@module-federation/enhanced 0.0.3 → 0.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 (67) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/package.json +1 -1
  3. package/src/index.js +22 -18
  4. package/src/index.js.map +1 -1
  5. package/src/lib/Constants.js +33 -33
  6. package/src/lib/Constants.js.map +1 -1
  7. package/src/lib/container/AsyncBoundaryPlugin.js +12 -5
  8. package/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
  9. package/src/lib/container/ContainerEntryDependency.js +7 -3
  10. package/src/lib/container/ContainerEntryDependency.js.map +1 -1
  11. package/src/lib/container/ContainerEntryModule.js +51 -9
  12. package/src/lib/container/ContainerEntryModule.js.map +1 -1
  13. package/src/lib/container/ContainerEntryModuleFactory.js +7 -3
  14. package/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
  15. package/src/lib/container/ContainerExposedDependency.js +7 -3
  16. package/src/lib/container/ContainerExposedDependency.js.map +1 -1
  17. package/src/lib/container/ContainerPlugin.js +9 -5
  18. package/src/lib/container/ContainerPlugin.js.map +1 -1
  19. package/src/lib/container/ContainerReferencePlugin.js +53 -11
  20. package/src/lib/container/ContainerReferencePlugin.js.map +1 -1
  21. package/src/lib/container/FallbackDependency.js +7 -3
  22. package/src/lib/container/FallbackDependency.js.map +1 -1
  23. package/src/lib/container/FallbackItemDependency.js +7 -3
  24. package/src/lib/container/FallbackItemDependency.js.map +1 -1
  25. package/src/lib/container/FallbackModule.js +10 -6
  26. package/src/lib/container/FallbackModule.js.map +1 -1
  27. package/src/lib/container/FallbackModuleFactory.js +7 -3
  28. package/src/lib/container/FallbackModuleFactory.js.map +1 -1
  29. package/src/lib/container/ModuleFederationPlugin.js +10 -6
  30. package/src/lib/container/ModuleFederationPlugin.js.map +1 -1
  31. package/src/lib/container/RemoteModule.js +10 -6
  32. package/src/lib/container/RemoteModule.js.map +1 -1
  33. package/src/lib/container/RemoteRuntimeModule.js +8 -4
  34. package/src/lib/container/RemoteRuntimeModule.js.map +1 -1
  35. package/src/lib/container/RemoteToExternalDependency.d.js +6 -2
  36. package/src/lib/container/RemoteToExternalDependency.d.js.map +1 -1
  37. package/src/lib/container/RemoteToExternalDependency.js +7 -3
  38. package/src/lib/container/RemoteToExternalDependency.js.map +1 -1
  39. package/src/lib/sharing/ConsumeSharedFallbackDependency.js +7 -3
  40. package/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
  41. package/src/lib/sharing/ConsumeSharedModule.js +49 -7
  42. package/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
  43. package/src/lib/sharing/ConsumeSharedPlugin.js +69 -14
  44. package/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
  45. package/src/lib/sharing/ConsumeSharedRuntimeModule.js +47 -5
  46. package/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
  47. package/src/lib/sharing/ProvideForSharedDependency.js +7 -3
  48. package/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
  49. package/src/lib/sharing/ProvideSharedDependency.js +7 -3
  50. package/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
  51. package/src/lib/sharing/ProvideSharedModule.js +49 -7
  52. package/src/lib/sharing/ProvideSharedModule.js.map +1 -1
  53. package/src/lib/sharing/ProvideSharedModuleFactory.js +7 -3
  54. package/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
  55. package/src/lib/sharing/ProvideSharedPlugin.js +25 -8
  56. package/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
  57. package/src/lib/sharing/SharePlugin.js +7 -3
  58. package/src/lib/sharing/SharePlugin.js.map +1 -1
  59. package/src/lib/sharing/ShareRuntimeModule.js +47 -5
  60. package/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
  61. package/src/lib/sharing/resolveMatchedConfigs.js +7 -3
  62. package/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
  63. package/src/lib/sharing/utils.js +6 -6
  64. package/src/lib/sharing/utils.js.map +1 -1
  65. package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
  66. package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +34 -0
  67. package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ # [0.1.0](https://github.com/module-federation/nextjs-mf/compare/enhanced-0.0.4-0...enhanced-0.1.0) (2023-10-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * ensure chunk handler exists before calling it ([98ba838](https://github.com/module-federation/nextjs-mf/commit/98ba838f979bbef11f5d678c3bf27a4de534cf9d))
11
+
12
+
13
+ ### Features
14
+
15
+ * AddRuntimeRequirementToPromiseExternal ([9bc5a20](https://github.com/module-federation/nextjs-mf/commit/9bc5a20b54228de7d1f2554eee10360a34e8d8a1))
16
+
17
+
18
+
19
+ ## [0.0.4-0](https://github.com/module-federation/nextjs-mf/compare/enhanced-0.0.3...enhanced-0.0.4-0) (2023-10-03)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * no external helpers ([6c47fd4](https://github.com/module-federation/nextjs-mf/commit/6c47fd4ce19f2292f6718d201005fba4a8552252))
25
+
26
+
27
+
5
28
  ## [0.0.3](https://github.com/module-federation/nextjs-mf/compare/enhanced-0.0.2...enhanced-0.0.3) (2023-10-03)
6
29
 
7
30
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "public": true,
3
3
  "name": "@module-federation/enhanced",
4
- "version": "0.0.3",
4
+ "version": "0.1.0",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
7
7
  "types": "src/index.d.ts",
package/src/index.js CHANGED
@@ -9,35 +9,39 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- ModuleInfoRuntimeModule: function() {
13
- return _ModuleInfoRuntimeModule.ModuleInfoRuntimeModule;
12
+ AsyncBoundaryPlugin: function() {
13
+ return _AsyncBoundaryPlugin.default;
14
14
  },
15
- ModuleInfoRuntimePlugin: function() {
16
- return _ModuleInfoRuntimePlugin.ModuleInfoRuntimePlugin;
15
+ ContainerEntryModule: function() {
16
+ return _ContainerEntryModule.default;
17
17
  },
18
- ModuleFederationPlugin: function() {
19
- return _ModuleFederationPlugin.default;
18
+ ContainerPlugin: function() {
19
+ return _ContainerPlugin.default;
20
20
  },
21
21
  ContainerReferencePlugin: function() {
22
22
  return _ContainerReferencePlugin.default;
23
23
  },
24
- ContainerPlugin: function() {
25
- return _ContainerPlugin.default;
24
+ ModuleFederationPlugin: function() {
25
+ return _ModuleFederationPlugin.default;
26
26
  },
27
- ContainerEntryModule: function() {
28
- return _ContainerEntryModule.default;
27
+ ModuleInfoRuntimeModule: function() {
28
+ return _ModuleInfoRuntimeModule.ModuleInfoRuntimeModule;
29
29
  },
30
- AsyncBoundaryPlugin: function() {
31
- return _AsyncBoundaryPlugin.default;
30
+ ModuleInfoRuntimePlugin: function() {
31
+ return _ModuleInfoRuntimePlugin.ModuleInfoRuntimePlugin;
32
32
  }
33
33
  });
34
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
35
34
  const _ModuleInfoRuntimeModule = require("./runtime/ModuleInfoRuntimeModule");
36
35
  const _ModuleInfoRuntimePlugin = require("./runtime/ModuleInfoRuntimePlugin");
37
- const _ModuleFederationPlugin = /*#__PURE__*/ _interop_require_default._(require("./lib/container/ModuleFederationPlugin"));
38
- const _ContainerReferencePlugin = /*#__PURE__*/ _interop_require_default._(require("./lib/container/ContainerReferencePlugin"));
39
- const _ContainerPlugin = /*#__PURE__*/ _interop_require_default._(require("./lib/container/ContainerPlugin"));
40
- const _ContainerEntryModule = /*#__PURE__*/ _interop_require_default._(require("./lib/container/ContainerEntryModule"));
41
- const _AsyncBoundaryPlugin = /*#__PURE__*/ _interop_require_default._(require("./lib/container/AsyncBoundaryPlugin"));
36
+ const _ModuleFederationPlugin = /*#__PURE__*/ _interop_require_default(require("./lib/container/ModuleFederationPlugin"));
37
+ const _ContainerReferencePlugin = /*#__PURE__*/ _interop_require_default(require("./lib/container/ContainerReferencePlugin"));
38
+ const _ContainerPlugin = /*#__PURE__*/ _interop_require_default(require("./lib/container/ContainerPlugin"));
39
+ const _ContainerEntryModule = /*#__PURE__*/ _interop_require_default(require("./lib/container/ContainerEntryModule"));
40
+ const _AsyncBoundaryPlugin = /*#__PURE__*/ _interop_require_default(require("./lib/container/AsyncBoundaryPlugin"));
41
+ function _interop_require_default(obj) {
42
+ return obj && obj.__esModule ? obj : {
43
+ default: obj
44
+ };
45
+ }
42
46
 
43
47
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../packages/enhanced/src/index.ts"],"sourcesContent":["export { ModuleInfoRuntimeModule } from './runtime/ModuleInfoRuntimeModule';\nexport { ModuleInfoRuntimePlugin } from './runtime/ModuleInfoRuntimePlugin';\nexport { default as ModuleFederationPlugin } from './lib/container/ModuleFederationPlugin';\nexport { default as ContainerReferencePlugin } from './lib/container/ContainerReferencePlugin';\nexport { default as ContainerPlugin } from './lib/container/ContainerPlugin';\nexport { default as ContainerEntryModule } from './lib/container/ContainerEntryModule';\nexport { default as AsyncBoundaryPlugin } from './lib/container/AsyncBoundaryPlugin';\n"],"names":["ModuleInfoRuntimeModule","ModuleInfoRuntimePlugin","ModuleFederationPlugin","ContainerReferencePlugin","ContainerPlugin","ContainerEntryModule","AsyncBoundaryPlugin"],"mappings":";;;;;;;;;;;IAASA,uBAAuB;eAAvBA,gDAAuB;;IACvBC,uBAAuB;eAAvBA,gDAAuB;;IACZC,sBAAsB;eAAtBA,+BAAsB;;IACtBC,wBAAwB;eAAxBA,iCAAwB;;IACxBC,eAAe;eAAfA,wBAAe;;IACfC,oBAAoB;eAApBA,6BAAoB;;IACpBC,mBAAmB;eAAnBA,4BAAmB;;;;yCANC;yCACA;iFACU;mFACE;0EACT;+EACK;8EACD"}
1
+ {"version":3,"sources":["../../../../packages/enhanced/src/index.ts"],"sourcesContent":["export { ModuleInfoRuntimeModule } from './runtime/ModuleInfoRuntimeModule';\nexport { ModuleInfoRuntimePlugin } from './runtime/ModuleInfoRuntimePlugin';\nexport { default as ModuleFederationPlugin } from './lib/container/ModuleFederationPlugin';\nexport { default as ContainerReferencePlugin } from './lib/container/ContainerReferencePlugin';\nexport { default as ContainerPlugin } from './lib/container/ContainerPlugin';\nexport { default as ContainerEntryModule } from './lib/container/ContainerEntryModule';\nexport { default as AsyncBoundaryPlugin } from './lib/container/AsyncBoundaryPlugin';\n"],"names":["AsyncBoundaryPlugin","ContainerEntryModule","ContainerPlugin","ContainerReferencePlugin","ModuleFederationPlugin","ModuleInfoRuntimeModule","ModuleInfoRuntimePlugin"],"mappings":";;;;;;;;;;;IAMoBA,mBAAmB;eAAnBA,4BAAmB;;IADnBC,oBAAoB;eAApBA,6BAAoB;;IADpBC,eAAe;eAAfA,wBAAe;;IADfC,wBAAwB;eAAxBA,iCAAwB;;IADxBC,sBAAsB;eAAtBA,+BAAsB;;IAFjCC,uBAAuB;eAAvBA,gDAAuB;;IACvBC,uBAAuB;eAAvBA,gDAAuB;;;yCADQ;yCACA;+EACU;iFACE;wEACT;6EACK;4EACD"}
@@ -14,68 +14,68 @@ function _export(target, all) {
14
14
  });
15
15
  }
16
16
  _export(exports, {
17
- JAVASCRIPT_MODULE_TYPE_AUTO: function() {
18
- return JAVASCRIPT_MODULE_TYPE_AUTO;
19
- },
20
- JAVASCRIPT_MODULE_TYPE_DYNAMIC: function() {
21
- return JAVASCRIPT_MODULE_TYPE_DYNAMIC;
17
+ ASSET_MODULE_TYPE: function() {
18
+ return ASSET_MODULE_TYPE;
22
19
  },
23
- JAVASCRIPT_MODULE_TYPE_ESM: function() {
24
- return JAVASCRIPT_MODULE_TYPE_ESM;
20
+ ASSET_MODULE_TYPE_INLINE: function() {
21
+ return ASSET_MODULE_TYPE_INLINE;
25
22
  },
26
- JSON_MODULE_TYPE: function() {
27
- return JSON_MODULE_TYPE;
23
+ ASSET_MODULE_TYPE_RAW_DATA_URL: function() {
24
+ return ASSET_MODULE_TYPE_RAW_DATA_URL;
28
25
  },
29
- WEBASSEMBLY_MODULE_TYPE_ASYNC: function() {
30
- return WEBASSEMBLY_MODULE_TYPE_ASYNC;
26
+ ASSET_MODULE_TYPE_RESOURCE: function() {
27
+ return ASSET_MODULE_TYPE_RESOURCE;
31
28
  },
32
- WEBASSEMBLY_MODULE_TYPE_SYNC: function() {
33
- return WEBASSEMBLY_MODULE_TYPE_SYNC;
29
+ ASSET_MODULE_TYPE_SOURCE: function() {
30
+ return ASSET_MODULE_TYPE_SOURCE;
34
31
  },
35
32
  CSS_MODULE_TYPE: function() {
36
33
  return CSS_MODULE_TYPE;
37
34
  },
35
+ CSS_MODULE_TYPE_AUTO: function() {
36
+ return CSS_MODULE_TYPE_AUTO;
37
+ },
38
38
  CSS_MODULE_TYPE_GLOBAL: function() {
39
39
  return CSS_MODULE_TYPE_GLOBAL;
40
40
  },
41
41
  CSS_MODULE_TYPE_MODULE: function() {
42
42
  return CSS_MODULE_TYPE_MODULE;
43
43
  },
44
- CSS_MODULE_TYPE_AUTO: function() {
45
- return CSS_MODULE_TYPE_AUTO;
44
+ JAVASCRIPT_MODULE_TYPE_AUTO: function() {
45
+ return JAVASCRIPT_MODULE_TYPE_AUTO;
46
46
  },
47
- ASSET_MODULE_TYPE: function() {
48
- return ASSET_MODULE_TYPE;
47
+ JAVASCRIPT_MODULE_TYPE_DYNAMIC: function() {
48
+ return JAVASCRIPT_MODULE_TYPE_DYNAMIC;
49
49
  },
50
- ASSET_MODULE_TYPE_INLINE: function() {
51
- return ASSET_MODULE_TYPE_INLINE;
50
+ JAVASCRIPT_MODULE_TYPE_ESM: function() {
51
+ return JAVASCRIPT_MODULE_TYPE_ESM;
52
52
  },
53
- ASSET_MODULE_TYPE_RESOURCE: function() {
54
- return ASSET_MODULE_TYPE_RESOURCE;
53
+ JSON_MODULE_TYPE: function() {
54
+ return JSON_MODULE_TYPE;
55
55
  },
56
- ASSET_MODULE_TYPE_SOURCE: function() {
57
- return ASSET_MODULE_TYPE_SOURCE;
56
+ WEBASSEMBLY_MODULE_TYPE_ASYNC: function() {
57
+ return WEBASSEMBLY_MODULE_TYPE_ASYNC;
58
58
  },
59
- ASSET_MODULE_TYPE_RAW_DATA_URL: function() {
60
- return ASSET_MODULE_TYPE_RAW_DATA_URL;
59
+ WEBASSEMBLY_MODULE_TYPE_SYNC: function() {
60
+ return WEBASSEMBLY_MODULE_TYPE_SYNC;
61
61
  },
62
- WEBPACK_MODULE_TYPE_RUNTIME: function() {
63
- return WEBPACK_MODULE_TYPE_RUNTIME;
62
+ WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE: function() {
63
+ return WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE;
64
64
  },
65
65
  WEBPACK_MODULE_TYPE_FALLBACK: function() {
66
66
  return WEBPACK_MODULE_TYPE_FALLBACK;
67
67
  },
68
- WEBPACK_MODULE_TYPE_REMOTE: function() {
69
- return WEBPACK_MODULE_TYPE_REMOTE;
68
+ WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY: function() {
69
+ return WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY;
70
70
  },
71
71
  WEBPACK_MODULE_TYPE_PROVIDE: function() {
72
72
  return WEBPACK_MODULE_TYPE_PROVIDE;
73
73
  },
74
- WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE: function() {
75
- return WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE;
74
+ WEBPACK_MODULE_TYPE_REMOTE: function() {
75
+ return WEBPACK_MODULE_TYPE_REMOTE;
76
76
  },
77
- WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY: function() {
78
- return WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY;
77
+ WEBPACK_MODULE_TYPE_RUNTIME: function() {
78
+ return WEBPACK_MODULE_TYPE_RUNTIME;
79
79
  }
80
80
  });
81
81
  const JAVASCRIPT_MODULE_TYPE_AUTO = 'javascript/auto';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../packages/enhanced/src/lib/Constants.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Sean Larkin @TheLarkInn\n*/\n\n/**\n * @type {Readonly<\"javascript/auto\">}\n */\nexport const JAVASCRIPT_MODULE_TYPE_AUTO: Readonly<'javascript/auto'> =\n 'javascript/auto';\n\n/**\n * @type {Readonly<\"javascript/dynamic\">}\n */\nexport const JAVASCRIPT_MODULE_TYPE_DYNAMIC: Readonly<'javascript/dynamic'> =\n 'javascript/dynamic';\n\n/**\n * @type {Readonly<\"javascript/esm\">}\n * This is the module type used for _strict_ ES Module syntax. This means that all legacy formats\n * that webpack supports (CommonJS, AMD, SystemJS) are not supported.\n */\nexport const JAVASCRIPT_MODULE_TYPE_ESM: Readonly<'javascript/esm'> =\n 'javascript/esm';\n\n/**\n * @type {Readonly<\"json\">}\n * This is the module type used for JSON files. JSON files are always parsed as ES Module.\n */\nexport const JSON_MODULE_TYPE: Readonly<'json'> = 'json';\n\n/**\n * @type {Readonly<\"webassembly/async\">}\n * This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.\n *\n */\nexport const WEBASSEMBLY_MODULE_TYPE_ASYNC: Readonly<'webassembly/async'> =\n 'webassembly/async';\n\n/**\n * @type {Readonly<\"webassembly/sync\">}\n * This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.\n * There is a legacy option to support this usage in webpack 5 and up.\n */\nexport const WEBASSEMBLY_MODULE_TYPE_SYNC: Readonly<'webassembly/sync'> =\n 'webassembly/sync';\n\n/**\n * @type {Readonly<\"css\">}\n * This is the module type used for CSS files.\n */\nexport const CSS_MODULE_TYPE: Readonly<'css'> = 'css';\n\n/**\n * @type {Readonly<\"css/global\">}\n * This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.\n */\nexport const CSS_MODULE_TYPE_GLOBAL: Readonly<'css/global'> = 'css/global';\n\n/**\n * @type {Readonly<\"css/module\">}\n * This is the module type used for CSS modules files, by default all classes are hashed.\n */\nexport const CSS_MODULE_TYPE_MODULE: Readonly<'css/module'> = 'css/module';\n\n/**\n * @type {Readonly<\"css/auto\">}\n * This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.\n */\nexport const CSS_MODULE_TYPE_AUTO: Readonly<'css/auto'> = 'css/auto';\n\n/**\n * @type {Readonly<\"asset\">}\n * This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).\n */\nexport const ASSET_MODULE_TYPE: Readonly<'asset'> = 'asset';\n\n/**\n * @type {Readonly<\"asset/inline\">}\n * This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.\n */\nexport const ASSET_MODULE_TYPE_INLINE: Readonly<'asset/inline'> =\n 'asset/inline';\n\n/**\n * @type {Readonly<\"asset/resource\">}\n * This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.\n */\nexport const ASSET_MODULE_TYPE_RESOURCE: Readonly<'asset/resource'> =\n 'asset/resource';\n\n/**\n * @type {Readonly<\"asset/source\">}\n * This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.\n */\nexport const ASSET_MODULE_TYPE_SOURCE: Readonly<'asset/source'> =\n 'asset/source';\n\n/**\n * @type {Readonly<\"asset/raw-data-url\">}\n * TODO: Document what this asset type is for. See css-loader tests for its usage.\n */\nexport const ASSET_MODULE_TYPE_RAW_DATA_URL: Readonly<'asset/raw-data-url'> =\n 'asset/raw-data-url';\n\n/**\n * @type {Readonly<\"runtime\">}\n * This is the module type used for the webpack runtime abstractions.\n */\nexport const WEBPACK_MODULE_TYPE_RUNTIME: Readonly<'runtime'> = 'runtime';\n\n/**\n * @type {Readonly<\"fallback-module\">}\n * This is the module type used for the ModuleFederation feature's FallbackModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_FALLBACK: Readonly<'fallback-module'> =\n 'fallback-module';\n\n/**\n * @type {Readonly<\"remote-module\">}\n * This is the module type used for the ModuleFederation feature's RemoteModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_REMOTE: Readonly<'remote-module'> =\n 'remote-module';\n\n/**\n * @type {Readonly<\"provide-module\">}\n * This is the module type used for the ModuleFederation feature's ProvideModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_PROVIDE: Readonly<'provide-module'> =\n 'provide-module';\n\n/**\n * @type {Readonly<\"consume-shared-module\">}\n * This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.\n */\nexport const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE: Readonly<'consume-shared-module'> =\n 'consume-shared-module';\n\n/**\n * @type {Readonly<\"lazy-compilation-proxy\">}\n * Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.\n */\nexport const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY: Readonly<'lazy-compilation-proxy'> =\n 'lazy-compilation-proxy';\n\n/** @typedef {\"javascript/auto\" | \"javascript/dynamic\" | \"javascript/esm\"} JavaScriptModuleTypes */\n/** @typedef {\"json\"} JSONModuleType */\n/** @typedef {\"webassembly/async\" | \"webassembly/sync\"} WebAssemblyModuleTypes */\n/** @typedef {\"css\" | \"css/global\" | \"css/module\"} CSSModuleTypes */\n/** @typedef {\"asset\" | \"asset/inline\" | \"asset/resource\" | \"asset/source\" | \"asset/raw-data-url\"} AssetModuleTypes */\n/** @typedef {\"runtime\" | \"fallback-module\" | \"remote-module\" | \"provide-module\" | \"consume-shared-module\" | \"lazy-compilation-proxy\"} WebpackModuleTypes */\n/** @typedef {string} UnknownModuleTypes */\n/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */\n"],"names":["JAVASCRIPT_MODULE_TYPE_AUTO","JAVASCRIPT_MODULE_TYPE_DYNAMIC","JAVASCRIPT_MODULE_TYPE_ESM","JSON_MODULE_TYPE","WEBASSEMBLY_MODULE_TYPE_ASYNC","WEBASSEMBLY_MODULE_TYPE_SYNC","CSS_MODULE_TYPE","CSS_MODULE_TYPE_GLOBAL","CSS_MODULE_TYPE_MODULE","CSS_MODULE_TYPE_AUTO","ASSET_MODULE_TYPE","ASSET_MODULE_TYPE_INLINE","ASSET_MODULE_TYPE_RESOURCE","ASSET_MODULE_TYPE_SOURCE","ASSET_MODULE_TYPE_RAW_DATA_URL","WEBPACK_MODULE_TYPE_RUNTIME","WEBPACK_MODULE_TYPE_FALLBACK","WEBPACK_MODULE_TYPE_REMOTE","WEBPACK_MODULE_TYPE_PROVIDE","WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY"],"mappings":"AAAA;;;AAGA,GAEA;;CAEC;;;;;;;;;;;IACYA,2BAA2B;eAA3BA;;IAMAC,8BAA8B;eAA9BA;;IAQAC,0BAA0B;eAA1BA;;IAOAC,gBAAgB;eAAhBA;;IAOAC,6BAA6B;eAA7BA;;IAQAC,4BAA4B;eAA5BA;;IAOAC,eAAe;eAAfA;;IAMAC,sBAAsB;eAAtBA;;IAMAC,sBAAsB;eAAtBA;;IAMAC,oBAAoB;eAApBA;;IAMAC,iBAAiB;eAAjBA;;IAMAC,wBAAwB;eAAxBA;;IAOAC,0BAA0B;eAA1BA;;IAOAC,wBAAwB;eAAxBA;;IAOAC,8BAA8B;eAA9BA;;IAOAC,2BAA2B;eAA3BA;;IAOAC,4BAA4B;eAA5BA;;IAQAC,0BAA0B;eAA1BA;;IAQAC,2BAA2B;eAA3BA;;IAOAC,yCAAyC;eAAzCA;;IAOAC,0CAA0C;eAA1CA;;;AA1IN,MAAMpB,8BACX;AAKK,MAAMC,iCACX;AAOK,MAAMC,6BACX;AAMK,MAAMC,mBAAqC;AAO3C,MAAMC,gCACX;AAOK,MAAMC,+BACX;AAMK,MAAMC,kBAAmC;AAMzC,MAAMC,yBAAiD;AAMvD,MAAMC,yBAAiD;AAMvD,MAAMC,uBAA6C;AAMnD,MAAMC,oBAAuC;AAM7C,MAAMC,2BACX;AAMK,MAAMC,6BACX;AAMK,MAAMC,2BACX;AAMK,MAAMC,iCACX;AAMK,MAAMC,8BAAmD;AAOzD,MAAMC,+BACX;AAOK,MAAMC,6BACX;AAOK,MAAMC,8BACX;AAMK,MAAMC,4CACX;AAMK,MAAMC,6CACX,0BAEF,iGAAiG,IACjG,qCAAqC,IACrC,+EAA+E,IAC/E,kEAAkE,IAClE,oHAAoH,IACpH,0JAA0J,IAC1J,yCAAyC,IACzC,yKAAyK"}
1
+ {"version":3,"sources":["../../../../../packages/enhanced/src/lib/Constants.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Sean Larkin @TheLarkInn\n*/\n\n/**\n * @type {Readonly<\"javascript/auto\">}\n */\nexport const JAVASCRIPT_MODULE_TYPE_AUTO: Readonly<'javascript/auto'> =\n 'javascript/auto';\n\n/**\n * @type {Readonly<\"javascript/dynamic\">}\n */\nexport const JAVASCRIPT_MODULE_TYPE_DYNAMIC: Readonly<'javascript/dynamic'> =\n 'javascript/dynamic';\n\n/**\n * @type {Readonly<\"javascript/esm\">}\n * This is the module type used for _strict_ ES Module syntax. This means that all legacy formats\n * that webpack supports (CommonJS, AMD, SystemJS) are not supported.\n */\nexport const JAVASCRIPT_MODULE_TYPE_ESM: Readonly<'javascript/esm'> =\n 'javascript/esm';\n\n/**\n * @type {Readonly<\"json\">}\n * This is the module type used for JSON files. JSON files are always parsed as ES Module.\n */\nexport const JSON_MODULE_TYPE: Readonly<'json'> = 'json';\n\n/**\n * @type {Readonly<\"webassembly/async\">}\n * This is the module type used for WebAssembly modules. In webpack 5 they are always treated as async modules.\n *\n */\nexport const WEBASSEMBLY_MODULE_TYPE_ASYNC: Readonly<'webassembly/async'> =\n 'webassembly/async';\n\n/**\n * @type {Readonly<\"webassembly/sync\">}\n * This is the module type used for WebAssembly modules. In webpack 4 they are always treated as sync modules.\n * There is a legacy option to support this usage in webpack 5 and up.\n */\nexport const WEBASSEMBLY_MODULE_TYPE_SYNC: Readonly<'webassembly/sync'> =\n 'webassembly/sync';\n\n/**\n * @type {Readonly<\"css\">}\n * This is the module type used for CSS files.\n */\nexport const CSS_MODULE_TYPE: Readonly<'css'> = 'css';\n\n/**\n * @type {Readonly<\"css/global\">}\n * This is the module type used for CSS modules files where you need to use `:local` in selector list to hash classes.\n */\nexport const CSS_MODULE_TYPE_GLOBAL: Readonly<'css/global'> = 'css/global';\n\n/**\n * @type {Readonly<\"css/module\">}\n * This is the module type used for CSS modules files, by default all classes are hashed.\n */\nexport const CSS_MODULE_TYPE_MODULE: Readonly<'css/module'> = 'css/module';\n\n/**\n * @type {Readonly<\"css/auto\">}\n * This is the module type used for CSS files, the module will be parsed as CSS modules if it's filename contains `.module.` or `.modules.`.\n */\nexport const CSS_MODULE_TYPE_AUTO: Readonly<'css/auto'> = 'css/auto';\n\n/**\n * @type {Readonly<\"asset\">}\n * This is the module type used for automatically choosing between `asset/inline`, `asset/resource` based on asset size limit (8096).\n */\nexport const ASSET_MODULE_TYPE: Readonly<'asset'> = 'asset';\n\n/**\n * @type {Readonly<\"asset/inline\">}\n * This is the module type used for assets that are inlined as a data URI. This is the equivalent of `url-loader`.\n */\nexport const ASSET_MODULE_TYPE_INLINE: Readonly<'asset/inline'> =\n 'asset/inline';\n\n/**\n * @type {Readonly<\"asset/resource\">}\n * This is the module type used for assets that are copied to the output directory. This is the equivalent of `file-loader`.\n */\nexport const ASSET_MODULE_TYPE_RESOURCE: Readonly<'asset/resource'> =\n 'asset/resource';\n\n/**\n * @type {Readonly<\"asset/source\">}\n * This is the module type used for assets that are imported as source code. This is the equivalent of `raw-loader`.\n */\nexport const ASSET_MODULE_TYPE_SOURCE: Readonly<'asset/source'> =\n 'asset/source';\n\n/**\n * @type {Readonly<\"asset/raw-data-url\">}\n * TODO: Document what this asset type is for. See css-loader tests for its usage.\n */\nexport const ASSET_MODULE_TYPE_RAW_DATA_URL: Readonly<'asset/raw-data-url'> =\n 'asset/raw-data-url';\n\n/**\n * @type {Readonly<\"runtime\">}\n * This is the module type used for the webpack runtime abstractions.\n */\nexport const WEBPACK_MODULE_TYPE_RUNTIME: Readonly<'runtime'> = 'runtime';\n\n/**\n * @type {Readonly<\"fallback-module\">}\n * This is the module type used for the ModuleFederation feature's FallbackModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_FALLBACK: Readonly<'fallback-module'> =\n 'fallback-module';\n\n/**\n * @type {Readonly<\"remote-module\">}\n * This is the module type used for the ModuleFederation feature's RemoteModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_REMOTE: Readonly<'remote-module'> =\n 'remote-module';\n\n/**\n * @type {Readonly<\"provide-module\">}\n * This is the module type used for the ModuleFederation feature's ProvideModule class.\n * TODO: Document this better.\n */\nexport const WEBPACK_MODULE_TYPE_PROVIDE: Readonly<'provide-module'> =\n 'provide-module';\n\n/**\n * @type {Readonly<\"consume-shared-module\">}\n * This is the module type used for the ModuleFederation feature's ConsumeSharedModule class.\n */\nexport const WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE: Readonly<'consume-shared-module'> =\n 'consume-shared-module';\n\n/**\n * @type {Readonly<\"lazy-compilation-proxy\">}\n * Module type used for `experiments.lazyCompilation` feature. See `LazyCompilationPlugin` for more information.\n */\nexport const WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY: Readonly<'lazy-compilation-proxy'> =\n 'lazy-compilation-proxy';\n\n/** @typedef {\"javascript/auto\" | \"javascript/dynamic\" | \"javascript/esm\"} JavaScriptModuleTypes */\n/** @typedef {\"json\"} JSONModuleType */\n/** @typedef {\"webassembly/async\" | \"webassembly/sync\"} WebAssemblyModuleTypes */\n/** @typedef {\"css\" | \"css/global\" | \"css/module\"} CSSModuleTypes */\n/** @typedef {\"asset\" | \"asset/inline\" | \"asset/resource\" | \"asset/source\" | \"asset/raw-data-url\"} AssetModuleTypes */\n/** @typedef {\"runtime\" | \"fallback-module\" | \"remote-module\" | \"provide-module\" | \"consume-shared-module\" | \"lazy-compilation-proxy\"} WebpackModuleTypes */\n/** @typedef {string} UnknownModuleTypes */\n/** @typedef {JavaScriptModuleTypes | JSONModuleType | WebAssemblyModuleTypes | CSSModuleTypes | AssetModuleTypes | WebpackModuleTypes | UnknownModuleTypes} ModuleTypes */\n"],"names":["ASSET_MODULE_TYPE","ASSET_MODULE_TYPE_INLINE","ASSET_MODULE_TYPE_RAW_DATA_URL","ASSET_MODULE_TYPE_RESOURCE","ASSET_MODULE_TYPE_SOURCE","CSS_MODULE_TYPE","CSS_MODULE_TYPE_AUTO","CSS_MODULE_TYPE_GLOBAL","CSS_MODULE_TYPE_MODULE","JAVASCRIPT_MODULE_TYPE_AUTO","JAVASCRIPT_MODULE_TYPE_DYNAMIC","JAVASCRIPT_MODULE_TYPE_ESM","JSON_MODULE_TYPE","WEBASSEMBLY_MODULE_TYPE_ASYNC","WEBASSEMBLY_MODULE_TYPE_SYNC","WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","WEBPACK_MODULE_TYPE_FALLBACK","WEBPACK_MODULE_TYPE_LAZY_COMPILATION_PROXY","WEBPACK_MODULE_TYPE_PROVIDE","WEBPACK_MODULE_TYPE_REMOTE","WEBPACK_MODULE_TYPE_RUNTIME"],"mappings":"AAAA;;;AAGA,GAEA;;CAEC;;;;;;;;;;;IAoEYA,iBAAiB;eAAjBA;;IAMAC,wBAAwB;eAAxBA;;IAqBAC,8BAA8B;eAA9BA;;IAdAC,0BAA0B;eAA1BA;;IAOAC,wBAAwB;eAAxBA;;IA5CAC,eAAe;eAAfA;;IAkBAC,oBAAoB;eAApBA;;IAZAC,sBAAsB;eAAtBA;;IAMAC,sBAAsB;eAAtBA;;IAvDAC,2BAA2B;eAA3BA;;IAMAC,8BAA8B;eAA9BA;;IAQAC,0BAA0B;eAA1BA;;IAOAC,gBAAgB;eAAhBA;;IAOAC,6BAA6B;eAA7BA;;IAQAC,4BAA4B;eAA5BA;;IA+FAC,yCAAyC;eAAzCA;;IAvBAC,4BAA4B;eAA5BA;;IA8BAC,0CAA0C;eAA1CA;;IAdAC,2BAA2B;eAA3BA;;IARAC,0BAA0B;eAA1BA;;IAfAC,2BAA2B;eAA3BA;;;AArGN,MAAMX,8BACX;AAKK,MAAMC,iCACX;AAOK,MAAMC,6BACX;AAMK,MAAMC,mBAAqC;AAO3C,MAAMC,gCACX;AAOK,MAAMC,+BACX;AAMK,MAAMT,kBAAmC;AAMzC,MAAME,yBAAiD;AAMvD,MAAMC,yBAAiD;AAMvD,MAAMF,uBAA6C;AAMnD,MAAMN,oBAAuC;AAM7C,MAAMC,2BACX;AAMK,MAAME,6BACX;AAMK,MAAMC,2BACX;AAMK,MAAMF,iCACX;AAMK,MAAMkB,8BAAmD;AAOzD,MAAMJ,+BACX;AAOK,MAAMG,6BACX;AAOK,MAAMD,8BACX;AAMK,MAAMH,4CACX;AAMK,MAAME,6CACX,0BAEF,iGAAiG,IACjG,qCAAqC,IACrC,+EAA+E,IAC/E,kEAAkE,IAClE,oHAAoH,IACpH,0JAA0J,IAC1J,yCAAyC,IACzC,yKAAyK"}
@@ -40,7 +40,10 @@ const _tapable = require("tapable");
40
40
  if (isInvalidContext) return source.source().toString();
41
41
  const { chunkGraph } = compilation;
42
42
  const replaceSource = source.source().toString();
43
- const [webpack_exec, ...webpack_exports] = replaceSource.split('\n');
43
+ const replaceSourceLines = replaceSource.split('\n');
44
+ const webpack_exec_index = replaceSourceLines.findIndex((line)=>line.includes('webpack_exec'));
45
+ const webpack_exec = replaceSourceLines[webpack_exec_index];
46
+ const webpack_exports = replaceSourceLines.slice(webpack_exec_index + 1);
44
47
  const dependentChunkIds = this.getDependentChunkIds(startupRenderContext, chunkGraph);
45
48
  return _webpack.Template.asString([
46
49
  this.replaceWebpackExec(webpack_exec),
@@ -48,10 +51,14 @@ const _tapable = require("tapable");
48
51
  `var __webpack_exec__ = async function() {`,
49
52
  _webpack.Template.indent([
50
53
  `var chunkIds = ${JSON.stringify(Array.from(dependentChunkIds))};`,
51
- `chunkIds.forEach(function(id) { ${_webpack.RuntimeGlobals.ensureChunkHandlers}.consumes(id, globalThis.ongoingRemotes); });`,
52
- `await Promise.all(globalThis.ongoingRemotes);`,
53
- `chunkIds.forEach(function(id) { ${_webpack.RuntimeGlobals.ensureChunkHandlers}.remotes(id, globalThis.ongoingRemotes); });`,
54
- `await Promise.all(globalThis.ongoingRemotes);`,
54
+ `if (${_webpack.RuntimeGlobals.ensureChunkHandlers}.consumes) {`,
55
+ ` chunkIds.forEach(function(id) { ${_webpack.RuntimeGlobals.ensureChunkHandlers}.consumes(id, globalThis.ongoingRemotes); });`,
56
+ ` await Promise.all(globalThis.ongoingRemotes);`,
57
+ `}`,
58
+ `if (${_webpack.RuntimeGlobals.ensureChunkHandlers}.remotes) {`,
59
+ ` chunkIds.forEach(function(id) { ${_webpack.RuntimeGlobals.ensureChunkHandlers}.remotes(id, globalThis.ongoingRemotes); });`,
60
+ ` await Promise.all(globalThis.ongoingRemotes);`,
61
+ `}`,
55
62
  `return __original_webpack_exec__.apply(this, arguments);`
56
63
  ]),
57
64
  `};`,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/AsyncBoundaryPlugin.ts"],"sourcesContent":["import { Template, RuntimeGlobals } from 'webpack';\nimport { Source } from 'webpack-sources';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type Compiler from 'webpack/lib/Compiler';\nimport type Module from 'webpack/lib/Module';\nimport type Chunk from 'webpack/lib/Chunk';\nimport { getAllChunks } from 'webpack/lib/javascript/ChunkHelpers';\nimport { ChunkGraph } from 'webpack/lib/ChunkGroup';\nimport { StartupRenderContext } from 'webpack/lib/javascript/JavascriptModulesPlugin';\nimport { RenderContext } from 'webpack/lib/javascript/JavascriptModulesPlugin';\nimport { SyncBailHook } from 'tapable';\n/**\n * AsyncBoundaryPlugin is a Webpack plugin that handles asynchronous boundaries in a federated module.\n * @class\n */\nclass AsyncBoundaryPlugin {\n /**\n * Define hooks\n * @property {SyncBailHook} checkInvalidContext - A hook that checks if the render context is invalid.\n */\n public hooks = {\n checkInvalidContext: new SyncBailHook<[Module, Compilation], boolean>([\n 'renderContext',\n 'compilation',\n ]),\n };\n\n /**\n * Apply the plugin to the Webpack compiler instance.\n * @param {Compiler} compiler - Webpack compiler instance.\n */\n public apply(compiler: Compiler): void {\n const { javascript } = compiler.webpack;\n compiler.hooks.thisCompilation.tap(\n 'AsyncBoundaryPlugin',\n (compilation: Compilation) => {\n const hooks =\n javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);\n hooks.renderStartup.tap(\n 'AsyncBoundaryPlugin',\n (\n source: Source,\n renderContext: Module,\n startupRenderContext: StartupRenderContext,\n ) => {\n return this.renderStartupLogic(\n source,\n renderContext,\n startupRenderContext,\n compilation,\n );\n },\n );\n },\n );\n }\n\n /**\n * Render the startup logic for the plugin.\n * @param {Source} source - The source code.\n * @param {RenderContext} renderContext - The render context.\n * @param {any} startupRenderContext - The startup render context.\n * @param {Compilation} compilation - The Webpack compilation instance.\n * @returns {string} - The modified source code.\n */\n private renderStartupLogic(\n source: Source,\n renderContext: Module,\n startupRenderContext: StartupRenderContext,\n compilation: Compilation,\n ): string {\n const isInvalidContext =\n this.hooks.checkInvalidContext.call(renderContext, compilation) ?? false;\n if (isInvalidContext) return source.source().toString();\n\n const { chunkGraph } = compilation;\n const replaceSource = source.source().toString();\n const [webpack_exec, ...webpack_exports] = replaceSource.split('\\n');\n const dependentChunkIds = this.getDependentChunkIds(\n startupRenderContext,\n chunkGraph,\n );\n\n return Template.asString([\n this.replaceWebpackExec(webpack_exec),\n `globalThis.ongoingRemotes = globalThis.ongoingRemotes || [];`,\n `var __webpack_exec__ = async function() {`,\n Template.indent([\n `var chunkIds = ${JSON.stringify(Array.from(dependentChunkIds))};`,\n `chunkIds.forEach(function(id) { ${RuntimeGlobals.ensureChunkHandlers}.consumes(id, globalThis.ongoingRemotes); });`,\n `await Promise.all(globalThis.ongoingRemotes);`,\n `chunkIds.forEach(function(id) { ${RuntimeGlobals.ensureChunkHandlers}.remotes(id, globalThis.ongoingRemotes); });`,\n `await Promise.all(globalThis.ongoingRemotes);`,\n `return __original_webpack_exec__.apply(this, arguments);`,\n ]),\n `};`,\n ...webpack_exports,\n ]);\n }\n\n /**\n * Replace the webpack exec string.\n * @param {string} webpack_exec - The webpack exec string.\n * @returns {string} - The replaced webpack exec string.\n */\n private replaceWebpackExec(webpack_exec: string): string {\n return webpack_exec.replace(\n '__webpack_exec__',\n '__original_webpack_exec__',\n );\n }\n\n /**\n * Get the IDs of the dependent chunks.\n * @param {any} startupRenderContext - The startup render context.\n * @param {any} chunkGraph - The chunk graph.\n * @returns {Set} - The set of dependent chunk IDs.\n */\n private getDependentChunkIds(\n startupRenderContext: RenderContext,\n chunkGraph: ChunkGraph,\n ): Set<string | number | null> {\n const entries = Array.from(\n chunkGraph.getChunkEntryModulesWithChunkGroupIterable(\n startupRenderContext.chunk,\n ),\n );\n const chunkIds = new Set<string | number | null>();\n for (const [module, entrypoint] of entries) {\n if (entrypoint) {\n const runtimeChunk = entrypoint.getRuntimeChunk();\n if (runtimeChunk) {\n const chunks = getAllChunks(entrypoint, runtimeChunk);\n for (const c of chunks) {\n chunkIds.add(c.id);\n }\n }\n }\n }\n return chunkIds;\n }\n}\n\nexport default AsyncBoundaryPlugin;\n"],"names":["AsyncBoundaryPlugin","apply","compiler","javascript","webpack","hooks","thisCompilation","tap","compilation","JavascriptModulesPlugin","getCompilationHooks","renderStartup","source","renderContext","startupRenderContext","renderStartupLogic","isInvalidContext","checkInvalidContext","call","toString","chunkGraph","replaceSource","webpack_exec","webpack_exports","split","dependentChunkIds","getDependentChunkIds","Template","asString","replaceWebpackExec","indent","JSON","stringify","Array","from","RuntimeGlobals","ensureChunkHandlers","replace","entries","getChunkEntryModulesWithChunkGroupIterable","chunk","chunkIds","Set","module","entrypoint","runtimeChunk","getRuntimeChunk","chunks","getAllChunks","c","add","id","SyncBailHook"],"mappings":";;;;+BA+IA;;;eAAA;;;yBA/IyC;8BAMZ;yBAIA;AAC7B;;;CAGC,GACD,IAAA,AAAMA,sBAAN,MAAMA;IAYJ;;;GAGC,GACD,AAAOC,MAAMC,QAAkB,EAAQ;QACrC,MAAM,EAAEC,UAAU,EAAE,GAAGD,SAASE,OAAO;QACvCF,SAASG,KAAK,CAACC,eAAe,CAACC,GAAG,CAChC,uBACA,CAACC;YACC,MAAMH,QACJF,WAAWM,uBAAuB,CAACC,mBAAmB,CAACF;YACzDH,MAAMM,aAAa,CAACJ,GAAG,CACrB,uBACA,CACEK,QACAC,eACAC;gBAEA,OAAO,IAAI,CAACC,kBAAkB,CAC5BH,QACAC,eACAC,sBACAN;YAEJ;QAEJ;IAEJ;IAEA;;;;;;;GAOC,GACD,AAAQO,mBACNH,MAAc,EACdC,aAAqB,EACrBC,oBAA0C,EAC1CN,WAAwB,EAChB;YAEN;QADF,MAAMQ,mBACJ,CAAA,uCAAA,IAAI,CAACX,KAAK,CAACY,mBAAmB,CAACC,IAAI,CAACL,eAAeL,wBAAnD,uCAAmE;QACrE,IAAIQ,kBAAkB,OAAOJ,OAAOA,MAAM,GAAGO,QAAQ;QAErD,MAAM,EAAEC,UAAU,EAAE,GAAGZ;QACvB,MAAMa,gBAAgBT,OAAOA,MAAM,GAAGO,QAAQ;QAC9C,MAAM,CAACG,cAAc,GAAGC,gBAAgB,GAAGF,cAAcG,KAAK,CAAC;QAC/D,MAAMC,oBAAoB,IAAI,CAACC,oBAAoB,CACjDZ,sBACAM;QAGF,OAAOO,iBAAQ,CAACC,QAAQ,CAAC;YACvB,IAAI,CAACC,kBAAkB,CAACP;YACxB,CAAC,4DAA4D,CAAC;YAC9D,CAAC,yCAAyC,CAAC;YAC3CK,iBAAQ,CAACG,MAAM,CAAC;gBACd,CAAC,eAAe,EAAEC,KAAKC,SAAS,CAACC,MAAMC,IAAI,CAACT,oBAAoB,CAAC,CAAC;gBAClE,CAAC,gCAAgC,EAAEU,uBAAc,CAACC,mBAAmB,CAAC,6CAA6C,CAAC;gBACpH,CAAC,6CAA6C,CAAC;gBAC/C,CAAC,gCAAgC,EAAED,uBAAc,CAACC,mBAAmB,CAAC,4CAA4C,CAAC;gBACnH,CAAC,6CAA6C,CAAC;gBAC/C,CAAC,yDAAyD,CAAC;aAC5D;YACD,CAAC,EAAE,CAAC;eACDb;SACJ;IACH;IAEA;;;;GAIC,GACD,AAAQM,mBAAmBP,YAAoB,EAAU;QACvD,OAAOA,aAAae,OAAO,CACzB,oBACA;IAEJ;IAEA;;;;;GAKC,GACD,AAAQX,qBACNZ,oBAAmC,EACnCM,UAAsB,EACO;QAC7B,MAAMkB,UAAUL,MAAMC,IAAI,CACxBd,WAAWmB,0CAA0C,CACnDzB,qBAAqB0B,KAAK;QAG9B,MAAMC,WAAW,IAAIC;QACrB,KAAK,MAAM,CAACC,QAAQC,WAAW,IAAIN,QAAS;YAC1C,IAAIM,YAAY;gBACd,MAAMC,eAAeD,WAAWE,eAAe;gBAC/C,IAAID,cAAc;oBAChB,MAAME,SAASC,IAAAA,0BAAY,EAACJ,YAAYC;oBACxC,KAAK,MAAMI,KAAKF,OAAQ;wBACtBN,SAASS,GAAG,CAACD,EAAEE,EAAE;oBACnB;gBACF;YACF;QACF;QACA,OAAOV;IACT;;QA5HA;;;GAGC,QACMpC,QAAQ;YACbY,qBAAqB,IAAImC,qBAAY,CAAiC;gBACpE;gBACA;aACD;QACH;;AAoHF;MAEA,WAAepD"}
1
+ {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/AsyncBoundaryPlugin.ts"],"sourcesContent":["import { Template, RuntimeGlobals } from 'webpack';\nimport { Source } from 'webpack-sources';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type Compiler from 'webpack/lib/Compiler';\nimport type Module from 'webpack/lib/Module';\nimport type Chunk from 'webpack/lib/Chunk';\nimport { getAllChunks } from 'webpack/lib/javascript/ChunkHelpers';\nimport { ChunkGraph } from 'webpack/lib/ChunkGroup';\nimport { StartupRenderContext } from 'webpack/lib/javascript/JavascriptModulesPlugin';\nimport { RenderContext } from 'webpack/lib/javascript/JavascriptModulesPlugin';\nimport { SyncBailHook } from 'tapable';\n/**\n * AsyncBoundaryPlugin is a Webpack plugin that handles asynchronous boundaries in a federated module.\n * @class\n */\nclass AsyncBoundaryPlugin {\n /**\n * Define hooks\n * @property {SyncBailHook} checkInvalidContext - A hook that checks if the render context is invalid.\n */\n public hooks = {\n checkInvalidContext: new SyncBailHook<[Module, Compilation], boolean>([\n 'renderContext',\n 'compilation',\n ]),\n };\n\n /**\n * Apply the plugin to the Webpack compiler instance.\n * @param {Compiler} compiler - Webpack compiler instance.\n */\n public apply(compiler: Compiler): void {\n const { javascript } = compiler.webpack;\n compiler.hooks.thisCompilation.tap(\n 'AsyncBoundaryPlugin',\n (compilation: Compilation) => {\n const hooks =\n javascript.JavascriptModulesPlugin.getCompilationHooks(compilation);\n \n hooks.renderStartup.tap(\n 'AsyncBoundaryPlugin',\n (\n source: Source,\n renderContext: Module,\n startupRenderContext: StartupRenderContext,\n ) => {\n return this.renderStartupLogic(\n source,\n renderContext,\n startupRenderContext,\n compilation,\n );\n },\n );\n },\n );\n }\n\n /**\n * Render the startup logic for the plugin.\n * @param {Source} source - The source code.\n * @param {RenderContext} renderContext - The render context.\n * @param {any} startupRenderContext - The startup render context.\n * @param {Compilation} compilation - The Webpack compilation instance.\n * @returns {string} - The modified source code.\n */\n private renderStartupLogic(\n source: Source,\n renderContext: Module,\n startupRenderContext: StartupRenderContext,\n compilation: Compilation,\n ): string {\n const isInvalidContext =\n this.hooks.checkInvalidContext.call(renderContext, compilation) ?? false;\n if (isInvalidContext) return source.source().toString();\n\n const { chunkGraph } = compilation;\n const replaceSource = source.source().toString();\n const replaceSourceLines = replaceSource.split('\\n');\n const webpack_exec_index = replaceSourceLines.findIndex(line => line.includes('webpack_exec'));\n const webpack_exec = replaceSourceLines[webpack_exec_index];\n const webpack_exports = replaceSourceLines.slice(webpack_exec_index + 1);\n const dependentChunkIds = this.getDependentChunkIds(\n startupRenderContext,\n chunkGraph,\n );\n\n return Template.asString([\n this.replaceWebpackExec(webpack_exec),\n `globalThis.ongoingRemotes = globalThis.ongoingRemotes || [];`,\n `var __webpack_exec__ = async function() {`,\n Template.indent([\n `var chunkIds = ${JSON.stringify(Array.from(dependentChunkIds))};`,\n `if (${RuntimeGlobals.ensureChunkHandlers}.consumes) {`,\n ` chunkIds.forEach(function(id) { ${RuntimeGlobals.ensureChunkHandlers}.consumes(id, globalThis.ongoingRemotes); });`,\n ` await Promise.all(globalThis.ongoingRemotes);`,\n `}`,\n `if (${RuntimeGlobals.ensureChunkHandlers}.remotes) {`,\n ` chunkIds.forEach(function(id) { ${RuntimeGlobals.ensureChunkHandlers}.remotes(id, globalThis.ongoingRemotes); });`,\n ` await Promise.all(globalThis.ongoingRemotes);`,\n `}`,\n `return __original_webpack_exec__.apply(this, arguments);`,\n ]),\n `};`,\n ...webpack_exports,\n ]);\n }\n\n /**\n * Replace the webpack exec string.\n * @param {string} webpack_exec - The webpack exec string.\n * @returns {string} - The replaced webpack exec string.\n */\n private replaceWebpackExec(webpack_exec: string): string {\n return webpack_exec.replace(\n '__webpack_exec__',\n '__original_webpack_exec__',\n );\n }\n\n /**\n * Get the IDs of the dependent chunks.\n * @param {any} startupRenderContext - The startup render context.\n * @param {any} chunkGraph - The chunk graph.\n * @returns {Set} - The set of dependent chunk IDs.\n */\n private getDependentChunkIds(\n startupRenderContext: RenderContext,\n chunkGraph: ChunkGraph,\n ): Set<string | number | null> {\n const entries = Array.from(\n chunkGraph.getChunkEntryModulesWithChunkGroupIterable(\n startupRenderContext.chunk,\n ),\n );\n const chunkIds = new Set<string | number | null>();\n for (const [module, entrypoint] of entries) {\n if (entrypoint) {\n const runtimeChunk = entrypoint.getRuntimeChunk();\n if (runtimeChunk) {\n const chunks = getAllChunks(entrypoint, runtimeChunk);\n for (const c of chunks) {\n chunkIds.add(c.id);\n }\n }\n }\n }\n return chunkIds;\n }\n}\n\nexport default AsyncBoundaryPlugin;\n"],"names":["AsyncBoundaryPlugin","apply","compiler","javascript","webpack","hooks","thisCompilation","tap","compilation","JavascriptModulesPlugin","getCompilationHooks","renderStartup","source","renderContext","startupRenderContext","renderStartupLogic","isInvalidContext","checkInvalidContext","call","toString","chunkGraph","replaceSource","replaceSourceLines","split","webpack_exec_index","findIndex","line","includes","webpack_exec","webpack_exports","slice","dependentChunkIds","getDependentChunkIds","Template","asString","replaceWebpackExec","indent","JSON","stringify","Array","from","RuntimeGlobals","ensureChunkHandlers","replace","entries","getChunkEntryModulesWithChunkGroupIterable","chunk","chunkIds","Set","module","entrypoint","runtimeChunk","getRuntimeChunk","chunks","getAllChunks","c","add","id","SyncBailHook"],"mappings":";;;;+BAuJA;;;eAAA;;;yBAvJyC;8BAMZ;yBAIA;AAC7B;;;CAGC,GACD,IAAA,AAAMA,sBAAN,MAAMA;IAYJ;;;GAGC,GACD,AAAOC,MAAMC,QAAkB,EAAQ;QACrC,MAAM,EAAEC,UAAU,EAAE,GAAGD,SAASE,OAAO;QACvCF,SAASG,KAAK,CAACC,eAAe,CAACC,GAAG,CAChC,uBACA,CAACC;YACC,MAAMH,QACJF,WAAWM,uBAAuB,CAACC,mBAAmB,CAACF;YAEzDH,MAAMM,aAAa,CAACJ,GAAG,CACrB,uBACA,CACEK,QACAC,eACAC;gBAEA,OAAO,IAAI,CAACC,kBAAkB,CAC5BH,QACAC,eACAC,sBACAN;YAEJ;QAEJ;IAEJ;IAEA;;;;;;;GAOC,GACD,AAAQO,mBACNH,MAAc,EACdC,aAAqB,EACrBC,oBAA0C,EAC1CN,WAAwB,EAChB;YAEN;QADF,MAAMQ,mBACJ,CAAA,uCAAA,IAAI,CAACX,KA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AAU;QACvD,OAAOA,aAAae,OAAO,CACzB,oBACA;IAEJ;IAEA;;;;;GAKC,GACD,AAAQX,qBACNlB,oBAAmC,EACnCM,UAAsB,EACO;QAC7B,MAAMwB,UAAUL,MAAMC,IAAI,CACxBpB,WAAWyB,0CAA0C,CACnD/B,qBAAqBgC,KAAK;QAG9B,MAAMC,WAAW,IAAIC;QACrB,KAAK,MAAM,CAACC,QAAQC,WAAW,IAAIN,QAAS;YAC1C,IAAIM,YAAY;gBACd,MAAMC,eAAeD,WAAWE,eAAe;gBAC/C,IAAID,cAAc;oBAChB,MAAME,SAASC,IAAAA,0BAAY,EAACJ,YAAYC;oBACxC,KAAK,MAAMI,KAAKF,OAAQ;wBACtBN,SAASS,GAAG,CAACD,EAAEE,EAAE;oBACnB;gBACF;YACF;QACF;QACA,OAAOV;IACT;;QApIA;;;GAGC,QACM1C,QAAQ;YACbY,qBAAqB,IAAIyC,qBAAY,CAAiC;gBACpE;gBACA;aACD;QACH;;AA4HF;MAEA,WAAe1D"}
@@ -11,9 +11,13 @@ Object.defineProperty(exports, "default", {
11
11
  return _default;
12
12
  }
13
13
  });
14
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
15
- const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
16
- const _Dependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/Dependency"));
14
+ const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
15
+ const _Dependency = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Dependency"));
16
+ function _interop_require_default(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
17
21
  let ContainerEntryDependency = class ContainerEntryDependency extends _Dependency.default {
18
22
  /**
19
23
  * @returns {string | null} an identifier to merge equal requests
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\nimport { ExposeOptions } from './ContainerEntryModule';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport Dependency from 'webpack/lib/Dependency';\n\nclass ContainerEntryDependency extends Dependency {\n public name: string;\n public exposes: [string, ExposeOptions][];\n public shareScope: string;\n\n /**\n * @param {string} name entry name\n * @param {[string, ExposeOptions][]} exposes list of exposed modules\n * @param {string} shareScope name of the share scope\n */\n constructor(\n name: string,\n exposes: [string, ExposeOptions][],\n shareScope: string,\n ) {\n super();\n this.name = name;\n this.exposes = exposes;\n this.shareScope = shareScope;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `container-entry-${this.name}`;\n }\n\n override get type(): string {\n return 'container entry';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n ContainerEntryDependency,\n 'enhanced/lib/container/ContainerEntryDependency',\n);\n\nexport default ContainerEntryDependency;\n"],"names":["ContainerEntryDependency","Dependency","getResourceIdentifier","name","type","category","constructor","exposes","shareScope","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BAgDA;;;eAAA;;;;2EA7C6B;qEACN;AAEvB,IAAA,AAAMA,2BAAN,MAAMA,iCAAiCC,mBAAU;IAqB/C;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAACC,IAAI,CAAC,CAAC;IACvC;IAEA,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IA7BA;;;;GAIC,GACDC,YACEH,IAAY,EACZI,OAAkC,EAClCC,UAAkB,CAClB;QACA,KAAK;QACL,IAAI,CAACL,IAAI,GAAGA;QACZ,IAAI,CAACI,OAAO,GAAGA;QACf,IAAI,CAACC,UAAU,GAAGA;IACpB;AAgBF;AAEAC,IAAAA,yBAAgB,EACdT,0BACA;MAGF,WAAeA"}
1
+ {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\nimport { ExposeOptions } from './ContainerEntryModule';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport Dependency from 'webpack/lib/Dependency';\n\nclass ContainerEntryDependency extends Dependency {\n public name: string;\n public exposes: [string, ExposeOptions][];\n public shareScope: string;\n\n /**\n * @param {string} name entry name\n * @param {[string, ExposeOptions][]} exposes list of exposed modules\n * @param {string} shareScope name of the share scope\n */\n constructor(\n name: string,\n exposes: [string, ExposeOptions][],\n shareScope: string,\n ) {\n super();\n this.name = name;\n this.exposes = exposes;\n this.shareScope = shareScope;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `container-entry-${this.name}`;\n }\n\n override get type(): string {\n return 'container entry';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n ContainerEntryDependency,\n 'enhanced/lib/container/ContainerEntryDependency',\n);\n\nexport default ContainerEntryDependency;\n"],"names":["ContainerEntryDependency","Dependency","getResourceIdentifier","name","type","category","constructor","exposes","shareScope","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BAgDA;;;eAAA;;;yEA7C6B;mEACN;;;;;;AAEvB,IAAA,AAAMA,2BAAN,MAAMA,iCAAiCC,mBAAU;IAqB/C;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,gBAAgB,EAAE,IAAI,CAACC,IAAI,CAAC,CAAC;IACvC;IAEA,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IA7BA;;;;GAIC,GACDC,YACEH,IAAY,EACZI,OAAkC,EAClCC,UAAkB,CAClB;QACA,KAAK;QACL,IAAI,CAACL,IAAI,GAAGA;QACZ,IAAI,CAACI,OAAO,GAAGA;QACf,IAAI,CAACC,UAAU,GAAGA;IACpB;AAgBF;AAEAC,IAAAA,yBAAgB,EACdT,0BACA;MAGF,WAAeA"}
@@ -11,17 +11,59 @@ Object.defineProperty(exports, "default", {
11
11
  return _default;
12
12
  }
13
13
  });
14
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
15
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
16
- const _AsyncDependenciesBlock = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/AsyncDependenciesBlock"));
17
- const _Template = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/Template"));
18
- const _Module = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/Module"));
19
- const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard._(require("webpack/lib/RuntimeGlobals"));
14
+ const _AsyncDependenciesBlock = /*#__PURE__*/ _interop_require_default(require("webpack/lib/AsyncDependenciesBlock"));
15
+ const _Template = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Template"));
16
+ const _Module = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Module"));
17
+ const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard(require("webpack/lib/RuntimeGlobals"));
20
18
  const _webpacksources = require("webpack-sources");
21
19
  const _ModuleTypeConstants = require("webpack/lib/ModuleTypeConstants");
22
- const _ContainerExposedDependency = /*#__PURE__*/ _interop_require_default._(require("./ContainerExposedDependency"));
23
- const _StaticExportsDependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/dependencies/StaticExportsDependency"));
24
- const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
20
+ const _ContainerExposedDependency = /*#__PURE__*/ _interop_require_default(require("./ContainerExposedDependency"));
21
+ const _StaticExportsDependency = /*#__PURE__*/ _interop_require_default(require("webpack/lib/dependencies/StaticExportsDependency"));
22
+ const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
23
+ function _interop_require_default(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
28
+ function _getRequireWildcardCache(nodeInterop) {
29
+ if (typeof WeakMap !== "function") return null;
30
+ var cacheBabelInterop = new WeakMap();
31
+ var cacheNodeInterop = new WeakMap();
32
+ return (_getRequireWildcardCache = function(nodeInterop) {
33
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
34
+ })(nodeInterop);
35
+ }
36
+ function _interop_require_wildcard(obj, nodeInterop) {
37
+ if (!nodeInterop && obj && obj.__esModule) {
38
+ return obj;
39
+ }
40
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
41
+ return {
42
+ default: obj
43
+ };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {};
50
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
51
+ for(var key in obj){
52
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
53
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
54
+ if (desc && (desc.get || desc.set)) {
55
+ Object.defineProperty(newObj, key, desc);
56
+ } else {
57
+ newObj[key] = obj[key];
58
+ }
59
+ }
60
+ }
61
+ newObj.default = obj;
62
+ if (cache) {
63
+ cache.set(obj, newObj);
64
+ }
65
+ return newObj;
66
+ }
25
67
  const SOURCE_TYPES = new Set([
26
68
  'javascript'
27
69
  ]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\n'use strict';\nimport AsyncDependenciesBlock from 'webpack/lib/AsyncDependenciesBlock';\nimport Dependency from 'webpack/lib/Dependency';\nimport Template from 'webpack/lib/Template';\nimport Module from 'webpack/lib/Module';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport { OriginalSource, RawSource } from 'webpack-sources';\nimport { JAVASCRIPT_MODULE_TYPE_DYNAMIC } from 'webpack/lib/ModuleTypeConstants';\nimport ContainerExposedDependency from './ContainerExposedDependency';\nimport StaticExportsDependency from 'webpack/lib/dependencies/StaticExportsDependency';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type {\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n WebpackOptions,\n InputFileSystem,\n ResolverWithOptions,\n} from 'webpack/lib/Module';\nimport type WebpackError from 'webpack/lib/WebpackError';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nconst SOURCE_TYPES = new Set(['javascript']);\n\nexport type ExposeOptions = {\n /**\n * requests to exposed modules (last one is exported)\n */\n import: string[];\n /**\n * custom chunk name for the exposed module\n */\n name: string;\n};\n\nclass ContainerEntryModule extends Module {\n private _name: string;\n private _exposes: [string, ExposeOptions][];\n private _shareScope: string;\n /**\n * @param {string} name container entry name\n * @param {[string, ExposeOptions][]} exposes list of exposed modules\n * @param {string} shareScope name of the share scope\n */\n constructor(\n name: string,\n exposes: [string, ExposeOptions][],\n shareScope: string,\n ) {\n super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);\n this._name = name;\n this._exposes = exposes;\n this._shareScope = shareScope;\n }\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {ContainerEntryModule} deserialized container entry module\n */\n static deserialize(context: ObjectDeserializerContext): ContainerEntryModule {\n const { read } = context;\n const obj = new ContainerEntryModule(read(), read(), read());\n //@ts-ignore\n obj.deserialize(context);\n return obj;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return SOURCE_TYPES;\n }\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return `container entry (${this._shareScope}) ${JSON.stringify(\n this._exposes,\n )}`;\n }\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return 'container entry';\n }\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `${this.layer ? `(${this.layer})/` : ''}webpack/container/entry/${\n this._name\n }`;\n }\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (\n arg0: (WebpackError | null) | undefined,\n arg1: boolean | undefined,\n ) => void,\n ): void {\n const baseContext = context as NeedBuildContext;\n callback(null, !this.buildMeta);\n }\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n topLevelDeclarations: new Set(['moduleMap', 'get', 'init']),\n };\n this.buildMeta.exportsType = 'namespace';\n //@ts-ignore\n this.clearDependenciesAndBlocks();\n\n for (const [name, options] of this._exposes) {\n const block = new AsyncDependenciesBlock(\n {\n name: options.name,\n },\n { name },\n options.import[options.import.length - 1],\n );\n let idx = 0;\n for (const request of options.import) {\n const dep = new ContainerExposedDependency(name, request);\n dep.loc = {\n name,\n index: idx++,\n };\n //@ts-ignore\n block.addDependency(dep);\n }\n //@ts-ignore\n this.addBlock(block);\n }\n //@ts-ignore\n this.addDependency(\n //@ts-ignore\n new StaticExportsDependency(\n ['get', 'init'],\n false,\n ) as unknown as Dependency,\n );\n\n callback();\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n //@ts-ignore\n override codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {\n const sources = new Map();\n const runtimeRequirements = new Set([\n RuntimeGlobals.definePropertyGetters,\n RuntimeGlobals.hasOwnProperty,\n RuntimeGlobals.exports,\n ]);\n const getters = [];\n //@ts-ignore\n for (const block of this.blocks) {\n const { dependencies } = block;\n\n const modules = dependencies.map((dependency: Dependency) => {\n const dep = dependency as unknown as ContainerExposedDependency;\n return {\n name: dep.exposedName,\n module: moduleGraph.getModule(dep),\n request: dep.userRequest,\n };\n });\n\n let str;\n //@ts-ignore\n if (modules.some((m) => !m.module)) {\n str = runtimeTemplate.throwMissingModuleErrorBlock({\n //@ts-ignore\n request: modules.map((m) => m.request).join(', '),\n });\n } else {\n str = `return ${runtimeTemplate.blockPromise({\n block,\n message: '',\n chunkGraph,\n runtimeRequirements,\n })}.then(${runtimeTemplate.returningFunction(\n runtimeTemplate.returningFunction(\n `(${modules\n //@ts-ignore\n .map(({ module, request }) =>\n runtimeTemplate.moduleRaw({\n module,\n chunkGraph,\n request,\n weak: false,\n runtimeRequirements,\n }),\n )\n .join(', ')})`,\n ),\n )});`;\n }\n\n getters.push(\n `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction(\n '',\n str,\n )}`,\n );\n }\n\n const source = Template.asString([\n `var moduleMap = {`,\n Template.indent(getters.join(',\\n')),\n '};',\n `var get = ${runtimeTemplate.basicFunction('module, getScope', [\n `${RuntimeGlobals.currentRemoteGetScope} = getScope;`,\n // reusing the getScope variable to avoid creating a new var (and module is also used later)\n 'getScope = (',\n Template.indent([\n `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`,\n Template.indent([\n '? moduleMap[module]()',\n `: Promise.resolve().then(${runtimeTemplate.basicFunction(\n '',\n \"throw new Error('Module \\\"' + module + '\\\" does not exist in container.');\",\n )})`,\n ]),\n ]),\n ');',\n `${RuntimeGlobals.currentRemoteGetScope} = undefined;`,\n 'return getScope;',\n ])};`,\n `var init = ${runtimeTemplate.basicFunction('shareScope, initScope', [\n `if (!${RuntimeGlobals.shareScopeMap}) return;`,\n `var name = ${JSON.stringify(this._shareScope)}`,\n `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`,\n `if(oldScope && oldScope !== shareScope) throw new Error(\"Container initialization failed as it has already been initialized with a different share scope\");`,\n `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`,\n `return ${RuntimeGlobals.initializeSharing}(name, initScope);`,\n ])};`,\n '',\n '// This exports getters to disallow modifications',\n `${RuntimeGlobals.definePropertyGetters}(exports, {`,\n Template.indent([\n `get: ${runtimeTemplate.returningFunction('get')},`,\n `init: ${runtimeTemplate.returningFunction('init')}`,\n ]),\n '});',\n ]);\n\n sources.set(\n 'javascript',\n this.useSourceMap || this.useSimpleSourceMap\n ? new OriginalSource(source, 'webpack/container-entry')\n : new RawSource(source),\n );\n\n return {\n sources,\n runtimeRequirements,\n };\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n /**\n * @param {ObjectSerializerContext} context context\n */\n //@ts-ignore\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this._name);\n write(this._exposes);\n write(this._shareScope);\n //@ts-ignore\n super.serialize(context);\n }\n}\n//@ts-ignore\nmakeSerializable(\n ContainerEntryModule,\n 'enhanced/lib/container/ContainerEntryModule',\n);\n\nexport default ContainerEntryModule;\n"],"names":["SOURCE_TYPES","Set","ContainerEntryModule","Module","deserialize","context","read","obj","getSourceTypes","identifier","_shareScope","JSON","stringify","_exposes","readableIdentifier","requestShortener","libIdent","options","layer","_name","needBuild","callback","baseContext","buildMeta","build","compilation","resolver","fs","buildInfo","strict","topLevelDeclarations","exportsType","clearDependenciesAndBlocks","name","block","AsyncDependenciesBlock","import","length","idx","request","dep","ContainerExposedDependency","loc","index","addDependency","addBlock","StaticExportsDependency","codeGeneration","moduleGraph","chunkGraph","runtimeTemplate","sources","Map","runtimeRequirements","RuntimeGlobals","definePropertyGetters","hasOwnProperty","exports","getters","blocks","dependencies","modules","map","dependency","exposedName","module","getModule","userRequest","str","some","m","throwMissingModuleErrorBlock","join","blockPromise","message","returningFunction","moduleRaw","weak","push","basicFunction","source","Template","asString","indent","currentRemoteGetScope","shareScopeMap","initializeSharing","set","useSourceMap","useSimpleSourceMap","OriginalSource","RawSource","size","type","serialize","write","constructor","exposes","shareScope","JAVASCRIPT_MODULE_TYPE_DYNAMIC","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA0TA;;;eAAA;;;;;iFAzTmC;mEAEd;iEACF;0EACa;gCACU;qCACK;qFACR;kFACH;2EAaP;AAE7B,MAAMA,eAAe,IAAIC,IAAI;IAAC;CAAa;AAa3C,IAAA,AAAMC,uBAAN,MAAMA,6BAA6BC,eAAM;IAmBvC;;;GAGC,GACD,OAAOC,YAAYC,OAAkC,EAAwB;QAC3E,MAAM,EAAEC,IAAI,EAAE,GAAGD;QACjB,MAAME,MAAM,IAAIL,qBAAqBI,QAAQA,QAAQA;QACrD,YAAY;QACZC,IAAIH,WAAW,CAACC;QAChB,OAAOE;IACT;IAEA;;GAEC,GACD,AAASC,iBAA8B;QACrC,OAAOR;IACT;IACA;;GAEC,GACD,AAASS,aAAqB;QAC5B,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAACC,WAAW,CAAC,EAAE,EAAEC,KAAKC,SAAS,CAC5D,IAAI,CAACC,QAAQ,EACb,CAAC;IACL;IACA;;;GAGC,GACD,AAASC,mBAAmBC,gBAAkC,EAAU;QACtE,OAAO;IACT;IACA;;;GAGC,GACD,AAASC,SAASC,OAAwB,EAAiB;QACzD,OAAO,CAAC,EAAE,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,CAACA,KAAK,CAAC,EAAE,CAAC,GAAG,G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AAC;gBACnD,CAAC,MAAM,EAAEzB,gBAAgByB,iBAAiB,CAAC,QAAQ,CAAC;aACrD;YACD;SACD;QAEDxB,QAAQoC,GAAG,CACT,cACA,IAAI,CAACC,YAAY,IAAI,IAAI,CAACC,kBAAkB,GACxC,IAAIC,8BAAc,CAACV,QAAQ,6BAC3B,IAAIW,yBAAS,CAACX;QAGpB,OAAO;YACL7B;YACAE;QACF;IACF;IAEA;;;GAGC,GACD,AAASuC,KAAKC,IAAa,EAAU;QACnC,OAAO;IACT;IACA;;GAEC,GACD,YAAY;IACHC,UAAUzF,OAAgC,EAAQ;QACzD,MAAM,EAAE0F,KAAK,EAAE,GAAG1F;QAClB0F,MAAM,IAAI,CAAC5E,KAAK;QAChB4E,MAAM,IAAI,CAAClF,QAAQ;QACnBkF,MAAM,IAAI,CAACrF,WAAW;QACtB,YAAY;QACZ,KAAK,CAACoF,UAAUzF;IAClB;IAzQA;;;;GAIC,GACD2F,YACE/D,IAAY,EACZgE,OAAkC,EAClCC,UAAkB,CAClB;QACA,KAAK,CAACC,mDAA8B,EAAE;QACtC,IAAI,CAAChF,KAAK,GAAGc;QACb,IAAI,CAACpB,QAAQ,GAAGoF;QAChB,IAAI,CAACvF,WAAW,GAAGwF;IACrB;AA4PF;AACA,YAAY;AACZE,IAAAA,yBAAgB,EACdlG,sBACA;MAGF,WAAeA"}
1
+ {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\n'use strict';\nimport AsyncDependenciesBlock from 'webpack/lib/AsyncDependenciesBlock';\nimport Dependency from 'webpack/lib/Dependency';\nimport Template from 'webpack/lib/Template';\nimport Module from 'webpack/lib/Module';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport { OriginalSource, RawSource } from 'webpack-sources';\nimport { JAVASCRIPT_MODULE_TYPE_DYNAMIC } from 'webpack/lib/ModuleTypeConstants';\nimport ContainerExposedDependency from './ContainerExposedDependency';\nimport StaticExportsDependency from 'webpack/lib/dependencies/StaticExportsDependency';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type {\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n WebpackOptions,\n InputFileSystem,\n ResolverWithOptions,\n} from 'webpack/lib/Module';\nimport type WebpackError from 'webpack/lib/WebpackError';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nconst SOURCE_TYPES = new Set(['javascript']);\n\nexport type ExposeOptions = {\n /**\n * requests to exposed modules (last one is exported)\n */\n import: string[];\n /**\n * custom chunk name for the exposed module\n */\n name: string;\n};\n\nclass ContainerEntryModule extends Module {\n private _name: string;\n private _exposes: [string, ExposeOptions][];\n private _shareScope: string;\n /**\n * @param {string} name container entry name\n * @param {[string, ExposeOptions][]} exposes list of exposed modules\n * @param {string} shareScope name of the share scope\n */\n constructor(\n name: string,\n exposes: [string, ExposeOptions][],\n shareScope: string,\n ) {\n super(JAVASCRIPT_MODULE_TYPE_DYNAMIC, null);\n this._name = name;\n this._exposes = exposes;\n this._shareScope = shareScope;\n }\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {ContainerEntryModule} deserialized container entry module\n */\n static deserialize(context: ObjectDeserializerContext): ContainerEntryModule {\n const { read } = context;\n const obj = new ContainerEntryModule(read(), read(), read());\n //@ts-ignore\n obj.deserialize(context);\n return obj;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return SOURCE_TYPES;\n }\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return `container entry (${this._shareScope}) ${JSON.stringify(\n this._exposes,\n )}`;\n }\n /**\n * @param {RequestShortener} requestShortener the request shortener\n * @returns {string} a user readable identifier of the module\n */\n override readableIdentifier(requestShortener: RequestShortener): string {\n return 'container entry';\n }\n /**\n * @param {LibIdentOptions} options options\n * @returns {string | null} an identifier for library inclusion\n */\n override libIdent(options: LibIdentOptions): string | null {\n return `${this.layer ? `(${this.layer})/` : ''}webpack/container/entry/${\n this._name\n }`;\n }\n /**\n * @param {NeedBuildContext} context context info\n * @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild\n * @returns {void}\n */\n override needBuild(\n context: NeedBuildContext,\n callback: (\n arg0: (WebpackError | null) | undefined,\n arg1: boolean | undefined,\n ) => void,\n ): void {\n const baseContext = context as NeedBuildContext;\n callback(null, !this.buildMeta);\n }\n /**\n * @param {WebpackOptions} options webpack options\n * @param {Compilation} compilation the compilation\n * @param {ResolverWithOptions} resolver the resolver\n * @param {InputFileSystem} fs the file system\n * @param {function(WebpackError): void} callback callback function\n * @returns {void}\n */\n override build(\n options: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n topLevelDeclarations: new Set(['moduleMap', 'get', 'init']),\n };\n this.buildMeta.exportsType = 'namespace';\n //@ts-ignore\n this.clearDependenciesAndBlocks();\n\n for (const [name, options] of this._exposes) {\n const block = new AsyncDependenciesBlock(\n {\n name: options.name,\n },\n { name },\n options.import[options.import.length - 1],\n );\n let idx = 0;\n for (const request of options.import) {\n const dep = new ContainerExposedDependency(name, request);\n dep.loc = {\n name,\n index: idx++,\n };\n //@ts-ignore\n block.addDependency(dep);\n }\n //@ts-ignore\n this.addBlock(block);\n }\n //@ts-ignore\n this.addDependency(\n //@ts-ignore\n new StaticExportsDependency(\n ['get', 'init'],\n false,\n ) as unknown as Dependency,\n );\n\n callback();\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n //@ts-ignore\n override codeGeneration({ moduleGraph, chunkGraph, runtimeTemplate }) {\n const sources = new Map();\n const runtimeRequirements = new Set([\n RuntimeGlobals.definePropertyGetters,\n RuntimeGlobals.hasOwnProperty,\n RuntimeGlobals.exports,\n ]);\n const getters = [];\n //@ts-ignore\n for (const block of this.blocks) {\n const { dependencies } = block;\n\n const modules = dependencies.map((dependency: Dependency) => {\n const dep = dependency as unknown as ContainerExposedDependency;\n return {\n name: dep.exposedName,\n module: moduleGraph.getModule(dep),\n request: dep.userRequest,\n };\n });\n\n let str;\n //@ts-ignore\n if (modules.some((m) => !m.module)) {\n str = runtimeTemplate.throwMissingModuleErrorBlock({\n //@ts-ignore\n request: modules.map((m) => m.request).join(', '),\n });\n } else {\n str = `return ${runtimeTemplate.blockPromise({\n block,\n message: '',\n chunkGraph,\n runtimeRequirements,\n })}.then(${runtimeTemplate.returningFunction(\n runtimeTemplate.returningFunction(\n `(${modules\n //@ts-ignore\n .map(({ module, request }) =>\n runtimeTemplate.moduleRaw({\n module,\n chunkGraph,\n request,\n weak: false,\n runtimeRequirements,\n }),\n )\n .join(', ')})`,\n ),\n )});`;\n }\n\n getters.push(\n `${JSON.stringify(modules[0].name)}: ${runtimeTemplate.basicFunction(\n '',\n str,\n )}`,\n );\n }\n\n const source = Template.asString([\n `var moduleMap = {`,\n Template.indent(getters.join(',\\n')),\n '};',\n `var get = ${runtimeTemplate.basicFunction('module, getScope', [\n `${RuntimeGlobals.currentRemoteGetScope} = getScope;`,\n // reusing the getScope variable to avoid creating a new var (and module is also used later)\n 'getScope = (',\n Template.indent([\n `${RuntimeGlobals.hasOwnProperty}(moduleMap, module)`,\n Template.indent([\n '? moduleMap[module]()',\n `: Promise.resolve().then(${runtimeTemplate.basicFunction(\n '',\n \"throw new Error('Module \\\"' + module + '\\\" does not exist in container.');\",\n )})`,\n ]),\n ]),\n ');',\n `${RuntimeGlobals.currentRemoteGetScope} = undefined;`,\n 'return getScope;',\n ])};`,\n `var init = ${runtimeTemplate.basicFunction('shareScope, initScope', [\n `if (!${RuntimeGlobals.shareScopeMap}) return;`,\n `var name = ${JSON.stringify(this._shareScope)}`,\n `var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`,\n `if(oldScope && oldScope !== shareScope) throw new Error(\"Container initialization failed as it has already been initialized with a different share scope\");`,\n `${RuntimeGlobals.shareScopeMap}[name] = shareScope;`,\n `return ${RuntimeGlobals.initializeSharing}(name, initScope);`,\n ])};`,\n '',\n '// This exports getters to disallow modifications',\n `${RuntimeGlobals.definePropertyGetters}(exports, {`,\n Template.indent([\n `get: ${runtimeTemplate.returningFunction('get')},`,\n `init: ${runtimeTemplate.returningFunction('init')}`,\n ]),\n '});',\n ]);\n\n sources.set(\n 'javascript',\n this.useSourceMap || this.useSimpleSourceMap\n ? new OriginalSource(source, 'webpack/container-entry')\n : new RawSource(source),\n );\n\n return {\n sources,\n runtimeRequirements,\n };\n }\n\n /**\n * @param {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n /**\n * @param {ObjectSerializerContext} context context\n */\n //@ts-ignore\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this._name);\n write(this._exposes);\n write(this._shareScope);\n //@ts-ignore\n super.serialize(context);\n }\n}\n//@ts-ignore\nmakeSerializable(\n ContainerEntryModule,\n 'enhanced/lib/container/ContainerEntryModule',\n);\n\nexport default ContainerEntryModule;\n"],"names":["SOURCE_TYPES","Set","ContainerEntryModule","Module","deserialize","context","read","obj","getSourceTypes","identifier","_shareScope","JSON","stringify","_exposes","readableIdentifier","requestShortener","libIdent","options","layer","_name","needBuild","callback","baseContext","buildMeta","build","compilation","resolver","fs","buildInfo","strict","topLevelDeclarations","exportsType","clearDependenciesAndBlocks","name","block","AsyncDependenciesBlock","import","length","idx","request","dep","ContainerExposedDependency","loc","index","addDependency","addBlock","StaticExportsDependency","codeGeneration","moduleGraph","chunkGraph","runtimeTemplate","sources","Map","runtimeRequirements","RuntimeGlobals","definePropertyGetters","hasOwnProperty","exports","getters","blocks","dependencies","modules","map","dependency","exposedName","module","getModule","userRequest","str","some","m","throwMissingModuleErrorBlock","join","blockPromise","message","returningFunction","moduleRaw","weak","push","basicFunction","source","Template","asString","indent","currentRemoteGetScope","shareScopeMap","initializeSharing","set","useSourceMap","useSimpleSourceMap","OriginalSource","RawSource","size","type","serialize","write","constructor","exposes","shareScope","JAVASCRIPT_MODULE_TYPE_DYNAMIC","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA0TA;;;eAAA;;;+EAzTmC;iEAEd;+DACF;wEACa;gCACU;qCACK;mFACR;gFACH;yEAaP;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE7B,MAAMA,eAAe,IAAIC,IAAI;IAAC;CAAa;AAa3C,IAAA,AAAMC,uBAAN,MAAMA,6BAA6BC,eAAM;IAmBvC;;;GAGC,GACD,OAAOC,YAAYC,OAAkC,EAAwB;QAC3E,MAAM,EAAEC,IAAI,EAAE,GAAGD;QACjB,MAAME,MAAM,IAAIL,qBAAqBI,QAAQA,QAAQA;QACrD,YAAY;QACZC,IAAIH,WAAW,CAACC;QAChB,OAAOE;IACT;IAEA;;GAEC,GACD,AAASC,iBAA8B;QACrC,OAAOR;IACT;IACA;;GAEC,GACD,AAASS,aAAqB;QAC5B,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAACC,WAAW,CAAC,EAAE,EAAEC,KAAKC,SAAS,CAC5D,IAAI,CAACC,QAAQ,EACb,CAAC;IACL;IACA;;;GAGC,GACD,AAASC,mBAAmBC,gBAAkC,EAAU;QACtE,OAAO;IACT;IACA;;;GAGC,GACD,AAASC,SAASC,OAAwB,EAAiB;QACzD,OAAO,CAAC,EAAE,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,CAACA,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,wBAAwB,EACrE,IAAI,CAACC,KAAK,CACX,CAAC;IACJ;IACA;;;;GAIC,GACD,AAASC,UACPf,OAAyB,EACzBgB,QAGS,EACH;QACN,MAAMC,c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AACC,YAAY,IAAI,IAAI,CAACC,kBAAkB,GACxC,IAAIC,8BAAc,CAACV,QAAQ,6BAC3B,IAAIW,yBAAS,CAACX;QAGpB,OAAO;YACL7B;YACAE;QACF;IACF;IAEA;;;GAGC,GACD,AAASuC,KAAKC,IAAa,EAAU;QACnC,OAAO;IACT;IACA;;GAEC,GACD,YAAY;IACHC,UAAUzF,OAAgC,EAAQ;QACzD,MAAM,EAAE0F,KAAK,EAAE,GAAG1F;QAClB0F,MAAM,IAAI,CAAC5E,KAAK;QAChB4E,MAAM,IAAI,CAAClF,QAAQ;QACnBkF,MAAM,IAAI,CAACrF,WAAW;QACtB,YAAY;QACZ,KAAK,CAACoF,UAAUzF;IAClB;IAzQA;;;;GAIC,GACD2F,YACE/D,IAAY,EACZgE,OAAkC,EAClCC,UAAkB,CAClB;QACA,KAAK,CAACC,mDAA8B,EAAE;QACtC,IAAI,CAAChF,KAAK,GAAGc;QACb,IAAI,CAACpB,QAAQ,GAAGoF;QAChB,IAAI,CAACvF,WAAW,GAAGwF;IACrB;AA4PF;AACA,YAAY;AACZE,IAAAA,yBAAgB,EACdlG,sBACA;MAGF,WAAeA"}
@@ -11,9 +11,13 @@ Object.defineProperty(exports, "default", {
11
11
  return ContainerEntryModuleFactory;
12
12
  }
13
13
  });
14
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
15
- const _ContainerEntryModule = /*#__PURE__*/ _interop_require_default._(require("./ContainerEntryModule"));
16
- const _ModuleFactory = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/ModuleFactory"));
14
+ const _ContainerEntryModule = /*#__PURE__*/ _interop_require_default(require("./ContainerEntryModule"));
15
+ const _ModuleFactory = /*#__PURE__*/ _interop_require_default(require("webpack/lib/ModuleFactory"));
16
+ function _interop_require_default(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
17
21
  let ContainerEntryModuleFactory = class ContainerEntryModuleFactory extends _ModuleFactory.default {
18
22
  /**
19
23
  * @param {ModuleFactoryCreateData} data data object
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryModuleFactory.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\n'use strict';\n\nimport ContainerEntryModule from './ContainerEntryModule';\nimport ContainerEntryDependency from './ContainerEntryDependency';\nimport ModuleFactory from 'webpack/lib/ModuleFactory';\nimport type {\n ModuleFactoryCreateData,\n ModuleFactoryResult,\n} from 'webpack/lib/ModuleFactory';\n\nexport default class ContainerEntryModuleFactory extends ModuleFactory {\n /**\n * @param {ModuleFactoryCreateData} data data object\n * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback\n * @returns {void}\n */\n override create(\n data: ModuleFactoryCreateData,\n callback: (error: Error | null, result: ModuleFactoryResult) => void,\n ): void {\n const { dependencies } = data;\n const containerDependencies =\n dependencies as unknown as ContainerEntryDependency[];\n const dep = containerDependencies[0];\n\n callback(null, {\n module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope),\n });\n }\n}\n"],"names":["ContainerEntryModuleFactory","ModuleFactory","create","data","callback","dependencies","containerDependencies","dep","module","ContainerEntryModule","name","exposes","shareScope"],"mappings":"AAAA;;;AAGA,GAEA;;;;;;;eAUqBA;;;;+EARY;wEAEP;AAMX,IAAA,AAAMA,8BAAN,MAAMA,oCAAoCC,sBAAa;IACpE;;;;GAIC,GACD,AAASC,OACPC,IAA6B,EAC7BC,QAAoE,EAC9D;QACN,MAAM,EAAEC,YAAY,EAAE,GAAGF;QACzB,MAAMG,wBACJD;QACF,MAAME,MAAMD,qBAAqB,CAAC,EAAE;QAEpCF,SAAS,MAAM;YACbI,QAAQ,IAAIC,6BAAoB,CAACF,IAAIG,IAAI,EAAEH,IAAII,OAAO,EAAEJ,IAAIK,UAAU;QACxE;IACF;AACF"}
1
+ {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerEntryModuleFactory.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\n'use strict';\n\nimport ContainerEntryModule from './ContainerEntryModule';\nimport ContainerEntryDependency from './ContainerEntryDependency';\nimport ModuleFactory from 'webpack/lib/ModuleFactory';\nimport type {\n ModuleFactoryCreateData,\n ModuleFactoryResult,\n} from 'webpack/lib/ModuleFactory';\n\nexport default class ContainerEntryModuleFactory extends ModuleFactory {\n /**\n * @param {ModuleFactoryCreateData} data data object\n * @param {function((Error | null)=, ModuleFactoryResult=): void} callback callback\n * @returns {void}\n */\n override create(\n data: ModuleFactoryCreateData,\n callback: (error: Error | null, result: ModuleFactoryResult) => void,\n ): void {\n const { dependencies } = data;\n const containerDependencies =\n dependencies as unknown as ContainerEntryDependency[];\n const dep = containerDependencies[0];\n\n callback(null, {\n module: new ContainerEntryModule(dep.name, dep.exposes, dep.shareScope),\n });\n }\n}\n"],"names":["ContainerEntryModuleFactory","ModuleFactory","create","data","callback","dependencies","containerDependencies","dep","module","ContainerEntryModule","name","exposes","shareScope"],"mappings":"AAAA;;;AAGA,GAEA;;;;;;;eAUqBA;;;6EARY;sEAEP;;;;;;AAMX,IAAA,AAAMA,8BAAN,MAAMA,oCAAoCC,sBAAa;IACpE;;;;GAIC,GACD,AAASC,OACPC,IAA6B,EAC7BC,QAAoE,EAC9D;QACN,MAAM,EAAEC,YAAY,EAAE,GAAGF;QACzB,MAAMG,wBACJD;QACF,MAAME,MAAMD,qBAAqB,CAAC,EAAE;QAEpCF,SAAS,MAAM;YACbI,QAAQ,IAAIC,6BAAoB,CAACF,IAAIG,IAAI,EAAEH,IAAII,OAAO,EAAEJ,IAAIK,UAAU;QACxE;IACF;AACF"}
@@ -11,9 +11,13 @@ Object.defineProperty(exports, "default", {
11
11
  return _default;
12
12
  }
13
13
  });
14
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
15
- const _ModuleDependency = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/dependencies/ModuleDependency"));
16
- const _makeSerializable = /*#__PURE__*/ _interop_require_default._(require("webpack/lib/util/makeSerializable"));
14
+ const _ModuleDependency = /*#__PURE__*/ _interop_require_default(require("webpack/lib/dependencies/ModuleDependency"));
15
+ const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
16
+ function _interop_require_default(obj) {
17
+ return obj && obj.__esModule ? obj : {
18
+ default: obj
19
+ };
20
+ }
17
21
  let ContainerExposedDependency = class ContainerExposedDependency extends _ModuleDependency.default {
18
22
  get type() {
19
23
  return 'container exposed';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerExposedDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/dependencies/ModuleDependency';\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass ContainerExposedDependency extends ModuleDependency {\n exposedName: string;\n override request: string;\n\n /**\n * @param {string} exposedName public name\n * @param {string} request request to module\n */\n constructor(exposedName: string, request: string) {\n super(request);\n this.exposedName = exposedName;\n this.request = request;\n }\n\n override get type(): string {\n return 'container exposed';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `exposed dependency ${this.exposedName}=${this.request}`;\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n context.write(this.exposedName);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n this.exposedName = context.read();\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ContainerExposedDependency,\n 'enhanced/lib/container/ContainerExposedDependency',\n);\n\nexport default ContainerExposedDependency;\n"],"names":["ContainerExposedDependency","ModuleDependency","type","category","getResourceIdentifier","exposedName","request","serialize","context","write","deserialize","read","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA4DA;;;eAAA;;;;2EAtD6B;2EACA;AAE7B,IAAA,AAAMA,6BAAN,MAAMA,mCAAmCC,yBAAgB;IAcvD,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAEA;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;IACjE;IAEA;;GAEC,GACD,AAASC,UAAUC,OAAgC,EAAQ;QACzDA,QAAQC,KAAK,CAAC,IAAI,CAACJ,WAAW;QAC9B,KAAK,CAACE,UAAUC;IAClB;IAEA;;GAEC,GACD,AAASE,YAAYF,OAAkC,EAAQ;QAC7D,IAAI,CAACH,WAAW,GAAGG,QAAQG,IAAI;QAC/B,KAAK,CAACD,YAAYF;IACpB;IAvCA;;;GAGC,GACDI,YAAYP,WAAmB,EAAEC,OAAe,CAAE;QAChD,KAAK,CAACA;QACN,IAAI,CAACD,WAAW,GAAGA;QACnB,IAAI,CAACC,OAAO,GAAGA;IACjB;AAgCF;AAEAO,IAAAA,yBAAgB,EACdb,4BACA;MAGF,WAAeA"}
1
+ {"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerExposedDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy, Marais Rossouw @maraisr\n*/\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/dependencies/ModuleDependency';\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass ContainerExposedDependency extends ModuleDependency {\n exposedName: string;\n override request: string;\n\n /**\n * @param {string} exposedName public name\n * @param {string} request request to module\n */\n constructor(exposedName: string, request: string) {\n super(request);\n this.exposedName = exposedName;\n this.request = request;\n }\n\n override get type(): string {\n return 'container exposed';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `exposed dependency ${this.exposedName}=${this.request}`;\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n context.write(this.exposedName);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n this.exposedName = context.read();\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ContainerExposedDependency,\n 'enhanced/lib/container/ContainerExposedDependency',\n);\n\nexport default ContainerExposedDependency;\n"],"names":["ContainerExposedDependency","ModuleDependency","type","category","getResourceIdentifier","exposedName","request","serialize","context","write","deserialize","read","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA4DA;;;eAAA;;;yEAtD6B;yEACA;;;;;;AAE7B,IAAA,AAAMA,6BAAN,MAAMA,mCAAmCC,yBAAgB;IAcvD,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAEA;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,mBAAmB,EAAE,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;IACjE;IAEA;;GAEC,GACD,AAASC,UAAUC,OAAgC,EAAQ;QACzDA,QAAQC,KAAK,CAAC,IAAI,CAACJ,WAAW;QAC9B,KAAK,CAACE,UAAUC;IAClB;IAEA;;GAEC,GACD,AAASE,YAAYF,OAAkC,EAAQ;QAC7D,IAAI,CAACH,WAAW,GAAGG,QAAQG,IAAI;QAC/B,KAAK,CAACD,YAAYF;IACpB;IAvCA;;;GAGC,GACDI,YAAYP,WAAmB,EAAEC,OAAe,CAAE;QAChD,KAAK,CAACA;QACN,IAAI,CAACD,WAAW,GAAGA;QACnB,IAAI,CAACC,OAAO,GAAGA;IACjB;AAgCF;AAEAO,IAAAA,yBAAgB,EACdb,4BACA;MAGF,WAAeA"}