Skip to content

Commit 11ef0cd

Browse files
committed
feat(langs-precompiled): mark EmulatedRegExp as pure
1 parent d82af15 commit 11ef0cd

File tree

4 files changed

+32
-1325
lines changed

4 files changed

+32
-1325
lines changed

Diff for: packages/langs-precompiled/scripts/__snapshots__/precompile.test.ts.snap

+7-5
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ exports[`precompile 1`] = `
9191
],
9292
},
9393
},
94-
end: new EmulatedRegExp("(?<=^|\\\\n(?!$))(?=\\\\P{space})|(?!^)", "dgv", {
95-
strategy: "search_start_clip",
96-
}),
94+
end: /*@__PURE__*/ new EmulatedRegExp(
95+
"(?<=^|\\\\n(?!$))(?=\\\\P{space})|(?!^)",
96+
"dgv",
97+
{ strategy: "search_start_clip" },
98+
),
9799
patterns: [
98100
{
99101
begin: /(?<=^|\\n(?!$))([ ]+)(?! )/dgv,
@@ -112,7 +114,7 @@ exports[`precompile 1`] = `
112114
beginCaptures: {
113115
"1": { name: "punctuation.whitespace.comment.leading.yaml" },
114116
},
115-
end: new EmulatedRegExp("(?!^)", "dgv", {
117+
end: /*@__PURE__*/ new EmulatedRegExp("(?!^)", "dgv", {
116118
strategy: "search_start_clip",
117119
}),
118120
patterns: [
@@ -377,7 +379,7 @@ exports[`precompile 1`] = `
377379
node: { patterns: [{ include: "#block-node" }] },
378380
property: {
379381
begin: /(?=!|&)/dgv,
380-
end: new EmulatedRegExp("(?!^)", "dgv", {
382+
end: /*@__PURE__*/ new EmulatedRegExp("(?!^)", "dgv", {
381383
strategy: "search_start_clip",
382384
}),
383385
name: "meta.property.yaml",

Diff for: packages/langs-precompiled/scripts/langs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export function toJsLiteral(value: any, seen = new Set()): string {
126126
}
127127

128128
if (value instanceof EmulatedRegExp) {
129-
return `new EmulatedRegExp(${JSON.stringify(value.rawArgs.pattern)},${JSON.stringify(value.rawArgs.flags)},${JSON.stringify(value.rawArgs.options)})`
129+
return `/*@__PURE__*/ new EmulatedRegExp(${JSON.stringify(value.rawArgs.pattern)},${JSON.stringify(value.rawArgs.flags)},${JSON.stringify(value.rawArgs.options)})`
130130
}
131131

132132
// RegExp

0 commit comments

Comments
 (0)