Skip to content

Commit e7bbd43

Browse files
authored
Merge pull request #9749 from quarto-dev/bugfix/9737
v8 - enable linear-time regex matching engine
2 parents 40e23f0 + f0abd35 commit e7bbd43

File tree

7 files changed

+35
-11
lines changed

7 files changed

+35
-11
lines changed

.vscode/launch.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"--unstable-ffi",
1818
"--importmap=${workspaceFolder}/src/import_map.json",
1919
"--inspect-brk",
20-
"--allow-all"
20+
"--allow-all",
21+
"--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192"
2122
],
2223
"env": {
2324
"QUARTO_BIN_PATH": "${workspaceFolder}/package/dist/bin",
@@ -43,7 +44,8 @@
4344
"--allow-all",
4445
"--check",
4546
"--importmap=${workspaceFolder}/src/import_map.json",
46-
"--inspect-brk"
47+
"--inspect-brk",
48+
"--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192"
4749
],
4850
"env": {
4951
"QUARTO_ROOT": "${workspaceFolder}",

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 {

tests/run-tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ $Env:QUARTO_DEBUG = "true"
5656
# Preparing running Deno with default arguments
5757

5858
$QUARTO_IMPORT_MAP_ARG="--importmap=$(Join-Path $QUARTO_SRC_DIR "dev_import_map.json")"
59-
$QUARTO_DENO_OPTIONS="--config test-conf.json --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check"
59+
$QUARTO_DENO_OPTIONS="--config test-conf.json --v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192 --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check"
6060

6161
# Parsing argument passed to the script
6262

tests/run-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export QUARTO_BIN_PATH=$DENO_DIR
2323
export QUARTO_SHARE_PATH="`cd "$QUARTO_ROOT/src/resources/";pwd`"
2424
export QUARTO_DEBUG=true
2525

26-
QUARTO_DENO_OPTIONS="--config test-conf.json --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check"
26+
QUARTO_DENO_OPTIONS="--config test-conf.json --v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192 --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check"
2727

2828

2929
if [[ -z $GITHUB_ACTION ]] && [[ -z $QUARTO_TESTS_NO_CONFIG ]]

0 commit comments

Comments
 (0)