Skip to content

Commit 19ef00f

Browse files
committed
v8 - enable linear-time regex matching engine
1 parent 6bf654a commit 19ef00f

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

package/launcher/src/main.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,15 @@ fn main() {
9393
String::from("--allow-ffi"),
9494
];
9595

96+
// # --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
97+
if let Ok(v8_options) = env::var("QUARTO_DENO_V8_OPTIONS") {
98+
deno_options.push(format!("{}{}", String::from("--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192,"), String::from(v8_options)));
99+
} else {
100+
deno_options.push(String::from("--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192"));
101+
}
96102
// If there are extra args, include those
97103
if let Ok(extra_options) = env::var("QUARTO_DENO_EXTRA_OPTIONS") {
98104
deno_options.push(extra_options);
99-
} else {
100-
deno_options.push(String::from("--v8-flags=--max-old-space-size=8192,--max-heap-size=8192"));
101105
};
102106

103107
// run deno

package/scripts/common/quarto

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,17 @@ export DENO_NO_UPDATE_CHECK=1
169169
# Be sure to include any already defined QUARTO_DENO_OPTIONS
170170
QUARTO_DENO_OPTIONS="--unstable-ffi --no-config ${QUARTO_CACHE_OPTIONS} --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi ${QUARTO_DENO_OPTIONS}"
171171

172+
# --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
173+
if [ "$QUARTO_DENO_V8_OPTIONS" != "" ]; then
174+
QUARTO_DENO_V8_OPTIONS="--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192,${QUARTO_DENO_V8_OPTIONS}"
175+
else
176+
QUARTO_DENO_V8_OPTIONS="--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192"
177+
fi
178+
172179
if [ "$QUARTO_DENO_EXTRA_OPTIONS" == "" ]; then
173-
QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=--max-old-space-size=8192,--max-heap-size=8192"
180+
QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=${QUARTO_DENO_V8_OPTIONS}"
181+
else
182+
QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=${QUARTO_DENO_V8_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS}"
174183
fi
175184

176185
if [ "$QUARTO_TS_PROFILE" != "" ]; then

package/scripts/windows/quarto.cmd

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,17 @@ SET "DENO_TLS_CA_STORE=system,mozilla"
9898
SET "DENO_NO_UPDATE_CHECK=1"
9999
SET "QUARTO_DENO_OPTIONS=--unstable-ffi --no-config --cached-only --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi"
100100

101+
REM --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737
102+
IF DEFINED QUARTO_DENO_V8_OPTIONS (
103+
SET "QUARTO_DENO_V8_OPTIONS=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192,!QUARTO_DENO_V8_OPTIONS!"
104+
) ELSE (
105+
SET "QUARTO_DENO_V8_OPTIONS=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192"
106+
)
107+
101108
IF NOT DEFINED QUARTO_DENO_EXTRA_OPTIONS (
102-
set "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=--max-old-space-size=8192,--max-heap-size=8192"
109+
SET "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=!QUARTO_DENO_V8_OPTIONS!"
110+
) ELSE (
111+
SET "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=!QUARTO_DENO_V8_OPTIONS! !QUARTO_DENO_EXTRA_OPTIONS!"
103112
)
104113

105114
!QUARTO_DENO! !QUARTO_ACTION! !QUARTO_DENO_OPTIONS! !QUARTO_DENO_EXTRA_OPTIONS! !QUARTO_IMPORT_MAP_ARG! !QUARTO_TARGET! %*

src/project/types/website/util/discover-meta.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const kPreviewClassPattern =
2121
const kMdNamedImagePattern =
2222
`!\\[[^\\]]*\\]\\(${kNamedFilePattern}(?:\\".*\\")?\\)(?:\\{[^\\|]*\.*[\\s\\}]+)?`;
2323

24-
const kNamedFileRegex = RegExp(kNamedFilePattern);
25-
const kMdPreviewClassRegex = RegExp(kPreviewClassPattern);
26-
const kMdNamedImageRegex = RegExp(kMdNamedImagePattern);
24+
const kNamedFileRegex = RegExp(kNamedFilePattern, "l");
25+
const kMdPreviewClassRegex = RegExp(kPreviewClassPattern, "l");
26+
const kMdNamedImageRegex = RegExp(kMdNamedImagePattern, "l");
2727
const kMarkdownImg = /!\[[^\]]*\]\((.*?)(?:\".*\")?\)(?:\{(?:[^\|]*)\})?/;
2828

2929
export function findDescription(doc: Document): string | undefined {

0 commit comments

Comments
 (0)