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

View File

@@ -8,7 +8,11 @@
const AsyncDependenciesBlock = require("../AsyncDependenciesBlock");
const CommentCompilationWarning = require("../CommentCompilationWarning");
const UnsupportedFeatureWarning = require("../UnsupportedFeatureWarning");
const { getImportAttributes } = require("../javascript/JavascriptParser");
const {
VariableInfo,
getImportAttributes
} = require("../javascript/JavascriptParser");
const traverseDestructuringAssignmentProperties = require("../util/traverseDestructuringAssignmentProperties");
const ContextDependencyHelpers = require("./ContextDependencyHelpers");
const ImportContextDependency = require("./ImportContextDependency");
const ImportDependency = require("./ImportDependency");
@@ -19,10 +23,144 @@ const ImportWeakDependency = require("./ImportWeakDependency");
/** @typedef {import("../ChunkGroup").RawChunkGroupOptions} RawChunkGroupOptions */
/** @typedef {import("../ContextModule").ContextMode} ContextMode */
/** @typedef {import("../Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("../Dependency").RawReferencedExports} RawReferencedExports */
/** @typedef {import("../Module").BuildMeta} BuildMeta */
/** @typedef {import("../javascript/JavascriptParser")} JavascriptParser */
/** @typedef {import("../javascript/JavascriptParser").ImportExpression} ImportExpression */
/** @typedef {import("../javascript/JavascriptParser").Range} Range */
/** @typedef {import("../javascript/JavascriptParser").ParserState} ParserState */
/** @typedef {import("../javascript/JavascriptParser").Members} Members */
/** @typedef {import("../javascript/JavascriptParser").MembersOptionals} MembersOptionals */
/** @typedef {import("../javascript/JavascriptParser").ArrowFunctionExpression} ArrowFunctionExpression */
/** @typedef {import("../javascript/JavascriptParser").FunctionExpression} FunctionExpression */
/** @typedef {import("../javascript/JavascriptParser").Identifier} Identifier */
/** @typedef {import("../javascript/JavascriptParser").ObjectPattern} ObjectPattern */
/** @typedef {import("../javascript/JavascriptParser").CallExpression} CallExpression */
/** @typedef {{ references: RawReferencedExports, expression: ImportExpression }} ImportSettings */
/** @typedef {WeakMap<ImportExpression, RawReferencedExports>} State */
/** @type {WeakMap<ParserState, State>} */
const parserStateMap = new WeakMap();
const dynamicImportTag = Symbol("import()");
/**
* @param {JavascriptParser} parser javascript parser
* @returns {State} import parser plugin state
*/
function getState(parser) {
if (!parserStateMap.has(parser.state)) {
parserStateMap.set(parser.state, new WeakMap());
}
return /** @type {State} */ (parserStateMap.get(parser.state));
}
/**
* @param {JavascriptParser} parser javascript parser
* @param {ImportExpression} importCall import expression
* @param {string} variableName variable name
*/
function tagDynamicImportReferenced(parser, importCall, variableName) {
const state = getState(parser);
/** @type {RawReferencedExports} */
const references = state.get(importCall) || [];
state.set(importCall, references);
parser.tagVariable(
variableName,
dynamicImportTag,
/** @type {ImportSettings} */ ({
references,
expression: importCall
})
);
}
/**
* @param {CallExpression} importThen import().then() call
* @returns {Identifier | ObjectPattern | undefined} the dynamic imported namespace obj
*/
function getFulfilledCallbackNamespaceObj(importThen) {
const fulfilledCallback = importThen.arguments[0];
if (
fulfilledCallback &&
(fulfilledCallback.type === "ArrowFunctionExpression" ||
fulfilledCallback.type === "FunctionExpression") &&
fulfilledCallback.params[0] &&
(fulfilledCallback.params[0].type === "Identifier" ||
fulfilledCallback.params[0].type === "ObjectPattern")
) {
return fulfilledCallback.params[0];
}
}
/**
* @param {JavascriptParser} parser javascript parser
* @param {ImportExpression} importCall import expression
* @param {ArrowFunctionExpression | FunctionExpression} fulfilledCallback the fulfilled callback
* @param {Identifier | ObjectPattern} namespaceObjArg the argument of namespace object=
*/
function walkImportThenFulfilledCallback(
parser,
importCall,
fulfilledCallback,
namespaceObjArg
) {
const arrow = fulfilledCallback.type === "ArrowFunctionExpression";
const wasTopLevel = parser.scope.topLevelScope;
parser.scope.topLevelScope = arrow ? (wasTopLevel ? "arrow" : false) : false;
const scopeParams = [...fulfilledCallback.params];
// Add function name in scope for recursive calls
if (!arrow && fulfilledCallback.id) {
scopeParams.push(fulfilledCallback.id);
}
parser.inFunctionScope(!arrow, scopeParams, () => {
if (namespaceObjArg.type === "Identifier") {
tagDynamicImportReferenced(parser, importCall, namespaceObjArg.name);
} else {
parser.enterDestructuringAssignment(namespaceObjArg, importCall);
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(importCall);
if (referencedPropertiesInDestructuring) {
const state = getState(parser);
const references = /** @type {RawReferencedExports} */ (
state.get(importCall)
);
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
for (const ids of refsInDestructuring) {
references.push(ids);
}
}
}
for (const param of fulfilledCallback.params) {
parser.walkPattern(param);
}
if (fulfilledCallback.body.type === "BlockStatement") {
parser.detectMode(fulfilledCallback.body.body);
const prev = parser.prevStatement;
parser.preWalkStatement(fulfilledCallback.body);
parser.prevStatement = prev;
parser.walkStatement(fulfilledCallback.body);
} else {
parser.walkExpression(fulfilledCallback.body);
}
});
parser.scope.topLevelScope = wasTopLevel;
}
/**
* @template T
* @param {Iterable<T>} enumerable enumerable
* @returns {T[][]} array of array
*/
const exportsFromEnumerable = (enumerable) =>
Array.from(enumerable, (e) => [e]);
const PLUGIN_NAME = "ImportParserPlugin";
@@ -40,26 +178,94 @@ class ImportParserPlugin {
*/
apply(parser) {
/**
* @template T
* @param {Iterable<T>} enumerable enumerable
* @returns {T[][]} array of array
* @param {Members} members members
* @param {MembersOptionals} membersOptionals members Optionals
* @returns {string[]} a non optional part
*/
const exportsFromEnumerable = (enumerable) =>
Array.from(enumerable, (e) => [e]);
function getNonOptionalPart(members, membersOptionals) {
let i = 0;
while (i < members.length && membersOptionals[i] === false) i++;
return i !== members.length ? members.slice(0, i) : members;
}
parser.hooks.collectDestructuringAssignmentProperties.tap(
PLUGIN_NAME,
(expr) => {
if (expr.type === "ImportExpression") return true;
const nameInfo = parser.getNameForExpression(expr);
if (
nameInfo &&
nameInfo.rootInfo instanceof VariableInfo &&
nameInfo.rootInfo.name &&
parser.getTagData(nameInfo.rootInfo.name, dynamicImportTag)
) {
return true;
}
}
);
parser.hooks.importCall.tap(PLUGIN_NAME, (expr) => {
parser.hooks.preDeclarator.tap(PLUGIN_NAME, (decl) => {
if (
decl.init &&
decl.init.type === "AwaitExpression" &&
decl.init.argument.type === "ImportExpression" &&
decl.id.type === "Identifier"
) {
parser.defineVariable(decl.id.name);
tagDynamicImportReferenced(parser, decl.init.argument, decl.id.name);
}
});
parser.hooks.expression.for(dynamicImportTag).tap(PLUGIN_NAME, (expr) => {
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(expr);
if (referencedPropertiesInDestructuring) {
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
for (const ids of refsInDestructuring) {
settings.references.push(ids);
}
} else {
settings.references.push([]);
}
return true;
});
parser.hooks.expressionMemberChain
.for(dynamicImportTag)
.tap(PLUGIN_NAME, (_expression, members, membersOptionals) => {
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
const ids = getNonOptionalPart(members, membersOptionals);
settings.references.push(ids);
return true;
});
parser.hooks.callMemberChain
.for(dynamicImportTag)
.tap(PLUGIN_NAME, (expression, members, membersOptionals) => {
const { arguments: args } = expression;
const settings = /** @type {ImportSettings} */ (parser.currentTagData);
let ids = getNonOptionalPart(members, membersOptionals);
const directImport = members.length === 0;
if (
!directImport &&
(this.options.strictThisContextOnImports || ids.length > 1)
) {
ids = ids.slice(0, -1);
}
settings.references.push(ids);
if (args) parser.walkExpressions(args);
return true;
});
parser.hooks.importCall.tap(PLUGIN_NAME, (expr, importThen) => {
const param = parser.evaluateExpression(expr.source);
let chunkName = null;
let mode = /** @type {ContextMode} */ (this.options.dynamicImportMode);
let include = null;
let exclude = null;
/** @type {string[][] | null} */
/** @type {RawReferencedExports | null} */
let exports = null;
/** @type {RawChunkGroupOptions} */
const groupOptions = {};
@@ -245,7 +451,7 @@ class ImportParserPlugin {
!(
typeof importOptions.webpackExports === "string" ||
(Array.isArray(importOptions.webpackExports) &&
/** @type {string[]} */ (importOptions.webpackExports).every(
importOptions.webpackExports.every(
(item) => typeof item === "string"
))
)
@@ -281,19 +487,42 @@ class ImportParserPlugin {
const referencedPropertiesInDestructuring =
parser.destructuringAssignmentPropertiesFor(expr);
if (referencedPropertiesInDestructuring) {
const state = getState(parser);
const referencedPropertiesInMember = state.get(expr);
const fulfilledNamespaceObj =
importThen && getFulfilledCallbackNamespaceObj(importThen);
if (
referencedPropertiesInDestructuring ||
referencedPropertiesInMember ||
fulfilledNamespaceObj
) {
if (exports) {
parser.state.module.addWarning(
new UnsupportedFeatureWarning(
"`webpackExports` could not be used with destructuring assignment.",
"You don't need `webpackExports` if the usage of dynamic import is statically analyse-able. You can safely remove the `webpackExports` magic comment.",
/** @type {DependencyLocation} */ (expr.loc)
)
);
}
exports = exportsFromEnumerable(
[...referencedPropertiesInDestructuring].map(({ id }) => id)
);
if (referencedPropertiesInDestructuring) {
/** @type {RawReferencedExports} */
const refsInDestructuring = [];
traverseDestructuringAssignmentProperties(
referencedPropertiesInDestructuring,
(stack) => refsInDestructuring.push(stack.map((p) => p.id))
);
exports = refsInDestructuring;
} else if (referencedPropertiesInMember) {
exports = referencedPropertiesInMember;
} else {
/** @type {RawReferencedExports} */
const references = [];
state.set(expr, references);
exports = references;
}
}
if (param.isString()) {
@@ -335,39 +564,53 @@ class ImportParserPlugin {
depBlock.addDependency(dep);
parser.state.current.addBlock(depBlock);
}
return true;
} else {
if (mode === "weak") {
mode = "async-weak";
}
const dep = ContextDependencyHelpers.create(
ImportContextDependency,
/** @type {Range} */ (expr.range),
param,
expr,
this.options,
{
chunkName,
groupOptions,
include,
exclude,
mode,
namespaceObject:
/** @type {BuildMeta} */
(parser.state.module.buildMeta).strictHarmonyModule
? "strict"
: true,
typePrefix: "import()",
category: "esm",
referencedExports: exports,
attributes: getImportAttributes(expr)
},
parser
);
if (!dep) return;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = Boolean(parser.scope.inTry);
parser.state.current.addDependency(dep);
}
if (mode === "weak") {
mode = "async-weak";
if (fulfilledNamespaceObj) {
walkImportThenFulfilledCallback(
parser,
expr,
/** @type {ArrowFunctionExpression | FunctionExpression} */
(importThen.arguments[0]),
fulfilledNamespaceObj
);
parser.walkExpressions(importThen.arguments.slice(1));
} else if (importThen) {
parser.walkExpressions(importThen.arguments);
}
const dep = ContextDependencyHelpers.create(
ImportContextDependency,
/** @type {Range} */ (expr.range),
param,
expr,
this.options,
{
chunkName,
groupOptions,
include,
exclude,
mode,
namespaceObject:
/** @type {BuildMeta} */
(parser.state.module.buildMeta).strictHarmonyModule
? "strict"
: true,
typePrefix: "import()",
category: "esm",
referencedExports: exports,
attributes: getImportAttributes(expr)
},
parser
);
if (!dep) return;
dep.loc = /** @type {DependencyLocation} */ (expr.loc);
dep.optional = Boolean(parser.scope.inTry);
parser.state.current.addDependency(dep);
return true;
});
}