@module-federation/enhanced 0.0.2 → 0.0.4-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 +13 -0
- package/package.json +1 -1
- package/src/index.js +10 -6
- package/src/index.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
|
@@ -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,CAACC,WAAW;IACzB;IAEA;;;GAGC,GACD,AAASC,mBAAmBC,gBAAkC,EAAU;QACtE,OAAO,IAAI,CAACF,WAAW;IACzB;IAEA;;;GAGC,GACD,AAASG,SAASC,O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Property(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,IACnE;gBACAJ;aAAAA,gDAAAA,SAASE,OAAO,CAACK,MAAM,CAACC,mBAAmB,qBAA3CR,8CAA6CU,IAAI,CAACP,QAAQC,IAAI;QAChE;QACAJ,SAASW,KAAK,CAACC,YAAY,CAACC,GAAG,CAAC,0BAA0B;YACxD,IACEX,QAAQY,OAAO,IACdC,CAAAA,MAAMC,OAAO,CAACd,QAAQY,OAAO,IAC1BZ,QAAQY,OAAO,CAACG,MAAM,GAAG,IACzBC,OAAOC,IAAI,CAACjB,QAAQY,OAAO,EAAEG,MAAM,GAAG,CAAA,GAC1C;gBACA,IAAIG,wBAAe,CAAC;oBAClB,YAAY;oBACZxB,MAAMM,QAAQN,IAAI;oBAClBO;oBACAkB,UAAUnB,QAAQmB,QAAQ;oBAC1BC,SAASpB,QAAQoB,OAAO;oBACxBC,YAAYrB,QAAQqB,UAAU;oBAC9BT,SAASZ,QAAQY,OAAO;gBAC1B,GAAGf,KAAK,CAACC;YACX;YACA,IACEE,QAAQsB,OAAO,IACdT,CAAAA,MAAMC,OAAO,CAACd,QAAQsB,OAAO,IAC1BtB,QAAQsB,OAAO,CAACP,MAAM,GAAG,IACzBC,OAAOC,IAAI,CAACjB,QAAQsB,OAAO,EAAEP,MAAM,GAAG,CAAA,GAC1C;gBACA,IAAIQ,iCAAwB,CAAC;oBAC3B,YAAY;oBACZpB;oBACAkB,YAAYrB,QAAQqB,UAAU;oBAC9BC,SAAStB,QAAQsB,OAAO;gBAC1B,GAAGzB,KAAK,CAACC;YACX;YACA,IAAIE,QAAQwB,MAAM,EAAE;gBAClB,IAAIC,oBAAW,CAAC;oBACdD,QAAQxB,QAAQwB,MAAM;oBACtBH,YAAYrB,QAAQqB,UAAU;gBAChC,GAAGxB,KAAK,CAACC;YACX;QACF;IACF;IAjEA;;GAEC,GACD4B,YAAY1B,OAAsC,CAAE;QAClDT,SAASS;QAET,IAAI,CAACD,QAAQ,GAAGC;IAClB;AA2DF;MAEA,WAAeJ"}
|
|
@@ -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
|
|
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,EAAE,IAAI,CAACC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,CAACA,KAAK,CAAC,EAAE,CAAC,GAAG,GAAG,yBAAyB,EACtE,IAAI,CAACH,OAAO,CACb,CAAC;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aAAa,EAAEC,KAAKC,SAAS,CAACZ,IAAI,EAAE,CAAC;YACtE;SACD;QACD,OAAO;YAAEE;YAASI;YAAMO,qBAAqBpD;QAAqB;IACpE;IACSqD,UAAUvC,OAAY,EAAE;QAC/B,MAAM,EAAEwC,KAAK,EAAE,GAAGxC;QAClBwC,MAAM,IAAI,CAAC7C,OAAO;QAClB6C,MAAM,IAAI,CAAC9B,gBAAgB;QAC3B8B,MAAM,IAAI,CAACC,eAAe;QAC1BD,MAAM,IAAI,CAACR,UAAU;QACrB,KAAK,CAACO,UAAUvC;IAClB;IAEA;;;GAGC,GACD,OAAO0C,YAAY1C,OAAkC,EAAgB;QACnE,MAAM,EAAE2C,IAAI,EAAE,GAAG3C;QACjB,MAAM4C,MAAM,IAAIvD,aAAasD,QAAQA,QAAQA,QAAQA;QACrDC,IAAIF,WAAW,CAAC1C;QAChB,OAAO4C;IACT;IAzJA;;;;;GAKC,GACDC,YACElD,OAAe,EACfe,gBAA0B,EAC1B+B,eAAuB,EACvBT,UAAkB,CAClB;QACA,KAAK,CAACc,+CAA0B;QAChC,IAAI,CAACnD,OAAO,GAAGA;QACf,IAAI,CAACe,gBAAgB,GAAGA;QACxB,IAAI,CAAC+B,eAAe,GAAGA;QACvB,IAAI,CAACT,UAAU,GAAGA;QAClB,IAAI,CAACxC,WAAW,GAAG,CAAC,QAAQ,EAAEwC,WAAW,EAAE,EAAE,IAAI,CAACtB,gBAAgB,CAACqC,IAAI,CACrE,KACA,CAAC,EAAE,IAAI,CAACN,eAAe,CAAC,CAAC;IAC7B;AAsIF;AAEAO,IAAAA,yBAAgB,EAAC3D,cAAc;MAE/B,WAAeA"}
|
|
@@ -11,10 +11,14 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
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,CAAC,EAAE;gBAClC,MAAMC,iBAAiBtB,YAAYuB,SAAS,CAACH;gBAC7C,MAAMI,mBACJ1B,cAAcwB,iBACVxB,WAAWmB,WAAW,CAACK,kBACvBJ;gBACN,IAA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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"}
|
|
@@ -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 RemoteToExternalDependency = class RemoteToExternalDependency extends _ModuleDependency.default {
|
|
18
22
|
get type() {
|
|
19
23
|
return 'remote to external';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteToExternalDependency.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 ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass RemoteToExternalDependency extends ModuleDependency {\n /**\n * @param {string} request request\n */\n constructor(request: string) {\n super(request);\n }\n override get type() {\n return 'remote to external';\n }\n\n override get category() {\n return 'esm';\n }\n}\n\nmakeSerializable(\n RemoteToExternalDependency,\n 'enhanced/lib/container/RemoteToExternalDependency',\n);\n\nexport default RemoteToExternalDependency;\n"],"names":["RemoteToExternalDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA0BA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/container/RemoteToExternalDependency.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 ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass RemoteToExternalDependency extends ModuleDependency {\n /**\n * @param {string} request request\n */\n constructor(request: string) {\n super(request);\n }\n override get type() {\n return 'remote to external';\n }\n\n override get category() {\n return 'esm';\n }\n}\n\nmakeSerializable(\n RemoteToExternalDependency,\n 'enhanced/lib/container/RemoteToExternalDependency',\n);\n\nexport default RemoteToExternalDependency;\n"],"names":["RemoteToExternalDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA0BA;;;eAAA;;;yEAxB6B;yEACA;;;;;;AAE7B,IAAA,AAAMA,6BAAN,MAAMA,mCAAmCC,yBAAgB;IAOvD,IAAaC,OAAO;QAClB,OAAO;IACT;IAEA,IAAaC,WAAW;QACtB,OAAO;IACT;IAZA;;GAEC,GACDC,YAAYC,OAAe,CAAE;QAC3B,KAAK,CAACA;IACR;AAQF;AAEAC,IAAAA,yBAAgB,EACdN,4BACA;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 ConsumeSharedFallbackDependency = class ConsumeSharedFallbackDependency extends _ModuleDependency.default {
|
|
18
22
|
get type() {
|
|
19
23
|
return 'consume shared fallback';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/sharing/ConsumeSharedFallbackDependency.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 ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass ConsumeSharedFallbackDependency extends ModuleDependency {\n /**\n * @param {string} request the request\n */\n constructor(request: string) {\n super(request);\n }\n\n override get type(): string {\n return 'consume shared fallback';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n ConsumeSharedFallbackDependency,\n 'enhanced/lib/sharing/ConsumeSharedFallbackDependency',\n);\n\nexport default ConsumeSharedFallbackDependency;\n"],"names":["ConsumeSharedFallbackDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA2BA;;;eAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/sharing/ConsumeSharedFallbackDependency.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 ModuleDependency from 'webpack/lib/dependencies/ModuleDependency';\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\n\nclass ConsumeSharedFallbackDependency extends ModuleDependency {\n /**\n * @param {string} request the request\n */\n constructor(request: string) {\n super(request);\n }\n\n override get type(): string {\n return 'consume shared fallback';\n }\n\n override get category(): string {\n return 'esm';\n }\n}\n\nmakeSerializable(\n ConsumeSharedFallbackDependency,\n 'enhanced/lib/sharing/ConsumeSharedFallbackDependency',\n);\n\nexport default ConsumeSharedFallbackDependency;\n"],"names":["ConsumeSharedFallbackDependency","ModuleDependency","type","category","constructor","request","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BA2BA;;;eAAA;;;yEAzB6B;yEACA;;;;;;AAE7B,IAAA,AAAMA,kCAAN,MAAMA,wCAAwCC,yBAAgB;IAQ5D,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,iCACA;MAGF,WAAeA"}
|
|
@@ -11,16 +11,58 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
return _default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
15
|
-
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
16
14
|
const _webpacksources = require("webpack-sources");
|
|
17
|
-
const _AsyncDependenciesBlock = /*#__PURE__*/ _interop_require_default
|
|
18
|
-
const _Module = /*#__PURE__*/ _interop_require_default
|
|
15
|
+
const _AsyncDependenciesBlock = /*#__PURE__*/ _interop_require_default(require("webpack/lib/AsyncDependenciesBlock"));
|
|
16
|
+
const _Module = /*#__PURE__*/ _interop_require_default(require("webpack/lib/Module"));
|
|
19
17
|
const _ModuleTypeConstants = require("webpack/lib/ModuleTypeConstants");
|
|
20
|
-
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard
|
|
21
|
-
const _makeSerializable = /*#__PURE__*/ _interop_require_default
|
|
18
|
+
const _RuntimeGlobals = /*#__PURE__*/ _interop_require_wildcard(require("webpack/lib/RuntimeGlobals"));
|
|
19
|
+
const _makeSerializable = /*#__PURE__*/ _interop_require_default(require("webpack/lib/util/makeSerializable"));
|
|
22
20
|
const _semver = require("webpack/lib/util/semver");
|
|
23
|
-
const _ConsumeSharedFallbackDependency = /*#__PURE__*/ _interop_require_default
|
|
21
|
+
const _ConsumeSharedFallbackDependency = /*#__PURE__*/ _interop_require_default(require("./ConsumeSharedFallbackDependency"));
|
|
22
|
+
function _interop_require_default(obj) {
|
|
23
|
+
return obj && obj.__esModule ? obj : {
|
|
24
|
+
default: obj
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
28
|
+
if (typeof WeakMap !== "function") return null;
|
|
29
|
+
var cacheBabelInterop = new WeakMap();
|
|
30
|
+
var cacheNodeInterop = new WeakMap();
|
|
31
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
32
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
33
|
+
})(nodeInterop);
|
|
34
|
+
}
|
|
35
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
36
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
37
|
+
return obj;
|
|
38
|
+
}
|
|
39
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
40
|
+
return {
|
|
41
|
+
default: obj
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
45
|
+
if (cache && cache.has(obj)) {
|
|
46
|
+
return cache.get(obj);
|
|
47
|
+
}
|
|
48
|
+
var newObj = {};
|
|
49
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
50
|
+
for(var key in obj){
|
|
51
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
52
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
53
|
+
if (desc && (desc.get || desc.set)) {
|
|
54
|
+
Object.defineProperty(newObj, key, desc);
|
|
55
|
+
} else {
|
|
56
|
+
newObj[key] = obj[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
newObj.default = obj;
|
|
61
|
+
if (cache) {
|
|
62
|
+
cache.set(obj, newObj);
|
|
63
|
+
}
|
|
64
|
+
return newObj;
|
|
65
|
+
}
|
|
24
66
|
/**
|
|
25
67
|
* @typedef {Object} ConsumeOptions
|
|
26
68
|
* @property {string=} import fallback request
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/sharing/ConsumeSharedModule.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 { RawSource } from 'webpack-sources';\n//@ts-ignore\nimport AsyncDependenciesBlock from 'webpack/lib/AsyncDependenciesBlock';\nimport type {\n WebpackOptions,\n Compilation,\n UpdateHashContext,\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n Hash,\n InputFileSystem,\n} from 'webpack/lib/Module';\n//@ts-ignore\nimport Module from 'webpack/lib/Module';\nimport { WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE } from 'webpack/lib/ModuleTypeConstants';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\n//@ts-ignore\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport { rangeToString, stringifyHoley } from 'webpack/lib/util/semver';\nimport ConsumeSharedFallbackDependency from './ConsumeSharedFallbackDependency';\nexport type ConsumeOptions = {\n /**\n * fallback request\n */\n import?: string | undefined;\n /**\n * resolved fallback request\n */\n importResolved?: string | undefined;\n /**\n * global share key\n */\n shareKey: string;\n /**\n * share scope\n */\n shareScope: string;\n /**\n * version requirement\n */\n requiredVersion:\n | import('webpack/lib/util/semver').SemVerRange\n | false\n | undefined;\n /**\n * package name to determine required version automatically\n */\n packageName: string;\n /**\n * don't use shared version even if version isn't valid\n */\n strictVersion: boolean;\n /**\n * use single global version\n */\n singleton: boolean;\n /**\n * include the fallback module in a sync way\n */\n eager: boolean;\n};\n\n/**\n * @typedef {Object} ConsumeOptions\n * @property {string=} import fallback request\n * @property {string=} importResolved resolved fallback request\n * @property {string} shareKey global share key\n * @property {string} shareScope share scope\n * @property {SemVerRange | false | undefined} requiredVersion version requirement\n * @property {string} packageName package name to determine required version automatically\n * @property {boolean} strictVersion don't use shared version even if version isn't valid\n * @property {boolean} singleton use single global version\n * @property {boolean} eager include the fallback module in a sync way\n */\n\nconst TYPES = new Set(['consume-shared']);\n\nclass ConsumeSharedModule extends Module {\n options: ConsumeOptions;\n\n /**\n * @param {string} context context\n * @param {ConsumeOptions} options consume options\n */\n constructor(context: string, options: ConsumeOptions) {\n super(WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE, context);\n this.options = options;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n } = this.options;\n return `${WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE}|${shareScope}|${shareKey}|${\n requiredVersion && rangeToString(requiredVersion)\n }|${strictVersion}|${importResolved}|${singleton}|${eager}`;\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 const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n } = this.options;\n return `consume shared module (${shareScope}) ${shareKey}@${\n requiredVersion ? rangeToString(requiredVersion) : '*'\n }${strictVersion ? ' (strict)' : ''}${singleton ? ' (singleton)' : ''}${\n importResolved\n ? ` (fallback: ${requestShortener.shorten(importResolved)})`\n : ''\n }${eager ? ' (eager)' : ''}`;\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 const { shareKey, shareScope, import: request } = this.options;\n return `${\n this.layer ? `(${this.layer})/` : ''\n }webpack/sharing/consume/${shareScope}/${shareKey}${\n request ? `/${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: (error?: 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: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {};\n if (this.options.import) {\n const dep = new ConsumeSharedFallbackDependency(this.options.import);\n if (this.options.eager) {\n this.addDependency(dep);\n } else {\n const block = new AsyncDependenciesBlock({});\n block.addDependency(dep);\n this.addBlock(block);\n }\n }\n callback();\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 {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n\n /**\n * @param {Hash} hash the hash used to track dependencies\n * @param {UpdateHashContext} context context\n * @returns {void}\n */\n override updateHash(hash: Hash, context: UpdateHashContext): void {\n hash.update(JSON.stringify(this.options));\n super.updateHash(hash, context);\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n chunkGraph,\n moduleGraph,\n runtimeTemplate,\n }: CodeGenerationContext): CodeGenerationResult {\n const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]);\n const {\n shareScope,\n shareKey,\n strictVersion,\n requiredVersion,\n import: request,\n singleton,\n eager,\n } = this.options;\n let fallbackCode;\n if (request) {\n if (eager) {\n const dep = this.dependencies[0];\n fallbackCode = runtimeTemplate.syncModuleFactory({\n dependency: dep,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n } else {\n const block = this.blocks[0];\n fallbackCode = runtimeTemplate.asyncModuleFactory({\n block,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n }\n }\n let fn = 'load';\n const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)];\n if (requiredVersion) {\n if (strictVersion) {\n fn += 'Strict';\n }\n if (singleton) {\n fn += 'Singleton';\n }\n args.push(stringifyHoley(requiredVersion));\n fn += 'VersionCheck';\n } else {\n if (singleton) {\n fn += 'Singleton';\n }\n }\n if (fallbackCode) {\n fn += 'Fallback';\n args.push(fallbackCode);\n }\n const code = runtimeTemplate.returningFunction(`${fn}(${args.join(', ')})`);\n const sources = new Map();\n sources.set('consume-shared', new RawSource(code));\n return {\n runtimeRequirements,\n sources,\n };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.options);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n const { read } = context;\n this.options = read();\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ConsumeSharedModule,\n 'enhanced/lib/sharing/ConsumeSharedModule',\n);\n\nexport default ConsumeSharedModule;\n"],"names":["TYPES","Set","ConsumeSharedModule","Module","identifier","shareKey","shareScope","importResolved","requiredVersion","strictVersion","singleton","eager","options","WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","rangeToString","readableIdentifier","requestShortener","shorten","libIdent","import","request","layer","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","dep","ConsumeSharedFallbackDependency","addDependency","block","AsyncDependenciesBlock","addBlock","getSourceTypes","size","type","updateHash","hash","update","JSON","stringify","codeGeneration","chunkGraph","moduleGraph","runtimeTemplate","runtimeRequirements","RuntimeGlobals","shareScopeMap","fallbackCode","dependencies","syncModuleFactory","dependency","blocks","asyncModuleFactory","fn","args","push","stringifyHoley","code","returningFunction","join","sources","Map","set","RawSource","serialize","write","deserialize","read","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BAuTA;;;eAAA;;;;;gCArT0B;iFAES;iEAkBhB;qCACuC;0EAC1B;2EAEH;wBACiB;0FACF;AA2C5C;;;;;;;;;;;CAWC,GAED,MAAMA,QAAQ,IAAIC,IAAI;IAAC;CAAiB;AAExC,IAAA,AAAMC,sBAAN,MAAMA,4BAA4BC,eAAM;IAYtC;;GAEC,GACD,AAASC,aAAqB;QAC5B,MAAM,EACJC,QAAQ,EACRC,UAAU,EACVC,cAAc,EACdC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,KAAK,EACN,GAAG,IAAI,CAACC,OAAO;QAChB,OAAO,CAAC,EAAEC,8DAAyC,CAAC,CAAC,EAAEP,WAAW,CAAC,EAAED,SAAS,CAAC,EAC7EG,mBAAmBM,IAAAA,qBAAa,EAACN,iBAClC,CAAC,EAAEC,cAAc,CAAC,EAAEF,eAAe,CAAC,EAAEG,UAAU,CAAC,EAAEC,MAAM,CAAC;IAC7D;IAEA;;;GAGC,GACD,AAASI,mBAAmBC,gBAAkC,EAAU;QACtE,MAAM,EACJX,Q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C,SAAS,CAACvC;SAAU;QACnE,IAAIG,iBAAiB;YACnB,IAAIC,eAAe;gBACjBiD,MAAM;YACR;YACA,IAAIhD,WAAW;gBACbgD,MAAM;YACR;YACAC,KAAKC,IAAI,CAACC,IAAAA,sBAAc,EAACrD;YACzBkD,MAAM;QACR,OAAO;YACL,IAAIhD,WAAW;gBACbgD,MAAM;YACR;QACF;QACA,IAAIN,cAAc;YAChBM,MAAM;YACNC,KAAKC,IAAI,CAACR;QACZ;QACA,MAAMU,OAAOd,gBAAgBe,iBAAiB,CAAC,CAAC,EAAEL,GAAG,CAAC,EAAEC,KAAKK,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1E,MAAMC,UAAU,IAAIC;QACpBD,QAAQE,GAAG,CAAC,kBAAkB,IAAIC,yBAAS,CAACN;QAC5C,OAAO;YACLb;YACAgB;QACF;IACF;IAEA;;GAEC,GACD,AAASI,UAAU9C,OAAgC,EAAQ;QACzD,MAAM,EAAE+C,KAAK,EAAE,GAAG/C;QAClB+C,MAAM,IAAI,CAAC1D,OAAO;QAClB,KAAK,CAACyD,UAAU9C;IAClB;IAEA;;GAEC,GACD,AAASgD,YAAYhD,OAAkC,EAAQ;QAC7D,MAAM,EAAEiD,IAAI,EAAE,GAAGjD;QACjB,IAAI,CAACX,OAAO,GAAG4D;QACf,KAAK,CAACD,YAAYhD;IACpB;IAtNA;;;GAGC,GACDkD,YAAYlD,OAAe,EAAEX,OAAuB,CAAE;QACpD,KAAK,CAACC,8DAAyC,EAAEU;QACjD,IAAI,CAACX,OAAO,GAAGA;IACjB;AAgNF;AAEA8D,IAAAA,yBAAgB,EACdxE,qBACA;MAGF,WAAeA"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../packages/enhanced/src/lib/sharing/ConsumeSharedModule.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 { RawSource } from 'webpack-sources';\n//@ts-ignore\nimport AsyncDependenciesBlock from 'webpack/lib/AsyncDependenciesBlock';\nimport type {\n WebpackOptions,\n Compilation,\n UpdateHashContext,\n CodeGenerationContext,\n CodeGenerationResult,\n LibIdentOptions,\n NeedBuildContext,\n RequestShortener,\n ResolverWithOptions,\n WebpackError,\n ObjectDeserializerContext,\n ObjectSerializerContext,\n Hash,\n InputFileSystem,\n} from 'webpack/lib/Module';\n//@ts-ignore\nimport Module from 'webpack/lib/Module';\nimport { WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE } from 'webpack/lib/ModuleTypeConstants';\nimport * as RuntimeGlobals from 'webpack/lib/RuntimeGlobals';\n//@ts-ignore\nimport makeSerializable from 'webpack/lib/util/makeSerializable';\nimport { rangeToString, stringifyHoley } from 'webpack/lib/util/semver';\nimport ConsumeSharedFallbackDependency from './ConsumeSharedFallbackDependency';\nexport type ConsumeOptions = {\n /**\n * fallback request\n */\n import?: string | undefined;\n /**\n * resolved fallback request\n */\n importResolved?: string | undefined;\n /**\n * global share key\n */\n shareKey: string;\n /**\n * share scope\n */\n shareScope: string;\n /**\n * version requirement\n */\n requiredVersion:\n | import('webpack/lib/util/semver').SemVerRange\n | false\n | undefined;\n /**\n * package name to determine required version automatically\n */\n packageName: string;\n /**\n * don't use shared version even if version isn't valid\n */\n strictVersion: boolean;\n /**\n * use single global version\n */\n singleton: boolean;\n /**\n * include the fallback module in a sync way\n */\n eager: boolean;\n};\n\n/**\n * @typedef {Object} ConsumeOptions\n * @property {string=} import fallback request\n * @property {string=} importResolved resolved fallback request\n * @property {string} shareKey global share key\n * @property {string} shareScope share scope\n * @property {SemVerRange | false | undefined} requiredVersion version requirement\n * @property {string} packageName package name to determine required version automatically\n * @property {boolean} strictVersion don't use shared version even if version isn't valid\n * @property {boolean} singleton use single global version\n * @property {boolean} eager include the fallback module in a sync way\n */\n\nconst TYPES = new Set(['consume-shared']);\n\nclass ConsumeSharedModule extends Module {\n options: ConsumeOptions;\n\n /**\n * @param {string} context context\n * @param {ConsumeOptions} options consume options\n */\n constructor(context: string, options: ConsumeOptions) {\n super(WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE, context);\n this.options = options;\n }\n\n /**\n * @returns {string} a unique identifier of the module\n */\n override identifier(): string {\n const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n } = this.options;\n return `${WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE}|${shareScope}|${shareKey}|${\n requiredVersion && rangeToString(requiredVersion)\n }|${strictVersion}|${importResolved}|${singleton}|${eager}`;\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 const {\n shareKey,\n shareScope,\n importResolved,\n requiredVersion,\n strictVersion,\n singleton,\n eager,\n } = this.options;\n return `consume shared module (${shareScope}) ${shareKey}@${\n requiredVersion ? rangeToString(requiredVersion) : '*'\n }${strictVersion ? ' (strict)' : ''}${singleton ? ' (singleton)' : ''}${\n importResolved\n ? ` (fallback: ${requestShortener.shorten(importResolved)})`\n : ''\n }${eager ? ' (eager)' : ''}`;\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 const { shareKey, shareScope, import: request } = this.options;\n return `${\n this.layer ? `(${this.layer})/` : ''\n }webpack/sharing/consume/${shareScope}/${shareKey}${\n request ? `/${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: (error?: 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: WebpackOptions,\n compilation: Compilation,\n resolver: ResolverWithOptions,\n fs: InputFileSystem,\n callback: (error?: WebpackError) => void,\n ): void {\n this.buildMeta = {};\n this.buildInfo = {};\n if (this.options.import) {\n const dep = new ConsumeSharedFallbackDependency(this.options.import);\n if (this.options.eager) {\n this.addDependency(dep);\n } else {\n const block = new AsyncDependenciesBlock({});\n block.addDependency(dep);\n this.addBlock(block);\n }\n }\n callback();\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 {string=} type the source type for which the size should be estimated\n * @returns {number} the estimated size of the module (must be non-zero)\n */\n override size(type?: string): number {\n return 42;\n }\n\n /**\n * @param {Hash} hash the hash used to track dependencies\n * @param {UpdateHashContext} context context\n * @returns {void}\n */\n override updateHash(hash: Hash, context: UpdateHashContext): void {\n hash.update(JSON.stringify(this.options));\n super.updateHash(hash, context);\n }\n\n /**\n * @param {CodeGenerationContext} context context for code generation\n * @returns {CodeGenerationResult} result\n */\n override codeGeneration({\n chunkGraph,\n moduleGraph,\n runtimeTemplate,\n }: CodeGenerationContext): CodeGenerationResult {\n const runtimeRequirements = new Set([RuntimeGlobals.shareScopeMap]);\n const {\n shareScope,\n shareKey,\n strictVersion,\n requiredVersion,\n import: request,\n singleton,\n eager,\n } = this.options;\n let fallbackCode;\n if (request) {\n if (eager) {\n const dep = this.dependencies[0];\n fallbackCode = runtimeTemplate.syncModuleFactory({\n dependency: dep,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n } else {\n const block = this.blocks[0];\n fallbackCode = runtimeTemplate.asyncModuleFactory({\n block,\n chunkGraph,\n runtimeRequirements,\n request: this.options.import,\n });\n }\n }\n let fn = 'load';\n const args = [JSON.stringify(shareScope), JSON.stringify(shareKey)];\n if (requiredVersion) {\n if (strictVersion) {\n fn += 'Strict';\n }\n if (singleton) {\n fn += 'Singleton';\n }\n args.push(stringifyHoley(requiredVersion));\n fn += 'VersionCheck';\n } else {\n if (singleton) {\n fn += 'Singleton';\n }\n }\n if (fallbackCode) {\n fn += 'Fallback';\n args.push(fallbackCode);\n }\n const code = runtimeTemplate.returningFunction(`${fn}(${args.join(', ')})`);\n const sources = new Map();\n sources.set('consume-shared', new RawSource(code));\n return {\n runtimeRequirements,\n sources,\n };\n }\n\n /**\n * @param {ObjectSerializerContext} context context\n */\n override serialize(context: ObjectSerializerContext): void {\n const { write } = context;\n write(this.options);\n super.serialize(context);\n }\n\n /**\n * @param {ObjectDeserializerContext} context context\n */\n override deserialize(context: ObjectDeserializerContext): void {\n const { read } = context;\n this.options = read();\n super.deserialize(context);\n }\n}\n\nmakeSerializable(\n ConsumeSharedModule,\n 'enhanced/lib/sharing/ConsumeSharedModule',\n);\n\nexport default ConsumeSharedModule;\n"],"names":["TYPES","Set","ConsumeSharedModule","Module","identifier","shareKey","shareScope","importResolved","requiredVersion","strictVersion","singleton","eager","options","WEBPACK_MODULE_TYPE_CONSUME_SHARED_MODULE","rangeToString","readableIdentifier","requestShortener","shorten","libIdent","import","request","layer","needBuild","context","callback","buildInfo","build","compilation","resolver","fs","buildMeta","dep","ConsumeSharedFallbackDependency","addDependency","block","AsyncDependenciesBlock","addBlock","getSourceTypes","size","type","updateHash","hash","update","JSON","stringify","codeGeneration","chunkGraph","moduleGraph","runtimeTemplate","runtimeRequirements","RuntimeGlobals","shareScopeMap","fallbackCode","dependencies","syncModuleFactory","dependency","blocks","asyncModuleFactory","fn","args","push","stringifyHoley","code","returningFunction","join","sources","Map","set","RawSource","serialize","write","deserialize","read","constructor","makeSerializable"],"mappings":"AAAA;;;AAGA,GAEA;;;;+BAuTA;;;eAAA;;;gCArT0B;+EAES;+DAkBhB;qCACuC;wEAC1B;yEAEH;wBACiB;wFACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2C5C;;;;;;;;;;;CAWC,GAED,MAAMA,QA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