Astro+Directus(Visual-Editing)+Snipcart Test-Stack
This commit is contained in:
commit
1459e99cb0
10119 files changed
+1499318
No files matched your search
+18
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
Apply transformations for atomic groups: `(?>…)`.
|
||||
@param {string} expression
|
||||
@param {PluginData} [data]
|
||||
@returns {Required<PluginResult>}
|
||||
*/
|
||||
export function atomic(expression: string, data?: PluginData): Required<PluginResult>;
|
||||
/**
|
||||
Transform posessive quantifiers into atomic groups. The posessessive quantifiers are:
|
||||
`?+`, `*+`, `++`, `{N}+`, `{N,}+`, `{N,N}+`.
|
||||
This follows Java, PCRE, Perl, and Python.
|
||||
Possessive quantifiers in Oniguruma and Onigmo are only: `?+`, `*+`, `++`.
|
||||
@param {string} expression
|
||||
@returns {PluginResult}
|
||||
*/
|
||||
export function possessive(expression: string): PluginResult;
|
||||
import type { PluginData } from './regex.js';
|
||||
import type { PluginResult } from './regex.js';
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
Applies flag v rules when using flag u, for forward compatibility.
|
||||
Assumes flag u and doesn't worry about syntax errors that are caught by it.
|
||||
@param {string} expression
|
||||
@returns {PluginResult}
|
||||
*/
|
||||
export function backcompatPlugin(expression: string): PluginResult;
|
||||
import type { PluginResult } from './regex.js';
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export function flagNPreprocessor(value: import("./regex.js").InterpolatedValue, runningContext: import("./utils.js").RunningContext, options: Required<import("./regex.js").RegexTagOptions>): {
|
||||
transformed: string;
|
||||
runningContext: import("./utils.js").RunningContext;
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
Remove `(?:)` token separators (most likely added by flag x) in cases where it's safe to do so.
|
||||
@param {string} expression
|
||||
@returns {PluginResult}
|
||||
*/
|
||||
export function clean(expression: string): PluginResult;
|
||||
export function flagXPreprocessor(value: import("./regex.js").InterpolatedValue, runningContext: import("./utils.js").RunningContext, options: Required<import("./regex.js").RegexTagOptions>): {
|
||||
transformed: string;
|
||||
runningContext: import("./utils.js").RunningContext;
|
||||
};
|
||||
import type { PluginResult } from './regex.js';
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
export { RegExpSubclass } from "./subclass.js";
|
||||
export { atomic, possessive } from "./atomic.js";
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"type":"commonjs"}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
export class Pattern {
|
||||
/** @param {string} value */
|
||||
constructor(value: string);
|
||||
/** @returns {string} */
|
||||
toString(): string;
|
||||
#private;
|
||||
}
|
||||
/**
|
||||
Returns a value that can be interpolated into a `regex` template string without having its special
|
||||
characters escaped.
|
||||
|
||||
Can be called as a function or template tag:
|
||||
- `pattern(value)` - String or value coerced to string.
|
||||
- `` pattern`…` `` - Same as ``pattern(String.raw`…`)``.
|
||||
|
||||
@overload
|
||||
@param {string | number} value
|
||||
@returns {Pattern}
|
||||
|
||||
@overload
|
||||
@param {TemplateStringsArray} template
|
||||
@param {...string} substitutions
|
||||
@returns {Pattern}
|
||||
*/
|
||||
export function pattern(value: string | number): Pattern;
|
||||
/**
|
||||
Returns a value that can be interpolated into a `regex` template string without having its special
|
||||
characters escaped.
|
||||
|
||||
Can be called as a function or template tag:
|
||||
- `pattern(value)` - String or value coerced to string.
|
||||
- `` pattern`…` `` - Same as ``pattern(String.raw`…`)``.
|
||||
|
||||
@overload
|
||||
@param {string | number} value
|
||||
@returns {Pattern}
|
||||
|
||||
@overload
|
||||
@param {TemplateStringsArray} template
|
||||
@param {...string} substitutions
|
||||
@returns {Pattern}
|
||||
*/
|
||||
export function pattern(template: TemplateStringsArray, ...substitutions: string[]): Pattern;
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
export type InterpolatedValue = string | RegExp | Pattern | number;
|
||||
export type PluginData = {
|
||||
flags?: string;
|
||||
captureTransfers?: Map<number, Array<number>>;
|
||||
hiddenCaptures?: Array<number>;
|
||||
};
|
||||
export type PluginResult = {
|
||||
pattern: string;
|
||||
captureTransfers?: Map<number, Array<number>>;
|
||||
hiddenCaptures?: Array<number>;
|
||||
};
|
||||
export type RawTemplate = TemplateStringsArray | {
|
||||
raw: Array<string>;
|
||||
};
|
||||
export type RegexTagOptions = {
|
||||
flags?: string;
|
||||
subclass?: boolean;
|
||||
plugins?: Array<(expression: string, data: PluginData) => PluginResult>;
|
||||
unicodeSetsPlugin?: ((expression: string, data: PluginData) => PluginResult) | null;
|
||||
disable?: {
|
||||
x?: boolean;
|
||||
n?: boolean;
|
||||
v?: boolean;
|
||||
atomic?: boolean;
|
||||
subroutines?: boolean;
|
||||
};
|
||||
force?: {
|
||||
v?: boolean;
|
||||
};
|
||||
};
|
||||
export type RegexTag<T> = {
|
||||
(template: RawTemplate, ...substitutions: ReadonlyArray<InterpolatedValue>): T;
|
||||
(flags?: string): RegexTag<T>;
|
||||
(options: RegexTagOptions & {
|
||||
subclass?: false;
|
||||
}): RegexTag<T>;
|
||||
(options: RegexTagOptions & {
|
||||
subclass: true;
|
||||
}): RegexTag<RegExpSubclass>;
|
||||
};
|
||||
export type RegexFromTemplate<T> = {
|
||||
(options: RegexTagOptions, template: RawTemplate, ...substitutions: ReadonlyArray<InterpolatedValue>): T;
|
||||
};
|
||||
import { pattern } from './pattern.js';
|
||||
/**
|
||||
@typedef {string | RegExp | Pattern | number} InterpolatedValue
|
||||
@typedef {{
|
||||
flags?: string;
|
||||
captureTransfers?: Map<number, Array<number>>;
|
||||
hiddenCaptures?: Array<number>;
|
||||
}} PluginData
|
||||
@typedef {{
|
||||
pattern: string;
|
||||
captureTransfers?: Map<number, Array<number>>;
|
||||
hiddenCaptures?: Array<number>;
|
||||
}} PluginResult
|
||||
@typedef {TemplateStringsArray | {raw: Array<string>}} RawTemplate
|
||||
@typedef {{
|
||||
flags?: string;
|
||||
subclass?: boolean;
|
||||
plugins?: Array<(expression: string, data: PluginData) => PluginResult>;
|
||||
unicodeSetsPlugin?: ((expression: string, data: PluginData) => PluginResult) | null;
|
||||
disable?: {
|
||||
x?: boolean;
|
||||
n?: boolean;
|
||||
v?: boolean;
|
||||
atomic?: boolean;
|
||||
subroutines?: boolean;
|
||||
};
|
||||
force?: {
|
||||
v?: boolean;
|
||||
};
|
||||
}} RegexTagOptions
|
||||
*/
|
||||
/**
|
||||
@template T
|
||||
@typedef RegexTag
|
||||
@type {{
|
||||
(template: RawTemplate, ...substitutions: ReadonlyArray<InterpolatedValue>): T;
|
||||
(flags?: string): RegexTag<T>;
|
||||
(options: RegexTagOptions & {subclass?: false}): RegexTag<T>;
|
||||
(options: RegexTagOptions & {subclass: true}): RegexTag<RegExpSubclass>;
|
||||
}}
|
||||
*/
|
||||
/**
|
||||
Template tag for constructing a regex with extended syntax and context-aware interpolation of
|
||||
regexes, strings, and patterns.
|
||||
|
||||
Can be called in several ways:
|
||||
1. `` regex`…` `` - Regex pattern as a raw string.
|
||||
2. `` regex('gi')`…` `` - To specify flags.
|
||||
3. `` regex({flags: 'gi'})`…` `` - With options.
|
||||
@type {RegexTag<RegExp>}
|
||||
*/
|
||||
export const regex: RegexTag<RegExp>;
|
||||
/**
|
||||
Returns the processed expression and flags as strings.
|
||||
@param {string} expression
|
||||
@param {RegexTagOptions} [options]
|
||||
@returns {{
|
||||
pattern: string;
|
||||
flags: string;
|
||||
}}
|
||||
*/
|
||||
export function rewrite(expression?: string, options?: RegexTagOptions): {
|
||||
pattern: string;
|
||||
flags: string;
|
||||
};
|
||||
import { Pattern } from './pattern.js';
|
||||
import { RegExpSubclass } from './subclass.js';
|
||||
export { pattern };
|
||||
+1335
File diff suppressed because it is too large.
Load diff
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"sources": ["../../src/regex.js", "../../src/utils-internals.js", "../../node_modules/.pnpm/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js", "../../src/atomic.js", "../../src/pattern.js", "../../src/utils.js", "../../src/backcompat.js", "../../src/flag-n.js", "../../src/flag-x.js", "../../src/subclass.js", "../../src/subroutines.js"],
|
||||
"sourcesContent": ["import {atomic, possessive} from './atomic.js';\nimport {backcompatPlugin} from './backcompat.js';\nimport {flagNPreprocessor} from './flag-n.js';\nimport {clean, flagXPreprocessor} from './flag-x.js';\nimport {Pattern, pattern} from './pattern.js';\nimport {RegExpSubclass} from './subclass.js';\nimport {subroutines} from './subroutines.js';\nimport {adjustNumberedBackrefs, CharClassContext, containsCharClassUnion, countCaptures, enclosedTokenCharClassContexts, enclosedTokenRegexContexts, envSupportsFlagGroups, envSupportsFlagV, escapeV, getBreakoutChar, getEndContextForIncompleteExpression, preprocess, RegexContext, sandboxLoneCharClassCaret, sandboxLoneDoublePunctuatorChar, sandboxUnsafeNulls} from './utils.js';\nimport {Context, hasUnescaped, replaceUnescaped} from 'regex-utilities';\n\n/**\n@typedef {string | RegExp | Pattern | number} InterpolatedValue\n@typedef {{\n flags?: string;\n captureTransfers?: Map<number, Array<number>>;\n hiddenCaptures?: Array<number>;\n}} PluginData\n@typedef {{\n pattern: string;\n captureTransfers?: Map<number, Array<number>>;\n hiddenCaptures?: Array<number>;\n}} PluginResult\n@typedef {TemplateStringsArray | {raw: Array<string>}} RawTemplate\n@typedef {{\n flags?: string;\n subclass?: boolean;\n plugins?: Array<(expression: string, data: PluginData) => PluginResult>;\n unicodeSetsPlugin?: ((expression: string, data: PluginData) => PluginResult) | null;\n disable?: {\n x?: boolean;\n n?: boolean;\n v?: boolean;\n atomic?: boolean;\n subroutines?: boolean;\n };\n force?: {\n v?: boolean;\n };\n}} RegexTagOptions\n*/\n/**\n@template T\n@typedef RegexTag\n@type {{\n (template: RawTemplate, ...substitutions: ReadonlyArray<InterpolatedValue>): T;\n (flags?: string): RegexTag<T>;\n (options: RegexTagOptions & {subclass?: false}): RegexTag<T>;\n (options: RegexTagOptions & {subclass: true}): RegexTag<RegExpSubclass>;\n}}\n*/\n/**\nTemplate tag for constructing a regex with extended syntax and context-aware interpolation of\nregexes, strings, and patterns.\n\nCan be called in several ways:\n1. `` regex`\u2026` `` - Regex pattern as a raw string.\n2. `` regex('gi')`\u2026` `` - To specify flags.\n3. `` regex({flags: 'gi'})`\u2026` `` - With options.\n@type {RegexTag<RegExp>}\n*/\nconst regex = (first, ...substitutions) => {\n // Given a template\n if (Array.isArray(first?.raw)) {\n return regexFromTemplate({}, first, ...substitutions);\n // Given flags\n } else if ((typeof first === 'string' || first === undefined) && !substitutions.length) {\n return regexFromTemplate.bind(null, {flags: first ?? ''});\n // Given an options object\n } else if ({}.toString.call(first) === '[object Object]' && !substitutions.length) {\n return regexFromTemplate.bind(null, first);\n }\n throw new Error(`Unexpected arguments: ${JSON.stringify([first, ...substitutions])}`);\n};\n\n/**\n@template T\n@typedef RegexFromTemplate\n@type {{\n (options: RegexTagOptions, template: RawTemplate, ...substitutions: ReadonlyArray<InterpolatedValue>) : T;\n}}\n*/\n/**\nReturns a RegExp from a template and substitutions to fill the template holes.\n@type {RegexFromTemplate<RegExp>}\n*/\nconst regexFromTemplate = (options, template, ...substitutions) => {\n const opts = getOptions(options);\n const prepped = runPreprocessors(template, substitutions, opts);\n\n let precedingCaptures = 0;\n let expression = '';\n let runningContext;\n // Intersperse raw template strings and substitutions\n prepped.template.raw.forEach((raw, i) => {\n const hasNonEmptyRawBoundary = !!(prepped.template.raw[i] || prepped.template.raw[i + 1]);\n // Even with flag n enabled, we might have named captures\n precedingCaptures += countCaptures(raw);\n // Sandbox `\\0` in character classes. Not needed outside character classes because in other\n // cases a following interpolated value would always be atomized\n expression += sandboxUnsafeNulls(raw, Context.CHAR_CLASS);\n runningContext = getEndContextForIncompleteExpression(expression, runningContext);\n const {regexContext, charClassContext} = runningContext;\n if (i < prepped.template.raw.length - 1) {\n const substitution = prepped.substitutions[i];\n expression += interpolate(\n substitution,\n opts.flags,\n regexContext,\n charClassContext,\n hasNonEmptyRawBoundary,\n precedingCaptures\n );\n if (substitution instanceof RegExp) {\n precedingCaptures += countCaptures(substitution.source);\n } else if (substitution instanceof Pattern) {\n precedingCaptures += countCaptures(String(substitution));\n }\n }\n });\n\n const plugged = runPlugins(expression, opts);\n expression = plugged.pattern;\n try {\n return opts.subclass ?\n new RegExpSubclass(expression, opts.flags, {hiddenCaptures: plugged.hiddenCaptures}) :\n new RegExp(expression, opts.flags);\n } catch (err) {\n // ImproLine truncated
|
||||
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEA,IAAM,oBAAoB,OAAO;AAOjC,SAAS,mBAAmB,KAAK,WAAW;AAC1C,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,QAAI,IAAI,CAAC,KAAK,WAAW;AACvB,UAAI,CAAC;AAAA,IACP;AAAA,EACF;AACF;AASA,SAAS,UAAU,KAAK,KAAK,UAAU,UAAU;AAC/C,SAAO,IAAI,MAAM,GAAG,GAAG,IAAI,WAAW,IAAI,MAAM,MAAM,SAAS,MAAM;AACvE;;;ACzBO,IAAM,UAAU,OAAO,OAAO;AAAA,EACnC,SAAS;AAAA,EACT,YAAY;AACd,CAAC;AAyBM,SAAS,iBAAiB,YAAY,QAAQ,aAAa,SAAS;AACzE,QAAM,KAAK,IAAI,OAAO,OAAO,MAAM,MAAM,yBAAyB,KAAK;AACvE,QAAM,UAAU,CAAC,KAAK;AACtB,MAAI,qBAAqB;AACzB,MAAI,SAAS;AACb,aAAW,SAAS,WAAW,SAAS,EAAE,GAAG;AAC3C,UAAM,EAAC,GAAG,GAAG,QAAQ,EAAC,MAAK,EAAC,IAAI;AAChC,QAAI,CAAC,UAAU,CAAC,WAAY,YAAY,QAAQ,YAAa,CAAC,qBAAqB;AACjF,UAAI,uBAAuB,UAAU;AACnC,kBAAU,YAAY,OAAO;AAAA,UAC3B,SAAS,qBAAqB,QAAQ,aAAa,QAAQ;AAAA,UAC3D,SAAS,QAAQ,QAAQ,SAAS,CAAC;AAAA,QACrC,CAAC;AAAA,MACH,OAAO;AACL,kBAAU;AAAA,MACZ;AACA;AAAA,IACF;AACA,QAAI,EAAE,CAAC,MAAM,KAAK;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,IACA;AAAA,EACF;AACF;AAEA,IAAM,iBAAiB,OAAO;AAE9B,IAAM,wBAAwB,IAAI,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAanC,cAAc;AAAA;AAAA,EAEzB,QAAQ,QAAQ,EAAE,GAAG,KAAK;AAU5B,SAAS,WAAW,YAAY;AAC9B,MAAI,CAAE,IAAI,OAAO,GAAG,cAAc,KAAK,EAAE,KAAK,UAAU,GAAI;AAC1D,WAAO;AAAA,MACL,SAAS;AAAA,IACX;AAAA,EACF;AAEA,QAAM,mBAAmB,CAAC;AAC1B,MAAI,iBAAiB;AACrB,MAAI,qBAAqB;AACzB,MAAI,YAAY;AAChB,MAAI,qBAAqB;AACzB,MAAI;AACJ,wBAAsB,YAAY;AAClC,SAAO,QAAQ,sBAAsB,KAAK,UAAU,GAAG;AACrD,UAAM,EAAC,GAAG,GAAG,OAAO,QAAQ,EAAC,OAAO,MAAM,SAAQ,EAAC,IAAI;AACvD,QAAI,MAAM,KAAK;AACb,UAAI,CAAC,oBAAoB;AACvB,6BAAqB;AAAA,MACvB;AACA;AAAA,IACF,WAAW,MAAM,KAAK;AACpB,UAAI,oBAAoB;AACtB;AAAA,MAEF,OAAO;AACL,6BAAqB;AAAA,MACvB;AAAA,IACF,WAAW,CAAC,oBAAoB;AAE9B,UAAI,SAAS,OAAO,aAAa,CAAC,UAAU,WAAW,GAAG,GAAG;AAE3D,YAAI,UAAU;AACZ,gBAAM,IAAI,MAAM,uBAAuB,CAAC,GAAG;AAAA,QAC7C;AACA,YAAI,aAAa;AAGjB,YAAI,YAAY,KAAK,KAAK,GAAG;AAC3B,uBAAa,UAAU,YAALine truncated
|
||||
"names": ["token", "result", "token", "token", "options", "token"]
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
Works the same as JavaScript's native `RegExp` constructor in all contexts, but automatically
|
||||
adjusts subpattern matches and indices (with flag `d`) to account for captures added as part of
|
||||
emulating extended syntax.
|
||||
*/
|
||||
export class RegExpSubclass extends RegExp {
|
||||
/**
|
||||
@overload
|
||||
@param {string} expression
|
||||
@param {string} [flags]
|
||||
@param {{
|
||||
hiddenCaptures?: Array<number>;
|
||||
}} [options]
|
||||
*/
|
||||
constructor(expression: string, flags?: string, options?: {
|
||||
hiddenCaptures?: Array<number>;
|
||||
});
|
||||
/**
|
||||
@overload
|
||||
@param {RegExpSubclass} expression
|
||||
@param {string} [flags]
|
||||
*/
|
||||
constructor(expression: RegExpSubclass, flags?: string);
|
||||
/**
|
||||
@private
|
||||
@type {Map<number, {
|
||||
hidden: true;
|
||||
}>}
|
||||
*/
|
||||
private _captureMap;
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
export type NamedCapturingGroupsMap = Map<string, {
|
||||
isUnique: boolean;
|
||||
contents?: string;
|
||||
groupNum?: number;
|
||||
numCaptures?: number;
|
||||
}>;
|
||||
/**
|
||||
@import {PluginData, PluginResult} from './regex.js';
|
||||
*/
|
||||
/**
|
||||
@param {string} expression
|
||||
@param {PluginData} [data]
|
||||
@returns {PluginResult}
|
||||
*/
|
||||
export function subroutines(expression: string, data?: PluginData): PluginResult;
|
||||
import type { PluginData } from './regex.js';
|
||||
import type { PluginResult } from './regex.js';
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
/**
|
||||
Updates the array in place by incrementing each value greater than or equal to the threshold.
|
||||
@param {Array<number>} arr
|
||||
@param {number} threshold
|
||||
*/
|
||||
export function incrementIfAtLeast(arr: Array<number>, threshold: number): void;
|
||||
export const noncapturingDelim: any;
|
||||
/**
|
||||
@param {string} str
|
||||
@param {number} pos
|
||||
@param {string} oldValue
|
||||
@param {string} newValue
|
||||
@returns {string}
|
||||
*/
|
||||
export function spliceStr(str: string, pos: number, oldValue: string, newValue: string): string;
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
export type RunningContext = {
|
||||
regexContext: string;
|
||||
charClassContext: string;
|
||||
charClassDepth: number;
|
||||
lastPos: number;
|
||||
};
|
||||
export type InterpolatedValue = InterpolatedValue;
|
||||
export type RawTemplate = RawTemplate;
|
||||
export type RegexTagOptions = RegexTagOptions;
|
||||
export type Preprocessor = (value: InterpolatedValue, runningContext: RunningContext, options: Required<RegexTagOptions>) => {
|
||||
transformed: string;
|
||||
runningContext: RunningContext;
|
||||
};
|
||||
/**
|
||||
@param {string} expression
|
||||
@param {number} precedingCaptures
|
||||
@returns {string}
|
||||
*/
|
||||
export function adjustNumberedBackrefs(expression: string, precedingCaptures: number): string;
|
||||
export const capturingDelim: any;
|
||||
export namespace CharClassContext {
|
||||
let DEFAULT: string;
|
||||
let ENCLOSED_P: string;
|
||||
let ENCLOSED_Q: string;
|
||||
let ENCLOSED_U: string;
|
||||
let INVALID_INCOMPLETE_TOKEN: string;
|
||||
let RANGE: string;
|
||||
}
|
||||
export function containsCharClassUnion(charClassPattern: any): boolean;
|
||||
/**
|
||||
@param {string} expression
|
||||
@returns {number}
|
||||
*/
|
||||
export function countCaptures(expression: string): number;
|
||||
export const doublePunctuatorChars: "&!#$%*+,.:;<=>?@^`~";
|
||||
export const enclosedTokenCharClassContexts: any;
|
||||
export const enclosedTokenRegexContexts: any;
|
||||
export const envSupportsFlagGroups: boolean;
|
||||
export const envSupportsFlagV: boolean;
|
||||
/**
|
||||
Escape special characters for the given context, assuming flag v.
|
||||
@param {string} str String to escape
|
||||
@param {'DEFAULT' | 'CHAR_CLASS'} context `Context` option from lib `regex-utilities`
|
||||
@returns {string} Escaped string
|
||||
*/
|
||||
export function escapeV(str: string, context: "DEFAULT" | "CHAR_CLASS"): string;
|
||||
export function getBreakoutChar(expression: any, regexContext: any, charClassContext: any): any;
|
||||
/**
|
||||
@typedef {{
|
||||
regexContext: string;
|
||||
charClassContext: string;
|
||||
charClassDepth: number;
|
||||
lastPos: number;
|
||||
}} RunningContext
|
||||
*/
|
||||
/**
|
||||
Accepts and returns its full state so it doesn't have to reprocess parts that have already been
|
||||
seen. Assumes flag v and doesn't worry about syntax errors that are caught by it.
|
||||
@param {string} incompleteExpression
|
||||
@param {Partial<RunningContext>} [runningContext]
|
||||
@returns {RunningContext}
|
||||
*/
|
||||
export function getEndContextForIncompleteExpression(incompleteExpression: string, runningContext?: Partial<RunningContext>): RunningContext;
|
||||
export const namedCapturingDelim: any;
|
||||
/**
|
||||
@typedef {InterpolatedValue} InterpolatedValue
|
||||
@typedef {RawTemplate} RawTemplate
|
||||
@typedef {RegexTagOptions} RegexTagOptions
|
||||
@typedef {(
|
||||
value: InterpolatedValue,
|
||||
runningContext: RunningContext,
|
||||
options: Required<RegexTagOptions>
|
||||
) => {
|
||||
transformed: string;
|
||||
runningContext: RunningContext;
|
||||
}} Preprocessor
|
||||
*/
|
||||
/**
|
||||
Returns transformed versions of a template and substitutions, using the given preprocessor. Only
|
||||
processes substitutions that are instanceof `Pattern`.
|
||||
@param {RawTemplate} template
|
||||
@param {ReadonlyArray<InterpolatedValue>} substitutions
|
||||
@param {Preprocessor} preprocessor
|
||||
@param {Required<RegexTagOptions>} options
|
||||
@returns {{template: RawTemplate; substitutions: ReadonlyArray<InterpolatedValue>;}}
|
||||
*/
|
||||
export function preprocess(template: RawTemplate, substitutions: ReadonlyArray<InterpolatedValue>, preprocessor: Preprocessor, options: Required<RegexTagOptions>): {
|
||||
template: RawTemplate;
|
||||
substitutions: ReadonlyArray<InterpolatedValue>;
|
||||
};
|
||||
export namespace RegexContext {
|
||||
let DEFAULT_1: string;
|
||||
export { DEFAULT_1 as DEFAULT };
|
||||
export let CHAR_CLASS: string;
|
||||
let ENCLOSED_P_1: string;
|
||||
export { ENCLOSED_P_1 as ENCLOSED_P };
|
||||
let ENCLOSED_U_1: string;
|
||||
export { ENCLOSED_U_1 as ENCLOSED_U };
|
||||
export let GROUP_NAME: string;
|
||||
export let INTERVAL_QUANTIFIER: string;
|
||||
let INVALID_INCOMPLETE_TOKEN_1: string;
|
||||
export { INVALID_INCOMPLETE_TOKEN_1 as INVALID_INCOMPLETE_TOKEN };
|
||||
}
|
||||
export function sandboxLoneCharClassCaret(str: any): any;
|
||||
export function sandboxLoneDoublePunctuatorChar(str: any): any;
|
||||
/**
|
||||
Converts `\0` tokens to `\x00` in the given context.
|
||||
@param {string} str
|
||||
@param {'DEFAULT' | 'CHAR_CLASS'} [context] `Context` option from lib `regex-utilities`
|
||||
@returns {string}
|
||||
*/
|
||||
export function sandboxUnsafeNulls(str: string, context?: "DEFAULT" | "CHAR_CLASS"): string;
|
||||
import type { InterpolatedValue } from './regex.js';
|
||||
import type { RawTemplate } from './regex.js';
|
||||
import type { RegexTagOptions } from './regex.js';
|
||||
Reference in new issue
Block a user