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:
root
2025-11-19 17:48:15 +00:00
parent 77b4d10af8
commit 9ebcc359ae
4360 changed files with 37751 additions and 18578 deletions

296
node_modules/webpack/lib/optimize/ConcatenatedModule.js generated vendored Executable file → Normal file
View File

@@ -22,8 +22,7 @@ const RuntimeGlobals = require("../RuntimeGlobals");
const Template = require("../Template");
const { DEFAULTS } = require("../config/defaults");
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
const HarmonyImportSideEffectDependency = require("../dependencies/HarmonyImportSideEffectDependency");
const HarmonyImportSpecifierDependency = require("../dependencies/HarmonyImportSpecifierDependency");
const { ImportPhaseUtils } = require("../dependencies/ImportPhase");
const JavascriptParser = require("../javascript/JavascriptParser");
const {
getMakeDeferredNamespaceModeFromExportsType,
@@ -167,6 +166,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
* @property {"external"} type
* @property {Module} module
* @property {RuntimeSpec | boolean} runtimeCondition
* @property {NonDeferAccess} nonDeferAccess
* @property {number} index
* @property {string | undefined} name module.exports / harmony namespace object
* @property {string | undefined} deferredName deferred module.exports / harmony namespace object
@@ -185,6 +185,7 @@ if (!ReferencerClass.prototype.PropertyDefinition) {
* @typedef {object} ReferenceToModuleInfo
* @property {"reference"} type
* @property {RuntimeSpec | boolean} runtimeCondition
* @property {NonDeferAccess} nonDeferAccess
* @property {ModuleInfo} target
*/
@@ -223,16 +224,6 @@ const compareNumbers = (a, b) => {
};
const bySourceOrder = createComparator("sourceOrder", compareNumbers);
const byRangeStart = createComparator("rangeStart", compareNumbers);
const moveDeferToLast = (
/** @type {{ defer?: boolean }} */ a,
/** @type {{ defer?: boolean }} */ b
) => {
if (a.defer === b.defer) return 0;
if (a.defer) return 1;
return -1;
};
const INITIAL_USED_NAMES = new Set(RESERVED_NAMES);
/**
* @param {Iterable<string>} iterable iterable object
@@ -254,11 +245,28 @@ const joinIterableWithComma = (iterable) => {
return str;
};
/** @typedef {boolean} NonDeferAccess */
/**
* @param {NonDeferAccess} a a
* @param {NonDeferAccess} b b
* @returns {NonDeferAccess} merged
*/
const mergeNonDeferAccess = (a, b) => a || b;
/**
* @param {NonDeferAccess} a first
* @param {NonDeferAccess} b second
* @returns {NonDeferAccess} first - second
*/
const subtractNonDeferAccess = (a, b) => a && !b;
/**
* @typedef {object} ConcatenationEntry
* @property {"concatenated" | "external"} type
* @property {Module} module
* @property {RuntimeSpec | boolean} runtimeCondition
* @property {NonDeferAccess} nonDeferAccess
*/
/** @typedef {Set<ConcatenatedModuleInfo>} NeededNamespaceObjects */
@@ -300,11 +308,11 @@ const getFinalBinding = (
moduleGraph,
strictHarmonyModule
);
const deferred =
depDeferred &&
const moduleDeferred =
info.type === "external" &&
info.deferred &&
!moduleGraph.isAsync(info.module);
!(/** @type {BuildMeta} */ (info.module.buildMeta).async);
const deferred = depDeferred && moduleDeferred;
if (exportName.length === 0) {
switch (exportsType) {
case "default-only":
@@ -391,6 +399,14 @@ const getFinalBinding = (
exportName
};
}
if (moduleDeferred) {
return {
info,
rawName: /** @type {string} */ (info.name),
ids: exportName,
exportName
};
}
info.interopDefaultAccessUsed = true;
const defaultExport = asCall
? `${info.interopDefaultAccessName}()`
@@ -951,13 +967,12 @@ class ConcatenatedModule extends Module {
_createConcatenationList(rootModule, modulesSet, runtime, moduleGraph) {
/** @type {ConcatenationEntry[]} */
const list = [];
/** @type {Map<Module, RuntimeSpec | true>} */
/** @type {Map<Module, { runtimeCondition: RuntimeSpec | true, nonDeferAccess: NonDeferAccess }>} */
const existingEntries = new Map();
const deferEnabled = this.compilation.options.experiments.deferImport;
/**
* @param {Module} module a module
* @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} imported modules in order
* @returns {Iterable<{ connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true, nonDeferAccess: NonDeferAccess }>} imported modules in order
*/
const getConcatenatedImports = (module) => {
const connections = [...moduleGraph.getOutgoingConnections(module)];
@@ -987,9 +1002,9 @@ class ConcatenatedModule extends Module {
(connection.dependency);
return {
connection,
sourceOrder: dep.sourceOrder,
sourceOrder: /** @type {number} */ (dep.sourceOrder),
rangeStart: dep.range && dep.range[0],
defer: dep.defer
defer: ImportPhaseUtils.isDefer(dep.phase)
};
});
/**
@@ -1004,27 +1019,27 @@ class ConcatenatedModule extends Module {
* a.a(); // first range
* b.b(); // second range
*
* If the import is deferred, we always move it to the last.
* If there is no reexport, we have the same source.
* If there is reexport, but module has side effects, this will lead to reexport module only.
* If there is side-effects-free reexport, we can get simple deterministic result with range start comparison.
*/
references.sort(concatComparators(bySourceOrder, byRangeStart));
if (deferEnabled) {
// do not combine those two sorts. defer is not the same as source or range which has a comparable number, defer is only moving them.
references.sort(moveDeferToLast);
}
/** @type {Map<Module, { connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true }>} */
/** @type {Map<Module, { connection: ModuleGraphConnection, runtimeCondition: RuntimeSpec | true, nonDeferAccess: NonDeferAccess }>} */
const referencesMap = new Map();
for (const { connection } of references) {
for (const { connection, defer } of references) {
const runtimeCondition = filterRuntime(runtime, (r) =>
connection.isTargetActive(r)
);
if (runtimeCondition === false) continue;
const nonDeferAccess = !defer;
const module = connection.module;
const entry = referencesMap.get(module);
if (entry === undefined) {
referencesMap.set(module, { connection, runtimeCondition });
referencesMap.set(module, {
connection,
runtimeCondition,
nonDeferAccess
});
continue;
}
entry.runtimeCondition = mergeRuntimeConditionNonFalse(
@@ -1032,6 +1047,10 @@ class ConcatenatedModule extends Module {
runtimeCondition,
runtime
);
entry.nonDeferAccess = mergeNonDeferAccess(
entry.nonDeferAccess,
nonDeferAccess
);
}
return referencesMap.values();
};
@@ -1039,17 +1058,25 @@ class ConcatenatedModule extends Module {
/**
* @param {ModuleGraphConnection} connection graph connection
* @param {RuntimeSpec | true} runtimeCondition runtime condition
* @param {NonDeferAccess} nonDeferAccess non-defer access
* @returns {void}
*/
const enterModule = (connection, runtimeCondition) => {
const enterModule = (connection, runtimeCondition, nonDeferAccess) => {
const module = connection.module;
if (!module) return;
const existingEntry = existingEntries.get(module);
if (existingEntry === true) {
if (
existingEntry &&
existingEntry.runtimeCondition === true &&
existingEntry.nonDeferAccess === true
) {
return;
}
if (modulesSet.has(module)) {
existingEntries.set(module, true);
existingEntries.set(module, {
runtimeCondition: true,
nonDeferAccess: true
});
if (runtimeCondition !== true) {
throw new Error(
`Cannot runtime-conditional concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}, ${runtimeConditionToString(
@@ -1057,34 +1084,66 @@ class ConcatenatedModule extends Module {
)}). This should not happen.`
);
}
if (nonDeferAccess !== true) {
throw new Error(
`Cannot deferred concatenate a module (${module.identifier()} in ${this.rootModule.identifier()}. This should not happen.`
);
}
const imports = getConcatenatedImports(module);
for (const { connection, runtimeCondition } of imports) {
enterModule(connection, runtimeCondition);
for (const {
connection,
runtimeCondition,
nonDeferAccess
} of imports) {
enterModule(connection, runtimeCondition, nonDeferAccess);
}
list.push({
type: "concatenated",
module: connection.module,
runtimeCondition
runtimeCondition,
nonDeferAccess
});
} else {
/** @type {RuntimeSpec | boolean} */
let reducedRuntimeCondition;
/** @type {NonDeferAccess} */
let reducedNonDeferAccess;
if (existingEntry !== undefined) {
const reducedRuntimeCondition = subtractRuntimeCondition(
reducedRuntimeCondition = subtractRuntimeCondition(
runtimeCondition,
existingEntry,
existingEntry.runtimeCondition,
runtime
);
if (reducedRuntimeCondition === false) return;
runtimeCondition = reducedRuntimeCondition;
existingEntries.set(
connection.module,
mergeRuntimeConditionNonFalse(
existingEntry,
runtimeCondition,
runtime
)
reducedNonDeferAccess = subtractNonDeferAccess(
nonDeferAccess,
existingEntry.nonDeferAccess
);
if (
reducedRuntimeCondition === false &&
reducedNonDeferAccess === false
) {
return;
}
if (reducedRuntimeCondition !== false) {
existingEntry.runtimeCondition = mergeRuntimeConditionNonFalse(
existingEntry.runtimeCondition,
reducedRuntimeCondition,
runtime
);
}
if (reducedNonDeferAccess !== false) {
existingEntry.nonDeferAccess = mergeNonDeferAccess(
existingEntry.nonDeferAccess,
reducedNonDeferAccess
);
}
} else {
existingEntries.set(connection.module, runtimeCondition);
reducedRuntimeCondition = runtimeCondition;
reducedNonDeferAccess = nonDeferAccess;
existingEntries.set(connection.module, {
runtimeCondition,
nonDeferAccess
});
}
if (list.length > 0) {
const lastItem = list[list.length - 1];
@@ -1094,9 +1153,13 @@ class ConcatenatedModule extends Module {
) {
lastItem.runtimeCondition = mergeRuntimeCondition(
lastItem.runtimeCondition,
runtimeCondition,
reducedRuntimeCondition,
runtime
);
lastItem.nonDeferAccess = mergeNonDeferAccess(
lastItem.nonDeferAccess,
reducedNonDeferAccess
);
return;
}
}
@@ -1108,20 +1171,25 @@ class ConcatenatedModule extends Module {
// concatenated module)
return connection.module;
},
runtimeCondition
runtimeCondition: reducedRuntimeCondition,
nonDeferAccess: reducedNonDeferAccess
});
}
};
existingEntries.set(rootModule, true);
existingEntries.set(rootModule, {
runtimeCondition: true,
nonDeferAccess: true
});
const imports = getConcatenatedImports(rootModule);
for (const { connection, runtimeCondition } of imports) {
enterModule(connection, runtimeCondition);
for (const { connection, runtimeCondition, nonDeferAccess } of imports) {
enterModule(connection, runtimeCondition, nonDeferAccess);
}
list.push({
type: "concatenated",
module: rootModule,
runtimeCondition: true
runtimeCondition: true,
nonDeferAccess: true
});
return list;
@@ -1207,18 +1275,8 @@ class ConcatenatedModule extends Module {
/** @type {NeededNamespaceObjects} */
const neededNamespaceObjects = new Set();
// Default disallowed names
const allUsedNames = new Set(INITIAL_USED_NAMES);
const chunks = chunkGraph.getModuleChunks(this);
// Add names already used in the current chunk scope
for (const chunk of chunks) {
if (ConcatenationScope.chunkUsedNames.has(chunk)) {
for (const name of ConcatenationScope.chunkUsedNames.get(chunk) || []) {
allUsedNames.add(name);
}
}
}
// List of all used names to avoid conflicts
const allUsedNames = new Set(RESERVED_NAMES);
// Generate source code and analyse scopes
// Prepare a ReplaceSource for the final source
@@ -1237,23 +1295,6 @@ class ConcatenatedModule extends Module {
);
}
// Record the names registered by the current ConcatenatedModule into the chunk scope
if (INITIAL_USED_NAMES.size !== allUsedNames.size) {
for (const name of allUsedNames) {
if (INITIAL_USED_NAMES.has(name)) continue;
for (const chunk of chunks) {
if (!ConcatenationScope.chunkUsedNames.has(chunk)) {
ConcatenationScope.chunkUsedNames.set(chunk, new Set([name]));
} else {
/** @type {Set<string>} */ (
ConcatenationScope.chunkUsedNames.get(chunk)
).add(name);
}
}
}
}
// Updated Top level declarations are created by renaming
/** @type {TopLevelDeclarations} */
const topLevelDeclarations = new Set();
@@ -1837,26 +1878,37 @@ ${defineGetters}`
if (info.type === "external" && info.deferred) {
const moduleId = JSON.stringify(chunkGraph.getModuleId(info.module));
const loader = getOptimizedDeferredModule(
runtimeTemplate,
moduleId,
info.module.getExportsType(
moduleGraph,
/** @type {BuildMeta} */
(this.rootModule.buildMeta).strictHarmonyModule
),
moduleId,
// an async module will opt-out of the concat module optimization.
[]
[],
runtimeRequirements
);
runtimeRequirements.add(RuntimeGlobals.require);
result.add(
`\n// DEFERRED EXTERNAL MODULE: ${info.module.readableIdentifier(requestShortener)}\nvar ${info.deferredName} = ${loader};`
);
if (info.deferredNamespaceObjectUsed) {
runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject);
result.add(
`\nvar ${info.deferredNamespaceObjectName} = /*#__PURE__*/${
RuntimeGlobals.makeDeferredNamespaceObject
}(${JSON.stringify(
chunkGraph.getModuleId(info.module)
)}, ${getMakeDeferredNamespaceModeFromExportsType(
info.module.getExportsType(moduleGraph, strictHarmonyModule)
)});`
);
}
}
}
/** @type {InitFragment<ChunkRenderContext>[]} */
const chunkInitFragments = [];
const deferEnabled = this.compilation.options.experiments.deferImport;
// evaluate modules in order
for (const rawInfo of modulesWithInfo) {
@@ -1868,41 +1920,6 @@ ${defineGetters}`
result.add(
`\n;// ${info.module.readableIdentifier(requestShortener)}\n`
);
// If a module is deferred in other places, but used as non-deferred here,
// the module itself will be emitted as mod_deferred (in the case "external"),
// we need to emit an extra import declaration to evaluate it in order.
if (deferEnabled) {
for (const dep of info.module.dependencies) {
if (
!(/** @type {HarmonyImportDependency} */ (dep).defer) &&
(dep instanceof HarmonyImportSideEffectDependency ||
dep instanceof HarmonyImportSpecifierDependency)
) {
const referredModule = moduleGraph.getModule(dep);
if (!referredModule) {
if (dep instanceof HarmonyImportSideEffectDependency) {
continue;
} else {
throw new Error(
"Deferred module used, but no module in the graph."
);
}
}
if (moduleGraph.isDeferred(referredModule)) {
const deferredModuleInfo = /** @type {ExternalModuleInfo} */ (
modulesWithInfo.find(
(i) =>
i.type === "external" && i.module === referredModule
)
);
if (!deferredModuleInfo) continue;
result.add(
`\n// non-deferred import to a deferred module (${referredModule.readableIdentifier(requestShortener)})\nvar ${deferredModuleInfo.name} = ${deferredModuleInfo.deferredName}.a;`
);
}
}
}
}
result.add(/** @type {ReplaceSource} */ (info.source));
if (info.chunkInitFragments) {
for (const f of info.chunkInitFragments) chunkInitFragments.push(f);
@@ -1943,24 +1960,23 @@ ${defineGetters}`
result.add(`var ${info.name} = __webpack_require__(${moduleId});`);
name = info.name;
}
// If a module is deferred in other places, but used as non-deferred here,
// the module itself will be emitted as mod_deferred (in the case "external"),
// we need to emit an extra import declaration to evaluate it in order.
const { nonDeferAccess } =
/** @type {ExternalModuleInfo | ReferenceToModuleInfo} */
(rawInfo);
if (info.deferred && nonDeferAccess) {
result.add(
`\n// non-deferred import to a deferred module (${info.module.readableIdentifier(requestShortener)})\nvar ${info.name} = ${info.deferredName}.a;`
);
}
break;
}
default:
// @ts-expect-error never is expected here
throw new Error(`Unsupported concatenation entry type ${info.type}`);
}
if (info.type === "external" && info.deferredNamespaceObjectUsed) {
runtimeRequirements.add(RuntimeGlobals.makeDeferredNamespaceObject);
result.add(
`\nvar ${info.deferredNamespaceObjectName} = /*#__PURE__*/${
RuntimeGlobals.makeDeferredNamespaceObject
}(${JSON.stringify(
chunkGraph.getModuleId(info.module)
)}, ${getMakeDeferredNamespaceModeFromExportsType(
info.module.getExportsType(moduleGraph, strictHarmonyModule)
)});`
);
}
if (info.interopNamespaceObjectUsed) {
runtimeRequirements.add(RuntimeGlobals.createFakeNamespaceObject);
result.add(
@@ -2049,11 +2065,19 @@ ${defineGetters}`
const data = codeGenResult.data;
const chunkInitFragments = data && data.get("chunkInitFragments");
const code = source.source().toString();
/** @type {Program} */
let ast;
try {
ast = JavascriptParser._parse(code, {
sourceType: "module"
});
({ ast } = JavascriptParser._parse(
code,
{
sourceType: "module",
ranges: true
},
JavascriptParser._getModuleParseFunction(this.compilation, m)
));
} catch (_err) {
const err =
/** @type {Error & { loc?: { line: number, column: number } }} */
@@ -2148,6 +2172,7 @@ ${defineGetters}`
type: "external",
module: info.module,
runtimeCondition: info.runtimeCondition,
nonDeferAccess: info.nonDeferAccess,
index,
name: undefined,
deferredName: undefined,
@@ -2177,6 +2202,7 @@ ${defineGetters}`
const ref = {
type: "reference",
runtimeCondition: info.runtimeCondition,
nonDeferAccess: info.nonDeferAccess,
target: item
};
return ref;