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>
71 lines
2.2 KiB
JavaScript
71 lines
2.2 KiB
JavaScript
/*
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
Author Natsu @xiaoxiaojx
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
const { updateHashForEntryStartup } = require("./StartupHelpers");
|
|
|
|
/** @typedef {import("../ChunkGraph")} ChunkGraph */
|
|
/** @typedef {import("../Module")} Module */
|
|
/** @typedef {import("../Chunk")} Chunk */
|
|
/** @typedef {import("../Entrypoint")} Entrypoint */
|
|
/** @typedef {import("../util/Hash")} Hash */
|
|
/** @typedef {import("../Compilation").ChunkHashContext} ChunkHashContext */
|
|
|
|
/**
|
|
* Gets information about a chunk including its entries and runtime chunk
|
|
* @param {Chunk} chunk The chunk to get information for
|
|
* @param {ChunkGraph} chunkGraph The chunk graph containing the chunk
|
|
* @returns {{ entries: [Module, Entrypoint | undefined][], runtimeChunk: Chunk | null }} Object containing chunk entries and runtime chunk
|
|
*/
|
|
function getChunkInfo(chunk, chunkGraph) {
|
|
const entries = [
|
|
...chunkGraph.getChunkEntryModulesWithChunkGroupIterable(chunk)
|
|
];
|
|
const runtimeChunk =
|
|
entries.length > 0
|
|
? /** @type {Entrypoint[][]} */
|
|
(entries)[0][1].getRuntimeChunk()
|
|
: null;
|
|
|
|
return {
|
|
entries,
|
|
runtimeChunk
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Creates a chunk hash handler
|
|
* @param {string} name The name of the chunk
|
|
* @returns {(chunk: Chunk, hash: Hash, { chunkGraph }: ChunkHashContext) => void} The chunk hash handler
|
|
*/
|
|
function createChunkHashHandler(name) {
|
|
/**
|
|
* @param {Chunk} chunk The chunk to get information for
|
|
* @param {Hash} hash The hash to update
|
|
* @param {ChunkHashContext} chunkHashContext The chunk hash context
|
|
* @returns {void}
|
|
*/
|
|
return (chunk, hash, { chunkGraph }) => {
|
|
if (chunk.hasRuntime()) return;
|
|
const { entries, runtimeChunk } = getChunkInfo(chunk, chunkGraph);
|
|
hash.update(name);
|
|
hash.update("1");
|
|
if (runtimeChunk && runtimeChunk.hash) {
|
|
// https://github.com/webpack/webpack/issues/19439
|
|
// Any change to runtimeChunk should trigger a hash update,
|
|
// we shouldn't depend on or inspect its internal implementation.
|
|
// import __webpack_require__ from "./runtime-main.e9400aee33633a3973bd.js";
|
|
hash.update(runtimeChunk.hash);
|
|
}
|
|
updateHashForEntryStartup(hash, chunkGraph, entries, chunk);
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
createChunkHashHandler,
|
|
getChunkInfo
|
|
};
|