diff --git a/.vscode/launch.json b/.vscode/launch.json index 377a06f25a..932257407b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -17,7 +17,8 @@ "--unstable-ffi", "--importmap=${workspaceFolder}/src/import_map.json", "--inspect-brk", - "--allow-all" + "--allow-all", + "--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192" ], "env": { "QUARTO_BIN_PATH": "${workspaceFolder}/package/dist/bin", @@ -43,7 +44,8 @@ "--allow-all", "--check", "--importmap=${workspaceFolder}/src/import_map.json", - "--inspect-brk" + "--inspect-brk", + "--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192" ], "env": { "QUARTO_ROOT": "${workspaceFolder}", diff --git a/package/launcher/src/main.rs b/package/launcher/src/main.rs index 3bb8f87a1b..8540ef3d34 100644 --- a/package/launcher/src/main.rs +++ b/package/launcher/src/main.rs @@ -93,11 +93,15 @@ fn main() { String::from("--allow-ffi"), ]; + // # --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737 + if let Ok(v8_options) = env::var("QUARTO_DENO_V8_OPTIONS") { + 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))); + } else { + deno_options.push(String::from("--v8-flags=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192")); + } // If there are extra args, include those if let Ok(extra_options) = env::var("QUARTO_DENO_EXTRA_OPTIONS") { deno_options.push(extra_options); - } else { - deno_options.push(String::from("--v8-flags=--max-old-space-size=8192,--max-heap-size=8192")); }; // run deno diff --git a/package/scripts/common/quarto b/package/scripts/common/quarto index 4f16ff58af..75b2462635 100755 --- a/package/scripts/common/quarto +++ b/package/scripts/common/quarto @@ -169,8 +169,17 @@ export DENO_NO_UPDATE_CHECK=1 # Be sure to include any already defined QUARTO_DENO_OPTIONS 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}" +# --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737 +if [ "$QUARTO_DENO_V8_OPTIONS" != "" ]; then + QUARTO_DENO_V8_OPTIONS="--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192,${QUARTO_DENO_V8_OPTIONS}" +else + QUARTO_DENO_V8_OPTIONS="--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192" +fi + if [ "$QUARTO_DENO_EXTRA_OPTIONS" == "" ]; then - QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=--max-old-space-size=8192,--max-heap-size=8192" + QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=${QUARTO_DENO_V8_OPTIONS}" +else + QUARTO_DENO_EXTRA_OPTIONS="--v8-flags=${QUARTO_DENO_V8_OPTIONS} ${QUARTO_DENO_EXTRA_OPTIONS}" fi if [ "$QUARTO_TS_PROFILE" != "" ]; then diff --git a/package/scripts/windows/quarto.cmd b/package/scripts/windows/quarto.cmd index 76a12d8eae..eb71c965cd 100644 --- a/package/scripts/windows/quarto.cmd +++ b/package/scripts/windows/quarto.cmd @@ -98,8 +98,17 @@ SET "DENO_TLS_CA_STORE=system,mozilla" SET "DENO_NO_UPDATE_CHECK=1" SET "QUARTO_DENO_OPTIONS=--unstable-ffi --no-config --cached-only --allow-read --allow-write --allow-run --allow-env --allow-net --allow-ffi" +REM --enable-experimental-regexp-engine is required for /regex/l, https://github.com/quarto-dev/quarto-cli/issues/9737 +IF DEFINED QUARTO_DENO_V8_OPTIONS ( + SET "QUARTO_DENO_V8_OPTIONS=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192,!QUARTO_DENO_V8_OPTIONS!" +) ELSE ( + SET "QUARTO_DENO_V8_OPTIONS=--enable-experimental-regexp-engine,--max-old-space-size=8192,--max-heap-size=8192" +) + IF NOT DEFINED QUARTO_DENO_EXTRA_OPTIONS ( - set "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=--max-old-space-size=8192,--max-heap-size=8192" + SET "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=!QUARTO_DENO_V8_OPTIONS!" +) ELSE ( + SET "QUARTO_DENO_EXTRA_OPTIONS=--v8-flags=!QUARTO_DENO_V8_OPTIONS! !QUARTO_DENO_EXTRA_OPTIONS!" ) !QUARTO_DENO! !QUARTO_ACTION! !QUARTO_DENO_OPTIONS! !QUARTO_DENO_EXTRA_OPTIONS! !QUARTO_IMPORT_MAP_ARG! !QUARTO_TARGET! %* diff --git a/src/project/types/website/util/discover-meta.ts b/src/project/types/website/util/discover-meta.ts index 42ca79f489..2b67059cfe 100644 --- a/src/project/types/website/util/discover-meta.ts +++ b/src/project/types/website/util/discover-meta.ts @@ -21,9 +21,9 @@ const kPreviewClassPattern = const kMdNamedImagePattern = `!\\[[^\\]]*\\]\\(${kNamedFilePattern}(?:\\".*\\")?\\)(?:\\{[^\\|]*\.*[\\s\\}]+)?`; -const kNamedFileRegex = RegExp(kNamedFilePattern); -const kMdPreviewClassRegex = RegExp(kPreviewClassPattern); -const kMdNamedImageRegex = RegExp(kMdNamedImagePattern); +const kNamedFileRegex = RegExp(kNamedFilePattern, "l"); +const kMdPreviewClassRegex = RegExp(kPreviewClassPattern, "l"); +const kMdNamedImageRegex = RegExp(kMdNamedImagePattern, "l"); const kMarkdownImg = /!\[[^\]]*\]\((.*?)(?:\".*\")?\)(?:\{(?:[^\|]*)\})?/; export function findDescription(doc: Document): string | undefined { diff --git a/tests/run-tests.ps1 b/tests/run-tests.ps1 index 902250b60a..02a703c426 100644 --- a/tests/run-tests.ps1 +++ b/tests/run-tests.ps1 @@ -56,7 +56,7 @@ $Env:QUARTO_DEBUG = "true" # Preparing running Deno with default arguments $QUARTO_IMPORT_MAP_ARG="--importmap=$(Join-Path $QUARTO_SRC_DIR "dev_import_map.json")" -$QUARTO_DENO_OPTIONS="--config test-conf.json --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check" +$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" # Parsing argument passed to the script diff --git a/tests/run-tests.sh b/tests/run-tests.sh index f7f17192b1..3edcb1a599 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -23,7 +23,7 @@ export QUARTO_BIN_PATH=$DENO_DIR export QUARTO_SHARE_PATH="`cd "$QUARTO_ROOT/src/resources/";pwd`" export QUARTO_DEBUG=true -QUARTO_DENO_OPTIONS="--config test-conf.json --unstable-ffi --allow-read --allow-write --allow-run --allow-env --allow-net --check" +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" if [[ -z $GITHUB_ACTION ]] && [[ -z $QUARTO_TESTS_NO_CONFIG ]]