feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -8,6 +8,7 @@
const { OriginalSource, RawSource } = require("webpack-sources");
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
const Module = require("../Module");
const { JS_TYPES } = require("../ModuleSourceTypesConstants");
const { JAVASCRIPT_MODULE_TYPE_DYNAMIC } = require("../ModuleTypeConstants");
const RuntimeGlobals = require("../RuntimeGlobals");
const Template = require("../Template");
@@ -41,8 +42,6 @@ const ContainerExposedDependency = require("./ContainerExposedDependency");
/** @typedef {[string, ExposeOptions][]} ExposesList */
const SOURCE_TYPES = new Set(["javascript"]);
class ContainerEntryModule extends Module {
/**
* @param {string} name container entry name
@@ -60,7 +59,7 @@ class ContainerEntryModule extends Module {
* @returns {SourceTypes} types available (do not mutate)
*/
getSourceTypes() {
return SOURCE_TYPES;
return JS_TYPES;
}
/**
@@ -77,7 +76,7 @@ class ContainerEntryModule extends Module {
* @returns {string} a user readable identifier of the module
*/
readableIdentifier(requestShortener) {
return `container entry`;
return "container entry";
}
/**
@@ -205,7 +204,7 @@ class ContainerEntryModule extends Module {
}
const source = Template.asString([
`var moduleMap = {`,
"var moduleMap = {",
Template.indent(getters.join(",\n")),
"};",
`var get = ${runtimeTemplate.basicFunction("module, getScope", [
@@ -230,7 +229,7 @@ class ContainerEntryModule extends Module {
`if (!${RuntimeGlobals.shareScopeMap}) return;`,
`var name = ${JSON.stringify(this._shareScope)}`,
`var oldScope = ${RuntimeGlobals.shareScopeMap}[name];`,
`if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");`,
'if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");',
`${RuntimeGlobals.shareScopeMap}[name] = shareScope;`,
`return ${RuntimeGlobals.initializeSharing}(name, initScope);`
])};`,