@umijs/mfsu 4.0.0-beta.9 → 4.0.0-canary-20240513.3

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.
Files changed (74) hide show
  1. package/compiled/is-absolute-url/LICENSE +9 -0
  2. package/compiled/is-absolute-url/index.d.ts +20 -0
  3. package/compiled/is-absolute-url/index.js +1 -0
  4. package/compiled/is-absolute-url/package.json +1 -0
  5. package/compiled/mrmime/package.json +1 -1
  6. package/compiled/webpack-virtual-modules/index.js +1 -1
  7. package/compiled/webpack-virtual-modules/package.json +1 -1
  8. package/dist/babelPlugins/awaitImport/MFImport.d.ts +24 -0
  9. package/dist/babelPlugins/awaitImport/MFImport.js +66 -0
  10. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
  11. package/dist/babelPlugins/awaitImport/awaitImport.js +111 -112
  12. package/dist/babelPlugins/awaitImport/checkMatch.d.ts +3 -1
  13. package/dist/babelPlugins/awaitImport/checkMatch.js +166 -109
  14. package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +2 -2
  15. package/dist/babelPlugins/awaitImport/getAliasedPath.js +44 -33
  16. package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
  17. package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
  18. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +62 -47
  19. package/dist/constants.d.ts +1 -0
  20. package/dist/constants.js +50 -10
  21. package/dist/dep/dep.d.ts +7 -3
  22. package/dist/dep/dep.js +117 -95
  23. package/dist/dep/getCJSExports.js +83 -47
  24. package/dist/dep/getExposeFromContent.js +99 -74
  25. package/dist/dep/getModuleExports.js +58 -43
  26. package/dist/depBuilder/depBuilder.d.ts +6 -1
  27. package/dist/depBuilder/depBuilder.js +222 -159
  28. package/dist/depBuilder/getESBuildEntry.d.ts +1 -0
  29. package/dist/depBuilder/getESBuildEntry.js +50 -14
  30. package/dist/depInfo.d.ts +20 -5
  31. package/dist/depInfo.js +90 -39
  32. package/dist/esbuildHandlers/autoCssModules.d.ts +2 -0
  33. package/dist/esbuildHandlers/autoCssModules.js +48 -0
  34. package/dist/esbuildHandlers/awaitImport/index.d.ts +15 -0
  35. package/dist/esbuildHandlers/awaitImport/index.js +86 -0
  36. package/dist/index.d.ts +3 -1
  37. package/dist/index.js +35 -13
  38. package/dist/loader/esbuild.d.ts +5 -0
  39. package/dist/loader/esbuild.js +79 -0
  40. package/dist/mfsu/mfsu.d.ts +69 -0
  41. package/dist/mfsu/mfsu.js +319 -0
  42. package/dist/mfsu/strategyCompileTime.d.ts +20 -0
  43. package/dist/mfsu/strategyCompileTime.js +142 -0
  44. package/dist/mfsu/strategyStaticAnalyze.d.ts +24 -0
  45. package/dist/mfsu/strategyStaticAnalyze.js +196 -0
  46. package/dist/moduleGraph.d.ts +5 -8
  47. package/dist/moduleGraph.js +228 -178
  48. package/dist/staticDepInfo/importParser.d.ts +4 -0
  49. package/dist/staticDepInfo/importParser.js +28 -0
  50. package/dist/staticDepInfo/simulations/babel-plugin-import.d.ts +15 -0
  51. package/dist/staticDepInfo/simulations/babel-plugin-import.js +118 -0
  52. package/dist/staticDepInfo/staticDepInfo.d.ts +61 -0
  53. package/dist/staticDepInfo/staticDepInfo.js +274 -0
  54. package/dist/types.d.ts +12 -0
  55. package/dist/types.js +33 -8
  56. package/dist/utils/makeArray.js +29 -5
  57. package/dist/utils/resolveUtils.d.ts +1 -0
  58. package/dist/utils/resolveUtils.js +104 -0
  59. package/dist/utils/trimFileContent.js +29 -5
  60. package/dist/utils/webpackUtils.d.ts +3 -0
  61. package/dist/utils/webpackUtils.js +80 -0
  62. package/dist/webpackPlugins/buildDepPlugin.d.ts +4 -3
  63. package/dist/webpackPlugins/buildDepPlugin.js +61 -17
  64. package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +1 -1
  65. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +47 -19
  66. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +55 -27
  67. package/dist/webpackPlugins/writeCachePlugin.js +45 -15
  68. package/package.json +23 -19
  69. package/vendors/importParser/_importParser.js +683 -0
  70. package/vendors/importParser/importParser.jison +105 -0
  71. package/dist/babelPlugins/autoExport.d.ts +0 -7
  72. package/dist/babelPlugins/autoExport.js +0 -61
  73. package/dist/mfsu.d.ts +0 -54
  74. package/dist/mfsu.js +0 -179
@@ -1,17 +1,61 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuildDepPlugin = void 0;
4
- const PLUGIN_NAME = 'MFSUBuildDeps';
5
- class BuildDepPlugin {
6
- constructor(opts) {
7
- this.opts = opts;
8
- }
9
- apply(compiler) {
10
- compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
11
- if (!stats.hasErrors()) {
12
- this.opts.onCompileDone();
13
- }
14
- });
15
- }
16
- }
17
- exports.BuildDepPlugin = BuildDepPlugin;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/webpackPlugins/buildDepPlugin.ts
20
+ var buildDepPlugin_exports = {};
21
+ __export(buildDepPlugin_exports, {
22
+ BuildDepPlugin: () => BuildDepPlugin
23
+ });
24
+ module.exports = __toCommonJS(buildDepPlugin_exports);
25
+ var import_utils = require("@umijs/utils");
26
+ var PLUGIN_NAME = "MFSUBuildDeps";
27
+ var BuildDepPlugin = class {
28
+ constructor(opts) {
29
+ this.opts = opts;
30
+ }
31
+ apply(compiler) {
32
+ compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, (c) => {
33
+ var _a, _b;
34
+ import_utils.logger.debug(
35
+ "webpack watched change",
36
+ "modified: ",
37
+ c.modifiedFiles,
38
+ "removed: ",
39
+ c.removedFiles
40
+ );
41
+ return ((_b = (_a = this.opts).onFileChange) == null ? void 0 : _b.call(_a, c)) || Promise.resolve();
42
+ });
43
+ compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
44
+ var _a, _b;
45
+ if (this.opts.beforeCompile) {
46
+ return (_b = (_a = this.opts).beforeCompile) == null ? void 0 : _b.call(_a);
47
+ } else {
48
+ return Promise.resolve();
49
+ }
50
+ });
51
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
52
+ if (!stats.hasErrors()) {
53
+ this.opts.onCompileDone();
54
+ }
55
+ });
56
+ }
57
+ };
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ BuildDepPlugin
61
+ });
@@ -1,4 +1,4 @@
1
- import { Compiler } from 'webpack';
1
+ import type { Compiler } from 'webpack';
2
2
  export declare class DepChunkIdPrefixPlugin {
3
3
  constructor();
4
4
  apply(compiler: Compiler): void;
@@ -1,19 +1,47 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DepChunkIdPrefixPlugin = void 0;
4
- const constants_1 = require("../constants");
5
- const pluginId = 'MFSUDepChunkIdPrefix';
6
- class DepChunkIdPrefixPlugin {
7
- constructor() { }
8
- apply(compiler) {
9
- compiler.hooks.compilation.tap(pluginId, (compilation) => {
10
- compilation.hooks.afterOptimizeChunkIds.tap(pluginId, (chunks) => {
11
- for (const chunk of chunks) {
12
- chunk.id = constants_1.MF_DEP_PREFIX + chunk.id;
13
- chunk.ids = [chunk.id];
14
- }
15
- });
16
- });
17
- }
18
- }
19
- exports.DepChunkIdPrefixPlugin = DepChunkIdPrefixPlugin;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/webpackPlugins/depChunkIdPrefixPlugin.ts
20
+ var depChunkIdPrefixPlugin_exports = {};
21
+ __export(depChunkIdPrefixPlugin_exports, {
22
+ DepChunkIdPrefixPlugin: () => DepChunkIdPrefixPlugin
23
+ });
24
+ module.exports = __toCommonJS(depChunkIdPrefixPlugin_exports);
25
+ var import_constants = require("../constants");
26
+ var pluginId = "MFSUDepChunkIdPrefix";
27
+ var DepChunkIdPrefixPlugin = class {
28
+ constructor() {
29
+ }
30
+ apply(compiler) {
31
+ compiler.hooks.compilation.tap(pluginId, (compilation) => {
32
+ compilation.hooks.afterOptimizeChunkIds.tap(
33
+ pluginId,
34
+ (chunks) => {
35
+ for (const chunk of chunks) {
36
+ chunk.id = import_constants.MF_DEP_PREFIX + chunk.id;
37
+ chunk.ids = [chunk.id];
38
+ }
39
+ }
40
+ );
41
+ });
42
+ }
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ DepChunkIdPrefixPlugin
47
+ });
@@ -1,28 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StripSourceMapUrlPlugin = void 0;
4
- class StripSourceMapUrlPlugin {
5
- constructor(opts) {
6
- this.opts = opts;
7
- }
8
- apply(compiler) {
9
- compiler.hooks.compilation.tap('StripSourceMapUrlPlugin', (compilation) => {
10
- compilation.hooks.processAssets.tap({
11
- name: 'StripSourceMapUrlPlugin',
12
- stage: this.opts.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVE,
13
- }, (assets) => {
14
- Object.keys(assets)
15
- .filter((filename) => /\.js$/.test(filename))
16
- .forEach((filename) => {
17
- const asset = assets[filename];
18
- const source = asset
19
- .source()
20
- .toString()
21
- .replace(/# sourceMappingURL=(.+?\.map)/g, '# $1');
22
- compilation.updateAsset(filename, new this.opts.webpack.sources.RawSource(source));
23
- });
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/webpackPlugins/stripSourceMapUrlPlugin.ts
20
+ var stripSourceMapUrlPlugin_exports = {};
21
+ __export(stripSourceMapUrlPlugin_exports, {
22
+ StripSourceMapUrlPlugin: () => StripSourceMapUrlPlugin
23
+ });
24
+ module.exports = __toCommonJS(stripSourceMapUrlPlugin_exports);
25
+ var StripSourceMapUrlPlugin = class {
26
+ constructor(opts) {
27
+ this.opts = opts;
28
+ }
29
+ apply(compiler) {
30
+ compiler.hooks.compilation.tap(
31
+ "StripSourceMapUrlPlugin",
32
+ (compilation) => {
33
+ compilation.hooks.processAssets.tap(
34
+ {
35
+ name: "StripSourceMapUrlPlugin",
36
+ stage: this.opts.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVE
37
+ },
38
+ (assets) => {
39
+ Object.keys(assets).filter((filename) => /\.js$/.test(filename)).forEach((filename) => {
40
+ const asset = assets[filename];
41
+ const source = asset.source().toString().replace(/# sourceMappingURL=(.+?\.map)/g, "# $1");
42
+ compilation.updateAsset(
43
+ filename,
44
+ new this.opts.webpack.sources.RawSource(source)
45
+ );
24
46
  });
25
- });
26
- }
27
- }
28
- exports.StripSourceMapUrlPlugin = StripSourceMapUrlPlugin;
47
+ }
48
+ );
49
+ }
50
+ );
51
+ }
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ StripSourceMapUrlPlugin
56
+ });
@@ -1,15 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WriteCachePlugin = void 0;
4
- const PLUGIN_NAME = 'MFSUWriteCache';
5
- class WriteCachePlugin {
6
- constructor(opts) {
7
- this.opts = opts;
8
- }
9
- apply(compiler) {
10
- compiler.cache.hooks.store.tap({ name: PLUGIN_NAME, stage: /*Cache.STAGE_DISK*/ 10 }, () => {
11
- this.opts.onWriteCache();
12
- });
13
- }
14
- }
15
- exports.WriteCachePlugin = WriteCachePlugin;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/webpackPlugins/writeCachePlugin.ts
20
+ var writeCachePlugin_exports = {};
21
+ __export(writeCachePlugin_exports, {
22
+ WriteCachePlugin: () => WriteCachePlugin
23
+ });
24
+ module.exports = __toCommonJS(writeCachePlugin_exports);
25
+ var PLUGIN_NAME = "MFSUWriteCache";
26
+ var WriteCachePlugin = class {
27
+ constructor(opts) {
28
+ this.opts = opts;
29
+ }
30
+ apply(compiler) {
31
+ compiler.cache.hooks.store.tap(
32
+ { name: PLUGIN_NAME, stage: (
33
+ /*Cache.STAGE_DISK*/
34
+ 10
35
+ ) },
36
+ () => {
37
+ this.opts.onWriteCache();
38
+ }
39
+ );
40
+ }
41
+ };
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ WriteCachePlugin
45
+ });
package/package.json CHANGED
@@ -1,36 +1,33 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-canary-20240513.3",
4
4
  "description": "@umijs/mfsu",
5
- "homepage": "https://github.com/umijs/umi-next/tree/master/packages/mfsu#readme",
6
- "bugs": "https://github.com/umijs/umi-next/issues",
5
+ "homepage": "https://github.com/umijs/umi/tree/master/packages/mfsu#readme",
6
+ "bugs": "https://github.com/umijs/umi/issues",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/umijs/umi-next"
9
+ "url": "https://github.com/umijs/umi"
10
10
  },
11
11
  "license": "MIT",
12
12
  "main": "dist/index.js",
13
13
  "types": "dist/index.d.ts",
14
14
  "files": [
15
15
  "compiled",
16
- "dist"
16
+ "dist",
17
+ "vendors"
17
18
  ],
18
- "scripts": {
19
- "build": "pnpm tsc",
20
- "build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
21
- "dev": "pnpm build -- --watch"
22
- },
23
19
  "dependencies": {
24
- "@umijs/bundler-esbuild": "4.0.0-beta.9",
25
- "@umijs/bundler-utils": "4.0.0-beta.9",
26
- "@umijs/utils": "4.0.0-beta.9"
20
+ "enhanced-resolve": "5.9.3",
21
+ "is-equal": "^1.6.4",
22
+ "@umijs/bundler-esbuild": "4.0.0-canary-20240513.3",
23
+ "@umijs/bundler-utils": "4.0.0-canary-20240513.3",
24
+ "@umijs/utils": "4.0.0-canary-20240513.3"
27
25
  },
28
26
  "devDependencies": {
29
- "@types/express": "4.17.13",
30
- "enhanced-resolve": "5.8.3",
31
- "mrmime": "1.0.0",
32
- "webpack": "5.61.0",
33
- "webpack-virtual-modules": "0.4.3"
27
+ "is-absolute-url": "^4.0.1",
28
+ "mrmime": "1.0.1",
29
+ "webpack": "5.76.1",
30
+ "webpack-virtual-modules": "0.5.0"
34
31
  },
35
32
  "publishConfig": {
36
33
  "access": "public"
@@ -40,6 +37,7 @@
40
37
  ],
41
38
  "compiledConfig": {
42
39
  "deps": [
40
+ "is-absolute-url",
43
41
  "mrmime",
44
42
  "webpack-virtual-modules"
45
43
  ],
@@ -49,5 +47,11 @@
49
47
  "excludeDtsDeps": [
50
48
  "webpack-virtual-modules"
51
49
  ]
50
+ },
51
+ "scripts": {
52
+ "build": "umi-scripts father build",
53
+ "build:deps": "umi-scripts bundleDeps",
54
+ "dev": "umi-scripts father dev",
55
+ "test": "umi-scripts jest-turbo"
52
56
  }
53
- }
57
+ }