Files
rspade_system/node_modules/webpack/lib/wasm-sync/WebAssemblyInInitialChunkError.js
root 77b4d10af8 Refactor filename naming system and apply convention-based renames
Standardize settings file naming and relocate documentation files
Fix code quality violations from rsx:check
Reorganize user_management directory into logical subdirectories
Move Quill Bundle to core and align with Tom Select pattern
Simplify Site Settings page to focus on core site information
Complete Phase 5: Multi-tenant authentication with login flow and site selection
Add route query parameter rule and synchronize filename validation logic
Fix critical bug in UpdateNpmCommand causing missing JavaScript stubs
Implement filename convention rule and resolve VS Code auto-rename conflict
Implement js-sanitizer RPC server to eliminate 900+ Node.js process spawns
Implement RPC server architecture for JavaScript parsing
WIP: Add RPC server infrastructure for JS parsing (partial implementation)
Update jqhtml terminology from destroy to stop, fix datagrid DOM preservation
Add JQHTML-CLASS-01 rule and fix redundant class names
Improve code quality rules and resolve violations
Remove legacy fatal error format in favor of unified 'fatal' error type
Filter internal keys from window.rsxapp output
Update button styling and comprehensive form/modal documentation
Add conditional fly-in animation for modals
Fix non-deterministic bundle compilation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-13 19:10:02 +00:00

110 lines
3.1 KiB
JavaScript
Executable File

/*
MIT License http://www.opensource.org/licenses/mit-license.php
*/
"use strict";
const WebpackError = require("../WebpackError");
/** @typedef {import("../ChunkGraph")} ChunkGraph */
/** @typedef {import("../Module")} Module */
/** @typedef {import("../ModuleGraph")} ModuleGraph */
/** @typedef {import("../RequestShortener")} RequestShortener */
/**
* @param {Module} module module to get chains from
* @param {ModuleGraph} moduleGraph the module graph
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {RequestShortener} requestShortener to make readable identifiers
* @returns {string[]} all chains to the module
*/
const getInitialModuleChains = (
module,
moduleGraph,
chunkGraph,
requestShortener
) => {
const queue = [
{ head: module, message: module.readableIdentifier(requestShortener) }
];
/** @type {Set<string>} */
const results = new Set();
/** @type {Set<string>} */
const incompleteResults = new Set();
/** @type {Set<Module>} */
const visitedModules = new Set();
for (const chain of queue) {
const { head, message } = chain;
let final = true;
/** @type {Set<Module>} */
const alreadyReferencedModules = new Set();
for (const connection of moduleGraph.getIncomingConnections(head)) {
const newHead = connection.originModule;
if (newHead) {
if (
!chunkGraph.getModuleChunks(newHead).some((c) => c.canBeInitial())
) {
continue;
}
final = false;
if (alreadyReferencedModules.has(newHead)) continue;
alreadyReferencedModules.add(newHead);
const moduleName = newHead.readableIdentifier(requestShortener);
const detail = connection.explanation
? ` (${connection.explanation})`
: "";
const newMessage = `${moduleName}${detail} --> ${message}`;
if (visitedModules.has(newHead)) {
incompleteResults.add(`... --> ${newMessage}`);
continue;
}
visitedModules.add(newHead);
queue.push({
head: newHead,
message: newMessage
});
} else {
final = false;
const newMessage = connection.explanation
? `(${connection.explanation}) --> ${message}`
: message;
results.add(newMessage);
}
}
if (final) {
results.add(message);
}
}
for (const result of incompleteResults) {
results.add(result);
}
return [...results];
};
module.exports = class WebAssemblyInInitialChunkError extends WebpackError {
/**
* @param {Module} module WASM module
* @param {ModuleGraph} moduleGraph the module graph
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {RequestShortener} requestShortener request shortener
*/
constructor(module, moduleGraph, chunkGraph, requestShortener) {
const moduleChains = getInitialModuleChains(
module,
moduleGraph,
chunkGraph,
requestShortener
);
const message = `WebAssembly module is included in initial chunk.
This is not allowed, because WebAssembly download and compilation must happen asynchronous.
Add an async split point (i. e. import()) somewhere between your entrypoint and the WebAssembly module:
${moduleChains.map((s) => `* ${s}`).join("\n")}`;
super(message);
this.name = "WebAssemblyInInitialChunkError";
this.hideStack = true;
this.module = module;
}
};