@module-federation/data-prefetch 0.0.0-fix-lazy-comile-20250925082726 → 0.0.0-fix-lazy-comile-20250929064217
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/babel.cjs.cjs +23 -15
- package/dist/babel.cjs.cjs.map +1 -1
- package/dist/babel.esm.js +23 -15
- package/dist/babel.esm.js.map +1 -1
- package/dist/cli.cjs.cjs +37 -40
- package/dist/cli.cjs.cjs.map +1 -1
- package/dist/cli.esm.js +37 -40
- package/dist/cli.esm.js.map +1 -1
- package/dist/constant.cjs.cjs.map +1 -1
- package/dist/constant.esm.js.map +1 -1
- package/dist/index.cjs2.cjs.map +1 -1
- package/dist/index.esm2.js.map +1 -1
- package/dist/plugin.cjs.cjs +131 -131
- package/dist/plugin.cjs.cjs.map +1 -1
- package/dist/plugin.esm.js +131 -131
- package/dist/plugin.esm.js.map +1 -1
- package/dist/prefetch.cjs.cjs +49 -61
- package/dist/prefetch.cjs.cjs.map +1 -1
- package/dist/prefetch.esm.js +49 -61
- package/dist/prefetch.esm.js.map +1 -1
- package/dist/react.cjs.cjs +18 -17
- package/dist/react.cjs.cjs.map +1 -1
- package/dist/react.esm.js +18 -17
- package/dist/react.esm.js.map +1 -1
- package/dist/runtime-utils.cjs.cjs +6 -5
- package/dist/runtime-utils.cjs.cjs.map +1 -1
- package/dist/runtime-utils.esm.js +6 -5
- package/dist/runtime-utils.esm.js.map +1 -1
- package/dist/universal.cjs.cjs +7 -5
- package/dist/universal.cjs.cjs.map +1 -1
- package/dist/universal.esm.js +7 -5
- package/dist/universal.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/babel.cjs.cjs
CHANGED
|
@@ -5,7 +5,7 @@ var path = require('path');
|
|
|
5
5
|
const attribute = 'id';
|
|
6
6
|
const hookId = 'usePrefetch';
|
|
7
7
|
const importPackage = '@module-federation/data-prefetch/react';
|
|
8
|
-
var babel = (
|
|
8
|
+
var babel = (babel, options) => {
|
|
9
9
|
const t = babel.types;
|
|
10
10
|
let shouldHandle = false;
|
|
11
11
|
let scope = '';
|
|
@@ -14,33 +14,41 @@ var babel = ((babel, options)=>{
|
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
16
16
|
const exposesKey = Object.keys(exposes);
|
|
17
|
-
const processedExposes = exposesKey.map((expose)=>({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const processedExposes = exposesKey.map((expose) => ({
|
|
18
|
+
key: expose.replace('.', ''),
|
|
19
|
+
value: path.resolve(typeof exposes[expose] === 'string'
|
|
20
|
+
?
|
|
21
|
+
exposes[expose]
|
|
22
|
+
:
|
|
23
|
+
exposes[expose].import),
|
|
24
|
+
}));
|
|
21
25
|
return {
|
|
22
26
|
visitor: {
|
|
23
|
-
ImportDeclaration
|
|
27
|
+
ImportDeclaration(nodePath, state) {
|
|
24
28
|
const source = nodePath.node.source.value;
|
|
25
29
|
const { specifiers } = nodePath.node;
|
|
26
30
|
const { filename } = state.file.opts;
|
|
27
31
|
if (source === importPackage) {
|
|
28
|
-
shouldHandle = specifiers.some((specifier)=>
|
|
32
|
+
shouldHandle = specifiers.some((specifier) => specifier.imported &&
|
|
33
|
+
specifier.imported.name === hookId &&
|
|
34
|
+
processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));
|
|
29
35
|
}
|
|
30
36
|
},
|
|
31
|
-
CallExpression
|
|
32
|
-
if (shouldHandle &&
|
|
33
|
-
name: hookId
|
|
34
|
-
|
|
37
|
+
CallExpression(nodePath) {
|
|
38
|
+
if (shouldHandle &&
|
|
39
|
+
t.isIdentifier(nodePath.node.callee, { name: hookId }) &&
|
|
40
|
+
nodePath.node.arguments.length > 0) {
|
|
35
41
|
const objectExpression = nodePath.node.arguments[0];
|
|
36
|
-
if (objectExpression &&
|
|
42
|
+
if (objectExpression &&
|
|
43
|
+
t.isObjectExpression(objectExpression) &&
|
|
44
|
+
!objectExpression.properties.find((p) => p.key.name === attribute)) {
|
|
37
45
|
objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
48
|
+
},
|
|
49
|
+
},
|
|
42
50
|
};
|
|
43
|
-
}
|
|
51
|
+
};
|
|
44
52
|
|
|
45
53
|
module.exports = babel;
|
|
46
54
|
//# sourceMappingURL=babel.cjs.cjs.map
|
package/dist/babel.cjs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel.cjs.cjs","sources":["../src/cli/babel.ts"],"sourcesContent":["import path from 'path';\nconst attribute = 'id';\nconst hookId = 'usePrefetch';\nconst importPackage = '@module-federation/data-prefetch/react';\nexport default (babel, options) => {\n const t = babel.types;\n let shouldHandle = false;\n let scope = '';\n const { name, exposes } = options;\n if (!exposes) {\n return {};\n }\n const exposesKey = Object.keys(exposes);\n const processedExposes = exposesKey.map((expose) => ({\n key: expose.replace('.', ''),\n value: path.resolve(typeof exposes[expose] === 'string'\n ?\n exposes[expose]\n :\n exposes[expose].import),\n }));\n return {\n visitor: {\n ImportDeclaration(nodePath, state) {\n const source = nodePath.node.source.value;\n const { specifiers } = nodePath.node;\n const { filename } = state.file.opts;\n if (source === importPackage) {\n shouldHandle = specifiers.some((specifier) => specifier.imported &&\n specifier.imported.name === hookId &&\n processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));\n }\n },\n CallExpression(nodePath) {\n if (shouldHandle &&\n t.isIdentifier(nodePath.node.callee, { name: hookId }) &&\n nodePath.node.arguments.length > 0) {\n const objectExpression = nodePath.node.arguments[0];\n if (objectExpression &&\n t.isObjectExpression(objectExpression) &&\n !objectExpression.properties.find((p) => p.key.name === attribute)) {\n objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));\n }\n }\n },\n },\n };\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"babel.cjs.cjs","sources":["../src/cli/babel.ts"],"sourcesContent":["import path from 'path';\nconst attribute = 'id';\nconst hookId = 'usePrefetch';\nconst importPackage = '@module-federation/data-prefetch/react';\nexport default (babel, options) => {\n const t = babel.types;\n let shouldHandle = false;\n let scope = '';\n const { name, exposes } = options;\n if (!exposes) {\n return {};\n }\n const exposesKey = Object.keys(exposes);\n const processedExposes = exposesKey.map((expose) => ({\n key: expose.replace('.', ''),\n value: path.resolve(typeof exposes[expose] === 'string'\n ?\n exposes[expose]\n :\n exposes[expose].import),\n }));\n return {\n visitor: {\n ImportDeclaration(nodePath, state) {\n const source = nodePath.node.source.value;\n const { specifiers } = nodePath.node;\n const { filename } = state.file.opts;\n if (source === importPackage) {\n shouldHandle = specifiers.some((specifier) => specifier.imported &&\n specifier.imported.name === hookId &&\n processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));\n }\n },\n CallExpression(nodePath) {\n if (shouldHandle &&\n t.isIdentifier(nodePath.node.callee, { name: hookId }) &&\n nodePath.node.arguments.length > 0) {\n const objectExpression = nodePath.node.arguments[0];\n if (objectExpression &&\n t.isObjectExpression(objectExpression) &&\n !objectExpression.properties.find((p) => p.key.name === attribute)) {\n objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));\n }\n }\n },\n },\n };\n};\n"],"names":[],"mappings":";;;;AACA,MAAM,SAAS,GAAG,IAAI;AACtB,MAAM,MAAM,GAAG,aAAa;AAC5B,MAAM,aAAa,GAAG,wCAAwC;AAC9D,YAAe,CAAC,KAAK,EAAE,OAAO,KAAK;AACnC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK;AACzB,IAAI,IAAI,YAAY,GAAG,KAAK;AAC5B,IAAI,IAAI,KAAK,GAAG,EAAE;AAClB,IAAI,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO;AACrC,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,EAAE;AACjB;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,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AAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AACxD,oBAAoB,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;AACvE,oBAAoB,IAAI,gBAAgB;AACxC,wBAAwB,CAAC,CAAC,kBAAkB,CAAC,gBAAgB,CAAC;AAC9D,wBAAwB,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE;AAC5F,wBAAwB,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;AAClI;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL,CAAC;;;;"}
|
package/dist/babel.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import path from 'path';
|
|
|
3
3
|
const attribute = 'id';
|
|
4
4
|
const hookId = 'usePrefetch';
|
|
5
5
|
const importPackage = '@module-federation/data-prefetch/react';
|
|
6
|
-
var babel = (
|
|
6
|
+
var babel = (babel, options) => {
|
|
7
7
|
const t = babel.types;
|
|
8
8
|
let shouldHandle = false;
|
|
9
9
|
let scope = '';
|
|
@@ -12,33 +12,41 @@ var babel = ((babel, options)=>{
|
|
|
12
12
|
return {};
|
|
13
13
|
}
|
|
14
14
|
const exposesKey = Object.keys(exposes);
|
|
15
|
-
const processedExposes = exposesKey.map((expose)=>({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const processedExposes = exposesKey.map((expose) => ({
|
|
16
|
+
key: expose.replace('.', ''),
|
|
17
|
+
value: path.resolve(typeof exposes[expose] === 'string'
|
|
18
|
+
?
|
|
19
|
+
exposes[expose]
|
|
20
|
+
:
|
|
21
|
+
exposes[expose].import),
|
|
22
|
+
}));
|
|
19
23
|
return {
|
|
20
24
|
visitor: {
|
|
21
|
-
ImportDeclaration
|
|
25
|
+
ImportDeclaration(nodePath, state) {
|
|
22
26
|
const source = nodePath.node.source.value;
|
|
23
27
|
const { specifiers } = nodePath.node;
|
|
24
28
|
const { filename } = state.file.opts;
|
|
25
29
|
if (source === importPackage) {
|
|
26
|
-
shouldHandle = specifiers.some((specifier)=>
|
|
30
|
+
shouldHandle = specifiers.some((specifier) => specifier.imported &&
|
|
31
|
+
specifier.imported.name === hookId &&
|
|
32
|
+
processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));
|
|
27
33
|
}
|
|
28
34
|
},
|
|
29
|
-
CallExpression
|
|
30
|
-
if (shouldHandle &&
|
|
31
|
-
name: hookId
|
|
32
|
-
|
|
35
|
+
CallExpression(nodePath) {
|
|
36
|
+
if (shouldHandle &&
|
|
37
|
+
t.isIdentifier(nodePath.node.callee, { name: hookId }) &&
|
|
38
|
+
nodePath.node.arguments.length > 0) {
|
|
33
39
|
const objectExpression = nodePath.node.arguments[0];
|
|
34
|
-
if (objectExpression &&
|
|
40
|
+
if (objectExpression &&
|
|
41
|
+
t.isObjectExpression(objectExpression) &&
|
|
42
|
+
!objectExpression.properties.find((p) => p.key.name === attribute)) {
|
|
35
43
|
objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
46
|
+
},
|
|
47
|
+
},
|
|
40
48
|
};
|
|
41
|
-
}
|
|
49
|
+
};
|
|
42
50
|
|
|
43
51
|
export { babel as default };
|
|
44
52
|
//# sourceMappingURL=babel.esm.js.map
|
package/dist/babel.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babel.esm.js","sources":["../src/cli/babel.ts"],"sourcesContent":["import path from 'path';\nconst attribute = 'id';\nconst hookId = 'usePrefetch';\nconst importPackage = '@module-federation/data-prefetch/react';\nexport default (babel, options) => {\n const t = babel.types;\n let shouldHandle = false;\n let scope = '';\n const { name, exposes } = options;\n if (!exposes) {\n return {};\n }\n const exposesKey = Object.keys(exposes);\n const processedExposes = exposesKey.map((expose) => ({\n key: expose.replace('.', ''),\n value: path.resolve(typeof exposes[expose] === 'string'\n ?\n exposes[expose]\n :\n exposes[expose].import),\n }));\n return {\n visitor: {\n ImportDeclaration(nodePath, state) {\n const source = nodePath.node.source.value;\n const { specifiers } = nodePath.node;\n const { filename } = state.file.opts;\n if (source === importPackage) {\n shouldHandle = specifiers.some((specifier) => specifier.imported &&\n specifier.imported.name === hookId &&\n processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));\n }\n },\n CallExpression(nodePath) {\n if (shouldHandle &&\n t.isIdentifier(nodePath.node.callee, { name: hookId }) &&\n nodePath.node.arguments.length > 0) {\n const objectExpression = nodePath.node.arguments[0];\n if (objectExpression &&\n t.isObjectExpression(objectExpression) &&\n !objectExpression.properties.find((p) => p.key.name === attribute)) {\n objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));\n }\n }\n },\n },\n };\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"babel.esm.js","sources":["../src/cli/babel.ts"],"sourcesContent":["import path from 'path';\nconst attribute = 'id';\nconst hookId = 'usePrefetch';\nconst importPackage = '@module-federation/data-prefetch/react';\nexport default (babel, options) => {\n const t = babel.types;\n let shouldHandle = false;\n let scope = '';\n const { name, exposes } = options;\n if (!exposes) {\n return {};\n }\n const exposesKey = Object.keys(exposes);\n const processedExposes = exposesKey.map((expose) => ({\n key: expose.replace('.', ''),\n value: path.resolve(typeof exposes[expose] === 'string'\n ?\n exposes[expose]\n :\n exposes[expose].import),\n }));\n return {\n visitor: {\n ImportDeclaration(nodePath, state) {\n const source = nodePath.node.source.value;\n const { specifiers } = nodePath.node;\n const { filename } = state.file.opts;\n if (source === importPackage) {\n shouldHandle = specifiers.some((specifier) => specifier.imported &&\n specifier.imported.name === hookId &&\n processedExposes.find((expose) => expose.value === filename && (scope = expose.key)));\n }\n },\n CallExpression(nodePath) {\n if (shouldHandle &&\n t.isIdentifier(nodePath.node.callee, { name: hookId }) &&\n nodePath.node.arguments.length > 0) {\n const objectExpression = nodePath.node.arguments[0];\n if (objectExpression &&\n t.isObjectExpression(objectExpression) &&\n !objectExpression.properties.find((p) => p.key.name === attribute)) {\n objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));\n }\n }\n },\n },\n };\n};\n"],"names":[],"mappings":";;AACA,MAAM,SAAS,GAAG,IAAI;AACtB,MAAM,MAAM,GAAG,aAAa;AAC5B,MAAM,aAAa,GAAG,wCAAwC;AAC9D,YAAe,CAAC,KAAK,EAAE,OAAO,KAAK;AACnC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK;AACzB,IAAI,IAAI,YAAY,GAAG,KAAK;AAC5B,IAAI,IAAI,KAAK,GAAG,EAAE;AAClB,IAAI,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO;AACrC,IAAI,IAAI,CAAC,OAAO,EAAE;AAClB,QAAQ,OAAO,EAAE;AACjB;AACA,IAAI,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;AAC3C,IAAI,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,MAAM;AACzD,QAAQ,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;AACpC,QAAQ,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK;AACvD;AACA,gBAAgB,OAAO,CAAC,MAAM;AAC9B;AACA,gBAAgB,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;AACvC,KAAK,CAAC,CAAC;AACP,IAAI,OAAO;AACX,QAAQ,OAAO,EAAE;AACjB,YAAY,iBAAiB,CAAC,QA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AAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;AAClI;AACA;AACA,aAAa;AACb,SAAS;AACT,KAAK;AACL,CAAC;;;;"}
|
package/dist/cli.cjs.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var constant = require('./constant.cjs.cjs');
|
|
|
9
9
|
|
|
10
10
|
const TEMP_DIR = '.mf';
|
|
11
11
|
|
|
12
|
-
const fileExistsWithCaseSync = (filepath)=>{
|
|
12
|
+
const fileExistsWithCaseSync = (filepath) => {
|
|
13
13
|
const dir = path.dirname(filepath);
|
|
14
14
|
if (filepath === '/' || filepath === '.') {
|
|
15
15
|
return true;
|
|
@@ -20,16 +20,14 @@ const fileExistsWithCaseSync = (filepath)=>{
|
|
|
20
20
|
}
|
|
21
21
|
return fileExistsWithCaseSync(dir);
|
|
22
22
|
};
|
|
23
|
-
const fixPrefetchPath = (exposePath)=>{
|
|
24
|
-
const pathExt = [
|
|
25
|
-
'.js',
|
|
26
|
-
'.ts'
|
|
27
|
-
];
|
|
23
|
+
const fixPrefetchPath = (exposePath) => {
|
|
24
|
+
const pathExt = ['.js', '.ts'];
|
|
28
25
|
const extReg = /\.(ts|js|tsx|jsx)$/;
|
|
29
26
|
if (extReg.test(exposePath)) {
|
|
30
|
-
return pathExt.map((ext)=>exposePath.replace(extReg, `.prefetch${ext}`));
|
|
31
|
-
}
|
|
32
|
-
|
|
27
|
+
return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return pathExt.map((ext) => exposePath + `.prefetch${ext}`);
|
|
33
31
|
}
|
|
34
32
|
};
|
|
35
33
|
|
|
@@ -38,6 +36,10 @@ function getFederationGlobalScope(runtimeGlobals) {
|
|
|
38
36
|
return `${runtimeGlobals.require || '__webpack_require__'}.federation`;
|
|
39
37
|
}
|
|
40
38
|
class PrefetchPlugin {
|
|
39
|
+
constructor(options) {
|
|
40
|
+
this.options = options;
|
|
41
|
+
this._reWriteExports = '';
|
|
42
|
+
}
|
|
41
43
|
apply(compiler) {
|
|
42
44
|
var _a;
|
|
43
45
|
const { name, exposes } = this.options;
|
|
@@ -68,16 +70,17 @@ class PrefetchPlugin {
|
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
const exposeAlias = Object.keys(exposes);
|
|
71
|
-
exposeAlias.forEach((alias)=>{
|
|
73
|
+
exposeAlias.forEach((alias) => {
|
|
72
74
|
let exposePath;
|
|
73
75
|
const exposeValue = exposes[alias];
|
|
74
76
|
if (typeof exposeValue === 'string') {
|
|
75
77
|
exposePath = exposeValue;
|
|
76
|
-
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
77
80
|
exposePath = exposeValue.import[0];
|
|
78
81
|
}
|
|
79
82
|
const targetPaths = fixPrefetchPath(exposePath);
|
|
80
|
-
for (const pathItem of targetPaths){
|
|
83
|
+
for (const pathItem of targetPaths) {
|
|
81
84
|
const absolutePath = path.resolve(compiler.options.context, pathItem);
|
|
82
85
|
if (fileExistsWithCaseSync(absolutePath)) {
|
|
83
86
|
const absoluteAlias = alias.replace('.', '');
|
|
@@ -98,7 +101,7 @@ class PrefetchPlugin {
|
|
|
98
101
|
}
|
|
99
102
|
fs.writeFileSync(asyncEntryPath, this._reWriteExports);
|
|
100
103
|
new compiler.webpack.DefinePlugin({
|
|
101
|
-
FederationDataPrefetch: JSON.stringify(asyncEntryPath)
|
|
104
|
+
FederationDataPrefetch: JSON.stringify(asyncEntryPath),
|
|
102
105
|
}).apply(compiler);
|
|
103
106
|
}
|
|
104
107
|
static addRuntime(compiler, options) {
|
|
@@ -109,43 +112,37 @@ class PrefetchPlugin {
|
|
|
109
112
|
const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);
|
|
110
113
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
111
114
|
return Template.asString([
|
|
112
|
-
fs.existsSync(prefetchEntry)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
115
|
+
fs.existsSync(prefetchEntry)
|
|
116
|
+
? Template.indent([
|
|
117
|
+
'function injectPrefetch() {',
|
|
118
|
+
Template.indent([
|
|
119
|
+
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,
|
|
120
|
+
`globalThis.__FEDERATION__['${sdk.MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${sdk.MFPrefetchCommon.globalKey}'] || {`,
|
|
121
|
+
`entryLoading: {},`,
|
|
122
|
+
`instance: new Map(),`,
|
|
123
|
+
`__PREFETCH_EXPORTS__: {},`,
|
|
124
|
+
`};`,
|
|
125
|
+
`globalThis.__FEDERATION__['${sdk.MFPrefetchCommon.globalKey}']['${sdk.MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${sdk.MFPrefetchCommon.globalKey}']['${sdk.MFPrefetchCommon.exportsKey}'] || {};`,
|
|
126
|
+
`globalThis.__FEDERATION__['${sdk.MFPrefetchCommon.globalKey}']['${sdk.MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,
|
|
127
|
+
]),
|
|
128
|
+
'}',
|
|
129
|
+
`${federationGlobal}.prefetch = injectPrefetch`,
|
|
130
|
+
])
|
|
131
|
+
: '',
|
|
127
132
|
Template.indent([
|
|
128
133
|
`if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,
|
|
129
134
|
`${federationGlobal}.prefetch()`,
|
|
130
|
-
'}'
|
|
131
|
-
])
|
|
135
|
+
'}',
|
|
136
|
+
]),
|
|
132
137
|
]);
|
|
133
138
|
}
|
|
134
139
|
static setRemoteIdentifier() {
|
|
135
140
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
136
|
-
return Template.indent([
|
|
137
|
-
`${federationGlobal}.isMFRemote = true;`
|
|
138
|
-
]);
|
|
141
|
+
return Template.indent([`${federationGlobal}.isMFRemote = true;`]);
|
|
139
142
|
}
|
|
140
143
|
static removeRemoteIdentifier() {
|
|
141
144
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
142
|
-
return Template.indent([
|
|
143
|
-
`${federationGlobal}.isMFRemote = false;`
|
|
144
|
-
]);
|
|
145
|
-
}
|
|
146
|
-
constructor(options){
|
|
147
|
-
this.options = options;
|
|
148
|
-
this._reWriteExports = '';
|
|
145
|
+
return Template.indent([`${federationGlobal}.isMFRemote = false;`]);
|
|
149
146
|
}
|
|
150
147
|
}
|
|
151
148
|
|
package/dist/cli.cjs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs.cjs","sources":["../src/common/constant.ts","../src/common/node-utils.ts","../src/cli/index.ts"],"sourcesContent":["export const TEMP_DIR = '.mf';\n","import path from 'path';\nimport fs from 'fs-extra';\nexport const fileExistsWithCaseSync = (filepath) => {\n const dir = path.dirname(filepath);\n if (filepath === '/' || filepath === '.') {\n return true;\n }\n const filenames = fs.readdirSync(dir);\n if (filenames.indexOf(path.basename(filepath)) === -1) {\n return false;\n }\n return fileExistsWithCaseSync(dir);\n};\nexport const fixPrefetchPath = (exposePath) => {\n const pathExt = ['.js', '.ts'];\n const extReg = /\\.(ts|js|tsx|jsx)$/;\n if (extReg.test(exposePath)) {\n return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));\n }\n else {\n return pathExt.map((ext) => exposePath + `.prefetch${ext}`);\n }\n};\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport { TEMP_DIR } from '../common/constant';\nimport { fileExistsWithCaseSync, fixPrefetchPath } from '../common/node-utils';\nimport { getPrefetchId } from '../common/runtime-utils';\nimport { SHARED_STRATEGY } from '../constant';\nconst { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));\nexport function getFederationGlobalScope(runtimeGlobals) {\n return `${runtimeGlobals.require || '__webpack_require__'}.federation`;\n}\nexport class PrefetchPlugin {\n constructor(options) {\n this.options = options;\n this._reWriteExports = '';\n }\n apply(compiler) {\n var _a;\n const { name, exposes } = this.options;\n if (!exposes) {\n return;\n }\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const { runtimePlugins } = this.options;\n if (!Array.isArray(runtimePlugins)) {\n this.options.runtimePlugins = [];\n }\n const runtimePath = path.resolve(__dirname, './plugin.esm.js');\n if (!((_a = this.options.runtimePlugins) === null || _a === void 0 ? void 0 : _a.includes(runtimePath))) {\n this.options.runtimePlugins.push(runtimePath);\n }\n if (this.options.shareStrategy !== SHARED_STRATEGY) {\n this.options.shareStrategy = SHARED_STRATEGY;\n console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`);\n }\n const encodedName = encodeName(name);\n const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);\n if (fs.existsSync(asyncEntryPath)) {\n fs.unlinkSync(asyncEntryPath);\n }\n if (!this.options.dataPrefetch) {\n return;\n }\n const prefetchs = [];\n const exposeAlias = Object.keys(exposes);\n exposeAlias.forEach((alias) => {\n let exposePath;\n const exposeValue = exposes[alias];\n if (typeof exposeValue === 'string') {\n exposePath = exposeValue;\n }\n else {\n exposePath = exposeValue.import[0];\n }\n const targetPaths = fixPrefetchPath(exposePath);\n for (const pathItem of targetPaths) {\n const absolutePath = path.resolve(compiler.options.context, pathItem);\n if (fileExistsWithCaseSync(absolutePath)) {\n prefetchs.push(pathItem);\n const absoluteAlias = alias.replace('.', '');\n this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\\n`;\n break;\n }\n }\n });\n if (!this._reWriteExports) {\n return;\n }\n const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);\n if (!fs.existsSync(tempDirRealPath)) {\n fs.mkdirSync(tempDirRealPath);\n }\n if (!fs.existsSync(`${tempDirRealPath}/${encodedName}`)) {\n fs.mkdirSync(`${tempDirRealPath}/${encodedName}`);\n }\n fs.writeFileSync(asyncEntryPath, this._reWriteExports);\n new compiler.webpack.DefinePlugin({\n FederationDataPrefetch: JSON.stringify(asyncEntryPath),\n }).apply(compiler);\n }\n static addRuntime(compiler, options) {\n const encodedName = encodeName(options.name);\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.asString([\n fs.existsSync(prefetchEntry)\n ? Template.indent([\n 'function injectPrefetch() {',\n Template.indent([\n `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,\n `entryLoading: {},`,\n `instance: new Map(),`,\n `__PREFETCH_EXPORTS__: {},`,\n `};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,\n ]),\n '}',\n `${federationGlobal}.prefetch = injectPrefetch`,\n ])\n : '',\n Template.indent([\n `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,\n `${federationGlobal}.prefetch()`,\n '}',\n ]),\n ]);\n }\n static setRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = true;`]);\n }\n static removeRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = false;`]);\n }\n}\n"],"names":["TEMP_DIR","fileExistsWithCaseSync","filepath","dir","path","dirname","filenames","fs","readdirSync","indexOf","basename","fixPrefetchPath","exposePath","pathExt","extReg","test","map","ext","replace","RuntimeGlobals","Template","require","normalizeWebpackPath","getFederationGlobalScope","runtimeGlobals","PrefetchPlugin","apply","compiler","_a","name","exposes","options","context","Error","runtimePlugins","Array","isArray","runtimePath","resolve","__dirname","includes","push","shareStrategy","SHARED_STRATEGY","console","warn","encodedName","encodeName","asyncEntryPath","existsSync","unlinkSync","dataPrefetch","exposeAlias","Object","keys","forEach","alias","exposeValue","import","targetPaths","pathItem","absolutePath","absoluteAlias","_reWriteExports","getPrefetchId","tempDirRealPath","mkdirSync","writeFileSync","webpack","DefinePlugin","FederationDataPrefetch","JSON","stringify","addRuntime","prefetchEntry","federationGlobal","asString","indent","MFPrefetchCommon","globalKey","exportsKey","setRemoteIdentifier","removeRemoteIdentifier","constructor"],"mappings":";;;;;;;;;AAAO,MAAMA,WAAW,KAAM;;ACEvB,MAAMC,yBAAyB,CAACC,QAAAA,GAAAA;IACnC,MAAMC,GAAAA,GAAMC,IAAKC,CAAAA,OAAO,CAACH,QAAAA,CAAAA;IACzB,IAAIA,QAAAA,KAAa,GAAOA,IAAAA,QAAAA,KAAa,GAAK,EAAA;QACtC,OAAO,IAAA;AACX;IACA,MAAMI,SAAAA,GAAYC,EAAGC,CAAAA,WAAW,CAACL,GAAAA,CAAAA;IACjC,IAAIG,SAAAA,CAAUG,OAAO,CAACL,IAAAA,CAAKM,QAAQ,CAACR,QAAAA,CAAAA,CAAAA,KAAe,EAAI,EAAA;QACnD,OAAO,KAAA;AACX;AACA,IAAA,OAAOD,sBAAuBE,CAAAA,G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2GJ;;;;;"}
|
|
1
|
+
{"version":3,"file":"cli.cjs.cjs","sources":["../src/common/constant.ts","../src/common/node-utils.ts","../src/cli/index.ts"],"sourcesContent":["export const TEMP_DIR = '.mf';\n","import path from 'path';\nimport fs from 'fs-extra';\nexport const fileExistsWithCaseSync = (filepath) => {\n const dir = path.dirname(filepath);\n if (filepath === '/' || filepath === '.') {\n return true;\n }\n const filenames = fs.readdirSync(dir);\n if (filenames.indexOf(path.basename(filepath)) === -1) {\n return false;\n }\n return fileExistsWithCaseSync(dir);\n};\nexport const fixPrefetchPath = (exposePath) => {\n const pathExt = ['.js', '.ts'];\n const extReg = /\\.(ts|js|tsx|jsx)$/;\n if (extReg.test(exposePath)) {\n return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));\n }\n else {\n return pathExt.map((ext) => exposePath + `.prefetch${ext}`);\n }\n};\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport { TEMP_DIR } from '../common/constant';\nimport { fileExistsWithCaseSync, fixPrefetchPath } from '../common/node-utils';\nimport { getPrefetchId } from '../common/runtime-utils';\nimport { SHARED_STRATEGY } from '../constant';\nconst { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));\nexport function getFederationGlobalScope(runtimeGlobals) {\n return `${runtimeGlobals.require || '__webpack_require__'}.federation`;\n}\nexport class PrefetchPlugin {\n constructor(options) {\n this.options = options;\n this._reWriteExports = '';\n }\n apply(compiler) {\n var _a;\n const { name, exposes } = this.options;\n if (!exposes) {\n return;\n }\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const { runtimePlugins } = this.options;\n if (!Array.isArray(runtimePlugins)) {\n this.options.runtimePlugins = [];\n }\n const runtimePath = path.resolve(__dirname, './plugin.esm.js');\n if (!((_a = this.options.runtimePlugins) === null || _a === void 0 ? void 0 : _a.includes(runtimePath))) {\n this.options.runtimePlugins.push(runtimePath);\n }\n if (this.options.shareStrategy !== SHARED_STRATEGY) {\n this.options.shareStrategy = SHARED_STRATEGY;\n console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`);\n }\n const encodedName = encodeName(name);\n const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);\n if (fs.existsSync(asyncEntryPath)) {\n fs.unlinkSync(asyncEntryPath);\n }\n if (!this.options.dataPrefetch) {\n return;\n }\n const prefetchs = [];\n const exposeAlias = Object.keys(exposes);\n exposeAlias.forEach((alias) => {\n let exposePath;\n const exposeValue = exposes[alias];\n if (typeof exposeValue === 'string') {\n exposePath = exposeValue;\n }\n else {\n exposePath = exposeValue.import[0];\n }\n const targetPaths = fixPrefetchPath(exposePath);\n for (const pathItem of targetPaths) {\n const absolutePath = path.resolve(compiler.options.context, pathItem);\n if (fileExistsWithCaseSync(absolutePath)) {\n prefetchs.push(pathItem);\n const absoluteAlias = alias.replace('.', '');\n this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\\n`;\n break;\n }\n }\n });\n if (!this._reWriteExports) {\n return;\n }\n const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);\n if (!fs.existsSync(tempDirRealPath)) {\n fs.mkdirSync(tempDirRealPath);\n }\n if (!fs.existsSync(`${tempDirRealPath}/${encodedName}`)) {\n fs.mkdirSync(`${tempDirRealPath}/${encodedName}`);\n }\n fs.writeFileSync(asyncEntryPath, this._reWriteExports);\n new compiler.webpack.DefinePlugin({\n FederationDataPrefetch: JSON.stringify(asyncEntryPath),\n }).apply(compiler);\n }\n static addRuntime(compiler, options) {\n const encodedName = encodeName(options.name);\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.asString([\n fs.existsSync(prefetchEntry)\n ? Template.indent([\n 'function injectPrefetch() {',\n Template.indent([\n `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,\n `entryLoading: {},`,\n `instance: new Map(),`,\n `__PREFETCH_EXPORTS__: {},`,\n `};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,\n ]),\n '}',\n `${federationGlobal}.prefetch = injectPrefetch`,\n ])\n : '',\n Template.indent([\n `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,\n `${federationGlobal}.prefetch()`,\n '}',\n ]),\n ]);\n }\n static setRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = true;`]);\n }\n static removeRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = false;`]);\n }\n}\n"],"names":["normalizeWebpackPath","SHARED_STRATEGY","encodeName","getPrefetchId","MFPrefetchCommon"],"mappings":";;;;;;;;;AAAO,MAAM,QAAQ,GAAG,KAAK;;ACEtB,MAAM,sBAAsB,GAAG,CAAC,QAAQ,KAAK;AACpD,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;AACtC,IAAI,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,EAAE;AAC9C,QAAQ,OAAO,IAAI;AACnB;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BAAgB,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAC1E;AACA,IAAI,OAAO,sBAAsB,GAAG;AACpC,QAAQ,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,cAAc,IAAI,EAAE,CAAC;AAC/E,QAAQ,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAC3E;AACA;;;;;"}
|
package/dist/cli.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { S as SHARED_STRATEGY } from './constant.esm.js';
|
|
|
7
7
|
|
|
8
8
|
const TEMP_DIR = '.mf';
|
|
9
9
|
|
|
10
|
-
const fileExistsWithCaseSync = (filepath)=>{
|
|
10
|
+
const fileExistsWithCaseSync = (filepath) => {
|
|
11
11
|
const dir = path.dirname(filepath);
|
|
12
12
|
if (filepath === '/' || filepath === '.') {
|
|
13
13
|
return true;
|
|
@@ -18,16 +18,14 @@ const fileExistsWithCaseSync = (filepath)=>{
|
|
|
18
18
|
}
|
|
19
19
|
return fileExistsWithCaseSync(dir);
|
|
20
20
|
};
|
|
21
|
-
const fixPrefetchPath = (exposePath)=>{
|
|
22
|
-
const pathExt = [
|
|
23
|
-
'.js',
|
|
24
|
-
'.ts'
|
|
25
|
-
];
|
|
21
|
+
const fixPrefetchPath = (exposePath) => {
|
|
22
|
+
const pathExt = ['.js', '.ts'];
|
|
26
23
|
const extReg = /\.(ts|js|tsx|jsx)$/;
|
|
27
24
|
if (extReg.test(exposePath)) {
|
|
28
|
-
return pathExt.map((ext)=>exposePath.replace(extReg, `.prefetch${ext}`));
|
|
29
|
-
}
|
|
30
|
-
|
|
25
|
+
return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return pathExt.map((ext) => exposePath + `.prefetch${ext}`);
|
|
31
29
|
}
|
|
32
30
|
};
|
|
33
31
|
|
|
@@ -36,6 +34,10 @@ function getFederationGlobalScope(runtimeGlobals) {
|
|
|
36
34
|
return `${runtimeGlobals.require || '__webpack_require__'}.federation`;
|
|
37
35
|
}
|
|
38
36
|
class PrefetchPlugin {
|
|
37
|
+
constructor(options) {
|
|
38
|
+
this.options = options;
|
|
39
|
+
this._reWriteExports = '';
|
|
40
|
+
}
|
|
39
41
|
apply(compiler) {
|
|
40
42
|
var _a;
|
|
41
43
|
const { name, exposes } = this.options;
|
|
@@ -66,16 +68,17 @@ class PrefetchPlugin {
|
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
68
70
|
const exposeAlias = Object.keys(exposes);
|
|
69
|
-
exposeAlias.forEach((alias)=>{
|
|
71
|
+
exposeAlias.forEach((alias) => {
|
|
70
72
|
let exposePath;
|
|
71
73
|
const exposeValue = exposes[alias];
|
|
72
74
|
if (typeof exposeValue === 'string') {
|
|
73
75
|
exposePath = exposeValue;
|
|
74
|
-
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
75
78
|
exposePath = exposeValue.import[0];
|
|
76
79
|
}
|
|
77
80
|
const targetPaths = fixPrefetchPath(exposePath);
|
|
78
|
-
for (const pathItem of targetPaths){
|
|
81
|
+
for (const pathItem of targetPaths) {
|
|
79
82
|
const absolutePath = path.resolve(compiler.options.context, pathItem);
|
|
80
83
|
if (fileExistsWithCaseSync(absolutePath)) {
|
|
81
84
|
const absoluteAlias = alias.replace('.', '');
|
|
@@ -96,7 +99,7 @@ class PrefetchPlugin {
|
|
|
96
99
|
}
|
|
97
100
|
fs.writeFileSync(asyncEntryPath, this._reWriteExports);
|
|
98
101
|
new compiler.webpack.DefinePlugin({
|
|
99
|
-
FederationDataPrefetch: JSON.stringify(asyncEntryPath)
|
|
102
|
+
FederationDataPrefetch: JSON.stringify(asyncEntryPath),
|
|
100
103
|
}).apply(compiler);
|
|
101
104
|
}
|
|
102
105
|
static addRuntime(compiler, options) {
|
|
@@ -107,43 +110,37 @@ class PrefetchPlugin {
|
|
|
107
110
|
const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);
|
|
108
111
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
109
112
|
return Template.asString([
|
|
110
|
-
fs.existsSync(prefetchEntry)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
fs.existsSync(prefetchEntry)
|
|
114
|
+
? Template.indent([
|
|
115
|
+
'function injectPrefetch() {',
|
|
116
|
+
Template.indent([
|
|
117
|
+
`globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,
|
|
118
|
+
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,
|
|
119
|
+
`entryLoading: {},`,
|
|
120
|
+
`instance: new Map(),`,
|
|
121
|
+
`__PREFETCH_EXPORTS__: {},`,
|
|
122
|
+
`};`,
|
|
123
|
+
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,
|
|
124
|
+
`globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,
|
|
125
|
+
]),
|
|
126
|
+
'}',
|
|
127
|
+
`${federationGlobal}.prefetch = injectPrefetch`,
|
|
128
|
+
])
|
|
129
|
+
: '',
|
|
125
130
|
Template.indent([
|
|
126
131
|
`if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,
|
|
127
132
|
`${federationGlobal}.prefetch()`,
|
|
128
|
-
'}'
|
|
129
|
-
])
|
|
133
|
+
'}',
|
|
134
|
+
]),
|
|
130
135
|
]);
|
|
131
136
|
}
|
|
132
137
|
static setRemoteIdentifier() {
|
|
133
138
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
134
|
-
return Template.indent([
|
|
135
|
-
`${federationGlobal}.isMFRemote = true;`
|
|
136
|
-
]);
|
|
139
|
+
return Template.indent([`${federationGlobal}.isMFRemote = true;`]);
|
|
137
140
|
}
|
|
138
141
|
static removeRemoteIdentifier() {
|
|
139
142
|
const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});
|
|
140
|
-
return Template.indent([
|
|
141
|
-
`${federationGlobal}.isMFRemote = false;`
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
constructor(options){
|
|
145
|
-
this.options = options;
|
|
146
|
-
this._reWriteExports = '';
|
|
143
|
+
return Template.indent([`${federationGlobal}.isMFRemote = false;`]);
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
|
package/dist/cli.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.esm.js","sources":["../src/common/constant.ts","../src/common/node-utils.ts","../src/cli/index.ts"],"sourcesContent":["export const TEMP_DIR = '.mf';\n","import path from 'path';\nimport fs from 'fs-extra';\nexport const fileExistsWithCaseSync = (filepath) => {\n const dir = path.dirname(filepath);\n if (filepath === '/' || filepath === '.') {\n return true;\n }\n const filenames = fs.readdirSync(dir);\n if (filenames.indexOf(path.basename(filepath)) === -1) {\n return false;\n }\n return fileExistsWithCaseSync(dir);\n};\nexport const fixPrefetchPath = (exposePath) => {\n const pathExt = ['.js', '.ts'];\n const extReg = /\\.(ts|js|tsx|jsx)$/;\n if (extReg.test(exposePath)) {\n return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));\n }\n else {\n return pathExt.map((ext) => exposePath + `.prefetch${ext}`);\n }\n};\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport { TEMP_DIR } from '../common/constant';\nimport { fileExistsWithCaseSync, fixPrefetchPath } from '../common/node-utils';\nimport { getPrefetchId } from '../common/runtime-utils';\nimport { SHARED_STRATEGY } from '../constant';\nconst { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));\nexport function getFederationGlobalScope(runtimeGlobals) {\n return `${runtimeGlobals.require || '__webpack_require__'}.federation`;\n}\nexport class PrefetchPlugin {\n constructor(options) {\n this.options = options;\n this._reWriteExports = '';\n }\n apply(compiler) {\n var _a;\n const { name, exposes } = this.options;\n if (!exposes) {\n return;\n }\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const { runtimePlugins } = this.options;\n if (!Array.isArray(runtimePlugins)) {\n this.options.runtimePlugins = [];\n }\n const runtimePath = path.resolve(__dirname, './plugin.esm.js');\n if (!((_a = this.options.runtimePlugins) === null || _a === void 0 ? void 0 : _a.includes(runtimePath))) {\n this.options.runtimePlugins.push(runtimePath);\n }\n if (this.options.shareStrategy !== SHARED_STRATEGY) {\n this.options.shareStrategy = SHARED_STRATEGY;\n console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`);\n }\n const encodedName = encodeName(name);\n const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);\n if (fs.existsSync(asyncEntryPath)) {\n fs.unlinkSync(asyncEntryPath);\n }\n if (!this.options.dataPrefetch) {\n return;\n }\n const prefetchs = [];\n const exposeAlias = Object.keys(exposes);\n exposeAlias.forEach((alias) => {\n let exposePath;\n const exposeValue = exposes[alias];\n if (typeof exposeValue === 'string') {\n exposePath = exposeValue;\n }\n else {\n exposePath = exposeValue.import[0];\n }\n const targetPaths = fixPrefetchPath(exposePath);\n for (const pathItem of targetPaths) {\n const absolutePath = path.resolve(compiler.options.context, pathItem);\n if (fileExistsWithCaseSync(absolutePath)) {\n prefetchs.push(pathItem);\n const absoluteAlias = alias.replace('.', '');\n this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\\n`;\n break;\n }\n }\n });\n if (!this._reWriteExports) {\n return;\n }\n const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);\n if (!fs.existsSync(tempDirRealPath)) {\n fs.mkdirSync(tempDirRealPath);\n }\n if (!fs.existsSync(`${tempDirRealPath}/${encodedName}`)) {\n fs.mkdirSync(`${tempDirRealPath}/${encodedName}`);\n }\n fs.writeFileSync(asyncEntryPath, this._reWriteExports);\n new compiler.webpack.DefinePlugin({\n FederationDataPrefetch: JSON.stringify(asyncEntryPath),\n }).apply(compiler);\n }\n static addRuntime(compiler, options) {\n const encodedName = encodeName(options.name);\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.asString([\n fs.existsSync(prefetchEntry)\n ? Template.indent([\n 'function injectPrefetch() {',\n Template.indent([\n `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,\n `entryLoading: {},`,\n `instance: new Map(),`,\n `__PREFETCH_EXPORTS__: {},`,\n `};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,\n ]),\n '}',\n `${federationGlobal}.prefetch = injectPrefetch`,\n ])\n : '',\n Template.indent([\n `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,\n `${federationGlobal}.prefetch()`,\n '}',\n ]),\n ]);\n }\n static setRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = true;`]);\n }\n static removeRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = false;`]);\n }\n}\n"],"names":["TEMP_DIR","fileExistsWithCaseSync","filepath","dir","path","dirname","filenames","fs","readdirSync","indexOf","basename","fixPrefetchPath","exposePath","pathExt","extReg","test","map","ext","replace","RuntimeGlobals","Template","require","normalizeWebpackPath","getFederationGlobalScope","runtimeGlobals","PrefetchPlugin","apply","compiler","_a","name","exposes","options","context","Error","runtimePlugins","Array","isArray","runtimePath","resolve","__dirname","includes","push","shareStrategy","SHARED_STRATEGY","console","warn","encodedName","encodeName","asyncEntryPath","existsSync","unlinkSync","dataPrefetch","exposeAlias","Object","keys","forEach","alias","exposeValue","import","targetPaths","pathItem","absolutePath","absoluteAlias","_reWriteExports","getPrefetchId","tempDirRealPath","mkdirSync","writeFileSync","webpack","DefinePlugin","FederationDataPrefetch","JSON","stringify","addRuntime","prefetchEntry","federationGlobal","asString","indent","MFPrefetchCommon","globalKey","exportsKey","setRemoteIdentifier","removeRemoteIdentifier","constructor"],"mappings":";;;;;;;AAAO,MAAMA,WAAW,KAAM;;ACEvB,MAAMC,yBAAyB,CAACC,QAAAA,GAAAA;IACnC,MAAMC,GAAAA,GAAMC,IAAKC,CAAAA,OAAO,CAACH,QAAAA,CAAAA;IACzB,IAAIA,QAAAA,KAAa,GAAOA,IAAAA,QAAAA,KAAa,GAAK,EAAA;QACtC,OAAO,IAAA;AACX;IACA,MAAMI,SAAAA,GAAYC,EAAGC,CAAAA,WAAW,CAACL,GAAAA,CAAAA;IACjC,IAAIG,SAAAA,CAAUG,OAAO,CAACL,IAAAA,CAAKM,QAAQ,CAACR,QAAAA,CAAAA,CAAAA,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CAACA,OAAO,GAAGA,OAAAA;QACf,IAAI,CAACgC,eAAe,GAAG,EAAA;AAC3B;AA2GJ;;;;"}
|
|
1
|
+
{"version":3,"file":"cli.esm.js","sources":["../src/common/constant.ts","../src/common/node-utils.ts","../src/cli/index.ts"],"sourcesContent":["export const TEMP_DIR = '.mf';\n","import path from 'path';\nimport fs from 'fs-extra';\nexport const fileExistsWithCaseSync = (filepath) => {\n const dir = path.dirname(filepath);\n if (filepath === '/' || filepath === '.') {\n return true;\n }\n const filenames = fs.readdirSync(dir);\n if (filenames.indexOf(path.basename(filepath)) === -1) {\n return false;\n }\n return fileExistsWithCaseSync(dir);\n};\nexport const fixPrefetchPath = (exposePath) => {\n const pathExt = ['.js', '.ts'];\n const extReg = /\\.(ts|js|tsx|jsx)$/;\n if (extReg.test(exposePath)) {\n return pathExt.map((ext) => exposePath.replace(extReg, `.prefetch${ext}`));\n }\n else {\n return pathExt.map((ext) => exposePath + `.prefetch${ext}`);\n }\n};\n","import path from 'path';\nimport fs from 'fs-extra';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nimport { normalizeWebpackPath } from '@module-federation/sdk/normalize-webpack-path';\nimport { TEMP_DIR } from '../common/constant';\nimport { fileExistsWithCaseSync, fixPrefetchPath } from '../common/node-utils';\nimport { getPrefetchId } from '../common/runtime-utils';\nimport { SHARED_STRATEGY } from '../constant';\nconst { RuntimeGlobals, Template } = require(normalizeWebpackPath('webpack'));\nexport function getFederationGlobalScope(runtimeGlobals) {\n return `${runtimeGlobals.require || '__webpack_require__'}.federation`;\n}\nexport class PrefetchPlugin {\n constructor(options) {\n this.options = options;\n this._reWriteExports = '';\n }\n apply(compiler) {\n var _a;\n const { name, exposes } = this.options;\n if (!exposes) {\n return;\n }\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const { runtimePlugins } = this.options;\n if (!Array.isArray(runtimePlugins)) {\n this.options.runtimePlugins = [];\n }\n const runtimePath = path.resolve(__dirname, './plugin.esm.js');\n if (!((_a = this.options.runtimePlugins) === null || _a === void 0 ? void 0 : _a.includes(runtimePath))) {\n this.options.runtimePlugins.push(runtimePath);\n }\n if (this.options.shareStrategy !== SHARED_STRATEGY) {\n this.options.shareStrategy = SHARED_STRATEGY;\n console.warn(`[Module Federation Data Prefetch]: Your shared strategy is set to '${SHARED_STRATEGY}', this is a necessary condition for data prefetch`);\n }\n const encodedName = encodeName(name);\n const asyncEntryPath = path.resolve(compiler.options.context, `node_modules/${TEMP_DIR}/${encodedName}/bootstrap.js`);\n if (fs.existsSync(asyncEntryPath)) {\n fs.unlinkSync(asyncEntryPath);\n }\n if (!this.options.dataPrefetch) {\n return;\n }\n const prefetchs = [];\n const exposeAlias = Object.keys(exposes);\n exposeAlias.forEach((alias) => {\n let exposePath;\n const exposeValue = exposes[alias];\n if (typeof exposeValue === 'string') {\n exposePath = exposeValue;\n }\n else {\n exposePath = exposeValue.import[0];\n }\n const targetPaths = fixPrefetchPath(exposePath);\n for (const pathItem of targetPaths) {\n const absolutePath = path.resolve(compiler.options.context, pathItem);\n if (fileExistsWithCaseSync(absolutePath)) {\n prefetchs.push(pathItem);\n const absoluteAlias = alias.replace('.', '');\n this._reWriteExports += `export * as ${getPrefetchId(`${name}${absoluteAlias}`)} from '${absolutePath}';\\n`;\n break;\n }\n }\n });\n if (!this._reWriteExports) {\n return;\n }\n const tempDirRealPath = path.resolve(compiler.options.context, 'node_modules', TEMP_DIR);\n if (!fs.existsSync(tempDirRealPath)) {\n fs.mkdirSync(tempDirRealPath);\n }\n if (!fs.existsSync(`${tempDirRealPath}/${encodedName}`)) {\n fs.mkdirSync(`${tempDirRealPath}/${encodedName}`);\n }\n fs.writeFileSync(asyncEntryPath, this._reWriteExports);\n new compiler.webpack.DefinePlugin({\n FederationDataPrefetch: JSON.stringify(asyncEntryPath),\n }).apply(compiler);\n }\n static addRuntime(compiler, options) {\n const encodedName = encodeName(options.name);\n if (!compiler.options.context) {\n throw new Error('compiler.options.context is not defined');\n }\n const prefetchEntry = path.resolve(compiler.options.context, `node_modules/.mf/${encodedName}/bootstrap.js`);\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.asString([\n fs.existsSync(prefetchEntry)\n ? Template.indent([\n 'function injectPrefetch() {',\n Template.indent([\n `globalThis.__FEDERATION__ = globalThis.__FEDERATION__ || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}'] || {`,\n `entryLoading: {},`,\n `instance: new Map(),`,\n `__PREFETCH_EXPORTS__: {},`,\n `};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] = globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}'] || {};`,\n `globalThis.__FEDERATION__['${MFPrefetchCommon.globalKey}']['${MFPrefetchCommon.exportsKey}']['${options.name}'] = function(){ return import('${prefetchEntry}');}`,\n ]),\n '}',\n `${federationGlobal}.prefetch = injectPrefetch`,\n ])\n : '',\n Template.indent([\n `if(!${federationGlobal}.isMFRemote && ${federationGlobal}.prefetch){`,\n `${federationGlobal}.prefetch()`,\n '}',\n ]),\n ]);\n }\n static setRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = true;`]);\n }\n static removeRemoteIdentifier() {\n const federationGlobal = getFederationGlobalScope(RuntimeGlobals || {});\n return Template.indent([`${federationGlobal}.isMFRemote = false;`]);\n }\n}\n"],"names":[],"mappings":";;;;;;;AAAO,MAAM,QAAQ,GAAG,KAAK;;ACEtB,MAAM,sBAAsB,GAAG,CAAC,QAAQ,KAAK;AACpD,IAAI,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;AACtC,IAAI,IAAI,QAAQ,KAAK,GAAG,IAAI,QAAQ,KAAK,GAAG,EAAE;AAC9C,QAAQ,OAAO,IAA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mBAAmB,CAAC,CAAC,CAAC;AAC1E;AACA,IAAI,OAAO,sBAAsB,GAAG;AACpC,QAAQ,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,cAAc,IAAI,EAAE,CAAC;AAC/E,QAAQ,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC;AAC3E;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constant.cjs.cjs","sources":["../src/constant.ts"],"sourcesContent":["export const SHARED_STRATEGY = 'loaded-first';\n"],"names":[
|
|
1
|
+
{"version":3,"file":"constant.cjs.cjs","sources":["../src/constant.ts"],"sourcesContent":["export const SHARED_STRATEGY = 'loaded-first';\n"],"names":[],"mappings":";;AAAY,MAAC,eAAe,GAAG;;;;"}
|