@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/react.cjs.cjs
CHANGED
|
@@ -6,15 +6,15 @@ var prefetch = require('./prefetch.cjs.cjs');
|
|
|
6
6
|
var universal = require('./universal.cjs.cjs');
|
|
7
7
|
var runtimeUtils = require('./runtime-utils.cjs.cjs');
|
|
8
8
|
|
|
9
|
-
const useFirstMounted = ()=>{
|
|
9
|
+
const useFirstMounted = () => {
|
|
10
10
|
const ref = react.useRef(true);
|
|
11
|
-
react.useEffect(()=>{
|
|
11
|
+
react.useEffect(() => {
|
|
12
12
|
ref.current = false;
|
|
13
13
|
}, []);
|
|
14
14
|
return ref.current;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const usePrefetch = (options)=>{
|
|
17
|
+
const usePrefetch = (options) => {
|
|
18
18
|
const isFirstMounted = useFirstMounted();
|
|
19
19
|
if (isFirstMounted) {
|
|
20
20
|
const startTiming = performance.now();
|
|
@@ -23,30 +23,32 @@ const usePrefetch = (options)=>{
|
|
|
23
23
|
const { id, functionId, deferId } = options;
|
|
24
24
|
const prefetchInfo = {
|
|
25
25
|
id,
|
|
26
|
-
functionId
|
|
26
|
+
functionId,
|
|
27
27
|
};
|
|
28
28
|
const mfScope = runtimeUtils.getScope();
|
|
29
29
|
let state;
|
|
30
30
|
const prefetchResult = universal.prefetch(options);
|
|
31
31
|
if (deferId) {
|
|
32
32
|
if (prefetchResult instanceof Promise) {
|
|
33
|
-
state = prefetchResult.then((deferredData)=>deferredData.data[deferId]);
|
|
34
|
-
}
|
|
33
|
+
state = prefetchResult.then((deferredData) => deferredData.data[deferId]);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
35
36
|
state = prefetchResult.data[deferId];
|
|
36
37
|
}
|
|
37
|
-
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
38
40
|
state = prefetchResult;
|
|
39
41
|
}
|
|
40
42
|
const [prefetchState, setPrefetchState] = react.useState(state);
|
|
41
43
|
const prefetchInstance = prefetch.MFDataPrefetch.getInstance(mfScope);
|
|
42
|
-
react.useEffect(()=>{
|
|
44
|
+
react.useEffect(() => {
|
|
43
45
|
const useEffectTiming = performance.now();
|
|
44
46
|
index.logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);
|
|
45
|
-
return ()=>{
|
|
47
|
+
return () => {
|
|
46
48
|
prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
|
|
47
49
|
};
|
|
48
50
|
}, []);
|
|
49
|
-
const refreshExecutor = (refetchParams)=>{
|
|
51
|
+
const refreshExecutor = (refetchParams) => {
|
|
50
52
|
const refetchOptions = Object.assign({}, options);
|
|
51
53
|
if (refetchParams) {
|
|
52
54
|
refetchOptions.refetchParams = refetchParams;
|
|
@@ -56,19 +58,18 @@ const usePrefetch = (options)=>{
|
|
|
56
58
|
let newState;
|
|
57
59
|
if (deferId) {
|
|
58
60
|
if (newVal instanceof Promise) {
|
|
59
|
-
newState = newVal.then((deferredData)=>deferredData.data[deferId]);
|
|
60
|
-
}
|
|
61
|
+
newState = newVal.then((deferredData) => deferredData.data[deferId]);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
61
64
|
newState = newVal.data[deferId];
|
|
62
65
|
}
|
|
63
|
-
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
64
68
|
newState = newVal;
|
|
65
69
|
}
|
|
66
70
|
setPrefetchState(newState);
|
|
67
71
|
};
|
|
68
|
-
return [
|
|
69
|
-
prefetchState,
|
|
70
|
-
refreshExecutor
|
|
71
|
-
];
|
|
72
|
+
return [prefetchState, refreshExecutor];
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
exports.usePrefetch = usePrefetch;
|
package/dist/react.cjs.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.cjs.cjs","sources":["../src/react/utils.ts","../src/react/hooks.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nexport const useFirstMounted = () => {\n const ref = useRef(true);\n useEffect(() => {\n ref.current = false;\n }, []);\n return ref.current;\n};\n","import { useEffect, useState } from 'react';\nimport logger from '../logger';\nimport { MFDataPrefetch } from '../prefetch';\nimport { prefetch } from '../universal';\nimport { getScope } from '../common/runtime-utils';\nimport { useFirstMounted } from './utils';\nexport const usePrefetch = (options) => {\n const isFirstMounted = useFirstMounted();\n if (isFirstMounted) {\n const startTiming = performance.now();\n logger.info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);\n }\n const { id, functionId, deferId } = options;\n const prefetchInfo = {\n id,\n functionId,\n };\n const mfScope = getScope();\n let state;\n const prefetchResult = prefetch(options);\n if (deferId) {\n if (prefetchResult instanceof Promise) {\n state = prefetchResult.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n state = prefetchResult.data[deferId];\n }\n }\n else {\n state = prefetchResult;\n }\n const [prefetchState, setPrefetchState] = useState(state);\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope);\n useEffect(() => {\n const useEffectTiming = performance.now();\n logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);\n return () => {\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n };\n }, []);\n const refreshExecutor = (refetchParams) => {\n const refetchOptions = Object.assign({}, options);\n if (refetchParams) {\n refetchOptions.refetchParams = refetchParams;\n }\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n const newVal = prefetch(refetchOptions);\n let newState;\n if (deferId) {\n if (newVal instanceof Promise) {\n newState = newVal.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n newState = newVal.data[deferId];\n }\n }\n else {\n newState = newVal;\n }\n setPrefetchState(newState);\n };\n return [prefetchState, refreshExecutor];\n};\n"],"names":["
|
|
1
|
+
{"version":3,"file":"react.cjs.cjs","sources":["../src/react/utils.ts","../src/react/hooks.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nexport const useFirstMounted = () => {\n const ref = useRef(true);\n useEffect(() => {\n ref.current = false;\n }, []);\n return ref.current;\n};\n","import { useEffect, useState } from 'react';\nimport logger from '../logger';\nimport { MFDataPrefetch } from '../prefetch';\nimport { prefetch } from '../universal';\nimport { getScope } from '../common/runtime-utils';\nimport { useFirstMounted } from './utils';\nexport const usePrefetch = (options) => {\n const isFirstMounted = useFirstMounted();\n if (isFirstMounted) {\n const startTiming = performance.now();\n logger.info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);\n }\n const { id, functionId, deferId } = options;\n const prefetchInfo = {\n id,\n functionId,\n };\n const mfScope = getScope();\n let state;\n const prefetchResult = prefetch(options);\n if (deferId) {\n if (prefetchResult instanceof Promise) {\n state = prefetchResult.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n state = prefetchResult.data[deferId];\n }\n }\n else {\n state = prefetchResult;\n }\n const [prefetchState, setPrefetchState] = useState(state);\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope);\n useEffect(() => {\n const useEffectTiming = performance.now();\n logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);\n return () => {\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n };\n }, []);\n const refreshExecutor = (refetchParams) => {\n const refetchOptions = Object.assign({}, options);\n if (refetchParams) {\n refetchOptions.refetchParams = refetchParams;\n }\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n const newVal = prefetch(refetchOptions);\n let newState;\n if (deferId) {\n if (newVal instanceof Promise) {\n newState = newVal.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n newState = newVal.data[deferId];\n }\n }\n else {\n newState = newVal;\n }\n setPrefetchState(newState);\n };\n return [prefetchState, refreshExecutor];\n};\n"],"names":["useRef","useEffect","logger","getScope","prefetch","useState","MFDataPrefetch"],"mappings":";;;;;;;;AACO,MAAM,eAAe,GAAG,MAAM;AACrC,IAAI,MAAM,GAAG,GAAGA,YAAM,CAAC,IAAI,CAAC;AAC5B,IAAIC,eAAS,CAAC,MAAM;AACpB,QAAQ,GAAG,CAAC,OAAO,GAAG,KAAK;AAC3B,KAAK,EAAE,EAAE,CAAC;AACV,IAAI,OAAO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
|
@@ -4,15 +4,15 @@ import { M as MFDataPrefetch } from './prefetch.esm.js';
|
|
|
4
4
|
import { prefetch } from './universal.esm.js';
|
|
5
5
|
import { g as getScope } from './runtime-utils.esm.js';
|
|
6
6
|
|
|
7
|
-
const useFirstMounted = ()=>{
|
|
7
|
+
const useFirstMounted = () => {
|
|
8
8
|
const ref = useRef(true);
|
|
9
|
-
useEffect(()=>{
|
|
9
|
+
useEffect(() => {
|
|
10
10
|
ref.current = false;
|
|
11
11
|
}, []);
|
|
12
12
|
return ref.current;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const usePrefetch = (options)=>{
|
|
15
|
+
const usePrefetch = (options) => {
|
|
16
16
|
const isFirstMounted = useFirstMounted();
|
|
17
17
|
if (isFirstMounted) {
|
|
18
18
|
const startTiming = performance.now();
|
|
@@ -21,30 +21,32 @@ const usePrefetch = (options)=>{
|
|
|
21
21
|
const { id, functionId, deferId } = options;
|
|
22
22
|
const prefetchInfo = {
|
|
23
23
|
id,
|
|
24
|
-
functionId
|
|
24
|
+
functionId,
|
|
25
25
|
};
|
|
26
26
|
const mfScope = getScope();
|
|
27
27
|
let state;
|
|
28
28
|
const prefetchResult = prefetch(options);
|
|
29
29
|
if (deferId) {
|
|
30
30
|
if (prefetchResult instanceof Promise) {
|
|
31
|
-
state = prefetchResult.then((deferredData)=>deferredData.data[deferId]);
|
|
32
|
-
}
|
|
31
|
+
state = prefetchResult.then((deferredData) => deferredData.data[deferId]);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
33
34
|
state = prefetchResult.data[deferId];
|
|
34
35
|
}
|
|
35
|
-
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
36
38
|
state = prefetchResult;
|
|
37
39
|
}
|
|
38
40
|
const [prefetchState, setPrefetchState] = useState(state);
|
|
39
41
|
const prefetchInstance = MFDataPrefetch.getInstance(mfScope);
|
|
40
|
-
useEffect(()=>{
|
|
42
|
+
useEffect(() => {
|
|
41
43
|
const useEffectTiming = performance.now();
|
|
42
44
|
logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);
|
|
43
|
-
return ()=>{
|
|
45
|
+
return () => {
|
|
44
46
|
prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
|
|
45
47
|
};
|
|
46
48
|
}, []);
|
|
47
|
-
const refreshExecutor = (refetchParams)=>{
|
|
49
|
+
const refreshExecutor = (refetchParams) => {
|
|
48
50
|
const refetchOptions = Object.assign({}, options);
|
|
49
51
|
if (refetchParams) {
|
|
50
52
|
refetchOptions.refetchParams = refetchParams;
|
|
@@ -54,19 +56,18 @@ const usePrefetch = (options)=>{
|
|
|
54
56
|
let newState;
|
|
55
57
|
if (deferId) {
|
|
56
58
|
if (newVal instanceof Promise) {
|
|
57
|
-
newState = newVal.then((deferredData)=>deferredData.data[deferId]);
|
|
58
|
-
}
|
|
59
|
+
newState = newVal.then((deferredData) => deferredData.data[deferId]);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
59
62
|
newState = newVal.data[deferId];
|
|
60
63
|
}
|
|
61
|
-
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
62
66
|
newState = newVal;
|
|
63
67
|
}
|
|
64
68
|
setPrefetchState(newState);
|
|
65
69
|
};
|
|
66
|
-
return [
|
|
67
|
-
prefetchState,
|
|
68
|
-
refreshExecutor
|
|
69
|
-
];
|
|
70
|
+
return [prefetchState, refreshExecutor];
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
export { usePrefetch };
|
package/dist/react.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.esm.js","sources":["../src/react/utils.ts","../src/react/hooks.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nexport const useFirstMounted = () => {\n const ref = useRef(true);\n useEffect(() => {\n ref.current = false;\n }, []);\n return ref.current;\n};\n","import { useEffect, useState } from 'react';\nimport logger from '../logger';\nimport { MFDataPrefetch } from '../prefetch';\nimport { prefetch } from '../universal';\nimport { getScope } from '../common/runtime-utils';\nimport { useFirstMounted } from './utils';\nexport const usePrefetch = (options) => {\n const isFirstMounted = useFirstMounted();\n if (isFirstMounted) {\n const startTiming = performance.now();\n logger.info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);\n }\n const { id, functionId, deferId } = options;\n const prefetchInfo = {\n id,\n functionId,\n };\n const mfScope = getScope();\n let state;\n const prefetchResult = prefetch(options);\n if (deferId) {\n if (prefetchResult instanceof Promise) {\n state = prefetchResult.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n state = prefetchResult.data[deferId];\n }\n }\n else {\n state = prefetchResult;\n }\n const [prefetchState, setPrefetchState] = useState(state);\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope);\n useEffect(() => {\n const useEffectTiming = performance.now();\n logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);\n return () => {\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n };\n }, []);\n const refreshExecutor = (refetchParams) => {\n const refetchOptions = Object.assign({}, options);\n if (refetchParams) {\n refetchOptions.refetchParams = refetchParams;\n }\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n const newVal = prefetch(refetchOptions);\n let newState;\n if (deferId) {\n if (newVal instanceof Promise) {\n newState = newVal.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n newState = newVal.data[deferId];\n }\n }\n else {\n newState = newVal;\n }\n setPrefetchState(newState);\n };\n return [prefetchState, refreshExecutor];\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"react.esm.js","sources":["../src/react/utils.ts","../src/react/hooks.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nexport const useFirstMounted = () => {\n const ref = useRef(true);\n useEffect(() => {\n ref.current = false;\n }, []);\n return ref.current;\n};\n","import { useEffect, useState } from 'react';\nimport logger from '../logger';\nimport { MFDataPrefetch } from '../prefetch';\nimport { prefetch } from '../universal';\nimport { getScope } from '../common/runtime-utils';\nimport { useFirstMounted } from './utils';\nexport const usePrefetch = (options) => {\n const isFirstMounted = useFirstMounted();\n if (isFirstMounted) {\n const startTiming = performance.now();\n logger.info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);\n }\n const { id, functionId, deferId } = options;\n const prefetchInfo = {\n id,\n functionId,\n };\n const mfScope = getScope();\n let state;\n const prefetchResult = prefetch(options);\n if (deferId) {\n if (prefetchResult instanceof Promise) {\n state = prefetchResult.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n state = prefetchResult.data[deferId];\n }\n }\n else {\n state = prefetchResult;\n }\n const [prefetchState, setPrefetchState] = useState(state);\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope);\n useEffect(() => {\n const useEffectTiming = performance.now();\n logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);\n return () => {\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n };\n }, []);\n const refreshExecutor = (refetchParams) => {\n const refetchOptions = Object.assign({}, options);\n if (refetchParams) {\n refetchOptions.refetchParams = refetchParams;\n }\n prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);\n const newVal = prefetch(refetchOptions);\n let newState;\n if (deferId) {\n if (newVal instanceof Promise) {\n newState = newVal.then((deferredData) => deferredData.data[deferId]);\n }\n else {\n newState = newVal.data[deferId];\n }\n }\n else {\n newState = newVal;\n }\n setPrefetchState(newState);\n };\n return [prefetchState, refreshExecutor];\n};\n"],"names":[],"mappings":";;;;;;AACO,MAAM,eAAe,GAAG,MAAM;AACrC,IAAI,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC;AAC5B,IAAI,SAAS,CAAC,MAAM;AACpB,QAAQ,GAA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aAAa,EAAE,eAAe,CAAC;AAC3C;;;;"}
|
|
@@ -3,16 +3,17 @@
|
|
|
3
3
|
var runtime = require('@module-federation/runtime');
|
|
4
4
|
var sdk = require('@module-federation/sdk');
|
|
5
5
|
|
|
6
|
-
const getScope = ()=>{
|
|
6
|
+
const getScope = () => {
|
|
7
7
|
return runtime.getInstance().options.name;
|
|
8
8
|
};
|
|
9
|
-
const getPrefetchId = (id)=>sdk.encodeName(`${id}/${sdk.MFPrefetchCommon.identifier}`);
|
|
10
|
-
const compatGetPrefetchId = (id)=>sdk.encodeName(`${id}/VmokPrefetch`);
|
|
11
|
-
const getSignalFromManifest = (remoteSnapshot)=>{
|
|
9
|
+
const getPrefetchId = (id) => sdk.encodeName(`${id}/${sdk.MFPrefetchCommon.identifier}`);
|
|
10
|
+
const compatGetPrefetchId = (id) => sdk.encodeName(`${id}/VmokPrefetch`);
|
|
11
|
+
const getSignalFromManifest = (remoteSnapshot) => {
|
|
12
12
|
if (!remoteSnapshot) {
|
|
13
13
|
return false;
|
|
14
14
|
}
|
|
15
|
-
if (!('prefetchEntry' in remoteSnapshot) &&
|
|
15
|
+
if (!('prefetchEntry' in remoteSnapshot) &&
|
|
16
|
+
!('prefetchInterface' in remoteSnapshot)) {
|
|
16
17
|
return false;
|
|
17
18
|
}
|
|
18
19
|
if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-utils.cjs.cjs","sources":["../src/common/runtime-utils.ts"],"sourcesContent":["import { getInstance } from '@module-federation/runtime';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nexport const getScope = () => {\n return getInstance().options.name;\n};\nexport const getPrefetchId = (id) => encodeName(`${id}/${MFPrefetchCommon.identifier}`);\nexport const compatGetPrefetchId = (id) => encodeName(`${id}/VmokPrefetch`);\nexport const getSignalFromManifest = (remoteSnapshot) => {\n if (!remoteSnapshot) {\n return false;\n }\n if (!('prefetchEntry' in remoteSnapshot) &&\n !('prefetchInterface' in remoteSnapshot)) {\n return false;\n }\n if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {\n return false;\n }\n return true;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"file":"runtime-utils.cjs.cjs","sources":["../src/common/runtime-utils.ts"],"sourcesContent":["import { getInstance } from '@module-federation/runtime';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nexport const getScope = () => {\n return getInstance().options.name;\n};\nexport const getPrefetchId = (id) => encodeName(`${id}/${MFPrefetchCommon.identifier}`);\nexport const compatGetPrefetchId = (id) => encodeName(`${id}/VmokPrefetch`);\nexport const getSignalFromManifest = (remoteSnapshot) => {\n if (!remoteSnapshot) {\n return false;\n }\n if (!('prefetchEntry' in remoteSnapshot) &&\n !('prefetchInterface' in remoteSnapshot)) {\n return false;\n }\n if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {\n return false;\n }\n return true;\n};\n"],"names":["getInstance","encodeName","MFPrefetchCommon"],"mappings":";;;;;AAEY,MAAC,QAAQ,GAAG,MAAM;AAC9B,IAAI,OAAOA,mBAAW,EAAE,CAAC,OAAO,CAAC,IAAI;AACrC;AACY,MAAC,aAAa,GAAG,CAAC,EAAE,KAAKC,cAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAEC,oBAAgB,CAAC,UAAU,CAAC,CAAC;AAC1E,MAAC,mBAAmB,GAAG,CAAC,EAAE,KAAKD,cAAU,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC;AAC9D,MAAC,qBAAqB,GAAG,CAAC,cAAc,KAAK;AACzD,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,IAAI,EAAE,eAAe,IAAI,cAAc,CAAC;AAC5C,QAAQ,EAAE,mBAAmB,IAAI,cAAc,CAAC,EAAE;AAClD,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE;AAC5E,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,OAAO,IAAI;AACf;;;;;;;"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { getInstance } from '@module-federation/runtime';
|
|
2
2
|
import { encodeName, MFPrefetchCommon } from '@module-federation/sdk';
|
|
3
3
|
|
|
4
|
-
const getScope = ()=>{
|
|
4
|
+
const getScope = () => {
|
|
5
5
|
return getInstance().options.name;
|
|
6
6
|
};
|
|
7
|
-
const getPrefetchId = (id)=>encodeName(`${id}/${MFPrefetchCommon.identifier}`);
|
|
8
|
-
const compatGetPrefetchId = (id)=>encodeName(`${id}/VmokPrefetch`);
|
|
9
|
-
const getSignalFromManifest = (remoteSnapshot)=>{
|
|
7
|
+
const getPrefetchId = (id) => encodeName(`${id}/${MFPrefetchCommon.identifier}`);
|
|
8
|
+
const compatGetPrefetchId = (id) => encodeName(`${id}/VmokPrefetch`);
|
|
9
|
+
const getSignalFromManifest = (remoteSnapshot) => {
|
|
10
10
|
if (!remoteSnapshot) {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
-
if (!('prefetchEntry' in remoteSnapshot) &&
|
|
13
|
+
if (!('prefetchEntry' in remoteSnapshot) &&
|
|
14
|
+
!('prefetchInterface' in remoteSnapshot)) {
|
|
14
15
|
return false;
|
|
15
16
|
}
|
|
16
17
|
if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-utils.esm.js","sources":["../src/common/runtime-utils.ts"],"sourcesContent":["import { getInstance } from '@module-federation/runtime';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nexport const getScope = () => {\n return getInstance().options.name;\n};\nexport const getPrefetchId = (id) => encodeName(`${id}/${MFPrefetchCommon.identifier}`);\nexport const compatGetPrefetchId = (id) => encodeName(`${id}/VmokPrefetch`);\nexport const getSignalFromManifest = (remoteSnapshot) => {\n if (!remoteSnapshot) {\n return false;\n }\n if (!('prefetchEntry' in remoteSnapshot) &&\n !('prefetchInterface' in remoteSnapshot)) {\n return false;\n }\n if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {\n return false;\n }\n return true;\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"runtime-utils.esm.js","sources":["../src/common/runtime-utils.ts"],"sourcesContent":["import { getInstance } from '@module-federation/runtime';\nimport { encodeName, MFPrefetchCommon, } from '@module-federation/sdk';\nexport const getScope = () => {\n return getInstance().options.name;\n};\nexport const getPrefetchId = (id) => encodeName(`${id}/${MFPrefetchCommon.identifier}`);\nexport const compatGetPrefetchId = (id) => encodeName(`${id}/VmokPrefetch`);\nexport const getSignalFromManifest = (remoteSnapshot) => {\n if (!remoteSnapshot) {\n return false;\n }\n if (!('prefetchEntry' in remoteSnapshot) &&\n !('prefetchInterface' in remoteSnapshot)) {\n return false;\n }\n if (!remoteSnapshot.prefetchEntry && !remoteSnapshot.prefetchInterface) {\n return false;\n }\n return true;\n};\n"],"names":[],"mappings":";;;AAEY,MAAC,QAAQ,GAAG,MAAM;AAC9B,IAAI,OAAO,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI;AACrC;AACY,MAAC,aAAa,GAAG,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC1E,MAAC,mBAAmB,GAAG,CAAC,EAAE,KAAK,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC;AAC9D,MAAC,qBAAqB,GAAG,CAAC,cAAc,KAAK;AACzD,IAAI,IAAI,CAAC,cAAc,EAAE;AACzB,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,IAAI,EAAE,eAAe,IAAI,cAAc,CAAC;AAC5C,QAAQ,EAAE,mBAAmB,IAAI,cAAc,CAAC,EAAE;AAClD,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE;AAC5E,QAAQ,OAAO,KAAK;AACpB;AACA,IAAI,OAAO,IAAI;AACf;;;;"}
|
package/dist/universal.cjs.cjs
CHANGED
|
@@ -6,18 +6,20 @@ var runtimeUtils = require('./runtime-utils.cjs.cjs');
|
|
|
6
6
|
function prefetch(options) {
|
|
7
7
|
const { id, functionId = 'default' } = options;
|
|
8
8
|
const mfScope = runtimeUtils.getScope();
|
|
9
|
-
const prefetchInstance = prefetch$1.MFDataPrefetch.getInstance(mfScope) ||
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const prefetchInstance = prefetch$1.MFDataPrefetch.getInstance(mfScope) ||
|
|
10
|
+
new prefetch$1.MFDataPrefetch({
|
|
11
|
+
name: mfScope,
|
|
12
|
+
});
|
|
12
13
|
const res = prefetchInstance.getProjectExports();
|
|
13
14
|
if (res instanceof Promise) {
|
|
14
|
-
const promise = res.then(()=>{
|
|
15
|
+
const promise = res.then(() => {
|
|
15
16
|
const result = prefetchInstance.prefetch(options);
|
|
16
17
|
prefetchInstance.memorize(id + functionId, result);
|
|
17
18
|
return result;
|
|
18
19
|
});
|
|
19
20
|
return promise;
|
|
20
|
-
}
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
21
23
|
const result = prefetchInstance.prefetch(options);
|
|
22
24
|
prefetchInstance.memorize(id + functionId, result);
|
|
23
25
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal.cjs.cjs","sources":["../src/universal/index.ts"],"sourcesContent":["import { MFDataPrefetch } from '../prefetch';\nimport { getScope } from '../common/runtime-utils';\nexport function prefetch(options) {\n const { id, functionId = 'default' } = options;\n const mfScope = getScope();\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||\n new MFDataPrefetch({\n name: mfScope,\n });\n const res = prefetchInstance.getProjectExports();\n if (res instanceof Promise) {\n const promise = res.then(() => {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n });\n return promise;\n }\n else {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n }\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"universal.cjs.cjs","sources":["../src/universal/index.ts"],"sourcesContent":["import { MFDataPrefetch } from '../prefetch';\nimport { getScope } from '../common/runtime-utils';\nexport function prefetch(options) {\n const { id, functionId = 'default' } = options;\n const mfScope = getScope();\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||\n new MFDataPrefetch({\n name: mfScope,\n });\n const res = prefetchInstance.getProjectExports();\n if (res instanceof Promise) {\n const promise = res.then(() => {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n });\n return promise;\n }\n else {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n }\n}\n"],"names":["getScope","MFDataPrefetch"],"mappings":";;;;;AAEO,SAAS,QAAQ,CAAC,OAAO,EAAE;AAClC,IAAI,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,SAAS,EAAE,GAAG,OAAO;AAClD,IAAI,MAAM,OAAO,GAAGA,qBAAQ,EAAE;AAC9B,IAAI,MAAM,gBAAgB,GAAGC,yBAAc,CAAC,WAAW,CAAC,OAAO,CAAC;AAChE,QAAQ,IAAIA,yBAAc,CAAC;AAC3B,YAAY,IAAI,EAAE,OAAO;AACzB,SAAS,CAAC;AACV,IAAI,MAAM,GAAG,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;AACpD,IAAI,IAAI,GAAG,YAAY,OAAO,EAAE;AAChC,QAAQ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM;AACvC,YAAY,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC7D,YAAY,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,CAAC;AAC9D,YAAY,OAAO,MAAM;AACzB,SAAS,CAAC;AACV,QAAQ,OAAO,OAAO;AACtB;AACA,SAAS;AACT,QAAQ,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;AACzD,QAAQ,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,CAAC;AAC1D,QAAQ,OAAO,MAAM;AACrB;AACA;;;;"}
|
package/dist/universal.esm.js
CHANGED
|
@@ -4,18 +4,20 @@ import { g as getScope } from './runtime-utils.esm.js';
|
|
|
4
4
|
function prefetch(options) {
|
|
5
5
|
const { id, functionId = 'default' } = options;
|
|
6
6
|
const mfScope = getScope();
|
|
7
|
-
const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||
|
|
8
|
+
new MFDataPrefetch({
|
|
9
|
+
name: mfScope,
|
|
10
|
+
});
|
|
10
11
|
const res = prefetchInstance.getProjectExports();
|
|
11
12
|
if (res instanceof Promise) {
|
|
12
|
-
const promise = res.then(()=>{
|
|
13
|
+
const promise = res.then(() => {
|
|
13
14
|
const result = prefetchInstance.prefetch(options);
|
|
14
15
|
prefetchInstance.memorize(id + functionId, result);
|
|
15
16
|
return result;
|
|
16
17
|
});
|
|
17
18
|
return promise;
|
|
18
|
-
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
19
21
|
const result = prefetchInstance.prefetch(options);
|
|
20
22
|
prefetchInstance.memorize(id + functionId, result);
|
|
21
23
|
return result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"universal.esm.js","sources":["../src/universal/index.ts"],"sourcesContent":["import { MFDataPrefetch } from '../prefetch';\nimport { getScope } from '../common/runtime-utils';\nexport function prefetch(options) {\n const { id, functionId = 'default' } = options;\n const mfScope = getScope();\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||\n new MFDataPrefetch({\n name: mfScope,\n });\n const res = prefetchInstance.getProjectExports();\n if (res instanceof Promise) {\n const promise = res.then(() => {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n });\n return promise;\n }\n else {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n }\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"universal.esm.js","sources":["../src/universal/index.ts"],"sourcesContent":["import { MFDataPrefetch } from '../prefetch';\nimport { getScope } from '../common/runtime-utils';\nexport function prefetch(options) {\n const { id, functionId = 'default' } = options;\n const mfScope = getScope();\n const prefetchInstance = MFDataPrefetch.getInstance(mfScope) ||\n new MFDataPrefetch({\n name: mfScope,\n });\n const res = prefetchInstance.getProjectExports();\n if (res instanceof Promise) {\n const promise = res.then(() => {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n });\n return promise;\n }\n else {\n const result = prefetchInstance.prefetch(options);\n prefetchInstance.memorize(id + functionId, result);\n return result;\n }\n}\n"],"names":[],"mappings":";;;AAEO,SAAS,QAAQ,CAAC,OAAO,EAAE;AAClC,IAAI,MAAM,EAAE,EAAE,EAAE,UAAU,GAAG,SAAS,EAAE,GAAG,OAAO;AAClD,IAAI,MAAM,OAAO,GAAG,QAAQ,EAAE;AAC9B,IAAI,MAAM,gBAAgB,GAAG,cAAc,CAAC,WAAW,CAAC,OAAO,CAAC;AAChE,QAAQ,IAAI,cAAc,CAAC;AAC3B,YAAY,IAAI,EAAE,OAAO;AACzB,SAAS,CAAC;AACV,IAAI,MAAM,GAAG,GAAG,gBAAgB,CAAC,iBAAiB,EAAE;AACpD,IAAI,IAAI,GAAG,YAAY,OAAO,EAAE;AAChC,QAAQ,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,MAAM;AACvC,YAAY,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;AAC7D,YAAY,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,CAAC;AAC9D,YAAY,OAAO,MAAM;AACzB,SAAS,CAAC;AACV,QAAQ,OAAO,OAAO;AACtB;AACA,SAAS;AACT,QAAQ,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC;AACzD,QAAQ,gBAAgB,CAAC,QAAQ,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,CAAC;AAC1D,QAAQ,OAAO,MAAM;AACrB;AACA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/data-prefetch",
|
|
3
3
|
"description": "Module Federation Data Prefetch",
|
|
4
|
-
"version": "0.0.0-fix-lazy-comile-
|
|
4
|
+
"version": "0.0.0-fix-lazy-comile-20250929064217",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "nieyan <nyqykk@foxmail.com>",
|
|
7
7
|
"homepage": "https://github.com/module-federation/core",
|
|
@@ -89,8 +89,8 @@
|
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
91
|
"fs-extra": "9.1.0",
|
|
92
|
-
"@module-federation/
|
|
93
|
-
"@module-federation/
|
|
92
|
+
"@module-federation/sdk": "0.0.0-fix-lazy-comile-20250929064217",
|
|
93
|
+
"@module-federation/runtime": "0.0.0-fix-lazy-comile-20250929064217"
|
|
94
94
|
},
|
|
95
95
|
"scripts": {
|
|
96
96
|
"test": "jest"
|