Quellcode durchsuchen

Add url as a polyfill dependency for apputils.

We could have also added it in apputils-extension or in the main jlab build instead (given that it is a polyfill for the browser, so only used when actually bundling code with webpack). However, it may be most convenient as a dependency for apputils.

Fixes #8657
Jason Grout vor 4 Jahren
Ursprung
Commit
aded4275bb

+ 2 - 1
buildutils/src/ensure-repo.ts

@@ -29,7 +29,8 @@ const MISSING: Dict<string[]> = {
 };
 
 const UNUSED: Dict<string[]> = {
-  '@jupyterlab/apputils': ['@types/react'],
+  // url is a polyfill for sanitize-html
+  '@jupyterlab/apputils': ['@types/react', 'url'],
   '@jupyterlab/application': ['@fortawesome/fontawesome-free'],
   '@jupyterlab/apputils-extension': ['es6-promise'],
   '@jupyterlab/services': ['node-fetch', 'ws'],

+ 2 - 1
packages/apputils/package.json

@@ -58,7 +58,8 @@
     "@types/react": "~16.9.16",
     "react": "~16.9.0",
     "react-dom": "~16.9.0",
-    "sanitize-html": "~1.20.1"
+    "sanitize-html": "~1.20.1",
+    "url": "^0.11.0"
   },
   "devDependencies": {
     "@jupyterlab/testutils": "^3.0.0-alpha.1",

+ 3 - 0
packages/apputils/src/sanitizer.ts

@@ -1,5 +1,8 @@
 // Copyright (c) Jupyter Development Team.
 // Distributed under the terms of the Modified BSD License.
+
+// sanitize-html uses the url package, so we depend on a standalone version of
+// it which acts as a polyfill for browsers.
 import sanitize from 'sanitize-html';
 
 export interface ISanitizer {