@umijs/mfsu 4.0.0-canary.20230216.1 → 4.0.0-canary.20230223.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.
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -53,6 +57,7 @@ function awaitImport_default() {
53
57
  const node = path.node.body[index];
54
58
  if (t.isImportDeclaration(node)) {
55
59
  const { isMatch, replaceValue } = (0, import_checkMatch.checkMatch)({
60
+ // @ts-ignore
56
61
  cache: this.cache,
57
62
  value: node.source.value,
58
63
  opts,
@@ -63,6 +68,7 @@ function awaitImport_default() {
63
68
  }
64
69
  } else if (t.isExportAllDeclaration(node)) {
65
70
  const { isMatch, replaceValue } = (0, import_checkMatch.checkMatch)({
71
+ // @ts-ignore
66
72
  cache: this.cache,
67
73
  value: node.source.value,
68
74
  opts,
@@ -73,6 +79,7 @@ function awaitImport_default() {
73
79
  }
74
80
  } else if (t.isExportNamedDeclaration(node) && node.source) {
75
81
  const { isMatch, replaceValue } = (0, import_checkMatch.checkMatch)({
82
+ // @ts-ignore
76
83
  cache: this.cache,
77
84
  value: node.source.value,
78
85
  opts,
@@ -91,6 +98,7 @@ function awaitImport_default() {
91
98
  const { node } = path;
92
99
  if (t.isImport(node.callee) && node.arguments.length === 1 && node.arguments[0].type === "StringLiteral") {
93
100
  const { isMatch, replaceValue } = (0, import_checkMatch.checkMatch)({
101
+ // @ts-ignore
94
102
  cache: this.cache,
95
103
  value: node.arguments[0].value,
96
104
  opts,
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -73,7 +77,17 @@ function checkMatch({
73
77
  value = value.replace(/^@fs\//, "/");
74
78
  const unMatchLibsRegex = genUnMatchLibsRegex(opts.unMatchLibs);
75
79
  const mfPathInitial = `${remoteName}/`;
76
- if ((unMatchLibsRegex == null ? void 0 : unMatchLibsRegex.test(value)) || value.includes("client/client/client.js") || (0, import_utils.winPath)(value).includes("babel/svgr-webpack") || value.startsWith("!!") || (0, import_isExternals.isExternals)({ value, externals: opts.externals }) || value.startsWith(".")) {
80
+ if (
81
+ // unMatch specified libs
82
+ (unMatchLibsRegex == null ? void 0 : unMatchLibsRegex.test(value)) || // do not match bundler-webpack/client/client/client.js
83
+ value.includes("client/client/client.js") || // don't match dynamic path
84
+ // e.g. @umijs/deps/compiled/babel/svgr-webpack.js?-svgo,+titleProp,+ref!./umi.svg
85
+ (0, import_utils.winPath)(value).includes("babel/svgr-webpack") || // don't match webpack loader
86
+ // e.g. !!dumi-raw-code-loader!/path/to/VerticalProgress/index.module.less?dumi-raw-code
87
+ value.startsWith("!!") || // don't match externals
88
+ (0, import_isExternals.isExternals)({ value, externals: opts.externals }) || // relative import
89
+ value.startsWith(".")
90
+ ) {
77
91
  isMatch = false;
78
92
  } else if (value.startsWith(mfPathInitial)) {
79
93
  isMatch = true;
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
package/dist/dep/dep.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -27,13 +27,19 @@ function getCJSExports({ content }) {
27
27
  /Object\.defineProperty\(\s*exports\s*\,\s*[\"|\'](\w+)[\"|\']/g,
28
28
  content
29
29
  ).concat(
30
+ // Support export['default']
31
+ // ref: https://unpkg.alibaba-inc.com/browse/echarts-for-react@2.0.16/lib/core.js
30
32
  matchAll(
31
33
  /exports(?:\.|\[(?:\'|\"))(\w+)(?:\s*|(?:\'|\")\])\s*\=/g,
32
34
  content
33
35
  )
34
36
  ).concat(
37
+ // Support __webpack_exports__["default"]
38
+ // ref: https://github.com/margox/braft-editor/blob/master/dist/index.js#L8429
35
39
  matchAll(/__webpack_exports__\[(?:\"|\')(\w+)(?:\"|\')\]\s*\=/g, content)
36
40
  ).concat(
41
+ // Support __webpack_require__.d(__webpack_exports, "EditorState")
42
+ // ref: https://github.com/margox/braft-editor/blob/master/dist/index.js#L8347
37
43
  matchAll(
38
44
  /__webpack_require__\.d\(\s*__webpack_exports__\s*,\s*(?:\"|\')(\w+)(?:\"|\')\s*,/g,
39
45
  content
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -66,7 +70,10 @@ export default _;`.trim();
66
70
  ret.push(`export default _;`);
67
71
  hasExports = true;
68
72
  }
69
- if (hasNonDefaultExports(exports) || /export\s*\*\s*from/.test(opts.content)) {
73
+ if (hasNonDefaultExports(exports) || // export * from 不会有 exports,只会有 imports
74
+ // case: export*from'.'
75
+ // export * from '.'
76
+ /export\s*\*\s*from/.test(opts.content)) {
70
77
  ret.push(`export * from '${importPath}';`);
71
78
  hasExports = true;
72
79
  }
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -104,6 +108,7 @@ var StrategyCompileTime = class {
104
108
  }) => {
105
109
  this.depInfo.moduleGraph.onFileChange({
106
110
  file,
111
+ // @ts-ignore
107
112
  deps: [
108
113
  ...Array.from(data.matched).map((item) => ({
109
114
  file: item.sourceValue,
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -60,6 +64,7 @@ function getResolver(opts) {
60
64
  const context = opts.context ?? process.cwd();
61
65
  const resolveDefaults = {
62
66
  extensions: [".tsx", ".ts", ".jsx", ".js"],
67
+ // keep same with previous mfsu version
63
68
  roots: [context]
64
69
  };
65
70
  const mergedResolve = import_webpack.util.cleverMerge(resolveDefaults, opts.resolve);
@@ -29,7 +29,10 @@ var WriteCachePlugin = class {
29
29
  }
30
30
  apply(compiler) {
31
31
  compiler.cache.hooks.store.tap(
32
- { name: PLUGIN_NAME, stage: 10 },
32
+ { name: PLUGIN_NAME, stage: (
33
+ /*Cache.STAGE_DISK*/
34
+ 10
35
+ ) },
33
36
  () => {
34
37
  this.opts.onWriteCache();
35
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/mfsu",
3
- "version": "4.0.0-canary.20230216.1",
3
+ "version": "4.0.0-canary.20230223.1",
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",
@@ -23,9 +23,9 @@
23
23
  "test": "umi-scripts jest-turbo"
24
24
  },
25
25
  "dependencies": {
26
- "@umijs/bundler-esbuild": "4.0.0-canary.20230216.1",
27
- "@umijs/bundler-utils": "4.0.0-canary.20230216.1",
28
- "@umijs/utils": "4.0.0-canary.20230216.1",
26
+ "@umijs/bundler-esbuild": "4.0.0-canary.20230223.1",
27
+ "@umijs/bundler-utils": "4.0.0-canary.20230223.1",
28
+ "@umijs/utils": "4.0.0-canary.20230223.1",
29
29
  "enhanced-resolve": "5.9.3",
30
30
  "is-equal": "^1.6.4"
31
31
  },