@umijs/bundler-utils 4.0.0-beta.1 → 4.0.0-beta.13
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/parser/typings/babel-parser.d.ts +2 -1
- package/compiled/@babel/types/lib/index-legacy.d.ts +23 -10
- package/compiled/babel/helper-module-imports.d.ts +3 -0
- package/compiled/babel/helper-module-imports.js +1 -0
- package/compiled/babel/index.js +45226 -87587
- package/compiled/babel/source-map-support.js +25 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.js +27 -3
- package/package.json +37 -36
|
@@ -59,6 +59,26 @@ function hasGlobalProcessEventEmitter() {
|
|
|
59
59
|
return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function globalProcessVersion() {
|
|
63
|
+
if ((typeof process === 'object') && (process !== null)) {
|
|
64
|
+
return process.version;
|
|
65
|
+
} else {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function globalProcessStderr() {
|
|
71
|
+
if ((typeof process === 'object') && (process !== null)) {
|
|
72
|
+
return process.stderr;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function globalProcessExit(code) {
|
|
77
|
+
if ((typeof process === 'object') && (process !== null) && (typeof process.exit === 'function')) {
|
|
78
|
+
return process.exit(code);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
62
82
|
function handlerExec(list) {
|
|
63
83
|
return function(arg) {
|
|
64
84
|
for (var i = 0; i < list.length; i++) {
|
|
@@ -369,7 +389,7 @@ function wrapCallSite(frame, state) {
|
|
|
369
389
|
// v11 is not an LTS candidate, we can just test the one version with it.
|
|
370
390
|
// Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11
|
|
371
391
|
var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/;
|
|
372
|
-
var headerLength = noHeader.test(
|
|
392
|
+
var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;
|
|
373
393
|
if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {
|
|
374
394
|
column -= headerLength;
|
|
375
395
|
}
|
|
@@ -466,8 +486,9 @@ function printErrorAndExit (error) {
|
|
|
466
486
|
var source = getErrorSource(error);
|
|
467
487
|
|
|
468
488
|
// Ensure error is printed synchronously and not truncated
|
|
469
|
-
|
|
470
|
-
|
|
489
|
+
var stderr = globalProcessStderr();
|
|
490
|
+
if (stderr && stderr._handle && stderr._handle.setBlocking) {
|
|
491
|
+
stderr._handle.setBlocking(true);
|
|
471
492
|
}
|
|
472
493
|
|
|
473
494
|
if (source) {
|
|
@@ -476,7 +497,7 @@ function printErrorAndExit (error) {
|
|
|
476
497
|
}
|
|
477
498
|
|
|
478
499
|
console.error(error.stack);
|
|
479
|
-
|
|
500
|
+
globalProcessExit(1);
|
|
480
501
|
}
|
|
481
502
|
|
|
482
503
|
function shimEmitUncaughtException () {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
declare
|
|
2
|
-
|
|
1
|
+
export declare function parseModule(opts: {
|
|
2
|
+
content: string;
|
|
3
|
+
path: string;
|
|
4
|
+
}): Promise<readonly [imports: readonly import("@umijs/bundler-utils/compiled/es-module-lexer").ImportSpecifier[], exports: readonly string[], facade: boolean]>;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
return
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
5
10
|
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.parseModule = void 0;
|
|
13
|
+
const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
|
|
14
|
+
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
15
|
+
const path_1 = require("path");
|
|
16
|
+
function parseModule(opts) {
|
|
17
|
+
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
|
+
yield es_module_lexer_1.init;
|
|
26
|
+
return (0, es_module_lexer_1.parse)(content);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.parseModule = parseModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-utils",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.13",
|
|
4
|
+
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-utils#readme",
|
|
5
|
+
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/umijs/umi-next"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
4
11
|
"main": "dist/index.js",
|
|
5
12
|
"types": "dist/index.d.ts",
|
|
6
13
|
"files": [
|
|
@@ -12,44 +19,32 @@
|
|
|
12
19
|
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
|
|
13
20
|
"dev": "pnpm build -- --watch"
|
|
14
21
|
},
|
|
15
|
-
"repository": {
|
|
16
|
-
"type": "git",
|
|
17
|
-
"url": "https://github.com/umijs/umi-next"
|
|
18
|
-
},
|
|
19
|
-
"authors": [
|
|
20
|
-
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
21
|
-
],
|
|
22
|
-
"license": "MIT",
|
|
23
|
-
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
24
|
-
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-utils#readme",
|
|
25
|
-
"publishConfig": {
|
|
26
|
-
"access": "public"
|
|
27
|
-
},
|
|
28
22
|
"dependencies": {
|
|
29
|
-
"@umijs/utils": "4.0.0-beta.
|
|
30
|
-
"esbuild": "0.
|
|
23
|
+
"@umijs/utils": "4.0.0-beta.13",
|
|
24
|
+
"esbuild": "0.14.1"
|
|
31
25
|
},
|
|
32
26
|
"devDependencies": {
|
|
33
|
-
"@babel/code-frame": "7.
|
|
34
|
-
"@babel/core": "7.
|
|
35
|
-
"@babel/generator": "7.
|
|
36
|
-
"@babel/
|
|
37
|
-
"@babel/
|
|
38
|
-
"@babel/plugin-proposal-
|
|
39
|
-
"@babel/plugin-proposal-
|
|
40
|
-
"@babel/plugin-proposal-export-
|
|
41
|
-
"@babel/plugin-proposal-
|
|
42
|
-
"@babel/plugin-proposal-
|
|
43
|
-
"@babel/plugin-proposal-
|
|
44
|
-
"@babel/plugin-proposal-
|
|
45
|
-
"@babel/plugin-
|
|
46
|
-
"@babel/
|
|
47
|
-
"@babel/preset-
|
|
48
|
-
"@babel/preset-
|
|
49
|
-
"@babel/
|
|
50
|
-
"@babel/
|
|
51
|
-
"@babel/
|
|
52
|
-
"@babel/
|
|
27
|
+
"@babel/code-frame": "7.16.0",
|
|
28
|
+
"@babel/core": "7.16.0",
|
|
29
|
+
"@babel/generator": "7.16.0",
|
|
30
|
+
"@babel/helper-module-imports": "7.16.0",
|
|
31
|
+
"@babel/parser": "7.16.4",
|
|
32
|
+
"@babel/plugin-proposal-decorators": "7.16.4",
|
|
33
|
+
"@babel/plugin-proposal-do-expressions": "7.16.0",
|
|
34
|
+
"@babel/plugin-proposal-export-default-from": "7.16.0",
|
|
35
|
+
"@babel/plugin-proposal-export-namespace-from": "7.16.0",
|
|
36
|
+
"@babel/plugin-proposal-function-bind": "7.16.0",
|
|
37
|
+
"@babel/plugin-proposal-partial-application": "7.16.0",
|
|
38
|
+
"@babel/plugin-proposal-pipeline-operator": "7.16.0",
|
|
39
|
+
"@babel/plugin-proposal-record-and-tuple": "7.16.0",
|
|
40
|
+
"@babel/plugin-transform-runtime": "7.16.4",
|
|
41
|
+
"@babel/preset-env": "7.16.4",
|
|
42
|
+
"@babel/preset-react": "7.16.0",
|
|
43
|
+
"@babel/preset-typescript": "7.16.0",
|
|
44
|
+
"@babel/register": "7.16.0",
|
|
45
|
+
"@babel/template": "7.16.0",
|
|
46
|
+
"@babel/traverse": "7.16.3",
|
|
47
|
+
"@babel/types": "7.16.0",
|
|
53
48
|
"@types/babel__code-frame": "7.0.3",
|
|
54
49
|
"@types/babel__generator": "7.6.3",
|
|
55
50
|
"@types/babel__parser": "7.1.1",
|
|
@@ -58,6 +53,12 @@
|
|
|
58
53
|
"cjs-module-lexer": "1.2.2",
|
|
59
54
|
"es-module-lexer": "0.9.3"
|
|
60
55
|
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"authors": [
|
|
60
|
+
"chencheng <sorrycc@gmail.com> (https://github.com/sorrycc)"
|
|
61
|
+
],
|
|
61
62
|
"compiledConfig": {
|
|
62
63
|
"deps": [
|
|
63
64
|
"cjs-module-lexer",
|