@azx-pbc/axiom-runtime 0.0.1 → 0.0.6
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/expr/regex.d.ts.map +1 -1
- package/dist/expr/regex.js +4 -1
- package/dist/expr/regex.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/dist/expr/regex.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../src/expr/regex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kGAAkG;AAClG,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAaxC,wFAAwF;AACxF,eAAO,MAAM,WAAW,YAAI,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AACpD,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAKpC,gFAAgF;AAChF,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7D;IAAE,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC5D;IAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE;;;;;;GA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|
case 'invalid-flags':
|
|
1161
1161
|
return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);
|
|
1162
1162
|
case 'invalid-pattern':
|
|
1163
|
-
|
|
1163
|
+
// Host engines word RegExp SyntaxError messages differently across V8, Hermes, JSC and
|
|
1164
|
+
// SpiderMonkey. This detail enters `report.diagnostics[].params.detail` and therefore
|
|
1165
|
+
// `reportHash`, so the runtime refusal must stay engine-independent.
|
|
1166
|
+
return new AxiomError('ENGINE_ERROR', 'matches: the pattern is not a valid regular expression', path);
|
|
1164
1167
|
case 'unsafe-pattern':
|
|
1165
1168
|
return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);
|
|
1166
1169
|
case 'subject-too-long':
|
package/dist/expr/regex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex.js","sourceRoot":"","sources":["../../src/expr/regex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kGAAkG;AAClG,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAE1C,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAGpD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,8EAA8E;AAC9E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAS9B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,SAAS,GAAG,gBAAgB,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI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AAM,CAAC,mBAAmB,CAAC,uCAAuC;SAC5I,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,SAAS,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAC9C,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAClE,uFAAuF;IACvF,2DAA2D;IAC3D,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IAC5C,IAAI,QAAQ,CAAC,IAAI,GAAG,sBAAsB,EAAE,CAAC;QAC3C,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,2BAA2B,MAAM,CAAC,sBAAsB,CAAC,0BAA0B,MAAM,CAAC,MAAM,CAAC,kEAAkE;SAC5K,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { AxiomError } from '../model/errors.js';\nimport { codePointLength } from './strings.js';\n\n/**\n * `matches(s, pattern, flags?)`: JavaScript regular-expression search with Unicode semantics,\n * `spec/semantics/expr-v1.md` `EXPR-14.1.12` to `EXPR-14.1.14`.\n *\n * Four properties make this operator defensible to ship:\n *\n * 1. **One dialect.** The pattern is an ECMAScript regular expression with the `u` flag always\n * set, so `\\p{L}`, `\\p{Script=Han}` and an astral character are one expression each and the\n * answer never depends on the host locale. `i`, `m` and `s` are the only other flags the\n * language admits; `g`, `y` and `d` describe state or indices a boolean test has no use for.\n * 2. **A bounded subject.** A subject longer than {@link REGEX_SUBJECT_LIMIT} code points is\n * refused before the engine runs, so no authored pattern can be used to scan a document\n * field of unbounded size.\n * 3. **The classic exponential shapes are refused.** {@link unsafePattern} refuses a repeated\n * group whose body is variable or whose alternation overlaps, and a run of adjacent variable\n * quantifiers whose operands can match the same text (`a?a?…`, `\\d*\\d*…`). A pattern that\n * arrives as a value is analysed by the same scan before the engine runs.\n * 4. **Every call has a work ceiling.** A family scan can always be beaten by a shape it does\n * not name, so the engine is never handed a pattern whose conservative backtracking bound at\n * this subject length exceeds {@link REGEX_MATCH_WORK_LIMIT}. The bound is computed from the\n * parsed source and the subject length, not measured after the fact, so a hostile computed\n * pattern is refused with `unsafe-pattern` instead of spending a request's latency.\n *\n * The compiled `RegExp` is cached per `(pattern, flags)`, so an item-scoped rule over a\n * thousand rows compiles one pattern and tests a thousand subjects.\n */\n\n/** The subject cap in code points: a longer input is refused, never scanned and never `false`. */\nexport const REGEX_SUBJECT_LIMIT = 4096;\n\n/**\n * The per-call work ceiling, in backtracking steps.\n *\n * A step stands for one path the engine may try or one character it may revisit. The estimate\n * below is deliberately conservative, so a pattern can be refused while its ordinary cost is\n * lower; the alternative, running an unbounded engine on the renderer's thread, is the failure\n * this ceiling exists to prevent. The value matches the `ascii_match` matcher's budget, so the\n * two pattern operators refuse at the same order of work.\n */\nconst REGEX_MATCH_WORK_LIMIT = 24_000_000;\n\n/** The optional flags an author may write, in the canonical order the cache keys on. */\nexport const REGEX_FLAGS = ['i', 'm', 's'] as const;\nexport type RegexFlag = (typeof REGEX_FLAGS)[number];\n\n/** The flag string every compiled pattern carries: `u` is not optional. */\nexport const BASE_REGEX_FLAGS = 'u';\n\n/** How many `(pattern, flags)` pairs the evaluator keeps compiled at once. */\nconst REGEX_CACHE_LIMIT = 256;\n\n/** Why a pattern or subject was refused, as data rather than a thrown error. */\nexport type RegexRefusal =\n | { readonly kind: 'invalid-flags'; readonly detail: string }\n | { readonly kind: 'invalid-pattern'; readonly detail: string }\n | { readonly kind: 'unsafe-pattern'; readonly detail: string }\n | { readonly kind: 'subject-too-long'; readonly detail: string };\n\n/**\n * The canonical flag string for one authored `flags` operand, or the refusal naming the\n * offending flag.\n *\n * The author writes a subset of `ims`; `u` is added here rather than accepted, so a document\n * cannot opt out of Unicode semantics by writing `g` or by writing nothing.\n */\nexport function canonicalFlags(\n flags: string,\n): { readonly kind: 'ok'; readonly flags: string } | RegexRefusal {\n const seen = new Set<string>();\n let canonical = BASE_REGEX_FLAGS;\n for (const flag of flags) {\n if (!(REGEX_FLAGS as readonly string[]).includes(flag)) {\n return {\n kind: 'invalid-flags',\n detail: `\\`${flag}\\` is not a supported flag; write \\`i\\`, \\`m\\`, \\`s\\` or omit the operand (the \\`u\\` flag is always on, and \\`g\\`, \\`y\\` and \\`d\\` are not available)`,\n };\n }\n if (seen.has(flag)) {\n return {\n kind: 'invalid-flags',\n detail: `flag \\`${flag}\\` is written twice; a flag may appear once`,\n };\n }\n seen.add(flag);\n }\n // Canonicalising the order keeps `im` and `mi` one cache entry, exactly as `RegExp` treats\n // them as one flag set.\n for (const flag of REGEX_FLAGS) {\n if (seen.has(flag)) canonical += flag;\n }\n return { kind: 'ok', flags: canonical };\n}\n\n/** The length of a quantifier at `index`, or 0 when the character there is a literal. */\nfunction quantifierLength(source: string, index: number): number {\n const character = source[index];\n if (character === '*' || character === '+' || character === '?') return 1;\n if (character !== '{') return 0;\n const match = /^\\{[0-9]+(?:,[0-9]*)?\\}/.exec(source.slice(index));\n return match === null ? 0 : match[0].length;\n}\n\n/** The repetition bounds a quantifier at `index` states, or `undefined` when none is there. */\ninterface QuantifierBounds {\n readonly min: number;\n readonly max: number;\n readonly variable: boolean;\n}\n\nfunction quantifierBounds(source: string, index: number): QuantifierBounds | undefined {\n const character = source[index];\n if (character === '?') return { min: 0, max: 1, variable: true };\n if (character === '*') return { min: 0, max: Number.POSITIVE_INFINITY, variable: true };\n if (character === '+') return { min: 1, max: Number.POSITIVE_INFINITY, variable: true };\n if (character !== '{') return undefined;\n const match = /^\\{([0-9]+)(?:,([0-9]*))?\\}/.exec(source.slice(index));\n if (match === null) return undefined;\n const min = Number(match[1]);\n // `{n}` is one count; `{n,}` and `{n,m}` vary.\n if (match[2] === undefined) return { min, max: min, variable: false };\n const max = match[2] === '' ? Number.POSITIVE_INFINITY : Number(match[2]);\n return { min, max, variable: true };\n}\n\n/**\n * Whether the construct at `index` repeats its operand at least twice, which is what turns a\n * nested ambiguity into exponential work. `?` is absent: it repeats zero or one time.\n */\nfunction quantifierRepeats(source: string, index: number): boolean {\n const bounds = quantifierBounds(source, index);\n if (bounds === undefined) return false;\n return bounds.max === Number.POSITIVE_INFINITY || bounds.max >= 2;\n}\n\n/** The index of the first body character after a `(` at `index`, skipping a group prefix. */\nfunction afterGroupPrefix(source: string, index: number): number {\n let cursor = index + 1;\n if (source[cursor] !== '?') return cursor;\n cursor += 1;\n const marker = source[cursor];\n if (marker === ':') return cursor + 1;\n if (marker === '=' || marker === '!') return cursor + 1;\n if (marker === '<') {\n const next = source[cursor + 1];\n // `(?<=` and `(?<!` are lookbehind assertions, not named groups: the `>` belongs to no\n // prefix here, and searching for one would swallow the body.\n if (next === '=' || next === '!') return cursor + 2;\n const close = source.indexOf('>', cursor);\n return close === -1 ? cursor + 1 : close + 1;\n }\n return cursor;\n}\n\n/** Whether a group at `index` is a lookahead or lookbehind assertion, which consumes nothing. */\nfunction groupIsLookaround(source: string, index: number): boolean {\n if (source[index + 1] !== '?') return false;\n const marker = source[index + 2];\n return (\n marker === '=' ||\n marker === '!' ||\n (marker === '<' && (source[index + 3] === '=' || source[index + 3] === '!'))\n );\n}\n\n/**\n * Whether `(` at `index` opens an ES2025 inline modifier group (`(?i:...)`, `(?-m:...)`,\n * `(?im-s:...)`).\n *\n * Inline modifier groups are outside the ES2023 / Hermes V1 runtime floor and change `i`/`m`/`s`\n * scoping mid-pattern, so the safety scan refuses them explicitly.\n */\nfunction isInlineModifierGroup(source: string, index: number): boolean {\n if (source[index + 1] !== '?') return false;\n return /^\\(\\?(?:[ims]+(?:-[ims]*)?|-[ims]+):/.test(source.slice(index));\n}\n\n/**\n * Affine work summary for a branch or group: given a continuation taking `R` steps, executing\n * this construct followed by the continuation takes at most `overhead + multiplier * R` steps.\n */\ninterface WorkProfile {\n readonly overhead: number;\n readonly multiplier: number;\n}\n\n/** One item in a parsed branch, retained to evaluate sequential and barrier-bounded work. */\ntype BranchItem =\n | {\n readonly kind: 'atom';\n readonly operand: Operand;\n readonly singleChar: boolean;\n bounds: QuantifierBounds | undefined;\n }\n | {\n readonly kind: 'group';\n readonly profile: WorkProfile;\n readonly lookaround: boolean;\n readonly zeroWidth: boolean;\n readonly leadingOperand: Operand | undefined;\n bounds: QuantifierBounds | undefined;\n }\n | {\n readonly kind: 'backref';\n bounds: QuantifierBounds | undefined;\n }\n | { readonly kind: 'assertion' };\n\n/** One alternation branch, as far as the safety scan can prove its shape. */\ninterface Branch {\n /**\n * The guaranteed leading literal text the branch begins with before its first non-literal or\n * optional construct, used by `operandFromBody` for adjacent-quantifier disjointness.\n */\n leadingPrefix: string;\n /**\n * Whether `leadingPrefix` is still accepting characters. Once a non-literal, non-1 quantifier,\n * or non-closed group appears, later literals cannot extend the leading prefix.\n */\n acceptingPrefix: boolean;\n /**\n * Whether the entire branch is an exact closed literal sequence. Only closed literal branches\n * can be proven disjoint in `branchesOverlap`.\n */\n closed: boolean;\n /** Length of `leadingPrefix` before the latest construct, for rolling back `min === 0` quantifiers. */\n lastPrefixStart: number;\n /** Whether no consuming construct has preceded a leading `^` anchor in this branch. */\n atStart: boolean;\n /** Whether this branch is anchored at index 0 of the subject (only when `m` is unset). */\n anchoredStart: boolean;\n /** Ordered constructs in this branch for conservative backtracking work estimation. */\n readonly items: BranchItem[];\n}\n\n/** What one group's body contains, as the safety scan needs it. */\ninterface GroupBody {\n readonly hasQuantifier: boolean;\n readonly hasOverlappingAlternation: boolean;\n /** The guaranteed leading literal prefix every branch begins with; `''` when none is guaranteed. */\n readonly leadingPrefix: string;\n /** Whether the body is a single closed literal branch. */\n readonly closed: boolean;\n}\n\ninterface GroupSpan {\n readonly source: string;\n readonly quantified: boolean;\n readonly body: GroupBody;\n}\n\n/**\n * What one quantified operand can begin with, as far as adjacent-run overlap can compare.\n *\n * `text` is a closed literal prefix; `set` is a character class the scan can compare; `any` is\n * `.`; `unknown` is a construct whose first set is not known (a property escape, a backreference,\n * an open group), which is treated as overlapping everything.\n */\ntype Operand =\n | { readonly kind: 'text'; readonly text: string }\n | {\n readonly kind: 'set';\n readonly ranges: readonly (readonly [number, number])[];\n readonly negated: boolean;\n }\n | { readonly kind: 'any' }\n | { readonly kind: 'unknown' };\n\nconst DIGIT_RANGES: readonly (readonly [number, number])[] = [[0x30, 0x39]];\nconst WORD_RANGES: readonly (readonly [number, number])[] = [\n [0x30, 0x39],\n [0x41, 0x5a],\n [0x5f, 0x5f],\n [0x61, 0x7a],\n];\n/** The ECMAScript `\\s` set: WhiteSpace and LineTerminator, as ranges of code points. */\nconst SPACE_RANGES: readonly (readonly [number, number])[] = [\n [0x09, 0x0d],\n [0x20, 0x20],\n [0xa0, 0xa0],\n [0x1680, 0x1680],\n [0x2000, 0x200a],\n [0x2028, 0x2029],\n [0x202f, 0x202f],\n [0x205f, 0x205f],\n [0x3000, 0x3000],\n [0xfeff, 0xfeff],\n];\n\n/** The branch being written in one frame, or `undefined` outside every group. */\nfunction currentBranch(frame: Frame): Branch | undefined {\n if (frame.open === -1) return undefined;\n return frame.branches[frame.branches.length - 1];\n}\n\n/** The active branch of `frame`, including the top-level root frame. */\nfunction activeBranch(frame: Frame): Branch {\n const branch = frame.branches[frame.branches.length - 1];\n if (branch === undefined) {\n const created = newBranch();\n frame.branches.push(created);\n return created;\n }\n return branch;\n}\n\nfunction newBranch(): Branch {\n return {\n leadingPrefix: '',\n acceptingPrefix: true,\n closed: true,\n lastPrefixStart: 0,\n atStart: true,\n anchoredStart: false,\n items: [],\n };\n}\n\n/** Whether any two alternation branches can match the same input prefix. */\nfunction branchesOverlap(frame: Frame, caseInsensitive: boolean): boolean {\n if (frame.branches.length < 2) return false;\n // One non-closed construct is enough: `.`, a character class, a shorthand escape (`\\d`, `\\w`,\n // `\\s`), a backreference, a quantified atom, or a multi-branch nested group can match text\n // another branch begins with. Only closed literal branches can be proven disjoint.\n if (frame.branches.some((branch) => !branch.closed)) return true;\n for (let left = 0; left < frame.branches.length; left += 1) {\n for (let right = left + 1; right < frame.branches.length; right += 1) {\n const leftBranch = frame.branches[left]?.leadingPrefix ?? '';\n const rightBranch = frame.branches[right]?.leadingPrefix ?? '';\n if (textPrefixesOverlap(leftBranch, rightBranch, caseInsensitive)) return true;\n }\n }\n return false;\n}\n\n/** The guaranteed leading literal text every branch begins with, compared by code point. */\nfunction commonPrefix(branches: readonly Branch[]): string {\n let prefix = branches[0]?.leadingPrefix ?? '';\n for (const branch of branches.slice(1)) {\n let index = 0;\n while (index < prefix.length && index < branch.leadingPrefix.length) {\n const left = prefix.codePointAt(index) ?? 0;\n const right = branch.leadingPrefix.codePointAt(index) ?? 0;\n if (left !== right) break;\n index += left > 0xffff ? 2 : 1;\n }\n prefix = prefix.slice(0, index);\n if (prefix === '') break;\n }\n return prefix;\n}\n\n/**\n * Whether an escape names literal text rather than a character set. `\\.`, `\\/` and `\\-` are one\n * character each; `\\d`, `\\w`, `\\s`, `\\p{…}`, `\\u{…}` and a backreference are not, so they are\n * treated as open.\n */\nfunction escapedLiteral(escaped: string): boolean {\n return escaped !== '' && !/[A-Za-z0-9]/.test(escaped);\n}\n\n/** The text one escape stands for, or `undefined` when its first character set is not known. */\nfunction escapeText(escaped: string): string | undefined {\n switch (escaped) {\n case 'n':\n return '\\n';\n case 'r':\n return '\\r';\n case 't':\n return '\\t';\n case 'f':\n return '\\f';\n case 'v':\n return '\\v';\n case '0':\n return '\\0';\n default:\n return escapedLiteral(escaped) ? escaped : undefined;\n }\n}\n\nfunction inRanges(ranges: readonly (readonly [number, number])[], code: number): boolean {\n for (const [from, to] of ranges) {\n if (code >= from && code <= to) return true;\n }\n return false;\n}\n\n/** Whether every code point of `inner` is a member of one of `outer`'s ranges. */\nfunction rangesCoveredBy(\n inner: readonly (readonly [number, number])[],\n outer: readonly (readonly [number, number])[],\n): boolean {\n for (const [from, to] of inner) {\n let cursor = from;\n while (cursor <= to) {\n let next = -1;\n for (const [outerFrom, outerTo] of outer) {\n if (cursor >= outerFrom && cursor <= outerTo) {\n next = outerTo + 1;\n break;\n }\n }\n if (next === -1) return false;\n cursor = next;\n }\n }\n return true;\n}\n\nfunction setsOverlap(\n left: { readonly ranges: readonly (readonly [number, number])[]; readonly negated: boolean },\n right: { readonly ranges: readonly (readonly [number, number])[]; readonly negated: boolean },\n): boolean {\n if (!left.negated && !right.negated) {\n for (const [leftFrom, leftTo] of left.ranges) {\n for (const [rightFrom, rightTo] of right.ranges) {\n if (leftFrom <= rightTo && rightFrom <= leftTo) return true;\n }\n }\n return false;\n }\n // A negated set overlaps unless the positive side lies wholly inside the excluded ranges.\n if (left.negated && !right.negated) return !rangesCoveredBy(right.ranges, left.ranges);\n if (!left.negated && right.negated) return !rangesCoveredBy(left.ranges, right.ranges);\n return true;\n}\n\nfunction isAsciiLetter(code: number): boolean {\n return (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a);\n}\n\nfunction isAsciiNonLetter(code: number): boolean {\n return code >= 0 && code <= 0x7f && !isAsciiLetter(code);\n}\n\nfunction isAsciiNonLetterRange(from: number, to: number): boolean {\n if (from < 0 || to > 0x7f) return false;\n if (from <= 0x5a && to >= 0x41) return false;\n if (from <= 0x7a && to >= 0x61) return false;\n return true;\n}\n\n/**\n * Whether two literal prefixes can match text beginning the same way under the active `i` flag.\n *\n * Under `/iu`, ASCII non-letters participate in no Unicode simple case folding, so a mismatch\n * involving one proves disjointness. Any other differing pair (ASCII letters or non-ASCII code\n * points such as `\\u017f` or `\\u212a`) is treated conservatively as overlapping without relying\n * on `.toLowerCase()`.\n */\nfunction textPrefixesOverlap(left: string, right: string, caseInsensitive: boolean): boolean {\n if (left === '' || right === '') return true;\n if (!caseInsensitive) {\n return left.startsWith(right) || right.startsWith(left);\n }\n let leftIndex = 0;\n let rightIndex = 0;\n while (leftIndex < left.length && rightIndex < right.length) {\n const leftCode = left.codePointAt(leftIndex) ?? 0;\n const rightCode = right.codePointAt(rightIndex) ?? 0;\n if (leftCode !== rightCode) {\n return !(isAsciiNonLetter(leftCode) || isAsciiNonLetter(rightCode));\n }\n leftIndex += leftCode > 0xffff ? 2 : 1;\n rightIndex += rightCode > 0xffff ? 2 : 1;\n }\n return true;\n}\n\n/**\n * Whether an operand matches only ASCII non-letter code points, which participate in no Unicode\n * simple case folding under the `iu` flags.\n */\nfunction isCaseInvariantOperand(operand: Operand): boolean {\n if (operand.kind === 'text') {\n if (operand.text === '') return false;\n const code = operand.text.codePointAt(0) ?? 0;\n return isAsciiNonLetter(code);\n }\n if (operand.kind === 'set' && !operand.negated) {\n return operand.ranges.every(([from, to]) => isAsciiNonLetterRange(from, to));\n }\n return false;\n}\n\n/** Whether two quantified operands can match text that begins the same way. */\nfunction operandsOverlap(left: Operand, right: Operand): boolean {\n if (left.kind === 'unknown' || right.kind === 'unknown') return true;\n if (left.kind === 'any' || right.kind === 'any') return true;\n if (left.kind === 'text' && right.kind === 'text') {\n return textPrefixesOverlap(left.text, right.text, false);\n }\n if (left.kind === 'text' && right.kind === 'set') {\n const first = left.text.codePointAt(0) ?? 0;\n return inRanges(right.ranges, first) !== right.negated;\n }\n if (left.kind === 'set' && right.kind === 'text') {\n const first = right.text.codePointAt(0) ?? 0;\n return inRanges(left.ranges, first) !== left.negated;\n }\n if (left.kind === 'set' && right.kind === 'set') return setsOverlap(left, right);\n return true;\n}\n\n/** Whether two operands can match text beginning the same way under the active `i` flag. */\nfunction operandsOverlapWithFlags(\n left: Operand,\n right: Operand,\n caseInsensitive: boolean,\n): boolean {\n if (!caseInsensitive) return operandsOverlap(left, right);\n if (left.kind === 'text' && right.kind === 'text') {\n return textPrefixesOverlap(left.text, right.text, true);\n }\n if (isCaseInvariantOperand(left) || isCaseInvariantOperand(right)) {\n return operandsOverlap(left, right);\n }\n return true;\n}\n\n/** The operand one group body presents: its guaranteed leading literal prefix, or unknown. */\nfunction operandFromBody(body: GroupBody): Operand {\n return body.leadingPrefix === ''\n ? { kind: 'unknown' }\n : { kind: 'text', text: body.leadingPrefix };\n}\n\ninterface Frame {\n /** The index of the `(` that opened this group; `-1` for the top level. */\n readonly open: number;\n /** The alternation branches written directly in this group. */\n readonly branches: Branch[];\n /** A variable quantifier appears at this group's own level. */\n variableQuantifier: boolean;\n /** A variable quantifier appears at any depth inside this group. */\n nestedVariableQuantifier: boolean;\n /** A nested group's alternation can match the same prefix two ways. */\n nestedOverlappingAlternation: boolean;\n /** The atom currently being written at this level. */\n current: { readonly operand: Operand; variable: boolean } | undefined;\n /** The variable-quantified atom immediately before `current`, if the run has not broken. */\n previous: { readonly operand: Operand; variable: boolean } | undefined;\n /** Whether this group is a lookaround, whose body is tried at each start position. */\n readonly lookaround: boolean;\n}\n\n/** The result of one structural analysis: the named refusals and a work estimate. */\ninterface PatternAnalysis {\n /** Why the pattern is refused before the engine runs, or `undefined` when it is admitted. */\n readonly unsafe: string | undefined;\n /** A conservative upper bound on backtracking steps at the analysed subject length. */\n readonly work: number;\n}\n\n/** The pattern cap in code units: analysis reads every character, so a longer value is refused. */\nconst REGEX_PATTERN_LIMIT = 4096;\n\nconst WORK_CAP = REGEX_MATCH_WORK_LIMIT + 1;\n\n/** Adds two work estimates, saturating at one above the ceiling rather than overflowing. */\nfunction addWork(left: number, right: number): number {\n if (left >= WORK_CAP || right >= WORK_CAP) return WORK_CAP;\n const sum = left + right;\n return sum >= WORK_CAP ? WORK_CAP : sum;\n}\n\n/** Multiplies two work estimates, saturating at one above the ceiling rather than overflowing. */\nfunction multiplyWork(left: number, right: number): number {\n if (left <= 0 || right <= 0) return 0;\n if (left >= WORK_CAP || right >= WORK_CAP) return WORK_CAP;\n return left > WORK_CAP / right ? WORK_CAP : left * right;\n}\n\n/** The number of repetition counts one quantifier can choose, capped by subject length. */\nfunction quantifierWork(bounds: QuantifierBounds, subjectLength: number): number {\n if (!bounds.variable) return 1;\n if (bounds.min > subjectLength) return 1;\n const maxRepeats =\n bounds.max === Number.POSITIVE_INFINITY ? subjectLength : Math.min(bounds.max, subjectLength);\n return Math.max(1, maxRepeats - bounds.min + 1);\n}\n\nfunction composeWork(first: WorkProfile, then: WorkProfile): WorkProfile {\n return {\n overhead: addWork(first.overhead, multiplyWork(first.multiplier, then.overhead)),\n multiplier: multiplyWork(first.multiplier, then.multiplier),\n };\n}\n\n/** Composes one affine work profile with itself `count` times, saturating at `WORK_CAP`. */\nfunction repeatWork(profile: WorkProfile, count: number): WorkProfile {\n if (count <= 0) return { overhead: 0, multiplier: 1 };\n let result: WorkProfile = { overhead: 0, multiplier: 1 };\n let base = profile;\n let remaining = count;\n while (remaining > 0) {\n if ((remaining & 1) === 1) {\n result = composeWork(result, base);\n if (result.overhead >= WORK_CAP && result.multiplier >= WORK_CAP) {\n return { overhead: WORK_CAP, multiplier: WORK_CAP };\n }\n }\n remaining = Math.floor(remaining / 2);\n if (remaining > 0) base = composeWork(base, base);\n }\n return result;\n}\n\nfunction sumWork(branches: readonly WorkProfile[], disjoint = false): WorkProfile {\n let overhead = 0;\n let multiplier = 0;\n for (const branch of branches) {\n overhead = addWork(overhead, branch.overhead);\n multiplier = disjoint\n ? Math.max(multiplier, branch.multiplier)\n : addWork(multiplier, branch.multiplier);\n }\n return { overhead, multiplier };\n}\n\n/** The first code point of a guaranteed leading literal prefix, or `undefined` when empty. */\nfunction leadingOperandFromPrefix(prefix: string): Operand | undefined {\n if (prefix === '') return undefined;\n const codePoint = prefix.codePointAt(0);\n if (codePoint === undefined) return undefined;\n return { kind: 'text', text: String.fromCodePoint(codePoint) };\n}\n\n/** Whether a parsed branch item can never consume input. */\nfunction isZeroWidthItem(item: BranchItem): boolean {\n switch (item.kind) {\n case 'assertion':\n return true;\n case 'atom':\n case 'backref':\n return item.bounds?.max === 0;\n case 'group':\n return item.lookaround || item.zeroWidth || item.bounds?.max === 0;\n }\n}\n\nfunction allAssertionsFrom(items: readonly BranchItem[], startIndex: number): boolean {\n for (let index = startIndex; index < items.length; index += 1) {\n if (items[index]?.kind !== 'assertion') return false;\n }\n return true;\n}\n\nfunction isDisjointBarrier(\n item: Extract<BranchItem, { kind: 'atom' }>,\n items: readonly BranchItem[],\n nextIndex: number,\n atPatternEnd: boolean,\n caseInsensitive: boolean,\n): boolean {\n if (!item.singleChar) return false;\n const next = items[nextIndex];\n if (next === undefined) return false;\n if (next.kind === 'atom') {\n if (!next.singleChar) return false;\n if (next.bounds !== undefined && next.bounds.min < 1) return false;\n return !operandsOverlapWithFlags(item.operand, next.operand, caseInsensitive);\n }\n if (next.kind === 'group') {\n if (next.lookaround || next.leadingOperand === undefined || next.bounds?.max === 0) {\n return false;\n }\n const required = next.bounds === undefined || next.bounds.min >= 1;\n const tailOnlyAssertions = atPatternEnd && allAssertionsFrom(items, nextIndex + 1);\n if (!required && !tailOnlyAssertions) return false;\n return !operandsOverlapWithFlags(item.operand, next.leadingOperand, caseInsensitive);\n }\n return false;\n}\n\nfunction itemWorkProfile(\n item: BranchItem,\n items: readonly BranchItem[],\n nextIndex: number,\n atPatternEnd: boolean,\n subjectLength: number,\n caseInsensitive: boolean,\n): WorkProfile {\n switch (item.kind) {\n case 'assertion':\n return { overhead: 0, multiplier: 1 };\n case 'backref': {\n const base = subjectLength + 1;\n const factor =\n item.bounds?.variable === true\n ? multiplyWork(base, quantifierWork(item.bounds, subjectLength))\n : base;\n return { overhead: 0, multiplier: factor };\n }\n case 'group': {\n if (item.lookaround) {\n const inner = addWork(item.profile.overhead, item.profile.multiplier);\n if (item.bounds?.variable === true) {\n const repeats = quantifierWork(item.bounds, subjectLength);\n return { overhead: multiplyWork(repeats, inner), multiplier: repeats };\n }\n if (item.bounds !== undefined) {\n if (item.bounds.max === 0) return { overhead: 0, multiplier: 1 };\n if (item.bounds.min > 1) {\n return { overhead: multiplyWork(item.bounds.min, inner), multiplier: 1 };\n }\n }\n return { overhead: inner, multiplier: 1 };\n }\n if (item.bounds?.variable === true) {\n const repeats = quantifierWork(item.bounds, subjectLength);\n const maxRepeats =\n item.bounds.max === Number.POSITIVE_INFINITY\n ? subjectLength\n : Math.min(item.bounds.max, subjectLength);\n const repeated = repeatWork(item.profile, maxRepeats);\n return {\n overhead: repeated.overhead,\n multiplier: multiplyWork(repeats, repeated.multiplier),\n };\n }\n if (item.bounds !== undefined) {\n if (item.bounds.max === 0) return { overhead: 0, multiplier: 1 };\n if (item.bounds.min > 1) {\n return repeatWork(item.profile, item.bounds.min);\n }\n }\n return item.profile;\n }\n case 'atom': {\n if (item.bounds === undefined || !item.bounds.variable) {\n return { overhead: 1, multiplier: 1 };\n }\n const repeats = quantifierWork(item.bounds, subjectLength);\n if (isDisjointBarrier(item, items, nextIndex, atPatternEnd, caseInsensitive)) {\n // A quantified single-char atom followed by a disjoint required atom, a disjoint required\n // group, or a disjoint optional group at the end of the pattern can enter the continuation\n // at most once per entry, so its scan and failback steps are additive.\n return { overhead: repeats, multiplier: 1 };\n }\n return { overhead: 0, multiplier: repeats };\n }\n }\n}\n\nfunction branchWork(\n items: readonly BranchItem[],\n subjectLength: number,\n caseInsensitive: boolean,\n atPatternEnd: boolean,\n): WorkProfile {\n let profile: WorkProfile = { overhead: 0, multiplier: 1 };\n for (let index = items.length - 1; index >= 0; index -= 1) {\n const item = items[index];\n if (item === undefined) continue;\n profile = composeWork(\n itemWorkProfile(item, items, index + 1, atPatternEnd, subjectLength, caseInsensitive),\n profile,\n );\n }\n return profile;\n}\n\nfunction newFrame(open: number, lookaround: boolean): Frame {\n return {\n open,\n branches: [newBranch()],\n variableQuantifier: false,\n nestedVariableQuantifier: false,\n nestedOverlappingAlternation: false,\n current: undefined,\n previous: undefined,\n lookaround,\n };\n}\n\n/** Records that the current branch encountered a non-literal construct. */\nfunction markOpen(frame: Frame): void {\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.closed = false;\n branch.acceptingPrefix = false;\n branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Prevents a trailing quantifier on a zero-width construct from rolling back an earlier literal. */\nfunction resetPrefixAnchor(frame: Frame): void {\n const branch = currentBranch(frame);\n if (branch !== undefined) branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Appends literal text to the current branch's guaranteed leading prefix when still accepting. */\nfunction appendLiteral(frame: Frame, text: string): void {\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.lastPrefixStart = branch.leadingPrefix.length;\n if (branch.acceptingPrefix) branch.leadingPrefix += text;\n}\n\n/**\n * Updates branch prefix and closedness when a quantifier applies to the previous atom.\n *\n * Any quantifier other than an exact `{1}` opens the branch for alternation overlap and stops\n * extending `leadingPrefix` (so `a{2}b` cannot masquerade as `ab`). When `min === 0`, the\n * optional atom's contribution to `leadingPrefix` is removed.\n */\nfunction applyQuantifierToBranch(frame: Frame, bounds: QuantifierBounds): void {\n if (!bounds.variable && bounds.min === 1 && bounds.max === 1) return;\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.closed = false;\n branch.acceptingPrefix = false;\n if (bounds.min === 0) {\n branch.leadingPrefix = branch.leadingPrefix.slice(0, branch.lastPrefixStart);\n }\n branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Starts a new consuming atom at this level, keeping the previous one for an adjacency test. */\nfunction noteAtom(frame: Frame, operand: Operand): void {\n frame.previous = frame.current?.variable === true ? frame.current : undefined;\n frame.current = { operand, variable: false };\n}\n\n/**\n * Records that the current atom carries a quantifier, and refuses a run of adjacent variable\n * quantifiers whose operands can match the same text.\n *\n * Two optional `a`s in a row are the same exponential family as `(a+)+`: the engine chooses how\n * each of them partitions the same input, so `n` optionals have 2ⁿ paths. A separator neither\n * operand can match, such as the digits after the letters in `[A-Za-z]+[0-9]+`, leaves only one\n * partition and is admitted.\n */\nfunction markQuantified(\n frame: Frame,\n bounds: QuantifierBounds | undefined,\n caseInsensitive: boolean,\n refusal: RefusalSink,\n): void {\n if (bounds === undefined || !bounds.variable) return;\n frame.variableQuantifier = true;\n const current = frame.current;\n if (current === undefined) return;\n current.variable = true;\n const previous = frame.previous;\n if (\n previous !== undefined &&\n operandsOverlapWithFlags(previous.operand, current.operand, caseInsensitive)\n ) {\n refusal.adjacent ??=\n 'a run of adjacent variable quantifiers can match the same text, which backtracks exponentially as the run grows; separate them with a character one operand cannot match, such as `[A-Za-z]+[0-9]+` instead of `[A-Za-z0-9]+[A-Za-z0-9]+`';\n }\n}\n\n/** The one mutable sink the walk fills: the first named ambiguity it proves. */\ninterface RefusalSink {\n adjacent: string | undefined;\n}\n\n/**\n * The classic catastrophic-backtracking shapes, as a structural scan of the source text.\n *\n * The three families are the ones an author can write by accident and an engine cannot escape:\n *\n * - **A repeated group whose body is itself variable** (`(a+)+`, `(\\w*)*`, `(a?)+`): the inner\n * repetition is free to re-partition the same text, so the outer one explores an exponential\n * number of partitions.\n * - **A repeated group whose alternation has branches that can match the same prefix**\n * (`(a|ab)+`, `(?:(?:a|aa))*`): the same text is reachable two ways, which is the same\n * exponential multiplicity written differently.\n * - **A run of adjacent variable quantifiers over overlapping operands** (`a?a?…a{n}b`,\n * `\\d*\\d*…`): each quantifier partitions the same text again, which is the first family with\n * no group to hang it on.\n *\n * This is a conservative analysis of a literal pattern, not a proof: it walks groups, escapes\n * and character classes so that `[{]` is not read as a group, and it refuses only constructs it\n * can name. A pattern it passes is still bounded by the per-call work ceiling. It runs at compile\n * time for a literal and, for a computed pattern, before every call.\n */\nexport function unsafePattern(pattern: string, flags?: string): string | undefined {\n return analysePattern(pattern, 0, flags ?? '').unsafe;\n}\n\n/**\n * Reads one character class, returning its ranges and the index after the closing `]`.\n *\n * A class whose escape names a set the scan cannot enumerate (a property escape, an unrecognised\n * escape) is marked `unknown`, which makes every overlap comparison conservative.\n */\ninterface ClassRead {\n readonly next: number;\n readonly ranges: readonly (readonly [number, number])[];\n readonly negated: boolean;\n readonly unknown: boolean;\n}\n\ninterface ClassElement {\n readonly next: number;\n readonly code?: number;\n readonly ranges?: readonly (readonly [number, number])[];\n readonly unknown?: boolean;\n}\n\nfunction classElement(source: string, index: number): ClassElement {\n const character = source[index] ?? '';\n if (character !== '\\\\') {\n const code = source.codePointAt(index) ?? 0;\n return { next: index + (code > 0xffff ? 2 : 1), code };\n }\n const escaped = source[index + 1] ?? '';\n if (escaped === 'd') return { next: index + 2, ranges: DIGIT_RANGES };\n if (escaped === 'w') return { next: index + 2, ranges: WORD_RANGES };\n if (escaped === 's') return { next: index + 2, ranges: SPACE_RANGES };\n if (escaped === 'p' || escaped === 'P') {\n const close = source.indexOf('}', index + 2);\n return { next: close === -1 ? index + 2 : close + 1, unknown: true };\n }\n const text = escapeText(escaped);\n if (text === undefined) return { next: index + 2, unknown: true };\n return { next: index + 2, code: text.codePointAt(0) ?? 0 };\n}\n\nfunction readCharacterClass(source: string, start: number): ClassRead {\n let index = start + 1;\n let negated = false;\n if (source[index] === '^') {\n negated = true;\n index += 1;\n }\n const ranges: (readonly [number, number])[] = [];\n let unknown = false;\n while (index < source.length) {\n // In ECMAScript `/u` mode, `]` closes a character class even as its first element (`[]` and `[^]`).\n if (source[index] === ']') {\n return { next: index + 1, ranges, negated, unknown };\n }\n const element = classElement(source, index);\n index = element.next;\n if (element.unknown === true) {\n unknown = true;\n continue;\n }\n if (element.ranges !== undefined) {\n for (const range of element.ranges) ranges.push(range);\n continue;\n }\n const from = element.code ?? 0;\n if (source[index] === '-' && source[index + 1] !== undefined && source[index + 1] !== ']') {\n const toElement = classElement(source, index + 1);\n index = toElement.next;\n if (toElement.unknown === true || toElement.ranges !== undefined) {\n ranges.push([from, from]);\n unknown = true;\n continue;\n }\n const to = toElement.code ?? 0;\n ranges.push(to >= from ? [from, to] : [from, from]);\n continue;\n }\n ranges.push([from, from]);\n }\n return { next: index, ranges, negated, unknown };\n}\n\n/** The operand a class read states, or `unknown` when it named a set the scan cannot compare. */\nfunction operandFromClass(read: ClassRead): Operand {\n return read.unknown\n ? { kind: 'unknown' }\n : { kind: 'set', ranges: read.ranges, negated: read.negated };\n}\n\n/** Skips `{...}` after a `\\p`, `\\P` or `\\u` escape, or the single character of a short escape. */\nfunction skipBraced(source: string, index: number): number {\n const close = source.indexOf('}', index);\n return close === -1 ? source.length : close + 1;\n}\n\nfunction skipAngle(source: string, index: number): number {\n const close = source.indexOf('>', index);\n return close === -1 ? source.length : close + 1;\n}\n\n/** The index after the operand of an escape whose first set the scan does not decode. */\nfunction skipUnknownEscape(source: string, index: number, escaped: string): number {\n const afterEscape = index + 2;\n switch (escaped) {\n case 'p':\n case 'P':\n return skipBraced(source, afterEscape);\n case 'k':\n return skipAngle(source, afterEscape);\n case 'u':\n return source[afterEscape] === '{'\n ? skipBraced(source, afterEscape + 1)\n : Math.min(afterEscape + 4, source.length);\n case 'x':\n return Math.min(afterEscape + 2, source.length);\n case 'c':\n return Math.min(afterEscape + 1, source.length);\n default:\n if (/^[1-9]$/.test(escaped)) {\n let cursor = afterEscape;\n while (cursor < source.length && /^[0-9]$/.test(source[cursor] ?? '')) {\n cursor += 1;\n }\n return cursor;\n }\n return afterEscape;\n }\n}\n\n/**\n * Walks a pattern once, stating the first family it refuses and a conservative work bound.\n *\n * The walk understands the constructs that hide a parenthesis, a quantifier or a character set:\n * an escape (`\\(`, `\\{`, `\\d`), a character class (`[{]`), a group prefix (`(?:`, `(?<=`), and a\n * quantifier (`{2,}`). Everything else is read one code point at a time. A group's proven prefix\n * travels to the enclosing branch, so one level of nesting cannot hide an outer repetition's\n * shape, and the same walk records which adjacent quantifiers share an operand set.\n */\nfunction analysePattern(pattern: string, subjectLength: number, flags = ''): PatternAnalysis {\n if (pattern.length > REGEX_PATTERN_LIMIT) {\n return {\n unsafe: `the pattern is ${String(pattern.length)} code units, longer than the ${String(REGEX_PATTERN_LIMIT)}-code-unit limit for a bounded match`,\n work: WORK_CAP,\n };\n }\n const multiline = flags.includes('m');\n const caseInsensitive = flags.includes('i');\n const groups: GroupSpan[] = [];\n const root = newFrame(-1, false);\n const stack: Frame[] = [];\n const top = (): Frame => stack[stack.length - 1] ?? root;\n const refusal: RefusalSink = { adjacent: undefined };\n let previousWasQuantifier = false;\n let index = 0;\n while (index < pattern.length) {\n const character = pattern[index] ?? '';\n if (character === '\\\\') {\n const escaped = pattern[index + 1] ?? '';\n const frame = top();\n const branch = activeBranch(frame);\n if (escaped === 'd' || escaped === 'D') {\n const operand: Operand = { kind: 'set', ranges: DIGIT_RANGES, negated: escaped === 'D' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 'w' || escaped === 'W') {\n const operand: Operand = { kind: 'set', ranges: WORD_RANGES, negated: escaped === 'W' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 's' || escaped === 'S') {\n const operand: Operand = { kind: 'set', ranges: SPACE_RANGES, negated: escaped === 'S' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 'b' || escaped === 'B') {\n // Word boundaries consume no input and do not separate adjacent variable quantifiers\n // (for example, `a?\\Ba?` still lets both quantifiers partition the same text).\n resetPrefixAnchor(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'assertion' });\n } else if (/^[1-9]$/.test(escaped) || escaped === 'k') {\n // A backreference matches whatever an earlier group captured; its length is not a\n // property of the source, so it joins the bound as a variable of the subject length.\n noteAtom(frame, { kind: 'unknown' });\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'backref', bounds: undefined });\n } else if (escapeText(escaped) !== undefined) {\n const text = escapeText(escaped) ?? escaped;\n const operand: Operand = { kind: 'text', text };\n noteAtom(frame, operand);\n appendLiteral(frame, text);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else {\n const operand: Operand = { kind: 'unknown' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: false, bounds: undefined });\n }\n previousWasQuantifier = false;\n index = skipUnknownEscape(pattern, index, escaped);\n continue;\n }\n if (character === '[') {\n const read = readCharacterClass(pattern, index);\n const frame = top();\n const operand = operandFromClass(read);\n noteAtom(frame, operand);\n markOpen(frame);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({\n kind: 'atom',\n operand,\n singleChar: !read.unknown,\n bounds: undefined,\n });\n previousWasQuantifier = false;\n index = read.next;\n continue;\n }\n if (character === '.') {\n const frame = top();\n const operand: Operand = { kind: 'any' };\n noteAtom(frame, operand);\n markOpen(frame);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: false, bounds: undefined });\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n if (character === '(') {\n if (isInlineModifierGroup(pattern, index)) {\n return {\n unsafe:\n 'inline modifier groups such as `(?i:...)` are not supported; pass `i`, `m`, or `s` in the `flags` argument instead',\n work: WORK_CAP,\n };\n }\n stack.push(newFrame(index, groupIsLookaround(pattern, index)));\n previousWasQuantifier = false;\n index = afterGroupPrefix(pattern, index);\n continue;\n }\n if (character === ')') {\n const frame = stack.pop();\n if (frame === undefined) {\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const leadingPrefix = commonPrefix(frame.branches);\n const closed = frame.branches.length === 1 && frame.branches[0]?.closed === true;\n const overlapping = branchesOverlap(frame, caseInsensitive);\n const body: GroupBody = {\n hasQuantifier: frame.variableQuantifier || frame.nestedVariableQuantifier,\n hasOverlappingAlternation: overlapping || frame.nestedOverlappingAlternation,\n leadingPrefix,\n closed,\n };\n groups.push({\n source: pattern.slice(afterGroupPrefix(pattern, frame.open), index),\n quantified: quantifierRepeats(pattern, index + 1),\n body,\n });\n const bounds = quantifierBounds(pattern, index + 1);\n const parent = top();\n const parentBranch = activeBranch(parent);\n const bodyZeroWidth = frame.branches.every((branch) => branch.items.every(isZeroWidthItem));\n const groupZeroWidth = frame.lookaround || bodyZeroWidth || bounds?.max === 0;\n if (!groupZeroWidth) noteAtom(parent, operandFromBody(body));\n const groupProfile = sumWork(\n frame.branches.map((branch) =>\n branchWork(branch.items, subjectLength, caseInsensitive, false),\n ),\n !overlapping,\n );\n if (!frame.lookaround) {\n const groupAnchored =\n !multiline &&\n frame.branches.length > 0 &&\n frame.branches.every((branch) => branch.anchoredStart);\n const groupRequired = bounds === undefined || bounds.min >= 1;\n if (parentBranch.atStart && groupAnchored && groupRequired) {\n parentBranch.anchoredStart = true;\n }\n }\n parentBranch.atStart = false;\n parentBranch.items.push({\n kind: 'group',\n profile: groupProfile,\n lookaround: frame.lookaround,\n zeroWidth: bodyZeroWidth,\n leadingOperand: frame.lookaround ? undefined : leadingOperandFromPrefix(body.leadingPrefix),\n bounds,\n });\n if (!groupZeroWidth) markQuantified(parent, bounds, caseInsensitive, refusal);\n else if (bounds?.variable === true && bounds.max > 0) parent.variableQuantifier = true;\n if (body.hasQuantifier) parent.nestedVariableQuantifier = true;\n if (body.hasOverlappingAlternation) parent.nestedOverlappingAlternation = true;\n if (frame.lookaround) {\n resetPrefixAnchor(parent);\n } else {\n const groupQuantified =\n bounds !== undefined && (bounds.variable || bounds.min !== 1 || bounds.max !== 1);\n const enclosing = currentBranch(parent);\n if (enclosing !== undefined) {\n if (bounds !== undefined && bounds.min === 0) {\n markOpen(parent);\n } else if (body.closed && !groupQuantified) {\n appendLiteral(parent, body.leadingPrefix);\n } else {\n if (enclosing.acceptingPrefix && body.leadingPrefix !== '') {\n enclosing.leadingPrefix += body.leadingPrefix;\n }\n markOpen(parent);\n }\n }\n }\n previousWasQuantifier = bounds !== undefined;\n index += 1 + quantifierLength(pattern, index + 1);\n continue;\n }\n if (character === '|') {\n const frame = top();\n frame.current = undefined;\n frame.previous = undefined;\n frame.branches.push(newBranch());\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const bounds = quantifierBounds(pattern, index);\n if (bounds !== undefined) {\n // A `?` directly after an actual quantifier token is the lazy marker, not a second\n // repetition. Tracking the prior token explicitly avoids mistaking an escaped literal\n // (`\\??`, `\\*?`, `\\+?`, `\\}?`) or property escape (`\\p{L}?`) for a lazy quantifier.\n if (character === '?' && previousWasQuantifier) {\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const frame = top();\n if (bounds.max === 0) {\n // A `{0}` (or `{0,0}`) repetition consumes nothing; keep any preceding variable\n // quantifier as the active predecessor so a zero-width atom cannot split a run.\n frame.current = frame.previous;\n frame.previous = undefined;\n } else {\n markQuantified(frame, bounds, caseInsensitive, refusal);\n }\n applyQuantifierToBranch(frame, bounds);\n const branch = activeBranch(frame);\n const lastItem = branch.items[branch.items.length - 1];\n if (lastItem !== undefined && lastItem.kind !== 'assertion') {\n lastItem.bounds = bounds;\n }\n previousWasQuantifier = true;\n index += quantifierLength(pattern, index);\n continue;\n }\n if (character === '^' || character === '$') {\n // An assertion consumes nothing; it separates runs that would otherwise look adjacent.\n const frame = top();\n frame.current = undefined;\n frame.previous = undefined;\n resetPrefixAnchor(frame);\n const branch = activeBranch(frame);\n if (character === '^' && !multiline && branch.atStart) {\n branch.anchoredStart = true;\n } else if (character === '$') {\n branch.atStart = false;\n }\n branch.items.push({ kind: 'assertion' });\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const codePoint = pattern.codePointAt(index) ?? 0;\n const text = String.fromCodePoint(codePoint);\n const frame = top();\n const operand: Operand = { kind: 'text', text };\n noteAtom(frame, operand);\n appendLiteral(frame, text);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n previousWasQuantifier = false;\n index += text.length;\n }\n const rootProfile = sumWork(\n root.branches.map((branch) => branchWork(branch.items, subjectLength, caseInsensitive, true)),\n );\n const perStartWork = Math.max(1, addWork(rootProfile.overhead, rootProfile.multiplier));\n const anchoredAtStart =\n !multiline && root.branches.length > 0 && root.branches.every((branch) => branch.anchoredStart);\n const startPositions = anchoredAtStart ? 1 : subjectLength + 1;\n let unsafe = refusal.adjacent;\n if (unsafe === undefined) {\n for (const group of groups) {\n if (!group.quantified) continue;\n if (group.body.hasQuantifier) {\n unsafe = `a repeated group contains a variable quantifier (\\`(${group.source})\\`), which backtracks exponentially over repeated input; make one repetition do the work, such as \\`[A-Za-z]+[0-9]+\\` instead of \\`([A-Za-z]+[0-9])+\\``;\n break;\n }\n if (group.body.hasOverlappingAlternation) {\n unsafe = `a repeated group has alternation branches that can match the same prefix (\\`(${group.source})\\`), which backtracks exponentially; make the branches disjoint, such as \\`(?:ab|ac)+\\` instead of \\`(a|ab)+\\``;\n break;\n }\n }\n }\n return {\n unsafe,\n work: multiplyWork(startPositions, perStartWork),\n };\n}\n\ninterface CompiledPattern {\n readonly regex: RegExp;\n}\n\n/** The `(pattern, flags)` pairs already compiled, oldest first for bounded eviction. */\nconst COMPILED = new Map<string, CompiledPattern>();\n\nfunction cacheKey(pattern: string, flags: string): string {\n return `${flags}\\u0000${pattern}`;\n}\n\n/**\n * Compiles one pattern, or states why it cannot be compiled.\n *\n * A `SyntaxError` from the engine is data: a computed pattern that does not parse is a\n * value-stated refusal the report can name, not an exception a host sees. The cache is bounded\n * because a document can write an unbounded number of distinct computed patterns, and a\n * process-global map an input can grow is a leak.\n */\nexport function compileRegex(\n pattern: string,\n canonical: string,\n): { readonly kind: 'ok'; readonly regex: RegExp } | RegexRefusal {\n const key = cacheKey(pattern, canonical);\n const cached = COMPILED.get(key);\n if (cached !== undefined) {\n // Refresh the recency of a hit, so the entries evicted are the least recently used.\n COMPILED.delete(key);\n COMPILED.set(key, cached);\n return { kind: 'ok', regex: cached.regex };\n }\n let regex: RegExp;\n try {\n regex = new RegExp(pattern, canonical);\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n return { kind: 'invalid-pattern', detail };\n }\n COMPILED.set(key, { regex });\n if (COMPILED.size > REGEX_CACHE_LIMIT) {\n const oldest = COMPILED.keys().next();\n if (!oldest.done) COMPILED.delete(oldest.value);\n }\n return { kind: 'ok', regex };\n}\n\n/** A refusal as the `ENGINE_ERROR` the evaluator reports at the call's path. */\nexport function regexRefusalError(refusal: RegexRefusal, path: string): AxiomError {\n switch (refusal.kind) {\n case 'invalid-flags':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n case 'invalid-pattern':\n return new AxiomError(\n 'ENGINE_ERROR',\n `matches: the pattern is not a valid regular expression (${refusal.detail})`,\n path,\n );\n case 'unsafe-pattern':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n case 'subject-too-long':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n }\n}\n\n/**\n * `matches(s, pattern, flags?)`: an unanchored Unicode search, or the refusal that stops it.\n *\n * The subject cap is checked before compilation, so an oversized input is refused whether or\n * not the pattern would have matched, and the answer is never a silent `false`. The work ceiling\n * is checked at this call's subject length, so a pattern that is ordinary over a short value is\n * not refused for it, and a shape the structural scan did not name still cannot outlast the\n * budget.\n */\nexport function matchRegex(\n subject: string,\n pattern: string,\n flags: string,\n): { readonly kind: 'tested'; readonly matched: boolean } | RegexRefusal {\n const length = codePointLength(subject);\n if (length > REGEX_SUBJECT_LIMIT) {\n return {\n kind: 'subject-too-long',\n detail: `the subject is ${String(length)} code points, longer than the ${String(REGEX_SUBJECT_LIMIT)}-code-point limit for a pattern check`,\n };\n }\n const canonical = canonicalFlags(flags);\n if (canonical.kind !== 'ok') return canonical;\n const analysis = analysePattern(pattern, length, canonical.flags);\n // A pattern the artifact states literally was analysed at compile time; a pattern that\n // arrived as a value is analysed here, with the same rule.\n if (analysis.unsafe !== undefined) {\n return { kind: 'unsafe-pattern', detail: analysis.unsafe };\n }\n const compiled = compileRegex(pattern, canonical.flags);\n if (compiled.kind !== 'ok') return compiled;\n if (analysis.work > REGEX_MATCH_WORK_LIMIT) {\n return {\n kind: 'unsafe-pattern',\n detail: `the pattern exceeds the ${String(REGEX_MATCH_WORK_LIMIT)}-step work budget on a ${String(length)}-code-point subject; shorten the subject or simplify the pattern`,\n };\n }\n return { kind: 'tested', matched: compiled.regex.test(subject) };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"regex.js","sourceRoot":"","sources":["../../src/expr/regex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,kGAAkG;AAClG,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAG,UAAU,CAAC;AAE1C,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAGpD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAEpC,8EAA8E;AAC9E,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAS9B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa;IAEb,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,SAAS,GAAG,gBAAgB,CAAC;IACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAE,WAAiC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACvD,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,KAAK,IAAI,uJAAuJ;aACzK,CAAC;QACJ,CAAC;QACD,IAAI,I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C,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IAClE,uFAAuF;IACvF,2DAA2D;IAC3D,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC7D,CAAC;IACD,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACxD,IAAI,QAAQ,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IAC5C,IAAI,QAAQ,CAAC,IAAI,GAAG,sBAAsB,EAAE,CAAC;QAC3C,OAAO;YACL,IAAI,EAAE,gBAAgB;YACtB,MAAM,EAAE,2BAA2B,MAAM,CAAC,sBAAsB,CAAC,0BAA0B,MAAM,CAAC,MAAM,CAAC,kEAAkE;SAC5K,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;AACnE,CAAC","sourcesContent":["import { AxiomError } from '../model/errors.js';\nimport { codePointLength } from './strings.js';\n\n/**\n * `matches(s, pattern, flags?)`: JavaScript regular-expression search with Unicode semantics,\n * `spec/semantics/expr-v1.md` `EXPR-14.1.12` to `EXPR-14.1.14`.\n *\n * Four properties make this operator defensible to ship:\n *\n * 1. **One dialect.** The pattern is an ECMAScript regular expression with the `u` flag always\n * set, so `\\p{L}`, `\\p{Script=Han}` and an astral character are one expression each and the\n * answer never depends on the host locale. `i`, `m` and `s` are the only other flags the\n * language admits; `g`, `y` and `d` describe state or indices a boolean test has no use for.\n * 2. **A bounded subject.** A subject longer than {@link REGEX_SUBJECT_LIMIT} code points is\n * refused before the engine runs, so no authored pattern can be used to scan a document\n * field of unbounded size.\n * 3. **The classic exponential shapes are refused.** {@link unsafePattern} refuses a repeated\n * group whose body is variable or whose alternation overlaps, and a run of adjacent variable\n * quantifiers whose operands can match the same text (`a?a?…`, `\\d*\\d*…`). A pattern that\n * arrives as a value is analysed by the same scan before the engine runs.\n * 4. **Every call has a work ceiling.** A family scan can always be beaten by a shape it does\n * not name, so the engine is never handed a pattern whose conservative backtracking bound at\n * this subject length exceeds {@link REGEX_MATCH_WORK_LIMIT}. The bound is computed from the\n * parsed source and the subject length, not measured after the fact, so a hostile computed\n * pattern is refused with `unsafe-pattern` instead of spending a request's latency.\n *\n * The compiled `RegExp` is cached per `(pattern, flags)`, so an item-scoped rule over a\n * thousand rows compiles one pattern and tests a thousand subjects.\n */\n\n/** The subject cap in code points: a longer input is refused, never scanned and never `false`. */\nexport const REGEX_SUBJECT_LIMIT = 4096;\n\n/**\n * The per-call work ceiling, in backtracking steps.\n *\n * A step stands for one path the engine may try or one character it may revisit. The estimate\n * below is deliberately conservative, so a pattern can be refused while its ordinary cost is\n * lower; the alternative, running an unbounded engine on the renderer's thread, is the failure\n * this ceiling exists to prevent. The value matches the `ascii_match` matcher's budget, so the\n * two pattern operators refuse at the same order of work.\n */\nconst REGEX_MATCH_WORK_LIMIT = 24_000_000;\n\n/** The optional flags an author may write, in the canonical order the cache keys on. */\nexport const REGEX_FLAGS = ['i', 'm', 's'] as const;\nexport type RegexFlag = (typeof REGEX_FLAGS)[number];\n\n/** The flag string every compiled pattern carries: `u` is not optional. */\nexport const BASE_REGEX_FLAGS = 'u';\n\n/** How many `(pattern, flags)` pairs the evaluator keeps compiled at once. */\nconst REGEX_CACHE_LIMIT = 256;\n\n/** Why a pattern or subject was refused, as data rather than a thrown error. */\nexport type RegexRefusal =\n | { readonly kind: 'invalid-flags'; readonly detail: string }\n | { readonly kind: 'invalid-pattern'; readonly detail: string }\n | { readonly kind: 'unsafe-pattern'; readonly detail: string }\n | { readonly kind: 'subject-too-long'; readonly detail: string };\n\n/**\n * The canonical flag string for one authored `flags` operand, or the refusal naming the\n * offending flag.\n *\n * The author writes a subset of `ims`; `u` is added here rather than accepted, so a document\n * cannot opt out of Unicode semantics by writing `g` or by writing nothing.\n */\nexport function canonicalFlags(\n flags: string,\n): { readonly kind: 'ok'; readonly flags: string } | RegexRefusal {\n const seen = new Set<string>();\n let canonical = BASE_REGEX_FLAGS;\n for (const flag of flags) {\n if (!(REGEX_FLAGS as readonly string[]).includes(flag)) {\n return {\n kind: 'invalid-flags',\n detail: `\\`${flag}\\` is not a supported flag; write \\`i\\`, \\`m\\`, \\`s\\` or omit the operand (the \\`u\\` flag is always on, and \\`g\\`, \\`y\\` and \\`d\\` are not available)`,\n };\n }\n if (seen.has(flag)) {\n return {\n kind: 'invalid-flags',\n detail: `flag \\`${flag}\\` is written twice; a flag may appear once`,\n };\n }\n seen.add(flag);\n }\n // Canonicalising the order keeps `im` and `mi` one cache entry, exactly as `RegExp` treats\n // them as one flag set.\n for (const flag of REGEX_FLAGS) {\n if (seen.has(flag)) canonical += flag;\n }\n return { kind: 'ok', flags: canonical };\n}\n\n/** The length of a quantifier at `index`, or 0 when the character there is a literal. */\nfunction quantifierLength(source: string, index: number): number {\n const character = source[index];\n if (character === '*' || character === '+' || character === '?') return 1;\n if (character !== '{') return 0;\n const match = /^\\{[0-9]+(?:,[0-9]*)?\\}/.exec(source.slice(index));\n return match === null ? 0 : match[0].length;\n}\n\n/** The repetition bounds a quantifier at `index` states, or `undefined` when none is there. */\ninterface QuantifierBounds {\n readonly min: number;\n readonly max: number;\n readonly variable: boolean;\n}\n\nfunction quantifierBounds(source: string, index: number): QuantifierBounds | undefined {\n const character = source[index];\n if (character === '?') return { min: 0, max: 1, variable: true };\n if (character === '*') return { min: 0, max: Number.POSITIVE_INFINITY, variable: true };\n if (character === '+') return { min: 1, max: Number.POSITIVE_INFINITY, variable: true };\n if (character !== '{') return undefined;\n const match = /^\\{([0-9]+)(?:,([0-9]*))?\\}/.exec(source.slice(index));\n if (match === null) return undefined;\n const min = Number(match[1]);\n // `{n}` is one count; `{n,}` and `{n,m}` vary.\n if (match[2] === undefined) return { min, max: min, variable: false };\n const max = match[2] === '' ? Number.POSITIVE_INFINITY : Number(match[2]);\n return { min, max, variable: true };\n}\n\n/**\n * Whether the construct at `index` repeats its operand at least twice, which is what turns a\n * nested ambiguity into exponential work. `?` is absent: it repeats zero or one time.\n */\nfunction quantifierRepeats(source: string, index: number): boolean {\n const bounds = quantifierBounds(source, index);\n if (bounds === undefined) return false;\n return bounds.max === Number.POSITIVE_INFINITY || bounds.max >= 2;\n}\n\n/** The index of the first body character after a `(` at `index`, skipping a group prefix. */\nfunction afterGroupPrefix(source: string, index: number): number {\n let cursor = index + 1;\n if (source[cursor] !== '?') return cursor;\n cursor += 1;\n const marker = source[cursor];\n if (marker === ':') return cursor + 1;\n if (marker === '=' || marker === '!') return cursor + 1;\n if (marker === '<') {\n const next = source[cursor + 1];\n // `(?<=` and `(?<!` are lookbehind assertions, not named groups: the `>` belongs to no\n // prefix here, and searching for one would swallow the body.\n if (next === '=' || next === '!') return cursor + 2;\n const close = source.indexOf('>', cursor);\n return close === -1 ? cursor + 1 : close + 1;\n }\n return cursor;\n}\n\n/** Whether a group at `index` is a lookahead or lookbehind assertion, which consumes nothing. */\nfunction groupIsLookaround(source: string, index: number): boolean {\n if (source[index + 1] !== '?') return false;\n const marker = source[index + 2];\n return (\n marker === '=' ||\n marker === '!' ||\n (marker === '<' && (source[index + 3] === '=' || source[index + 3] === '!'))\n );\n}\n\n/**\n * Whether `(` at `index` opens an ES2025 inline modifier group (`(?i:...)`, `(?-m:...)`,\n * `(?im-s:...)`).\n *\n * Inline modifier groups are outside the ES2023 / Hermes V1 runtime floor and change `i`/`m`/`s`\n * scoping mid-pattern, so the safety scan refuses them explicitly.\n */\nfunction isInlineModifierGroup(source: string, index: number): boolean {\n if (source[index + 1] !== '?') return false;\n return /^\\(\\?(?:[ims]+(?:-[ims]*)?|-[ims]+):/.test(source.slice(index));\n}\n\n/**\n * Affine work summary for a branch or group: given a continuation taking `R` steps, executing\n * this construct followed by the continuation takes at most `overhead + multiplier * R` steps.\n */\ninterface WorkProfile {\n readonly overhead: number;\n readonly multiplier: number;\n}\n\n/** One item in a parsed branch, retained to evaluate sequential and barrier-bounded work. */\ntype BranchItem =\n | {\n readonly kind: 'atom';\n readonly operand: Operand;\n readonly singleChar: boolean;\n bounds: QuantifierBounds | undefined;\n }\n | {\n readonly kind: 'group';\n readonly profile: WorkProfile;\n readonly lookaround: boolean;\n readonly zeroWidth: boolean;\n readonly leadingOperand: Operand | undefined;\n bounds: QuantifierBounds | undefined;\n }\n | {\n readonly kind: 'backref';\n bounds: QuantifierBounds | undefined;\n }\n | { readonly kind: 'assertion' };\n\n/** One alternation branch, as far as the safety scan can prove its shape. */\ninterface Branch {\n /**\n * The guaranteed leading literal text the branch begins with before its first non-literal or\n * optional construct, used by `operandFromBody` for adjacent-quantifier disjointness.\n */\n leadingPrefix: string;\n /**\n * Whether `leadingPrefix` is still accepting characters. Once a non-literal, non-1 quantifier,\n * or non-closed group appears, later literals cannot extend the leading prefix.\n */\n acceptingPrefix: boolean;\n /**\n * Whether the entire branch is an exact closed literal sequence. Only closed literal branches\n * can be proven disjoint in `branchesOverlap`.\n */\n closed: boolean;\n /** Length of `leadingPrefix` before the latest construct, for rolling back `min === 0` quantifiers. */\n lastPrefixStart: number;\n /** Whether no consuming construct has preceded a leading `^` anchor in this branch. */\n atStart: boolean;\n /** Whether this branch is anchored at index 0 of the subject (only when `m` is unset). */\n anchoredStart: boolean;\n /** Ordered constructs in this branch for conservative backtracking work estimation. */\n readonly items: BranchItem[];\n}\n\n/** What one group's body contains, as the safety scan needs it. */\ninterface GroupBody {\n readonly hasQuantifier: boolean;\n readonly hasOverlappingAlternation: boolean;\n /** The guaranteed leading literal prefix every branch begins with; `''` when none is guaranteed. */\n readonly leadingPrefix: string;\n /** Whether the body is a single closed literal branch. */\n readonly closed: boolean;\n}\n\ninterface GroupSpan {\n readonly source: string;\n readonly quantified: boolean;\n readonly body: GroupBody;\n}\n\n/**\n * What one quantified operand can begin with, as far as adjacent-run overlap can compare.\n *\n * `text` is a closed literal prefix; `set` is a character class the scan can compare; `any` is\n * `.`; `unknown` is a construct whose first set is not known (a property escape, a backreference,\n * an open group), which is treated as overlapping everything.\n */\ntype Operand =\n | { readonly kind: 'text'; readonly text: string }\n | {\n readonly kind: 'set';\n readonly ranges: readonly (readonly [number, number])[];\n readonly negated: boolean;\n }\n | { readonly kind: 'any' }\n | { readonly kind: 'unknown' };\n\nconst DIGIT_RANGES: readonly (readonly [number, number])[] = [[0x30, 0x39]];\nconst WORD_RANGES: readonly (readonly [number, number])[] = [\n [0x30, 0x39],\n [0x41, 0x5a],\n [0x5f, 0x5f],\n [0x61, 0x7a],\n];\n/** The ECMAScript `\\s` set: WhiteSpace and LineTerminator, as ranges of code points. */\nconst SPACE_RANGES: readonly (readonly [number, number])[] = [\n [0x09, 0x0d],\n [0x20, 0x20],\n [0xa0, 0xa0],\n [0x1680, 0x1680],\n [0x2000, 0x200a],\n [0x2028, 0x2029],\n [0x202f, 0x202f],\n [0x205f, 0x205f],\n [0x3000, 0x3000],\n [0xfeff, 0xfeff],\n];\n\n/** The branch being written in one frame, or `undefined` outside every group. */\nfunction currentBranch(frame: Frame): Branch | undefined {\n if (frame.open === -1) return undefined;\n return frame.branches[frame.branches.length - 1];\n}\n\n/** The active branch of `frame`, including the top-level root frame. */\nfunction activeBranch(frame: Frame): Branch {\n const branch = frame.branches[frame.branches.length - 1];\n if (branch === undefined) {\n const created = newBranch();\n frame.branches.push(created);\n return created;\n }\n return branch;\n}\n\nfunction newBranch(): Branch {\n return {\n leadingPrefix: '',\n acceptingPrefix: true,\n closed: true,\n lastPrefixStart: 0,\n atStart: true,\n anchoredStart: false,\n items: [],\n };\n}\n\n/** Whether any two alternation branches can match the same input prefix. */\nfunction branchesOverlap(frame: Frame, caseInsensitive: boolean): boolean {\n if (frame.branches.length < 2) return false;\n // One non-closed construct is enough: `.`, a character class, a shorthand escape (`\\d`, `\\w`,\n // `\\s`), a backreference, a quantified atom, or a multi-branch nested group can match text\n // another branch begins with. Only closed literal branches can be proven disjoint.\n if (frame.branches.some((branch) => !branch.closed)) return true;\n for (let left = 0; left < frame.branches.length; left += 1) {\n for (let right = left + 1; right < frame.branches.length; right += 1) {\n const leftBranch = frame.branches[left]?.leadingPrefix ?? '';\n const rightBranch = frame.branches[right]?.leadingPrefix ?? '';\n if (textPrefixesOverlap(leftBranch, rightBranch, caseInsensitive)) return true;\n }\n }\n return false;\n}\n\n/** The guaranteed leading literal text every branch begins with, compared by code point. */\nfunction commonPrefix(branches: readonly Branch[]): string {\n let prefix = branches[0]?.leadingPrefix ?? '';\n for (const branch of branches.slice(1)) {\n let index = 0;\n while (index < prefix.length && index < branch.leadingPrefix.length) {\n const left = prefix.codePointAt(index) ?? 0;\n const right = branch.leadingPrefix.codePointAt(index) ?? 0;\n if (left !== right) break;\n index += left > 0xffff ? 2 : 1;\n }\n prefix = prefix.slice(0, index);\n if (prefix === '') break;\n }\n return prefix;\n}\n\n/**\n * Whether an escape names literal text rather than a character set. `\\.`, `\\/` and `\\-` are one\n * character each; `\\d`, `\\w`, `\\s`, `\\p{…}`, `\\u{…}` and a backreference are not, so they are\n * treated as open.\n */\nfunction escapedLiteral(escaped: string): boolean {\n return escaped !== '' && !/[A-Za-z0-9]/.test(escaped);\n}\n\n/** The text one escape stands for, or `undefined` when its first character set is not known. */\nfunction escapeText(escaped: string): string | undefined {\n switch (escaped) {\n case 'n':\n return '\\n';\n case 'r':\n return '\\r';\n case 't':\n return '\\t';\n case 'f':\n return '\\f';\n case 'v':\n return '\\v';\n case '0':\n return '\\0';\n default:\n return escapedLiteral(escaped) ? escaped : undefined;\n }\n}\n\nfunction inRanges(ranges: readonly (readonly [number, number])[], code: number): boolean {\n for (const [from, to] of ranges) {\n if (code >= from && code <= to) return true;\n }\n return false;\n}\n\n/** Whether every code point of `inner` is a member of one of `outer`'s ranges. */\nfunction rangesCoveredBy(\n inner: readonly (readonly [number, number])[],\n outer: readonly (readonly [number, number])[],\n): boolean {\n for (const [from, to] of inner) {\n let cursor = from;\n while (cursor <= to) {\n let next = -1;\n for (const [outerFrom, outerTo] of outer) {\n if (cursor >= outerFrom && cursor <= outerTo) {\n next = outerTo + 1;\n break;\n }\n }\n if (next === -1) return false;\n cursor = next;\n }\n }\n return true;\n}\n\nfunction setsOverlap(\n left: { readonly ranges: readonly (readonly [number, number])[]; readonly negated: boolean },\n right: { readonly ranges: readonly (readonly [number, number])[]; readonly negated: boolean },\n): boolean {\n if (!left.negated && !right.negated) {\n for (const [leftFrom, leftTo] of left.ranges) {\n for (const [rightFrom, rightTo] of right.ranges) {\n if (leftFrom <= rightTo && rightFrom <= leftTo) return true;\n }\n }\n return false;\n }\n // A negated set overlaps unless the positive side lies wholly inside the excluded ranges.\n if (left.negated && !right.negated) return !rangesCoveredBy(right.ranges, left.ranges);\n if (!left.negated && right.negated) return !rangesCoveredBy(left.ranges, right.ranges);\n return true;\n}\n\nfunction isAsciiLetter(code: number): boolean {\n return (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a);\n}\n\nfunction isAsciiNonLetter(code: number): boolean {\n return code >= 0 && code <= 0x7f && !isAsciiLetter(code);\n}\n\nfunction isAsciiNonLetterRange(from: number, to: number): boolean {\n if (from < 0 || to > 0x7f) return false;\n if (from <= 0x5a && to >= 0x41) return false;\n if (from <= 0x7a && to >= 0x61) return false;\n return true;\n}\n\n/**\n * Whether two literal prefixes can match text beginning the same way under the active `i` flag.\n *\n * Under `/iu`, ASCII non-letters participate in no Unicode simple case folding, so a mismatch\n * involving one proves disjointness. Any other differing pair (ASCII letters or non-ASCII code\n * points such as `\\u017f` or `\\u212a`) is treated conservatively as overlapping without relying\n * on `.toLowerCase()`.\n */\nfunction textPrefixesOverlap(left: string, right: string, caseInsensitive: boolean): boolean {\n if (left === '' || right === '') return true;\n if (!caseInsensitive) {\n return left.startsWith(right) || right.startsWith(left);\n }\n let leftIndex = 0;\n let rightIndex = 0;\n while (leftIndex < left.length && rightIndex < right.length) {\n const leftCode = left.codePointAt(leftIndex) ?? 0;\n const rightCode = right.codePointAt(rightIndex) ?? 0;\n if (leftCode !== rightCode) {\n return !(isAsciiNonLetter(leftCode) || isAsciiNonLetter(rightCode));\n }\n leftIndex += leftCode > 0xffff ? 2 : 1;\n rightIndex += rightCode > 0xffff ? 2 : 1;\n }\n return true;\n}\n\n/**\n * Whether an operand matches only ASCII non-letter code points, which participate in no Unicode\n * simple case folding under the `iu` flags.\n */\nfunction isCaseInvariantOperand(operand: Operand): boolean {\n if (operand.kind === 'text') {\n if (operand.text === '') return false;\n const code = operand.text.codePointAt(0) ?? 0;\n return isAsciiNonLetter(code);\n }\n if (operand.kind === 'set' && !operand.negated) {\n return operand.ranges.every(([from, to]) => isAsciiNonLetterRange(from, to));\n }\n return false;\n}\n\n/** Whether two quantified operands can match text that begins the same way. */\nfunction operandsOverlap(left: Operand, right: Operand): boolean {\n if (left.kind === 'unknown' || right.kind === 'unknown') return true;\n if (left.kind === 'any' || right.kind === 'any') return true;\n if (left.kind === 'text' && right.kind === 'text') {\n return textPrefixesOverlap(left.text, right.text, false);\n }\n if (left.kind === 'text' && right.kind === 'set') {\n const first = left.text.codePointAt(0) ?? 0;\n return inRanges(right.ranges, first) !== right.negated;\n }\n if (left.kind === 'set' && right.kind === 'text') {\n const first = right.text.codePointAt(0) ?? 0;\n return inRanges(left.ranges, first) !== left.negated;\n }\n if (left.kind === 'set' && right.kind === 'set') return setsOverlap(left, right);\n return true;\n}\n\n/** Whether two operands can match text beginning the same way under the active `i` flag. */\nfunction operandsOverlapWithFlags(\n left: Operand,\n right: Operand,\n caseInsensitive: boolean,\n): boolean {\n if (!caseInsensitive) return operandsOverlap(left, right);\n if (left.kind === 'text' && right.kind === 'text') {\n return textPrefixesOverlap(left.text, right.text, true);\n }\n if (isCaseInvariantOperand(left) || isCaseInvariantOperand(right)) {\n return operandsOverlap(left, right);\n }\n return true;\n}\n\n/** The operand one group body presents: its guaranteed leading literal prefix, or unknown. */\nfunction operandFromBody(body: GroupBody): Operand {\n return body.leadingPrefix === ''\n ? { kind: 'unknown' }\n : { kind: 'text', text: body.leadingPrefix };\n}\n\ninterface Frame {\n /** The index of the `(` that opened this group; `-1` for the top level. */\n readonly open: number;\n /** The alternation branches written directly in this group. */\n readonly branches: Branch[];\n /** A variable quantifier appears at this group's own level. */\n variableQuantifier: boolean;\n /** A variable quantifier appears at any depth inside this group. */\n nestedVariableQuantifier: boolean;\n /** A nested group's alternation can match the same prefix two ways. */\n nestedOverlappingAlternation: boolean;\n /** The atom currently being written at this level. */\n current: { readonly operand: Operand; variable: boolean } | undefined;\n /** The variable-quantified atom immediately before `current`, if the run has not broken. */\n previous: { readonly operand: Operand; variable: boolean } | undefined;\n /** Whether this group is a lookaround, whose body is tried at each start position. */\n readonly lookaround: boolean;\n}\n\n/** The result of one structural analysis: the named refusals and a work estimate. */\ninterface PatternAnalysis {\n /** Why the pattern is refused before the engine runs, or `undefined` when it is admitted. */\n readonly unsafe: string | undefined;\n /** A conservative upper bound on backtracking steps at the analysed subject length. */\n readonly work: number;\n}\n\n/** The pattern cap in code units: analysis reads every character, so a longer value is refused. */\nconst REGEX_PATTERN_LIMIT = 4096;\n\nconst WORK_CAP = REGEX_MATCH_WORK_LIMIT + 1;\n\n/** Adds two work estimates, saturating at one above the ceiling rather than overflowing. */\nfunction addWork(left: number, right: number): number {\n if (left >= WORK_CAP || right >= WORK_CAP) return WORK_CAP;\n const sum = left + right;\n return sum >= WORK_CAP ? WORK_CAP : sum;\n}\n\n/** Multiplies two work estimates, saturating at one above the ceiling rather than overflowing. */\nfunction multiplyWork(left: number, right: number): number {\n if (left <= 0 || right <= 0) return 0;\n if (left >= WORK_CAP || right >= WORK_CAP) return WORK_CAP;\n return left > WORK_CAP / right ? WORK_CAP : left * right;\n}\n\n/** The number of repetition counts one quantifier can choose, capped by subject length. */\nfunction quantifierWork(bounds: QuantifierBounds, subjectLength: number): number {\n if (!bounds.variable) return 1;\n if (bounds.min > subjectLength) return 1;\n const maxRepeats =\n bounds.max === Number.POSITIVE_INFINITY ? subjectLength : Math.min(bounds.max, subjectLength);\n return Math.max(1, maxRepeats - bounds.min + 1);\n}\n\nfunction composeWork(first: WorkProfile, then: WorkProfile): WorkProfile {\n return {\n overhead: addWork(first.overhead, multiplyWork(first.multiplier, then.overhead)),\n multiplier: multiplyWork(first.multiplier, then.multiplier),\n };\n}\n\n/** Composes one affine work profile with itself `count` times, saturating at `WORK_CAP`. */\nfunction repeatWork(profile: WorkProfile, count: number): WorkProfile {\n if (count <= 0) return { overhead: 0, multiplier: 1 };\n let result: WorkProfile = { overhead: 0, multiplier: 1 };\n let base = profile;\n let remaining = count;\n while (remaining > 0) {\n if ((remaining & 1) === 1) {\n result = composeWork(result, base);\n if (result.overhead >= WORK_CAP && result.multiplier >= WORK_CAP) {\n return { overhead: WORK_CAP, multiplier: WORK_CAP };\n }\n }\n remaining = Math.floor(remaining / 2);\n if (remaining > 0) base = composeWork(base, base);\n }\n return result;\n}\n\nfunction sumWork(branches: readonly WorkProfile[], disjoint = false): WorkProfile {\n let overhead = 0;\n let multiplier = 0;\n for (const branch of branches) {\n overhead = addWork(overhead, branch.overhead);\n multiplier = disjoint\n ? Math.max(multiplier, branch.multiplier)\n : addWork(multiplier, branch.multiplier);\n }\n return { overhead, multiplier };\n}\n\n/** The first code point of a guaranteed leading literal prefix, or `undefined` when empty. */\nfunction leadingOperandFromPrefix(prefix: string): Operand | undefined {\n if (prefix === '') return undefined;\n const codePoint = prefix.codePointAt(0);\n if (codePoint === undefined) return undefined;\n return { kind: 'text', text: String.fromCodePoint(codePoint) };\n}\n\n/** Whether a parsed branch item can never consume input. */\nfunction isZeroWidthItem(item: BranchItem): boolean {\n switch (item.kind) {\n case 'assertion':\n return true;\n case 'atom':\n case 'backref':\n return item.bounds?.max === 0;\n case 'group':\n return item.lookaround || item.zeroWidth || item.bounds?.max === 0;\n }\n}\n\nfunction allAssertionsFrom(items: readonly BranchItem[], startIndex: number): boolean {\n for (let index = startIndex; index < items.length; index += 1) {\n if (items[index]?.kind !== 'assertion') return false;\n }\n return true;\n}\n\nfunction isDisjointBarrier(\n item: Extract<BranchItem, { kind: 'atom' }>,\n items: readonly BranchItem[],\n nextIndex: number,\n atPatternEnd: boolean,\n caseInsensitive: boolean,\n): boolean {\n if (!item.singleChar) return false;\n const next = items[nextIndex];\n if (next === undefined) return false;\n if (next.kind === 'atom') {\n if (!next.singleChar) return false;\n if (next.bounds !== undefined && next.bounds.min < 1) return false;\n return !operandsOverlapWithFlags(item.operand, next.operand, caseInsensitive);\n }\n if (next.kind === 'group') {\n if (next.lookaround || next.leadingOperand === undefined || next.bounds?.max === 0) {\n return false;\n }\n const required = next.bounds === undefined || next.bounds.min >= 1;\n const tailOnlyAssertions = atPatternEnd && allAssertionsFrom(items, nextIndex + 1);\n if (!required && !tailOnlyAssertions) return false;\n return !operandsOverlapWithFlags(item.operand, next.leadingOperand, caseInsensitive);\n }\n return false;\n}\n\nfunction itemWorkProfile(\n item: BranchItem,\n items: readonly BranchItem[],\n nextIndex: number,\n atPatternEnd: boolean,\n subjectLength: number,\n caseInsensitive: boolean,\n): WorkProfile {\n switch (item.kind) {\n case 'assertion':\n return { overhead: 0, multiplier: 1 };\n case 'backref': {\n const base = subjectLength + 1;\n const factor =\n item.bounds?.variable === true\n ? multiplyWork(base, quantifierWork(item.bounds, subjectLength))\n : base;\n return { overhead: 0, multiplier: factor };\n }\n case 'group': {\n if (item.lookaround) {\n const inner = addWork(item.profile.overhead, item.profile.multiplier);\n if (item.bounds?.variable === true) {\n const repeats = quantifierWork(item.bounds, subjectLength);\n return { overhead: multiplyWork(repeats, inner), multiplier: repeats };\n }\n if (item.bounds !== undefined) {\n if (item.bounds.max === 0) return { overhead: 0, multiplier: 1 };\n if (item.bounds.min > 1) {\n return { overhead: multiplyWork(item.bounds.min, inner), multiplier: 1 };\n }\n }\n return { overhead: inner, multiplier: 1 };\n }\n if (item.bounds?.variable === true) {\n const repeats = quantifierWork(item.bounds, subjectLength);\n const maxRepeats =\n item.bounds.max === Number.POSITIVE_INFINITY\n ? subjectLength\n : Math.min(item.bounds.max, subjectLength);\n const repeated = repeatWork(item.profile, maxRepeats);\n return {\n overhead: repeated.overhead,\n multiplier: multiplyWork(repeats, repeated.multiplier),\n };\n }\n if (item.bounds !== undefined) {\n if (item.bounds.max === 0) return { overhead: 0, multiplier: 1 };\n if (item.bounds.min > 1) {\n return repeatWork(item.profile, item.bounds.min);\n }\n }\n return item.profile;\n }\n case 'atom': {\n if (item.bounds === undefined || !item.bounds.variable) {\n return { overhead: 1, multiplier: 1 };\n }\n const repeats = quantifierWork(item.bounds, subjectLength);\n if (isDisjointBarrier(item, items, nextIndex, atPatternEnd, caseInsensitive)) {\n // A quantified single-char atom followed by a disjoint required atom, a disjoint required\n // group, or a disjoint optional group at the end of the pattern can enter the continuation\n // at most once per entry, so its scan and failback steps are additive.\n return { overhead: repeats, multiplier: 1 };\n }\n return { overhead: 0, multiplier: repeats };\n }\n }\n}\n\nfunction branchWork(\n items: readonly BranchItem[],\n subjectLength: number,\n caseInsensitive: boolean,\n atPatternEnd: boolean,\n): WorkProfile {\n let profile: WorkProfile = { overhead: 0, multiplier: 1 };\n for (let index = items.length - 1; index >= 0; index -= 1) {\n const item = items[index];\n if (item === undefined) continue;\n profile = composeWork(\n itemWorkProfile(item, items, index + 1, atPatternEnd, subjectLength, caseInsensitive),\n profile,\n );\n }\n return profile;\n}\n\nfunction newFrame(open: number, lookaround: boolean): Frame {\n return {\n open,\n branches: [newBranch()],\n variableQuantifier: false,\n nestedVariableQuantifier: false,\n nestedOverlappingAlternation: false,\n current: undefined,\n previous: undefined,\n lookaround,\n };\n}\n\n/** Records that the current branch encountered a non-literal construct. */\nfunction markOpen(frame: Frame): void {\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.closed = false;\n branch.acceptingPrefix = false;\n branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Prevents a trailing quantifier on a zero-width construct from rolling back an earlier literal. */\nfunction resetPrefixAnchor(frame: Frame): void {\n const branch = currentBranch(frame);\n if (branch !== undefined) branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Appends literal text to the current branch's guaranteed leading prefix when still accepting. */\nfunction appendLiteral(frame: Frame, text: string): void {\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.lastPrefixStart = branch.leadingPrefix.length;\n if (branch.acceptingPrefix) branch.leadingPrefix += text;\n}\n\n/**\n * Updates branch prefix and closedness when a quantifier applies to the previous atom.\n *\n * Any quantifier other than an exact `{1}` opens the branch for alternation overlap and stops\n * extending `leadingPrefix` (so `a{2}b` cannot masquerade as `ab`). When `min === 0`, the\n * optional atom's contribution to `leadingPrefix` is removed.\n */\nfunction applyQuantifierToBranch(frame: Frame, bounds: QuantifierBounds): void {\n if (!bounds.variable && bounds.min === 1 && bounds.max === 1) return;\n const branch = currentBranch(frame);\n if (branch === undefined) return;\n branch.closed = false;\n branch.acceptingPrefix = false;\n if (bounds.min === 0) {\n branch.leadingPrefix = branch.leadingPrefix.slice(0, branch.lastPrefixStart);\n }\n branch.lastPrefixStart = branch.leadingPrefix.length;\n}\n\n/** Starts a new consuming atom at this level, keeping the previous one for an adjacency test. */\nfunction noteAtom(frame: Frame, operand: Operand): void {\n frame.previous = frame.current?.variable === true ? frame.current : undefined;\n frame.current = { operand, variable: false };\n}\n\n/**\n * Records that the current atom carries a quantifier, and refuses a run of adjacent variable\n * quantifiers whose operands can match the same text.\n *\n * Two optional `a`s in a row are the same exponential family as `(a+)+`: the engine chooses how\n * each of them partitions the same input, so `n` optionals have 2ⁿ paths. A separator neither\n * operand can match, such as the digits after the letters in `[A-Za-z]+[0-9]+`, leaves only one\n * partition and is admitted.\n */\nfunction markQuantified(\n frame: Frame,\n bounds: QuantifierBounds | undefined,\n caseInsensitive: boolean,\n refusal: RefusalSink,\n): void {\n if (bounds === undefined || !bounds.variable) return;\n frame.variableQuantifier = true;\n const current = frame.current;\n if (current === undefined) return;\n current.variable = true;\n const previous = frame.previous;\n if (\n previous !== undefined &&\n operandsOverlapWithFlags(previous.operand, current.operand, caseInsensitive)\n ) {\n refusal.adjacent ??=\n 'a run of adjacent variable quantifiers can match the same text, which backtracks exponentially as the run grows; separate them with a character one operand cannot match, such as `[A-Za-z]+[0-9]+` instead of `[A-Za-z0-9]+[A-Za-z0-9]+`';\n }\n}\n\n/** The one mutable sink the walk fills: the first named ambiguity it proves. */\ninterface RefusalSink {\n adjacent: string | undefined;\n}\n\n/**\n * The classic catastrophic-backtracking shapes, as a structural scan of the source text.\n *\n * The three families are the ones an author can write by accident and an engine cannot escape:\n *\n * - **A repeated group whose body is itself variable** (`(a+)+`, `(\\w*)*`, `(a?)+`): the inner\n * repetition is free to re-partition the same text, so the outer one explores an exponential\n * number of partitions.\n * - **A repeated group whose alternation has branches that can match the same prefix**\n * (`(a|ab)+`, `(?:(?:a|aa))*`): the same text is reachable two ways, which is the same\n * exponential multiplicity written differently.\n * - **A run of adjacent variable quantifiers over overlapping operands** (`a?a?…a{n}b`,\n * `\\d*\\d*…`): each quantifier partitions the same text again, which is the first family with\n * no group to hang it on.\n *\n * This is a conservative analysis of a literal pattern, not a proof: it walks groups, escapes\n * and character classes so that `[{]` is not read as a group, and it refuses only constructs it\n * can name. A pattern it passes is still bounded by the per-call work ceiling. It runs at compile\n * time for a literal and, for a computed pattern, before every call.\n */\nexport function unsafePattern(pattern: string, flags?: string): string | undefined {\n return analysePattern(pattern, 0, flags ?? '').unsafe;\n}\n\n/**\n * Reads one character class, returning its ranges and the index after the closing `]`.\n *\n * A class whose escape names a set the scan cannot enumerate (a property escape, an unrecognised\n * escape) is marked `unknown`, which makes every overlap comparison conservative.\n */\ninterface ClassRead {\n readonly next: number;\n readonly ranges: readonly (readonly [number, number])[];\n readonly negated: boolean;\n readonly unknown: boolean;\n}\n\ninterface ClassElement {\n readonly next: number;\n readonly code?: number;\n readonly ranges?: readonly (readonly [number, number])[];\n readonly unknown?: boolean;\n}\n\nfunction classElement(source: string, index: number): ClassElement {\n const character = source[index] ?? '';\n if (character !== '\\\\') {\n const code = source.codePointAt(index) ?? 0;\n return { next: index + (code > 0xffff ? 2 : 1), code };\n }\n const escaped = source[index + 1] ?? '';\n if (escaped === 'd') return { next: index + 2, ranges: DIGIT_RANGES };\n if (escaped === 'w') return { next: index + 2, ranges: WORD_RANGES };\n if (escaped === 's') return { next: index + 2, ranges: SPACE_RANGES };\n if (escaped === 'p' || escaped === 'P') {\n const close = source.indexOf('}', index + 2);\n return { next: close === -1 ? index + 2 : close + 1, unknown: true };\n }\n const text = escapeText(escaped);\n if (text === undefined) return { next: index + 2, unknown: true };\n return { next: index + 2, code: text.codePointAt(0) ?? 0 };\n}\n\nfunction readCharacterClass(source: string, start: number): ClassRead {\n let index = start + 1;\n let negated = false;\n if (source[index] === '^') {\n negated = true;\n index += 1;\n }\n const ranges: (readonly [number, number])[] = [];\n let unknown = false;\n while (index < source.length) {\n // In ECMAScript `/u` mode, `]` closes a character class even as its first element (`[]` and `[^]`).\n if (source[index] === ']') {\n return { next: index + 1, ranges, negated, unknown };\n }\n const element = classElement(source, index);\n index = element.next;\n if (element.unknown === true) {\n unknown = true;\n continue;\n }\n if (element.ranges !== undefined) {\n for (const range of element.ranges) ranges.push(range);\n continue;\n }\n const from = element.code ?? 0;\n if (source[index] === '-' && source[index + 1] !== undefined && source[index + 1] !== ']') {\n const toElement = classElement(source, index + 1);\n index = toElement.next;\n if (toElement.unknown === true || toElement.ranges !== undefined) {\n ranges.push([from, from]);\n unknown = true;\n continue;\n }\n const to = toElement.code ?? 0;\n ranges.push(to >= from ? [from, to] : [from, from]);\n continue;\n }\n ranges.push([from, from]);\n }\n return { next: index, ranges, negated, unknown };\n}\n\n/** The operand a class read states, or `unknown` when it named a set the scan cannot compare. */\nfunction operandFromClass(read: ClassRead): Operand {\n return read.unknown\n ? { kind: 'unknown' }\n : { kind: 'set', ranges: read.ranges, negated: read.negated };\n}\n\n/** Skips `{...}` after a `\\p`, `\\P` or `\\u` escape, or the single character of a short escape. */\nfunction skipBraced(source: string, index: number): number {\n const close = source.indexOf('}', index);\n return close === -1 ? source.length : close + 1;\n}\n\nfunction skipAngle(source: string, index: number): number {\n const close = source.indexOf('>', index);\n return close === -1 ? source.length : close + 1;\n}\n\n/** The index after the operand of an escape whose first set the scan does not decode. */\nfunction skipUnknownEscape(source: string, index: number, escaped: string): number {\n const afterEscape = index + 2;\n switch (escaped) {\n case 'p':\n case 'P':\n return skipBraced(source, afterEscape);\n case 'k':\n return skipAngle(source, afterEscape);\n case 'u':\n return source[afterEscape] === '{'\n ? skipBraced(source, afterEscape + 1)\n : Math.min(afterEscape + 4, source.length);\n case 'x':\n return Math.min(afterEscape + 2, source.length);\n case 'c':\n return Math.min(afterEscape + 1, source.length);\n default:\n if (/^[1-9]$/.test(escaped)) {\n let cursor = afterEscape;\n while (cursor < source.length && /^[0-9]$/.test(source[cursor] ?? '')) {\n cursor += 1;\n }\n return cursor;\n }\n return afterEscape;\n }\n}\n\n/**\n * Walks a pattern once, stating the first family it refuses and a conservative work bound.\n *\n * The walk understands the constructs that hide a parenthesis, a quantifier or a character set:\n * an escape (`\\(`, `\\{`, `\\d`), a character class (`[{]`), a group prefix (`(?:`, `(?<=`), and a\n * quantifier (`{2,}`). Everything else is read one code point at a time. A group's proven prefix\n * travels to the enclosing branch, so one level of nesting cannot hide an outer repetition's\n * shape, and the same walk records which adjacent quantifiers share an operand set.\n */\nfunction analysePattern(pattern: string, subjectLength: number, flags = ''): PatternAnalysis {\n if (pattern.length > REGEX_PATTERN_LIMIT) {\n return {\n unsafe: `the pattern is ${String(pattern.length)} code units, longer than the ${String(REGEX_PATTERN_LIMIT)}-code-unit limit for a bounded match`,\n work: WORK_CAP,\n };\n }\n const multiline = flags.includes('m');\n const caseInsensitive = flags.includes('i');\n const groups: GroupSpan[] = [];\n const root = newFrame(-1, false);\n const stack: Frame[] = [];\n const top = (): Frame => stack[stack.length - 1] ?? root;\n const refusal: RefusalSink = { adjacent: undefined };\n let previousWasQuantifier = false;\n let index = 0;\n while (index < pattern.length) {\n const character = pattern[index] ?? '';\n if (character === '\\\\') {\n const escaped = pattern[index + 1] ?? '';\n const frame = top();\n const branch = activeBranch(frame);\n if (escaped === 'd' || escaped === 'D') {\n const operand: Operand = { kind: 'set', ranges: DIGIT_RANGES, negated: escaped === 'D' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 'w' || escaped === 'W') {\n const operand: Operand = { kind: 'set', ranges: WORD_RANGES, negated: escaped === 'W' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 's' || escaped === 'S') {\n const operand: Operand = { kind: 'set', ranges: SPACE_RANGES, negated: escaped === 'S' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else if (escaped === 'b' || escaped === 'B') {\n // Word boundaries consume no input and do not separate adjacent variable quantifiers\n // (for example, `a?\\Ba?` still lets both quantifiers partition the same text).\n resetPrefixAnchor(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'assertion' });\n } else if (/^[1-9]$/.test(escaped) || escaped === 'k') {\n // A backreference matches whatever an earlier group captured; its length is not a\n // property of the source, so it joins the bound as a variable of the subject length.\n noteAtom(frame, { kind: 'unknown' });\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'backref', bounds: undefined });\n } else if (escapeText(escaped) !== undefined) {\n const text = escapeText(escaped) ?? escaped;\n const operand: Operand = { kind: 'text', text };\n noteAtom(frame, operand);\n appendLiteral(frame, text);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n } else {\n const operand: Operand = { kind: 'unknown' };\n noteAtom(frame, operand);\n markOpen(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: false, bounds: undefined });\n }\n previousWasQuantifier = false;\n index = skipUnknownEscape(pattern, index, escaped);\n continue;\n }\n if (character === '[') {\n const read = readCharacterClass(pattern, index);\n const frame = top();\n const operand = operandFromClass(read);\n noteAtom(frame, operand);\n markOpen(frame);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({\n kind: 'atom',\n operand,\n singleChar: !read.unknown,\n bounds: undefined,\n });\n previousWasQuantifier = false;\n index = read.next;\n continue;\n }\n if (character === '.') {\n const frame = top();\n const operand: Operand = { kind: 'any' };\n noteAtom(frame, operand);\n markOpen(frame);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: false, bounds: undefined });\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n if (character === '(') {\n if (isInlineModifierGroup(pattern, index)) {\n return {\n unsafe:\n 'inline modifier groups such as `(?i:...)` are not supported; pass `i`, `m`, or `s` in the `flags` argument instead',\n work: WORK_CAP,\n };\n }\n stack.push(newFrame(index, groupIsLookaround(pattern, index)));\n previousWasQuantifier = false;\n index = afterGroupPrefix(pattern, index);\n continue;\n }\n if (character === ')') {\n const frame = stack.pop();\n if (frame === undefined) {\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const leadingPrefix = commonPrefix(frame.branches);\n const closed = frame.branches.length === 1 && frame.branches[0]?.closed === true;\n const overlapping = branchesOverlap(frame, caseInsensitive);\n const body: GroupBody = {\n hasQuantifier: frame.variableQuantifier || frame.nestedVariableQuantifier,\n hasOverlappingAlternation: overlapping || frame.nestedOverlappingAlternation,\n leadingPrefix,\n closed,\n };\n groups.push({\n source: pattern.slice(afterGroupPrefix(pattern, frame.open), index),\n quantified: quantifierRepeats(pattern, index + 1),\n body,\n });\n const bounds = quantifierBounds(pattern, index + 1);\n const parent = top();\n const parentBranch = activeBranch(parent);\n const bodyZeroWidth = frame.branches.every((branch) => branch.items.every(isZeroWidthItem));\n const groupZeroWidth = frame.lookaround || bodyZeroWidth || bounds?.max === 0;\n if (!groupZeroWidth) noteAtom(parent, operandFromBody(body));\n const groupProfile = sumWork(\n frame.branches.map((branch) =>\n branchWork(branch.items, subjectLength, caseInsensitive, false),\n ),\n !overlapping,\n );\n if (!frame.lookaround) {\n const groupAnchored =\n !multiline &&\n frame.branches.length > 0 &&\n frame.branches.every((branch) => branch.anchoredStart);\n const groupRequired = bounds === undefined || bounds.min >= 1;\n if (parentBranch.atStart && groupAnchored && groupRequired) {\n parentBranch.anchoredStart = true;\n }\n }\n parentBranch.atStart = false;\n parentBranch.items.push({\n kind: 'group',\n profile: groupProfile,\n lookaround: frame.lookaround,\n zeroWidth: bodyZeroWidth,\n leadingOperand: frame.lookaround ? undefined : leadingOperandFromPrefix(body.leadingPrefix),\n bounds,\n });\n if (!groupZeroWidth) markQuantified(parent, bounds, caseInsensitive, refusal);\n else if (bounds?.variable === true && bounds.max > 0) parent.variableQuantifier = true;\n if (body.hasQuantifier) parent.nestedVariableQuantifier = true;\n if (body.hasOverlappingAlternation) parent.nestedOverlappingAlternation = true;\n if (frame.lookaround) {\n resetPrefixAnchor(parent);\n } else {\n const groupQuantified =\n bounds !== undefined && (bounds.variable || bounds.min !== 1 || bounds.max !== 1);\n const enclosing = currentBranch(parent);\n if (enclosing !== undefined) {\n if (bounds !== undefined && bounds.min === 0) {\n markOpen(parent);\n } else if (body.closed && !groupQuantified) {\n appendLiteral(parent, body.leadingPrefix);\n } else {\n if (enclosing.acceptingPrefix && body.leadingPrefix !== '') {\n enclosing.leadingPrefix += body.leadingPrefix;\n }\n markOpen(parent);\n }\n }\n }\n previousWasQuantifier = bounds !== undefined;\n index += 1 + quantifierLength(pattern, index + 1);\n continue;\n }\n if (character === '|') {\n const frame = top();\n frame.current = undefined;\n frame.previous = undefined;\n frame.branches.push(newBranch());\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const bounds = quantifierBounds(pattern, index);\n if (bounds !== undefined) {\n // A `?` directly after an actual quantifier token is the lazy marker, not a second\n // repetition. Tracking the prior token explicitly avoids mistaking an escaped literal\n // (`\\??`, `\\*?`, `\\+?`, `\\}?`) or property escape (`\\p{L}?`) for a lazy quantifier.\n if (character === '?' && previousWasQuantifier) {\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const frame = top();\n if (bounds.max === 0) {\n // A `{0}` (or `{0,0}`) repetition consumes nothing; keep any preceding variable\n // quantifier as the active predecessor so a zero-width atom cannot split a run.\n frame.current = frame.previous;\n frame.previous = undefined;\n } else {\n markQuantified(frame, bounds, caseInsensitive, refusal);\n }\n applyQuantifierToBranch(frame, bounds);\n const branch = activeBranch(frame);\n const lastItem = branch.items[branch.items.length - 1];\n if (lastItem !== undefined && lastItem.kind !== 'assertion') {\n lastItem.bounds = bounds;\n }\n previousWasQuantifier = true;\n index += quantifierLength(pattern, index);\n continue;\n }\n if (character === '^' || character === '$') {\n // An assertion consumes nothing; it separates runs that would otherwise look adjacent.\n const frame = top();\n frame.current = undefined;\n frame.previous = undefined;\n resetPrefixAnchor(frame);\n const branch = activeBranch(frame);\n if (character === '^' && !multiline && branch.atStart) {\n branch.anchoredStart = true;\n } else if (character === '$') {\n branch.atStart = false;\n }\n branch.items.push({ kind: 'assertion' });\n previousWasQuantifier = false;\n index += 1;\n continue;\n }\n const codePoint = pattern.codePointAt(index) ?? 0;\n const text = String.fromCodePoint(codePoint);\n const frame = top();\n const operand: Operand = { kind: 'text', text };\n noteAtom(frame, operand);\n appendLiteral(frame, text);\n const branch = activeBranch(frame);\n branch.atStart = false;\n branch.items.push({ kind: 'atom', operand, singleChar: true, bounds: undefined });\n previousWasQuantifier = false;\n index += text.length;\n }\n const rootProfile = sumWork(\n root.branches.map((branch) => branchWork(branch.items, subjectLength, caseInsensitive, true)),\n );\n const perStartWork = Math.max(1, addWork(rootProfile.overhead, rootProfile.multiplier));\n const anchoredAtStart =\n !multiline && root.branches.length > 0 && root.branches.every((branch) => branch.anchoredStart);\n const startPositions = anchoredAtStart ? 1 : subjectLength + 1;\n let unsafe = refusal.adjacent;\n if (unsafe === undefined) {\n for (const group of groups) {\n if (!group.quantified) continue;\n if (group.body.hasQuantifier) {\n unsafe = `a repeated group contains a variable quantifier (\\`(${group.source})\\`), which backtracks exponentially over repeated input; make one repetition do the work, such as \\`[A-Za-z]+[0-9]+\\` instead of \\`([A-Za-z]+[0-9])+\\``;\n break;\n }\n if (group.body.hasOverlappingAlternation) {\n unsafe = `a repeated group has alternation branches that can match the same prefix (\\`(${group.source})\\`), which backtracks exponentially; make the branches disjoint, such as \\`(?:ab|ac)+\\` instead of \\`(a|ab)+\\``;\n break;\n }\n }\n }\n return {\n unsafe,\n work: multiplyWork(startPositions, perStartWork),\n };\n}\n\ninterface CompiledPattern {\n readonly regex: RegExp;\n}\n\n/** The `(pattern, flags)` pairs already compiled, oldest first for bounded eviction. */\nconst COMPILED = new Map<string, CompiledPattern>();\n\nfunction cacheKey(pattern: string, flags: string): string {\n return `${flags}\\u0000${pattern}`;\n}\n\n/**\n * Compiles one pattern, or states why it cannot be compiled.\n *\n * A `SyntaxError` from the engine is data: a computed pattern that does not parse is a\n * value-stated refusal the report can name, not an exception a host sees. The cache is bounded\n * because a document can write an unbounded number of distinct computed patterns, and a\n * process-global map an input can grow is a leak.\n */\nexport function compileRegex(\n pattern: string,\n canonical: string,\n): { readonly kind: 'ok'; readonly regex: RegExp } | RegexRefusal {\n const key = cacheKey(pattern, canonical);\n const cached = COMPILED.get(key);\n if (cached !== undefined) {\n // Refresh the recency of a hit, so the entries evicted are the least recently used.\n COMPILED.delete(key);\n COMPILED.set(key, cached);\n return { kind: 'ok', regex: cached.regex };\n }\n let regex: RegExp;\n try {\n regex = new RegExp(pattern, canonical);\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n return { kind: 'invalid-pattern', detail };\n }\n COMPILED.set(key, { regex });\n if (COMPILED.size > REGEX_CACHE_LIMIT) {\n const oldest = COMPILED.keys().next();\n if (!oldest.done) COMPILED.delete(oldest.value);\n }\n return { kind: 'ok', regex };\n}\n\n/** A refusal as the `ENGINE_ERROR` the evaluator reports at the call's path. */\nexport function regexRefusalError(refusal: RegexRefusal, path: string): AxiomError {\n switch (refusal.kind) {\n case 'invalid-flags':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n case 'invalid-pattern':\n // Host engines word RegExp SyntaxError messages differently across V8, Hermes, JSC and\n // SpiderMonkey. This detail enters `report.diagnostics[].params.detail` and therefore\n // `reportHash`, so the runtime refusal must stay engine-independent.\n return new AxiomError(\n 'ENGINE_ERROR',\n 'matches: the pattern is not a valid regular expression',\n path,\n );\n case 'unsafe-pattern':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n case 'subject-too-long':\n return new AxiomError('ENGINE_ERROR', `matches: ${refusal.detail}`, path);\n }\n}\n\n/**\n * `matches(s, pattern, flags?)`: an unanchored Unicode search, or the refusal that stops it.\n *\n * The subject cap is checked before compilation, so an oversized input is refused whether or\n * not the pattern would have matched, and the answer is never a silent `false`. The work ceiling\n * is checked at this call's subject length, so a pattern that is ordinary over a short value is\n * not refused for it, and a shape the structural scan did not name still cannot outlast the\n * budget.\n */\nexport function matchRegex(\n subject: string,\n pattern: string,\n flags: string,\n): { readonly kind: 'tested'; readonly matched: boolean } | RegexRefusal {\n const length = codePointLength(subject);\n if (length > REGEX_SUBJECT_LIMIT) {\n return {\n kind: 'subject-too-long',\n detail: `the subject is ${String(length)} code points, longer than the ${String(REGEX_SUBJECT_LIMIT)}-code-point limit for a pattern check`,\n };\n }\n const canonical = canonicalFlags(flags);\n if (canonical.kind !== 'ok') return canonical;\n const analysis = analysePattern(pattern, length, canonical.flags);\n // A pattern the artifact states literally was analysed at compile time; a pattern that\n // arrived as a value is analysed here, with the same rule.\n if (analysis.unsafe !== undefined) {\n return { kind: 'unsafe-pattern', detail: analysis.unsafe };\n }\n const compiled = compileRegex(pattern, canonical.flags);\n if (compiled.kind !== 'ok') return compiled;\n if (analysis.work > REGEX_MATCH_WORK_LIMIT) {\n return {\n kind: 'unsafe-pattern',\n detail: `the pattern exceeds the ${String(REGEX_MATCH_WORK_LIMIT)}-step work budget on a ${String(length)}-code-point subject; shorten the subject or simplify the pattern`,\n };\n }\n return { kind: 'tested', matched: compiled.regex.test(subject) };\n}\n"]}
|
package/dist/version.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* outside it is refused by the caller rather than coerced.
|
|
17
17
|
*/
|
|
18
18
|
/** The version all eight Axiom packages publish at. */
|
|
19
|
-
export declare const AXIOM_VERSION = "0.0.
|
|
19
|
+
export declare const AXIOM_VERSION = "0.0.6";
|
|
20
20
|
/** Whether `text` is a release version, as an artifact's producer stamp must be. */
|
|
21
21
|
export declare function isVersionText(text: string): boolean;
|
|
22
22
|
/**
|
package/dist/version.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* outside it is refused by the caller rather than coerced.
|
|
17
17
|
*/
|
|
18
18
|
/** The version all eight Axiom packages publish at. */
|
|
19
|
-
export const AXIOM_VERSION = '0.0.
|
|
19
|
+
export const AXIOM_VERSION = '0.0.6'; // x-release-please-version
|
|
20
20
|
/**
|
|
21
21
|
* A semantic version's text.
|
|
22
22
|
*
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,2BAA2B;AAUjE;;;;;;GAMG;AACH,MAAM,eAAe,GACnB,sIAAsI,CAAC;AAEzI,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,MAA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACzD,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzD,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC","sourcesContent":["/**\n * The release version this build reports, and the comparison an artifact's producer stamp is\n * admitted by.\n *\n * `AXIOM_VERSION` is the version all eight packages publish at. It lives in source rather than\n * being read from `package.json` because the runtime ships to browsers and Hermes: neither has a\n * filesystem to read a manifest from, and a build-time define would make the published tarball's\n * version depend on which bundler assembled it. The value is kept equal to all eight manifests by\n * release-please's generic `extra-files` updater (the `x-release-please-version` marker below) and\n * is asserted by `test/release/manifest-lockstep.test.ts`.\n *\n * `compareVersions` is hand-rolled rather than delegating to `semver`, which is a root\n * devDependency: the runtime's device bundle may not grow a dependency that is not already one of\n * its three (§ Dependencies: buy before build). The grammar is the subset a release version uses:\n * the three numeric components, an optional prerelease and ignored build metadata, and a value\n * outside it is refused by the caller rather than coerced.\n */\n\n/** The version all eight Axiom packages publish at. */\nexport const AXIOM_VERSION = '0.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,2BAA2B;AAUjE;;;;;;GAMG;AACH,MAAM,eAAe,GACnB,sIAAsI,CAAC;AAEzI,SAAS,YAAY,CAAC,IAAY;IAChC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IACrC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,2FAA2F;IAC3F,qFAAqF;IACrF,IACE,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAC5B,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC;QAC5B,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAC5B,CAAC;QAC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C7B,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAC9B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACzD,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,OAAO,iBAAiB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;AACvD,CAAC","sourcesContent":["/**\n * The release version this build reports, and the comparison an artifact's producer stamp is\n * admitted by.\n *\n * `AXIOM_VERSION` is the version all eight packages publish at. It lives in source rather than\n * being read from `package.json` because the runtime ships to browsers and Hermes: neither has a\n * filesystem to read a manifest from, and a build-time define would make the published tarball's\n * version depend on which bundler assembled it. The value is kept equal to all eight manifests by\n * release-please's generic `extra-files` updater (the `x-release-please-version` marker below) and\n * is asserted by `test/release/manifest-lockstep.test.ts`.\n *\n * `compareVersions` is hand-rolled rather than delegating to `semver`, which is a root\n * devDependency: the runtime's device bundle may not grow a dependency that is not already one of\n * its three (§ Dependencies: buy before build). The grammar is the subset a release version uses:\n * the three numeric components, an optional prerelease and ignored build metadata, and a value\n * outside it is refused by the caller rather than coerced.\n */\n\n/** The version all eight Axiom packages publish at. */\nexport const AXIOM_VERSION = '0.0.6'; // x-release-please-version\n\n/** A parsed release version. `prerelease` is empty for a final release. */\ninterface ParsedVersion {\n readonly major: number;\n readonly minor: number;\n readonly patch: number;\n readonly prerelease: readonly string[];\n}\n\n/**\n * A semantic version's text.\n *\n * Numeric components carry no leading zero, which is what makes the comparison total once each\n * component has been read as a number. Build metadata is accepted and discarded because semver\n * precedence ignores it.\n */\nconst VERSION_PATTERN =\n /^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*))?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$/;\n\nfunction parseVersion(text: string): ParsedVersion | undefined {\n const match = VERSION_PATTERN.exec(text);\n if (match === null) return undefined;\n const major = Number(match[1]);\n const minor = Number(match[2]);\n const patch = Number(match[3]);\n // A component beyond the safe integer range is not a version this repository produces, and\n // reading it as an imprecise number could make two different versions compare equal.\n if (\n !Number.isSafeInteger(major) ||\n !Number.isSafeInteger(minor) ||\n !Number.isSafeInteger(patch)\n ) {\n return undefined;\n }\n const prerelease = match[4] === undefined ? [] : match[4].split('.');\n // A numeric prerelease identifier carries no leading zero, so `1.0.0-01` is not a version\n // semver precedence orders. The pattern admits the characters; this is the rule it cannot.\n for (const identifier of prerelease) {\n if (/^[0-9]+$/.test(identifier) && identifier.length > 1 && identifier.startsWith('0')) {\n return undefined;\n }\n }\n return { major, minor, patch, prerelease };\n}\n\n/** Whether `text` is a release version, as an artifact's producer stamp must be. */\nexport function isVersionText(text: string): boolean {\n return parseVersion(text) !== undefined;\n}\n\n/**\n * Semver precedence between two prerelease identifier lists.\n *\n * A numeric identifier is always lower than an alphanumeric one, numeric identifiers compare as\n * numbers, alphanumeric identifiers compare by ASCII code point, and a shorter list that is a\n * prefix of a longer one sorts first.\n */\nfunction comparePrerelease(left: readonly string[], right: readonly string[]): number {\n if (left.length === 0 && right.length === 0) return 0;\n // A final release outranks any prerelease of the same numeric triple.\n if (left.length === 0) return 1;\n if (right.length === 0) return -1;\n const length = Math.min(left.length, right.length);\n for (let index = 0; index < length; index += 1) {\n const a = left[index];\n const b = right[index];\n if (a === undefined || b === undefined) continue;\n const aNumeric = /^[0-9]+$/.test(a);\n const bNumeric = /^[0-9]+$/.test(b);\n if (aNumeric && bNumeric) {\n // Numeric identifiers carry no leading zero, so the longer text is the larger number and\n // equal-length texts compare as integers. Reading them through `Number` would compare two\n // identifiers beyond the safe range imprecisely.\n if (a.length !== b.length) return a.length < b.length ? -1 : 1;\n if (a !== b) return a < b ? -1 : 1;\n continue;\n }\n if (aNumeric !== bNumeric) return aNumeric ? -1 : 1;\n if (a !== b) return a < b ? -1 : 1;\n }\n return left.length === right.length ? 0 : left.length < right.length ? -1 : 1;\n}\n\n/**\n * The semver precedence of `left` against `right`: negative when `left` is older, zero when they\n * are the same release, positive when it is newer, and `undefined` when either is not a version.\n *\n * The undefined arm exists so a malformed producer stamp is a refusal at the boundary rather than\n * a comparison that happens to fall one way.\n */\nexport function compareVersions(left: string, right: string): number | undefined {\n const a = parseVersion(left);\n const b = parseVersion(right);\n if (a === undefined || b === undefined) return undefined;\n if (a.major !== b.major) return a.major < b.major ? -1 : 1;\n if (a.minor !== b.minor) return a.minor < b.minor ? -1 : 1;\n if (a.patch !== b.patch) return a.patch < b.patch ? -1 : 1;\n return comparePrerelease(a.prerelease, b.prerelease);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azx-pbc/axiom-runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A target-neutral evaluator for a compiled artifact: exact decimal arithmetic, civil dates and restricted canonical hashing, so Node, a browser and Hermes reach the same verdict.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AZX, PBC",
|