@umijs/bundler-utils 4.0.0-beta.6 → 4.0.0-rc.1

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/dist/index.d.ts CHANGED
@@ -1,2 +1,5 @@
1
- declare const _default: () => string;
2
- export default _default;
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]>;
5
+ export declare function isDepPath(path: string): boolean;
package/dist/index.js CHANGED
@@ -1,5 +1,35 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = () => {
4
- return '@umijs/bundler-utils';
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.isDepPath = 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;
30
+ function isDepPath(path) {
31
+ const umiMonorepoPaths = ['umi/packages/', 'umi-next/packages/'];
32
+ return (path.includes('node_modules') ||
33
+ umiMonorepoPaths.some((p) => path.includes(p)));
34
+ }
35
+ exports.isDepPath = isDepPath;
package/package.json CHANGED
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "@umijs/bundler-utils",
3
- "version": "4.0.0-beta.6",
3
+ "version": "4.0.0-rc.1",
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,29 +19,17 @@
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.6",
30
- "esbuild": "0.13.11"
23
+ "@umijs/utils": "4.0.0-rc.1",
24
+ "esbuild": "0.14.1"
31
25
  },
32
26
  "devDependencies": {
33
27
  "@babel/code-frame": "7.16.0",
34
28
  "@babel/core": "7.16.0",
35
29
  "@babel/generator": "7.16.0",
36
- "@babel/parser": "7.16.0",
37
- "@babel/plugin-proposal-decorators": "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",
38
33
  "@babel/plugin-proposal-do-expressions": "7.16.0",
39
34
  "@babel/plugin-proposal-export-default-from": "7.16.0",
40
35
  "@babel/plugin-proposal-export-namespace-from": "7.16.0",
@@ -42,13 +37,13 @@
42
37
  "@babel/plugin-proposal-partial-application": "7.16.0",
43
38
  "@babel/plugin-proposal-pipeline-operator": "7.16.0",
44
39
  "@babel/plugin-proposal-record-and-tuple": "7.16.0",
45
- "@babel/plugin-transform-runtime": "7.16.0",
46
- "@babel/preset-env": "7.16.0",
40
+ "@babel/plugin-transform-runtime": "7.16.4",
41
+ "@babel/preset-env": "7.16.4",
47
42
  "@babel/preset-react": "7.16.0",
48
43
  "@babel/preset-typescript": "7.16.0",
49
44
  "@babel/register": "7.16.0",
50
45
  "@babel/template": "7.16.0",
51
- "@babel/traverse": "7.16.0",
46
+ "@babel/traverse": "7.16.3",
52
47
  "@babel/types": "7.16.0",
53
48
  "@types/babel__code-frame": "7.0.3",
54
49
  "@types/babel__generator": "7.6.3",
@@ -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",