@poe-platform/safe-bash 0.1.772 → 0.1.774
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/image-ast/index.browser.js +3543 -706
- package/dist/image-ast/index.js +3543 -706
- package/dist/pdf-ast/ast.d.ts +7 -0
- package/dist/pdf-ast/content/evaluator.d.ts +1 -0
- package/dist/pdf-ast/index.js +3587 -718
- package/dist/pdf-ast/render/raster.d.ts +1 -0
- package/dist/pdf-ast/vendor/pdfjs-fonts.d.mts +36 -0
- package/dist/pdf-ast/vendor/pdfjs-fonts.mjs +3323 -0
- package/dist/safe-bash/command-chunks/{chunk-M2XU2YCK.js → chunk-4ZHDCMQX.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-NBENXODJ.js → chunk-HH5QPKIN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-C4AAJTXF.js → chunk-PM63UJE6.js} +3546 -706
- package/dist/safe-bash/core.browser.js +101 -45
- package/dist/safe-bash/core.d.ts +1 -1
- package/dist/safe-bash/plugins/composition.d.ts +2 -0
- package/dist/safe-bash/plugins/composition.js +2 -1
- package/dist/safe-bash/shell/runtime.js +17 -9
- package/dist/safe-bash/shell/sync-posix-regex.d.ts +3 -0
- package/dist/safe-bash/shell/sync-posix-regex.js +48 -0
- package/dist/safe-bash-command-ffmpeg/index.js +11032 -9579
- package/dist/safe-bash-command-gh/index.d.ts +1 -0
- package/dist/safe-bash-command-gh/index.js +43 -13
- package/dist/safe-bash-command-gh/types.d.ts +1 -0
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/index.js +22 -15
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-gpg/index.js +28 -7
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-openssl/index.js +24 -6
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +3542 -660
- package/dist/safe-bash-command-pdfinfo/index.js +3584 -718
- package/dist/safe-bash-command-pdftk/index.js +3542 -660
- package/dist/safe-bash-command-pdftoppm/index.js +3589 -787
- package/dist/safe-bash-command-pdftotext/index.js +3542 -660
- package/dist/safe-bash-command-qpdf/index.js +3542 -660
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +1 -1
- package/dist/safe-bash-command-ssconvert/index.js +3553 -716
- package/dist/safe-bash-command-ssh/index.js +124 -23
- package/dist/safe-bash-command-wkhtmltopdf/index.js +3581 -660
- package/dist/safe-bash-mcp/index.d.ts +8 -2
- package/dist/safe-bash-mcp/index.js +13 -6
- package/package.json +7 -7
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +84 -1
|
@@ -1102,6 +1102,43 @@ import * as bounded_provider_star from "../safe-bash-regex-engine/execution/boun
|
|
|
1102
1102
|
// packages/safe-bash/src/plugins/composition.ts
|
|
1103
1103
|
init_platform();
|
|
1104
1104
|
|
|
1105
|
+
// packages/safe-bash/src/commands/gh/index.ts
|
|
1106
|
+
var gh_exports = {};
|
|
1107
|
+
__export(gh_exports, {
|
|
1108
|
+
createGhCommand: () => createGhCommand,
|
|
1109
|
+
createGhCommands: () => createGhCommands,
|
|
1110
|
+
evalSyncGh: () => evalSyncGh,
|
|
1111
|
+
ghCommands: () => ghCommands
|
|
1112
|
+
});
|
|
1113
|
+
init_platform();
|
|
1114
|
+
__reExport(gh_exports, safe_bash_command_gh_star);
|
|
1115
|
+
import {
|
|
1116
|
+
createGhCommand as createRawGhCommand,
|
|
1117
|
+
createGhCommands as createRawGhCommands,
|
|
1118
|
+
evalSyncGh
|
|
1119
|
+
} from "../safe-bash-command-gh/index.js";
|
|
1120
|
+
import * as safe_bash_command_gh_star from "../safe-bash-command-gh/index.js";
|
|
1121
|
+
function createGhCommand(options8 = {}) {
|
|
1122
|
+
const def = createRawGhCommand(options8);
|
|
1123
|
+
internal_exports.builtInDirectContextExecutors.add(def.execute);
|
|
1124
|
+
return def;
|
|
1125
|
+
}
|
|
1126
|
+
function createGhCommands(options8 = {}) {
|
|
1127
|
+
const defs = createRawGhCommands(options8);
|
|
1128
|
+
for (let i = 0; i < defs.length; i++) internal_exports.builtInDirectContextExecutors.add(defs[i].execute);
|
|
1129
|
+
return defs;
|
|
1130
|
+
}
|
|
1131
|
+
function ghCommands(options8 = {}) {
|
|
1132
|
+
const command4 = createGhCommand(options8);
|
|
1133
|
+
return {
|
|
1134
|
+
name: "gh-commands",
|
|
1135
|
+
setup(host2) {
|
|
1136
|
+
host2.commands.register(command4, { replace: options8.replace ?? false });
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
}
|
|
1140
|
+
internal_exports.syncCommandEvaluators.evalSyncGh = evalSyncGh;
|
|
1141
|
+
|
|
1105
1142
|
// packages/safe-bash/src/commands/standard.ts
|
|
1106
1143
|
init_platform();
|
|
1107
1144
|
|
|
@@ -8203,7 +8240,7 @@ var TR_CHARACTER_CLASSES = (() => {
|
|
|
8203
8240
|
})();
|
|
8204
8241
|
var TR_CONTROLS = { a: 7, b: 8, f: 12, n: 10, r: 13, t: 9, v: 11, "\\": 92 };
|
|
8205
8242
|
function characterSet(specification, repeatLength, translatingSecond = false) {
|
|
8206
|
-
const
|
|
8243
|
+
const classes2 = TR_CHARACTER_CLASSES;
|
|
8207
8244
|
const tokens = [];
|
|
8208
8245
|
const readCharacter = (offset) => {
|
|
8209
8246
|
if (specification[offset] === "\\") {
|
|
@@ -8227,7 +8264,7 @@ function characterSet(specification, repeatLength, translatingSecond = false) {
|
|
|
8227
8264
|
const classEnd = specification.startsWith("[:", offset) ? specification.indexOf(":]", offset + 2) : -1;
|
|
8228
8265
|
if (classEnd !== -1 && specification.indexOf("]", offset + 2) === classEnd + 1) {
|
|
8229
8266
|
const name2 = specification.slice(offset + 2, classEnd);
|
|
8230
|
-
const bytes6 = Object.hasOwn(
|
|
8267
|
+
const bytes6 = Object.hasOwn(classes2, name2) ? classes2[name2] : void 0;
|
|
8231
8268
|
if (!bytes6) throw new internal_exports.UsageError(`unknown character class '${name2}'`);
|
|
8232
8269
|
if (translatingSecond && name2 !== "upper" && name2 !== "lower") {
|
|
8233
8270
|
throw new diagnostics_exports.PublicDiagnostic("when translating, the only character classes that may appear in string2 are 'upper' and 'lower'");
|
|
@@ -43560,7 +43597,7 @@ function hasCustomFamilyOptions(options8) {
|
|
|
43560
43597
|
return options8.text !== void 0 || options8.structured !== void 0 || options8.bytes !== void 0 || options8.diffPatch !== void 0 || options8.metadata !== void 0 || options8.archive !== void 0 || options8.tableText !== void 0 || options8.streamInspection !== void 0 || options8.streamFormat !== void 0 || options8.split !== void 0 || options8.timeEnv !== void 0 || options8.tree !== void 0 || options8.file !== void 0 || options8.column !== void 0 || options8.htmlToMarkdown !== void 0 || options8.du !== void 0 || options8.which !== void 0 || options8.timeout !== void 0 || options8.applyPatch !== void 0 || options8.xml !== void 0 || options8.pr !== void 0 || options8.tsort !== void 0 || options8.factor !== void 0 || options8.getopt !== void 0 || options8.hexdump !== void 0 || options8.iconv !== void 0 || options8.lineEndings !== void 0 || options8.bc !== void 0 || options8.sponge !== void 0 || options8.fd !== void 0 || options8.less !== void 0 || options8.sqlite3 !== void 0 || options8.muscleMemory !== void 0 || options8.mdq !== void 0;
|
|
43561
43598
|
}
|
|
43562
43599
|
function composeRawAgentCommands(options8, executors) {
|
|
43563
|
-
const commands = [];
|
|
43600
|
+
const commands = [...createGhCommands(options8.gh)];
|
|
43564
43601
|
const useErgonomicGrep = options8.regexExecutor === void 0;
|
|
43565
43602
|
const grep = (0, grep_exports.createGrepCommands)(executors.grep, { ergonomicRegex: useErgonomicGrep });
|
|
43566
43603
|
const exprLimits = options8.expr?.limits;
|
|
@@ -49015,6 +49052,55 @@ var ShellInput = class _ShellInput {
|
|
|
49015
49052
|
// packages/safe-bash/src/shell/runtime.ts
|
|
49016
49053
|
init_platform();
|
|
49017
49054
|
|
|
49055
|
+
// packages/safe-bash/src/shell/sync-posix-regex.ts
|
|
49056
|
+
init_platform();
|
|
49057
|
+
var classes = {
|
|
49058
|
+
digit: "0-9",
|
|
49059
|
+
alpha: "A-Za-z",
|
|
49060
|
+
alnum: "A-Za-z0-9",
|
|
49061
|
+
upper: "A-Z",
|
|
49062
|
+
lower: "a-z",
|
|
49063
|
+
blank: " \\t",
|
|
49064
|
+
space: " \\t\\r\\n\\v\\f",
|
|
49065
|
+
xdigit: "A-Fa-f0-9",
|
|
49066
|
+
punct: "!-/:-@\\[-`{-~",
|
|
49067
|
+
cntrl: "\\x00-\\x1f\\x7f",
|
|
49068
|
+
graph: "!-~",
|
|
49069
|
+
print: " -~"
|
|
49070
|
+
};
|
|
49071
|
+
function syncPosixRegexSource(source) {
|
|
49072
|
+
let output10 = "";
|
|
49073
|
+
let inBracket = false;
|
|
49074
|
+
let bracketStart = 0;
|
|
49075
|
+
for (let i = 0; i < source.length; i++) {
|
|
49076
|
+
const char = source[i];
|
|
49077
|
+
if (char === "\\") {
|
|
49078
|
+
output10 += source.slice(i, i + 2);
|
|
49079
|
+
i++;
|
|
49080
|
+
continue;
|
|
49081
|
+
}
|
|
49082
|
+
if (inBracket && char === "[" && source[i + 1] === ":") {
|
|
49083
|
+
const end = source.indexOf(":]", i + 2);
|
|
49084
|
+
if (end === -1) return void 0;
|
|
49085
|
+
const name2 = source.slice(i + 2, end);
|
|
49086
|
+
if (!Object.hasOwn(classes, name2)) return void 0;
|
|
49087
|
+
output10 += classes[name2];
|
|
49088
|
+
i = end + 1;
|
|
49089
|
+
continue;
|
|
49090
|
+
}
|
|
49091
|
+
if (char === "[" && !inBracket) {
|
|
49092
|
+
inBracket = true;
|
|
49093
|
+
bracketStart = i + 1 + (source[i + 1] === "^" ? 1 : 0);
|
|
49094
|
+
if (source[bracketStart] === "]") return void 0;
|
|
49095
|
+
} else if (char === "]" && inBracket) {
|
|
49096
|
+
inBracket = false;
|
|
49097
|
+
}
|
|
49098
|
+
if (inBracket && char === "[" && (source[i + 1] === "." || source[i + 1] === "=")) return void 0;
|
|
49099
|
+
output10 += char;
|
|
49100
|
+
}
|
|
49101
|
+
return output10;
|
|
49102
|
+
}
|
|
49103
|
+
|
|
49018
49104
|
// packages/safe-bash/src/shell/sync-jq-expression.ts
|
|
49019
49105
|
init_platform();
|
|
49020
49106
|
function compareSyncJqStrings(left, right) {
|
|
@@ -83802,7 +83888,8 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
83802
83888
|
if (subExprs.length === 0) return void 0;
|
|
83803
83889
|
const compileSedAddrRe = (patSpec) => {
|
|
83804
83890
|
if (patSpec.length === 0 || patSpec.includes("[.") || patSpec.includes("[=") || /\\[1-9]/.test(patSpec)) return void 0;
|
|
83805
|
-
const normPat = patSpec
|
|
83891
|
+
const normPat = syncPosixRegexSource(patSpec);
|
|
83892
|
+
if (normPat === void 0) return void 0;
|
|
83806
83893
|
const jsPat = isExtended ? normPat : normPat.replace(/\\([+?()|])/g, "$1");
|
|
83807
83894
|
try {
|
|
83808
83895
|
return new RegExp(jsPat);
|
|
@@ -84831,8 +84918,10 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
84831
84918
|
if (patM) {
|
|
84832
84919
|
const inv = patM[1] === "!";
|
|
84833
84920
|
let re;
|
|
84921
|
+
const source = syncPosixRegexSource(patM[2]);
|
|
84922
|
+
if (source === void 0) return void 0;
|
|
84834
84923
|
try {
|
|
84835
|
-
re = new RegExp(
|
|
84924
|
+
re = new RegExp(source);
|
|
84836
84925
|
} catch {
|
|
84837
84926
|
return void 0;
|
|
84838
84927
|
}
|
|
@@ -84843,8 +84932,10 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
84843
84932
|
const fTok = fPatM[1];
|
|
84844
84933
|
const inv = fPatM[2] === "!~";
|
|
84845
84934
|
let re;
|
|
84935
|
+
const source = syncPosixRegexSource(fPatM[3]);
|
|
84936
|
+
if (source === void 0) return void 0;
|
|
84846
84937
|
try {
|
|
84847
|
-
re = new RegExp(
|
|
84938
|
+
re = new RegExp(source);
|
|
84848
84939
|
} catch {
|
|
84849
84940
|
return void 0;
|
|
84850
84941
|
}
|
|
@@ -85449,8 +85540,10 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
85449
85540
|
const parseSecSpec = (v) => {
|
|
85450
85541
|
if (v === "a" || v === "t" || v === "n") return { style: v };
|
|
85451
85542
|
if (v.startsWith("p") && v.length > 1) {
|
|
85543
|
+
const source = syncPosixRegexSource(v.slice(1));
|
|
85544
|
+
if (source === void 0) return void 0;
|
|
85452
85545
|
try {
|
|
85453
|
-
return { style: "p", re: new RegExp(
|
|
85546
|
+
return { style: "p", re: new RegExp(source) };
|
|
85454
85547
|
} catch {
|
|
85455
85548
|
return void 0;
|
|
85456
85549
|
}
|
|
@@ -86071,7 +86164,7 @@ ${prefix2} line ${offset + line}: \`${source.split("\n")[line - 1] ?? ""}'
|
|
|
86071
86164
|
}
|
|
86072
86165
|
}
|
|
86073
86166
|
pushRun();
|
|
86074
|
-
if (sep !== void 0) return runs.length === 0 ? [] : [runs.join(sep)];
|
|
86167
|
+
if (sep !== void 0) return runs.length === 0 ? [] : [runs.join(sep) + sep];
|
|
86075
86168
|
return runs;
|
|
86076
86169
|
}
|
|
86077
86170
|
evalSyncColumn(rawLines, opArgs) {
|
|
@@ -95575,43 +95668,6 @@ function xzCommands(options8 = {}) {
|
|
|
95575
95668
|
};
|
|
95576
95669
|
}
|
|
95577
95670
|
|
|
95578
|
-
// packages/safe-bash/src/commands/gh/index.ts
|
|
95579
|
-
var gh_exports = {};
|
|
95580
|
-
__export(gh_exports, {
|
|
95581
|
-
createGhCommand: () => createGhCommand,
|
|
95582
|
-
createGhCommands: () => createGhCommands,
|
|
95583
|
-
evalSyncGh: () => evalSyncGh,
|
|
95584
|
-
ghCommands: () => ghCommands
|
|
95585
|
-
});
|
|
95586
|
-
init_platform();
|
|
95587
|
-
__reExport(gh_exports, safe_bash_command_gh_star);
|
|
95588
|
-
import {
|
|
95589
|
-
createGhCommand as createRawGhCommand,
|
|
95590
|
-
createGhCommands as createRawGhCommands,
|
|
95591
|
-
evalSyncGh
|
|
95592
|
-
} from "../safe-bash-command-gh/index.js";
|
|
95593
|
-
import * as safe_bash_command_gh_star from "../safe-bash-command-gh/index.js";
|
|
95594
|
-
function createGhCommand(options8 = {}) {
|
|
95595
|
-
const def = createRawGhCommand(options8);
|
|
95596
|
-
internal_exports.builtInDirectContextExecutors.add(def.execute);
|
|
95597
|
-
return def;
|
|
95598
|
-
}
|
|
95599
|
-
function createGhCommands(options8 = {}) {
|
|
95600
|
-
const defs = createRawGhCommands(options8);
|
|
95601
|
-
for (let i = 0; i < defs.length; i++) internal_exports.builtInDirectContextExecutors.add(defs[i].execute);
|
|
95602
|
-
return defs;
|
|
95603
|
-
}
|
|
95604
|
-
function ghCommands(options8 = {}) {
|
|
95605
|
-
const command4 = createGhCommand(options8);
|
|
95606
|
-
return {
|
|
95607
|
-
name: "gh-commands",
|
|
95608
|
-
setup(host2) {
|
|
95609
|
-
host2.commands.register(command4, { replace: options8.replace ?? false });
|
|
95610
|
-
}
|
|
95611
|
-
};
|
|
95612
|
-
}
|
|
95613
|
-
internal_exports.syncCommandEvaluators.evalSyncGh = evalSyncGh;
|
|
95614
|
-
|
|
95615
95671
|
// packages/safe-bash/src/core.browser.ts
|
|
95616
95672
|
__reExport(core_browser_exports, core_exports);
|
|
95617
95673
|
import { CommandArgumentIdentityError, createCommandArguments as createCommandArguments4, getCommandArguments as getCommandArguments11, commandRuntimeIdentity as commandRuntimeIdentity2, CommandRegistry as CommandRegistry3, validateExitCode as validateExitCode2 } from "../safe-bash-contracts/command.js";
|
package/dist/safe-bash/core.d.ts
CHANGED
|
@@ -110,5 +110,5 @@ export * from "./commands/mdq/index.js";
|
|
|
110
110
|
export { createOpensslCommand, createOpensslCommands, opensslCommands, type OpensslCommandsOptions, type OpensslLimits, type OpensslOptions } from "./commands/openssl/index.js";
|
|
111
111
|
export { createSshCommand, createSshKeygenCommand, createSshCommands, sshCommands, type SshCommandsOptions, type SshLimits, type SshOptions } from "./commands/ssh/index.js";
|
|
112
112
|
export { createGpgCommand, createGpgCommands, gpgCommands, type GpgCommandsOptions, type GpgLimits, type GpgOptions } from "./commands/gpg/index.js";
|
|
113
|
-
export { createGhCommand, createGhCommands, ghCommands, type GhCommandOptions, type GhCommandsOptions } from "./commands/gh/index.js";
|
|
113
|
+
export { createGhCommand, createGhCommands, ghCommands, type GhCommandOptions, type GhCommandsOptions, type GhLimits } from "./commands/gh/index.js";
|
|
114
114
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type GhCommandOptions } from "../commands/gh/index.js";
|
|
1
2
|
import { type CommandDefinition, type CommandHandler } from "../contracts/index.js";
|
|
2
3
|
import { type ExecutionCommandsOptions, type StandardCommandsOptions } from "../commands/standard.js";
|
|
3
4
|
import { type TextProgramOptions } from "../commands/text-programs/index.js";
|
|
@@ -40,6 +41,7 @@ import { type MdqCommandOptions } from "../commands/mdq/index.js";
|
|
|
40
41
|
import type { RegexExecutionOptions } from "../commands/regex-execution/protocol.js";
|
|
41
42
|
import type { BoundedRegexProvider } from "../commands/regex-execution/provider.js";
|
|
42
43
|
export interface AgentCommandsOptions {
|
|
44
|
+
readonly gh?: GhCommandOptions;
|
|
43
45
|
readonly predicateIdentity?: StandardCommandsOptions["predicateIdentity"];
|
|
44
46
|
readonly execution?: ExecutionCommandsOptions;
|
|
45
47
|
readonly bytes?: Omit<ByteCommandsOptions, "replace">;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createGhCommands } from "../commands/gh/index.js";
|
|
1
2
|
import { CommandRegistry } from "../contracts/index.js";
|
|
2
3
|
import { PublicDiagnostic } from "../diagnostics.js";
|
|
3
4
|
import { createStandardCommandsWithGrep } from "../commands/standard.js";
|
|
@@ -153,7 +154,7 @@ function hasCustomFamilyOptions(options) {
|
|
|
153
154
|
options.mdq !== undefined);
|
|
154
155
|
}
|
|
155
156
|
export function composeRawAgentCommands(options, executors) {
|
|
156
|
-
const commands = [];
|
|
157
|
+
const commands = [...createGhCommands(options.gh)];
|
|
157
158
|
const useErgonomicGrep = options.regexExecutor === undefined;
|
|
158
159
|
const grep = createGrepCommands(executors.grep, { ergonomicRegex: useErgonomicGrep });
|
|
159
160
|
const exprLimits = options.expr?.limits;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { syncPosixRegexSource } from "./sync-posix-regex.js";
|
|
1
2
|
import { syncCommandEvaluators } from "../commands/internal.js";
|
|
2
3
|
import { compareSyncJqStrings, splitSyncJqExpression } from "./sync-jq-expression.js";
|
|
3
4
|
import { wcDisplayWidth } from "../commands/wc-width.js";
|
|
@@ -29671,11 +29672,9 @@ export class Runtime {
|
|
|
29671
29672
|
const compileSedAddrRe = (patSpec) => {
|
|
29672
29673
|
if (patSpec.length === 0 || patSpec.includes("[.") || patSpec.includes("[=") || /\\[1-9]/.test(patSpec))
|
|
29673
29674
|
return undefined;
|
|
29674
|
-
const normPat = patSpec
|
|
29675
|
-
|
|
29676
|
-
|
|
29677
|
-
.replace(/\[:alpha:\]/g, "a-zA-Z")
|
|
29678
|
-
.replace(/\[:alnum:\]/g, "a-zA-Z0-9");
|
|
29675
|
+
const normPat = syncPosixRegexSource(patSpec);
|
|
29676
|
+
if (normPat === undefined)
|
|
29677
|
+
return undefined;
|
|
29679
29678
|
const jsPat = isExtended
|
|
29680
29679
|
? normPat
|
|
29681
29680
|
: normPat.replace(/\\([+?()|])/g, "$1");
|
|
@@ -30963,8 +30962,11 @@ export class Runtime {
|
|
|
30963
30962
|
if (patM) {
|
|
30964
30963
|
const inv = patM[1] === "!";
|
|
30965
30964
|
let re;
|
|
30965
|
+
const source = syncPosixRegexSource(patM[2]);
|
|
30966
|
+
if (source === undefined)
|
|
30967
|
+
return undefined;
|
|
30966
30968
|
try {
|
|
30967
|
-
re = new RegExp(
|
|
30969
|
+
re = new RegExp(source);
|
|
30968
30970
|
}
|
|
30969
30971
|
catch {
|
|
30970
30972
|
return undefined;
|
|
@@ -30976,8 +30978,11 @@ export class Runtime {
|
|
|
30976
30978
|
const fTok = fPatM[1];
|
|
30977
30979
|
const inv = fPatM[2] === "!~";
|
|
30978
30980
|
let re;
|
|
30981
|
+
const source = syncPosixRegexSource(fPatM[3]);
|
|
30982
|
+
if (source === undefined)
|
|
30983
|
+
return undefined;
|
|
30979
30984
|
try {
|
|
30980
|
-
re = new RegExp(
|
|
30985
|
+
re = new RegExp(source);
|
|
30981
30986
|
}
|
|
30982
30987
|
catch {
|
|
30983
30988
|
return undefined;
|
|
@@ -31706,8 +31711,11 @@ export class Runtime {
|
|
|
31706
31711
|
if (v === "a" || v === "t" || v === "n")
|
|
31707
31712
|
return { style: v };
|
|
31708
31713
|
if (v.startsWith("p") && v.length > 1) {
|
|
31714
|
+
const source = syncPosixRegexSource(v.slice(1));
|
|
31715
|
+
if (source === undefined)
|
|
31716
|
+
return undefined;
|
|
31709
31717
|
try {
|
|
31710
|
-
return { style: "p", re: new RegExp(
|
|
31718
|
+
return { style: "p", re: new RegExp(source) };
|
|
31711
31719
|
}
|
|
31712
31720
|
catch {
|
|
31713
31721
|
return undefined;
|
|
@@ -32486,7 +32494,7 @@ export class Runtime {
|
|
|
32486
32494
|
}
|
|
32487
32495
|
pushRun();
|
|
32488
32496
|
if (sep !== undefined)
|
|
32489
|
-
return runs.length === 0 ? [] : [runs.join(sep)];
|
|
32497
|
+
return runs.length === 0 ? [] : [runs.join(sep) + sep];
|
|
32490
32498
|
return runs;
|
|
32491
32499
|
}
|
|
32492
32500
|
evalSyncColumn(rawLines, opArgs) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Character-class fragments for the sync evaluators' ASCII regex profile.
|
|
2
|
+
const classes = {
|
|
3
|
+
digit: "0-9", alpha: "A-Za-z", alnum: "A-Za-z0-9",
|
|
4
|
+
upper: "A-Z", lower: "a-z", blank: " \\t",
|
|
5
|
+
space: " \\t\\r\\n\\v\\f", xdigit: "A-Fa-f0-9",
|
|
6
|
+
punct: "!-/:-@\\[-`{-~", cntrl: "\\x00-\\x1f\\x7f",
|
|
7
|
+
graph: "!-~", print: " -~",
|
|
8
|
+
};
|
|
9
|
+
/** Translate class tokens only inside bracket expressions; defer unsupported syntax. */
|
|
10
|
+
export function syncPosixRegexSource(source) {
|
|
11
|
+
let output = "";
|
|
12
|
+
let inBracket = false;
|
|
13
|
+
let bracketStart = 0;
|
|
14
|
+
for (let i = 0; i < source.length; i++) {
|
|
15
|
+
const char = source[i];
|
|
16
|
+
if (char === "\\") {
|
|
17
|
+
output += source.slice(i, i + 2);
|
|
18
|
+
i++;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
if (inBracket && char === "[" && source[i + 1] === ":") {
|
|
22
|
+
const end = source.indexOf(":]", i + 2);
|
|
23
|
+
if (end === -1)
|
|
24
|
+
return undefined;
|
|
25
|
+
const name = source.slice(i + 2, end);
|
|
26
|
+
if (!Object.hasOwn(classes, name))
|
|
27
|
+
return undefined;
|
|
28
|
+
output += classes[name];
|
|
29
|
+
i = end + 1;
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
if (char === "[" && !inBracket) {
|
|
33
|
+
inBracket = true;
|
|
34
|
+
bracketStart = i + 1 + (source[i + 1] === "^" ? 1 : 0);
|
|
35
|
+
// A leading literal ] requires POSIX bracket parsing rather than JS RegExp.
|
|
36
|
+
if (source[bracketStart] === "]")
|
|
37
|
+
return undefined;
|
|
38
|
+
}
|
|
39
|
+
else if (char === "]" && inBracket) {
|
|
40
|
+
inBracket = false;
|
|
41
|
+
}
|
|
42
|
+
if (inBracket && char === "[" && (source[i + 1] === "." || source[i + 1] === "="))
|
|
43
|
+
return undefined;
|
|
44
|
+
output += char;
|
|
45
|
+
}
|
|
46
|
+
return output;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=sync-posix-regex.js.map
|