Enhance refactor commands with controller-aware Route() updates and fix code quality violations

Add semantic token highlighting for 'that' variable and comment file references in VS Code extension
Add Phone_Text_Input and Currency_Input components with formatting utilities
Implement client widgets, form standardization, and soft delete functionality
Add modal scroll lock and update documentation
Implement comprehensive modal system with form integration and validation
Fix modal component instantiation using jQuery plugin API
Implement modal system with responsive sizing, queuing, and validation support
Implement form submission with validation, error handling, and loading states
Implement country/state selectors with dynamic data loading and Bootstrap styling
Revert Rsx::Route() highlighting in Blade/PHP files
Target specific PHP scopes for Rsx::Route() highlighting in Blade
Expand injection selector for Rsx::Route() highlighting
Add custom syntax highlighting for Rsx::Route() and Rsx.Route() calls
Update jqhtml packages to v2.2.165
Add bundle path validation for common mistakes (development mode only)
Create Ajax_Select_Input widget and Rsx_Reference_Data controller
Create Country_Select_Input widget with default country support
Initialize Tom Select on Select_Input widgets
Add Tom Select bundle for enhanced select dropdowns
Implement ISO 3166 geographic data system for country/region selection
Implement widget-based form system with disabled state support

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-10-30 06:21:56 +00:00
parent e678b987c2
commit f6ac36c632
5683 changed files with 5854736 additions and 22329 deletions

82
node_modules/loader-runner/README.md generated vendored
View File

@@ -1,53 +1,51 @@
# loader-runner
``` js
```js
import { runLoaders } from "loader-runner";
runLoaders({
resource: "/abs/path/to/file.txt?query",
// String: Absolute path to the resource (optionally including query string)
runLoaders(
{
resource: "/abs/path/to/file.txt?query",
// String: Absolute path to the resource (optionally including query string)
loaders: ["/abs/path/to/loader.js?query"],
// String[]: Absolute paths to the loaders (optionally including query string)
// {loader, options}[]: Absolute paths to the loaders with options object
loaders: ["/abs/path/to/loader.js?query"],
// String[]: Absolute paths to the loaders (optionally including query string)
// {loader, options}[]: Absolute paths to the loaders with options object
context: { minimize: true },
// Additional loader context which is used as base context
context: { minimize: true },
// Additional loader context which is used as base context
processResource: (loaderContext, resourcePath, callback) => { ... },
// Optional: A function to process the resource
// Must have signature function(context, path, function(err, buffer))
// By default readResource is used and the resource is added a fileDependency
processResource: (loaderContext, resourcePath, callback) => {
// ...
},
// Optional: A function to process the resource
// Must have signature function(context, path, function(err, buffer))
// By default readResource is used and the resource is added a fileDependency
readResource: fs.readFile.bind(fs)
// Optional: A function to read the resource
// Only used when 'processResource' is not provided
// Must have signature function(path, function(err, buffer))
// By default fs.readFile is used
}, function(err, result) {
// err: Error?
// result.result: Buffer | String
// The result
// only available when no error occured
// result.resourceBuffer: Buffer
// The raw resource as Buffer (useful for SourceMaps)
// only available when no error occured
// result.cacheable: Bool
// Is the result cacheable or do it require reexecution?
// result.fileDependencies: String[]
// An array of paths (existing files) on which the result depends on
// result.missingDependencies: String[]
// An array of paths (not existing files) on which the result depends on
// result.contextDependencies: String[]
// An array of paths (directories) on which the result depends on
})
readResource: fs.readFile.bind(fs),
// Optional: A function to read the resource
// Only used when 'processResource' is not provided
// Must have signature function(path, function(err, buffer))
// By default fs.readFile is used
},
(err, result) => {
// err: Error?
// result.result: Buffer | String
// The result
// only available when no error occurred
// result.resourceBuffer: Buffer
// The raw resource as Buffer (useful for SourceMaps)
// only available when no error occurred
// result.cacheable: Bool
// Is the result cacheable or do it require reexecution?
// result.fileDependencies: String[]
// An array of paths (existing files) on which the result depends on
// result.missingDependencies: String[]
// An array of paths (not existing files) on which the result depends on
// result.contextDependencies: String[]
// An array of paths (directories) on which the result depends on
}
);
```
More documentation following...

2
node_modules/loader-runner/lib/LoaderLoadingError.js generated vendored Executable file → Normal file
View File

@@ -4,6 +4,8 @@ class LoadingLoaderError extends Error {
constructor(message) {
super(message);
this.name = "LoaderRunnerError";
// For old Node.js engines remove it then we drop them support
// eslint-disable-next-line unicorn/no-useless-error-capture-stack-trace
Error.captureStackTrace(this, this.constructor);
}
}

543
node_modules/loader-runner/lib/LoaderRunner.js generated vendored Executable file → Normal file
View File

@@ -2,49 +2,94 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
var fs = require("fs");
var readFile = fs.readFile.bind(fs);
var loadLoader = require("./loadLoader");
"use strict";
const fs = require("fs");
const readFile = fs.readFile.bind(fs);
const loadLoader = require("./loadLoader");
function utf8BufferToString(buf) {
var str = buf.toString("utf-8");
if(str.charCodeAt(0) === 0xFEFF) {
return str.substr(1);
} else {
return str;
const str = buf.toString("utf8");
if (str.charCodeAt(0) === 0xfeff) {
return str.slice(1);
}
return str;
}
const PATH_QUERY_FRAGMENT_REGEXP = /^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
const PATH_QUERY_FRAGMENT_REGEXP =
/^((?:\0.|[^?#\0])*)(\?(?:\0.|[^#\0])*)?(#.*)?$/;
const ZERO_ESCAPE_REGEXP = /\0(.)/g;
/**
* @param {string} str the path with query and fragment
* @returns {{ path: string, query: string, fragment: string }} parsed parts
* @param {string} identifier identifier
* @returns {[string, string, string]} parsed identifier
*/
function parsePathQueryFragment(str) {
var match = PATH_QUERY_FRAGMENT_REGEXP.exec(str);
return {
path: match[1].replace(/\0(.)/g, "$1"),
query: match[2] ? match[2].replace(/\0(.)/g, "$1") : "",
fragment: match[3] || ""
};
function parseIdentifier(identifier) {
// Fast path for inputs that don't use \0 escaping.
const firstEscape = identifier.indexOf("\0");
if (firstEscape < 0) {
const queryStart = identifier.indexOf("?");
const fragmentStart = identifier.indexOf("#");
if (fragmentStart < 0) {
if (queryStart < 0) {
// No fragment, no query
return [identifier, "", ""];
}
// Query, no fragment
return [
identifier.slice(0, queryStart),
identifier.slice(queryStart),
"",
];
}
if (queryStart < 0 || fragmentStart < queryStart) {
// Fragment, no query
return [
identifier.slice(0, fragmentStart),
"",
identifier.slice(fragmentStart),
];
}
// Query and fragment
return [
identifier.slice(0, queryStart),
identifier.slice(queryStart, fragmentStart),
identifier.slice(fragmentStart),
];
}
const match = PATH_QUERY_FRAGMENT_REGEXP.exec(identifier);
return [
match[1].replace(ZERO_ESCAPE_REGEXP, "$1"),
match[2] ? match[2].replace(ZERO_ESCAPE_REGEXP, "$1") : "",
match[3] || "",
];
}
function dirname(path) {
if(path === "/") return "/";
var i = path.lastIndexOf("/");
var j = path.lastIndexOf("\\");
var i2 = path.indexOf("/");
var j2 = path.indexOf("\\");
var idx = i > j ? i : j;
var idx2 = i > j ? i2 : j2;
if(idx < 0) return path;
if(idx === idx2) return path.substr(0, idx + 1);
return path.substr(0, idx);
if (path === "/") return "/";
const i = path.lastIndexOf("/");
const j = path.lastIndexOf("\\");
const i2 = path.indexOf("/");
const j2 = path.indexOf("\\");
const idx = i > j ? i : j;
const idx2 = i > j ? i2 : j2;
if (idx < 0) return path;
if (idx === idx2) return path.slice(0, idx + 1);
return path.slice(0, idx);
}
function createLoaderObject(loader) {
var obj = {
const obj = {
path: null,
query: null,
fragment: null,
@@ -55,152 +100,233 @@ function createLoaderObject(loader) {
raw: null,
data: null,
pitchExecuted: false,
normalExecuted: false
normalExecuted: false,
};
Object.defineProperty(obj, "request", {
enumerable: true,
get: function() {
return obj.path.replace(/#/g, "\0#") + obj.query.replace(/#/g, "\0#") + obj.fragment;
get() {
return (
obj.path.replace(/#/g, "\0#") +
obj.query.replace(/#/g, "\0#") +
obj.fragment
);
},
set: function(value) {
if(typeof value === "string") {
var splittedRequest = parsePathQueryFragment(value);
obj.path = splittedRequest.path;
obj.query = splittedRequest.query;
obj.fragment = splittedRequest.fragment;
set(value) {
if (typeof value === "string") {
const [path, query, fragment] = parseIdentifier(value);
obj.path = path;
obj.query = query;
obj.fragment = fragment;
obj.options = undefined;
obj.ident = undefined;
} else {
if(!value.loader)
throw new Error("request should be a string or object with loader and options (" + JSON.stringify(value) + ")");
if (!value.loader) {
throw new Error(
`request should be a string or object with loader and options (${JSON.stringify(
value
)})`
);
}
obj.path = value.loader;
obj.fragment = value.fragment || "";
obj.type = value.type;
obj.options = value.options;
obj.ident = value.ident;
if(obj.options === null)
if (obj.options === null) {
obj.query = "";
else if(obj.options === undefined)
} else if (obj.options === undefined) {
obj.query = "";
else if(typeof obj.options === "string")
obj.query = "?" + obj.options;
else if(obj.ident)
obj.query = "??" + obj.ident;
else if(typeof obj.options === "object" && obj.options.ident)
obj.query = "??" + obj.options.ident;
else
obj.query = "?" + JSON.stringify(obj.options);
} else if (typeof obj.options === "string") {
obj.query = `?${obj.options}`;
} else if (obj.ident) {
obj.query = `??${obj.ident}`;
} else if (typeof obj.options === "object" && obj.options.ident) {
obj.query = `??${obj.options.ident}`;
} else {
obj.query = `?${JSON.stringify(obj.options)}`;
}
}
}
},
});
obj.request = loader;
if(Object.preventExtensions) {
if (Object.preventExtensions) {
Object.preventExtensions(obj);
}
return obj;
}
function runSyncOrAsync(fn, context, args, callback) {
var isSync = true;
var isDone = false;
var isError = false; // internal error
var reportedError = false;
context.async = function async() {
if(isDone) {
if(reportedError) return; // ignore
throw new Error("async(): The callback was already called.");
}
isSync = false;
return innerCallback;
};
var innerCallback = context.callback = function() {
if(isDone) {
if(reportedError) return; // ignore
let isSync = true;
let isDone = false;
let isError = false; // internal error
let reportedError = false;
// eslint-disable-next-line func-name-matching
const innerCallback = (context.callback = function innerCallback() {
if (isDone) {
if (reportedError) return; // ignore
throw new Error("callback(): The callback was already called.");
}
isDone = true;
isSync = false;
try {
callback.apply(null, arguments);
} catch(e) {
} catch (err) {
isError = true;
throw e;
throw err;
}
});
context.async = function async() {
if (isDone) {
if (reportedError) return; // ignore
throw new Error("async(): The callback was already called.");
}
isSync = false;
return innerCallback;
};
try {
var result = (function LOADER_EXECUTION() {
const result = (function LOADER_EXECUTION() {
return fn.apply(context, args);
}());
if(isSync) {
})();
if (isSync) {
isDone = true;
if(result === undefined)
return callback();
if(result && typeof result === "object" && typeof result.then === "function") {
return result.then(function(r) {
if (result === undefined) return callback();
if (
result &&
typeof result === "object" &&
typeof result.then === "function"
) {
return result.then((r) => {
callback(null, r);
}, callback);
}
return callback(null, result);
}
} catch(e) {
if(isError) throw e;
if(isDone) {
} catch (err) {
if (isError) throw err;
if (isDone) {
// loader is already "done", so we cannot use the callback function
// for better debugging we print the error on the console
if(typeof e === "object" && e.stack) console.error(e.stack);
else console.error(e);
if (typeof err === "object" && err.stack) {
// eslint-disable-next-line no-console
console.error(err.stack);
} else {
// eslint-disable-next-line no-console
console.error(err);
}
return;
}
isDone = true;
reportedError = true;
callback(e);
callback(err);
}
}
function convertArgs(args, raw) {
if(!raw && Buffer.isBuffer(args[0]))
if (!raw && Buffer.isBuffer(args[0])) {
args[0] = utf8BufferToString(args[0]);
else if(raw && typeof args[0] === "string")
args[0] = Buffer.from(args[0], "utf-8");
} else if (raw && typeof args[0] === "string") {
args[0] = Buffer.from(args[0], "utf8");
}
}
function iterateNormalLoaders(options, loaderContext, args, callback) {
if (loaderContext.loaderIndex < 0) return callback(null, args);
const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
// iterate
if (currentLoaderObject.normalExecuted) {
loaderContext.loaderIndex--;
return iterateNormalLoaders(options, loaderContext, args, callback);
}
const fn = currentLoaderObject.normal;
currentLoaderObject.normalExecuted = true;
if (!fn) {
return iterateNormalLoaders(options, loaderContext, args, callback);
}
convertArgs(args, currentLoaderObject.raw);
runSyncOrAsync(fn, loaderContext, args, function runSyncOrAsyncCallback(err) {
if (err) return callback(err);
const args = Array.prototype.slice.call(arguments, 1);
iterateNormalLoaders(options, loaderContext, args, callback);
});
}
function processResource(options, loaderContext, callback) {
// set loader index to last loader
loaderContext.loaderIndex = loaderContext.loaders.length - 1;
const { resourcePath } = loaderContext;
if (resourcePath) {
options.processResource(
loaderContext,
resourcePath,
function processResourceCallback(err) {
if (err) return callback(err);
const args = Array.prototype.slice.call(arguments, 1);
[options.resourceBuffer] = args;
iterateNormalLoaders(options, loaderContext, args, callback);
}
);
} else {
iterateNormalLoaders(options, loaderContext, [null], callback);
}
}
function iteratePitchingLoaders(options, loaderContext, callback) {
// abort after last loader
if(loaderContext.loaderIndex >= loaderContext.loaders.length)
if (loaderContext.loaderIndex >= loaderContext.loaders.length) {
return processResource(options, loaderContext, callback);
}
var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
const currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
// iterate
if(currentLoaderObject.pitchExecuted) {
if (currentLoaderObject.pitchExecuted) {
loaderContext.loaderIndex++;
return iteratePitchingLoaders(options, loaderContext, callback);
}
// load loader module
loadLoader(currentLoaderObject, function(err) {
if(err) {
loadLoader(currentLoaderObject, (err) => {
if (err) {
loaderContext.cacheable(false);
return callback(err);
}
var fn = currentLoaderObject.pitch;
const fn = currentLoaderObject.pitch;
currentLoaderObject.pitchExecuted = true;
if(!fn) return iteratePitchingLoaders(options, loaderContext, callback);
if (!fn) return iteratePitchingLoaders(options, loaderContext, callback);
runSyncOrAsync(
fn,
loaderContext, [loaderContext.remainingRequest, loaderContext.previousRequest, currentLoaderObject.data = {}],
function(err) {
if(err) return callback(err);
var args = Array.prototype.slice.call(arguments, 1);
loaderContext,
[
loaderContext.remainingRequest,
loaderContext.previousRequest,
(currentLoaderObject.data = {}),
],
function runSyncOrAsyncCallback(err) {
if (err) return callback(err);
const args = Array.prototype.slice.call(arguments, 1);
// Determine whether to continue the pitching process based on
// argument values (as opposed to argument presence) in order
// to support synchronous and asynchronous usages.
var hasArg = args.some(function(value) {
return value !== undefined;
});
if(hasArg) {
const hasArg = args.some((value) => value !== undefined);
if (hasArg) {
loaderContext.loaderIndex--;
iterateNormalLoaders(options, loaderContext, args, callback);
} else {
@@ -211,78 +337,34 @@ function iteratePitchingLoaders(options, loaderContext, callback) {
});
}
function processResource(options, loaderContext, callback) {
// set loader index to last loader
loaderContext.loaderIndex = loaderContext.loaders.length - 1;
var resourcePath = loaderContext.resourcePath;
if(resourcePath) {
options.processResource(loaderContext, resourcePath, function(err) {
if(err) return callback(err);
var args = Array.prototype.slice.call(arguments, 1);
options.resourceBuffer = args[0];
iterateNormalLoaders(options, loaderContext, args, callback);
});
} else {
iterateNormalLoaders(options, loaderContext, [null], callback);
}
}
function iterateNormalLoaders(options, loaderContext, args, callback) {
if(loaderContext.loaderIndex < 0)
return callback(null, args);
var currentLoaderObject = loaderContext.loaders[loaderContext.loaderIndex];
// iterate
if(currentLoaderObject.normalExecuted) {
loaderContext.loaderIndex--;
return iterateNormalLoaders(options, loaderContext, args, callback);
}
var fn = currentLoaderObject.normal;
currentLoaderObject.normalExecuted = true;
if(!fn) {
return iterateNormalLoaders(options, loaderContext, args, callback);
}
convertArgs(args, currentLoaderObject.raw);
runSyncOrAsync(fn, loaderContext, args, function(err) {
if(err) return callback(err);
var args = Array.prototype.slice.call(arguments, 1);
iterateNormalLoaders(options, loaderContext, args, callback);
});
}
exports.getContext = function getContext(resource) {
var path = parsePathQueryFragment(resource).path;
module.exports.getContext = function getContext(resource) {
const [path] = parseIdentifier(resource);
return dirname(path);
};
exports.runLoaders = function runLoaders(options, callback) {
module.exports.runLoaders = function runLoaders(options, callback) {
// read options
var resource = options.resource || "";
var loaders = options.loaders || [];
var loaderContext = options.context || {};
var processResource = options.processResource || ((readResource, context, resource, callback) => {
context.addDependency(resource);
readResource(resource, callback);
}).bind(null, options.readResource || readFile);
const resource = options.resource || "";
let loaders = options.loaders || [];
const loaderContext = options.context || {};
const processResource =
options.processResource ||
((readResource, context, resource, callback) => {
context.addDependency(resource);
readResource(resource, callback);
}).bind(null, options.readResource || readFile);
//
var splittedResource = resource && parsePathQueryFragment(resource);
var resourcePath = splittedResource ? splittedResource.path : undefined;
var resourceQuery = splittedResource ? splittedResource.query : undefined;
var resourceFragment = splittedResource ? splittedResource.fragment : undefined;
var contextDirectory = resourcePath ? dirname(resourcePath) : null;
const splittedResource = resource && parseIdentifier(resource);
const resourcePath = splittedResource ? splittedResource[0] : "";
const resourceQuery = splittedResource ? splittedResource[1] : "";
const resourceFragment = splittedResource ? splittedResource[2] : "";
const contextDirectory = resourcePath ? dirname(resourcePath) : null;
// execution state
var requestCacheable = true;
var fileDependencies = [];
var contextDependencies = [];
var missingDependencies = [];
let requestCacheable = true;
const fileDependencies = [];
const contextDependencies = [];
const missingDependencies = [];
// prepare loader objects
loaders = loaders.map(createLoaderObject);
@@ -296,13 +378,14 @@ exports.runLoaders = function runLoaders(options, callback) {
loaderContext.async = null;
loaderContext.callback = null;
loaderContext.cacheable = function cacheable(flag) {
if(flag === false) {
if (flag === false) {
requestCacheable = false;
}
};
loaderContext.dependency = loaderContext.addDependency = function addDependency(file) {
fileDependencies.push(file);
};
loaderContext.dependency = loaderContext.addDependency =
function addDependency(file) {
fileDependencies.push(file);
};
loaderContext.addContextDependency = function addContextDependency(context) {
contextDependencies.push(context);
};
@@ -310,13 +393,13 @@ exports.runLoaders = function runLoaders(options, callback) {
missingDependencies.push(context);
};
loaderContext.getDependencies = function getDependencies() {
return fileDependencies.slice();
return [...fileDependencies];
};
loaderContext.getContextDependencies = function getContextDependencies() {
return contextDependencies.slice();
return [...contextDependencies];
};
loaderContext.getMissingDependencies = function getMissingDependencies() {
return missingDependencies.slice();
return [...missingDependencies];
};
loaderContext.clearDependencies = function clearDependencies() {
fileDependencies.length = 0;
@@ -326,91 +409,107 @@ exports.runLoaders = function runLoaders(options, callback) {
};
Object.defineProperty(loaderContext, "resource", {
enumerable: true,
get: function() {
if(loaderContext.resourcePath === undefined)
return undefined;
return loaderContext.resourcePath.replace(/#/g, "\0#") + loaderContext.resourceQuery.replace(/#/g, "\0#") + loaderContext.resourceFragment;
get() {
return (
loaderContext.resourcePath.replace(/#/g, "\0#") +
loaderContext.resourceQuery.replace(/#/g, "\0#") +
loaderContext.resourceFragment
);
},
set(value) {
const splittedResource = value && parseIdentifier(value);
loaderContext.resourcePath = splittedResource ? splittedResource[0] : "";
loaderContext.resourceQuery = splittedResource ? splittedResource[1] : "";
loaderContext.resourceFragment = splittedResource
? splittedResource[2]
: "";
},
set: function(value) {
var splittedResource = value && parsePathQueryFragment(value);
loaderContext.resourcePath = splittedResource ? splittedResource.path : undefined;
loaderContext.resourceQuery = splittedResource ? splittedResource.query : undefined;
loaderContext.resourceFragment = splittedResource ? splittedResource.fragment : undefined;
}
});
Object.defineProperty(loaderContext, "request", {
enumerable: true,
get: function() {
return loaderContext.loaders.map(function(o) {
return o.request;
}).concat(loaderContext.resource || "").join("!");
}
get() {
return loaderContext.loaders
.map((loader) => loader.request)
.concat(loaderContext.resource || "")
.join("!");
},
});
Object.defineProperty(loaderContext, "remainingRequest", {
enumerable: true,
get: function() {
if(loaderContext.loaderIndex >= loaderContext.loaders.length - 1 && !loaderContext.resource)
get() {
if (
loaderContext.loaderIndex >= loaderContext.loaders.length - 1 &&
!loaderContext.resource
) {
return "";
return loaderContext.loaders.slice(loaderContext.loaderIndex + 1).map(function(o) {
return o.request;
}).concat(loaderContext.resource || "").join("!");
}
}
return loaderContext.loaders
.slice(loaderContext.loaderIndex + 1)
.map((loader) => loader.request)
.concat(loaderContext.resource || "")
.join("!");
},
});
Object.defineProperty(loaderContext, "currentRequest", {
enumerable: true,
get: function() {
return loaderContext.loaders.slice(loaderContext.loaderIndex).map(function(o) {
return o.request;
}).concat(loaderContext.resource || "").join("!");
}
get() {
return loaderContext.loaders
.slice(loaderContext.loaderIndex)
.map((loader) => loader.request)
.concat(loaderContext.resource || "")
.join("!");
},
});
Object.defineProperty(loaderContext, "previousRequest", {
enumerable: true,
get: function() {
return loaderContext.loaders.slice(0, loaderContext.loaderIndex).map(function(o) {
return o.request;
}).join("!");
}
get() {
return loaderContext.loaders
.slice(0, loaderContext.loaderIndex)
.map((loader) => loader.request)
.join("!");
},
});
Object.defineProperty(loaderContext, "query", {
enumerable: true,
get: function() {
var entry = loaderContext.loaders[loaderContext.loaderIndex];
return entry.options && typeof entry.options === "object" ? entry.options : entry.query;
}
get() {
const entry = loaderContext.loaders[loaderContext.loaderIndex];
return entry.options && typeof entry.options === "object"
? entry.options
: entry.query;
},
});
Object.defineProperty(loaderContext, "data", {
enumerable: true,
get: function() {
get() {
return loaderContext.loaders[loaderContext.loaderIndex].data;
}
},
});
// finish loader context
if(Object.preventExtensions) {
if (Object.preventExtensions) {
Object.preventExtensions(loaderContext);
}
var processOptions = {
const processOptions = {
resourceBuffer: null,
processResource: processResource
processResource,
};
iteratePitchingLoaders(processOptions, loaderContext, function(err, result) {
if(err) {
iteratePitchingLoaders(processOptions, loaderContext, (err, result) => {
if (err) {
return callback(err, {
cacheable: requestCacheable,
fileDependencies: fileDependencies,
contextDependencies: contextDependencies,
missingDependencies: missingDependencies
fileDependencies,
contextDependencies,
missingDependencies,
});
}
callback(null, {
result: result,
result,
resourceBuffer: processOptions.resourceBuffer,
cacheable: requestCacheable,
fileDependencies: fileDependencies,
contextDependencies: contextDependencies,
missingDependencies: missingDependencies
fileDependencies,
contextDependencies,
missingDependencies,
});
});
};

114
node_modules/loader-runner/lib/loadLoader.js generated vendored Executable file → Normal file
View File

@@ -1,54 +1,80 @@
var LoaderLoadingError = require("./LoaderLoadingError");
var url;
"use strict";
module.exports = function loadLoader(loader, callback) {
if(loader.type === "module") {
try {
if(url === undefined) url = require("url");
var loaderUrl = url.pathToFileURL(loader.path);
var modulePromise = eval("import(" + JSON.stringify(loaderUrl.toString()) + ")");
modulePromise.then(function(module) {
handleResult(loader, module, callback);
}, callback);
return;
} catch(e) {
callback(e);
}
} else {
try {
var module = require(loader.path);
} catch(e) {
// 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(e instanceof Error && e.code === "EMFILE") {
var retry = loadLoader.bind(null, loader, callback);
if(typeof setImmediate === "function") {
// node >= 0.9.0
return setImmediate(retry);
} else {
// node < 0.9.0
return process.nextTick(retry);
}
}
return callback(e);
}
return handleResult(loader, module, callback);
}
};
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)"
));
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)"
));
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);
}
};

View File

@@ -1,45 +1,57 @@
{
"name": "loader-runner",
"version": "4.3.0",
"version": "4.3.1",
"description": "Runs (webpack) loaders",
"main": "lib/LoaderRunner.js",
"scripts": {
"lint": "eslint lib test",
"pretest": "npm run lint",
"test": "mocha --reporter spec",
"precover": "npm run lint",
"cover": "istanbul cover node_modules/mocha/bin/_mocha"
"keywords": ["webpack", "loader"],
"homepage": "https://github.com/webpack/loader-runner#readme",
"bugs": {
"url": "https://github.com/webpack/loader-runner/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/loader-runner.git"
},
"keywords": [
"webpack",
"loader"
],
"author": "Tobias Koppers @sokra",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/webpack/loader-runner/issues"
"author": "Tobias Koppers @sokra",
"main": "lib/LoaderRunner.js",
"files": ["lib/", "bin/", "hot/", "web_modules/", "schemas/"],
"scripts": {
"lint": "npm run lint:code && npm run fmt:check",
"lint:code": "eslint --cache .",
"fmt": "npm run fmt:base -- --log-level warn --write",
"fmt:check": "npm run fmt:base -- --check",
"fmt:base": "prettier --cache --ignore-unknown .",
"fix": "npm run fix:code && npm run fmt",
"fix:code": "npm run lint:code -- --fix",
"pretest": "npm run lint",
"test": "npm run test:basic",
"test:basic": "mocha --reporter spec",
"test:cover": "nyc --reporter=lcov npm run test:basic"
},
"homepage": "https://github.com/webpack/loader-runner#readme",
"engines": {
"node": ">=6.11.5"
},
"files": [
"lib/",
"bin/",
"hot/",
"web_modules/",
"schemas/"
],
"devDependencies": {
"eslint": "^3.12.2",
"eslint-plugin-node": "^3.0.5",
"eslint-plugin-nodeca": "^1.0.3",
"istanbul": "^0.4.1",
"@eslint/js": "^9.28.0",
"@eslint/markdown": "^7.1.0",
"@stylistic/eslint-plugin": "^5.2.3",
"globals": "^16.2.0",
"eslint": "^9.28.0",
"eslint-config-webpack": "^4.6.1",
"eslint-config-prettier": "^10.1.5",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^28.12.0",
"eslint-plugin-jsdoc": "^54.1.1",
"eslint-plugin-n": "^17.19.0",
"eslint-plugin-prettier": "^5.4.1",
"eslint-plugin-unicorn": "^60.0.0",
"prettier": "^3.5.3",
"nyc": "^14.1.1",
"mocha": "^3.2.0",
"should": "^8.0.2"
},
"engines": {
"node": ">=6.11.5"
}
}