@umijs/mfsu 4.0.7 → 4.0.10

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 (40) hide show
  1. package/compiled/is-absolute-url/LICENSE +9 -0
  2. package/compiled/is-absolute-url/index.d.ts +22 -0
  3. package/compiled/is-absolute-url/index.js +1 -0
  4. package/compiled/is-absolute-url/package.json +1 -0
  5. package/dist/babelPlugins/awaitImport/MFImport.js +59 -66
  6. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
  7. package/dist/babelPlugins/awaitImport/awaitImport.js +103 -117
  8. package/dist/babelPlugins/awaitImport/checkMatch.js +131 -119
  9. package/dist/babelPlugins/awaitImport/getAliasedPath.js +54 -35
  10. package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
  11. package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
  12. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +51 -52
  13. package/dist/constants.js +47 -10
  14. package/dist/dep/dep.js +112 -83
  15. package/dist/dep/getCJSExports.js +60 -53
  16. package/dist/dep/getExposeFromContent.js +71 -59
  17. package/dist/dep/getModuleExports.js +58 -32
  18. package/dist/depBuilder/depBuilder.js +191 -158
  19. package/dist/depBuilder/getESBuildEntry.js +35 -12
  20. package/dist/depInfo.js +75 -53
  21. package/dist/esbuildHandlers/autoCssModules.js +43 -22
  22. package/dist/esbuildHandlers/awaitImport/index.js +82 -70
  23. package/dist/index.js +32 -22
  24. package/dist/loader/esbuild.js +87 -35
  25. package/dist/mfsu/mfsu.d.ts +5 -1
  26. package/dist/mfsu/mfsu.js +236 -257
  27. package/dist/mfsu/strategyCompileTime.js +131 -99
  28. package/dist/mfsu/strategyStaticAnalyze.js +151 -115
  29. package/dist/moduleGraph.js +227 -186
  30. package/dist/staticDepInfo/importParser.js +28 -6
  31. package/dist/staticDepInfo/simulations/babel-plugin-import.js +99 -91
  32. package/dist/staticDepInfo/staticDepInfo.js +239 -197
  33. package/dist/types.js +33 -8
  34. package/dist/utils/makeArray.js +29 -5
  35. package/dist/utils/trimFileContent.js +29 -5
  36. package/dist/webpackPlugins/buildDepPlugin.js +49 -25
  37. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +44 -19
  38. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +46 -27
  39. package/dist/webpackPlugins/writeCachePlugin.js +39 -15
  40. package/package.json +8 -6
@@ -1,19 +1,44 @@
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(pluginId, (chunks) => {
33
+ for (const chunk of chunks) {
34
+ chunk.id = import_constants.MF_DEP_PREFIX + chunk.id;
35
+ chunk.ids = [chunk.id];
36
+ }
37
+ });
38
+ });
39
+ }
40
+ };
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ DepChunkIdPrefixPlugin
44
+ });
@@ -1,28 +1,47 @@
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
- });
24
- });
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("StripSourceMapUrlPlugin", (compilation) => {
31
+ compilation.hooks.processAssets.tap({
32
+ name: "StripSourceMapUrlPlugin",
33
+ stage: this.opts.webpack.Compilation.PROCESS_ASSETS_STAGE_DERIVE
34
+ }, (assets) => {
35
+ Object.keys(assets).filter((filename) => /\.js$/.test(filename)).forEach((filename) => {
36
+ const asset = assets[filename];
37
+ const source = asset.source().toString().replace(/# sourceMappingURL=(.+?\.map)/g, "# $1");
38
+ compilation.updateAsset(filename, new this.opts.webpack.sources.RawSource(source));
25
39
  });
26
- }
27
- }
28
- exports.StripSourceMapUrlPlugin = StripSourceMapUrlPlugin;
40
+ });
41
+ });
42
+ }
43
+ };
44
+ // Annotate the CommonJS export names for ESM import in node:
45
+ 0 && (module.exports = {
46
+ StripSourceMapUrlPlugin
47
+ });
@@ -1,15 +1,39 @@
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({ name: PLUGIN_NAME, stage: 10 }, () => {
32
+ this.opts.onWriteCache();
33
+ });
34
+ }
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ WriteCachePlugin
39
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.7",
3
+ "version": "4.0.10",
4
4
  "description": "@umijs/mfsu",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/mfsu#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -17,19 +17,20 @@
17
17
  "vendors"
18
18
  ],
19
19
  "scripts": {
20
- "build": "pnpm tsc",
20
+ "build": "umi-scripts father build",
21
21
  "build:deps": "umi-scripts bundleDeps",
22
- "dev": "pnpm build --watch",
22
+ "dev": "umi-scripts father dev",
23
23
  "test": "umi-scripts jest-turbo"
24
24
  },
25
25
  "dependencies": {
26
- "@umijs/bundler-esbuild": "4.0.7",
27
- "@umijs/bundler-utils": "4.0.7",
28
- "@umijs/utils": "4.0.7",
26
+ "@umijs/bundler-esbuild": "4.0.10",
27
+ "@umijs/bundler-utils": "4.0.10",
28
+ "@umijs/utils": "4.0.10",
29
29
  "enhanced-resolve": "5.9.3",
30
30
  "is-equal": "^1.6.4"
31
31
  },
32
32
  "devDependencies": {
33
+ "is-absolute-url": "^3.0.3",
33
34
  "mrmime": "1.0.0",
34
35
  "webpack": "5.72.1",
35
36
  "webpack-virtual-modules": "0.4.3"
@@ -42,6 +43,7 @@
42
43
  ],
43
44
  "compiledConfig": {
44
45
  "deps": [
46
+ "is-absolute-url",
45
47
  "mrmime",
46
48
  "webpack-virtual-modules"
47
49
  ],