@umijs/bundler-utils 4.0.0-rc.1 → 4.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/babel/index.js +27201 -18699
- package/compiled/babel/index1.js +50 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +15 -10
- package/package.json +25 -25
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
|
|
5
|
+
const babel = require("./babel-core");
|
|
6
|
+
|
|
7
|
+
const handleMessage = require("./handle-message");
|
|
8
|
+
|
|
9
|
+
const {
|
|
10
|
+
parentPort
|
|
11
|
+
} = require("worker_threads");
|
|
12
|
+
|
|
13
|
+
parentPort.addListener("message", function () {
|
|
14
|
+
var _ref = _asyncToGenerator(function* ({
|
|
15
|
+
signal,
|
|
16
|
+
port,
|
|
17
|
+
action,
|
|
18
|
+
payload
|
|
19
|
+
}) {
|
|
20
|
+
let response;
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
if (babel.init) yield babel.init;
|
|
24
|
+
response = {
|
|
25
|
+
result: yield handleMessage(action, payload)
|
|
26
|
+
};
|
|
27
|
+
} catch (error) {
|
|
28
|
+
response = {
|
|
29
|
+
error,
|
|
30
|
+
errorData: Object.assign({}, error)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
port.postMessage(response);
|
|
36
|
+
} catch (_unused) {
|
|
37
|
+
port.postMessage({
|
|
38
|
+
error: new Error("Cannot serialize worker response")
|
|
39
|
+
});
|
|
40
|
+
} finally {
|
|
41
|
+
port.close();
|
|
42
|
+
Atomics.store(signal, 0, 1);
|
|
43
|
+
Atomics.notify(signal, 0);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
return function (_x) {
|
|
48
|
+
return _ref.apply(this, arguments);
|
|
49
|
+
};
|
|
50
|
+
}());
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,8 @@ export declare function parseModule(opts: {
|
|
|
2
2
|
content: string;
|
|
3
3
|
path: string;
|
|
4
4
|
}): Promise<readonly [imports: readonly import("@umijs/bundler-utils/compiled/es-module-lexer").ImportSpecifier[], exports: readonly string[], facade: boolean]>;
|
|
5
|
+
export declare function parseModuleSync(opts: {
|
|
6
|
+
content: string;
|
|
7
|
+
path: string;
|
|
8
|
+
}): readonly [imports: readonly import("@umijs/bundler-utils/compiled/es-module-lexer").ImportSpecifier[], exports: readonly string[], facade: boolean];
|
|
5
9
|
export declare function isDepPath(path: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -9,27 +9,32 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.isDepPath = exports.parseModule = void 0;
|
|
12
|
+
exports.isDepPath = exports.parseModuleSync = exports.parseModule = void 0;
|
|
13
13
|
const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
|
|
14
14
|
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
15
|
+
const utils_1 = require("@umijs/utils");
|
|
15
16
|
const path_1 = require("path");
|
|
16
17
|
function parseModule(opts) {
|
|
17
18
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
let content = opts.content;
|
|
19
|
-
if (opts.path.endsWith('.tsx') || opts.path.endsWith('.jsx')) {
|
|
20
|
-
content = (0, esbuild_1.transformSync)(content, {
|
|
21
|
-
loader: (0, path_1.extname)(opts.path).slice(1),
|
|
22
|
-
format: 'esm',
|
|
23
|
-
}).code;
|
|
24
|
-
}
|
|
25
19
|
yield es_module_lexer_1.init;
|
|
26
|
-
return (
|
|
20
|
+
return parseModuleSync(opts);
|
|
27
21
|
});
|
|
28
22
|
}
|
|
29
23
|
exports.parseModule = parseModule;
|
|
24
|
+
function parseModuleSync(opts) {
|
|
25
|
+
let content = opts.content;
|
|
26
|
+
if (opts.path.endsWith('.tsx') || opts.path.endsWith('.jsx')) {
|
|
27
|
+
content = (0, esbuild_1.transformSync)(content, {
|
|
28
|
+
loader: (0, path_1.extname)(opts.path).slice(1),
|
|
29
|
+
format: 'esm',
|
|
30
|
+
}).code;
|
|
31
|
+
}
|
|
32
|
+
return (0, es_module_lexer_1.parse)(content);
|
|
33
|
+
}
|
|
34
|
+
exports.parseModuleSync = parseModuleSync;
|
|
30
35
|
function isDepPath(path) {
|
|
31
36
|
const umiMonorepoPaths = ['umi/packages/', 'umi-next/packages/'];
|
|
32
37
|
return (path.includes('node_modules') ||
|
|
33
|
-
umiMonorepoPaths.some((p) => path.includes(p)));
|
|
38
|
+
umiMonorepoPaths.some((p) => (0, utils_1.winPath)(path).includes(p)));
|
|
34
39
|
}
|
|
35
40
|
exports.isDepPath = isDepPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utils",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.2",
|
|
4
4
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-utils#readme",
|
|
5
5
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
6
6
|
"repository": {
|
|
@@ -20,33 +20,33 @@
|
|
|
20
20
|
"dev": "pnpm build -- --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@umijs/utils": "4.0.0-rc.
|
|
24
|
-
"esbuild": "0.14.
|
|
23
|
+
"@umijs/utils": "4.0.0-rc.2",
|
|
24
|
+
"esbuild": "0.14.22"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@babel/code-frame": "7.16.
|
|
28
|
-
"@babel/core": "7.
|
|
29
|
-
"@babel/generator": "7.
|
|
30
|
-
"@babel/helper-module-imports": "7.16.
|
|
31
|
-
"@babel/parser": "7.
|
|
32
|
-
"@babel/plugin-proposal-decorators": "7.
|
|
33
|
-
"@babel/plugin-proposal-do-expressions": "7.16.
|
|
34
|
-
"@babel/plugin-proposal-export-default-from": "7.16.
|
|
35
|
-
"@babel/plugin-proposal-export-namespace-from": "7.16.
|
|
36
|
-
"@babel/plugin-proposal-function-bind": "7.16.
|
|
37
|
-
"@babel/plugin-proposal-partial-application": "7.16.
|
|
38
|
-
"@babel/plugin-proposal-pipeline-operator": "7.16.
|
|
39
|
-
"@babel/plugin-proposal-record-and-tuple": "7.16.
|
|
40
|
-
"@babel/plugin-transform-runtime": "7.
|
|
41
|
-
"@babel/preset-env": "7.16.
|
|
42
|
-
"@babel/preset-react": "7.16.
|
|
43
|
-
"@babel/preset-typescript": "7.16.
|
|
44
|
-
"@babel/register": "7.
|
|
45
|
-
"@babel/template": "7.16.
|
|
46
|
-
"@babel/traverse": "7.
|
|
47
|
-
"@babel/types": "7.
|
|
27
|
+
"@babel/code-frame": "7.16.7",
|
|
28
|
+
"@babel/core": "7.17.5",
|
|
29
|
+
"@babel/generator": "7.17.3",
|
|
30
|
+
"@babel/helper-module-imports": "7.16.7",
|
|
31
|
+
"@babel/parser": "7.17.3",
|
|
32
|
+
"@babel/plugin-proposal-decorators": "7.17.2",
|
|
33
|
+
"@babel/plugin-proposal-do-expressions": "7.16.7",
|
|
34
|
+
"@babel/plugin-proposal-export-default-from": "7.16.7",
|
|
35
|
+
"@babel/plugin-proposal-export-namespace-from": "7.16.7",
|
|
36
|
+
"@babel/plugin-proposal-function-bind": "7.16.7",
|
|
37
|
+
"@babel/plugin-proposal-partial-application": "7.16.7",
|
|
38
|
+
"@babel/plugin-proposal-pipeline-operator": "7.16.7",
|
|
39
|
+
"@babel/plugin-proposal-record-and-tuple": "7.16.7",
|
|
40
|
+
"@babel/plugin-transform-runtime": "7.17.0",
|
|
41
|
+
"@babel/preset-env": "7.16.11",
|
|
42
|
+
"@babel/preset-react": "7.16.7",
|
|
43
|
+
"@babel/preset-typescript": "7.16.7",
|
|
44
|
+
"@babel/register": "7.17.0",
|
|
45
|
+
"@babel/template": "7.16.7",
|
|
46
|
+
"@babel/traverse": "7.17.3",
|
|
47
|
+
"@babel/types": "7.17.0",
|
|
48
48
|
"@types/babel__code-frame": "7.0.3",
|
|
49
|
-
"@types/babel__generator": "7.6.
|
|
49
|
+
"@types/babel__generator": "7.6.4",
|
|
50
50
|
"@types/babel__parser": "7.1.1",
|
|
51
51
|
"@types/babel__template": "7.4.1",
|
|
52
52
|
"@types/babel__traverse": "7.14.2",
|