@module-federation/data-prefetch 0.0.0-next-20240927185728 → 0.0.0-next-20240930063850
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/.swcrc +29 -0
- package/CHANGELOG.md +13 -3
- package/dist/babel.cjs.js +23 -35
- package/dist/babel.esm.d.ts +2 -0
- package/dist/babel.esm.js +23 -31
- package/dist/cli.cjs.js +122 -3546
- package/dist/cli.esm.d.ts +1 -0
- package/dist/cli.esm.js +123 -3536
- package/dist/index.cjs.js +0 -2
- package/dist/index.esm.d.ts +1 -0
- package/dist/package.json +7 -6
- package/dist/plugin.cjs.js +95 -298
- package/dist/plugin.esm.d.ts +2 -0
- package/dist/plugin.esm.js +94 -297
- package/dist/polyfills.cjs.js +14 -0
- package/dist/polyfills.esm.js +12 -0
- package/dist/prefetch.cjs.js +118 -327
- package/dist/prefetch.esm.js +119 -328
- package/dist/react.cjs.js +31 -117
- package/dist/react.esm.d.ts +1 -0
- package/dist/react.esm.js +32 -116
- package/dist/runtime-utils.cjs.js +4 -8
- package/dist/runtime-utils.esm.js +5 -9
- package/dist/shared.cjs.js +10 -12
- package/dist/shared.esm.d.ts +2 -0
- package/dist/shared.esm.js +10 -12
- package/dist/universal.cjs.js +8 -17
- package/dist/universal.esm.d.ts +1 -0
- package/dist/universal.esm.js +9 -16
- package/package.json +5 -5
- package/project.json +2 -2
- package/rollup.config.js +22 -1
package/.swcrc
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jsc": {
|
|
3
|
+
"target": "es2017",
|
|
4
|
+
"parser": {
|
|
5
|
+
"syntax": "typescript",
|
|
6
|
+
"decorators": true,
|
|
7
|
+
"dynamicImport": true
|
|
8
|
+
},
|
|
9
|
+
"transform": {
|
|
10
|
+
"decoratorMetadata": true,
|
|
11
|
+
"legacyDecorator": true
|
|
12
|
+
},
|
|
13
|
+
"keepClassNames": true,
|
|
14
|
+
"externalHelpers": true,
|
|
15
|
+
"loose": true
|
|
16
|
+
},
|
|
17
|
+
"module": {
|
|
18
|
+
"type": "es6"
|
|
19
|
+
},
|
|
20
|
+
"sourceMaps": true,
|
|
21
|
+
"exclude": [
|
|
22
|
+
"jest.config.ts",
|
|
23
|
+
".*\\.spec.tsx?$",
|
|
24
|
+
".*\\.test.tsx?$",
|
|
25
|
+
"./src/jest-setup.ts$",
|
|
26
|
+
"./**/jest-setup.ts$",
|
|
27
|
+
".*.js$"
|
|
28
|
+
]
|
|
29
|
+
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
# @module-federation/data-prefetch
|
|
2
2
|
|
|
3
|
-
## 0.0.0-next-
|
|
3
|
+
## 0.0.0-next-20240930063850
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [32db0ac]
|
|
8
|
+
- Updated dependencies [32db0ac]
|
|
9
|
+
- Updated dependencies [7f790e4]
|
|
10
|
+
- @module-federation/sdk@0.0.0-next-20240930063850
|
|
11
|
+
- @module-federation/runtime@0.0.0-next-20240930063850
|
|
12
|
+
|
|
13
|
+
## 0.6.7
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
6
16
|
|
|
@@ -14,8 +24,8 @@
|
|
|
14
24
|
- Updated dependencies [9e32644]
|
|
15
25
|
- Updated dependencies [9e32644]
|
|
16
26
|
- Updated dependencies [9e32644]
|
|
17
|
-
- @module-federation/runtime@0.
|
|
18
|
-
- @module-federation/sdk@0.
|
|
27
|
+
- @module-federation/runtime@0.6.7
|
|
28
|
+
- @module-federation/sdk@0.6.7
|
|
19
29
|
|
|
20
30
|
## 0.6.6
|
|
21
31
|
|
package/dist/babel.cjs.js
CHANGED
|
@@ -1,62 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
-
|
|
7
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
3
|
+
var path = require('path');
|
|
8
4
|
|
|
9
5
|
// no used now
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const attribute = 'id';
|
|
7
|
+
const hookId = 'usePrefetch';
|
|
8
|
+
const importPackage = '@module-federation/data-prefetch/react';
|
|
13
9
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
var babel = ((babel, options)=>{
|
|
11
|
+
const t = babel.types;
|
|
12
|
+
let shouldHandle = false;
|
|
13
|
+
let scope = '';
|
|
14
|
+
const { name, exposes } = options;
|
|
19
15
|
if (!exposes) {
|
|
20
16
|
return {};
|
|
21
17
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return {
|
|
18
|
+
const exposesKey = Object.keys(exposes);
|
|
19
|
+
const processedExposes = exposesKey.map((expose)=>({
|
|
25
20
|
key: expose.replace('.', ''),
|
|
26
|
-
value:
|
|
21
|
+
value: path.resolve(// @ts-ignore
|
|
27
22
|
typeof exposes[expose] === 'string' ? exposes[expose] : exposes[expose].import)
|
|
28
|
-
};
|
|
29
|
-
});
|
|
23
|
+
}));
|
|
30
24
|
return {
|
|
31
25
|
visitor: {
|
|
32
|
-
ImportDeclaration
|
|
26
|
+
ImportDeclaration (nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
33
27
|
state) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
const source = nodePath.node.source.value;
|
|
29
|
+
const { specifiers } = nodePath.node;
|
|
30
|
+
const { filename } = state.file.opts;
|
|
37
31
|
if (source === importPackage) {
|
|
38
|
-
shouldHandle = specifiers.some(
|
|
39
|
-
|
|
40
|
-
function(expose) {
|
|
41
|
-
return expose.value === filename && (scope = expose.key);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
32
|
+
shouldHandle = specifiers.some((specifier)=>specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
|
33
|
+
(expose)=>expose.value === filename && (scope = expose.key)));
|
|
44
34
|
}
|
|
45
35
|
},
|
|
46
|
-
CallExpression
|
|
36
|
+
CallExpression (nodePath) {
|
|
47
37
|
if (shouldHandle && t.isIdentifier(nodePath.node.callee, {
|
|
48
38
|
name: hookId
|
|
49
39
|
}) && nodePath.node.arguments.length > 0) {
|
|
50
|
-
|
|
51
|
-
if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find(
|
|
52
|
-
return p.key.name === attribute;
|
|
53
|
-
})) {
|
|
40
|
+
const objectExpression = nodePath.node.arguments[0];
|
|
41
|
+
if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find((p)=>p.key.name === attribute)) {
|
|
54
42
|
objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
|
|
55
43
|
}
|
|
56
44
|
}
|
|
57
45
|
}
|
|
58
46
|
}
|
|
59
47
|
};
|
|
60
|
-
}
|
|
48
|
+
});
|
|
61
49
|
|
|
62
50
|
module.exports = babel;
|
package/dist/babel.esm.js
CHANGED
|
@@ -1,56 +1,48 @@
|
|
|
1
|
-
import
|
|
1
|
+
import path from 'path';
|
|
2
2
|
|
|
3
3
|
// no used now
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const attribute = 'id';
|
|
5
|
+
const hookId = 'usePrefetch';
|
|
6
|
+
const importPackage = '@module-federation/data-prefetch/react';
|
|
7
7
|
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var babel = ((babel, options)=>{
|
|
9
|
+
const t = babel.types;
|
|
10
|
+
let shouldHandle = false;
|
|
11
|
+
let scope = '';
|
|
12
|
+
const { name, exposes } = options;
|
|
13
13
|
if (!exposes) {
|
|
14
14
|
return {};
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return {
|
|
16
|
+
const exposesKey = Object.keys(exposes);
|
|
17
|
+
const processedExposes = exposesKey.map((expose)=>({
|
|
19
18
|
key: expose.replace('.', ''),
|
|
20
|
-
value:
|
|
19
|
+
value: path.resolve(// @ts-ignore
|
|
21
20
|
typeof exposes[expose] === 'string' ? exposes[expose] : exposes[expose].import)
|
|
22
|
-
};
|
|
23
|
-
});
|
|
21
|
+
}));
|
|
24
22
|
return {
|
|
25
23
|
visitor: {
|
|
26
|
-
ImportDeclaration
|
|
24
|
+
ImportDeclaration (nodePath, // biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
27
25
|
state) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const source = nodePath.node.source.value;
|
|
27
|
+
const { specifiers } = nodePath.node;
|
|
28
|
+
const { filename } = state.file.opts;
|
|
31
29
|
if (source === importPackage) {
|
|
32
|
-
shouldHandle = specifiers.some(
|
|
33
|
-
|
|
34
|
-
function(expose) {
|
|
35
|
-
return expose.value === filename && (scope = expose.key);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
30
|
+
shouldHandle = specifiers.some((specifier)=>specifier.imported && specifier.imported.name === hookId && processedExposes.find(// biome-ignore lint/suspicious/noAssignInExpressions: <explanation>
|
|
31
|
+
(expose)=>expose.value === filename && (scope = expose.key)));
|
|
38
32
|
}
|
|
39
33
|
},
|
|
40
|
-
CallExpression
|
|
34
|
+
CallExpression (nodePath) {
|
|
41
35
|
if (shouldHandle && t.isIdentifier(nodePath.node.callee, {
|
|
42
36
|
name: hookId
|
|
43
37
|
}) && nodePath.node.arguments.length > 0) {
|
|
44
|
-
|
|
45
|
-
if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find(
|
|
46
|
-
return p.key.name === attribute;
|
|
47
|
-
})) {
|
|
38
|
+
const objectExpression = nodePath.node.arguments[0];
|
|
39
|
+
if (objectExpression && t.isObjectExpression(objectExpression) && !objectExpression.properties.find((p)=>p.key.name === attribute)) {
|
|
48
40
|
objectExpression.properties.push(t.objectProperty(t.identifier(attribute), t.stringLiteral(name + scope)));
|
|
49
41
|
}
|
|
50
42
|
}
|
|
51
43
|
}
|
|
52
44
|
}
|
|
53
45
|
};
|
|
54
|
-
}
|
|
46
|
+
});
|
|
55
47
|
|
|
56
48
|
export { babel as default };
|