@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.
- package/CHANGELOG.md +23 -0
- package/package.json +1 -1
- package/src/index.js +22 -18
- package/src/index.js.map +1 -1
- package/src/lib/Constants.js +33 -33
- package/src/lib/Constants.js.map +1 -1
- package/src/lib/container/AsyncBoundaryPlugin.js +12 -5
- package/src/lib/container/AsyncBoundaryPlugin.js.map +1 -1
- package/src/lib/container/ContainerEntryDependency.js +7 -3
- package/src/lib/container/ContainerEntryDependency.js.map +1 -1
- package/src/lib/container/ContainerEntryModule.js +51 -9
- package/src/lib/container/ContainerEntryModule.js.map +1 -1
- package/src/lib/container/ContainerEntryModuleFactory.js +7 -3
- package/src/lib/container/ContainerEntryModuleFactory.js.map +1 -1
- package/src/lib/container/ContainerExposedDependency.js +7 -3
- package/src/lib/container/ContainerExposedDependency.js.map +1 -1
- package/src/lib/container/ContainerPlugin.js +9 -5
- package/src/lib/container/ContainerPlugin.js.map +1 -1
- package/src/lib/container/ContainerReferencePlugin.js +53 -11
- package/src/lib/container/ContainerReferencePlugin.js.map +1 -1
- package/src/lib/container/FallbackDependency.js +7 -3
- package/src/lib/container/FallbackDependency.js.map +1 -1
- package/src/lib/container/FallbackItemDependency.js +7 -3
- package/src/lib/container/FallbackItemDependency.js.map +1 -1
- package/src/lib/container/FallbackModule.js +10 -6
- package/src/lib/container/FallbackModule.js.map +1 -1
- package/src/lib/container/FallbackModuleFactory.js +7 -3
- package/src/lib/container/FallbackModuleFactory.js.map +1 -1
- package/src/lib/container/ModuleFederationPlugin.js +10 -6
- package/src/lib/container/ModuleFederationPlugin.js.map +1 -1
- package/src/lib/container/RemoteModule.js +10 -6
- package/src/lib/container/RemoteModule.js.map +1 -1
- package/src/lib/container/RemoteRuntimeModule.js +8 -4
- package/src/lib/container/RemoteRuntimeModule.js.map +1 -1
- package/src/lib/container/RemoteToExternalDependency.d.js +6 -2
- package/src/lib/container/RemoteToExternalDependency.d.js.map +1 -1
- package/src/lib/container/RemoteToExternalDependency.js +7 -3
- package/src/lib/container/RemoteToExternalDependency.js.map +1 -1
- package/src/lib/sharing/ConsumeSharedFallbackDependency.js +7 -3
- package/src/lib/sharing/ConsumeSharedFallbackDependency.js.map +1 -1
- package/src/lib/sharing/ConsumeSharedModule.js +49 -7
- package/src/lib/sharing/ConsumeSharedModule.js.map +1 -1
- package/src/lib/sharing/ConsumeSharedPlugin.js +69 -14
- package/src/lib/sharing/ConsumeSharedPlugin.js.map +1 -1
- package/src/lib/sharing/ConsumeSharedRuntimeModule.js +47 -5
- package/src/lib/sharing/ConsumeSharedRuntimeModule.js.map +1 -1
- package/src/lib/sharing/ProvideForSharedDependency.js +7 -3
- package/src/lib/sharing/ProvideForSharedDependency.js.map +1 -1
- package/src/lib/sharing/ProvideSharedDependency.js +7 -3
- package/src/lib/sharing/ProvideSharedDependency.js.map +1 -1
- package/src/lib/sharing/ProvideSharedModule.js +49 -7
- package/src/lib/sharing/ProvideSharedModule.js.map +1 -1
- package/src/lib/sharing/ProvideSharedModuleFactory.js +7 -3
- package/src/lib/sharing/ProvideSharedModuleFactory.js.map +1 -1
- package/src/lib/sharing/ProvideSharedPlugin.js +25 -8
- package/src/lib/sharing/ProvideSharedPlugin.js.map +1 -1
- package/src/lib/sharing/SharePlugin.js +7 -3
- package/src/lib/sharing/SharePlugin.js.map +1 -1
- package/src/lib/sharing/ShareRuntimeModule.js +47 -5
- package/src/lib/sharing/ShareRuntimeModule.js.map +1 -1
- package/src/lib/sharing/resolveMatchedConfigs.js +7 -3
- package/src/lib/sharing/resolveMatchedConfigs.js.map +1 -1
- package/src/lib/sharing/utils.js +6 -6
- package/src/lib/sharing/utils.js.map +1 -1
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +5 -0
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js +34 -0
- package/src/runtime/AddRuntimeRequirementToPromiseExternalPlugin.js.map +1 -0
|
@@ -12,12 +12,16 @@ Object.defineProperty(exports, "default", {
|
|
|
12
12
|
return _default;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const _ContainerExposedDependency = /*#__PURE__*/ _interop_require_default._(require("./ContainerExposedDependency"));
|
|
15
|
+
const _createschemavalidation = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/create-schema-validation"));
|
|
16
|
+
const _ContainerEntryDependency = /*#__PURE__*/ _interop_require_default(require("./ContainerEntryDependency"));
|
|
17
|
+
const _ContainerEntryModuleFactory = /*#__PURE__*/ _interop_require_default(require("./ContainerEntryModuleFactory"));
|
|
18
|
+
const _ContainerExposedDependency = /*#__PURE__*/ _interop_require_default(require("./ContainerExposedDependency"));
|
|
20
19
|
const _options = require("./options");
|
|
20
|
+
function _interop_require_default(obj) {
|
|
21
|
+
return obj && obj.__esModule ? obj : {
|
|
22
|
+
default: obj
|
|
23
|
+
};
|
|
24
|
+
}
|
|
21
25
|
const validate = (0, _createschemavalidation.default)(//eslint-disable-next-line
|
|
22
26
|
require('webpack/schemas/plugins/container/ContainerPlugin.check.js'), ()=>require('webpack/schemas/plugins/container/ContainerPlugin.json'), {
|
|
23
27
|
name: 'Container Plugin',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerPlugin.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//@ts-ignore\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport ContainerEntryDependency from './ContainerEntryDependency';\nimport ContainerEntryModuleFactory from './ContainerEntryModuleFactory';\nimport ContainerExposedDependency from './ContainerExposedDependency';\nimport { parseOptions } from './options';\nimport type Compiler from 'webpack/lib/Compiler';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ContainerPluginOptions } from '../../declarations/plugins/container/ContainerPlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ContainerPlugin.check.js'),\n () => require('webpack/schemas/plugins/container/ContainerPlugin.json'),\n {\n name: 'Container Plugin',\n baseDataPath: 'options',\n },\n);\n\nconst PLUGIN_NAME = 'ContainerPlugin';\n\nclass ContainerPlugin {\n _options: ContainerPluginOptions;\n /**\n * @param {ContainerPluginOptions} options options\n */\n constructor(options: ContainerPluginOptions) {\n validate(options);\n this._options = {\n name: options.name,\n shareScope: options.shareScope || 'default',\n library: options.library || {\n type: 'var',\n name: options.name,\n },\n runtime: options.runtime,\n filename: options.filename || undefined,\n //@ts-ignore\n exposes: parseOptions(\n options.exposes,\n (item) => ({\n import: Array.isArray(item) ? item : [item],\n name: undefined,\n }),\n (item) => ({\n import: Array.isArray(item.import) ? item.import : [item.import],\n name: item.name || undefined,\n }),\n ),\n };\n }\n\n apply(compiler: Compiler): void {\n const { name, exposes, shareScope, filename, library, runtime } =\n this._options;\n\n if (\n library &&\n compiler.options.output &&\n compiler.options.output.enabledLibraryTypes &&\n !compiler.options.output.enabledLibraryTypes.includes(library.type)\n ) {\n compiler.options.output.enabledLibraryTypes.push(library.type);\n }\n\n compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {\n //@ts-ignore\n const dep = new ContainerEntryDependency(name, exposes, shareScope);\n dep.loc = { name };\n compilation.addEntry(\n compilation.options.context || '',\n //@ts-ignore\n dep,\n {\n name,\n filename,\n runtime,\n library,\n },\n (error: WebpackError | null | undefined) => {\n if (error) {\n return callback(error);\n }\n callback();\n },\n );\n });\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: Compilation, { normalModuleFactory }) => {\n compilation.dependencyFactories.set(\n //@ts-ignore\n ContainerEntryDependency,\n new ContainerEntryModuleFactory(),\n );\n\n compilation.dependencyFactories.set(\n ContainerExposedDependency,\n normalModuleFactory,\n );\n },\n );\n }\n}\n\nexport default ContainerPlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","PLUGIN_NAME","ContainerPlugin","apply","compiler","exposes","shareScope","filename","library","runtime","_options","options","output","enabledLibraryTypes","includes","type","push","hooks","make","tapAsync","compilation","callback","dep","ContainerEntryDependency","loc","addEntry","context","error","thisCompilation","tap","normalModuleFactory","dependencyFactories","set","ContainerEntryModuleFactory","ContainerExposedDependency","constructor","undefined","parseOptions","item","import","Array","isArray"],"mappings":"AAAA;;;AAGA,GACA,YAAY;;;;;+BA2GZ;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerPlugin.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//@ts-ignore\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport ContainerEntryDependency from './ContainerEntryDependency';\nimport ContainerEntryModuleFactory from './ContainerEntryModuleFactory';\nimport ContainerExposedDependency from './ContainerExposedDependency';\nimport { parseOptions } from './options';\nimport type Compiler from 'webpack/lib/Compiler';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ContainerPluginOptions } from '../../declarations/plugins/container/ContainerPlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ContainerPlugin.check.js'),\n () => require('webpack/schemas/plugins/container/ContainerPlugin.json'),\n {\n name: 'Container Plugin',\n baseDataPath: 'options',\n },\n);\n\nconst PLUGIN_NAME = 'ContainerPlugin';\n\nclass ContainerPlugin {\n _options: ContainerPluginOptions;\n /**\n * @param {ContainerPluginOptions} options options\n */\n constructor(options: ContainerPluginOptions) {\n validate(options);\n this._options = {\n name: options.name,\n shareScope: options.shareScope || 'default',\n library: options.library || {\n type: 'var',\n name: options.name,\n },\n runtime: options.runtime,\n filename: options.filename || undefined,\n //@ts-ignore\n exposes: parseOptions(\n options.exposes,\n (item) => ({\n import: Array.isArray(item) ? item : [item],\n name: undefined,\n }),\n (item) => ({\n import: Array.isArray(item.import) ? item.import : [item.import],\n name: item.name || undefined,\n }),\n ),\n };\n }\n\n apply(compiler: Compiler): void {\n const { name, exposes, shareScope, filename, library, runtime } =\n this._options;\n\n if (\n library &&\n compiler.options.output &&\n compiler.options.output.enabledLibraryTypes &&\n !compiler.options.output.enabledLibraryTypes.includes(library.type)\n ) {\n compiler.options.output.enabledLibraryTypes.push(library.type);\n }\n\n compiler.hooks.make.tapAsync(PLUGIN_NAME, (compilation, callback) => {\n //@ts-ignore\n const dep = new ContainerEntryDependency(name, exposes, shareScope);\n dep.loc = { name };\n compilation.addEntry(\n compilation.options.context || '',\n //@ts-ignore\n dep,\n {\n name,\n filename,\n runtime,\n library,\n },\n (error: WebpackError | null | undefined) => {\n if (error) {\n return callback(error);\n }\n callback();\n },\n );\n });\n\n compiler.hooks.thisCompilation.tap(\n PLUGIN_NAME,\n (compilation: Compilation, { normalModuleFactory }) => {\n compilation.dependencyFactories.set(\n //@ts-ignore\n ContainerEntryDependency,\n new ContainerEntryModuleFactory(),\n );\n\n compilation.dependencyFactories.set(\n ContainerExposedDependency,\n normalModuleFactory,\n );\n },\n );\n }\n}\n\nexport default ContainerPlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","PLUGIN_NAME","ContainerPlugin","apply","compiler","exposes","shareScope","filename","library","runtime","_options","options","output","enabledLibraryTypes","includes","type","push","hooks","make","tapAsync","compilation","callback","dep","ContainerEntryDependency","loc","addEntry","context","error","thisCompilation","tap","normalModuleFactory","dependencyFactories","set","ContainerEntryModuleFactory","ContainerExposedDependency","constructor","undefined","parseOptions","item","import","Array","isArray"],"mappings":"AAAA;;;AAGA,GACA,YAAY;;;;;+BA2GZ;;;eAAA;;;+EA1GmC;iFACE;oFACG;mFACD;yBACV;;;;;;AAK7B,MAAMA,WAAWC,IAA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B,OAA+B,CAAE;QAC3Cf,SAASe;QACT,IAAI,CAACD,QAAQ,GAAG;YACdX,MAAMY,QAAQZ,IAAI;YAClBO,YAAYK,QAAQL,UAAU,IAAI;YAClCE,SAASG,QAAQH,OAAO,IAAI;gBAC1BO,MAAM;gBACNhB,MAAMY,QAAQZ,IAAI;YACpB;YACAU,SAASE,QAAQF,OAAO;YACxBF,UAAUI,QAAQJ,QAAQ,IAAI6B;YAC9B,YAAY;YACZ/B,SAASgC,IAAAA,qBAAY,EACnB1B,QAAQN,OAAO,EACf,CAACiC,OAAU,CAAA;oBACTC,QAAQC,MAAMC,OAAO,CAACH,QAAQA,OAAO;wBAACA;qBAAK;oBAC3CvC,MAAMqC;gBACR,CAAA,GACA,CAACE,OAAU,CAAA;oBACTC,QAAQC,MAAMC,OAAO,CAACH,KAAKC,MAAM,IAAID,KAAKC,MAAM,GAAG;wBAACD,KAAKC,MAAM;qBAAC;oBAChExC,MAAMuC,KAAKvC,IAAI,IAAIqC;gBACrB,CAAA;QAEJ;IACF;AAsDF;MAEA,WAAelC"}
|
|
@@ -11,18 +11,60 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const _RemoteRuntimeModule = /*#__PURE__*/ _interop_require_default._(require("./RemoteRuntimeModule"));
|
|
23
|
-
const _RemoteToExternalDependency = /*#__PURE__*/ _interop_require_default._(require("./RemoteToExternalDependency"));
|
|
14
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard(require("webpack/lib/RuntimeGlobals"));
|
|
15
|
+
const _createschemavalidation = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/create-schema-validation"));
|
|
16
|
+
const _FallbackDependency = /*#__PURE__*/ _interop_require_default(require("./FallbackDependency"));
|
|
17
|
+
const _FallbackItemDependency = /*#__PURE__*/ _interop_require_default(require("./FallbackItemDependency"));
|
|
18
|
+
const _FallbackModuleFactory = /*#__PURE__*/ _interop_require_default(require("./FallbackModuleFactory"));
|
|
19
|
+
const _RemoteModule = /*#__PURE__*/ _interop_require_default(require("./RemoteModule"));
|
|
20
|
+
const _RemoteRuntimeModule = /*#__PURE__*/ _interop_require_default(require("./RemoteRuntimeModule"));
|
|
21
|
+
const _RemoteToExternalDependency = /*#__PURE__*/ _interop_require_default(require("./RemoteToExternalDependency"));
|
|
24
22
|
const _options = require("./options");
|
|
25
|
-
const _ExternalsPlugin = /*#__PURE__*/ _interop_require_default
|
|
23
|
+
const _ExternalsPlugin = /*#__PURE__*/ _interop_require_default(require("webpack/lib/ExternalsPlugin"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
25
|
+
return obj && obj.__esModule ? obj : {
|
|
26
|
+
default: obj
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
30
|
+
if (typeof WeakMap !== "function") return null;
|
|
31
|
+
var cacheBabelInterop = new WeakMap();
|
|
32
|
+
var cacheNodeInterop = new WeakMap();
|
|
33
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
34
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
35
|
+
})(nodeInterop);
|
|
36
|
+
}
|
|
37
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
38
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
39
|
+
return obj;
|
|
40
|
+
}
|
|
41
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
42
|
+
return {
|
|
43
|
+
default: obj
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
47
|
+
if (cache && cache.has(obj)) {
|
|
48
|
+
return cache.get(obj);
|
|
49
|
+
}
|
|
50
|
+
var newObj = {};
|
|
51
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
52
|
+
for(var key in obj){
|
|
53
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
54
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
55
|
+
if (desc && (desc.get || desc.set)) {
|
|
56
|
+
Object.defineProperty(newObj, key, desc);
|
|
57
|
+
} else {
|
|
58
|
+
newObj[key] = obj[key];
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
newObj.default = obj;
|
|
63
|
+
if (cache) {
|
|
64
|
+
cache.set(obj, newObj);
|
|
65
|
+
}
|
|
66
|
+
return newObj;
|
|
67
|
+
}
|
|
26
68
|
const validate = (0, _createschemavalidation.default)(//eslint-disable-next-line
|
|
27
69
|
require('webpack/schemas/plugins/container/ContainerReferencePlugin.check.js'), ()=>require('webpack/schemas/plugins/container/ContainerReferencePlugin.json'), {
|
|
28
70
|
name: 'Container Reference Plugin',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerReferencePlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\nimport type Compiler from 'webpack/lib/Compiler';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport FallbackDependency from './FallbackDependency';\nimport FallbackItemDependency from './FallbackItemDependency';\nimport FallbackModuleFactory from './FallbackModuleFactory';\nimport RemoteModule from './RemoteModule';\nimport RemoteRuntimeModule from './RemoteRuntimeModule';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport { parseOptions } from './options';\nimport ExternalsPlugin from 'webpack/lib/ExternalsPlugin';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ResolveData } from 'webpack/lib/NormalModuleFactory';\nimport NormalModuleFactory from 'webpack/lib/NormalModuleFactory';\nimport {\n ExternalsType,\n ContainerReferencePluginOptions,\n RemotesConfig,\n} from '../../declarations/plugins/container/ContainerReferencePlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.check.js'),\n () =>\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.json'),\n {\n name: 'Container Reference Plugin',\n baseDataPath: 'options',\n },\n);\n\nconst slashCode = '/'.charCodeAt(0);\n\nclass ContainerReferencePlugin {\n private _remoteType: ExternalsType;\n private _remotes: [string, RemotesConfig][];\n\n constructor(options: ContainerReferencePluginOptions) {\n validate(options);\n\n this._remoteType = options.remoteType;\n this._remotes = parseOptions(\n options.remotes,\n (item) => ({\n external: Array.isArray(item) ? item : [item],\n shareScope: options.shareScope || 'default',\n }),\n (item) => ({\n external: Array.isArray(item.external)\n ? item.external\n : [item.external],\n shareScope: item.shareScope || options.shareScope || 'default',\n }),\n );\n }\n\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void {\n const { _remotes: remotes, _remoteType: remoteType } = this;\n\n /** @type {Record<string, string>} */\n const remoteExternals: Record<string, string> = {};\n\n for (const [key, config] of remotes) {\n let i = 0;\n for (const external of config.external) {\n if (typeof external === 'string' && external.startsWith('internal ')) {\n continue;\n }\n remoteExternals[\n `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`\n ] = external;\n i++;\n }\n }\n const Externals = compiler.webpack.ExternalsPlugin || ExternalsPlugin;\n //@ts-ignore\n new Externals(remoteType, remoteExternals).apply(compiler);\n\n compiler.hooks.compilation.tap(\n 'ContainerReferencePlugin',\n (\n compilation: Compilation,\n { normalModuleFactory }: { normalModuleFactory: NormalModuleFactory },\n ) => {\n compilation.dependencyFactories.set(\n RemoteToExternalDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackItemDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackDependency,\n new FallbackModuleFactory(),\n );\n\n normalModuleFactory.hooks.factorize.tap(\n 'ContainerReferencePlugin',\n //@ts-ignore\n (data: ResolveData): Module => {\n if (!data.request.includes('!')) {\n for (const [key, config] of remotes) {\n if (\n data.request.startsWith(`${key}`) &&\n (data.request.length === key.length ||\n data.request.charCodeAt(key.length) === slashCode)\n ) {\n return new RemoteModule(\n data.request,\n //@ts-ignore\n config.external.map((external: any, i: any) =>\n external.startsWith('internal ')\n ? external.slice(9)\n : `webpack/container/reference/${key}${\n i ? `/fallback-${i}` : ''\n }`,\n ),\n `.${data.request.slice(key.length)}`,\n //@ts-ignore\n config.shareScope,\n );\n }\n }\n }\n },\n );\n\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.ensureChunkHandlers)\n .tap('ContainerReferencePlugin', (chunk, set) => {\n set.add(RuntimeGlobals.module);\n set.add(RuntimeGlobals.moduleFactoriesAddOnly);\n set.add(RuntimeGlobals.hasOwnProperty);\n set.add(RuntimeGlobals.initializeSharing);\n set.add(RuntimeGlobals.shareScopeMap);\n compilation.addRuntimeModule(chunk, new RemoteRuntimeModule());\n });\n },\n );\n }\n}\n\nexport default ContainerReferencePlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","slashCode","charCodeAt","ContainerReferencePlugin","apply","compiler","_remotes","remotes","_remoteType","remoteType","remoteExternals","key","config","i","external","startsWith","Externals","webpack","ExternalsPlugin","hooks","compilation","tap","normalModuleFactory","dependencyFactories","set","RemoteToExternalDependency","FallbackItemDependency","FallbackDependency","FallbackModuleFactory","factorize","data","request","includes","length","RemoteModule","map","slice","shareScope","runtimeRequirementInTree","for","RuntimeGlobals","ensureChunkHandlers","chunk","add","module","moduleFactoriesAddOnly","hasOwnProperty","initializeSharing","shareScopeMap","addRuntimeModule","RemoteRuntimeModule","constructor","options","parseOptions","item","Array","isArray"],"mappings":"AAAA;;;AAGA;;;;+BAwJA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ContainerReferencePlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\nimport type Compiler from 'webpack/lib/Compiler';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport FallbackDependency from './FallbackDependency';\nimport FallbackItemDependency from './FallbackItemDependency';\nimport FallbackModuleFactory from './FallbackModuleFactory';\nimport RemoteModule from './RemoteModule';\nimport RemoteRuntimeModule from './RemoteRuntimeModule';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport { parseOptions } from './options';\nimport ExternalsPlugin from 'webpack/lib/ExternalsPlugin';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ResolveData } from 'webpack/lib/NormalModuleFactory';\nimport NormalModuleFactory from 'webpack/lib/NormalModuleFactory';\nimport {\n ExternalsType,\n ContainerReferencePluginOptions,\n RemotesConfig,\n} from '../../declarations/plugins/container/ContainerReferencePlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.check.js'),\n () =>\n require('webpack/schemas/plugins/container/ContainerReferencePlugin.json'),\n {\n name: 'Container Reference Plugin',\n baseDataPath: 'options',\n },\n);\n\nconst slashCode = '/'.charCodeAt(0);\n\nclass ContainerReferencePlugin {\n private _remoteType: ExternalsType;\n private _remotes: [string, RemotesConfig][];\n\n constructor(options: ContainerReferencePluginOptions) {\n validate(options);\n\n this._remoteType = options.remoteType;\n this._remotes = parseOptions(\n options.remotes,\n (item) => ({\n external: Array.isArray(item) ? item : [item],\n shareScope: options.shareScope || 'default',\n }),\n (item) => ({\n external: Array.isArray(item.external)\n ? item.external\n : [item.external],\n shareScope: item.shareScope || options.shareScope || 'default',\n }),\n );\n }\n\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void {\n const { _remotes: remotes, _remoteType: remoteType } = this;\n\n /** @type {Record<string, string>} */\n const remoteExternals: Record<string, string> = {};\n\n for (const [key, config] of remotes) {\n let i = 0;\n for (const external of config.external) {\n if (typeof external === 'string' && external.startsWith('internal ')) {\n continue;\n }\n remoteExternals[\n `webpack/container/reference/${key}${i ? `/fallback-${i}` : ''}`\n ] = external;\n i++;\n }\n }\n const Externals = compiler.webpack.ExternalsPlugin || ExternalsPlugin;\n //@ts-ignore\n new Externals(remoteType, remoteExternals).apply(compiler);\n\n compiler.hooks.compilation.tap(\n 'ContainerReferencePlugin',\n (\n compilation: Compilation,\n { normalModuleFactory }: { normalModuleFactory: NormalModuleFactory },\n ) => {\n compilation.dependencyFactories.set(\n RemoteToExternalDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackItemDependency,\n normalModuleFactory,\n );\n\n compilation.dependencyFactories.set(\n FallbackDependency,\n new FallbackModuleFactory(),\n );\n\n normalModuleFactory.hooks.factorize.tap(\n 'ContainerReferencePlugin',\n //@ts-ignore\n (data: ResolveData): Module => {\n if (!data.request.includes('!')) {\n for (const [key, config] of remotes) {\n if (\n data.request.startsWith(`${key}`) &&\n (data.request.length === key.length ||\n data.request.charCodeAt(key.length) === slashCode)\n ) {\n return new RemoteModule(\n data.request,\n //@ts-ignore\n config.external.map((external: any, i: any) =>\n external.startsWith('internal ')\n ? external.slice(9)\n : `webpack/container/reference/${key}${\n i ? `/fallback-${i}` : ''\n }`,\n ),\n `.${data.request.slice(key.length)}`,\n //@ts-ignore\n config.shareScope,\n );\n }\n }\n }\n },\n );\n\n compilation.hooks.runtimeRequirementInTree\n .for(RuntimeGlobals.ensureChunkHandlers)\n .tap('ContainerReferencePlugin', (chunk, set) => {\n set.add(RuntimeGlobals.module);\n set.add(RuntimeGlobals.moduleFactoriesAddOnly);\n set.add(RuntimeGlobals.hasOwnProperty);\n set.add(RuntimeGlobals.initializeSharing);\n set.add(RuntimeGlobals.shareScopeMap);\n compilation.addRuntimeModule(chunk, new RemoteRuntimeModule());\n });\n },\n );\n }\n}\n\nexport default ContainerReferencePlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","slashCode","charCodeAt","ContainerReferencePlugin","apply","compiler","_remotes","remotes","_remoteType","remoteType","remoteExternals","key","config","i","external","startsWith","Externals","webpack","ExternalsPlugin","hooks","compilation","tap","normalModuleFactory","dependencyFactories","set","RemoteToExternalDependency","FallbackItemDependency","FallbackDependency","FallbackModuleFactory","factorize","data","request","includes","length","RemoteModule","map","slice","shareScope","runtimeRequirementInTree","for","RuntimeGlobals","ensureChunkHandlers","chunk","add","module","moduleFactoriesAddOnly","hasOwnProperty","initializeSharing","shareScopeMap","addRuntimeModule","RemoteRuntimeModule","constructor","options","parseOptions","item","Array","isArray"],"mappings":"AAAA;;;AAGA;;;;+BAwJA;;;eAAA;;;wEArJgC;+EACG;2EACJ;+EACI;8EACD;qEACT;4EACO;mFACO;yBACV;wEACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAU5B,MAAMA,WAAWC,IAAAA,+BAAsB,EACrC,0BAA0B;AAC1BC,QAAQ,wEACR,IACEA,QAAQ,oEACV;IACEC,MAAM;IACNC,cAAc;AAChB;AAGF,MAAMC,YAAY,IAAIC,UAAU,CAAC;AAEjC,IAAA,AAAMC,2BAAN,MAAMA;IAuBJ;;;;GAIC,GACDC,MAAMC,QAAkB,EAAQ;QAC9B,MAAM,EAAEC,UAAUC,OAAO,EAAEC,aAAaC,UAAU,EAAE,GAAG,IAAI;QAE3D,mCAAmC,GACnC,MAAMC,kBAA0C,CAAC;QAEjD,KAAK,MAAM,CAACC,KAAKC,OAAO,IAAIL,QAAS;YACnC,IAAIM,IAAI;YACR,KAAK,MAAMC,YAAYF,OAAOE,QAAQ,CAAE;gBACtC,IAAI,OAAOA,aAAa,YAA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15
|
-
const
|
|
16
|
-
|
|
14
|
+
const _Dependency = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Dependency"));
|
|
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 FallbackDependency = class FallbackDependency 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/FallbackDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/Dependency';\nimport Dependency from 'webpack/lib/Dependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackDependency extends Dependency {\n requests: string[];\n\n /**\n * @param {string[]} requests requests\n */\n constructor(requests: string[]) {\n super();\n this.requests = requests;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `fallback ${this.requests.join(' ')}`;\n }\n\n override get type(): string {\n return 'fallback';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackDependency} deserialize fallback dependency\n */\n static deserialize(context: ObjectDeserializerContext): FallbackDependency {\n const { read } = context;\n const obj = new FallbackDependency(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(\n FallbackDependency,\n 'enhanced/lib/container/FallbackDependency',\n);\n\nexport default FallbackDependency;\n"],"names":["FallbackDependency","Dependency","getResourceIdentifier","requests","join","type","category","serialize","context","write","deserialize","read","obj","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA6DA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport type {\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/Dependency';\nimport Dependency from 'webpack/lib/Dependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackDependency extends Dependency {\n requests: string[];\n\n /**\n * @param {string[]} requests requests\n */\n constructor(requests: string[]) {\n super();\n this.requests = requests;\n }\n\n /**\n * @returns {string | null} an identifier to merge equal requests\n */\n override getResourceIdentifier(): string | null {\n return `fallback ${this.requests.join(' ')}`;\n }\n\n override get type(): string {\n return 'fallback';\n }\n\n override get category(): string {\n return 'esm';\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackDependency} deserialize fallback dependency\n */\n static deserialize(context: ObjectDeserializerContext): FallbackDependency {\n const { read } = context;\n const obj = new FallbackDependency(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(\n FallbackDependency,\n 'enhanced/lib/container/FallbackDependency',\n);\n\nexport default FallbackDependency;\n"],"names":["FallbackDependency","Dependency","getResourceIdentifier","requests","join","type","category","serialize","context","write","deserialize","read","obj","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA6DA;;;eAAA;;;mEAvDuB;yEACM;;;;;;AAE7B,IAAA,AAAMA,qBAAN,MAAMA,2BAA2BC,mBAAU;IAWzC;;GAEC,GACD,AAASC,wBAAuC;QAC9C,OAAO,CAAC,SAAS,EAAE,IAAI,CAACC,QAAQ,CAACC,IAAI,CAAC,KAAK,CAAC;IAC9C;IAEA,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAEA;;GAEC,GACD,AAASC,UAAUC,OAAgC,EAAQ;QACzD,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClBC,MAAM,IAAI,CAACN,QAAQ;QACnB,KAAK,CAACI,UAAUC;IAClB;IAEA;;;GAGC,GACD,OAAOE,YAAYF,OAAkC,EAAsB;QACzE,MAAM,EAAEG,IAAI,EAAE,GAAGH;QACjB,MAAMI,MAAM,IAAIZ,mBAAmBW;QACnCC,IAAIF,WAAW,CAACF;QAChB,OAAOI;IACT;IAzCA;;GAEC,GACDC,YAAYV,QAAkB,CAAE;QAC9B,KAAK;QACL,IAAI,CAACA,QAAQ,GAAGA;IAClB;AAoCF;AAEAW,IAAAA,yBAAgB,EACdd,oBACA;MAGF,WAAeA"}
|
|
@@ -11,9 +11,13 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
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 FallbackItemDependency = class FallbackItemDependency extends _ModuleDependency.default {
|
|
18
22
|
get type() {
|
|
19
23
|
return 'fallback item';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackItemDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackItemDependency extends ModuleDependency {\n /**\n * @param {string} request request\n */\n constructor(request: string) {\n super(request);\n }\n\n override get type(): string {\n return 'fallback item';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n FallbackItemDependency,\n 'enhanced/lib/container/FallbackItemDependency',\n);\n\nexport default FallbackItemDependency;\n"],"names":["FallbackItemDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA0BA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackItemDependency.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass FallbackItemDependency extends ModuleDependency {\n /**\n * @param {string} request request\n */\n constructor(request: string) {\n super(request);\n }\n\n override get type(): string {\n return 'fallback item';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n FallbackItemDependency,\n 'enhanced/lib/container/FallbackItemDependency',\n);\n\nexport default FallbackItemDependency;\n"],"names":["FallbackItemDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA0BA;;;eAAA;;;yEAzB6B;yEACA;;;;;;AAE7B,IAAA,AAAMA,yBAAN,MAAMA,+BAA+BC,yBAAgB;IAQnD,IAAaC,OAAe;QAC1B,OAAO;IACT;IAEA,IAAaC,WAAmB;QAC9B,OAAO;IACT;IAbA;;GAEC,GACDC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA;IACR;AASF;AAEAC,IAAAA,yBAAgB,EACdN,wBACA;MAGF,WAAeA"}
|
|
@@ -11,14 +11,18 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
14
|
const _webpacksources = require("webpack-sources");
|
|
16
|
-
const _Module = /*#__PURE__*/ _interop_require_default
|
|
15
|
+
const _Module = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Module"));
|
|
17
16
|
const _ModuleTypeConstants = require("webpack/lib/ModuleTypeConstants");
|
|
18
|
-
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_default
|
|
19
|
-
const _Template = /*#__PURE__*/ _interop_require_default
|
|
20
|
-
const _makeSerializable = /*#__PURE__*/ _interop_require_default
|
|
21
|
-
const _FallbackItemDependency = /*#__PURE__*/ _interop_require_default
|
|
17
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_default(require("webpack/lib/RuntimeGlobals"));
|
|
18
|
+
const _Template = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Template"));
|
|
19
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
|
|
20
|
+
const _FallbackItemDependency = /*#__PURE__*/ _interop_require_default(require("./FallbackItemDependency"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
22
26
|
const TYPES = new Set([
|
|
23
27
|
'javascript'
|
|
24
28
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport { RawSource } from 'webpack-sources';\nimport type {\n RequestShortener,\n LibIdentOptions,\n CodeGenerationContext,\n CodeGenerationResult,\n NeedBuildContext,\n WebpackError,\n ResolverWithOptions,\n InputFileSystem,\n Compilation,\n WebpackOptions,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/Module';\nimport Module from 'webpack/lib/Module';\nimport type ChunkGraph from 'webpack/lib/ChunkGraph';\nimport Chunk from 'webpack/lib/Chunk';\nimport { WEBPACK_MODULE_TYPE_FALLBACK } from 'webpack/lib/ModuleTypeConstants';\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport Template from 'webpack/lib/Template';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport FallbackItemDependency from './FallbackItemDependency';\n\nconst TYPES = new Set(['javascript']);\nconst RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);\n\nclass FallbackModule extends Module {\n private requests: string[];\n private _identifier: string;\n\n /**\n * @param {string[]} requests list of requests to choose one\n */\n constructor(requests: string[]) {\n super(WEBPACK_MODULE_TYPE_FALLBACK);\n this.requests = requests;\n this._identifier = `fallback ${this.requests.join(' ')}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\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 this._identifier;\n }\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/fallback/${\n this.requests[0]\n }/and ${this.requests.length - 1} more`;\n }\n\n /**\n * @param {Chunk} chunk the chunk which condition should be checked\n * @param {Compilation} compilation the compilation\n * @returns {boolean} true, if the chunk is ok for the module\n */\n override chunkCondition(\n chunk: Chunk,\n { chunkGraph }: { chunkGraph: ChunkGraph },\n ): boolean {\n return chunkGraph.getNumberOfEntryModules(chunk) > 0;\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: (error: WebpackError | null, result?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\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: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n for (const request of this.requests)\n this.addDependency(new FallbackItemDependency(request));\n\n callback();\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 this.requests.length * 5 + 42;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n runtimeTemplate,\n moduleGraph,\n chunkGraph,\n }: CodeGenerationContext): CodeGenerationResult {\n const ids = this.dependencies.map((dep) =>\n //@ts-ignore\n chunkGraph.getModuleId(moduleGraph.getModule(dep)),\n );\n const code = Template.asString([\n `var ids = ${JSON.stringify(ids)};`,\n 'var error, result, i = 0;',\n `var loop = ${runtimeTemplate.basicFunction('next', [\n 'while(i < ids.length) {',\n Template.indent([\n `try { next = ${RuntimeGlobals.require}(ids[i++]); } catch(e) { return handleError(e); }`,\n 'if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);',\n ]),\n '}',\n 'if(error) throw error;',\n ])}`,\n `var handleResult = ${runtimeTemplate.basicFunction('result', [\n 'if(result) return result;',\n 'return loop();',\n ])};`,\n `var handleError = ${runtimeTemplate.basicFunction('e', [\n 'error = e;',\n 'return loop();',\n ])};`,\n 'module.exports = loop();',\n ]);\n const sources = new Map();\n sources.set('javascript', new RawSource(code));\n return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackModule} deserialized fallback module\n */\n static deserialize(context: ObjectDeserializerContext): FallbackModule {\n const { read } = context;\n const obj = new FallbackModule(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(FallbackModule, 'enhanced/lib/container/FallbackModule');\n\nexport default FallbackModule;\n"],"names":["TYPES","Set","RUNTIME_REQUIREMENTS","RuntimeGlobals","module","FallbackModule","Module","identifier","_identifier","readableIdentifier","requestShortener","libIdent","options","layer","requests","length","chunkCondition","chunk","chunkGraph","getNumberOfEntryModules","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","strict","clearDependenciesAndBlocks","request","addDependency","FallbackItemDependency","size","type","getSourceTypes","codeGeneration","runtimeTemplate","moduleGraph","ids","dependencies","map","dep","getModuleId","getModule","code","Template","asString","JSON","stringify","basicFunction","indent","require","sources","Map","set","RawSource","runtimeRequirements","serialize","write","deserialize","read","obj","constructor","WEBPACK_MODULE_TYPE_FALLBACK","join","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BAoMA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport { RawSource } from 'webpack-sources';\nimport type {\n RequestShortener,\n LibIdentOptions,\n CodeGenerationContext,\n CodeGenerationResult,\n NeedBuildContext,\n WebpackError,\n ResolverWithOptions,\n InputFileSystem,\n Compilation,\n WebpackOptions,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n} from 'webpack/lib/Module';\nimport Module from 'webpack/lib/Module';\nimport type ChunkGraph from 'webpack/lib/ChunkGraph';\nimport Chunk from 'webpack/lib/Chunk';\nimport { WEBPACK_MODULE_TYPE_FALLBACK } from 'webpack/lib/ModuleTypeConstants';\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport Template from 'webpack/lib/Template';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport FallbackItemDependency from './FallbackItemDependency';\n\nconst TYPES = new Set(['javascript']);\nconst RUNTIME_REQUIREMENTS = new Set([RuntimeGlobals.module]);\n\nclass FallbackModule extends Module {\n private requests: string[];\n private _identifier: string;\n\n /**\n * @param {string[]} requests list of requests to choose one\n */\n constructor(requests: string[]) {\n super(WEBPACK_MODULE_TYPE_FALLBACK);\n this.requests = requests;\n this._identifier = `fallback ${this.requests.join(' ')}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\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 this._identifier;\n }\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/fallback/${\n this.requests[0]\n }/and ${this.requests.length - 1} more`;\n }\n\n /**\n * @param {Chunk} chunk the chunk which condition should be checked\n * @param {Compilation} compilation the compilation\n * @returns {boolean} true, if the chunk is ok for the module\n */\n override chunkCondition(\n chunk: Chunk,\n { chunkGraph }: { chunkGraph: ChunkGraph },\n ): boolean {\n return chunkGraph.getNumberOfEntryModules(chunk) > 0;\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: (error: WebpackError | null, result?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\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: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n for (const request of this.requests)\n this.addDependency(new FallbackItemDependency(request));\n\n callback();\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 this.requests.length * 5 + 42;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n runtimeTemplate,\n moduleGraph,\n chunkGraph,\n }: CodeGenerationContext): CodeGenerationResult {\n const ids = this.dependencies.map((dep) =>\n //@ts-ignore\n chunkGraph.getModuleId(moduleGraph.getModule(dep)),\n );\n const code = Template.asString([\n `var ids = ${JSON.stringify(ids)};`,\n 'var error, result, i = 0;',\n `var loop = ${runtimeTemplate.basicFunction('next', [\n 'while(i < ids.length) {',\n Template.indent([\n `try { next = ${RuntimeGlobals.require}(ids[i++]); } catch(e) { return handleError(e); }`,\n 'if(next) return next.then ? next.then(handleResult, handleError) : handleResult(next);',\n ]),\n '}',\n 'if(error) throw error;',\n ])}`,\n `var handleResult = ${runtimeTemplate.basicFunction('result', [\n 'if(result) return result;',\n 'return loop();',\n ])};`,\n `var handleError = ${runtimeTemplate.basicFunction('e', [\n 'error = e;',\n 'return loop();',\n ])};`,\n 'module.exports = loop();',\n ]);\n const sources = new Map();\n sources.set('javascript', new RawSource(code));\n return { sources, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.requests);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {FallbackModule} deserialized fallback module\n */\n static deserialize(context: ObjectDeserializerContext): FallbackModule {\n const { read } = context;\n const obj = new FallbackModule(read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(FallbackModule, 'enhanced/lib/container/FallbackModule');\n\nexport default FallbackModule;\n"],"names":["TYPES","Set","RUNTIME_REQUIREMENTS","RuntimeGlobals","module","FallbackModule","Module","identifier","_identifier","readableIdentifier","requestShortener","libIdent","options","layer","requests","length","chunkCondition","chunk","chunkGraph","getNumberOfEntryModules","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","strict","clearDependenciesAndBlocks","request","addDependency","FallbackItemDependency","size","type","getSourceTypes","codeGeneration","runtimeTemplate","moduleGraph","ids","dependencies","map","dep","getModuleId","getModule","code","Template","asString","JSON","stringify","basicFunction","indent","require","sources","Map","set","RawSource","runtimeRequirements","serialize","write","deserialize","read","obj","constructor","WEBPACK_MODULE_TYPE_FALLBACK","join","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BAoMA;;;eAAA;;;gCAlM0B;+DAeP;qCAG0B;uEAClB;iEACN;yEACQ;+EACM;;;;;;AAEnC,MAAMA,QAAQ,IAAIC,IAAI;IAAC;CAAa;AACpC,MAAMC,uBAAuB,IAAID,IAAI;IAACE,uBAAc,CAACC,MAAM;CAAC;AAE5D,IAAA,AAAMC,iBAAN,MAAMA,uBAAuBC,eAAM;IAajC;;GAEC,GACD,AAASC,aAAqB;QAC5B,OAAO,IAAI,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Q,CAACoD,IAAI,CAAC,KAAK,CAAC;IAC1D;AAwJF;AAEAC,IAAAA,yBAAgB,EAAC9D,gBAAgB;MAEjC,WAAeA"}
|
|
@@ -11,9 +11,13 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return FallbackModuleFactory;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const _ModuleFactory = /*#__PURE__*/ _interop_require_default(require("webpack/lib/ModuleFactory"));
|
|
15
|
+
const _FallbackModule = /*#__PURE__*/ _interop_require_default(require("./FallbackModule"));
|
|
16
|
+
function _interop_require_default(obj) {
|
|
17
|
+
return obj && obj.__esModule ? obj : {
|
|
18
|
+
default: obj
|
|
19
|
+
};
|
|
20
|
+
}
|
|
17
21
|
let FallbackModuleFactory = class FallbackModuleFactory extends _ModuleFactory.default {
|
|
18
22
|
/**
|
|
19
23
|
* @param {ModuleFactoryCreateData} data data object
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackModuleFactory.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 {\n ModuleFactoryCreateData,\n ModuleFactoryResult,\n} from 'webpack/lib/ModuleFactory';\nimport ModuleFactory from 'webpack/lib/ModuleFactory';\nimport FallbackModule from './FallbackModule';\nimport FallbackDependency from './FallbackDependency';\n\nexport default class FallbackModuleFactory 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 dependency = data.dependencies[0] as FallbackDependency;\n callback(null, {\n module: new FallbackModule(dependency.requests),\n });\n }\n}\n"],"names":["FallbackModuleFactory","ModuleFactory","create","data","callback","dependency","dependencies","module","FallbackModule","requests"],"mappings":"AAAA;;;AAGA,GAEA;;;;;;;eASqBA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/FallbackModuleFactory.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 {\n ModuleFactoryCreateData,\n ModuleFactoryResult,\n} from 'webpack/lib/ModuleFactory';\nimport ModuleFactory from 'webpack/lib/ModuleFactory';\nimport FallbackModule from './FallbackModule';\nimport FallbackDependency from './FallbackDependency';\n\nexport default class FallbackModuleFactory 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 dependency = data.dependencies[0] as FallbackDependency;\n callback(null, {\n module: new FallbackModule(dependency.requests),\n });\n }\n}\n"],"names":["FallbackModuleFactory","ModuleFactory","create","data","callback","dependency","dependencies","module","FallbackModule","requests"],"mappings":"AAAA;;;AAGA,GAEA;;;;;;;eASqBA;;;sEAJK;uEACC;;;;;;AAGZ,IAAA,AAAMA,wBAAN,MAAMA,8BAA8BC,sBAAa;IAC9D;;;;GAIC,GACD,AAASC,OACPC,IAA6B,EAC7BC,QAAqE,EAC/D;QACN,MAAMC,aAAaF,KAAKG,YAAY,CAAC,EAAE;QACvCF,SAAS,MAAM;YACbG,QAAQ,IAAIC,uBAAc,CAACH,WAAWI,QAAQ;QAChD;IACF;AACF"}
|
|
@@ -11,12 +11,16 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
14
|
+
const _ExternalsTypecheck = /*#__PURE__*/ _interop_require_default(require("webpack/schemas/plugins/container/ExternalsType.check.js"));
|
|
15
|
+
const _SharePlugin = /*#__PURE__*/ _interop_require_default(require("../sharing/SharePlugin"));
|
|
16
|
+
const _createschemavalidation = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/create-schema-validation"));
|
|
17
|
+
const _ContainerPlugin = /*#__PURE__*/ _interop_require_default(require("./ContainerPlugin"));
|
|
18
|
+
const _ContainerReferencePlugin = /*#__PURE__*/ _interop_require_default(require("./ContainerReferencePlugin"));
|
|
19
|
+
function _interop_require_default(obj) {
|
|
20
|
+
return obj && obj.__esModule ? obj : {
|
|
21
|
+
default: obj
|
|
22
|
+
};
|
|
23
|
+
}
|
|
20
24
|
const validate = (0, _createschemavalidation.default)(//eslint-disable-next-line
|
|
21
25
|
require('webpack/schemas/plugins/container/ModuleFederationPlugin.check.js'), ()=>require('webpack/schemas/plugins/container/ModuleFederationPlugin.json'), {
|
|
22
26
|
name: 'Module Federation Plugin',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ModuleFederationPlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport type Compiler from 'webpack/lib/Compiler';\nimport isValidExternalsType from 'webpack/schemas/plugins/container/ExternalsType.check.js';\nimport type { ModuleFederationPluginOptions } from './ModuleFederationPluginTypes';\nimport SharePlugin from '../sharing/SharePlugin';\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport ContainerPlugin from './ContainerPlugin';\nimport ContainerReferencePlugin from './ContainerReferencePlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ModuleFederationPlugin.check.js'),\n () =>\n require('webpack/schemas/plugins/container/ModuleFederationPlugin.json'),\n {\n name: 'Module Federation Plugin',\n baseDataPath: 'options',\n },\n);\n\nclass ModuleFederationPlugin {\n private _options: ModuleFederationPluginOptions;\n /**\n * @param {ModuleFederationPluginOptions} options options\n */\n constructor(options: ModuleFederationPluginOptions) {\n validate(options);\n\n this._options = options;\n }\n\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void {\n const { _options: options } = this;\n const library = options.library || { type: 'var', name: options.name };\n const remoteType =\n options.remoteType ||\n (options.library && isValidExternalsType(options.library.type)\n ? options.library.type\n : 'script');\n if (\n library &&\n !compiler.options.output.enabledLibraryTypes?.includes(library.type)\n ) {\n compiler.options.output.enabledLibraryTypes?.push(library.type);\n }\n compiler.hooks.afterPlugins.tap('ModuleFederationPlugin', () => {\n if (\n options.exposes &&\n (Array.isArray(options.exposes)\n ? options.exposes.length > 0\n : Object.keys(options.exposes).length > 0)\n ) {\n new ContainerPlugin({\n //@ts-ignore\n name: options.name,\n library,\n filename: options.filename,\n runtime: options.runtime,\n shareScope: options.shareScope,\n exposes: options.exposes,\n }).apply(compiler);\n }\n if (\n options.remotes &&\n (Array.isArray(options.remotes)\n ? options.remotes.length > 0\n : Object.keys(options.remotes).length > 0)\n ) {\n new ContainerReferencePlugin({\n //@ts-ignore\n remoteType,\n shareScope: options.shareScope,\n remotes: options.remotes,\n }).apply(compiler);\n }\n if (options.shared) {\n new SharePlugin({\n shared: options.shared,\n shareScope: options.shareScope,\n }).apply(compiler);\n }\n });\n }\n}\n\nexport default ModuleFederationPlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","ModuleFederationPlugin","apply","compiler","_options","options","library","type","remoteType","isValidExternalsType","output","enabledLibraryTypes","includes","push","hooks","afterPlugins","tap","exposes","Array","isArray","length","Object","keys","ContainerPlugin","filename","runtime","shareScope","remotes","ContainerReferencePlugin","shared","SharePlugin","constructor"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA2FA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/ModuleFederationPlugin.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra and Zackary Jackson @ScriptedAlchemy\n*/\n\n'use strict';\n\nimport type Compiler from 'webpack/lib/Compiler';\nimport isValidExternalsType from 'webpack/schemas/plugins/container/ExternalsType.check.js';\nimport type { ModuleFederationPluginOptions } from './ModuleFederationPluginTypes';\nimport SharePlugin from '../sharing/SharePlugin';\nimport createSchemaValidation from 'webpack/lib/util/create-schema-validation';\nimport ContainerPlugin from './ContainerPlugin';\nimport ContainerReferencePlugin from './ContainerReferencePlugin';\n\nconst validate = createSchemaValidation(\n //eslint-disable-next-line\n require('webpack/schemas/plugins/container/ModuleFederationPlugin.check.js'),\n () =>\n require('webpack/schemas/plugins/container/ModuleFederationPlugin.json'),\n {\n name: 'Module Federation Plugin',\n baseDataPath: 'options',\n },\n);\n\nclass ModuleFederationPlugin {\n private _options: ModuleFederationPluginOptions;\n /**\n * @param {ModuleFederationPluginOptions} options options\n */\n constructor(options: ModuleFederationPluginOptions) {\n validate(options);\n\n this._options = options;\n }\n\n /**\n * Apply the plugin\n * @param {Compiler} compiler the compiler instance\n * @returns {void}\n */\n apply(compiler: Compiler): void {\n const { _options: options } = this;\n const library = options.library || { type: 'var', name: options.name };\n const remoteType =\n options.remoteType ||\n (options.library && isValidExternalsType(options.library.type)\n ? options.library.type\n : 'script');\n if (\n library &&\n !compiler.options.output.enabledLibraryTypes?.includes(library.type)\n ) {\n compiler.options.output.enabledLibraryTypes?.push(library.type);\n }\n compiler.hooks.afterPlugins.tap('ModuleFederationPlugin', () => {\n if (\n options.exposes &&\n (Array.isArray(options.exposes)\n ? options.exposes.length > 0\n : Object.keys(options.exposes).length > 0)\n ) {\n new ContainerPlugin({\n //@ts-ignore\n name: options.name,\n library,\n filename: options.filename,\n runtime: options.runtime,\n shareScope: options.shareScope,\n exposes: options.exposes,\n }).apply(compiler);\n }\n if (\n options.remotes &&\n (Array.isArray(options.remotes)\n ? options.remotes.length > 0\n : Object.keys(options.remotes).length > 0)\n ) {\n new ContainerReferencePlugin({\n //@ts-ignore\n remoteType,\n shareScope: options.shareScope,\n remotes: options.remotes,\n }).apply(compiler);\n }\n if (options.shared) {\n new SharePlugin({\n shared: options.shared,\n shareScope: options.shareScope,\n }).apply(compiler);\n }\n });\n }\n}\n\nexport default ModuleFederationPlugin;\n"],"names":["validate","createSchemaValidation","require","name","baseDataPath","ModuleFederationPlugin","apply","compiler","_options","options","library","type","remoteType","isValidExternalsType","output","enabledLibraryTypes","includes","push","hooks","afterPlugins","tap","exposes","Array","isArray","length","Object","keys","ContainerPlugin","filename","runtime","shareScope","remotes","ContainerReferencePlugin","shared","SharePlugin","constructor"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA2FA;;;eAAA;;;2EAxFiC;oEAET;+EACW;wEACP;iFACS;;;;;;AAErC,MAAMA,WAAWC,IAAAA,+BAAsB,EACrC,0BAA0B;AAC1BC,QAAQ,sEACR,IACEA,QAAQ,kEACV;IACEC,MAAM;IACNC,cAAc;AAChB;AAGF,IAAA,AAAMC,yBAAN,MAAMA;IAWJ;;;;GAIC,GACDC,MAAMC,QAAkB,EAAQ;YAU3BA;QATH,MAAM,EAAEC,UAAUC,OAAO,EAAE,GAAG,IAAI;QAClC,MAAMC,UAAUD,QAAQC,OAAO,IAAI;YAAEC,MAAM;YAAOR,MAAMM,QAAQN,IAAI;QAAC;QACrE,MAAMS,aACJH,QAAQG,UAAU,IACjBH,CAAAA,QAAQC,OAAO,IAAIG,IAAAA,2BAAoB,EAACJ,QAAQC,OAAO,CAACC,IAAI,IACzDF,QAAQC,OAAO,CAACC,IAAI,GACpB,QAAO;QACb,IACED,WACA,GAACH,+CAAAA,SAASE,OAAO,CAACK,MAAM,CAACC,mBAAmB,qBAA3CR,6CAA6CS,QAAQ,CAACN,QAAQC,IAAI,IAC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 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
14
|
const _webpacksources = require("webpack-sources");
|
|
16
|
-
const _Module = /*#__PURE__*/ _interop_require_default
|
|
17
|
-
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_default
|
|
18
|
-
const _makeSerializable = /*#__PURE__*/ _interop_require_default
|
|
19
|
-
const _FallbackDependency = /*#__PURE__*/ _interop_require_default
|
|
20
|
-
const _RemoteToExternalDependency = /*#__PURE__*/ _interop_require_default
|
|
15
|
+
const _Module = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Module"));
|
|
16
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_default(require("webpack/lib/RuntimeGlobals"));
|
|
17
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
|
|
18
|
+
const _FallbackDependency = /*#__PURE__*/ _interop_require_default(require("./FallbackDependency"));
|
|
19
|
+
const _RemoteToExternalDependency = /*#__PURE__*/ _interop_require_default(require("./RemoteToExternalDependency"));
|
|
21
20
|
const _ModuleTypeConstants = require("webpack/lib/ModuleTypeConstants");
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
22
26
|
const TYPES = new Set([
|
|
23
27
|
'remote',
|
|
24
28
|
'share-init'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\nimport { RawSource } from 'webpack-sources';\nimport type {\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n WebpackError,\n} from 'webpack/lib/Module';\nimport Module from 'webpack/lib/Module';\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport FallbackDependency from './FallbackDependency';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';\nimport type { InputFileSystem } from 'webpack/lib/FileSystemInfo';\nimport type { RequestShortener } from 'webpack/lib/RuntimeModule';\nimport { WEBPACK_MODULE_TYPE_REMOTE } from 'webpack/lib/ModuleTypeConstants';\nimport type { WebpackOptionsNormalized } from 'webpack/lib/WebpackOptionsDefaulter';\nimport type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';\n\nconst TYPES: Set<string> = new Set(['remote', 'share-init']);\nconst RUNTIME_REQUIREMENTS: Set<string> = new Set([RuntimeGlobals.module]);\n\nclass RemoteModule extends Module {\n private _identifier: string;\n public request: string;\n public externalRequests: string[];\n public internalRequest: string;\n public shareScope: string;\n\n /**\n * @param {string} request request string\n * @param {string[]} externalRequests list of external requests to containers\n * @param {string} internalRequest name of exposed module in container\n * @param {string} shareScope the used share scope name\n */\n constructor(\n request: string,\n externalRequests: string[],\n internalRequest: string,\n shareScope: string,\n ) {\n super(WEBPACK_MODULE_TYPE_REMOTE);\n this.request = request;\n this.externalRequests = externalRequests;\n this.internalRequest = internalRequest;\n this.shareScope = shareScope;\n this._identifier = `remote (${shareScope}) ${this.externalRequests.join(\n ' ',\n )} ${this.internalRequest}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\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 `remote ${this.request}`;\n }\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/remote/${\n this.request\n }`;\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: (err: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\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: WebpackOptionsNormalized,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError | undefined) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n if (this.externalRequests.length === 1) {\n this.addDependency(\n new RemoteToExternalDependency(this.externalRequests[0]),\n );\n } else {\n this.addDependency(new FallbackDependency(this.externalRequests));\n }\n\n callback();\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 6;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)\n */\n override nameForCondition(): string | null {\n return this.request;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration(\n context: CodeGenerationContext,\n ): CodeGenerationResult {\n const { runtimeTemplate, moduleGraph, chunkGraph } = context;\n const module = moduleGraph.getModule(this.dependencies[0]);\n const id = module && chunkGraph.getModuleId(module);\n const sources = new Map();\n sources.set('remote', new RawSource(''));\n const data = new Map();\n data.set('share-init', [\n {\n shareScope: this.shareScope,\n initStage: 20,\n init: id === undefined ? '' : `initExternal(${JSON.stringify(id)});`,\n },\n ]);\n return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n override serialize(context: any) {\n const { write } = context;\n write(this.request);\n write(this.externalRequests);\n write(this.internalRequest);\n write(this.shareScope);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {RemoteModule} deserialized module\n */\n static deserialize(context: ObjectDeserializerContext): RemoteModule {\n const { read } = context;\n const obj = new RemoteModule(read(), read(), read(), read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(RemoteModule, 'enhanced/lib/container/RemoteModule');\n\nexport default RemoteModule;\n"],"names":["TYPES","Set","RUNTIME_REQUIREMENTS","RuntimeGlobals","module","RemoteModule","Module","identifier","_identifier","readableIdentifier","requestShortener","request","libIdent","options","layer","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","strict","clearDependenciesAndBlocks","externalRequests","length","addDependency","RemoteToExternalDependency","FallbackDependency","size","type","getSourceTypes","nameForCondition","codeGeneration","runtimeTemplate","moduleGraph","chunkGraph","getModule","dependencies","id","getModuleId","sources","Map","set","RawSource","data","shareScope","initStage","init","undefined","JSON","stringify","runtimeRequirements","serialize","write","internalRequest","deserialize","read","obj","constructor","WEBPACK_MODULE_TYPE_REMOTE","join","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA+LA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\n\nimport { RawSource } from 'webpack-sources';\nimport type {\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n WebpackError,\n} from 'webpack/lib/Module';\nimport Module from 'webpack/lib/Module';\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport FallbackDependency from './FallbackDependency';\nimport RemoteToExternalDependency from './RemoteToExternalDependency';\nimport type Compilation from 'webpack/lib/Compilation';\nimport type { ResolverWithOptions } from 'webpack/lib/ResolverFactory';\nimport type { InputFileSystem } from 'webpack/lib/FileSystemInfo';\nimport type { RequestShortener } from 'webpack/lib/RuntimeModule';\nimport { WEBPACK_MODULE_TYPE_REMOTE } from 'webpack/lib/ModuleTypeConstants';\nimport type { WebpackOptionsNormalized } from 'webpack/lib/WebpackOptionsDefaulter';\nimport type { ObjectDeserializerContext } from 'webpack/lib/serialization/ObjectMiddleware';\n\nconst TYPES: Set<string> = new Set(['remote', 'share-init']);\nconst RUNTIME_REQUIREMENTS: Set<string> = new Set([RuntimeGlobals.module]);\n\nclass RemoteModule extends Module {\n private _identifier: string;\n public request: string;\n public externalRequests: string[];\n public internalRequest: string;\n public shareScope: string;\n\n /**\n * @param {string} request request string\n * @param {string[]} externalRequests list of external requests to containers\n * @param {string} internalRequest name of exposed module in container\n * @param {string} shareScope the used share scope name\n */\n constructor(\n request: string,\n externalRequests: string[],\n internalRequest: string,\n shareScope: string,\n ) {\n super(WEBPACK_MODULE_TYPE_REMOTE);\n this.request = request;\n this.externalRequests = externalRequests;\n this.internalRequest = internalRequest;\n this.shareScope = shareScope;\n this._identifier = `remote (${shareScope}) ${this.externalRequests.join(\n ' ',\n )} ${this.internalRequest}`;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n return this._identifier;\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 `remote ${this.request}`;\n }\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/remote/${\n this.request\n }`;\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: (err: WebpackError | null, needsRebuild?: boolean) => void,\n ): void {\n callback(null, !this.buildInfo);\n }\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: WebpackOptionsNormalized,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (err?: WebpackError | undefined) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {\n strict: true,\n };\n\n this.clearDependenciesAndBlocks();\n if (this.externalRequests.length === 1) {\n this.addDependency(\n new RemoteToExternalDependency(this.externalRequests[0]),\n );\n } else {\n this.addDependency(new FallbackDependency(this.externalRequests));\n }\n\n callback();\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 6;\n }\n\n /**\n * @returns {Set<string>} types available (do not mutate)\n */\n override getSourceTypes(): Set<string> {\n return TYPES;\n }\n\n /**\n * @returns {string | null} absolute path which should be used for condition matching (usually the resource path)\n */\n override nameForCondition(): string | null {\n return this.request;\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration(\n context: CodeGenerationContext,\n ): CodeGenerationResult {\n const { runtimeTemplate, moduleGraph, chunkGraph } = context;\n const module = moduleGraph.getModule(this.dependencies[0]);\n const id = module && chunkGraph.getModuleId(module);\n const sources = new Map();\n sources.set('remote', new RawSource(''));\n const data = new Map();\n data.set('share-init', [\n {\n shareScope: this.shareScope,\n initStage: 20,\n init: id === undefined ? '' : `initExternal(${JSON.stringify(id)});`,\n },\n ]);\n return { sources, data, runtimeRequirements: RUNTIME_REQUIREMENTS };\n }\n override serialize(context: any) {\n const { write } = context;\n write(this.request);\n write(this.externalRequests);\n write(this.internalRequest);\n write(this.shareScope);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n * @returns {RemoteModule} deserialized module\n */\n static deserialize(context: ObjectDeserializerContext): RemoteModule {\n const { read } = context;\n const obj = new RemoteModule(read(), read(), read(), read());\n obj.deserialize(context);\n return obj;\n }\n}\n\nmakeSerializable(RemoteModule, 'enhanced/lib/container/RemoteModule');\n\nexport default RemoteModule;\n"],"names":["TYPES","Set","RUNTIME_REQUIREMENTS","RuntimeGlobals","module","RemoteModule","Module","identifier","_identifier","readableIdentifier","requestShortener","request","libIdent","options","layer","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","strict","clearDependenciesAndBlocks","externalRequests","length","addDependency","RemoteToExternalDependency","FallbackDependency","size","type","getSourceTypes","nameForCondition","codeGeneration","runtimeTemplate","moduleGraph","chunkGraph","getModule","dependencies","id","getModuleId","sources","Map","set","RawSource","data","shareScope","initStage","init","undefined","JSON","stringify","runtimeRequirements","serialize","write","internalRequest","deserialize","read","obj","constructor","WEBPACK_MODULE_TYPE_REMOTE","join","makeSerializable"],"mappings":"AAAA;;;AAGA;;;;+BA+LA;;;eAAA;;;gCA7L0B;+DAQP;uEACQ;yEACE;2EACE;mFACQ;qCAKI;;;;;;AAI3C,MAAMA,QAAqB,IAAIC,IAAI;IAAC;IAAU;CAAa;AAC3D,MAAMC,uBAAoC,IAAID,IAAI;IAACE,uBAAc,CAACC,MAAM;CAAC;AAEzE,IAAA,AAAMC,eAAN,MAAMA,qBAAqBC,eAAM;IA6B/B;;GAEC,GACD,AAASC,aAAqB;QAC5B,OAAO,IAAI,CAACC,WAAW;IACzB;IAEA;;;GAGC,GACD,AAASC,mBAAmBC,gBAAkC,EAAU;QACtE,OAAO,CAAC,OAAO,EAAE,IAAI,CAACC,OAAO,CAAC,CAAC;IACjC;IAEA;;;GAGC,GACD,AAASC,SAASC,OAAwB,EAAiB;QACzD,OAAO,CAAC,EAA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12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
14
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_default(require("webpack/lib/RuntimeGlobals"));
|
|
15
|
+
const _RuntimeModule = /*#__PURE__*/ _interop_require_default(require("webpack/lib/RuntimeModule"));
|
|
16
|
+
const _Template = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Template"));
|
|
17
|
+
function _interop_require_default(obj) {
|
|
18
|
+
return obj && obj.__esModule ? obj : {
|
|
19
|
+
default: obj
|
|
20
|
+
};
|
|
21
|
+
}
|
|
18
22
|
let RemoteRuntimeModule = class RemoteRuntimeModule extends _RuntimeModule.default {
|
|
19
23
|
/**
|
|
20
24
|
* @returns {string | null} runtime code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteRuntimeModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport type Compilation from 'webpack/lib/Compilation';\nimport RemoteModule from './RemoteModule';\nimport RuntimeModule from 'webpack/lib/RuntimeModule';\nimport Template from 'webpack/lib/Template';\n\nclass RemoteRuntimeModule extends RuntimeModule {\n constructor() {\n super('remotes loading');\n }\n\n /**\n * @returns {string | null} runtime code\n */\n override generate(): string | null {\n const { compilation, chunkGraph } = this;\n const { runtimeTemplate, moduleGraph } = compilation as Compilation;\n const chunkToRemotesMapping: Record<string, any> = {};\n const idToExternalAndNameMapping: Record<string | number, any> = {};\n const allChunks = [\n ...Array.from(this.chunk?.getAllAsyncChunks() || []),\n ...Array.from(this.chunk?.getAllInitialChunks() || []),\n ];\n\n for (const chunk of allChunks) {\n const modules = chunkGraph?.getChunkModulesIterableBySourceType(\n chunk,\n 'remote',\n );\n if (!modules) {\n continue;\n }\n // @ts-ignore\n const remotes = (chunkToRemotesMapping[chunk.id] = []);\n for (const m of modules) {\n const module: RemoteModule = m as RemoteModule;\n const name = module.internalRequest;\n const id = chunkGraph ? chunkGraph.getModuleId(module) : undefined;\n const { shareScope } = module;\n const dep = module.dependencies[0];\n const externalModule = moduleGraph.getModule(dep);\n const externalModuleId =\n chunkGraph && externalModule\n ? chunkGraph.getModuleId(externalModule)\n : undefined;\n if (id !== undefined) {\n //@ts-ignore\n remotes.push(id);\n idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId];\n }\n }\n }\n return Template.asString([\n `var chunkMapping = ${JSON.stringify(\n chunkToRemotesMapping,\n null,\n '\\t',\n )};`,\n `var idToExternalAndNameMapping = ${JSON.stringify(\n idToExternalAndNameMapping,\n null,\n '\\t',\n )};`,\n `${\n RuntimeGlobals.ensureChunkHandlers\n }.remotes = ${runtimeTemplate.basicFunction('chunkId, promises', [\n `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`,\n Template.indent([\n `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction('id', [\n `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`,\n 'if(!getScope) getScope = [];',\n 'var data = idToExternalAndNameMapping[id];',\n 'if(getScope.indexOf(data) >= 0) return;',\n 'getScope.push(data);',\n `if(data.p) return promises.push(data.p);`,\n `var onError = ${runtimeTemplate.basicFunction('error', [\n 'if(!error) error = new Error(\"Container missing\");',\n 'if(typeof error.message === \"string\")',\n Template.indent(\n `error.message += '\\\\nwhile loading \"' + data[1] + '\" from ' + data[2];`,\n ),\n `${\n RuntimeGlobals.moduleFactories\n }[id] = ${runtimeTemplate.basicFunction('', ['throw error;'])}`,\n 'data.p = 0;',\n ])};`,\n `var handleFunction = ${runtimeTemplate.basicFunction(\n 'fn, arg1, arg2, d, next, first',\n [\n 'try {',\n Template.indent([\n 'var promise = fn(arg1, arg2);',\n 'if(promise && promise.then) {',\n Template.indent([\n `var p = promise.then(${runtimeTemplate.returningFunction(\n 'next(result, d)',\n 'result',\n )}, onError);`,\n `if(first) promises.push(data.p = p); else return p;`,\n ]),\n '} else {',\n Template.indent(['return next(promise, d, first);']),\n '}',\n ]),\n '} catch(error) {',\n Template.indent(['onError(error);']),\n '}',\n ],\n )}`,\n `var onExternal = ${runtimeTemplate.returningFunction(\n `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`,\n 'external, _, first',\n )};`,\n `var onInitialized = ${runtimeTemplate.returningFunction(\n `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`,\n '_, external, first',\n )};`,\n `var onFactory = ${runtimeTemplate.basicFunction('factory', [\n 'data.p = 1;',\n `${\n RuntimeGlobals.moduleFactories\n }[id] = ${runtimeTemplate.basicFunction('module', [\n 'module.exports = factory();',\n ])}`,\n ])};`,\n `handleFunction(${RuntimeGlobals.require}, data[2], 0, 0, onExternal, 1);`,\n ])});`,\n ]),\n '}',\n ])}`,\n ]);\n }\n}\n\nexport default RemoteRuntimeModule;\n"],"names":["RemoteRuntimeModule","RuntimeModule","generate","compilation","chunkGraph","runtimeTemplate","moduleGraph","chunkToRemotesMapping","idToExternalAndNameMapping","allChunks","Array","from","chunk","getAllAsyncChunks","getAllInitialChunks","modules","getChunkModulesIterableBySourceType","remotes","id","m","module","name","internalRequest","getModuleId","undefined","shareScope","dep","dependencies","externalModule","getModule","externalModuleId","push","Template","asString","JSON","stringify","RuntimeGlobals","ensureChunkHandlers","basicFunction","hasOwnProperty","indent","currentRemoteGetScope","moduleFactories","returningFunction","initializeSharing","require","constructor"],"mappings":"AAAA;;;AAGA;;;;+BAuIA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteRuntimeModule.ts"],"sourcesContent":["/*\n\tMIT License http://www.opensource.org/licenses/mit-license.php\n\tAuthor Tobias Koppers @sokra, Zackary Jackson @ScriptedAlchemy\n*/\nimport RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\nimport type Compilation from 'webpack/lib/Compilation';\nimport RemoteModule from './RemoteModule';\nimport RuntimeModule from 'webpack/lib/RuntimeModule';\nimport Template from 'webpack/lib/Template';\n\nclass RemoteRuntimeModule extends RuntimeModule {\n constructor() {\n super('remotes loading');\n }\n\n /**\n * @returns {string | null} runtime code\n */\n override generate(): string | null {\n const { compilation, chunkGraph } = this;\n const { runtimeTemplate, moduleGraph } = compilation as Compilation;\n const chunkToRemotesMapping: Record<string, any> = {};\n const idToExternalAndNameMapping: Record<string | number, any> = {};\n const allChunks = [\n ...Array.from(this.chunk?.getAllAsyncChunks() || []),\n ...Array.from(this.chunk?.getAllInitialChunks() || []),\n ];\n\n for (const chunk of allChunks) {\n const modules = chunkGraph?.getChunkModulesIterableBySourceType(\n chunk,\n 'remote',\n );\n if (!modules) {\n continue;\n }\n // @ts-ignore\n const remotes = (chunkToRemotesMapping[chunk.id] = []);\n for (const m of modules) {\n const module: RemoteModule = m as RemoteModule;\n const name = module.internalRequest;\n const id = chunkGraph ? chunkGraph.getModuleId(module) : undefined;\n const { shareScope } = module;\n const dep = module.dependencies[0];\n const externalModule = moduleGraph.getModule(dep);\n const externalModuleId =\n chunkGraph && externalModule\n ? chunkGraph.getModuleId(externalModule)\n : undefined;\n if (id !== undefined) {\n //@ts-ignore\n remotes.push(id);\n idToExternalAndNameMapping[id] = [shareScope, name, externalModuleId];\n }\n }\n }\n return Template.asString([\n `var chunkMapping = ${JSON.stringify(\n chunkToRemotesMapping,\n null,\n '\\t',\n )};`,\n `var idToExternalAndNameMapping = ${JSON.stringify(\n idToExternalAndNameMapping,\n null,\n '\\t',\n )};`,\n `${\n RuntimeGlobals.ensureChunkHandlers\n }.remotes = ${runtimeTemplate.basicFunction('chunkId, promises', [\n `if(${RuntimeGlobals.hasOwnProperty}(chunkMapping, chunkId)) {`,\n Template.indent([\n `chunkMapping[chunkId].forEach(${runtimeTemplate.basicFunction('id', [\n `var getScope = ${RuntimeGlobals.currentRemoteGetScope};`,\n 'if(!getScope) getScope = [];',\n 'var data = idToExternalAndNameMapping[id];',\n 'if(getScope.indexOf(data) >= 0) return;',\n 'getScope.push(data);',\n `if(data.p) return promises.push(data.p);`,\n `var onError = ${runtimeTemplate.basicFunction('error', [\n 'if(!error) error = new Error(\"Container missing\");',\n 'if(typeof error.message === \"string\")',\n Template.indent(\n `error.message += '\\\\nwhile loading \"' + data[1] + '\" from ' + data[2];`,\n ),\n `${\n RuntimeGlobals.moduleFactories\n }[id] = ${runtimeTemplate.basicFunction('', ['throw error;'])}`,\n 'data.p = 0;',\n ])};`,\n `var handleFunction = ${runtimeTemplate.basicFunction(\n 'fn, arg1, arg2, d, next, first',\n [\n 'try {',\n Template.indent([\n 'var promise = fn(arg1, arg2);',\n 'if(promise && promise.then) {',\n Template.indent([\n `var p = promise.then(${runtimeTemplate.returningFunction(\n 'next(result, d)',\n 'result',\n )}, onError);`,\n `if(first) promises.push(data.p = p); else return p;`,\n ]),\n '} else {',\n Template.indent(['return next(promise, d, first);']),\n '}',\n ]),\n '} catch(error) {',\n Template.indent(['onError(error);']),\n '}',\n ],\n )}`,\n `var onExternal = ${runtimeTemplate.returningFunction(\n `external ? handleFunction(${RuntimeGlobals.initializeSharing}, data[0], 0, external, onInitialized, first) : onError()`,\n 'external, _, first',\n )};`,\n `var onInitialized = ${runtimeTemplate.returningFunction(\n `handleFunction(external.get, data[1], getScope, 0, onFactory, first)`,\n '_, external, first',\n )};`,\n `var onFactory = ${runtimeTemplate.basicFunction('factory', [\n 'data.p = 1;',\n `${\n RuntimeGlobals.moduleFactories\n }[id] = ${runtimeTemplate.basicFunction('module', [\n 'module.exports = factory();',\n ])}`,\n ])};`,\n `handleFunction(${RuntimeGlobals.require}, data[2], 0, 0, onExternal, 1);`,\n ])});`,\n ]),\n '}',\n ])}`,\n ]);\n }\n}\n\nexport default RemoteRuntimeModule;\n"],"names":["RemoteRuntimeModule","RuntimeModule","generate","compilation","chunkGraph","runtimeTemplate","moduleGraph","chunkToRemotesMapping","idToExternalAndNameMapping","allChunks","Array","from","chunk","getAllAsyncChunks","getAllInitialChunks","modules","getChunkModulesIterableBySourceType","remotes","id","m","module","name","internalRequest","getModuleId","undefined","shareScope","dep","dependencies","externalModule","getModule","externalModuleId","push","Template","asString","JSON","stringify","RuntimeGlobals","ensureChunkHandlers","basicFunction","hasOwnProperty","indent","currentRemoteGetScope","moduleFactories","returningFunction","initializeSharing","require","constructor"],"mappings":"AAAA;;;AAGA;;;;+BAuIA;;;eAAA;;;uEAtI2B;sEAGD;iEACL;;;;;;AAErB,IAAA,AAAMA,sBAAN,MAAMA,4BAA4BC,sBAAa;IAK7C;;GAEC,GACD,AAASC,WAA0B;YAMjB,aACA;QANhB,MAAM,EAAEC,WAAW,EAAEC,UAAU,EAAE,GAAG,IAAI;QACxC,MAAM,EAAEC,eAAe,EAAEC,WAAW,EAAE,GAAGH;QACzC,MAAMI,wBAA6C,CAAC;QACpD,MAAMC,6BAA2D,CAAC;QAClE,MAAMC,YAAY;eACbC,MAAMC,IAAI,CAAC,EAAA,cAAA,IAAI,CAACC,KAAK,qBAAV,YAAYC,iBAAiB,OAAM,EAAE;eAChDH,MAAMC,IAAI,CAAC,EAAA,eAAA,IAAI,CAACC,KAAK,qBAAV,aAAYE,mBAAmB,OAAM,EAAE;SACtD;QAED,KAAK,MAAMF,SAASH,UAAW;YAC7B,MAAMM,UAAUX,8BAAAA,WAAYY,mCAAmC,CAC7DJ,OACA;YAEF,IAAI,CAACG,SAAS;gBACZ;YACF;YACA,aAAa;YACb,MAAME,UAAWV,qBAAqB,CAACK,MAAMM,EAAE,CAAC,GAAG,EAAE;YACrD,KAAK,MAAMC,KAAKJ,QAAS;gBACvB,MAAMK,SAAuBD;gBAC7B,MAAME,OAAOD,OAAOE,eAAe;gBACnC,MAAMJ,KAAKd,aAAaA,WAAWmB,WAAW,CAACH,UAAUI;gBACzD,MAAM,EAAEC,UAAU,EAAE,GAAGL;gBACvB,MAAMM,MAAMN,OAAOO,YAAY,CAA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ACAR,iBAAQ,CAACQ,MAAM,CAAC;oCACd,CAAC,qBAAqB,EAAEnC,gBAAgBsC,iBAAiB,CACvD,mBACA,UACA,WAAW,CAAC;oCACd,CAAC,mDAAmD,CAAC;iCACtD;gCACD;gCACAX,iBAAQ,CAACQ,MAAM,CAAC;oCAAC;iCAAkC;gCACnD;6BACD;4BACD;4BACAR,iBAAQ,CAACQ,MAAM,CAAC;gCAAC;6BAAkB;4BACnC;yBACD,EACD,CAAC;wBACH,CAAC,iBAAiB,EAAEnC,gBAAgBsC,iBAAiB,CACnD,CAAC,0BAA0B,EAAEP,uBAAc,CAACQ,iBAAiB,CAAC,yDAAyD,CAAC,EACxH,sBACA,CAAC,CAAC;wBACJ,CAAC,oBAAoB,EAAEvC,gBAAgBsC,iBAAiB,CACtD,CAAC,oEAAoE,CAAC,EACtE,sBACA,CAAC,CAAC;wBACJ,CAAC,gBAAgB,EAAEtC,gBAAgBiC,aAAa,CAAC,WAAW;4BAC1D;4BACA,CAAC,EACCF,uBAAc,CAACM,eAAe,CAC/B,OAAO,EAAErC,gBAAgBiC,aAAa,CAAC,UAAU;gCAChD;6BACD,EAAE,CAAC;yBACL,EAAE,CAAC,CAAC;wBACL,CAAC,eAAe,EAAEF,uBAAc,CAACS,OAAO,CAAC,gCAAgC,CAAC;qBAC3E,EAAE,EAAE,CAAC;iBACP;gBACD;aACD,EAAE,CAAC;SACL;IACH;IA5HAC,aAAc;QACZ,KAAK,CAAC;IACR;AA2HF;MAEA,WAAe9C"}
|
|
@@ -8,8 +8,12 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const _ModuleDependency = /*#__PURE__*/ _interop_require_default(require("webpack/lib/dependencies/ModuleDependency"));
|
|
12
|
+
function _interop_require_default(obj) {
|
|
13
|
+
return obj && obj.__esModule ? obj : {
|
|
14
|
+
default: obj
|
|
15
|
+
};
|
|
16
|
+
}
|
|
13
17
|
const _default = RemoteToExternalDependency;
|
|
14
18
|
|
|
15
19
|
//# sourceMappingURL=RemoteToExternalDependency.d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteToExternalDependency.d.ts"],"sourcesContent":["export default RemoteToExternalDependency;\ndeclare class RemoteToExternalDependency extends ModuleDependency {}\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\n"],"names":["RemoteToExternalDependency"],"mappings":";;;;+BAAA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteToExternalDependency.d.ts"],"sourcesContent":["export default RemoteToExternalDependency;\ndeclare class RemoteToExternalDependency extends ModuleDependency {}\nimport ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\n"],"names":["RemoteToExternalDependency"],"mappings":";;;;+BAAA;;;eAAA;;;yEAE6B;;;;;;MAF7B,WAAeA"}
|