Fix code quality violations and enhance ROUTE-EXISTS-01 rule
Implement JQHTML function cache ID system and fix bundle compilation Implement underscore prefix for system tables Fix JS syntax linter to support decorators and grant exception to Task system SPA: Update planning docs and wishlists with remaining features SPA: Document Navigation API abandonment and future enhancements Implement SPA browser integration with History API (Phase 1) Convert contacts view page to SPA action Convert clients pages to SPA actions and document conversion procedure SPA: Merge GET parameters and update documentation Implement SPA route URL generation in JavaScript and PHP Implement SPA bootstrap controller architecture Add SPA routing manual page (rsx:man spa) Add SPA routing documentation to CLAUDE.md Phase 4 Complete: Client-side SPA routing implementation Update get_routes() consumers for unified route structure Complete SPA Phase 3: PHP-side route type detection and is_spa flag Restore unified routes structure and Manifest_Query class Refactor route indexing and add SPA infrastructure Phase 3 Complete: SPA route registration in manifest Implement SPA Phase 2: Extract router code and test decorators Rename Jqhtml_Component to Component and complete SPA foundation setup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
171
node_modules/webpack/lib/RuntimeTemplate.js
generated
vendored
171
node_modules/webpack/lib/RuntimeTemplate.js
generated
vendored
@@ -11,15 +11,24 @@ const Template = require("./Template");
|
||||
const {
|
||||
getOutgoingAsyncModules
|
||||
} = require("./async-modules/AsyncModuleHelpers");
|
||||
const { ImportPhaseUtils } = require("./dependencies/ImportPhase");
|
||||
const {
|
||||
getMakeDeferredNamespaceModeFromExportsType,
|
||||
getOptimizedDeferredModule
|
||||
} = require("./runtime/MakeDeferredNamespaceObjectRuntime");
|
||||
const { equals } = require("./util/ArrayHelpers");
|
||||
const compileBooleanMatcher = require("./util/compileBooleanMatcher");
|
||||
const memoize = require("./util/memoize");
|
||||
const propertyAccess = require("./util/propertyAccess");
|
||||
const { forEachRuntime, subtractRuntime } = require("./util/runtime");
|
||||
|
||||
const getHarmonyImportDependency = memoize(() =>
|
||||
require("./dependencies/HarmonyImportDependency")
|
||||
);
|
||||
const getImportDependency = memoize(() =>
|
||||
require("./dependencies/ImportDependency")
|
||||
);
|
||||
|
||||
/** @typedef {import("./config/defaults").OutputNormalizedWithDefaults} OutputOptions */
|
||||
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
|
||||
/** @typedef {import("./Chunk")} Chunk */
|
||||
@@ -32,6 +41,8 @@ const { forEachRuntime, subtractRuntime } = require("./util/runtime");
|
||||
/** @typedef {import("./ModuleGraph")} ModuleGraph */
|
||||
/** @typedef {import("./RequestShortener")} RequestShortener */
|
||||
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
|
||||
/** @typedef {import("./dependencies/ImportPhase").ImportPhaseType} ImportPhaseType */
|
||||
/** @typedef {import("./NormalModuleFactory").ModuleDependency} ModuleDependency */
|
||||
|
||||
/**
|
||||
* @param {Module} module the module
|
||||
@@ -617,6 +628,7 @@ class RuntimeTemplate {
|
||||
* @param {string} options.message a message for the comment
|
||||
* @param {boolean=} options.strict if the current module is in strict esm mode
|
||||
* @param {boolean=} options.weak if the dependency is weak (will create a nice error message)
|
||||
* @param {Dependency} options.dependency dependency
|
||||
* @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements
|
||||
* @returns {string} the promise expression
|
||||
*/
|
||||
@@ -628,6 +640,7 @@ class RuntimeTemplate {
|
||||
message,
|
||||
strict,
|
||||
weak,
|
||||
dependency,
|
||||
runtimeRequirements
|
||||
}) {
|
||||
if (!module) {
|
||||
@@ -684,42 +697,45 @@ class RuntimeTemplate {
|
||||
type: "statements"
|
||||
})} } `;
|
||||
}
|
||||
const moduleIdExpr = this.moduleId({
|
||||
module,
|
||||
chunkGraph,
|
||||
request,
|
||||
weak
|
||||
});
|
||||
const exportsType = module.getExportsType(chunkGraph.moduleGraph, strict);
|
||||
let fakeType = 16;
|
||||
switch (exportsType) {
|
||||
case "namespace":
|
||||
|
||||
const isModuleDeferred =
|
||||
(dependency instanceof getHarmonyImportDependency() ||
|
||||
dependency instanceof getImportDependency()) &&
|
||||
ImportPhaseUtils.isDefer(dependency.phase) &&
|
||||
!(/** @type {BuildMeta} */ (module.buildMeta).async);
|
||||
|
||||
if (isModuleDeferred) {
|
||||
runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject);
|
||||
const mode = getMakeDeferredNamespaceModeFromExportsType(exportsType);
|
||||
const asyncDeps = Array.from(
|
||||
getOutgoingAsyncModules(chunkGraph.moduleGraph, module),
|
||||
(m) => chunkGraph.getModuleId(m)
|
||||
).filter((id) => id !== null);
|
||||
if (asyncDeps.length) {
|
||||
if (header) {
|
||||
const rawModule = this.moduleRaw({
|
||||
module,
|
||||
chunkGraph,
|
||||
request,
|
||||
weak,
|
||||
runtimeRequirements
|
||||
});
|
||||
appending = `.then(${this.basicFunction(
|
||||
"",
|
||||
`${header}return ${rawModule};`
|
||||
`${header}return ${RuntimeGlobals.deferredModuleAsyncTransitiveDependencies}(${JSON.stringify(asyncDeps)});`
|
||||
)})`;
|
||||
} else {
|
||||
runtimeRequirements.add(RuntimeGlobals.require);
|
||||
appending = `.then(${RuntimeGlobals.require}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}))`;
|
||||
appending = `.then(${this.returningFunction(`${RuntimeGlobals.deferredModuleAsyncTransitiveDependencies}(${JSON.stringify(asyncDeps)})`)})`;
|
||||
}
|
||||
break;
|
||||
case "dynamic":
|
||||
fakeType |= 4;
|
||||
/* fall through */
|
||||
case "default-with-named":
|
||||
fakeType |= 2;
|
||||
/* fall through */
|
||||
case "default-only":
|
||||
runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
|
||||
if (chunkGraph.moduleGraph.isAsync(module)) {
|
||||
appending += `.then(${RuntimeGlobals.makeDeferredNamespaceObject}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}, ${mode}))`;
|
||||
} else if (header) {
|
||||
appending = `.then(${this.basicFunction(
|
||||
"",
|
||||
`${header}return ${RuntimeGlobals.makeDeferredNamespaceObject}(${comment}${idExpr}, ${mode});`
|
||||
)})`;
|
||||
} else {
|
||||
runtimeRequirements.add(RuntimeGlobals.require);
|
||||
appending = `.then(${RuntimeGlobals.makeDeferredNamespaceObject}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}, ${mode}))`;
|
||||
}
|
||||
} else {
|
||||
let fakeType = 16;
|
||||
switch (exportsType) {
|
||||
case "namespace":
|
||||
if (header) {
|
||||
const rawModule = this.moduleRaw({
|
||||
module,
|
||||
@@ -736,23 +752,56 @@ class RuntimeTemplate {
|
||||
runtimeRequirements.add(RuntimeGlobals.require);
|
||||
appending = `.then(${RuntimeGlobals.require}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}))`;
|
||||
}
|
||||
appending += `.then(${this.returningFunction(
|
||||
`${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`,
|
||||
"m"
|
||||
)})`;
|
||||
} else {
|
||||
fakeType |= 1;
|
||||
if (header) {
|
||||
const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`;
|
||||
appending = `.then(${this.basicFunction(
|
||||
"",
|
||||
`${header}return ${returnExpression};`
|
||||
break;
|
||||
case "dynamic":
|
||||
fakeType |= 4;
|
||||
/* fall through */
|
||||
case "default-with-named":
|
||||
fakeType |= 2;
|
||||
/* fall through */
|
||||
case "default-only":
|
||||
runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
|
||||
if (chunkGraph.moduleGraph.isAsync(module)) {
|
||||
if (header) {
|
||||
const rawModule = this.moduleRaw({
|
||||
module,
|
||||
chunkGraph,
|
||||
request,
|
||||
weak,
|
||||
runtimeRequirements
|
||||
});
|
||||
appending = `.then(${this.basicFunction(
|
||||
"",
|
||||
`${header}return ${rawModule};`
|
||||
)})`;
|
||||
} else {
|
||||
runtimeRequirements.add(RuntimeGlobals.require);
|
||||
appending = `.then(${RuntimeGlobals.require}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}))`;
|
||||
}
|
||||
appending += `.then(${this.returningFunction(
|
||||
`${RuntimeGlobals.createFakeNamespaceObject}(m, ${fakeType})`,
|
||||
"m"
|
||||
)})`;
|
||||
} else {
|
||||
appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}, ${fakeType}))`;
|
||||
fakeType |= 1;
|
||||
if (header) {
|
||||
const moduleIdExpr = this.moduleId({
|
||||
module,
|
||||
chunkGraph,
|
||||
request,
|
||||
weak
|
||||
});
|
||||
const returnExpression = `${RuntimeGlobals.createFakeNamespaceObject}(${moduleIdExpr}, ${fakeType})`;
|
||||
appending = `.then(${this.basicFunction(
|
||||
"",
|
||||
`${header}return ${returnExpression};`
|
||||
)})`;
|
||||
} else {
|
||||
appending = `.then(${RuntimeGlobals.createFakeNamespaceObject}.bind(${RuntimeGlobals.require}, ${comment}${idExpr}, ${fakeType}))`;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return `${promise || "Promise.resolve()"}${appending}`;
|
||||
@@ -806,7 +855,7 @@ class RuntimeTemplate {
|
||||
* @param {Module} options.originModule module in which the statement is emitted
|
||||
* @param {boolean=} options.weak true, if this is a weak dependency
|
||||
* @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements
|
||||
* @param {boolean=} options.defer if set, the module will be deferred
|
||||
* @param {ModuleDependency} options.dependency module dependency
|
||||
* @returns {[string, string]} the import statement and the compat statement
|
||||
*/
|
||||
importStatement({
|
||||
@@ -818,7 +867,7 @@ class RuntimeTemplate {
|
||||
importVar,
|
||||
originModule,
|
||||
weak,
|
||||
defer,
|
||||
dependency,
|
||||
runtimeRequirements
|
||||
}) {
|
||||
if (!module) {
|
||||
@@ -866,15 +915,22 @@ class RuntimeTemplate {
|
||||
);
|
||||
runtimeRequirements.add(RuntimeGlobals.require);
|
||||
let importContent;
|
||||
if (defer && !(/** @type {BuildMeta} */ (module.buildMeta).async)) {
|
||||
|
||||
const isModuleDeferred =
|
||||
(dependency instanceof getHarmonyImportDependency() ||
|
||||
dependency instanceof getImportDependency()) &&
|
||||
ImportPhaseUtils.isDefer(dependency.phase) &&
|
||||
!(/** @type {BuildMeta} */ (module.buildMeta).async);
|
||||
|
||||
if (isModuleDeferred) {
|
||||
/** @type {Set<Module>} */
|
||||
const outgoingAsyncModules = getOutgoingAsyncModules(moduleGraph, module);
|
||||
|
||||
importContent = `/* deferred harmony import */ ${optDeclaration}${importVar} = ${getOptimizedDeferredModule(
|
||||
this,
|
||||
exportsType,
|
||||
moduleId,
|
||||
Array.from(outgoingAsyncModules, (mod) => chunkGraph.getModuleId(mod))
|
||||
exportsType,
|
||||
Array.from(outgoingAsyncModules, (mod) => chunkGraph.getModuleId(mod)),
|
||||
runtimeRequirements
|
||||
)};\n`;
|
||||
|
||||
return [importContent, ""];
|
||||
@@ -908,7 +964,7 @@ class RuntimeTemplate {
|
||||
* @param {InitFragment<GenerateContext>[]} options.initFragments init fragments will be added here
|
||||
* @param {RuntimeSpec} options.runtime runtime for which this code will be generated
|
||||
* @param {RuntimeRequirements} options.runtimeRequirements if set, will be filled with runtime requirements
|
||||
* @param {boolean=} options.defer if true, the module will be deferred.
|
||||
* @param {ModuleDependency} options.dependency module dependency
|
||||
* @returns {string} expression
|
||||
*/
|
||||
exportFromImport({
|
||||
@@ -926,7 +982,7 @@ class RuntimeTemplate {
|
||||
initFragments,
|
||||
runtime,
|
||||
runtimeRequirements,
|
||||
defer
|
||||
dependency
|
||||
}) {
|
||||
if (!module) {
|
||||
return this.missingModule({
|
||||
@@ -942,13 +998,16 @@ class RuntimeTemplate {
|
||||
(originModule.buildMeta).strictHarmonyModule
|
||||
);
|
||||
|
||||
const isDeferred =
|
||||
defer && !(/** @type {BuildMeta} */ (module.buildMeta).async);
|
||||
const isModuleDeferred =
|
||||
(dependency instanceof getHarmonyImportDependency() ||
|
||||
dependency instanceof getImportDependency()) &&
|
||||
ImportPhaseUtils.isDefer(dependency.phase) &&
|
||||
!(/** @type {BuildMeta} */ (module.buildMeta).async);
|
||||
|
||||
if (defaultInterop) {
|
||||
// when the defaultInterop is used (when a ESM imports a CJS module),
|
||||
if (exportName.length > 0 && exportName[0] === "default") {
|
||||
if (isDeferred && exportsType !== "namespace") {
|
||||
if (isModuleDeferred && exportsType !== "namespace") {
|
||||
const exportsInfo = moduleGraph.getExportsInfo(module);
|
||||
const name = exportName.slice(1);
|
||||
const used = exportsInfo.getUsedName(name, runtime);
|
||||
@@ -1002,7 +1061,7 @@ class RuntimeTemplate {
|
||||
) {
|
||||
return "/* __esModule */true";
|
||||
}
|
||||
} else if (isDeferred) {
|
||||
} else if (isModuleDeferred) {
|
||||
// now exportName.length is 0
|
||||
// fall through to the end of this function, create the namespace there.
|
||||
} else if (
|
||||
@@ -1045,7 +1104,7 @@ class RuntimeTemplate {
|
||||
? ""
|
||||
: `${Template.toNormalComment(propertyAccess(exportName))} `;
|
||||
const access = `${importVar}${
|
||||
isDeferred ? ".a" : ""
|
||||
isModuleDeferred ? ".a" : ""
|
||||
}${comment}${propertyAccess(used)}`;
|
||||
if (isCall && callContext === false) {
|
||||
return asiSafe
|
||||
@@ -1056,7 +1115,7 @@ class RuntimeTemplate {
|
||||
}
|
||||
return access;
|
||||
}
|
||||
if (isDeferred) {
|
||||
if (isModuleDeferred) {
|
||||
initFragments.push(
|
||||
new InitFragment(
|
||||
`var ${importVar}_deferred_namespace_cache;\n`,
|
||||
|
||||
Reference in New Issue
Block a user