rebuild hrm

This commit is contained in:
2026-04-13 09:30:59 +08:00
parent 44a98495ab
commit cd31c74da8
12034 changed files with 548007 additions and 451275 deletions

View File

@@ -9,10 +9,10 @@ export declare class ExpandArguments implements CommandParser {
parse(commandInfo: CommandInfo): {
command: string;
name: string;
env?: Record<string, unknown> | undefined;
cwd?: string | undefined;
prefixColor?: string | undefined;
ipc?: number | undefined;
raw?: boolean | undefined;
env?: Record<string, unknown>;
cwd?: string;
prefixColor?: string;
ipc?: number;
raw?: boolean;
};
}

View File

@@ -16,18 +16,20 @@ class ExpandArguments {
if (match.startsWith('\\')) {
return match.slice(1);
}
// Replace numeric placeholder if value exists in additional arguments.
if (!isNaN(placeholderTarget) &&
placeholderTarget <= this.additionalArguments.length) {
return (0, shell_quote_1.quote)([this.additionalArguments[placeholderTarget - 1]]);
}
// Replace all arguments placeholder.
if (placeholderTarget === '@') {
return (0, shell_quote_1.quote)(this.additionalArguments);
}
// Replace combined arguments placeholder.
if (placeholderTarget === '*') {
return (0, shell_quote_1.quote)([this.additionalArguments.join(' ')]);
if (this.additionalArguments.length > 0) {
// Replace numeric placeholder if value exists in additional arguments.
if (!isNaN(placeholderTarget) &&
placeholderTarget <= this.additionalArguments.length) {
return (0, shell_quote_1.quote)([this.additionalArguments[placeholderTarget - 1]]);
}
// Replace all arguments placeholder.
if (placeholderTarget === '@') {
return (0, shell_quote_1.quote)(this.additionalArguments);
}
// Replace combined arguments placeholder.
if (placeholderTarget === '*') {
return (0, shell_quote_1.quote)([this.additionalArguments.join(' ')]);
}
}
// Replace placeholder with empty string
// if value doesn't exist in additional arguments.

View File

@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpandWildcard = void 0;
const fs_1 = __importDefault(require("fs"));
const lodash_1 = __importDefault(require("lodash"));
const jsonc_1 = __importDefault(require("../jsonc"));
const utils_1 = require("../utils");
// Matches a negative filter surrounded by '(!' and ')'.
const OMISSION = /\(!([^)]+)\)/;
/**
@@ -28,7 +28,7 @@ class ExpandWildcard {
}
return jsonc_1.default.parse(json);
}
catch (e) {
catch {
return {};
}
}
@@ -37,7 +37,7 @@ class ExpandWildcard {
const json = fs_1.default.readFileSync('package.json', { encoding: 'utf-8' });
return JSON.parse(json);
}
catch (e) {
catch {
return {};
}
}
@@ -79,8 +79,8 @@ class ExpandWildcard {
}
const [, omission] = OMISSION.exec(scriptGlob) || [];
const scriptGlobSansOmission = scriptGlob.replace(OMISSION, '');
const preWildcard = lodash_1.default.escapeRegExp(scriptGlobSansOmission.slice(0, wildcardPosition));
const postWildcard = lodash_1.default.escapeRegExp(scriptGlobSansOmission.slice(wildcardPosition + 1));
const preWildcard = (0, utils_1.escapeRegExp)(scriptGlobSansOmission.slice(0, wildcardPosition));
const postWildcard = (0, utils_1.escapeRegExp)(scriptGlobSansOmission.slice(wildcardPosition + 1));
const wildcardRegex = new RegExp(`^${preWildcard}(.*?)${postWildcard}$`);
// If 'commandInfo.name' doesn't match 'scriptGlob', this means a custom name
// has been specified and thus becomes the prefix (as described in the README).
@@ -90,7 +90,8 @@ class ExpandWildcard {
if (omission && RegExp(omission).test(script)) {
return;
}
const [, match] = wildcardRegex.exec(script) || [];
const result = wildcardRegex.exec(script);
const match = result?.[1];
if (match !== undefined) {
return {
...commandInfo,

View File

@@ -7,10 +7,10 @@ export declare class StripQuotes implements CommandParser {
parse(commandInfo: CommandInfo): {
command: string;
name: string;
env?: Record<string, unknown> | undefined;
cwd?: string | undefined;
prefixColor?: string | undefined;
ipc?: number | undefined;
raw?: boolean | undefined;
env?: Record<string, unknown>;
cwd?: string;
prefixColor?: string;
ipc?: number;
raw?: boolean;
};
}