Files
rspade_system/node_modules/loader-runner/lib/loadLoader.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

81 lines
1.8 KiB
JavaScript
Executable File

"use strict";
const LoaderLoadingError = require("./LoaderLoadingError");
let url;
function handleResult(loader, module, callback) {
if (typeof module !== "function" && typeof module !== "object") {
return callback(
new LoaderLoadingError(
`Module '${
loader.path
}' is not a loader (export function or es6 module)`
)
);
}
loader.normal = typeof module === "function" ? module : module.default;
loader.pitch = module.pitch;
loader.raw = module.raw;
if (
typeof loader.normal !== "function" &&
typeof loader.pitch !== "function"
) {
return callback(
new LoaderLoadingError(
`Module '${
loader.path
}' is not a loader (must have normal or pitch function)`
)
);
}
callback();
}
module.exports = function loadLoader(loader, callback) {
if (loader.type === "module") {
try {
if (url === undefined) url = require("url");
// eslint-disable-next-line n/no-unsupported-features/node-builtins
const loaderUrl = url.pathToFileURL(loader.path);
// eslint-disable-next-line no-eval
const modulePromise = eval(
`import(${JSON.stringify(loaderUrl.toString())})`
);
modulePromise.then((module) => {
handleResult(loader, module, callback);
}, callback);
} catch (err) {
callback(err);
}
} else {
let loadedModule;
try {
loadedModule = require(loader.path);
} catch (err) {
// it is possible for node to choke on a require if the FD descriptor
// limit has been reached. give it a chance to recover.
if (err instanceof Error && err.code === "EMFILE") {
const retry = loadLoader.bind(null, loader, callback);
if (typeof setImmediate === "function") {
// node >= 0.9.0
return setImmediate(retry);
}
// node < 0.9.0
return process.nextTick(retry);
}
return callback(err);
}
return handleResult(loader, loadedModule, callback);
}
};