Ver Fonte

Remove babel rewriting

Alex Dima há 7 anos atrás
pai
commit
c19aff59af
3 ficheiros alterados com 4 adições e 41 exclusões
  1. 3 3
      package-lock.json
  2. 1 1
      package.json
  3. 0 37
      webpack/index.js

+ 3 - 3
package-lock.json

@@ -2759,9 +2759,9 @@
       "dev": true
     },
     "monaco-editor-core": {
-      "version": "0.11.6",
-      "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.6.tgz",
-      "integrity": "sha512-WGJnnmtSY7qRYLRBOL23+pdQR6flUNKPAkREscc/ctiNRJHCqo0jFiSvuqh4VMfoVGkyprGCEjkBc+8/7nQuEA==",
+      "version": "0.11.7",
+      "resolved": "https://registry.npmjs.org/monaco-editor-core/-/monaco-editor-core-0.11.7.tgz",
+      "integrity": "sha512-dWg+HmIAIl0LPSeyzN6CAtM//k9isMOrVsbg6ffwWOT7V8z7tDG50KW7F22i4N4vPu+KQdGF9BY/Ui0EFFRUkw==",
       "dev": true
     },
     "monaco-html": {

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
     "http-server": "^0.11.1",
     "loader-utils": "1.1.0",
     "monaco-css": "2.0.1",
-    "monaco-editor-core": "0.11.6",
+    "monaco-editor-core": "^0.11.7",
     "monaco-html": "2.0.2",
     "monaco-json": "2.0.1",
     "monaco-languages": "1.0.4",

+ 0 - 37
webpack/index.js

@@ -114,21 +114,6 @@ function createLoaderRules(languages, features, workers, publicPath) {
         },
       ],
     },
-    // HACK: This loader can be removed if the self.require() call in editorSimpleWorker.ts is
-    // replaced with a global require() call
-    {
-      test: WORKER_LOADER_PATH,
-      use: [
-        {
-          loader: require.resolve('babel-loader'),
-          options: {
-            plugins: [
-              replaceSelfRequireWithGlobalRequire(),
-            ],
-          },
-        },
-      ],
-    },
   ];
 }
 
@@ -166,28 +151,6 @@ function createEntryPointPlugin(webpack, id, entry, output) {
   return new AddWorkerEntryPointPlugin(webpack, { id, entry, output });
 }
 
-function replaceSelfRequireWithGlobalRequire() {
-	return (babel) => {
-		const { types: t } = babel;
-		return {
-			visitor: {
-				CallExpression(path) {
-					const { node } = path;
-					const isSelfRequireExpression = (
-						t.isMemberExpression(node.callee)
-						&& t.isIdentifier(node.callee.object, { name: 'self' })
-						&& t.isIdentifier(node.callee.property, { name: 'require' })
-						&& t.isArrayExpression(node.arguments[0])
-						&& t.isFunction(node.arguments[1])
-					);
-					if (!isSelfRequireExpression) { return; }
-					path.get('callee').replaceWith(t.identifier('require'));
-				}
-			},
-		};
-	};
-}
-
 function flatMap(items, iteratee) {
   return items.map(iteratee).reduce((acc, item) => [...acc, ...item], []);
 }