@umijs/mfsu 4.0.5 → 4.0.8

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 (67) hide show
  1. package/dist/babelPlugins/awaitImport/MFImport.d.ts +0 -0
  2. package/dist/babelPlugins/awaitImport/MFImport.js +59 -66
  3. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
  4. package/dist/babelPlugins/awaitImport/awaitImport.js +103 -117
  5. package/dist/babelPlugins/awaitImport/checkMatch.d.ts +0 -0
  6. package/dist/babelPlugins/awaitImport/checkMatch.js +18 -3
  7. package/dist/babelPlugins/awaitImport/getAliasedPath.d.ts +0 -0
  8. package/dist/babelPlugins/awaitImport/getAliasedPath.js +54 -35
  9. package/dist/babelPlugins/awaitImport/getRealPath.d.ts +0 -0
  10. package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
  11. package/dist/babelPlugins/awaitImport/isExternals.d.ts +0 -0
  12. package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
  13. package/dist/babelPlugins/awaitImport/parseSpecifiers.d.ts +0 -0
  14. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +51 -52
  15. package/dist/constants.d.ts +0 -0
  16. package/dist/constants.js +47 -10
  17. package/dist/dep/dep.d.ts +0 -0
  18. package/dist/dep/dep.js +0 -0
  19. package/dist/dep/getCJSExports.d.ts +0 -0
  20. package/dist/dep/getCJSExports.js +60 -53
  21. package/dist/dep/getExposeFromContent.d.ts +0 -0
  22. package/dist/dep/getExposeFromContent.js +71 -59
  23. package/dist/dep/getModuleExports.d.ts +0 -0
  24. package/dist/dep/getModuleExports.js +58 -32
  25. package/dist/depBuilder/depBuilder.d.ts +0 -0
  26. package/dist/depBuilder/depBuilder.js +0 -0
  27. package/dist/depBuilder/getESBuildEntry.d.ts +0 -0
  28. package/dist/depBuilder/getESBuildEntry.js +35 -12
  29. package/dist/depInfo.d.ts +0 -0
  30. package/dist/depInfo.js +0 -0
  31. package/dist/esbuildHandlers/autoCssModules.d.ts +0 -0
  32. package/dist/esbuildHandlers/autoCssModules.js +0 -0
  33. package/dist/esbuildHandlers/awaitImport/index.d.ts +0 -0
  34. package/dist/esbuildHandlers/awaitImport/index.js +82 -70
  35. package/dist/index.d.ts +0 -0
  36. package/dist/index.js +32 -22
  37. package/dist/loader/esbuild.d.ts +0 -0
  38. package/dist/loader/esbuild.js +87 -35
  39. package/dist/mfsu/mfsu.d.ts +1 -1
  40. package/dist/mfsu/mfsu.js +1 -1
  41. package/dist/mfsu/strategyCompileTime.d.ts +0 -0
  42. package/dist/mfsu/strategyCompileTime.js +1 -1
  43. package/dist/mfsu/strategyStaticAnalyze.d.ts +0 -0
  44. package/dist/mfsu/strategyStaticAnalyze.js +1 -2
  45. package/dist/moduleGraph.d.ts +0 -0
  46. package/dist/moduleGraph.js +0 -0
  47. package/dist/staticDepInfo/importParser.d.ts +0 -0
  48. package/dist/staticDepInfo/importParser.js +28 -6
  49. package/dist/staticDepInfo/simulations/babel-plugin-import.d.ts +0 -0
  50. package/dist/staticDepInfo/simulations/babel-plugin-import.js +0 -0
  51. package/dist/staticDepInfo/staticDepInfo.d.ts +0 -0
  52. package/dist/staticDepInfo/staticDepInfo.js +8 -0
  53. package/dist/types.d.ts +0 -0
  54. package/dist/types.js +33 -8
  55. package/dist/utils/makeArray.d.ts +0 -0
  56. package/dist/utils/makeArray.js +29 -5
  57. package/dist/utils/trimFileContent.d.ts +0 -0
  58. package/dist/utils/trimFileContent.js +29 -5
  59. package/dist/webpackPlugins/buildDepPlugin.d.ts +0 -0
  60. package/dist/webpackPlugins/buildDepPlugin.js +49 -25
  61. package/dist/webpackPlugins/depChunkIdPrefixPlugin.d.ts +0 -0
  62. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +44 -19
  63. package/dist/webpackPlugins/stripSourceMapUrlPlugin.d.ts +0 -0
  64. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +46 -27
  65. package/dist/webpackPlugins/writeCachePlugin.d.ts +0 -0
  66. package/dist/webpackPlugins/writeCachePlugin.js +39 -15
  67. package/package.json +6 -6
@@ -1,7 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trimFileContent = void 0;
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
+ // trimFileContent.ts
20
+ var trimFileContent_exports = {};
21
+ __export(trimFileContent_exports, {
22
+ trimFileContent: () => trimFileContent
23
+ });
24
+ module.exports = __toCommonJS(trimFileContent_exports);
4
25
  function trimFileContent(content) {
5
- return content.trim() + '\n';
26
+ return content.trim() + "\n";
6
27
  }
7
- exports.trimFileContent = trimFileContent;
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ trimFileContent
31
+ });
File without changes
@@ -1,25 +1,49 @@
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.watchRun.tapPromise(PLUGIN_NAME, (c) => {
11
- var _a, _b;
12
- return ((_b = (_a = this.opts).onFileChange) === null || _b === void 0 ? void 0 : _b.call(_a, c)) || Promise.resolve();
13
- });
14
- compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
15
- var _a, _b;
16
- (_b = (_a = this.opts).beforeCompile) === null || _b === void 0 ? void 0 : _b.call(_a);
17
- });
18
- compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
19
- if (!stats.hasErrors()) {
20
- this.opts.onCompileDone();
21
- }
22
- });
23
- }
24
- }
25
- 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
+ // buildDepPlugin.ts
20
+ var buildDepPlugin_exports = {};
21
+ __export(buildDepPlugin_exports, {
22
+ BuildDepPlugin: () => BuildDepPlugin
23
+ });
24
+ module.exports = __toCommonJS(buildDepPlugin_exports);
25
+ var PLUGIN_NAME = "MFSUBuildDeps";
26
+ var BuildDepPlugin = class {
27
+ constructor(opts) {
28
+ this.opts = opts;
29
+ }
30
+ apply(compiler) {
31
+ compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, (c) => {
32
+ var _a, _b;
33
+ return ((_b = (_a = this.opts).onFileChange) == null ? void 0 : _b.call(_a, c)) || Promise.resolve();
34
+ });
35
+ compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
36
+ var _a, _b;
37
+ (_b = (_a = this.opts).beforeCompile) == null ? void 0 : _b.call(_a);
38
+ });
39
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
40
+ if (!stats.hasErrors()) {
41
+ this.opts.onCompileDone();
42
+ }
43
+ });
44
+ }
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ BuildDepPlugin
49
+ });
File without changes
@@ -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
+ // 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
+ });
File without changes
@@ -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
+ // 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
+ });
File without changes
@@ -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
+ // 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.5",
3
+ "version": "4.0.8",
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,15 +17,15 @@
17
17
  "vendors"
18
18
  ],
19
19
  "scripts": {
20
- "build": "pnpm tsc",
20
+ "build": "pnpm father build",
21
21
  "build:deps": "umi-scripts bundleDeps",
22
- "dev": "pnpm build --watch",
22
+ "dev": "pnpm father dev",
23
23
  "test": "umi-scripts jest-turbo"
24
24
  },
25
25
  "dependencies": {
26
- "@umijs/bundler-esbuild": "4.0.5",
27
- "@umijs/bundler-utils": "4.0.5",
28
- "@umijs/utils": "4.0.5",
26
+ "@umijs/bundler-esbuild": "4.0.8",
27
+ "@umijs/bundler-utils": "4.0.8",
28
+ "@umijs/utils": "4.0.8",
29
29
  "enhanced-resolve": "5.9.3",
30
30
  "is-equal": "^1.6.4"
31
31
  },