@module-federation/data-prefetch 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/dist/babel.cjs +95 -0
  2. package/dist/babel.d.cts +1 -0
  3. package/dist/babel.d.ts +1 -2
  4. package/dist/babel.js +5 -0
  5. package/dist/cli/babel.cjs +115 -0
  6. package/dist/cli/babel.d.ts +37 -0
  7. package/dist/cli/babel.js +52 -0
  8. package/dist/cli/index.cjs +230 -0
  9. package/dist/cli/index.d.ts +16 -0
  10. package/dist/cli/index.js +171 -0
  11. package/dist/cli.cjs +95 -0
  12. package/dist/cli.d.cts +1 -0
  13. package/dist/cli.d.ts +1 -1
  14. package/dist/cli.js +5 -0
  15. package/dist/common/constant.cjs +51 -0
  16. package/dist/common/constant.d.ts +1 -0
  17. package/dist/common/constant.js +5 -0
  18. package/dist/common/index.cjs +95 -0
  19. package/dist/common/index.d.ts +1 -0
  20. package/dist/common/index.js +5 -0
  21. package/dist/common/node-utils.cjs +100 -0
  22. package/dist/common/node-utils.d.ts +2 -0
  23. package/dist/common/node-utils.js +35 -0
  24. package/dist/common/runtime-utils.cjs +84 -0
  25. package/dist/common/runtime-utils.d.ts +5 -0
  26. package/dist/common/runtime-utils.js +29 -0
  27. package/dist/constant.cjs +51 -0
  28. package/dist/constant.d.ts +1 -0
  29. package/dist/constant.js +5 -0
  30. package/dist/index.cjs +106 -0
  31. package/dist/index.d.ts +2 -1
  32. package/dist/index.js +7 -0
  33. package/dist/logger/index.cjs +60 -0
  34. package/dist/logger/index.d.ts +2 -0
  35. package/dist/logger/index.js +10 -0
  36. package/dist/plugin.cjs +234 -0
  37. package/dist/{src/plugin.d.ts → plugin.d.cts} +1 -1
  38. package/dist/plugin.d.ts +3 -2
  39. package/dist/plugin.js +173 -0
  40. package/dist/prefetch.cjs +197 -0
  41. package/dist/prefetch.d.ts +42 -0
  42. package/dist/prefetch.js +149 -0
  43. package/dist/react/hooks.cjs +144 -0
  44. package/dist/react/hooks.d.ts +11 -0
  45. package/dist/{react.esm.js → react/hooks.js} +42 -30
  46. package/dist/react/index.cjs +95 -0
  47. package/dist/react/index.d.ts +1 -0
  48. package/dist/react/index.js +5 -0
  49. package/dist/react/utils.cjs +65 -0
  50. package/dist/react/utils.d.ts +1 -0
  51. package/dist/react/utils.js +15 -0
  52. package/dist/react.cjs +95 -0
  53. package/dist/react.d.cts +1 -0
  54. package/dist/react.d.ts +1 -1
  55. package/dist/react.js +5 -0
  56. package/dist/universal/index.cjs +81 -0
  57. package/dist/universal/index.d.ts +2 -0
  58. package/dist/{universal.esm.js → universal/index.js} +14 -10
  59. package/dist/universal.cjs +95 -0
  60. package/dist/universal.d.cts +1 -0
  61. package/dist/universal.d.ts +1 -1
  62. package/dist/universal.js +5 -0
  63. package/package.json +47 -21
  64. package/dist/babel.cjs.cjs +0 -54
  65. package/dist/babel.cjs.cjs.map +0 -1
  66. package/dist/babel.cjs.d.ts +0 -2
  67. package/dist/babel.esm.js +0 -52
  68. package/dist/babel.esm.js.map +0 -1
  69. package/dist/cli.cjs.cjs +0 -156
  70. package/dist/cli.cjs.cjs.map +0 -1
  71. package/dist/cli.cjs.d.ts +0 -1
  72. package/dist/cli.esm.js +0 -153
  73. package/dist/cli.esm.js.map +0 -1
  74. package/dist/constant.cjs.cjs +0 -6
  75. package/dist/constant.cjs.cjs.map +0 -1
  76. package/dist/constant.esm.js +0 -4
  77. package/dist/constant.esm.js.map +0 -1
  78. package/dist/index.cjs.cjs +0 -10
  79. package/dist/index.cjs.cjs.map +0 -1
  80. package/dist/index.cjs.d.ts +0 -1
  81. package/dist/index.cjs2.cjs +0 -8
  82. package/dist/index.cjs2.cjs.map +0 -1
  83. package/dist/index.esm.js +0 -3
  84. package/dist/index.esm.js.map +0 -1
  85. package/dist/index.esm2.js +0 -6
  86. package/dist/index.esm2.js.map +0 -1
  87. package/dist/plugin.cjs.cjs +0 -158
  88. package/dist/plugin.cjs.cjs.map +0 -1
  89. package/dist/plugin.cjs.d.ts +0 -2
  90. package/dist/plugin.esm.js +0 -153
  91. package/dist/plugin.esm.js.map +0 -1
  92. package/dist/prefetch.cjs.cjs +0 -182
  93. package/dist/prefetch.cjs.cjs.map +0 -1
  94. package/dist/prefetch.esm.js +0 -179
  95. package/dist/prefetch.esm.js.map +0 -1
  96. package/dist/react.cjs.cjs +0 -76
  97. package/dist/react.cjs.cjs.map +0 -1
  98. package/dist/react.cjs.d.ts +0 -1
  99. package/dist/react.esm.js.map +0 -1
  100. package/dist/runtime-utils.cjs.cjs +0 -29
  101. package/dist/runtime-utils.cjs.cjs.map +0 -1
  102. package/dist/runtime-utils.esm.js +0 -24
  103. package/dist/runtime-utils.esm.js.map +0 -1
  104. package/dist/universal.cjs.cjs +0 -30
  105. package/dist/universal.cjs.cjs.map +0 -1
  106. package/dist/universal.cjs.d.ts +0 -1
  107. package/dist/universal.esm.js.map +0 -1
  108. /package/dist/{src/cli/babel.d.ts → cli/babel.d.cts} +0 -0
  109. /package/dist/{src/cli/index.d.ts → cli/index.d.cts} +0 -0
  110. /package/dist/{src/common/constant.d.ts → common/constant.d.cts} +0 -0
  111. /package/dist/{src/common/index.d.ts → common/index.d.cts} +0 -0
  112. /package/dist/{src/common/node-utils.d.ts → common/node-utils.d.cts} +0 -0
  113. /package/dist/{src/common/runtime-utils.d.ts → common/runtime-utils.d.cts} +0 -0
  114. /package/dist/{src/constant.d.ts → constant.d.cts} +0 -0
  115. /package/dist/{src/index.d.ts → index.d.cts} +0 -0
  116. /package/dist/{src/logger/index.d.ts → logger/index.d.cts} +0 -0
  117. /package/dist/{src/prefetch.d.ts → prefetch.d.cts} +0 -0
  118. /package/dist/{src/react/hooks.d.ts → react/hooks.d.cts} +0 -0
  119. /package/dist/{src/react/index.d.ts → react/index.d.cts} +0 -0
  120. /package/dist/{src/react/utils.d.ts → react/utils.d.cts} +0 -0
  121. /package/dist/{src/universal/index.d.ts → universal/index.d.cts} +0 -0
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ /************************************************************************/
13
+ // webpack/runtime/compat_get_default_export
14
+ (() => {
15
+ // getDefaultExport function for compatibility with non-ESM modules
16
+ __webpack_require__.n = (module) => {
17
+ var getter = module && module.__esModule ?
18
+ () => (module['default']) :
19
+ () => (module);
20
+ __webpack_require__.d(getter, { a: getter });
21
+ return getter;
22
+ };
23
+
24
+ })();
25
+ // webpack/runtime/define_property_getters
26
+ (() => {
27
+ __webpack_require__.d = (exports, definition) => {
28
+ for(var key in definition) {
29
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
30
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
31
+ }
32
+ }
33
+ };
34
+ })();
35
+ // webpack/runtime/has_own_property
36
+ (() => {
37
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
38
+ })();
39
+ // webpack/runtime/make_namespace_object
40
+ (() => {
41
+ // define __esModule on exports
42
+ __webpack_require__.r = (exports) => {
43
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
44
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
+ }
46
+ Object.defineProperty(exports, '__esModule', { value: true });
47
+ };
48
+ })();
49
+ /************************************************************************/
50
+ var __webpack_exports__ = {};
51
+ // ESM COMPAT FLAG
52
+ __webpack_require__.r(__webpack_exports__);
53
+
54
+ // EXPORTS
55
+ __webpack_require__.d(__webpack_exports__, {
56
+ usePrefetch: () => (/* binding */ usePrefetch)
57
+ });
58
+
59
+ ;// CONCATENATED MODULE: external "react"
60
+ const external_react_namespaceObject = require("react");
61
+ ;// CONCATENATED MODULE: external "../logger/index.cjs"
62
+ const index_cjs_namespaceObject = require("../logger/index.cjs");
63
+ var index_cjs_default = /*#__PURE__*/__webpack_require__.n(index_cjs_namespaceObject);
64
+ ;// CONCATENATED MODULE: external "../prefetch.cjs"
65
+ const external_prefetch_cjs_namespaceObject = require("../prefetch.cjs");
66
+ ;// CONCATENATED MODULE: external "../universal.cjs"
67
+ const external_universal_cjs_namespaceObject = require("../universal.cjs");
68
+ ;// CONCATENATED MODULE: external "../common/runtime-utils.cjs"
69
+ const runtime_utils_cjs_namespaceObject = require("../common/runtime-utils.cjs");
70
+ ;// CONCATENATED MODULE: external "./utils.cjs"
71
+ const external_utils_cjs_namespaceObject = require("./utils.cjs");
72
+ ;// CONCATENATED MODULE: ./src/react/hooks.ts
73
+
74
+
75
+
76
+
77
+
78
+
79
+ const usePrefetch = (options)=>{
80
+ const isFirstMounted = (0,external_utils_cjs_namespaceObject.useFirstMounted)();
81
+ if (isFirstMounted) {
82
+ const startTiming = performance.now();
83
+ index_cjs_default().info(`2. Start Get Prefetch Data: ${options.id} - ${options.functionId || 'default'} - ${startTiming}`);
84
+ }
85
+ const { id, functionId, deferId } = options;
86
+ const prefetchInfo = {
87
+ id,
88
+ functionId
89
+ };
90
+ const mfScope = (0,runtime_utils_cjs_namespaceObject.getScope)();
91
+ let state;
92
+ const prefetchResult = (0,external_universal_cjs_namespaceObject.prefetch)(options);
93
+ if (deferId) {
94
+ if (prefetchResult instanceof Promise) {
95
+ state = prefetchResult.then((deferredData)=>deferredData.data[deferId]);
96
+ } else {
97
+ state = prefetchResult.data[deferId];
98
+ }
99
+ } else {
100
+ state = prefetchResult;
101
+ }
102
+ const [prefetchState, setPrefetchState] = (0,external_react_namespaceObject.useState)(state);
103
+ const prefetchInstance = external_prefetch_cjs_namespaceObject.MFDataPrefetch.getInstance(mfScope);
104
+ (0,external_react_namespaceObject.useEffect)(()=>{
105
+ const useEffectTiming = performance.now();
106
+ index_cjs_default().info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);
107
+ return ()=>{
108
+ prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
109
+ };
110
+ }, []);
111
+ const refreshExecutor = (refetchParams)=>{
112
+ const refetchOptions = {
113
+ ...options
114
+ };
115
+ if (refetchParams) {
116
+ refetchOptions.refetchParams = refetchParams;
117
+ }
118
+ prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
119
+ const newVal = (0,external_universal_cjs_namespaceObject.prefetch)(refetchOptions);
120
+ let newState;
121
+ if (deferId) {
122
+ if (newVal instanceof Promise) {
123
+ newState = newVal.then((deferredData)=>deferredData.data[deferId]);
124
+ } else {
125
+ newState = newVal.data[deferId];
126
+ }
127
+ } else {
128
+ newState = newVal;
129
+ }
130
+ setPrefetchState(newState);
131
+ };
132
+ return [
133
+ prefetchState,
134
+ refreshExecutor
135
+ ];
136
+ };
137
+
138
+ exports.usePrefetch = __webpack_exports__.usePrefetch;
139
+ for(var __webpack_i__ in __webpack_exports__) {
140
+ if(["usePrefetch"].indexOf(__webpack_i__) === -1) {
141
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
142
+ }
143
+ }
144
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,11 @@
1
+ import { type prefetchOptions } from '../prefetch';
2
+ type refetchParams = any;
3
+ type prefetchReturnType<T> = [
4
+ Promise<T>,
5
+ (refetchParams?: refetchParams) => void
6
+ ];
7
+ type UsePrefetchOptions = prefetchOptions & {
8
+ deferId?: string;
9
+ };
10
+ export declare const usePrefetch: <T>(options: UsePrefetchOptions) => prefetchReturnType<T>;
11
+ export {};
@@ -1,18 +1,30 @@
1
- import { useRef, useEffect, useState } from 'react';
2
- import { l as logger } from './index.esm2.js';
3
- import { M as MFDataPrefetch } from './prefetch.esm.js';
4
- import { prefetch } from './universal.esm.js';
5
- import { g as getScope } from './runtime-utils.esm.js';
1
+ import { useEffect, useState } from "react";
2
+ import logger from "../logger/index.js";
3
+ import { MFDataPrefetch } from "../prefetch.js";
4
+ import { prefetch } from "../universal.js";
5
+ import { getScope } from "../common/runtime-utils.js";
6
+ import { useFirstMounted } from "./utils.js";
7
+
8
+ ;// CONCATENATED MODULE: external "react"
9
+
10
+ ;// CONCATENATED MODULE: external "../logger/index.js"
11
+
12
+ ;// CONCATENATED MODULE: external "../prefetch.js"
13
+
14
+ ;// CONCATENATED MODULE: external "../universal.js"
15
+
16
+ ;// CONCATENATED MODULE: external "../common/runtime-utils.js"
17
+
18
+ ;// CONCATENATED MODULE: external "./utils.js"
19
+
20
+ ;// CONCATENATED MODULE: ./src/react/hooks.ts
6
21
 
7
- const useFirstMounted = () => {
8
- const ref = useRef(true);
9
- useEffect(() => {
10
- ref.current = false;
11
- }, []);
12
- return ref.current;
13
- };
14
22
 
15
- const usePrefetch = (options) => {
23
+
24
+
25
+
26
+
27
+ const usePrefetch = (options)=>{
16
28
  const isFirstMounted = useFirstMounted();
17
29
  if (isFirstMounted) {
18
30
  const startTiming = performance.now();
@@ -21,33 +33,33 @@ const usePrefetch = (options) => {
21
33
  const { id, functionId, deferId } = options;
22
34
  const prefetchInfo = {
23
35
  id,
24
- functionId,
36
+ functionId
25
37
  };
26
38
  const mfScope = getScope();
27
39
  let state;
28
40
  const prefetchResult = prefetch(options);
29
41
  if (deferId) {
30
42
  if (prefetchResult instanceof Promise) {
31
- state = prefetchResult.then((deferredData) => deferredData.data[deferId]);
32
- }
33
- else {
43
+ state = prefetchResult.then((deferredData)=>deferredData.data[deferId]);
44
+ } else {
34
45
  state = prefetchResult.data[deferId];
35
46
  }
36
- }
37
- else {
47
+ } else {
38
48
  state = prefetchResult;
39
49
  }
40
50
  const [prefetchState, setPrefetchState] = useState(state);
41
51
  const prefetchInstance = MFDataPrefetch.getInstance(mfScope);
42
- useEffect(() => {
52
+ useEffect(()=>{
43
53
  const useEffectTiming = performance.now();
44
54
  logger.info(`3. Start Execute UseEffect: ${options.id} - ${options.functionId || 'default'} - ${useEffectTiming}`);
45
- return () => {
55
+ return ()=>{
46
56
  prefetchInstance === null || prefetchInstance === void 0 ? void 0 : prefetchInstance.markOutdate(prefetchInfo, true);
47
57
  };
48
58
  }, []);
49
- const refreshExecutor = (refetchParams) => {
50
- const refetchOptions = Object.assign({}, options);
59
+ const refreshExecutor = (refetchParams)=>{
60
+ const refetchOptions = {
61
+ ...options
62
+ };
51
63
  if (refetchParams) {
52
64
  refetchOptions.refetchParams = refetchParams;
53
65
  }
@@ -56,19 +68,19 @@ const usePrefetch = (options) => {
56
68
  let newState;
57
69
  if (deferId) {
58
70
  if (newVal instanceof Promise) {
59
- newState = newVal.then((deferredData) => deferredData.data[deferId]);
60
- }
61
- else {
71
+ newState = newVal.then((deferredData)=>deferredData.data[deferId]);
72
+ } else {
62
73
  newState = newVal.data[deferId];
63
74
  }
64
- }
65
- else {
75
+ } else {
66
76
  newState = newVal;
67
77
  }
68
78
  setPrefetchState(newState);
69
79
  };
70
- return [prefetchState, refreshExecutor];
80
+ return [
81
+ prefetchState,
82
+ refreshExecutor
83
+ ];
71
84
  };
72
85
 
73
86
  export { usePrefetch };
74
- //# sourceMappingURL=react.esm.js.map
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ var __webpack_modules__ = ({
10
+ "./hooks": (function (module) {
11
+ module.exports = require("./hooks.cjs");
12
+
13
+ }),
14
+
15
+ });
16
+ /************************************************************************/
17
+ // The module cache
18
+ var __webpack_module_cache__ = {};
19
+
20
+ // The require function
21
+ function __webpack_require__(moduleId) {
22
+
23
+ // Check if module is in cache
24
+ var cachedModule = __webpack_module_cache__[moduleId];
25
+ if (cachedModule !== undefined) {
26
+ return cachedModule.exports;
27
+ }
28
+ // Create a new module (and put it into the cache)
29
+ var module = (__webpack_module_cache__[moduleId] = {
30
+ exports: {}
31
+ });
32
+ // Execute the module function
33
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
34
+
35
+ // Return the exports of the module
36
+ return module.exports;
37
+
38
+ }
39
+
40
+ /************************************************************************/
41
+ // webpack/runtime/compat_get_default_export
42
+ (() => {
43
+ // getDefaultExport function for compatibility with non-ESM modules
44
+ __webpack_require__.n = (module) => {
45
+ var getter = module && module.__esModule ?
46
+ () => (module['default']) :
47
+ () => (module);
48
+ __webpack_require__.d(getter, { a: getter });
49
+ return getter;
50
+ };
51
+
52
+ })();
53
+ // webpack/runtime/define_property_getters
54
+ (() => {
55
+ __webpack_require__.d = (exports, definition) => {
56
+ for(var key in definition) {
57
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
58
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
59
+ }
60
+ }
61
+ };
62
+ })();
63
+ // webpack/runtime/has_own_property
64
+ (() => {
65
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
66
+ })();
67
+ // webpack/runtime/make_namespace_object
68
+ (() => {
69
+ // define __esModule on exports
70
+ __webpack_require__.r = (exports) => {
71
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
72
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
73
+ }
74
+ Object.defineProperty(exports, '__esModule', { value: true });
75
+ };
76
+ })();
77
+ /************************************************************************/
78
+ var __webpack_exports__ = {};
79
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
80
+ (() => {
81
+ __webpack_require__.r(__webpack_exports__);
82
+ /* ESM import */var _hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./hooks");
83
+ /* ESM import */var _hooks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_hooks__WEBPACK_IMPORTED_MODULE_0__);
84
+
85
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
86
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _hooks__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _hooks__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
87
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
88
+
89
+
90
+ })();
91
+
92
+ for(var __webpack_i__ in __webpack_exports__) {
93
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
94
+ }
95
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1 @@
1
+ export * from './hooks';
@@ -0,0 +1,5 @@
1
+ export * from "./hooks.js";
2
+
3
+ ;// CONCATENATED MODULE: ./src/react/index.ts
4
+
5
+
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ /************************************************************************/
13
+ // webpack/runtime/define_property_getters
14
+ (() => {
15
+ __webpack_require__.d = (exports, definition) => {
16
+ for(var key in definition) {
17
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
19
+ }
20
+ }
21
+ };
22
+ })();
23
+ // webpack/runtime/has_own_property
24
+ (() => {
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
26
+ })();
27
+ // webpack/runtime/make_namespace_object
28
+ (() => {
29
+ // define __esModule on exports
30
+ __webpack_require__.r = (exports) => {
31
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
32
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33
+ }
34
+ Object.defineProperty(exports, '__esModule', { value: true });
35
+ };
36
+ })();
37
+ /************************************************************************/
38
+ var __webpack_exports__ = {};
39
+ // ESM COMPAT FLAG
40
+ __webpack_require__.r(__webpack_exports__);
41
+
42
+ // EXPORTS
43
+ __webpack_require__.d(__webpack_exports__, {
44
+ useFirstMounted: () => (/* binding */ useFirstMounted)
45
+ });
46
+
47
+ ;// CONCATENATED MODULE: external "react"
48
+ const external_react_namespaceObject = require("react");
49
+ ;// CONCATENATED MODULE: ./src/react/utils.ts
50
+
51
+ const useFirstMounted = ()=>{
52
+ const ref = (0,external_react_namespaceObject.useRef)(true);
53
+ (0,external_react_namespaceObject.useEffect)(()=>{
54
+ ref.current = false;
55
+ }, []);
56
+ return ref.current;
57
+ };
58
+
59
+ exports.useFirstMounted = __webpack_exports__.useFirstMounted;
60
+ for(var __webpack_i__ in __webpack_exports__) {
61
+ if(["useFirstMounted"].indexOf(__webpack_i__) === -1) {
62
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
63
+ }
64
+ }
65
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1 @@
1
+ export declare const useFirstMounted: () => boolean;
@@ -0,0 +1,15 @@
1
+ import { useEffect, useRef } from "react";
2
+
3
+ ;// CONCATENATED MODULE: external "react"
4
+
5
+ ;// CONCATENATED MODULE: ./src/react/utils.ts
6
+
7
+ const useFirstMounted = ()=>{
8
+ const ref = useRef(true);
9
+ useEffect(()=>{
10
+ ref.current = false;
11
+ }, []);
12
+ return ref.current;
13
+ };
14
+
15
+ export { useFirstMounted };
package/dist/react.cjs ADDED
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ var __webpack_modules__ = ({
10
+ "./react/index": (function (module) {
11
+ module.exports = require("./react/index.cjs");
12
+
13
+ }),
14
+
15
+ });
16
+ /************************************************************************/
17
+ // The module cache
18
+ var __webpack_module_cache__ = {};
19
+
20
+ // The require function
21
+ function __webpack_require__(moduleId) {
22
+
23
+ // Check if module is in cache
24
+ var cachedModule = __webpack_module_cache__[moduleId];
25
+ if (cachedModule !== undefined) {
26
+ return cachedModule.exports;
27
+ }
28
+ // Create a new module (and put it into the cache)
29
+ var module = (__webpack_module_cache__[moduleId] = {
30
+ exports: {}
31
+ });
32
+ // Execute the module function
33
+ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
34
+
35
+ // Return the exports of the module
36
+ return module.exports;
37
+
38
+ }
39
+
40
+ /************************************************************************/
41
+ // webpack/runtime/compat_get_default_export
42
+ (() => {
43
+ // getDefaultExport function for compatibility with non-ESM modules
44
+ __webpack_require__.n = (module) => {
45
+ var getter = module && module.__esModule ?
46
+ () => (module['default']) :
47
+ () => (module);
48
+ __webpack_require__.d(getter, { a: getter });
49
+ return getter;
50
+ };
51
+
52
+ })();
53
+ // webpack/runtime/define_property_getters
54
+ (() => {
55
+ __webpack_require__.d = (exports, definition) => {
56
+ for(var key in definition) {
57
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
58
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
59
+ }
60
+ }
61
+ };
62
+ })();
63
+ // webpack/runtime/has_own_property
64
+ (() => {
65
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
66
+ })();
67
+ // webpack/runtime/make_namespace_object
68
+ (() => {
69
+ // define __esModule on exports
70
+ __webpack_require__.r = (exports) => {
71
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
72
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
73
+ }
74
+ Object.defineProperty(exports, '__esModule', { value: true });
75
+ };
76
+ })();
77
+ /************************************************************************/
78
+ var __webpack_exports__ = {};
79
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
80
+ (() => {
81
+ __webpack_require__.r(__webpack_exports__);
82
+ /* ESM import */var _react_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./react/index");
83
+ /* ESM import */var _react_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_react_index__WEBPACK_IMPORTED_MODULE_0__);
84
+
85
+ /* ESM reexport (unknown) */ var __WEBPACK_REEXPORT_OBJECT__ = {};
86
+ /* ESM reexport (unknown) */ for( var __WEBPACK_IMPORT_KEY__ in _react_index__WEBPACK_IMPORTED_MODULE_0__) if(__WEBPACK_IMPORT_KEY__ !== "default") __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] =function(key) { return _react_index__WEBPACK_IMPORTED_MODULE_0__[key]; }.bind(0, __WEBPACK_IMPORT_KEY__)
87
+ /* ESM reexport (unknown) */ __webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
88
+
89
+
90
+ })();
91
+
92
+ for(var __webpack_i__ in __webpack_exports__) {
93
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
94
+ }
95
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1 @@
1
+ export * from './react/index';
package/dist/react.d.ts CHANGED
@@ -1 +1 @@
1
- export * from "./src/react/index";
1
+ export * from './react/index';
package/dist/react.js ADDED
@@ -0,0 +1,5 @@
1
+ export * from "./react/index.js";
2
+
3
+ ;// CONCATENATED MODULE: ./src/react.ts
4
+
5
+
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
10
+ var __webpack_require__ = {};
11
+
12
+ /************************************************************************/
13
+ // webpack/runtime/define_property_getters
14
+ (() => {
15
+ __webpack_require__.d = (exports, definition) => {
16
+ for(var key in definition) {
17
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
19
+ }
20
+ }
21
+ };
22
+ })();
23
+ // webpack/runtime/has_own_property
24
+ (() => {
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
26
+ })();
27
+ // webpack/runtime/make_namespace_object
28
+ (() => {
29
+ // define __esModule on exports
30
+ __webpack_require__.r = (exports) => {
31
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
32
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33
+ }
34
+ Object.defineProperty(exports, '__esModule', { value: true });
35
+ };
36
+ })();
37
+ /************************************************************************/
38
+ var __webpack_exports__ = {};
39
+ // ESM COMPAT FLAG
40
+ __webpack_require__.r(__webpack_exports__);
41
+
42
+ // EXPORTS
43
+ __webpack_require__.d(__webpack_exports__, {
44
+ prefetch: () => (/* binding */ prefetch)
45
+ });
46
+
47
+ ;// CONCATENATED MODULE: external "../prefetch.cjs"
48
+ const external_prefetch_cjs_namespaceObject = require("../prefetch.cjs");
49
+ ;// CONCATENATED MODULE: external "../common/runtime-utils.cjs"
50
+ const runtime_utils_cjs_namespaceObject = require("../common/runtime-utils.cjs");
51
+ ;// CONCATENATED MODULE: ./src/universal/index.ts
52
+
53
+
54
+ function prefetch(options) {
55
+ const { id, functionId = 'default' } = options;
56
+ const mfScope = (0,runtime_utils_cjs_namespaceObject.getScope)();
57
+ const prefetchInstance = external_prefetch_cjs_namespaceObject.MFDataPrefetch.getInstance(mfScope) || new external_prefetch_cjs_namespaceObject.MFDataPrefetch({
58
+ name: mfScope
59
+ });
60
+ const res = prefetchInstance.getProjectExports();
61
+ if (res instanceof Promise) {
62
+ const promise = res.then(()=>{
63
+ const result = prefetchInstance.prefetch(options);
64
+ prefetchInstance.memorize(id + functionId, result);
65
+ return result;
66
+ });
67
+ return promise;
68
+ } else {
69
+ const result = prefetchInstance.prefetch(options);
70
+ prefetchInstance.memorize(id + functionId, result);
71
+ return result;
72
+ }
73
+ }
74
+
75
+ exports.prefetch = __webpack_exports__.prefetch;
76
+ for(var __webpack_i__ in __webpack_exports__) {
77
+ if(["prefetch"].indexOf(__webpack_i__) === -1) {
78
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
79
+ }
80
+ }
81
+ Object.defineProperty(exports, '__esModule', { value: true });
@@ -0,0 +1,2 @@
1
+ import { type prefetchOptions } from '../prefetch';
2
+ export declare function prefetch(options: prefetchOptions): Promise<any>;