Skip to content

Commit 2847a3d

Browse files
authored
Merge pull request #12600 from quarto-dev/feature/deno-2-deps
Feature/deno 2 deps
2 parents f08f424 + a414807 commit 2847a3d

File tree

1,356 files changed

+1960
-244286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,356 files changed

+1960
-244286
lines changed

.github/workflows/actions/quarto-dev/action.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ runs:
88
uses: actions/cache@v4
99
with:
1010
path: ./src/resources/deno_std/cache
11-
key: ${{ runner.os }}-deno_std-1-${{ hashFiles('./src/resources/deno_std/deno_std.lock', './package/scripts/deno_std/deno_std.ts') }}
11+
key: ${{ runner.os }}-deno_std-2-${{ hashFiles('./src/resources/deno_std/deno_std.lock', './package/scripts/deno_std/deno_std.ts') }}
1212
restore-keys: |
13-
${{ runner.os }}-deno_std-1-
14-
${{ runner.os }}-deno_std-
13+
${{ runner.os }}-deno_std-2-
1514
1615
- name: Configure Quarto (.sh)
1716
if: runner.os != 'Windows'

configure.cmd

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -69,30 +69,14 @@ echo Configuration done
6969

7070
POPD
7171

72-
if "%CI%" NEQ "true" (
73-
echo Revendoring quarto dependencies
74-
75-
@REM for /F "tokens=2" %%i in ('date /t') do set today=%%i
76-
@REM RENAME src\vendor src\vendor-%today%
77-
@REM pushd src
78-
@REM echo Vendor phase 1
79-
@REM %QUARTO_DENO% vendor quarto.ts %QUARTO_ROOT%\tests\test-deps.ts --importmap=import_map.json
80-
@REM if ERRORLEVEL NEQ 0 (
81-
@REM popd
82-
@REM echo deno vendor failed (likely because of a download error). Please run the configure script again.
83-
@REM RMDIR vendor
84-
@REM RENAME vendor-${today} vendor
85-
@REM exit 1
86-
@REM )
87-
@REM popd
88-
@REM %QUARTO_DENO% run --unstable --allow-all --importmap=src\import_map.json package\src\common\create-dev-import-map.ts
89-
)
72+
REM download typescript dependencies
73+
CALL package\scripts\vendoring\vendor.cmd
9074

9175
ECHO Downloading Deno Stdlib
9276
CALL !QUARTO_PACKAGE_PATH!\scripts\deno_std\download.bat
9377

94-
SET QUARTO_DENO_EXTRA_OPTIONS="--reload"
9578
IF EXIST !QUARTO_BIN_PATH!\quarto.cmd (
79+
SET QUARTO_DENO_EXTRA_OPTIONS=--reload
9680
CALL "!QUARTO_BIN_PATH!\quarto" --version
9781
)
9882

configure.sh

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,51 +29,58 @@ function download() {
2929

3030
QUARTO_VENDOR_BINARIES=${QUARTO_VENDOR_BINARIES=true}
3131

32-
DENO_BIN=${QUARTO_DENO=$QUARTO_BIN_PATH/tools/$DENO_DIR/deno}
32+
DENO_BIN=${QUARTO_DENO=$QUARTO_BIN_PATH/tools/$DENO_ARCH_DIR/deno}
3333

3434
if [[ "${QUARTO_VENDOR_BINARIES}" = "true" ]]; then
35-
DENO_VERSION_NO_V=$(echo $DENO | sed 's/v//')
36-
if [[ (! -f "$DENO_BIN") || $("$DENO_BIN" --version | grep $DENO_VERSION_NO_V) == "" ]]; then
35+
DENO_VERSION_NO_V=$(echo "$DENO" | sed 's/v//')
36+
if [[ (! -f "$DENO_BIN") || $("$DENO_BIN" --version | grep "$DENO_VERSION_NO_V") == "" ]]; then
3737
# Ensure directory is there for Deno
3838
echo "Bootstrapping Deno..."
3939

40-
rm -rf $QUARTO_DIST_PATH
40+
rm -rf "$QUARTO_DIST_PATH"
4141

4242
## Binary Directory
4343
mkdir -p "$QUARTO_BIN_PATH/tools"
44-
cd $QUARTO_BIN_PATH/tools
44+
pushd "$QUARTO_BIN_PATH/tools"
4545

4646
# Download Deno
4747
for DENOFILE in $DENOFILES; do
4848
download "$DENOURL/$DENO/$DENOFILE" "$DENOFILE"
49-
unzip -o $DENOFILE
50-
51-
mkdir -p $DENO_DIR
52-
mv deno $DENO_DIR
53-
rm $DENOFILE
49+
unzip -o "$DENOFILE"
50+
mkdir -p "$DENO_ARCH_DIR"
51+
mv deno "$DENO_ARCH_DIR"
52+
rm "$DENOFILE"
5453
done
5554

5655
# we create a symlink here so that we need only one quarto-cli.code-workspace file
57-
ln -s $DENO_DIR/deno deno
56+
ln -s $DENO_ARCH_DIR/deno deno
5857

5958
# If a canary commit is provided, upgrade to that
60-
if [ ! -z "$DENO_CANARY_COMMIT" ]; then
59+
if [ -n "$DENO_CANARY_COMMIT" ]; then
6160
echo [Upgrading Deno to Canary]
62-
./deno upgrade --canary --version $DENO_CANARY_COMMIT
61+
./deno upgrade --canary --version "$DENO_CANARY_COMMIT"
6362
fi
6463

6564
# write deno version file for later use
66-
mkdir -p $QUARTO_BIN_PATH/../config
67-
echo $DENO > $QUARTO_BIN_PATH/../config/deno-version
65+
mkdir -p "$QUARTO_BIN_PATH/../config"
66+
echo "$DENO" > "$QUARTO_BIN_PATH/../config/deno-version"
67+
68+
popd
6869
fi
69-
export DENO_BIN_PATH=$QUARTO_BIN_PATH/tools/$DENO_DIR/deno
70+
export DENO_BIN_PATH=$QUARTO_BIN_PATH/tools/$DENO_ARCH_DIR/deno
7071
else
7172
if [ -z "$DENO_BIN_PATH" ]; then
7273
echo "DENO_BIN_PATH is not set. You either need to allow QUARTO_VENDOR_BINARIES or set DENO_BIN_PATH to the path of a deno binary."
7374
exit 1
7475
fi
7576
fi
7677

78+
if [ "$QUARTO_DENO_DIR" == "" ]; then
79+
export DENO_DIR=$QUARTO_BIN_PATH/deno_cache
80+
else
81+
export DENO_DIR=$QUARTO_DENO_DIR
82+
fi
83+
7784
echo "Downloading Deno Stdlib"
7885
"${QUARTO_PACKAGE_PATH}/scripts/deno_std/download.sh"
7986

@@ -82,6 +89,11 @@ pushd "$QUARTO_PACKAGE_PATH/src/"
8289
# Run the configure command to bootstrap installation
8390
./quarto-bld configure --log-level info
8491

92+
popd
93+
94+
# download typescript dependencies
95+
source package/scripts/vendoring/vendor.sh
96+
8597
# Run the quarto command with 'reload', which will force the import_map dependencies
8698
# to be reloaded
8799
if ! quarto_loc="$(type -p quarto)" || [[ -z $quarto_loc ]]; then

dev-docs/add-typescript-dependency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ We vendor all external dependencies to avoid downloads during the execution of q
1010

1111
- If the dependency is meant to be exposed to quarto typescript script (through `quarto run`), then add the import to `package/scripts/deno_std/deno_std.ts` as well (notice the slightly different syntax there, and adapt accordingly).
1212

13-
Then, run the `./package/scripts/vendoring/vendor.sh` scripts to update the vendored dependencies. This script will update `src/dev_import_map.json`, as well as files in `src/vendor`, `src/resources/deno_std`, and `src/resources/vendor`. Check those changes in version control.
13+
Then, rerun `./configure.sh`, which calls the `./package/scripts/vendoring/vendor.sh` scripts to update the deno cache with the downloaded dependencies.

dev-docs/upgrade-dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Contact Carlos so he uploads the binaries to the S3 bucket.
1010

1111
- In `src/import_map.json`, change the version number of the imports like `https://deno.land/[email protected]/archive` to the new version number (e.g. `0.205.0`).
1212

13-
- run `./package/scripts/vendoring/vendor.sh`
13+
- run `./configure.sh`.
1414

1515
### Upgrade Deno download link for RHEL build from conda-forge
1616

package/scripts/common/quarto

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ else
3333
fi
3434
QUARTO_SRC_PATH="$QUARTO_ROOT/src"
3535
DEV_PATH=$QUARTO_SRC_PATH/quarto.ts
36+
QUARTO_IMPORT_MAP_ARG=--importmap=$QUARTO_SRC_PATH/import_map.json
37+
3638
if [ -f "$DEV_PATH" ]; then
3739
if [ "$1" == "--version" ] || [ "$1" == "-v" ]; then
3840
if [ "$QUARTO_FORCE_VERSION" != "" ]; then
@@ -48,9 +50,6 @@ if [ -f "$DEV_PATH" ]; then
4850
QUARTO_ACTION=run
4951
fi
5052

51-
# Local import map
52-
QUARTO_IMPORT_MAP_ARG=--importmap=$QUARTO_SRC_PATH/import_map.json
53-
5453
# Turn on type checking for dev version
5554
if [ -z ${QUARTO_NO_TYPECHECK+x} ]; then
5655
QUARTO_DENO_OPTIONS=--check
@@ -63,10 +62,12 @@ if [ -f "$DEV_PATH" ]; then
6362

6463
export QUARTO_BIN_PATH=$SCRIPT_PATH
6564
export QUARTO_SHARE_PATH="${QUARTO_SHARE_PATH=$QUARTO_SRC_PATH/resources/}"
65+
export DENO_DIR=$QUARTO_BIN_PATH/deno_cache
66+
6667
if [ -z ${QUARTO_DEBUG+x} ]; then
6768
export QUARTO_DEBUG=true
6869
fi
69-
# QUARTO_CACHE_OPTIONS="--cached-only"
70+
QUARTO_CACHE_OPTIONS="--cached-only"
7071

7172
# Check for deno update
7273
QUARTO_DIST_CONFIG=$QUARTO_BIN_PATH/../config
@@ -91,7 +92,8 @@ else
9192
QUARTO_ACTION=run
9293
QUARTO_TARGET=${SCRIPT_PATH}/quarto.js
9394
export QUARTO_BIN_PATH=$SCRIPT_PATH
94-
QUARTO_CACHE_OPTIONS=""
95+
export DENO_DIR=$QUARTO_BIN_PATH/deno_cache
96+
QUARTO_CACHE_OPTIONS="--cached-only"
9597

9698
# Turn off type checking for bundled version
9799
QUARTO_DENO_OPTIONS=--no-check
@@ -108,9 +110,6 @@ else
108110
fi
109111
fi
110112

111-
# release vendored import map
112-
QUARTO_IMPORT_MAP_ARG=--importmap=$SCRIPT_PATH/vendor/import_map.json
113-
114113
if [ "$1" == "--version" ] || [ "$1" == "-v" ]; then
115114
if [ "$QUARTO_FORCE_VERSION" != "" ]; then
116115
echo $QUARTO_FORCE_VERSION

package/scripts/common/utils.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# DENOFILES is only required at configure.sh, but DENO_DIR is used in many places
1+
# DENOFILES is only required at configure.sh, but DENO_ARCH_DIR is used in many places
22

33
if [[ $OSTYPE == 'darwin'* ]]; then
44
DENOURL=https://github.com/denoland/deno/releases/download
55
FULLARCH=$(uname -sm)
66

77

88
if [[ $FULLARCH == "Darwin x86_64" ]]; then
9-
DENO_DIR=x86_64
9+
DENO_ARCH_DIR=x86_64
1010
DENOFILES="deno-x86_64-apple-darwin.zip"
1111
elif [[ $FULLARCH == "Darwin arm64" ]]; then
12-
DENO_DIR=aarch64
12+
DENO_ARCH_DIR=aarch64
1313
DENOFILES="deno-aarch64-apple-darwin.zip"
1414
else
1515
echo "configure script failed: unrecognized architecture " ${FULLARCH}
@@ -21,11 +21,11 @@ else
2121
if [[ $NIXARCH == "x86_64" ]]; then
2222
DENOURL=https://github.com/denoland/deno/releases/download
2323
DENOFILES=deno-x86_64-unknown-linux-gnu.zip
24-
DENO_DIR=x86_64
24+
DENO_ARCH_DIR=x86_64
2525
elif [[ $NIXARCH == "aarch64" ]]; then
2626
DENOURL=https://github.com/denoland/deno/releases/download
2727
DENOFILES=deno-aarch64-unknown-linux-gnu.zip
28-
DENO_DIR=aarch64
28+
DENO_ARCH_DIR=aarch64
2929
else
3030
echo "configure script failed: unrecognized architecture " ${NIXARCH}
3131
exit 1

package/scripts/deno_std/download.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ if NOT DEFINED QUARTO_DENO (
66
)
77

88
set DENO_DIR=%~dp0\..\..\..\src\resources\deno_std\cache
9-
%QUARTO_DENO% cache --unstable-ffi --lock %~dp0\..\..\..\src\resources\deno_std\deno_std.lock %~dp0\deno_std.ts
9+
%QUARTO_DENO% cache --allow-import --unstable-ffi --lock %~dp0\..\..\..\src\resources\deno_std\deno_std.lock %~dp0\deno_std.ts

package/scripts/deno_std/download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ source "$SCRIPT_PATH/../../../configuration"
55
source "$SCRIPT_PATH/../../src/set_package_paths.sh"
66

77
if [ -z "$QUARTO_DENO" ]; then
8-
export QUARTO_DENO="$QUARTO_DIST_PATH/bin/tools/$DENO_DIR/deno"
8+
export QUARTO_DENO="$QUARTO_DIST_PATH/bin/tools/$DENO_ARCH_DIR/deno"
99
fi
1010

1111

package/scripts/vendoring/vendor.cmd

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@ECHO OFF
2+
REM You should not need to run this script directly.
3+
REM It is sourced by the configure.cmd script.
4+
SETLOCAL ENABLEDELAYEDEXPANSION
5+
6+
IF "%QUARTO_VENDOR_BINARIES%"=="true" (
7+
SET DENO_BIN_PATH=!QUARTO_BIN_PATH!\tools\!DENO_ARCH_DIR!\deno.exe
8+
) ELSE (
9+
IF NOT DEFINED DENO_BIN_PATH (
10+
ECHO DENO_BIN_PATH is not set. You either need to allow QUARTO_VENDOR_BINARIES or set DENO_BIN_PATH to the path of a deno binary.
11+
EXIT /B 1
12+
)
13+
)
14+
15+
IF NOT DEFINED DENO_DIR (
16+
SET DENO_DIR=!QUARTO_BIN_PATH!\deno_cache
17+
)
18+
19+
ECHO Revendoring quarto dependencies
20+
21+
REM remove deno_cache directory first
22+
IF EXIST "!DENO_DIR!" (
23+
RMDIR /S /Q "!DENO_DIR!"
24+
)
25+
26+
PUSHD "!QUARTO_SRC_PATH!"
27+
28+
FOR %%E IN (quarto.ts vendor_deps.ts ..\tests\test-deps.ts ..\package\scripts\deno_std\deno_std.ts) DO (
29+
CALL !DENO_BIN_PATH! install --allow-all --no-config --entrypoint %%E --importmap="!QUARTO_SRC_PATH!\import_map.json"
30+
)
31+
32+
REM Return to the original directory
33+
POPD
34+
35+
36+
EXIT /B 0

0 commit comments

Comments
 (0)