diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d006b65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules/ +web/node_modules/ +web/build/ +data/ +.env diff --git a/web/node_modules/.bin/acorn b/web/node_modules/.bin/acorn deleted file mode 100644 index 46a3e61..0000000 --- a/web/node_modules/.bin/acorn +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../acorn/bin/acorn" "$@" -else - exec node "$basedir/../acorn/bin/acorn" "$@" -fi diff --git a/web/node_modules/.bin/acorn.cmd b/web/node_modules/.bin/acorn.cmd deleted file mode 100644 index a9324df..0000000 --- a/web/node_modules/.bin/acorn.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\acorn\bin\acorn" %* diff --git a/web/node_modules/.bin/acorn.ps1 b/web/node_modules/.bin/acorn.ps1 deleted file mode 100644 index 6f6dcdd..0000000 --- a/web/node_modules/.bin/acorn.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args - } else { - & "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../acorn/bin/acorn" $args - } else { - & "node$exe" "$basedir/../acorn/bin/acorn" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/esbuild b/web/node_modules/.bin/esbuild deleted file mode 100644 index 26bef54..0000000 --- a/web/node_modules/.bin/esbuild +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../esbuild/bin/esbuild" "$@" -else - exec node "$basedir/../esbuild/bin/esbuild" "$@" -fi diff --git a/web/node_modules/.bin/esbuild.cmd b/web/node_modules/.bin/esbuild.cmd deleted file mode 100644 index cc920c5..0000000 --- a/web/node_modules/.bin/esbuild.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\esbuild\bin\esbuild" %* diff --git a/web/node_modules/.bin/esbuild.ps1 b/web/node_modules/.bin/esbuild.ps1 deleted file mode 100644 index 81ffbf9..0000000 --- a/web/node_modules/.bin/esbuild.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args - } else { - & "$basedir/node$exe" "$basedir/../esbuild/bin/esbuild" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../esbuild/bin/esbuild" $args - } else { - & "node$exe" "$basedir/../esbuild/bin/esbuild" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/jiti b/web/node_modules/.bin/jiti deleted file mode 100644 index 6abe7fe..0000000 --- a/web/node_modules/.bin/jiti +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../jiti/lib/jiti-cli.mjs" "$@" -else - exec node "$basedir/../jiti/lib/jiti-cli.mjs" "$@" -fi diff --git a/web/node_modules/.bin/jiti.cmd b/web/node_modules/.bin/jiti.cmd deleted file mode 100644 index b2360f3..0000000 --- a/web/node_modules/.bin/jiti.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\jiti\lib\jiti-cli.mjs" %* diff --git a/web/node_modules/.bin/jiti.ps1 b/web/node_modules/.bin/jiti.ps1 deleted file mode 100644 index baf5345..0000000 --- a/web/node_modules/.bin/jiti.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args - } else { - & "$basedir/node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args - } else { - & "node$exe" "$basedir/../jiti/lib/jiti-cli.mjs" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/nanoid b/web/node_modules/.bin/nanoid deleted file mode 100644 index 23254eb..0000000 --- a/web/node_modules/.bin/nanoid +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../nanoid/bin/nanoid.cjs" "$@" -else - exec node "$basedir/../nanoid/bin/nanoid.cjs" "$@" -fi diff --git a/web/node_modules/.bin/nanoid.cmd b/web/node_modules/.bin/nanoid.cmd deleted file mode 100644 index 9c40107..0000000 --- a/web/node_modules/.bin/nanoid.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\nanoid\bin\nanoid.cjs" %* diff --git a/web/node_modules/.bin/nanoid.ps1 b/web/node_modules/.bin/nanoid.ps1 deleted file mode 100644 index d8a4d7a..0000000 --- a/web/node_modules/.bin/nanoid.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args - } else { - & "$basedir/node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args - } else { - & "node$exe" "$basedir/../nanoid/bin/nanoid.cjs" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/rollup b/web/node_modules/.bin/rollup deleted file mode 100644 index 11bd86d..0000000 --- a/web/node_modules/.bin/rollup +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../rollup/dist/bin/rollup" "$@" -else - exec node "$basedir/../rollup/dist/bin/rollup" "$@" -fi diff --git a/web/node_modules/.bin/rollup.cmd b/web/node_modules/.bin/rollup.cmd deleted file mode 100644 index b3f110b..0000000 --- a/web/node_modules/.bin/rollup.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\rollup\dist\bin\rollup" %* diff --git a/web/node_modules/.bin/rollup.ps1 b/web/node_modules/.bin/rollup.ps1 deleted file mode 100644 index 10f657d..0000000 --- a/web/node_modules/.bin/rollup.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args - } else { - & "$basedir/node$exe" "$basedir/../rollup/dist/bin/rollup" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../rollup/dist/bin/rollup" $args - } else { - & "node$exe" "$basedir/../rollup/dist/bin/rollup" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/svelte-check b/web/node_modules/.bin/svelte-check deleted file mode 100644 index 3c55d2d..0000000 --- a/web/node_modules/.bin/svelte-check +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../svelte-check/bin/svelte-check" "$@" -else - exec node "$basedir/../svelte-check/bin/svelte-check" "$@" -fi diff --git a/web/node_modules/.bin/svelte-check.cmd b/web/node_modules/.bin/svelte-check.cmd deleted file mode 100644 index f08f2f6..0000000 --- a/web/node_modules/.bin/svelte-check.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\svelte-check\bin\svelte-check" %* diff --git a/web/node_modules/.bin/svelte-check.ps1 b/web/node_modules/.bin/svelte-check.ps1 deleted file mode 100644 index 3fcdf81..0000000 --- a/web/node_modules/.bin/svelte-check.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../svelte-check/bin/svelte-check" $args - } else { - & "$basedir/node$exe" "$basedir/../svelte-check/bin/svelte-check" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../svelte-check/bin/svelte-check" $args - } else { - & "node$exe" "$basedir/../svelte-check/bin/svelte-check" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/svelte-kit b/web/node_modules/.bin/svelte-kit deleted file mode 100644 index 610e55b..0000000 --- a/web/node_modules/.bin/svelte-kit +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../@sveltejs/kit/svelte-kit.js" "$@" -else - exec node "$basedir/../@sveltejs/kit/svelte-kit.js" "$@" -fi diff --git a/web/node_modules/.bin/svelte-kit.cmd b/web/node_modules/.bin/svelte-kit.cmd deleted file mode 100644 index 38d52f9..0000000 --- a/web/node_modules/.bin/svelte-kit.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\@sveltejs\kit\svelte-kit.js" %* diff --git a/web/node_modules/.bin/svelte-kit.ps1 b/web/node_modules/.bin/svelte-kit.ps1 deleted file mode 100644 index 1ac1f3f..0000000 --- a/web/node_modules/.bin/svelte-kit.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../@sveltejs/kit/svelte-kit.js" $args - } else { - & "$basedir/node$exe" "$basedir/../@sveltejs/kit/svelte-kit.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../@sveltejs/kit/svelte-kit.js" $args - } else { - & "node$exe" "$basedir/../@sveltejs/kit/svelte-kit.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/tsc b/web/node_modules/.bin/tsc deleted file mode 100644 index 4979851..0000000 --- a/web/node_modules/.bin/tsc +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../typescript/bin/tsc" "$@" -else - exec node "$basedir/../typescript/bin/tsc" "$@" -fi diff --git a/web/node_modules/.bin/tsc.cmd b/web/node_modules/.bin/tsc.cmd deleted file mode 100644 index 40bf128..0000000 --- a/web/node_modules/.bin/tsc.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsc" %* diff --git a/web/node_modules/.bin/tsc.ps1 b/web/node_modules/.bin/tsc.ps1 deleted file mode 100644 index 112413b..0000000 --- a/web/node_modules/.bin/tsc.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args - } else { - & "$basedir/node$exe" "$basedir/../typescript/bin/tsc" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../typescript/bin/tsc" $args - } else { - & "node$exe" "$basedir/../typescript/bin/tsc" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/tsserver b/web/node_modules/.bin/tsserver deleted file mode 100644 index cc53aac..0000000 --- a/web/node_modules/.bin/tsserver +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../typescript/bin/tsserver" "$@" -else - exec node "$basedir/../typescript/bin/tsserver" "$@" -fi diff --git a/web/node_modules/.bin/tsserver.cmd b/web/node_modules/.bin/tsserver.cmd deleted file mode 100644 index 57f851f..0000000 --- a/web/node_modules/.bin/tsserver.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\typescript\bin\tsserver" %* diff --git a/web/node_modules/.bin/tsserver.ps1 b/web/node_modules/.bin/tsserver.ps1 deleted file mode 100644 index 249f417..0000000 --- a/web/node_modules/.bin/tsserver.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args - } else { - & "$basedir/node$exe" "$basedir/../typescript/bin/tsserver" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../typescript/bin/tsserver" $args - } else { - & "node$exe" "$basedir/../typescript/bin/tsserver" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.bin/vite b/web/node_modules/.bin/vite deleted file mode 100644 index a85d325..0000000 --- a/web/node_modules/.bin/vite +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") - -case `uname` in - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; -esac - -if [ -x "$basedir/node" ]; then - exec "$basedir/node" "$basedir/../vite/bin/vite.js" "$@" -else - exec node "$basedir/../vite/bin/vite.js" "$@" -fi diff --git a/web/node_modules/.bin/vite.cmd b/web/node_modules/.bin/vite.cmd deleted file mode 100644 index f62e966..0000000 --- a/web/node_modules/.bin/vite.cmd +++ /dev/null @@ -1,17 +0,0 @@ -@ECHO off -GOTO start -:find_dp0 -SET dp0=%~dp0 -EXIT /b -:start -SETLOCAL -CALL :find_dp0 - -IF EXIST "%dp0%\node.exe" ( - SET "_prog=%dp0%\node.exe" -) ELSE ( - SET "_prog=node" - SET PATHEXT=%PATHEXT:;.JS;=;% -) - -endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & "%_prog%" "%dp0%\..\vite\bin\vite.js" %* diff --git a/web/node_modules/.bin/vite.ps1 b/web/node_modules/.bin/vite.ps1 deleted file mode 100644 index a7759bc..0000000 --- a/web/node_modules/.bin/vite.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env pwsh -$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent - -$exe="" -if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) { - # Fix case when both the Windows and Linux builds of Node - # are installed in the same directory - $exe=".exe" -} -$ret=0 -if (Test-Path "$basedir/node$exe") { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args - } else { - & "$basedir/node$exe" "$basedir/../vite/bin/vite.js" $args - } - $ret=$LASTEXITCODE -} else { - # Support pipeline input - if ($MyInvocation.ExpectingInput) { - $input | & "node$exe" "$basedir/../vite/bin/vite.js" $args - } else { - & "node$exe" "$basedir/../vite/bin/vite.js" $args - } - $ret=$LASTEXITCODE -} -exit $ret diff --git a/web/node_modules/.package-lock.json b/web/node_modules/.package-lock.json deleted file mode 100644 index b19422f..0000000 --- a/web/node_modules/.package-lock.json +++ /dev/null @@ -1,978 +0,0 @@ -{ - "name": "docker-watcher-web", - "version": "0.1.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/@esbuild/win32-x64": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", - "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.13", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", - "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/remapping": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", - "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.31", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", - "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", - "dev": true, - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@polka/url": { - "version": "1.0.0-next.29", - "resolved": "https://registry.npmjs.org/@polka/url/-/url-1.0.0-next.29.tgz", - "integrity": "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==", - "dev": true - }, - "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.0.tgz", - "integrity": "sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.0.tgz", - "integrity": "sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@standard-schema/spec": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "dev": true - }, - "node_modules/@sveltejs/acorn-typescript": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.9.tgz", - "integrity": "sha512-lVJX6qEgs/4DOcRTpo56tmKzVPtoWAaVbL4hfO7t7NVwl9AAXzQR6cihesW1BmNMPl+bK6dreu2sOKBP2Q9CIA==", - "dev": true, - "peerDependencies": { - "acorn": "^8.9.0" - } - }, - "node_modules/@sveltejs/adapter-static": { - "version": "3.0.10", - "resolved": "https://registry.npmjs.org/@sveltejs/adapter-static/-/adapter-static-3.0.10.tgz", - "integrity": "sha512-7D9lYFWJmB7zxZyTE/qxjksvMqzMuYrrsyh1f4AlZqeZeACPRySjbC3aFiY55wb1tWUaKOQG9PVbm74JcN2Iew==", - "dev": true, - "peerDependencies": { - "@sveltejs/kit": "^2.0.0" - } - }, - "node_modules/@sveltejs/kit": { - "version": "2.55.0", - "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.55.0.tgz", - "integrity": "sha512-MdFRjevVxmAknf2NbaUkDF16jSIzXMWd4Nfah0Qp8TtQVoSp3bV4jKt8mX7z7qTUTWvgSaxtR0EG5WJf53gcuA==", - "dev": true, - "dependencies": { - "@standard-schema/spec": "^1.0.0", - "@sveltejs/acorn-typescript": "^1.0.5", - "@types/cookie": "^0.6.0", - "acorn": "^8.14.1", - "cookie": "^0.6.0", - "devalue": "^5.6.4", - "esm-env": "^1.2.2", - "kleur": "^4.1.5", - "magic-string": "^0.30.5", - "mrmime": "^2.0.0", - "set-cookie-parser": "^3.0.0", - "sirv": "^3.0.0" - }, - "bin": { - "svelte-kit": "svelte-kit.js" - }, - "engines": { - "node": ">=18.13" - }, - "peerDependencies": { - "@opentelemetry/api": "^1.0.0", - "@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0 || ^7.0.0", - "svelte": "^4.0.0 || ^5.0.0-next.0", - "typescript": "^5.3.3", - "vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "@opentelemetry/api": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/@sveltejs/vite-plugin-svelte": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-5.1.1.tgz", - "integrity": "sha512-Y1Cs7hhTc+a5E9Va/xwKlAJoariQyHY+5zBgCZg4PFWNYQ1nMN9sjK1zhw1gK69DuqVP++sht/1GZg1aRwmAXQ==", - "dev": true, - "dependencies": { - "@sveltejs/vite-plugin-svelte-inspector": "^4.0.1", - "debug": "^4.4.1", - "deepmerge": "^4.3.1", - "kleur": "^4.1.5", - "magic-string": "^0.30.17", - "vitefu": "^1.0.6" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "peerDependencies": { - "svelte": "^5.0.0", - "vite": "^6.0.0" - } - }, - "node_modules/@sveltejs/vite-plugin-svelte-inspector": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-4.0.1.tgz", - "integrity": "sha512-J/Nmb2Q2y7mck2hyCX4ckVHcR5tu2J+MtBEQqpDrrgELZ2uvraQcK/ioCV61AqkdXFgriksOKIceDcQmqnGhVw==", - "dev": true, - "dependencies": { - "debug": "^4.3.7" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "peerDependencies": { - "@sveltejs/vite-plugin-svelte": "^5.0.0", - "svelte": "^5.0.0", - "vite": "^6.0.0" - } - }, - "node_modules/@tailwindcss/node": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.2.2.tgz", - "integrity": "sha512-pXS+wJ2gZpVXqFaUEjojq7jzMpTGf8rU6ipJz5ovJV6PUGmlJ+jvIwGrzdHdQ80Sg+wmQxUFuoW1UAAwHNEdFA==", - "dev": true, - "dependencies": { - "@jridgewell/remapping": "^2.3.5", - "enhanced-resolve": "^5.19.0", - "jiti": "^2.6.1", - "lightningcss": "1.32.0", - "magic-string": "^0.30.21", - "source-map-js": "^1.2.1", - "tailwindcss": "4.2.2" - } - }, - "node_modules/@tailwindcss/oxide": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.2.2.tgz", - "integrity": "sha512-qEUA07+E5kehxYp9BVMpq9E8vnJuBHfJEC0vPC5e7iL/hw7HR61aDKoVoKzrG+QKp56vhNZe4qwkRmMC0zDLvg==", - "dev": true, - "engines": { - "node": ">= 20" - }, - "optionalDependencies": { - "@tailwindcss/oxide-android-arm64": "4.2.2", - "@tailwindcss/oxide-darwin-arm64": "4.2.2", - "@tailwindcss/oxide-darwin-x64": "4.2.2", - "@tailwindcss/oxide-freebsd-x64": "4.2.2", - "@tailwindcss/oxide-linux-arm-gnueabihf": "4.2.2", - "@tailwindcss/oxide-linux-arm64-gnu": "4.2.2", - "@tailwindcss/oxide-linux-arm64-musl": "4.2.2", - "@tailwindcss/oxide-linux-x64-gnu": "4.2.2", - "@tailwindcss/oxide-linux-x64-musl": "4.2.2", - "@tailwindcss/oxide-wasm32-wasi": "4.2.2", - "@tailwindcss/oxide-win32-arm64-msvc": "4.2.2", - "@tailwindcss/oxide-win32-x64-msvc": "4.2.2" - } - }, - "node_modules/@tailwindcss/oxide-win32-x64-msvc": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.2.2.tgz", - "integrity": "sha512-1T/37VvI7WyH66b+vqHj/cLwnCxt7Qt3WFu5Q8hk65aOvlwAhs7rAp1VkulBJw/N4tMirXjVnylTR72uI0HGcA==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 20" - } - }, - "node_modules/@tailwindcss/vite": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@tailwindcss/vite/-/vite-4.2.2.tgz", - "integrity": "sha512-mEiF5HO1QqCLXoNEfXVA1Tzo+cYsrqV7w9Juj2wdUFyW07JRenqMG225MvPwr3ZD9N1bFQj46X7r33iHxLUW0w==", - "dev": true, - "dependencies": { - "@tailwindcss/node": "4.2.2", - "@tailwindcss/oxide": "4.2.2", - "tailwindcss": "4.2.2" - }, - "peerDependencies": { - "vite": "^5.2.0 || ^6 || ^7 || ^8" - } - }, - "node_modules/@types/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", - "dev": true - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true - }, - "node_modules/@types/trusted-types": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", - "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", - "dev": true - }, - "node_modules/@typescript-eslint/types": { - "version": "8.57.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.57.2.tgz", - "integrity": "sha512-/iZM6FnM4tnx9csuTxspMW4BOSegshwX5oBDznJ7S4WggL7Vczz5d2W11ecc4vRrQMQHXRSxzrCsyG5EsPPTbA==", - "dev": true, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aria-query": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.1.tgz", - "integrity": "sha512-Z/ZeOgVl7bcSYZ/u/rh0fOpvEpq//LZmdbkXyc7syVzjPAhfOa9ebsdTSjEBDU4vs5nC98Kfduj1uFo0qyET3g==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/axobject-query": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", - "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", - "dev": true, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dev": true, - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/clsx": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", - "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "dev": true, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deepmerge": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", - "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/detect-libc": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", - "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/devalue": { - "version": "5.6.4", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.4.tgz", - "integrity": "sha512-Gp6rDldRsFh/7XuouDbxMH3Mx8GMCcgzIb1pDTvNyn8pZGQ22u+Wa+lGV9dQCltFQ7uVw0MhRyb8XDskNFOReA==", - "dev": true - }, - "node_modules/enhanced-resolve": { - "version": "5.20.1", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.20.1.tgz", - "integrity": "sha512-Qohcme7V1inbAfvjItgw0EaxVX5q2rdVEZHRBrEQdRZTssLDGsL8Lwrznl8oQ/6kuTJONLaDcGjkNP247XEhcA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.3.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/esbuild": { - "version": "0.25.12", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", - "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", - "dev": true, - "hasInstallScript": true, - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.12", - "@esbuild/android-arm": "0.25.12", - "@esbuild/android-arm64": "0.25.12", - "@esbuild/android-x64": "0.25.12", - "@esbuild/darwin-arm64": "0.25.12", - "@esbuild/darwin-x64": "0.25.12", - "@esbuild/freebsd-arm64": "0.25.12", - "@esbuild/freebsd-x64": "0.25.12", - "@esbuild/linux-arm": "0.25.12", - "@esbuild/linux-arm64": "0.25.12", - "@esbuild/linux-ia32": "0.25.12", - "@esbuild/linux-loong64": "0.25.12", - "@esbuild/linux-mips64el": "0.25.12", - "@esbuild/linux-ppc64": "0.25.12", - "@esbuild/linux-riscv64": "0.25.12", - "@esbuild/linux-s390x": "0.25.12", - "@esbuild/linux-x64": "0.25.12", - "@esbuild/netbsd-arm64": "0.25.12", - "@esbuild/netbsd-x64": "0.25.12", - "@esbuild/openbsd-arm64": "0.25.12", - "@esbuild/openbsd-x64": "0.25.12", - "@esbuild/openharmony-arm64": "0.25.12", - "@esbuild/sunos-x64": "0.25.12", - "@esbuild/win32-arm64": "0.25.12", - "@esbuild/win32-ia32": "0.25.12", - "@esbuild/win32-x64": "0.25.12" - } - }, - "node_modules/esm-env": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz", - "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==", - "dev": true - }, - "node_modules/esrap": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.2.4.tgz", - "integrity": "sha512-suICpxAmZ9A8bzJjEl/+rLJiDKC0X4gYWUxT6URAWBLvlXmtbZd5ySMu/N2ZGEtMCAmflUDPSehrP9BQcsGcSg==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15", - "@typescript-eslint/types": "^8.2.0" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/is-reference": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-3.0.3.tgz", - "integrity": "sha512-ixkJoqQvAP88E6wLydLGGqCJsrFUnqoH6HnaczB8XmDH1oaWU+xxdptvikTgaEhtZ53Ky6YXiBuUI2WXLMCwjw==", - "dev": true, - "dependencies": { - "@types/estree": "^1.0.6" - } - }, - "node_modules/jiti": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", - "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", - "dev": true, - "bin": { - "jiti": "lib/jiti-cli.mjs" - } - }, - "node_modules/kleur": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", - "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/lightningcss": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", - "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", - "dev": true, - "dependencies": { - "detect-libc": "^2.0.3" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - }, - "optionalDependencies": { - "lightningcss-android-arm64": "1.32.0", - "lightningcss-darwin-arm64": "1.32.0", - "lightningcss-darwin-x64": "1.32.0", - "lightningcss-freebsd-x64": "1.32.0", - "lightningcss-linux-arm-gnueabihf": "1.32.0", - "lightningcss-linux-arm64-gnu": "1.32.0", - "lightningcss-linux-arm64-musl": "1.32.0", - "lightningcss-linux-x64-gnu": "1.32.0", - "lightningcss-linux-x64-musl": "1.32.0", - "lightningcss-win32-arm64-msvc": "1.32.0", - "lightningcss-win32-x64-msvc": "1.32.0" - } - }, - "node_modules/lightningcss-win32-x64-msvc": { - "version": "1.32.0", - "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", - "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", - "cpu": [ - "x64" - ], - "dev": true, - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/parcel" - } - }, - "node_modules/locate-character": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", - "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==", - "dev": true - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "dev": true, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/mri": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", - "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/mrmime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/mrmime/-/mrmime-2.0.1.tgz", - "integrity": "sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true - }, - "node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/postcss": { - "version": "8.5.8", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", - "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "dev": true, - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/rollup": { - "version": "4.60.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.0.tgz", - "integrity": "sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==", - "dev": true, - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.60.0", - "@rollup/rollup-android-arm64": "4.60.0", - "@rollup/rollup-darwin-arm64": "4.60.0", - "@rollup/rollup-darwin-x64": "4.60.0", - "@rollup/rollup-freebsd-arm64": "4.60.0", - "@rollup/rollup-freebsd-x64": "4.60.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.60.0", - "@rollup/rollup-linux-arm-musleabihf": "4.60.0", - "@rollup/rollup-linux-arm64-gnu": "4.60.0", - "@rollup/rollup-linux-arm64-musl": "4.60.0", - "@rollup/rollup-linux-loong64-gnu": "4.60.0", - "@rollup/rollup-linux-loong64-musl": "4.60.0", - "@rollup/rollup-linux-ppc64-gnu": "4.60.0", - "@rollup/rollup-linux-ppc64-musl": "4.60.0", - "@rollup/rollup-linux-riscv64-gnu": "4.60.0", - "@rollup/rollup-linux-riscv64-musl": "4.60.0", - "@rollup/rollup-linux-s390x-gnu": "4.60.0", - "@rollup/rollup-linux-x64-gnu": "4.60.0", - "@rollup/rollup-linux-x64-musl": "4.60.0", - "@rollup/rollup-openbsd-x64": "4.60.0", - "@rollup/rollup-openharmony-arm64": "4.60.0", - "@rollup/rollup-win32-arm64-msvc": "4.60.0", - "@rollup/rollup-win32-ia32-msvc": "4.60.0", - "@rollup/rollup-win32-x64-gnu": "4.60.0", - "@rollup/rollup-win32-x64-msvc": "4.60.0", - "fsevents": "~2.3.2" - } - }, - "node_modules/sade": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", - "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", - "dev": true, - "dependencies": { - "mri": "^1.1.0" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/set-cookie-parser": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-3.1.0.tgz", - "integrity": "sha512-kjnC1DXBHcxaOaOXBHBeRtltsDG2nUiUni+jP92M9gYdW12rsmx92UsfpH7o5tDRs7I1ZZPSQJQGv3UaRfCiuw==", - "dev": true - }, - "node_modules/sirv": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/sirv/-/sirv-3.0.2.tgz", - "integrity": "sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==", - "dev": true, - "dependencies": { - "@polka/url": "^1.0.0-next.24", - "mrmime": "^2.0.0", - "totalist": "^3.0.0" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/svelte": { - "version": "5.55.0", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.55.0.tgz", - "integrity": "sha512-SThllKq6TRMBwPtat7ASnm/9CDXnIhBR0NPGw0ujn2DVYx9rVwsPZxDaDQcYGdUz/3BYVsCzdq7pZarRQoGvtw==", - "dev": true, - "dependencies": { - "@jridgewell/remapping": "^2.3.4", - "@jridgewell/sourcemap-codec": "^1.5.0", - "@sveltejs/acorn-typescript": "^1.0.5", - "@types/estree": "^1.0.5", - "@types/trusted-types": "^2.0.7", - "acorn": "^8.12.1", - "aria-query": "5.3.1", - "axobject-query": "^4.1.0", - "clsx": "^2.1.1", - "devalue": "^5.6.4", - "esm-env": "^1.2.1", - "esrap": "^2.2.2", - "is-reference": "^3.0.3", - "locate-character": "^3.0.0", - "magic-string": "^0.30.11", - "zimmerframe": "^1.1.2" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/svelte-check": { - "version": "4.4.5", - "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.4.5.tgz", - "integrity": "sha512-1bSwIRCvvmSHrlK52fOlZmVtUZgil43jNL/2H18pRpa+eQjzGt6e3zayxhp1S7GajPFKNM/2PMCG+DZFHlG9fw==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.25", - "chokidar": "^4.0.1", - "fdir": "^6.2.0", - "picocolors": "^1.0.0", - "sade": "^1.7.4" - }, - "bin": { - "svelte-check": "bin/svelte-check" - }, - "engines": { - "node": ">= 18.0.0" - }, - "peerDependencies": { - "svelte": "^4.0.0 || ^5.0.0-next.0", - "typescript": ">=5.0.0" - } - }, - "node_modules/tailwindcss": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.2.2.tgz", - "integrity": "sha512-KWBIxs1Xb6NoLdMVqhbhgwZf2PGBpPEiwOqgI4pFIYbNTfBXiKYyWoTsXgBQ9WFg/OlhnvHaY+AEpW7wSmFo2Q==", - "dev": true - }, - "node_modules/tapable": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.2.tgz", - "integrity": "sha512-1MOpMXuhGzGL5TTCZFItxCc0AARf1EZFQkGqMm7ERKj8+Hgr5oLvJOVFcC+lRmR8hCe2S3jC4T5D7Vg/d7/fhA==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "dev": true, - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/totalist": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", - "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/vite": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.1.tgz", - "integrity": "sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==", - "dev": true, - "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.4", - "picomatch": "^4.0.2", - "postcss": "^8.5.3", - "rollup": "^4.34.9", - "tinyglobby": "^0.2.13" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "jiti": ">=1.21.0", - "less": "*", - "lightningcss": "^1.21.0", - "sass": "*", - "sass-embedded": "*", - "stylus": "*", - "sugarss": "*", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vitefu": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.1.2.tgz", - "integrity": "sha512-zpKATdUbzbsycPFBN71nS2uzBUQiVnFoOrr2rvqv34S1lcAgMKKkjWleLGeiJlZ8lwCXvtWaRn7R3ZC16SYRuw==", - "dev": true, - "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-beta.0" - }, - "peerDependenciesMeta": { - "vite": { - "optional": true - } - } - }, - "node_modules/zimmerframe": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/zimmerframe/-/zimmerframe-1.1.4.tgz", - "integrity": "sha512-B58NGBEoc8Y9MWWCQGl/gq9xBCe4IiKM0a2x7GZdQKOW5Exr8S1W24J6OgM1njK8xCRGvAJIL/MxXHf6SkmQKQ==", - "dev": true - } - } -} diff --git a/web/node_modules/@esbuild/win32-x64/README.md b/web/node_modules/@esbuild/win32-x64/README.md deleted file mode 100644 index a99ee7c..0000000 --- a/web/node_modules/@esbuild/win32-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# esbuild - -This is the Windows 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/web/node_modules/@esbuild/win32-x64/esbuild.exe b/web/node_modules/@esbuild/win32-x64/esbuild.exe deleted file mode 100644 index afe1502..0000000 Binary files a/web/node_modules/@esbuild/win32-x64/esbuild.exe and /dev/null differ diff --git a/web/node_modules/@esbuild/win32-x64/package.json b/web/node_modules/@esbuild/win32-x64/package.json deleted file mode 100644 index 5b60c1d..0000000 --- a/web/node_modules/@esbuild/win32-x64/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@esbuild/win32-x64", - "version": "0.25.12", - "description": "The Windows 64-bit binary for esbuild, a JavaScript bundler.", - "repository": { - "type": "git", - "url": "git+https://github.com/evanw/esbuild.git" - }, - "license": "MIT", - "preferUnplugged": true, - "engines": { - "node": ">=18" - }, - "os": [ - "win32" - ], - "cpu": [ - "x64" - ] -} diff --git a/web/node_modules/@jridgewell/gen-mapping/LICENSE b/web/node_modules/@jridgewell/gen-mapping/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@jridgewell/gen-mapping/README.md b/web/node_modules/@jridgewell/gen-mapping/README.md deleted file mode 100644 index 93692b1..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# @jridgewell/gen-mapping - -> Generate source maps - -`gen-mapping` allows you to generate a source map during transpilation or minification. -With a source map, you're able to trace the original location in the source file, either in Chrome's -DevTools or using a library like [`@jridgewell/trace-mapping`][trace-mapping]. - -You may already be familiar with the [`source-map`][source-map] package's `SourceMapGenerator`. This -provides the same `addMapping` and `setSourceContent` API. - -## Installation - -```sh -npm install @jridgewell/gen-mapping -``` - -## Usage - -```typescript -import { GenMapping, addMapping, setSourceContent, toEncodedMap, toDecodedMap } from '@jridgewell/gen-mapping'; - -const map = new GenMapping({ - file: 'output.js', - sourceRoot: 'https://example.com/', -}); - -setSourceContent(map, 'input.js', `function foo() {}`); - -addMapping(map, { - // Lines start at line 1, columns at column 0. - generated: { line: 1, column: 0 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -addMapping(map, { - generated: { line: 1, column: 9 }, - source: 'input.js', - original: { line: 1, column: 9 }, - name: 'foo', -}); - -assert.deepEqual(toDecodedMap(map), { - version: 3, - file: 'output.js', - names: ['foo'], - sourceRoot: 'https://example.com/', - sources: ['input.js'], - sourcesContent: ['function foo() {}'], - mappings: [ - [ [0, 0, 0, 0], [9, 0, 0, 9, 0] ] - ], -}); - -assert.deepEqual(toEncodedMap(map), { - version: 3, - file: 'output.js', - names: ['foo'], - sourceRoot: 'https://example.com/', - sources: ['input.js'], - sourcesContent: ['function foo() {}'], - mappings: 'AAAA,SAASA', -}); -``` - -### Smaller Sourcemaps - -Not everything needs to be added to a sourcemap, and needless markings can cause signficantly -larger file sizes. `gen-mapping` exposes `maybeAddSegment`/`maybeAddMapping` APIs that will -intelligently determine if this marking adds useful information. If not, the marking will be -skipped. - -```typescript -import { maybeAddMapping } from '@jridgewell/gen-mapping'; - -const map = new GenMapping(); - -// Adding a sourceless marking at the beginning of a line isn't useful. -maybeAddMapping(map, { - generated: { line: 1, column: 0 }, -}); - -// Adding a new source marking is useful. -maybeAddMapping(map, { - generated: { line: 1, column: 0 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -// But adding another marking pointing to the exact same original location isn't, even if the -// generated column changed. -maybeAddMapping(map, { - generated: { line: 1, column: 9 }, - source: 'input.js', - original: { line: 1, column: 0 }, -}); - -assert.deepEqual(toEncodedMap(map), { - version: 3, - names: [], - sources: ['input.js'], - sourcesContent: [null], - mappings: 'AAAA', -}); -``` - -## Benchmarks - -``` -node v18.0.0 - -amp.js.map -Memory Usage: -gen-mapping: addSegment 5852872 bytes -gen-mapping: addMapping 7716042 bytes -source-map-js 6143250 bytes -source-map-0.6.1 6124102 bytes -source-map-0.8.0 6121173 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 441 ops/sec ±2.07% (90 runs sampled) -gen-mapping: addMapping x 350 ops/sec ±2.40% (86 runs sampled) -source-map-js: addMapping x 169 ops/sec ±2.42% (80 runs sampled) -source-map-0.6.1: addMapping x 167 ops/sec ±2.56% (80 runs sampled) -source-map-0.8.0: addMapping x 168 ops/sec ±2.52% (80 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 150,824,370 ops/sec ±0.07% (102 runs sampled) -gen-mapping: encoded output x 663 ops/sec ±0.22% (98 runs sampled) -source-map-js: encoded output x 197 ops/sec ±0.45% (84 runs sampled) -source-map-0.6.1: encoded output x 198 ops/sec ±0.33% (85 runs sampled) -source-map-0.8.0: encoded output x 197 ops/sec ±0.06% (93 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -babel.min.js.map -Memory Usage: -gen-mapping: addSegment 37578063 bytes -gen-mapping: addMapping 37212897 bytes -source-map-js 47638527 bytes -source-map-0.6.1 47690503 bytes -source-map-0.8.0 47470188 bytes -Smallest memory usage is gen-mapping: addMapping - -Adding speed: -gen-mapping: addSegment x 31.05 ops/sec ±8.31% (43 runs sampled) -gen-mapping: addMapping x 29.83 ops/sec ±7.36% (51 runs sampled) -source-map-js: addMapping x 20.73 ops/sec ±6.22% (38 runs sampled) -source-map-0.6.1: addMapping x 20.03 ops/sec ±10.51% (38 runs sampled) -source-map-0.8.0: addMapping x 19.30 ops/sec ±8.27% (37 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 381,379,234 ops/sec ±0.29% (96 runs sampled) -gen-mapping: encoded output x 95.15 ops/sec ±2.98% (72 runs sampled) -source-map-js: encoded output x 15.20 ops/sec ±7.41% (33 runs sampled) -source-map-0.6.1: encoded output x 16.36 ops/sec ±10.46% (31 runs sampled) -source-map-0.8.0: encoded output x 16.06 ops/sec ±6.45% (31 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -preact.js.map -Memory Usage: -gen-mapping: addSegment 416247 bytes -gen-mapping: addMapping 419824 bytes -source-map-js 1024619 bytes -source-map-0.6.1 1146004 bytes -source-map-0.8.0 1113250 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 13,755 ops/sec ±0.15% (98 runs sampled) -gen-mapping: addMapping x 13,013 ops/sec ±0.11% (101 runs sampled) -source-map-js: addMapping x 4,564 ops/sec ±0.21% (98 runs sampled) -source-map-0.6.1: addMapping x 4,562 ops/sec ±0.11% (99 runs sampled) -source-map-0.8.0: addMapping x 4,593 ops/sec ±0.11% (100 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 379,864,020 ops/sec ±0.23% (93 runs sampled) -gen-mapping: encoded output x 14,368 ops/sec ±4.07% (82 runs sampled) -source-map-js: encoded output x 5,261 ops/sec ±0.21% (99 runs sampled) -source-map-0.6.1: encoded output x 5,124 ops/sec ±0.58% (99 runs sampled) -source-map-0.8.0: encoded output x 5,434 ops/sec ±0.33% (96 runs sampled) -Fastest is gen-mapping: decoded output - - -*** - - -react.js.map -Memory Usage: -gen-mapping: addSegment 975096 bytes -gen-mapping: addMapping 1102981 bytes -source-map-js 2918836 bytes -source-map-0.6.1 2885435 bytes -source-map-0.8.0 2874336 bytes -Smallest memory usage is gen-mapping: addSegment - -Adding speed: -gen-mapping: addSegment x 4,772 ops/sec ±0.15% (100 runs sampled) -gen-mapping: addMapping x 4,456 ops/sec ±0.13% (97 runs sampled) -source-map-js: addMapping x 1,618 ops/sec ±0.24% (97 runs sampled) -source-map-0.6.1: addMapping x 1,622 ops/sec ±0.12% (99 runs sampled) -source-map-0.8.0: addMapping x 1,631 ops/sec ±0.12% (100 runs sampled) -Fastest is gen-mapping: addSegment - -Generate speed: -gen-mapping: decoded output x 379,107,695 ops/sec ±0.07% (99 runs sampled) -gen-mapping: encoded output x 5,421 ops/sec ±1.60% (89 runs sampled) -source-map-js: encoded output x 2,113 ops/sec ±1.81% (98 runs sampled) -source-map-0.6.1: encoded output x 2,126 ops/sec ±0.10% (100 runs sampled) -source-map-0.8.0: encoded output x 2,176 ops/sec ±0.39% (98 runs sampled) -Fastest is gen-mapping: decoded output -``` - -[source-map]: https://www.npmjs.com/package/source-map -[trace-mapping]: https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs b/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs deleted file mode 100644 index bbb0cac..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs +++ /dev/null @@ -1,292 +0,0 @@ -// src/set-array.ts -var SetArray = class { - constructor() { - this._indexes = { __proto__: null }; - this.array = []; - } -}; -function cast(set) { - return set; -} -function get(setarr, key) { - return cast(setarr)._indexes[key]; -} -function put(setarr, key) { - const index = get(setarr, key); - if (index !== void 0) return index; - const { array, _indexes: indexes } = cast(setarr); - const length = array.push(key); - return indexes[key] = length - 1; -} -function remove(setarr, key) { - const index = get(setarr, key); - if (index === void 0) return; - const { array, _indexes: indexes } = cast(setarr); - for (let i = index + 1; i < array.length; i++) { - const k = array[i]; - array[i - 1] = k; - indexes[k]--; - } - indexes[key] = void 0; - array.pop(); -} - -// src/gen-mapping.ts -import { - encode -} from "@jridgewell/sourcemap-codec"; -import { TraceMap, decodedMappings } from "@jridgewell/trace-mapping"; - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; - -// src/gen-mapping.ts -var NO_NAME = -1; -var GenMapping = class { - constructor({ file, sourceRoot } = {}) { - this._names = new SetArray(); - this._sources = new SetArray(); - this._sourcesContent = []; - this._mappings = []; - this.file = file; - this.sourceRoot = sourceRoot; - this._ignoreList = new SetArray(); - } -}; -function cast2(map) { - return map; -} -function addSegment(map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { - return addSegmentInternal( - false, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content - ); -} -function addMapping(map, mapping) { - return addMappingInternal(false, map, mapping); -} -var maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal( - true, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content - ); -}; -var maybeAddMapping = (map, mapping) => { - return addMappingInternal(true, map, mapping); -}; -function setSourceContent(map, source, content) { - const { - _sources: sources, - _sourcesContent: sourcesContent - // _originalScopes: originalScopes, - } = cast2(map); - const index = put(sources, source); - sourcesContent[index] = content; -} -function setIgnore(map, source, ignore = true) { - const { - _sources: sources, - _sourcesContent: sourcesContent, - _ignoreList: ignoreList - // _originalScopes: originalScopes, - } = cast2(map); - const index = put(sources, source); - if (index === sourcesContent.length) sourcesContent[index] = null; - if (ignore) put(ignoreList, index); - else remove(ignoreList, index); -} -function toDecodedMap(map) { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names, - _ignoreList: ignoreList - // _originalScopes: originalScopes, - // _generatedRanges: generatedRanges, - } = cast2(map); - removeEmptyFinalLines(mappings); - return { - version: 3, - file: map.file || void 0, - names: names.array, - sourceRoot: map.sourceRoot || void 0, - sources: sources.array, - sourcesContent, - mappings, - // originalScopes, - // generatedRanges, - ignoreList: ignoreList.array - }; -} -function toEncodedMap(map) { - const decoded = toDecodedMap(map); - return Object.assign({}, decoded, { - // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)), - // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]), - mappings: encode(decoded.mappings) - }); -} -function fromMap(input) { - const map = new TraceMap(input); - const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); - putAll(cast2(gen)._names, map.names); - putAll(cast2(gen)._sources, map.sources); - cast2(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null); - cast2(gen)._mappings = decodedMappings(map); - if (map.ignoreList) putAll(cast2(gen)._ignoreList, map.ignoreList); - return gen; -} -function allMappings(map) { - const out = []; - const { _mappings: mappings, _sources: sources, _names: names } = cast2(map); - for (let i = 0; i < mappings.length; i++) { - const line = mappings[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generated = { line: i + 1, column: seg[COLUMN] }; - let source = void 0; - let original = void 0; - let name = void 0; - if (seg.length !== 1) { - source = sources.array[seg[SOURCES_INDEX]]; - original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; - if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; - } - out.push({ generated, source, original, name }); - } - } - return out; -} -function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names - // _originalScopes: originalScopes, - } = cast2(map); - const line = getIndex(mappings, genLine); - const index = getColumnIndex(line, genColumn); - if (!source) { - if (skipable && skipSourceless(line, index)) return; - return insert(line, index, [genColumn]); - } - assert(sourceLine); - assert(sourceColumn); - const sourcesIndex = put(sources, source); - const namesIndex = name ? put(names, name) : NO_NAME; - if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null; - if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { - return; - } - return insert( - line, - index, - name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn] - ); -} -function assert(_val) { -} -function getIndex(arr, index) { - for (let i = arr.length; i <= index; i++) { - arr[i] = []; - } - return arr[index]; -} -function getColumnIndex(line, genColumn) { - let index = line.length; - for (let i = index - 1; i >= 0; index = i--) { - const current = line[i]; - if (genColumn >= current[COLUMN]) break; - } - return index; -} -function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} -function removeEmptyFinalLines(mappings) { - const { length } = mappings; - let len = length; - for (let i = len - 1; i >= 0; len = i, i--) { - if (mappings[i].length > 0) break; - } - if (len < length) mappings.length = len; -} -function putAll(setarr, array) { - for (let i = 0; i < array.length; i++) put(setarr, array[i]); -} -function skipSourceless(line, index) { - if (index === 0) return true; - const prev = line[index - 1]; - return prev.length === 1; -} -function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { - if (index === 0) return false; - const prev = line[index - 1]; - if (prev.length === 1) return false; - return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME); -} -function addMappingInternal(skipable, map, mapping) { - const { generated, source, original, name, content } = mapping; - if (!source) { - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - null, - null, - null, - null, - null - ); - } - assert(original); - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - source, - original.line - 1, - original.column, - name, - content - ); -} -export { - GenMapping, - addMapping, - addSegment, - allMappings, - fromMap, - maybeAddMapping, - maybeAddSegment, - setIgnore, - setSourceContent, - toDecodedMap, - toEncodedMap -}; -//# sourceMappingURL=gen-mapping.mjs.map diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map b/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map deleted file mode 100644 index 4e37e45..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/set-array.ts", "../src/gen-mapping.ts", "../src/sourcemap-segment.ts"], - "mappings": "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", - "names": ["cast"] -} diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js b/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js deleted file mode 100644 index cb84af5..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js +++ /dev/null @@ -1,358 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module, require('@jridgewell/sourcemap-codec'), require('@jridgewell/trace-mapping')); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module', '@jridgewell/sourcemap-codec', '@jridgewell/trace-mapping'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod, global.sourcemapCodec, global.traceMapping); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.genMapping = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module, require_sourcemapCodec, require_traceMapping) { -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// umd:@jridgewell/sourcemap-codec -var require_sourcemap_codec = __commonJS({ - "umd:@jridgewell/sourcemap-codec"(exports, module2) { - module2.exports = require_sourcemapCodec; - } -}); - -// umd:@jridgewell/trace-mapping -var require_trace_mapping = __commonJS({ - "umd:@jridgewell/trace-mapping"(exports, module2) { - module2.exports = require_traceMapping; - } -}); - -// src/gen-mapping.ts -var gen_mapping_exports = {}; -__export(gen_mapping_exports, { - GenMapping: () => GenMapping, - addMapping: () => addMapping, - addSegment: () => addSegment, - allMappings: () => allMappings, - fromMap: () => fromMap, - maybeAddMapping: () => maybeAddMapping, - maybeAddSegment: () => maybeAddSegment, - setIgnore: () => setIgnore, - setSourceContent: () => setSourceContent, - toDecodedMap: () => toDecodedMap, - toEncodedMap: () => toEncodedMap -}); -module.exports = __toCommonJS(gen_mapping_exports); - -// src/set-array.ts -var SetArray = class { - constructor() { - this._indexes = { __proto__: null }; - this.array = []; - } -}; -function cast(set) { - return set; -} -function get(setarr, key) { - return cast(setarr)._indexes[key]; -} -function put(setarr, key) { - const index = get(setarr, key); - if (index !== void 0) return index; - const { array, _indexes: indexes } = cast(setarr); - const length = array.push(key); - return indexes[key] = length - 1; -} -function remove(setarr, key) { - const index = get(setarr, key); - if (index === void 0) return; - const { array, _indexes: indexes } = cast(setarr); - for (let i = index + 1; i < array.length; i++) { - const k = array[i]; - array[i - 1] = k; - indexes[k]--; - } - indexes[key] = void 0; - array.pop(); -} - -// src/gen-mapping.ts -var import_sourcemap_codec = __toESM(require_sourcemap_codec()); -var import_trace_mapping = __toESM(require_trace_mapping()); - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; - -// src/gen-mapping.ts -var NO_NAME = -1; -var GenMapping = class { - constructor({ file, sourceRoot } = {}) { - this._names = new SetArray(); - this._sources = new SetArray(); - this._sourcesContent = []; - this._mappings = []; - this.file = file; - this.sourceRoot = sourceRoot; - this._ignoreList = new SetArray(); - } -}; -function cast2(map) { - return map; -} -function addSegment(map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { - return addSegmentInternal( - false, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content - ); -} -function addMapping(map, mapping) { - return addMappingInternal(false, map, mapping); -} -var maybeAddSegment = (map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) => { - return addSegmentInternal( - true, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content - ); -}; -var maybeAddMapping = (map, mapping) => { - return addMappingInternal(true, map, mapping); -}; -function setSourceContent(map, source, content) { - const { - _sources: sources, - _sourcesContent: sourcesContent - // _originalScopes: originalScopes, - } = cast2(map); - const index = put(sources, source); - sourcesContent[index] = content; -} -function setIgnore(map, source, ignore = true) { - const { - _sources: sources, - _sourcesContent: sourcesContent, - _ignoreList: ignoreList - // _originalScopes: originalScopes, - } = cast2(map); - const index = put(sources, source); - if (index === sourcesContent.length) sourcesContent[index] = null; - if (ignore) put(ignoreList, index); - else remove(ignoreList, index); -} -function toDecodedMap(map) { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names, - _ignoreList: ignoreList - // _originalScopes: originalScopes, - // _generatedRanges: generatedRanges, - } = cast2(map); - removeEmptyFinalLines(mappings); - return { - version: 3, - file: map.file || void 0, - names: names.array, - sourceRoot: map.sourceRoot || void 0, - sources: sources.array, - sourcesContent, - mappings, - // originalScopes, - // generatedRanges, - ignoreList: ignoreList.array - }; -} -function toEncodedMap(map) { - const decoded = toDecodedMap(map); - return Object.assign({}, decoded, { - // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)), - // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]), - mappings: (0, import_sourcemap_codec.encode)(decoded.mappings) - }); -} -function fromMap(input) { - const map = new import_trace_mapping.TraceMap(input); - const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); - putAll(cast2(gen)._names, map.names); - putAll(cast2(gen)._sources, map.sources); - cast2(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null); - cast2(gen)._mappings = (0, import_trace_mapping.decodedMappings)(map); - if (map.ignoreList) putAll(cast2(gen)._ignoreList, map.ignoreList); - return gen; -} -function allMappings(map) { - const out = []; - const { _mappings: mappings, _sources: sources, _names: names } = cast2(map); - for (let i = 0; i < mappings.length; i++) { - const line = mappings[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generated = { line: i + 1, column: seg[COLUMN] }; - let source = void 0; - let original = void 0; - let name = void 0; - if (seg.length !== 1) { - source = sources.array[seg[SOURCES_INDEX]]; - original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; - if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; - } - out.push({ generated, source, original, name }); - } - } - return out; -} -function addSegmentInternal(skipable, map, genLine, genColumn, source, sourceLine, sourceColumn, name, content) { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names - // _originalScopes: originalScopes, - } = cast2(map); - const line = getIndex(mappings, genLine); - const index = getColumnIndex(line, genColumn); - if (!source) { - if (skipable && skipSourceless(line, index)) return; - return insert(line, index, [genColumn]); - } - assert(sourceLine); - assert(sourceColumn); - const sourcesIndex = put(sources, source); - const namesIndex = name ? put(names, name) : NO_NAME; - if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content != null ? content : null; - if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { - return; - } - return insert( - line, - index, - name ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] : [genColumn, sourcesIndex, sourceLine, sourceColumn] - ); -} -function assert(_val) { -} -function getIndex(arr, index) { - for (let i = arr.length; i <= index; i++) { - arr[i] = []; - } - return arr[index]; -} -function getColumnIndex(line, genColumn) { - let index = line.length; - for (let i = index - 1; i >= 0; index = i--) { - const current = line[i]; - if (genColumn >= current[COLUMN]) break; - } - return index; -} -function insert(array, index, value) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} -function removeEmptyFinalLines(mappings) { - const { length } = mappings; - let len = length; - for (let i = len - 1; i >= 0; len = i, i--) { - if (mappings[i].length > 0) break; - } - if (len < length) mappings.length = len; -} -function putAll(setarr, array) { - for (let i = 0; i < array.length; i++) put(setarr, array[i]); -} -function skipSourceless(line, index) { - if (index === 0) return true; - const prev = line[index - 1]; - return prev.length === 1; -} -function skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex) { - if (index === 0) return false; - const prev = line[index - 1]; - if (prev.length === 1) return false; - return sourcesIndex === prev[SOURCES_INDEX] && sourceLine === prev[SOURCE_LINE] && sourceColumn === prev[SOURCE_COLUMN] && namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME); -} -function addMappingInternal(skipable, map, mapping) { - const { generated, source, original, name, content } = mapping; - if (!source) { - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - null, - null, - null, - null, - null - ); - } - assert(original); - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - source, - original.line - 1, - original.column, - name, - content - ); -} -})); -//# sourceMappingURL=gen-mapping.umd.js.map diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map b/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map deleted file mode 100644 index b13750b..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["umd:@jridgewell/sourcemap-codec", "umd:@jridgewell/trace-mapping", "../src/gen-mapping.ts", "../src/set-array.ts", "../src/sourcemap-segment.ts"], - "mappings": "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", - "names": ["module", "module", "cast"] -} diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts b/web/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts deleted file mode 100644 index 9ba936e..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/types/gen-mapping.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types'; -export type { DecodedSourceMap, EncodedSourceMap, Mapping }; -export type Options = { - file?: string | null; - sourceRoot?: string | null; -}; -/** - * Provides the state to generate a sourcemap. - */ -export declare class GenMapping { - private _names; - private _sources; - private _sourcesContent; - private _mappings; - private _ignoreList; - file: string | null | undefined; - sourceRoot: string | null | undefined; - constructor({ file, sourceRoot }?: Options); -} -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void; -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source?: null; - original?: null; - name?: null; - content?: null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name?: null; - content?: string | null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name: string; - content?: string | null; -}): void; -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -export declare const maybeAddSegment: typeof addSegment; -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -export declare const maybeAddMapping: typeof addMapping; -/** - * Adds/removes the content of the source file to the source map. - */ -export declare function setSourceContent(map: GenMapping, source: string, content: string | null): void; -export declare function setIgnore(map: GenMapping, source: string, ignore?: boolean): void; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toDecodedMap(map: GenMapping): DecodedSourceMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toEncodedMap(map: GenMapping): EncodedSourceMap; -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -export declare function fromMap(input: SourceMapInput): GenMapping; -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -export declare function allMappings(map: GenMapping): Mapping[]; diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts b/web/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts deleted file mode 100644 index 6ed4354..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/types/set-array.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -type Key = string | number | symbol; -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export declare class SetArray { - private _indexes; - array: readonly T[]; - constructor(); -} -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export declare function get(setarr: SetArray, key: T): number | undefined; -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export declare function put(setarr: SetArray, key: T): number; -/** - * Pops the last added item out of the SetArray. - */ -export declare function pop(setarr: SetArray): void; -/** - * Removes the key, if it exists in the set. - */ -export declare function remove(setarr: SetArray, key: T): void; -export {}; diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts b/web/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts deleted file mode 100644 index aa19fb5..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/types/sourcemap-segment.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; -export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export {}; diff --git a/web/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts b/web/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts deleted file mode 100644 index 8eb90fb..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/dist/types/types.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -export interface SourceMapV3 { - file?: string | null; - names: readonly string[]; - sourceRoot?: string; - sources: readonly (string | null)[]; - sourcesContent?: readonly (string | null)[]; - version: 3; - ignoreList?: readonly number[]; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: readonly SourceMapSegment[][]; -} -export interface Pos { - line: number; - column: number; -} -export interface OriginalPos extends Pos { - source: string; -} -export interface BindingExpressionRange { - start: Pos; - expression: string; -} -export type Mapping = { - generated: Pos; - source: undefined; - original: undefined; - name: undefined; -} | { - generated: Pos; - source: string; - original: Pos; - name: string; -} | { - generated: Pos; - source: string; - original: Pos; - name: undefined; -}; diff --git a/web/node_modules/@jridgewell/gen-mapping/package.json b/web/node_modules/@jridgewell/gen-mapping/package.json deleted file mode 100644 index 036f9b7..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@jridgewell/gen-mapping", - "version": "0.3.13", - "description": "Generate source maps", - "keywords": [ - "source", - "map" - ], - "main": "dist/gen-mapping.umd.js", - "module": "dist/gen-mapping.mjs", - "types": "types/gen-mapping.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/gen-mapping.d.mts", - "default": "./dist/gen-mapping.mjs" - }, - "default": { - "types": "./types/gen-mapping.d.cts", - "default": "./dist/gen-mapping.umd.js" - } - }, - "./dist/gen-mapping.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs gen-mapping.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/gen-mapping", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/gen-mapping" - }, - "author": "Justin Ridgewell ", - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0", - "@jridgewell/trace-mapping": "^0.3.24" - } -} diff --git a/web/node_modules/@jridgewell/gen-mapping/src/gen-mapping.ts b/web/node_modules/@jridgewell/gen-mapping/src/gen-mapping.ts deleted file mode 100644 index ecc878c..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/src/gen-mapping.ts +++ /dev/null @@ -1,614 +0,0 @@ -import { SetArray, put, remove } from './set-array'; -import { - encode, - // encodeGeneratedRanges, - // encodeOriginalScopes -} from '@jridgewell/sourcemap-codec'; -import { TraceMap, decodedMappings } from '@jridgewell/trace-mapping'; - -import { - COLUMN, - SOURCES_INDEX, - SOURCE_LINE, - SOURCE_COLUMN, - NAMES_INDEX, -} from './sourcemap-segment'; - -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -// import type { OriginalScope, GeneratedRange } from '@jridgewell/sourcemap-codec'; -import type { SourceMapSegment } from './sourcemap-segment'; -import type { - DecodedSourceMap, - EncodedSourceMap, - Pos, - Mapping, - // BindingExpressionRange, - // OriginalPos, - // OriginalScopeInfo, - // GeneratedRangeInfo, -} from './types'; - -export type { DecodedSourceMap, EncodedSourceMap, Mapping }; - -export type Options = { - file?: string | null; - sourceRoot?: string | null; -}; - -const NO_NAME = -1; - -/** - * Provides the state to generate a sourcemap. - */ -export class GenMapping { - declare private _names: SetArray; - declare private _sources: SetArray; - declare private _sourcesContent: (string | null)[]; - declare private _mappings: SourceMapSegment[][]; - // private declare _originalScopes: OriginalScope[][]; - // private declare _generatedRanges: GeneratedRange[]; - declare private _ignoreList: SetArray; - declare file: string | null | undefined; - declare sourceRoot: string | null | undefined; - - constructor({ file, sourceRoot }: Options = {}) { - this._names = new SetArray(); - this._sources = new SetArray(); - this._sourcesContent = []; - this._mappings = []; - // this._originalScopes = []; - // this._generatedRanges = []; - this.file = file; - this.sourceRoot = sourceRoot; - this._ignoreList = new SetArray(); - } -} - -interface PublicMap { - _names: GenMapping['_names']; - _sources: GenMapping['_sources']; - _sourcesContent: GenMapping['_sourcesContent']; - _mappings: GenMapping['_mappings']; - // _originalScopes: GenMapping['_originalScopes']; - // _generatedRanges: GenMapping['_generatedRanges']; - _ignoreList: GenMapping['_ignoreList']; -} - -/** - * Typescript doesn't allow friend access to private fields, so this just casts the map into a type - * with public access modifiers. - */ -function cast(map: unknown): PublicMap { - return map as any; -} - -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -export function addSegment( - map: GenMapping, - genLine: number, - genColumn: number, - source?: null, - sourceLine?: null, - sourceColumn?: null, - name?: null, - content?: null, -): void; -export function addSegment( - map: GenMapping, - genLine: number, - genColumn: number, - source: string, - sourceLine: number, - sourceColumn: number, - name?: null, - content?: string | null, -): void; -export function addSegment( - map: GenMapping, - genLine: number, - genColumn: number, - source: string, - sourceLine: number, - sourceColumn: number, - name: string, - content?: string | null, -): void; -export function addSegment( - map: GenMapping, - genLine: number, - genColumn: number, - source?: string | null, - sourceLine?: number | null, - sourceColumn?: number | null, - name?: string | null, - content?: string | null, -): void { - return addSegmentInternal( - false, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content, - ); -} - -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -export function addMapping( - map: GenMapping, - mapping: { - generated: Pos; - source?: null; - original?: null; - name?: null; - content?: null; - }, -): void; -export function addMapping( - map: GenMapping, - mapping: { - generated: Pos; - source: string; - original: Pos; - name?: null; - content?: string | null; - }, -): void; -export function addMapping( - map: GenMapping, - mapping: { - generated: Pos; - source: string; - original: Pos; - name: string; - content?: string | null; - }, -): void; -export function addMapping( - map: GenMapping, - mapping: { - generated: Pos; - source?: string | null; - original?: Pos | null; - name?: string | null; - content?: string | null; - }, -): void { - return addMappingInternal(false, map, mapping as Parameters[2]); -} - -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -export const maybeAddSegment: typeof addSegment = ( - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content, -) => { - return addSegmentInternal( - true, - map, - genLine, - genColumn, - source, - sourceLine, - sourceColumn, - name, - content, - ); -}; - -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -export const maybeAddMapping: typeof addMapping = (map, mapping) => { - return addMappingInternal(true, map, mapping as Parameters[2]); -}; - -/** - * Adds/removes the content of the source file to the source map. - */ -export function setSourceContent(map: GenMapping, source: string, content: string | null): void { - const { - _sources: sources, - _sourcesContent: sourcesContent, - // _originalScopes: originalScopes, - } = cast(map); - const index = put(sources, source); - sourcesContent[index] = content; - // if (index === originalScopes.length) originalScopes[index] = []; -} - -export function setIgnore(map: GenMapping, source: string, ignore = true) { - const { - _sources: sources, - _sourcesContent: sourcesContent, - _ignoreList: ignoreList, - // _originalScopes: originalScopes, - } = cast(map); - const index = put(sources, source); - if (index === sourcesContent.length) sourcesContent[index] = null; - // if (index === originalScopes.length) originalScopes[index] = []; - if (ignore) put(ignoreList, index); - else remove(ignoreList, index); -} - -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export function toDecodedMap(map: GenMapping): DecodedSourceMap { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names, - _ignoreList: ignoreList, - // _originalScopes: originalScopes, - // _generatedRanges: generatedRanges, - } = cast(map); - removeEmptyFinalLines(mappings); - - return { - version: 3, - file: map.file || undefined, - names: names.array, - sourceRoot: map.sourceRoot || undefined, - sources: sources.array, - sourcesContent, - mappings, - // originalScopes, - // generatedRanges, - ignoreList: ignoreList.array, - }; -} - -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export function toEncodedMap(map: GenMapping): EncodedSourceMap { - const decoded = toDecodedMap(map); - return Object.assign({}, decoded, { - // originalScopes: decoded.originalScopes.map((os) => encodeOriginalScopes(os)), - // generatedRanges: encodeGeneratedRanges(decoded.generatedRanges as GeneratedRange[]), - mappings: encode(decoded.mappings as SourceMapSegment[][]), - }); -} - -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -export function fromMap(input: SourceMapInput): GenMapping { - const map = new TraceMap(input); - const gen = new GenMapping({ file: map.file, sourceRoot: map.sourceRoot }); - - putAll(cast(gen)._names, map.names); - putAll(cast(gen)._sources, map.sources as string[]); - cast(gen)._sourcesContent = map.sourcesContent || map.sources.map(() => null); - cast(gen)._mappings = decodedMappings(map) as GenMapping['_mappings']; - // TODO: implement originalScopes/generatedRanges - if (map.ignoreList) putAll(cast(gen)._ignoreList, map.ignoreList); - - return gen; -} - -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -export function allMappings(map: GenMapping): Mapping[] { - const out: Mapping[] = []; - const { _mappings: mappings, _sources: sources, _names: names } = cast(map); - - for (let i = 0; i < mappings.length; i++) { - const line = mappings[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - - const generated = { line: i + 1, column: seg[COLUMN] }; - let source: string | undefined = undefined; - let original: Pos | undefined = undefined; - let name: string | undefined = undefined; - - if (seg.length !== 1) { - source = sources.array[seg[SOURCES_INDEX]]; - original = { line: seg[SOURCE_LINE] + 1, column: seg[SOURCE_COLUMN] }; - - if (seg.length === 5) name = names.array[seg[NAMES_INDEX]]; - } - - out.push({ generated, source, original, name } as Mapping); - } - } - - return out; -} - -// This split declaration is only so that terser can elminiate the static initialization block. -function addSegmentInternal( - skipable: boolean, - map: GenMapping, - genLine: number, - genColumn: number, - source: S, - sourceLine: S extends string ? number : null | undefined, - sourceColumn: S extends string ? number : null | undefined, - name: S extends string ? string | null | undefined : null | undefined, - content: S extends string ? string | null | undefined : null | undefined, -): void { - const { - _mappings: mappings, - _sources: sources, - _sourcesContent: sourcesContent, - _names: names, - // _originalScopes: originalScopes, - } = cast(map); - const line = getIndex(mappings, genLine); - const index = getColumnIndex(line, genColumn); - - if (!source) { - if (skipable && skipSourceless(line, index)) return; - return insert(line, index, [genColumn]); - } - - // Sigh, TypeScript can't figure out sourceLine and sourceColumn aren't nullish if source - // isn't nullish. - assert(sourceLine); - assert(sourceColumn); - - const sourcesIndex = put(sources, source); - const namesIndex = name ? put(names, name) : NO_NAME; - if (sourcesIndex === sourcesContent.length) sourcesContent[sourcesIndex] = content ?? null; - // if (sourcesIndex === originalScopes.length) originalScopes[sourcesIndex] = []; - - if (skipable && skipSource(line, index, sourcesIndex, sourceLine, sourceColumn, namesIndex)) { - return; - } - - return insert( - line, - index, - name - ? [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] - : [genColumn, sourcesIndex, sourceLine, sourceColumn], - ); -} - -function assert(_val: unknown): asserts _val is T { - // noop. -} - -function getIndex(arr: T[][], index: number): T[] { - for (let i = arr.length; i <= index; i++) { - arr[i] = []; - } - return arr[index]; -} - -function getColumnIndex(line: SourceMapSegment[], genColumn: number): number { - let index = line.length; - for (let i = index - 1; i >= 0; index = i--) { - const current = line[i]; - if (genColumn >= current[COLUMN]) break; - } - return index; -} - -function insert(array: T[], index: number, value: T) { - for (let i = array.length; i > index; i--) { - array[i] = array[i - 1]; - } - array[index] = value; -} - -function removeEmptyFinalLines(mappings: SourceMapSegment[][]) { - const { length } = mappings; - let len = length; - for (let i = len - 1; i >= 0; len = i, i--) { - if (mappings[i].length > 0) break; - } - if (len < length) mappings.length = len; -} - -function putAll(setarr: SetArray, array: T[]) { - for (let i = 0; i < array.length; i++) put(setarr, array[i]); -} - -function skipSourceless(line: SourceMapSegment[], index: number): boolean { - // The start of a line is already sourceless, so adding a sourceless segment to the beginning - // doesn't generate any useful information. - if (index === 0) return true; - - const prev = line[index - 1]; - // If the previous segment is also sourceless, then adding another sourceless segment doesn't - // genrate any new information. Else, this segment will end the source/named segment and point to - // a sourceless position, which is useful. - return prev.length === 1; -} - -function skipSource( - line: SourceMapSegment[], - index: number, - sourcesIndex: number, - sourceLine: number, - sourceColumn: number, - namesIndex: number, -): boolean { - // A source/named segment at the start of a line gives position at that genColumn - if (index === 0) return false; - - const prev = line[index - 1]; - - // If the previous segment is sourceless, then we're transitioning to a source. - if (prev.length === 1) return false; - - // If the previous segment maps to the exact same source position, then this segment doesn't - // provide any new position information. - return ( - sourcesIndex === prev[SOURCES_INDEX] && - sourceLine === prev[SOURCE_LINE] && - sourceColumn === prev[SOURCE_COLUMN] && - namesIndex === (prev.length === 5 ? prev[NAMES_INDEX] : NO_NAME) - ); -} - -function addMappingInternal( - skipable: boolean, - map: GenMapping, - mapping: { - generated: Pos; - source: S; - original: S extends string ? Pos : null | undefined; - name: S extends string ? string | null | undefined : null | undefined; - content: S extends string ? string | null | undefined : null | undefined; - }, -) { - const { generated, source, original, name, content } = mapping; - if (!source) { - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - null, - null, - null, - null, - null, - ); - } - assert(original); - return addSegmentInternal( - skipable, - map, - generated.line - 1, - generated.column, - source as string, - original.line - 1, - original.column, - name, - content, - ); -} - -/* -export function addOriginalScope( - map: GenMapping, - data: { - start: Pos; - end: Pos; - source: string; - kind: string; - name?: string; - variables?: string[]; - }, -): OriginalScopeInfo { - const { start, end, source, kind, name, variables } = data; - const { - _sources: sources, - _sourcesContent: sourcesContent, - _originalScopes: originalScopes, - _names: names, - } = cast(map); - const index = put(sources, source); - if (index === sourcesContent.length) sourcesContent[index] = null; - if (index === originalScopes.length) originalScopes[index] = []; - - const kindIndex = put(names, kind); - const scope: OriginalScope = name - ? [start.line - 1, start.column, end.line - 1, end.column, kindIndex, put(names, name)] - : [start.line - 1, start.column, end.line - 1, end.column, kindIndex]; - if (variables) { - scope.vars = variables.map((v) => put(names, v)); - } - const len = originalScopes[index].push(scope); - return [index, len - 1, variables]; -} -*/ - -// Generated Ranges -/* -export function addGeneratedRange( - map: GenMapping, - data: { - start: Pos; - isScope: boolean; - originalScope?: OriginalScopeInfo; - callsite?: OriginalPos; - }, -): GeneratedRangeInfo { - const { start, isScope, originalScope, callsite } = data; - const { - _originalScopes: originalScopes, - _sources: sources, - _sourcesContent: sourcesContent, - _generatedRanges: generatedRanges, - } = cast(map); - - const range: GeneratedRange = [ - start.line - 1, - start.column, - 0, - 0, - originalScope ? originalScope[0] : -1, - originalScope ? originalScope[1] : -1, - ]; - if (originalScope?.[2]) { - range.bindings = originalScope[2].map(() => [[-1]]); - } - if (callsite) { - const index = put(sources, callsite.source); - if (index === sourcesContent.length) sourcesContent[index] = null; - if (index === originalScopes.length) originalScopes[index] = []; - range.callsite = [index, callsite.line - 1, callsite.column]; - } - if (isScope) range.isScope = true; - generatedRanges.push(range); - - return [range, originalScope?.[2]]; -} - -export function setEndPosition(range: GeneratedRangeInfo, pos: Pos) { - range[0][2] = pos.line - 1; - range[0][3] = pos.column; -} - -export function addBinding( - map: GenMapping, - range: GeneratedRangeInfo, - variable: string, - expression: string | BindingExpressionRange, -) { - const { _names: names } = cast(map); - const bindings = (range[0].bindings ||= []); - const vars = range[1]; - - const index = vars!.indexOf(variable); - const binding = getIndex(bindings, index); - - if (typeof expression === 'string') binding[0] = [put(names, expression)]; - else { - const { start } = expression; - binding.push([put(names, expression.expression), start.line - 1, start.column]); - } -} -*/ diff --git a/web/node_modules/@jridgewell/gen-mapping/src/set-array.ts b/web/node_modules/@jridgewell/gen-mapping/src/set-array.ts deleted file mode 100644 index a2a73a5..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/src/set-array.ts +++ /dev/null @@ -1,82 +0,0 @@ -type Key = string | number | symbol; - -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export class SetArray { - declare private _indexes: Record; - declare array: readonly T[]; - - constructor() { - this._indexes = { __proto__: null } as any; - this.array = []; - } -} - -interface PublicSet { - array: T[]; - _indexes: SetArray['_indexes']; -} - -/** - * Typescript doesn't allow friend access to private fields, so this just casts the set into a type - * with public access modifiers. - */ -function cast(set: SetArray): PublicSet { - return set as any; -} - -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export function get(setarr: SetArray, key: T): number | undefined { - return cast(setarr)._indexes[key]; -} - -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export function put(setarr: SetArray, key: T): number { - // The key may or may not be present. If it is present, it's a number. - const index = get(setarr, key); - if (index !== undefined) return index; - - const { array, _indexes: indexes } = cast(setarr); - - const length = array.push(key); - return (indexes[key] = length - 1); -} - -/** - * Pops the last added item out of the SetArray. - */ -export function pop(setarr: SetArray): void { - const { array, _indexes: indexes } = cast(setarr); - if (array.length === 0) return; - - const last = array.pop()!; - indexes[last] = undefined; -} - -/** - * Removes the key, if it exists in the set. - */ -export function remove(setarr: SetArray, key: T): void { - const index = get(setarr, key); - if (index === undefined) return; - - const { array, _indexes: indexes } = cast(setarr); - for (let i = index + 1; i < array.length; i++) { - const k = array[i]; - array[i - 1] = k; - indexes[k]!--; - } - indexes[key] = undefined; - array.pop(); -} diff --git a/web/node_modules/@jridgewell/gen-mapping/src/sourcemap-segment.ts b/web/node_modules/@jridgewell/gen-mapping/src/sourcemap-segment.ts deleted file mode 100644 index fb296dd..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/src/sourcemap-segment.ts +++ /dev/null @@ -1,16 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; - -export type SourceMapSegment = - | [GeneratedColumn] - | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] - | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; - -export const COLUMN = 0; -export const SOURCES_INDEX = 1; -export const SOURCE_LINE = 2; -export const SOURCE_COLUMN = 3; -export const NAMES_INDEX = 4; diff --git a/web/node_modules/@jridgewell/gen-mapping/src/types.ts b/web/node_modules/@jridgewell/gen-mapping/src/types.ts deleted file mode 100644 index b087f70..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/src/types.ts +++ /dev/null @@ -1,61 +0,0 @@ -// import type { GeneratedRange, OriginalScope } from '@jridgewell/sourcemap-codec'; -import type { SourceMapSegment } from './sourcemap-segment'; - -export interface SourceMapV3 { - file?: string | null; - names: readonly string[]; - sourceRoot?: string; - sources: readonly (string | null)[]; - sourcesContent?: readonly (string | null)[]; - version: 3; - ignoreList?: readonly number[]; -} - -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; - // originalScopes: string[]; - // generatedRanges: string; -} - -export interface DecodedSourceMap extends SourceMapV3 { - mappings: readonly SourceMapSegment[][]; - // originalScopes: readonly OriginalScope[][]; - // generatedRanges: readonly GeneratedRange[]; -} - -export interface Pos { - line: number; // 1-based - column: number; // 0-based -} - -export interface OriginalPos extends Pos { - source: string; -} - -export interface BindingExpressionRange { - start: Pos; - expression: string; -} - -// export type OriginalScopeInfo = [number, number, string[] | undefined]; -// export type GeneratedRangeInfo = [GeneratedRange, string[] | undefined]; - -export type Mapping = - | { - generated: Pos; - source: undefined; - original: undefined; - name: undefined; - } - | { - generated: Pos; - source: string; - original: Pos; - name: string; - } - | { - generated: Pos; - source: string; - original: Pos; - name: undefined; - }; diff --git a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts b/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts deleted file mode 100644 index 7618d85..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts +++ /dev/null @@ -1,89 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types.cts'; -export type { DecodedSourceMap, EncodedSourceMap, Mapping }; -export type Options = { - file?: string | null; - sourceRoot?: string | null; -}; -/** - * Provides the state to generate a sourcemap. - */ -export declare class GenMapping { - private _names; - private _sources; - private _sourcesContent; - private _mappings; - private _ignoreList; - file: string | null | undefined; - sourceRoot: string | null | undefined; - constructor({ file, sourceRoot }?: Options); -} -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void; -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source?: null; - original?: null; - name?: null; - content?: null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name?: null; - content?: string | null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name: string; - content?: string | null; -}): void; -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -export declare const maybeAddSegment: typeof addSegment; -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -export declare const maybeAddMapping: typeof addMapping; -/** - * Adds/removes the content of the source file to the source map. - */ -export declare function setSourceContent(map: GenMapping, source: string, content: string | null): void; -export declare function setIgnore(map: GenMapping, source: string, ignore?: boolean): void; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toDecodedMap(map: GenMapping): DecodedSourceMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toEncodedMap(map: GenMapping): EncodedSourceMap; -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -export declare function fromMap(input: SourceMapInput): GenMapping; -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -export declare function allMappings(map: GenMapping): Mapping[]; -//# sourceMappingURL=gen-mapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts.map b/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts.map deleted file mode 100644 index 8a2b183..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gen-mapping.d.ts","sourceRoot":"","sources":["../src/gen-mapping.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts b/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts deleted file mode 100644 index bbc0d89..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts +++ /dev/null @@ -1,89 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Pos, Mapping } from './types.mts'; -export type { DecodedSourceMap, EncodedSourceMap, Mapping }; -export type Options = { - file?: string | null; - sourceRoot?: string | null; -}; -/** - * Provides the state to generate a sourcemap. - */ -export declare class GenMapping { - private _names; - private _sources; - private _sourcesContent; - private _mappings; - private _ignoreList; - file: string | null | undefined; - sourceRoot: string | null | undefined; - constructor({ file, sourceRoot }?: Options); -} -/** - * A low-level API to associate a generated position with an original source position. Line and - * column here are 0-based, unlike `addMapping`. - */ -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source?: null, sourceLine?: null, sourceColumn?: null, name?: null, content?: null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name?: null, content?: string | null): void; -export declare function addSegment(map: GenMapping, genLine: number, genColumn: number, source: string, sourceLine: number, sourceColumn: number, name: string, content?: string | null): void; -/** - * A high-level API to associate a generated position with an original source position. Line is - * 1-based, but column is 0-based, due to legacy behavior in `source-map` library. - */ -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source?: null; - original?: null; - name?: null; - content?: null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name?: null; - content?: string | null; -}): void; -export declare function addMapping(map: GenMapping, mapping: { - generated: Pos; - source: string; - original: Pos; - name: string; - content?: string | null; -}): void; -/** - * Same as `addSegment`, but will only add the segment if it generates useful information in the - * resulting map. This only works correctly if segments are added **in order**, meaning you should - * not add a segment with a lower generated line/column than one that came before. - */ -export declare const maybeAddSegment: typeof addSegment; -/** - * Same as `addMapping`, but will only add the mapping if it generates useful information in the - * resulting map. This only works correctly if mappings are added **in order**, meaning you should - * not add a mapping with a lower generated line/column than one that came before. - */ -export declare const maybeAddMapping: typeof addMapping; -/** - * Adds/removes the content of the source file to the source map. - */ -export declare function setSourceContent(map: GenMapping, source: string, content: string | null): void; -export declare function setIgnore(map: GenMapping, source: string, ignore?: boolean): void; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toDecodedMap(map: GenMapping): DecodedSourceMap; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function toEncodedMap(map: GenMapping): EncodedSourceMap; -/** - * Constructs a new GenMapping, using the already present mappings of the input. - */ -export declare function fromMap(input: SourceMapInput): GenMapping; -/** - * Returns an array of high-level mapping objects for every recorded segment, which could then be - * passed to the `source-map` library. - */ -export declare function allMappings(map: GenMapping): Mapping[]; -//# sourceMappingURL=gen-mapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts.map b/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts.map deleted file mode 100644 index 8a2b183..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/gen-mapping.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"gen-mapping.d.ts","sourceRoot":"","sources":["../src/gen-mapping.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts b/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts deleted file mode 100644 index 5d8cda3..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts +++ /dev/null @@ -1,33 +0,0 @@ -type Key = string | number | symbol; -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export declare class SetArray { - private _indexes; - array: readonly T[]; - constructor(); -} -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export declare function get(setarr: SetArray, key: T): number | undefined; -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export declare function put(setarr: SetArray, key: T): number; -/** - * Pops the last added item out of the SetArray. - */ -export declare function pop(setarr: SetArray): void; -/** - * Removes the key, if it exists in the set. - */ -export declare function remove(setarr: SetArray, key: T): void; -export {}; -//# sourceMappingURL=set-array.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts.map b/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts.map deleted file mode 100644 index c52b8bc..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-array.d.ts","sourceRoot":"","sources":["../src/set-array.ts"],"names":[],"mappings":"AAAA,KAAK,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG;IACvC,QAAgB,QAAQ,CAAgC;IAChD,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;;CAM7B;AAeD;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS,CAElF;AAED;;;GAGG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAStE;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAM5D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAYvE"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts b/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts deleted file mode 100644 index 5d8cda3..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts +++ /dev/null @@ -1,33 +0,0 @@ -type Key = string | number | symbol; -/** - * SetArray acts like a `Set` (allowing only one occurrence of a string `key`), but provides the - * index of the `key` in the backing array. - * - * This is designed to allow synchronizing a second array with the contents of the backing array, - * like how in a sourcemap `sourcesContent[i]` is the source content associated with `source[i]`, - * and there are never duplicates. - */ -export declare class SetArray { - private _indexes; - array: readonly T[]; - constructor(); -} -/** - * Gets the index associated with `key` in the backing array, if it is already present. - */ -export declare function get(setarr: SetArray, key: T): number | undefined; -/** - * Puts `key` into the backing array, if it is not already present. Returns - * the index of the `key` in the backing array. - */ -export declare function put(setarr: SetArray, key: T): number; -/** - * Pops the last added item out of the SetArray. - */ -export declare function pop(setarr: SetArray): void; -/** - * Removes the key, if it exists in the set. - */ -export declare function remove(setarr: SetArray, key: T): void; -export {}; -//# sourceMappingURL=set-array.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts.map b/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts.map deleted file mode 100644 index c52b8bc..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/set-array.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"set-array.d.ts","sourceRoot":"","sources":["../src/set-array.ts"],"names":[],"mappings":"AAAA,KAAK,GAAG,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,qBAAa,QAAQ,CAAC,CAAC,SAAS,GAAG,GAAG,GAAG;IACvC,QAAgB,QAAQ,CAAgC;IAChD,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;;CAM7B;AAeD;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,GAAG,SAAS,CAElF;AAED;;;GAGG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,CAStE;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,IAAI,CAM5D;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAYvE"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts b/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts deleted file mode 100644 index 6886295..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts +++ /dev/null @@ -1,13 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; -export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export {}; -//# sourceMappingURL=sourcemap-segment.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts.map b/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts.map deleted file mode 100644 index 23cdc45..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-segment.d.ts","sourceRoot":"","sources":["../src/sourcemap-segment.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC;AAC9B,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AACzB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACxB,CAAC,eAAe,CAAC,GACjB,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,GACzD,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts b/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts deleted file mode 100644 index 6886295..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts +++ /dev/null @@ -1,13 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; -export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export {}; -//# sourceMappingURL=sourcemap-segment.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts.map b/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts.map deleted file mode 100644 index 23cdc45..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/sourcemap-segment.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-segment.d.ts","sourceRoot":"","sources":["../src/sourcemap-segment.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC;AAC9B,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AACzB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACxB,CAAC,eAAe,CAAC,GACjB,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,GACzD,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts b/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts deleted file mode 100644 index 58da00a..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts +++ /dev/null @@ -1,44 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.cts'; -export interface SourceMapV3 { - file?: string | null; - names: readonly string[]; - sourceRoot?: string; - sources: readonly (string | null)[]; - sourcesContent?: readonly (string | null)[]; - version: 3; - ignoreList?: readonly number[]; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: readonly SourceMapSegment[][]; -} -export interface Pos { - line: number; - column: number; -} -export interface OriginalPos extends Pos { - source: string; -} -export interface BindingExpressionRange { - start: Pos; - expression: string; -} -export type Mapping = { - generated: Pos; - source: undefined; - original: undefined; - name: undefined; -} | { - generated: Pos; - source: string; - original: Pos; - name: string; -} | { - generated: Pos; - source: string; - original: Pos; - name: undefined; -}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts.map b/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts.map deleted file mode 100644 index 159e734..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/types.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,EAAE,MAAM,CAAC;CAGlB;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EAAE,CAAC;CAGzC;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,MAAM,MAAM,OAAO,GACf;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;CACjB,GACD;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts b/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts deleted file mode 100644 index e9837eb..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts +++ /dev/null @@ -1,44 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.mts'; -export interface SourceMapV3 { - file?: string | null; - names: readonly string[]; - sourceRoot?: string; - sources: readonly (string | null)[]; - sourcesContent?: readonly (string | null)[]; - version: 3; - ignoreList?: readonly number[]; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: readonly SourceMapSegment[][]; -} -export interface Pos { - line: number; - column: number; -} -export interface OriginalPos extends Pos { - source: string; -} -export interface BindingExpressionRange { - start: Pos; - expression: string; -} -export type Mapping = { - generated: Pos; - source: undefined; - original: undefined; - name: undefined; -} | { - generated: Pos; - source: string; - original: Pos; - name: string; -} | { - generated: Pos; - source: string; - original: Pos; - name: undefined; -}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts.map b/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts.map deleted file mode 100644 index 159e734..0000000 --- a/web/node_modules/@jridgewell/gen-mapping/types/types.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACpC,cAAc,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,EAAE,MAAM,CAAC;CAGlB;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,QAAQ,EAAE,SAAS,gBAAgB,EAAE,EAAE,CAAC;CAGzC;AAED,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAY,SAAQ,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,GAAG,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,MAAM,MAAM,OAAO,GACf;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,EAAE,SAAS,CAAC;CACjB,GACD;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,GACD;IACE,SAAS,EAAE,GAAG,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/LICENSE b/web/node_modules/@jridgewell/remapping/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/web/node_modules/@jridgewell/remapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@jridgewell/remapping/README.md b/web/node_modules/@jridgewell/remapping/README.md deleted file mode 100644 index 6d092d7..0000000 --- a/web/node_modules/@jridgewell/remapping/README.md +++ /dev/null @@ -1,218 +0,0 @@ -# @jridgewell/remapping - -> Remap sequential sourcemaps through transformations to point at the original source code - -Remapping allows you to take the sourcemaps generated through transforming your code and "remap" -them to the original source locations. Think "my minified code, transformed with babel and bundled -with webpack", all pointing to the correct location in your original source code. - -With remapping, none of your source code transformations need to be aware of the input's sourcemap, -they only need to generate an output sourcemap. This greatly simplifies building custom -transformations (think a find-and-replace). - -## Installation - -```sh -npm install @jridgewell/remapping -``` - -## Usage - -```typescript -function remapping( - map: SourceMap | SourceMap[], - loader: (file: string, ctx: LoaderContext) => (SourceMap | null | undefined), - options?: { excludeContent: boolean, decodedMappings: boolean } -): SourceMap; - -// LoaderContext gives the loader the importing sourcemap, tree depth, the ability to override the -// "source" location (where child sources are resolved relative to, or the location of original -// source), and the ability to override the "content" of an original source for inclusion in the -// output sourcemap. -type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; -} -``` - -`remapping` takes the final output sourcemap, and a `loader` function. For every source file pointer -in the sourcemap, the `loader` will be called with the resolved path. If the path itself represents -a transformed file (it has a sourcmap associated with it), then the `loader` should return that -sourcemap. If not, the path will be treated as an original, untransformed source code. - -```js -// Babel transformed "helloworld.js" into "transformed.js" -const transformedMap = JSON.stringify({ - file: 'transformed.js', - // 1st column of 2nd line of output file translates into the 1st source - // file, line 3, column 2 - mappings: ';CAEE', - sources: ['helloworld.js'], - version: 3, -}); - -// Uglify minified "transformed.js" into "transformed.min.js" -const minifiedTransformedMap = JSON.stringify({ - file: 'transformed.min.js', - // 0th column of 1st line of output file translates into the 1st source - // file, line 2, column 1. - mappings: 'AACC', - names: [], - sources: ['transformed.js'], - version: 3, -}); - -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - // The "transformed.js" file is an transformed file. - if (file === 'transformed.js') { - // The root importer is empty. - console.assert(ctx.importer === ''); - // The depth in the sourcemap tree we're currently loading. - // The root `minifiedTransformedMap` is depth 0, and its source children are depth 1, etc. - console.assert(ctx.depth === 1); - - return transformedMap; - } - - // Loader will be called to load transformedMap's source file pointers as well. - console.assert(file === 'helloworld.js'); - // `transformed.js`'s sourcemap points into `helloworld.js`. - console.assert(ctx.importer === 'transformed.js'); - // This is a source child of `transformed`, which is a source child of `minifiedTransformedMap`. - console.assert(ctx.depth === 2); - return null; - } -); - -console.log(remapped); -// { -// file: 'transpiled.min.js', -// mappings: 'AAEE', -// sources: ['helloworld.js'], -// version: 3, -// }; -``` - -In this example, `loader` will be called twice: - -1. `"transformed.js"`, the first source file pointer in the `minifiedTransformedMap`. We return the - associated sourcemap for it (its a transformed file, after all) so that sourcemap locations can - be traced through it into the source files it represents. -2. `"helloworld.js"`, our original, unmodified source code. This file does not have a sourcemap, so - we return `null`. - -The `remapped` sourcemap now points from `transformed.min.js` into locations in `helloworld.js`. If -you were to read the `mappings`, it says "0th column of the first line output line points to the 1st -column of the 2nd line of the file `helloworld.js`". - -### Multiple transformations of a file - -As a convenience, if you have multiple single-source transformations of a file, you may pass an -array of sourcemap files in the order of most-recent transformation sourcemap first. Note that this -changes the `importer` and `depth` of each call to our loader. So our above example could have been -written as: - -```js -const remapped = remapping( - [minifiedTransformedMap, transformedMap], - () => null -); - -console.log(remapped); -// { -// file: 'transpiled.min.js', -// mappings: 'AAEE', -// sources: ['helloworld.js'], -// version: 3, -// }; -``` - -### Advanced control of the loading graph - -#### `source` - -The `source` property can overridden to any value to change the location of the current load. Eg, -for an original source file, it allows us to change the location to the original source regardless -of what the sourcemap source entry says. And for transformed files, it allows us to change the -relative resolving location for child sources of the loaded sourcemap. - -```js -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - if (file === 'transformed.js') { - // We pretend the transformed.js file actually exists in the 'src/' directory. When the nested - // source files are loaded, they will now be relative to `src/`. - ctx.source = 'src/transformed.js'; - return transformedMap; - } - - console.assert(file === 'src/helloworld.js'); - // We could futher change the source of this original file, eg, to be inside a nested directory - // itself. This will be reflected in the remapped sourcemap. - ctx.source = 'src/nested/transformed.js'; - return null; - } -); - -console.log(remapped); -// { -// …, -// sources: ['src/nested/helloworld.js'], -// }; -``` - - -#### `content` - -The `content` property can be overridden when we encounter an original source file. Eg, this allows -you to manually provide the source content of the original file regardless of whether the -`sourcesContent` field is present in the parent sourcemap. It can also be set to `null` to remove -the source content. - -```js -const remapped = remapping( - minifiedTransformedMap, - (file, ctx) => { - - if (file === 'transformed.js') { - // transformedMap does not include a `sourcesContent` field, so usually the remapped sourcemap - // would not include any `sourcesContent` values. - return transformedMap; - } - - console.assert(file === 'helloworld.js'); - // We can read the file to provide the source content. - ctx.content = fs.readFileSync(file, 'utf8'); - return null; - } -); - -console.log(remapped); -// { -// …, -// sourcesContent: [ -// 'console.log("Hello world!")', -// ], -// }; -``` - -### Options - -#### excludeContent - -By default, `excludeContent` is `false`. Passing `{ excludeContent: true }` will exclude the -`sourcesContent` field from the returned sourcemap. This is mainly useful when you want to reduce -the size out the sourcemap. - -#### decodedMappings - -By default, `decodedMappings` is `false`. Passing `{ decodedMappings: true }` will leave the -`mappings` field in a [decoded state](https://github.com/rich-harris/sourcemap-codec) instead of -encoding into a VLQ string. diff --git a/web/node_modules/@jridgewell/remapping/dist/remapping.mjs b/web/node_modules/@jridgewell/remapping/dist/remapping.mjs deleted file mode 100644 index 8b7009c..0000000 --- a/web/node_modules/@jridgewell/remapping/dist/remapping.mjs +++ /dev/null @@ -1,144 +0,0 @@ -// src/build-source-map-tree.ts -import { TraceMap } from "@jridgewell/trace-mapping"; - -// src/source-map-tree.ts -import { GenMapping, maybeAddSegment, setIgnore, setSourceContent } from "@jridgewell/gen-mapping"; -import { traceSegment, decodedMappings } from "@jridgewell/trace-mapping"; -var SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false); -var EMPTY_SOURCES = []; -function SegmentObject(source, line, column, name, content, ignore) { - return { source, line, column, name, content, ignore }; -} -function Source(map, sources, source, content, ignore) { - return { - map, - sources, - source, - content, - ignore - }; -} -function MapSource(map, sources) { - return Source(map, sources, "", null, false); -} -function OriginalSource(source, content, ignore) { - return Source(null, EMPTY_SOURCES, source, content, ignore); -} -function traceMappings(tree) { - const gen = new GenMapping({ file: tree.map.file }); - const { sources: rootSources, map } = tree; - const rootNames = map.names; - const rootMappings = decodedMappings(map); - for (let i = 0; i < rootMappings.length; i++) { - const segments = rootMappings[i]; - for (let j = 0; j < segments.length; j++) { - const segment = segments[j]; - const genCol = segment[0]; - let traced = SOURCELESS_MAPPING; - if (segment.length !== 1) { - const source2 = rootSources[segment[1]]; - traced = originalPositionFor( - source2, - segment[2], - segment[3], - segment.length === 5 ? rootNames[segment[4]] : "" - ); - if (traced == null) continue; - } - const { column, line, name, content, source, ignore } = traced; - maybeAddSegment(gen, i, genCol, source, line, column, name); - if (source && content != null) setSourceContent(gen, source, content); - if (ignore) setIgnore(gen, source, true); - } - } - return gen; -} -function originalPositionFor(source, line, column, name) { - if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content, source.ignore); - } - const segment = traceSegment(source.map, line, column); - if (segment == null) return null; - if (segment.length === 1) return SOURCELESS_MAPPING; - return originalPositionFor( - source.sources[segment[1]], - segment[2], - segment[3], - segment.length === 5 ? source.map.names[segment[4]] : name - ); -} - -// src/build-source-map-tree.ts -function asArray(value) { - if (Array.isArray(value)) return value; - return [value]; -} -function buildSourceMapTree(input, loader) { - const maps = asArray(input).map((m) => new TraceMap(m, "")); - const map = maps.pop(); - for (let i = 0; i < maps.length; i++) { - if (maps[i].sources.length > 1) { - throw new Error( - `Transformation map ${i} must have exactly one source file. -Did you specify these with the most recent transformation maps first?` - ); - } - } - let tree = build(map, loader, "", 0); - for (let i = maps.length - 1; i >= 0; i--) { - tree = MapSource(maps[i], [tree]); - } - return tree; -} -function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent, ignoreList } = map; - const depth = importerDepth + 1; - const children = resolvedSources.map((sourceFile, i) => { - const ctx = { - importer, - depth, - source: sourceFile || "", - content: void 0, - ignore: void 0 - }; - const sourceMap = loader(ctx.source, ctx); - const { source, content, ignore } = ctx; - if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth); - const sourceContent = content !== void 0 ? content : sourcesContent ? sourcesContent[i] : null; - const ignored = ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i) : false; - return OriginalSource(source, sourceContent, ignored); - }); - return MapSource(map, children); -} - -// src/source-map.ts -import { toDecodedMap, toEncodedMap } from "@jridgewell/gen-mapping"; -var SourceMap = class { - constructor(map, options) { - const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map); - this.version = out.version; - this.file = out.file; - this.mappings = out.mappings; - this.names = out.names; - this.ignoreList = out.ignoreList; - this.sourceRoot = out.sourceRoot; - this.sources = out.sources; - if (!options.excludeContent) { - this.sourcesContent = out.sourcesContent; - } - } - toString() { - return JSON.stringify(this); - } -}; - -// src/remapping.ts -function remapping(input, loader, options) { - const opts = typeof options === "object" ? options : { excludeContent: !!options, decodedMappings: false }; - const tree = buildSourceMapTree(input, loader); - return new SourceMap(traceMappings(tree), opts); -} -export { - remapping as default -}; -//# sourceMappingURL=remapping.mjs.map diff --git a/web/node_modules/@jridgewell/remapping/dist/remapping.mjs.map b/web/node_modules/@jridgewell/remapping/dist/remapping.mjs.map deleted file mode 100644 index 66801e6..0000000 --- a/web/node_modules/@jridgewell/remapping/dist/remapping.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/build-source-map-tree.ts", "../src/source-map-tree.ts", "../src/source-map.ts", "../src/remapping.ts"], - "mappings": "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", - "names": ["source"] -} diff --git a/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js b/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js deleted file mode 100644 index 077eb4d..0000000 --- a/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js +++ /dev/null @@ -1,212 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module, require('@jridgewell/gen-mapping'), require('@jridgewell/trace-mapping')); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module', '@jridgewell/gen-mapping', '@jridgewell/trace-mapping'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod, global.genMapping, global.traceMapping); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.remapping = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module, require_genMapping, require_traceMapping) { -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// umd:@jridgewell/trace-mapping -var require_trace_mapping = __commonJS({ - "umd:@jridgewell/trace-mapping"(exports, module2) { - module2.exports = require_traceMapping; - } -}); - -// umd:@jridgewell/gen-mapping -var require_gen_mapping = __commonJS({ - "umd:@jridgewell/gen-mapping"(exports, module2) { - module2.exports = require_genMapping; - } -}); - -// src/remapping.ts -var remapping_exports = {}; -__export(remapping_exports, { - default: () => remapping -}); -module.exports = __toCommonJS(remapping_exports); - -// src/build-source-map-tree.ts -var import_trace_mapping2 = __toESM(require_trace_mapping()); - -// src/source-map-tree.ts -var import_gen_mapping = __toESM(require_gen_mapping()); -var import_trace_mapping = __toESM(require_trace_mapping()); -var SOURCELESS_MAPPING = /* @__PURE__ */ SegmentObject("", -1, -1, "", null, false); -var EMPTY_SOURCES = []; -function SegmentObject(source, line, column, name, content, ignore) { - return { source, line, column, name, content, ignore }; -} -function Source(map, sources, source, content, ignore) { - return { - map, - sources, - source, - content, - ignore - }; -} -function MapSource(map, sources) { - return Source(map, sources, "", null, false); -} -function OriginalSource(source, content, ignore) { - return Source(null, EMPTY_SOURCES, source, content, ignore); -} -function traceMappings(tree) { - const gen = new import_gen_mapping.GenMapping({ file: tree.map.file }); - const { sources: rootSources, map } = tree; - const rootNames = map.names; - const rootMappings = (0, import_trace_mapping.decodedMappings)(map); - for (let i = 0; i < rootMappings.length; i++) { - const segments = rootMappings[i]; - for (let j = 0; j < segments.length; j++) { - const segment = segments[j]; - const genCol = segment[0]; - let traced = SOURCELESS_MAPPING; - if (segment.length !== 1) { - const source2 = rootSources[segment[1]]; - traced = originalPositionFor( - source2, - segment[2], - segment[3], - segment.length === 5 ? rootNames[segment[4]] : "" - ); - if (traced == null) continue; - } - const { column, line, name, content, source, ignore } = traced; - (0, import_gen_mapping.maybeAddSegment)(gen, i, genCol, source, line, column, name); - if (source && content != null) (0, import_gen_mapping.setSourceContent)(gen, source, content); - if (ignore) (0, import_gen_mapping.setIgnore)(gen, source, true); - } - } - return gen; -} -function originalPositionFor(source, line, column, name) { - if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content, source.ignore); - } - const segment = (0, import_trace_mapping.traceSegment)(source.map, line, column); - if (segment == null) return null; - if (segment.length === 1) return SOURCELESS_MAPPING; - return originalPositionFor( - source.sources[segment[1]], - segment[2], - segment[3], - segment.length === 5 ? source.map.names[segment[4]] : name - ); -} - -// src/build-source-map-tree.ts -function asArray(value) { - if (Array.isArray(value)) return value; - return [value]; -} -function buildSourceMapTree(input, loader) { - const maps = asArray(input).map((m) => new import_trace_mapping2.TraceMap(m, "")); - const map = maps.pop(); - for (let i = 0; i < maps.length; i++) { - if (maps[i].sources.length > 1) { - throw new Error( - `Transformation map ${i} must have exactly one source file. -Did you specify these with the most recent transformation maps first?` - ); - } - } - let tree = build(map, loader, "", 0); - for (let i = maps.length - 1; i >= 0; i--) { - tree = MapSource(maps[i], [tree]); - } - return tree; -} -function build(map, loader, importer, importerDepth) { - const { resolvedSources, sourcesContent, ignoreList } = map; - const depth = importerDepth + 1; - const children = resolvedSources.map((sourceFile, i) => { - const ctx = { - importer, - depth, - source: sourceFile || "", - content: void 0, - ignore: void 0 - }; - const sourceMap = loader(ctx.source, ctx); - const { source, content, ignore } = ctx; - if (sourceMap) return build(new import_trace_mapping2.TraceMap(sourceMap, source), loader, source, depth); - const sourceContent = content !== void 0 ? content : sourcesContent ? sourcesContent[i] : null; - const ignored = ignore !== void 0 ? ignore : ignoreList ? ignoreList.includes(i) : false; - return OriginalSource(source, sourceContent, ignored); - }); - return MapSource(map, children); -} - -// src/source-map.ts -var import_gen_mapping2 = __toESM(require_gen_mapping()); -var SourceMap = class { - constructor(map, options) { - const out = options.decodedMappings ? (0, import_gen_mapping2.toDecodedMap)(map) : (0, import_gen_mapping2.toEncodedMap)(map); - this.version = out.version; - this.file = out.file; - this.mappings = out.mappings; - this.names = out.names; - this.ignoreList = out.ignoreList; - this.sourceRoot = out.sourceRoot; - this.sources = out.sources; - if (!options.excludeContent) { - this.sourcesContent = out.sourcesContent; - } - } - toString() { - return JSON.stringify(this); - } -}; - -// src/remapping.ts -function remapping(input, loader, options) { - const opts = typeof options === "object" ? options : { excludeContent: !!options, decodedMappings: false }; - const tree = buildSourceMapTree(input, loader); - return new SourceMap(traceMappings(tree), opts); -} -})); -//# sourceMappingURL=remapping.umd.js.map diff --git a/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js.map b/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js.map deleted file mode 100644 index d5e0786..0000000 --- a/web/node_modules/@jridgewell/remapping/dist/remapping.umd.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["umd:@jridgewell/trace-mapping", "umd:@jridgewell/gen-mapping", "../src/remapping.ts", "../src/build-source-map-tree.ts", "../src/source-map-tree.ts", "../src/source-map.ts"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,2CAAAA,SAAA;AAAA,IAAAA,QAAO,UAAU;AAAA;AAAA;;;ACAjB;AAAA,yCAAAC,SAAA;AAAA,IAAAA,QAAO,UAAU;AAAA;AAAA;;;ACAjB;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAC,wBAAyB;;;ACAzB,yBAAyE;AACzE,2BAA8C;AA+B9C,IAAM,qBAAqC,8BAAc,IAAI,IAAI,IAAI,IAAI,MAAM,KAAK;AACpF,IAAM,gBAA2B,CAAC;AAElC,SAAS,cACP,QACA,MACA,QACA,MACA,SACA,QACwB;AACxB,SAAO,EAAE,QAAQ,MAAM,QAAQ,MAAM,SAAS,OAAO;AACvD;AAgBA,SAAS,OACP,KACA,SACA,QACA,SACA,QACS;AACT,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAMO,SAAS,UAAU,KAAe,SAA+B;AACtE,SAAO,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK;AAC7C;AAMO,SAAS,eACd,QACA,SACA,QACgB;AAChB,SAAO,OAAO,MAAM,eAAe,QAAQ,SAAS,MAAM;AAC5D;AAMO,SAAS,cAAc,MAA6B;AAGzD,QAAM,MAAM,IAAI,8BAAW,EAAE,MAAM,KAAK,IAAI,KAAK,CAAC;AAClD,QAAM,EAAE,SAAS,aAAa,IAAI,IAAI;AACtC,QAAM,YAAY,IAAI;AACtB,QAAM,mBAAe,sCAAgB,GAAG;AAExC,WAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;AAC5C,UAAM,WAAW,aAAa,CAAC;AAE/B,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACxC,YAAM,UAAU,SAAS,CAAC;AAC1B,YAAM,SAAS,QAAQ,CAAC;AACxB,UAAI,SAAwC;AAI5C,UAAI,QAAQ,WAAW,GAAG;AACxB,cAAMC,UAAS,YAAY,QAAQ,CAAC,CAAC;AACrC,iBAAS;AAAA,UACPA;AAAA,UACA,QAAQ,CAAC;AAAA,UACT,QAAQ,CAAC;AAAA,UACT,QAAQ,WAAW,IAAI,UAAU,QAAQ,CAAC,CAAC,IAAI;AAAA,QACjD;AAIA,YAAI,UAAU,KAAM;AAAA,MACtB;AAEA,YAAM,EAAE,QAAQ,MAAM,MAAM,SAAS,QAAQ,OAAO,IAAI;AAExD,8CAAgB,KAAK,GAAG,QAAQ,QAAQ,MAAM,QAAQ,IAAI;AAC1D,UAAI,UAAU,WAAW,KAAM,0CAAiB,KAAK,QAAQ,OAAO;AACpE,UAAI,OAAQ,mCAAU,KAAK,QAAQ,IAAI;AAAA,IACzC;AAAA,EACF;AAEA,SAAO;AACT;AAMO,SAAS,oBACd,QACA,MACA,QACA,MAC+B;AAC/B,MAAI,CAAC,OAAO,KAAK;AACf,WAAO,cAAc,OAAO,QAAQ,MAAM,QAAQ,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACvF;AAEA,QAAM,cAAU,mCAAa,OAAO,KAAK,MAAM,MAAM;AAGrD,MAAI,WAAW,KAAM,QAAO;AAG5B,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SAAO;AAAA,IACL,OAAO,QAAQ,QAAQ,CAAC,CAAC;AAAA,IACzB,QAAQ,CAAC;AAAA,IACT,QAAQ,CAAC;AAAA,IACT,QAAQ,WAAW,IAAI,OAAO,IAAI,MAAM,QAAQ,CAAC,CAAC,IAAI;AAAA,EACxD;AACF;;;ADpKA,SAAS,QAAW,OAAqB;AACvC,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO;AACjC,SAAO,CAAC,KAAK;AACf;AAae,SAAR,mBACL,OACA,QACe;AACf,QAAM,OAAO,QAAQ,KAAK,EAAE,IAAI,CAAC,MAAM,IAAI,+BAAS,GAAG,EAAE,CAAC;AAC1D,QAAM,MAAM,KAAK,IAAI;AAErB,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,QAAI,KAAK,CAAC,EAAE,QAAQ,SAAS,GAAG;AAC9B,YAAM,IAAI;AAAA,QACR,sBAAsB,CAAC;AAAA;AAAA,MAEzB;AAAA,IACF;AAAA,EACF;AAEA,MAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC;AACnC,WAAS,IAAI,KAAK,SAAS,GAAG,KAAK,GAAG,KAAK;AACzC,WAAO,UAAU,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;AAAA,EAClC;AACA,SAAO;AACT;AAEA,SAAS,MACP,KACA,QACA,UACA,eACe;AACf,QAAM,EAAE,iBAAiB,gBAAgB,WAAW,IAAI;AAExD,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,WAAW,gBAAgB,IAAI,CAAC,YAA2B,MAAuB;AAKtF,UAAM,MAAqB;AAAA,MACzB;AAAA,MACA;AAAA,MACA,QAAQ,cAAc;AAAA,MACtB,SAAS;AAAA,MACT,QAAQ;AAAA,IACV;AAIA,UAAM,YAAY,OAAO,IAAI,QAAQ,GAAG;AAExC,UAAM,EAAE,QAAQ,SAAS,OAAO,IAAI;AAGpC,QAAI,UAAW,QAAO,MAAM,IAAI,+BAAS,WAAW,MAAM,GAAG,QAAQ,QAAQ,KAAK;AAMlF,UAAM,gBACJ,YAAY,SAAY,UAAU,iBAAiB,eAAe,CAAC,IAAI;AACzE,UAAM,UAAU,WAAW,SAAY,SAAS,aAAa,WAAW,SAAS,CAAC,IAAI;AACtF,WAAO,eAAe,QAAQ,eAAe,OAAO;AAAA,EACtD,CAAC;AAED,SAAO,UAAU,KAAK,QAAQ;AAChC;;;AExFA,IAAAC,sBAA2C;AAS3C,IAAqB,YAArB,MAA+B;AAAA,EAU7B,YAAY,KAAiB,SAAkB;AAC7C,UAAM,MAAM,QAAQ,sBAAkB,kCAAa,GAAG,QAAI,kCAAa,GAAG;AAC1E,SAAK,UAAU,IAAI;AACnB,SAAK,OAAO,IAAI;AAChB,SAAK,WAAW,IAAI;AACpB,SAAK,QAAQ,IAAI;AACjB,SAAK,aAAa,IAAI;AACtB,SAAK,aAAa,IAAI;AAEtB,SAAK,UAAU,IAAI;AACnB,QAAI,CAAC,QAAQ,gBAAgB;AAC3B,WAAK,iBAAiB,IAAI;AAAA,IAC5B;AAAA,EACF;AAAA,EAEA,WAAmB;AACjB,WAAO,KAAK,UAAU,IAAI;AAAA,EAC5B;AACF;;;AHLe,SAAR,UACL,OACA,QACA,SACW;AACX,QAAM,OACJ,OAAO,YAAY,WAAW,UAAU,EAAE,gBAAgB,CAAC,CAAC,SAAS,iBAAiB,MAAM;AAC9F,QAAM,OAAO,mBAAmB,OAAO,MAAM;AAC7C,SAAO,IAAI,UAAU,cAAc,IAAI,GAAG,IAAI;AAChD;", - "names": ["module", "module", "import_trace_mapping", "source", "import_gen_mapping"] -} diff --git a/web/node_modules/@jridgewell/remapping/package.json b/web/node_modules/@jridgewell/remapping/package.json deleted file mode 100644 index ed00441..0000000 --- a/web/node_modules/@jridgewell/remapping/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@jridgewell/remapping", - "version": "2.3.5", - "description": "Remap sequential sourcemaps through transformations to point at the original source code", - "keywords": [ - "source", - "map", - "remap" - ], - "main": "dist/remapping.umd.js", - "module": "dist/remapping.mjs", - "types": "types/remapping.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/remapping.d.mts", - "default": "./dist/remapping.mjs" - }, - "default": { - "types": "./types/remapping.d.cts", - "default": "./dist/remapping.umd.js" - } - }, - "./dist/remapping.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs remapping.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/remapping", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/remapping" - }, - "author": "Justin Ridgewell ", - "license": "MIT", - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "devDependencies": { - "source-map": "0.6.1" - } -} diff --git a/web/node_modules/@jridgewell/remapping/src/build-source-map-tree.ts b/web/node_modules/@jridgewell/remapping/src/build-source-map-tree.ts deleted file mode 100644 index 3e0262b..0000000 --- a/web/node_modules/@jridgewell/remapping/src/build-source-map-tree.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { TraceMap } from '@jridgewell/trace-mapping'; - -import { OriginalSource, MapSource } from './source-map-tree'; - -import type { Sources, MapSource as MapSourceType } from './source-map-tree'; -import type { SourceMapInput, SourceMapLoader, LoaderContext } from './types'; - -function asArray(value: T | T[]): T[] { - if (Array.isArray(value)) return value; - return [value]; -} - -/** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ -export default function buildSourceMapTree( - input: SourceMapInput | SourceMapInput[], - loader: SourceMapLoader, -): MapSourceType { - const maps = asArray(input).map((m) => new TraceMap(m, '')); - const map = maps.pop()!; - - for (let i = 0; i < maps.length; i++) { - if (maps[i].sources.length > 1) { - throw new Error( - `Transformation map ${i} must have exactly one source file.\n` + - 'Did you specify these with the most recent transformation maps first?', - ); - } - } - - let tree = build(map, loader, '', 0); - for (let i = maps.length - 1; i >= 0; i--) { - tree = MapSource(maps[i], [tree]); - } - return tree; -} - -function build( - map: TraceMap, - loader: SourceMapLoader, - importer: string, - importerDepth: number, -): MapSourceType { - const { resolvedSources, sourcesContent, ignoreList } = map; - - const depth = importerDepth + 1; - const children = resolvedSources.map((sourceFile: string | null, i: number): Sources => { - // The loading context gives the loader more information about why this file is being loaded - // (eg, from which importer). It also allows the loader to override the location of the loaded - // sourcemap/original source, or to override the content in the sourcesContent field if it's - // an unmodified source file. - const ctx: LoaderContext = { - importer, - depth, - source: sourceFile || '', - content: undefined, - ignore: undefined, - }; - - // Use the provided loader callback to retrieve the file's sourcemap. - // TODO: We should eventually support async loading of sourcemap files. - const sourceMap = loader(ctx.source, ctx); - - const { source, content, ignore } = ctx; - - // If there is a sourcemap, then we need to recurse into it to load its source files. - if (sourceMap) return build(new TraceMap(sourceMap, source), loader, source, depth); - - // Else, it's an unmodified source file. - // The contents of this unmodified source file can be overridden via the loader context, - // allowing it to be explicitly null or a string. If it remains undefined, we fall back to - // the importing sourcemap's `sourcesContent` field. - const sourceContent = - content !== undefined ? content : sourcesContent ? sourcesContent[i] : null; - const ignored = ignore !== undefined ? ignore : ignoreList ? ignoreList.includes(i) : false; - return OriginalSource(source, sourceContent, ignored); - }); - - return MapSource(map, children); -} diff --git a/web/node_modules/@jridgewell/remapping/src/remapping.ts b/web/node_modules/@jridgewell/remapping/src/remapping.ts deleted file mode 100644 index c0f8b0d..0000000 --- a/web/node_modules/@jridgewell/remapping/src/remapping.ts +++ /dev/null @@ -1,42 +0,0 @@ -import buildSourceMapTree from './build-source-map-tree'; -import { traceMappings } from './source-map-tree'; -import SourceMap from './source-map'; - -import type { SourceMapInput, SourceMapLoader, Options } from './types'; -export type { - SourceMapSegment, - EncodedSourceMap, - EncodedSourceMap as RawSourceMap, - DecodedSourceMap, - SourceMapInput, - SourceMapLoader, - LoaderContext, - Options, -} from './types'; -export type { SourceMap }; - -/** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ -export default function remapping( - input: SourceMapInput | SourceMapInput[], - loader: SourceMapLoader, - options?: boolean | Options, -): SourceMap { - const opts = - typeof options === 'object' ? options : { excludeContent: !!options, decodedMappings: false }; - const tree = buildSourceMapTree(input, loader); - return new SourceMap(traceMappings(tree), opts); -} diff --git a/web/node_modules/@jridgewell/remapping/src/source-map-tree.ts b/web/node_modules/@jridgewell/remapping/src/source-map-tree.ts deleted file mode 100644 index 935240f..0000000 --- a/web/node_modules/@jridgewell/remapping/src/source-map-tree.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { GenMapping, maybeAddSegment, setIgnore, setSourceContent } from '@jridgewell/gen-mapping'; -import { traceSegment, decodedMappings } from '@jridgewell/trace-mapping'; - -import type { TraceMap } from '@jridgewell/trace-mapping'; - -export type SourceMapSegmentObject = { - column: number; - line: number; - name: string; - source: string; - content: string | null; - ignore: boolean; -}; - -export type OriginalSource = { - map: null; - sources: Sources[]; - source: string; - content: string | null; - ignore: boolean; -}; - -export type MapSource = { - map: TraceMap; - sources: Sources[]; - source: string; - content: null; - ignore: false; -}; - -export type Sources = OriginalSource | MapSource; - -const SOURCELESS_MAPPING = /* #__PURE__ */ SegmentObject('', -1, -1, '', null, false); -const EMPTY_SOURCES: Sources[] = []; - -function SegmentObject( - source: string, - line: number, - column: number, - name: string, - content: string | null, - ignore: boolean, -): SourceMapSegmentObject { - return { source, line, column, name, content, ignore }; -} - -function Source( - map: TraceMap, - sources: Sources[], - source: '', - content: null, - ignore: false, -): MapSource; -function Source( - map: null, - sources: Sources[], - source: string, - content: string | null, - ignore: boolean, -): OriginalSource; -function Source( - map: TraceMap | null, - sources: Sources[], - source: string | '', - content: string | null, - ignore: boolean, -): Sources { - return { - map, - sources, - source, - content, - ignore, - } as any; -} - -/** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ -export function MapSource(map: TraceMap, sources: Sources[]): MapSource { - return Source(map, sources, '', null, false); -} - -/** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ -export function OriginalSource( - source: string, - content: string | null, - ignore: boolean, -): OriginalSource { - return Source(null, EMPTY_SOURCES, source, content, ignore); -} - -/** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ -export function traceMappings(tree: MapSource): GenMapping { - // TODO: Eventually support sourceRoot, which has to be removed because the sources are already - // fully resolved. We'll need to make sources relative to the sourceRoot before adding them. - const gen = new GenMapping({ file: tree.map.file }); - const { sources: rootSources, map } = tree; - const rootNames = map.names; - const rootMappings = decodedMappings(map); - - for (let i = 0; i < rootMappings.length; i++) { - const segments = rootMappings[i]; - - for (let j = 0; j < segments.length; j++) { - const segment = segments[j]; - const genCol = segment[0]; - let traced: SourceMapSegmentObject | null = SOURCELESS_MAPPING; - - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length !== 1) { - const source = rootSources[segment[1]]; - traced = originalPositionFor( - source, - segment[2], - segment[3], - segment.length === 5 ? rootNames[segment[4]] : '', - ); - - // If the trace is invalid, then the trace ran into a sourcemap that doesn't contain a - // respective segment into an original source. - if (traced == null) continue; - } - - const { column, line, name, content, source, ignore } = traced; - - maybeAddSegment(gen, i, genCol, source, line, column, name); - if (source && content != null) setSourceContent(gen, source, content); - if (ignore) setIgnore(gen, source, true); - } - } - - return gen; -} - -/** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ -export function originalPositionFor( - source: Sources, - line: number, - column: number, - name: string, -): SourceMapSegmentObject | null { - if (!source.map) { - return SegmentObject(source.source, line, column, name, source.content, source.ignore); - } - - const segment = traceSegment(source.map, line, column); - - // If we couldn't find a segment, then this doesn't exist in the sourcemap. - if (segment == null) return null; - // 1-length segments only move the current generated column, there's no source information - // to gather from it. - if (segment.length === 1) return SOURCELESS_MAPPING; - - return originalPositionFor( - source.sources[segment[1]], - segment[2], - segment[3], - segment.length === 5 ? source.map.names[segment[4]] : name, - ); -} diff --git a/web/node_modules/@jridgewell/remapping/src/source-map.ts b/web/node_modules/@jridgewell/remapping/src/source-map.ts deleted file mode 100644 index 5156086..0000000 --- a/web/node_modules/@jridgewell/remapping/src/source-map.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { toDecodedMap, toEncodedMap } from '@jridgewell/gen-mapping'; - -import type { GenMapping } from '@jridgewell/gen-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Options } from './types'; - -/** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ -export default class SourceMap { - declare file?: string | null; - declare mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings']; - declare sourceRoot?: string; - declare names: string[]; - declare sources: (string | null)[]; - declare sourcesContent?: (string | null)[]; - declare version: 3; - declare ignoreList: number[] | undefined; - - constructor(map: GenMapping, options: Options) { - const out = options.decodedMappings ? toDecodedMap(map) : toEncodedMap(map); - this.version = out.version; // SourceMap spec says this should be first. - this.file = out.file; - this.mappings = out.mappings as SourceMap['mappings']; - this.names = out.names as SourceMap['names']; - this.ignoreList = out.ignoreList as SourceMap['ignoreList']; - this.sourceRoot = out.sourceRoot; - - this.sources = out.sources as SourceMap['sources']; - if (!options.excludeContent) { - this.sourcesContent = out.sourcesContent as SourceMap['sourcesContent']; - } - } - - toString(): string { - return JSON.stringify(this); - } -} diff --git a/web/node_modules/@jridgewell/remapping/src/types.ts b/web/node_modules/@jridgewell/remapping/src/types.ts deleted file mode 100644 index 384961d..0000000 --- a/web/node_modules/@jridgewell/remapping/src/types.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; - -export type { - SourceMapSegment, - DecodedSourceMap, - EncodedSourceMap, -} from '@jridgewell/trace-mapping'; - -export type { SourceMapInput }; - -export type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; - ignore: boolean | undefined; -}; - -export type SourceMapLoader = ( - file: string, - ctx: LoaderContext, -) => SourceMapInput | null | undefined | void; - -export type Options = { - excludeContent?: boolean; - decodedMappings?: boolean; -}; diff --git a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts b/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts deleted file mode 100644 index e089aea..0000000 --- a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts +++ /dev/null @@ -1,15 +0,0 @@ -import type { MapSource as MapSourceType } from './source-map-tree.cts'; -import type { SourceMapInput, SourceMapLoader } from './types.cts'; -/** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ -export = function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType; -//# sourceMappingURL=build-source-map-tree.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts.map b/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts.map deleted file mode 100644 index 38e4290..0000000 --- a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"build-source-map-tree.d.ts","sourceRoot":"","sources":["../src/build-source-map-tree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,SAAS,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAO9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,KAAK,EAAE,cAAc,GAAG,cAAc,EAAE,EACxC,MAAM,EAAE,eAAe,GACtB,aAAa,CAkBf"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts b/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts deleted file mode 100644 index 746ac5f..0000000 --- a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts +++ /dev/null @@ -1,15 +0,0 @@ -import type { MapSource as MapSourceType } from './source-map-tree.mts'; -import type { SourceMapInput, SourceMapLoader } from './types.mts'; -/** - * Recursively builds a tree structure out of sourcemap files, with each node - * being either an `OriginalSource` "leaf" or a `SourceMapTree` composed of - * `OriginalSource`s and `SourceMapTree`s. - * - * Every sourcemap is composed of a collection of source files and mappings - * into locations of those source files. When we generate a `SourceMapTree` for - * the sourcemap, we attempt to load each source file's own sourcemap. If it - * does not have an associated sourcemap, it is considered an original, - * unmodified source file. - */ -export default function buildSourceMapTree(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader): MapSourceType; -//# sourceMappingURL=build-source-map-tree.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts.map b/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts.map deleted file mode 100644 index 38e4290..0000000 --- a/web/node_modules/@jridgewell/remapping/types/build-source-map-tree.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"build-source-map-tree.d.ts","sourceRoot":"","sources":["../src/build-source-map-tree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAW,SAAS,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAC;AAO9E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,KAAK,EAAE,cAAc,GAAG,cAAc,EAAE,EACxC,MAAM,EAAE,eAAe,GACtB,aAAa,CAkBf"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/remapping.d.cts b/web/node_modules/@jridgewell/remapping/types/remapping.d.cts deleted file mode 100644 index 2022784..0000000 --- a/web/node_modules/@jridgewell/remapping/types/remapping.d.cts +++ /dev/null @@ -1,21 +0,0 @@ -import SourceMap from './source-map.cts'; -import type { SourceMapInput, SourceMapLoader, Options } from './types.cts'; -export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types.cts'; -export type { SourceMap }; -/** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ -export = function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap; -//# sourceMappingURL=remapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/remapping.d.cts.map b/web/node_modules/@jridgewell/remapping/types/remapping.d.cts.map deleted file mode 100644 index 9f2fd0e..0000000 --- a/web/node_modules/@jridgewell/remapping/types/remapping.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"remapping.d.ts","sourceRoot":"","sources":["../src/remapping.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,IAAI,YAAY,EAChC,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,EACb,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,KAAK,EAAE,cAAc,GAAG,cAAc,EAAE,EACxC,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAC1B,SAAS,CAKX"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/remapping.d.mts b/web/node_modules/@jridgewell/remapping/types/remapping.d.mts deleted file mode 100644 index 95c4066..0000000 --- a/web/node_modules/@jridgewell/remapping/types/remapping.d.mts +++ /dev/null @@ -1,21 +0,0 @@ -import SourceMap from './source-map.mts'; -import type { SourceMapInput, SourceMapLoader, Options } from './types.mts'; -export type { SourceMapSegment, EncodedSourceMap, EncodedSourceMap as RawSourceMap, DecodedSourceMap, SourceMapInput, SourceMapLoader, LoaderContext, Options, } from './types.mts'; -export type { SourceMap }; -/** - * Traces through all the mappings in the root sourcemap, through the sources - * (and their sourcemaps), all the way back to the original source location. - * - * `loader` will be called every time we encounter a source file. If it returns - * a sourcemap, we will recurse into that sourcemap to continue the trace. If - * it returns a falsey value, that source file is treated as an original, - * unmodified source file. - * - * Pass `excludeContent` to exclude any self-containing source file content - * from the output sourcemap. - * - * Pass `decodedMappings` to receive a SourceMap with decoded (instead of - * VLQ encoded) mappings. - */ -export default function remapping(input: SourceMapInput | SourceMapInput[], loader: SourceMapLoader, options?: boolean | Options): SourceMap; -//# sourceMappingURL=remapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/remapping.d.mts.map b/web/node_modules/@jridgewell/remapping/types/remapping.d.mts.map deleted file mode 100644 index 9f2fd0e..0000000 --- a/web/node_modules/@jridgewell/remapping/types/remapping.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"remapping.d.ts","sourceRoot":"","sources":["../src/remapping.ts"],"names":[],"mappings":"AAEA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACxE,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,IAAI,YAAY,EAChC,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,EACb,OAAO,GACR,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,KAAK,EAAE,cAAc,GAAG,cAAc,EAAE,EACxC,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAC1B,SAAS,CAKX"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts b/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts deleted file mode 100644 index 440f65b..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts +++ /dev/null @@ -1,46 +0,0 @@ -import { GenMapping } from '@jridgewell/gen-mapping'; -import type { TraceMap } from '@jridgewell/trace-mapping'; -export type SourceMapSegmentObject = { - column: number; - line: number; - name: string; - source: string; - content: string | null; - ignore: boolean; -}; -export type OriginalSource = { - map: null; - sources: Sources[]; - source: string; - content: string | null; - ignore: boolean; -}; -export type MapSource = { - map: TraceMap; - sources: Sources[]; - source: string; - content: null; - ignore: false; -}; -export type Sources = OriginalSource | MapSource; -/** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ -export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource; -/** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ -export declare function OriginalSource(source: string, content: string | null, ignore: boolean): OriginalSource; -/** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ -export declare function traceMappings(tree: MapSource): GenMapping; -/** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ -export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null; -//# sourceMappingURL=source-map-tree.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts.map b/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts.map deleted file mode 100644 index e7cbfb9..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map-tree.d.ts","sourceRoot":"","sources":["../src/source-map-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgD,MAAM,yBAAyB,CAAC;AAGnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,IAAI,CAAC;IACV,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,QAAQ,CAAC;IACd,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;AA8CjD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,SAAS,CAEtE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,MAAM,EAAE,OAAO,GACd,cAAc,CAEhB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CAyCzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,sBAAsB,GAAG,IAAI,CAmB/B"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts b/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts deleted file mode 100644 index 440f65b..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts +++ /dev/null @@ -1,46 +0,0 @@ -import { GenMapping } from '@jridgewell/gen-mapping'; -import type { TraceMap } from '@jridgewell/trace-mapping'; -export type SourceMapSegmentObject = { - column: number; - line: number; - name: string; - source: string; - content: string | null; - ignore: boolean; -}; -export type OriginalSource = { - map: null; - sources: Sources[]; - source: string; - content: string | null; - ignore: boolean; -}; -export type MapSource = { - map: TraceMap; - sources: Sources[]; - source: string; - content: null; - ignore: false; -}; -export type Sources = OriginalSource | MapSource; -/** - * MapSource represents a single sourcemap, with the ability to trace mappings into its child nodes - * (which may themselves be SourceMapTrees). - */ -export declare function MapSource(map: TraceMap, sources: Sources[]): MapSource; -/** - * A "leaf" node in the sourcemap tree, representing an original, unmodified source file. Recursive - * segment tracing ends at the `OriginalSource`. - */ -export declare function OriginalSource(source: string, content: string | null, ignore: boolean): OriginalSource; -/** - * traceMappings is only called on the root level SourceMapTree, and begins the process of - * resolving each mapping in terms of the original source files. - */ -export declare function traceMappings(tree: MapSource): GenMapping; -/** - * originalPositionFor is only called on children SourceMapTrees. It recurses down into its own - * child SourceMapTrees, until we find the original source map. - */ -export declare function originalPositionFor(source: Sources, line: number, column: number, name: string): SourceMapSegmentObject | null; -//# sourceMappingURL=source-map-tree.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts.map b/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts.map deleted file mode 100644 index e7cbfb9..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map-tree.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map-tree.d.ts","sourceRoot":"","sources":["../src/source-map-tree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgD,MAAM,yBAAyB,CAAC;AAGnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,IAAI,CAAC;IACV,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,QAAQ,CAAC;IACd,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,cAAc,GAAG,SAAS,CAAC;AA8CjD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,SAAS,CAEtE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GAAG,IAAI,EACtB,MAAM,EAAE,OAAO,GACd,cAAc,CAEhB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,SAAS,GAAG,UAAU,CAyCzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,sBAAsB,GAAG,IAAI,CAmB/B"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map.d.cts b/web/node_modules/@jridgewell/remapping/types/source-map.d.cts deleted file mode 100644 index fdb7eed..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map.d.cts +++ /dev/null @@ -1,19 +0,0 @@ -import type { GenMapping } from '@jridgewell/gen-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Options } from './types.cts'; -/** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ -export = class SourceMap { - file?: string | null; - mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings']; - sourceRoot?: string; - names: string[]; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - ignoreList: number[] | undefined; - constructor(map: GenMapping, options: Options); - toString(): string; -} -//# sourceMappingURL=source-map.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map.d.cts.map b/web/node_modules/@jridgewell/remapping/types/source-map.d.cts.map deleted file mode 100644 index 593daf8..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map.d.ts","sourceRoot":"","sources":["../src/source-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;gBAE7B,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;IAe7C,QAAQ,IAAI,MAAM;CAGnB"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map.d.mts b/web/node_modules/@jridgewell/remapping/types/source-map.d.mts deleted file mode 100644 index 52ebba2..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map.d.mts +++ /dev/null @@ -1,19 +0,0 @@ -import type { GenMapping } from '@jridgewell/gen-mapping'; -import type { DecodedSourceMap, EncodedSourceMap, Options } from './types.mts'; -/** - * A SourceMap v3 compatible sourcemap, which only includes fields that were - * provided to it. - */ -export default class SourceMap { - file?: string | null; - mappings: EncodedSourceMap['mappings'] | DecodedSourceMap['mappings']; - sourceRoot?: string; - names: string[]; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - ignoreList: number[] | undefined; - constructor(map: GenMapping, options: Options); - toString(): string; -} -//# sourceMappingURL=source-map.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/source-map.d.mts.map b/web/node_modules/@jridgewell/remapping/types/source-map.d.mts.map deleted file mode 100644 index 593daf8..0000000 --- a/web/node_modules/@jridgewell/remapping/types/source-map.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"source-map.d.ts","sourceRoot":"","sources":["../src/source-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,SAAS;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAC3B,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;gBAE7B,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO;IAe7C,QAAQ,IAAI,MAAM;CAGnB"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/types.d.cts b/web/node_modules/@jridgewell/remapping/types/types.d.cts deleted file mode 100644 index eeb320f..0000000 --- a/web/node_modules/@jridgewell/remapping/types/types.d.cts +++ /dev/null @@ -1,16 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping'; -export type { SourceMapInput }; -export type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; - ignore: boolean | undefined; -}; -export type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void; -export type Options = { - excludeContent?: boolean; - decodedMappings?: boolean; -}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/types.d.cts.map b/web/node_modules/@jridgewell/remapping/types/types.d.cts.map deleted file mode 100644 index 4f8647e..0000000 --- a/web/node_modules/@jridgewell/remapping/types/types.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,aAAa,KACf,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/types.d.mts b/web/node_modules/@jridgewell/remapping/types/types.d.mts deleted file mode 100644 index eeb320f..0000000 --- a/web/node_modules/@jridgewell/remapping/types/types.d.mts +++ /dev/null @@ -1,16 +0,0 @@ -import type { SourceMapInput } from '@jridgewell/trace-mapping'; -export type { SourceMapSegment, DecodedSourceMap, EncodedSourceMap, } from '@jridgewell/trace-mapping'; -export type { SourceMapInput }; -export type LoaderContext = { - readonly importer: string; - readonly depth: number; - source: string; - content: string | null | undefined; - ignore: boolean | undefined; -}; -export type SourceMapLoader = (file: string, ctx: LoaderContext) => SourceMapInput | null | undefined | void; -export type Options = { - excludeContent?: boolean; - decodedMappings?: boolean; -}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/remapping/types/types.d.mts.map b/web/node_modules/@jridgewell/remapping/types/types.d.mts.map deleted file mode 100644 index 4f8647e..0000000 --- a/web/node_modules/@jridgewell/remapping/types/types.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,CAC5B,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,aAAa,KACf,cAAc,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;AAE9C,MAAM,MAAM,OAAO,GAAG;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/resolve-uri/LICENSE b/web/node_modules/@jridgewell/resolve-uri/LICENSE deleted file mode 100644 index 0a81b2a..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2019 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/web/node_modules/@jridgewell/resolve-uri/README.md b/web/node_modules/@jridgewell/resolve-uri/README.md deleted file mode 100644 index 2fe70df..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# @jridgewell/resolve-uri - -> Resolve a URI relative to an optional base URI - -Resolve any combination of absolute URIs, protocol-realtive URIs, absolute paths, or relative paths. - -## Installation - -```sh -npm install @jridgewell/resolve-uri -``` - -## Usage - -```typescript -function resolve(input: string, base?: string): string; -``` - -```js -import resolve from '@jridgewell/resolve-uri'; - -resolve('foo', 'https://example.com'); // => 'https://example.com/foo' -``` - -| Input | Base | Resolution | Explanation | -|-----------------------|-------------------------|--------------------------------|--------------------------------------------------------------| -| `https://example.com` | _any_ | `https://example.com/` | Input is normalized only | -| `//example.com` | `https://base.com/` | `https://example.com/` | Input inherits the base's protocol | -| `//example.com` | _rest_ | `//example.com/` | Input is normalized only | -| `/example` | `https://base.com/` | `https://base.com/example` | Input inherits the base's origin | -| `/example` | `//base.com/` | `//base.com/example` | Input inherits the base's host and remains protocol relative | -| `/example` | _rest_ | `/example` | Input is normalized only | -| `example` | `https://base.com/dir/` | `https://base.com/dir/example` | Input is joined with the base | -| `example` | `https://base.com/file` | `https://base.com/example` | Input is joined with the base without its file | -| `example` | `//base.com/dir/` | `//base.com/dir/example` | Input is joined with the base's last directory | -| `example` | `//base.com/file` | `//base.com/example` | Input is joined with the base without its file | -| `example` | `/base/dir/` | `/base/dir/example` | Input is joined with the base's last directory | -| `example` | `/base/file` | `/base/example` | Input is joined with the base without its file | -| `example` | `base/dir/` | `base/dir/example` | Input is joined with the base's last directory | -| `example` | `base/file` | `base/example` | Input is joined with the base without its file | diff --git a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs b/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs deleted file mode 100644 index e958e88..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +++ /dev/null @@ -1,232 +0,0 @@ -// Matches the scheme of a URL, eg "http://" -const schemeRegex = /^[\w+.-]+:\/\//; -/** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ -const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; -/** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ -const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; -function isAbsoluteUrl(input) { - return schemeRegex.test(input); -} -function isSchemeRelativeUrl(input) { - return input.startsWith('//'); -} -function isAbsolutePath(input) { - return input.startsWith('/'); -} -function isFileUrl(input) { - return input.startsWith('file:'); -} -function isRelative(input) { - return /^[.?#]/.test(input); -} -function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); -} -function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); -} -function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: 7 /* Absolute */, - }; -} -function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = 6 /* SchemeRelative */; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = 5 /* AbsolutePath */; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? 3 /* Query */ - : input.startsWith('#') - ? 2 /* Hash */ - : 4 /* RelativePath */ - : 1 /* Empty */; - return url; -} -function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} -function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } -} -/** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ -function normalizePath(url, type) { - const rel = type <= 4 /* RelativePath */; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; -} -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== 7 /* Absolute */) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case 1 /* Empty */: - url.hash = baseUrl.hash; - // fall through - case 2 /* Hash */: - url.query = baseUrl.query; - // fall through - case 3 /* Query */: - case 4 /* RelativePath */: - mergePaths(url, baseUrl); - // fall through - case 5 /* AbsolutePath */: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case 6 /* SchemeRelative */: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case 2 /* Hash */: - case 3 /* Query */: - return queryHash; - case 4 /* RelativePath */: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case 5 /* AbsolutePath */: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } -} - -export { resolve as default }; -//# sourceMappingURL=resolve-uri.mjs.map diff --git a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map b/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map deleted file mode 100644 index 1de97d0..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.mjs","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js b/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js deleted file mode 100644 index a783049..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +++ /dev/null @@ -1,240 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.resolveURI = factory()); -})(this, (function () { 'use strict'; - - // Matches the scheme of a URL, eg "http://" - const schemeRegex = /^[\w+.-]+:\/\//; - /** - * Matches the parts of a URL: - * 1. Scheme, including ":", guaranteed. - * 2. User/password, including "@", optional. - * 3. Host, guaranteed. - * 4. Port, including ":", optional. - * 5. Path, including "/", optional. - * 6. Query, including "?", optional. - * 7. Hash, including "#", optional. - */ - const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/; - /** - * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start - * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive). - * - * 1. Host, optional. - * 2. Path, which may include "/", guaranteed. - * 3. Query, including "?", optional. - * 4. Hash, including "#", optional. - */ - const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i; - function isAbsoluteUrl(input) { - return schemeRegex.test(input); - } - function isSchemeRelativeUrl(input) { - return input.startsWith('//'); - } - function isAbsolutePath(input) { - return input.startsWith('/'); - } - function isFileUrl(input) { - return input.startsWith('file:'); - } - function isRelative(input) { - return /^[.?#]/.test(input); - } - function parseAbsoluteUrl(input) { - const match = urlRegex.exec(input); - return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || ''); - } - function parseFileUrl(input) { - const match = fileRegex.exec(input); - const path = match[2]; - return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || ''); - } - function makeUrl(scheme, user, host, port, path, query, hash) { - return { - scheme, - user, - host, - port, - path, - query, - hash, - type: 7 /* Absolute */, - }; - } - function parseUrl(input) { - if (isSchemeRelativeUrl(input)) { - const url = parseAbsoluteUrl('http:' + input); - url.scheme = ''; - url.type = 6 /* SchemeRelative */; - return url; - } - if (isAbsolutePath(input)) { - const url = parseAbsoluteUrl('http://foo.com' + input); - url.scheme = ''; - url.host = ''; - url.type = 5 /* AbsolutePath */; - return url; - } - if (isFileUrl(input)) - return parseFileUrl(input); - if (isAbsoluteUrl(input)) - return parseAbsoluteUrl(input); - const url = parseAbsoluteUrl('http://foo.com/' + input); - url.scheme = ''; - url.host = ''; - url.type = input - ? input.startsWith('?') - ? 3 /* Query */ - : input.startsWith('#') - ? 2 /* Hash */ - : 4 /* RelativePath */ - : 1 /* Empty */; - return url; - } - function stripPathFilename(path) { - // If a path ends with a parent directory "..", then it's a relative path with excess parent - // paths. It's not a file, so we can't strip it. - if (path.endsWith('/..')) - return path; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); - } - function mergePaths(url, base) { - normalizePath(base, base.type); - // If the path is just a "/", then it was an empty path to begin with (remember, we're a relative - // path). - if (url.path === '/') { - url.path = base.path; - } - else { - // Resolution happens relative to the base path's directory, not the file. - url.path = stripPathFilename(base.path) + url.path; - } - } - /** - * The path can have empty directories "//", unneeded parents "foo/..", or current directory - * "foo/.". We need to normalize to a standard representation. - */ - function normalizePath(url, type) { - const rel = type <= 4 /* RelativePath */; - const pieces = url.path.split('/'); - // We need to preserve the first piece always, so that we output a leading slash. The item at - // pieces[0] is an empty string. - let pointer = 1; - // Positive is the number of real directories we've output, used for popping a parent directory. - // Eg, "foo/bar/.." will have a positive 2, and we can decrement to be left with just "foo". - let positive = 0; - // We need to keep a trailing slash if we encounter an empty directory (eg, splitting "foo/" will - // generate `["foo", ""]` pieces). And, if we pop a parent directory. But once we encounter a - // real directory, we won't need to append, unless the other conditions happen again. - let addTrailingSlash = false; - for (let i = 1; i < pieces.length; i++) { - const piece = pieces[i]; - // An empty directory, could be a trailing slash, or just a double "//" in the path. - if (!piece) { - addTrailingSlash = true; - continue; - } - // If we encounter a real directory, then we don't need to append anymore. - addTrailingSlash = false; - // A current directory, which we can always drop. - if (piece === '.') - continue; - // A parent directory, we need to see if there are any real directories we can pop. Else, we - // have an excess of parents, and we'll need to keep the "..". - if (piece === '..') { - if (positive) { - addTrailingSlash = true; - positive--; - pointer--; - } - else if (rel) { - // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute - // URL, protocol relative URL, or an absolute path, we don't need to keep excess. - pieces[pointer++] = piece; - } - continue; - } - // We've encountered a real directory. Move it to the next insertion pointer, which accounts for - // any popped or dropped directories. - pieces[pointer++] = piece; - positive++; - } - let path = ''; - for (let i = 1; i < pointer; i++) { - path += '/' + pieces[i]; - } - if (!path || (addTrailingSlash && !path.endsWith('/..'))) { - path += '/'; - } - url.path = path; - } - /** - * Attempts to resolve `input` URL/path relative to `base`. - */ - function resolve(input, base) { - if (!input && !base) - return ''; - const url = parseUrl(input); - let inputType = url.type; - if (base && inputType !== 7 /* Absolute */) { - const baseUrl = parseUrl(base); - const baseType = baseUrl.type; - switch (inputType) { - case 1 /* Empty */: - url.hash = baseUrl.hash; - // fall through - case 2 /* Hash */: - url.query = baseUrl.query; - // fall through - case 3 /* Query */: - case 4 /* RelativePath */: - mergePaths(url, baseUrl); - // fall through - case 5 /* AbsolutePath */: - // The host, user, and port are joined, you can't copy one without the others. - url.user = baseUrl.user; - url.host = baseUrl.host; - url.port = baseUrl.port; - // fall through - case 6 /* SchemeRelative */: - // The input doesn't have a schema at least, so we need to copy at least that over. - url.scheme = baseUrl.scheme; - } - if (baseType > inputType) - inputType = baseType; - } - normalizePath(url, inputType); - const queryHash = url.query + url.hash; - switch (inputType) { - // This is impossible, because of the empty checks at the start of the function. - // case UrlType.Empty: - case 2 /* Hash */: - case 3 /* Query */: - return queryHash; - case 4 /* RelativePath */: { - // The first char is always a "/", and we need it to be relative. - const path = url.path.slice(1); - if (!path) - return queryHash || '.'; - if (isRelative(base || input) && !isRelative(path)) { - // If base started with a leading ".", or there is no base and input started with a ".", - // then we need to ensure that the relative path starts with a ".". We don't know if - // relative starts with a "..", though, so check before prepending. - return './' + path + queryHash; - } - return path + queryHash; - } - case 5 /* AbsolutePath */: - return url.path + queryHash; - default: - return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash; - } - } - - return resolve; - -})); -//# sourceMappingURL=resolve-uri.umd.js.map diff --git a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map b/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map deleted file mode 100644 index 70a37f2..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve-uri.umd.js","sources":["../src/resolve-uri.ts"],"sourcesContent":["// Matches the scheme of a URL, eg \"http://\"\nconst schemeRegex = /^[\\w+.-]+:\\/\\//;\n\n/**\n * Matches the parts of a URL:\n * 1. Scheme, including \":\", guaranteed.\n * 2. User/password, including \"@\", optional.\n * 3. Host, guaranteed.\n * 4. Port, including \":\", optional.\n * 5. Path, including \"/\", optional.\n * 6. Query, including \"?\", optional.\n * 7. Hash, including \"#\", optional.\n */\nconst urlRegex = /^([\\w+.-]+:)\\/\\/([^@/#?]*@)?([^:/#?]*)(:\\d+)?(\\/[^#?]*)?(\\?[^#]*)?(#.*)?/;\n\n/**\n * File URLs are weird. They dont' need the regular `//` in the scheme, they may or may not start\n * with a leading `/`, they can have a domain (but only if they don't start with a Windows drive).\n *\n * 1. Host, optional.\n * 2. Path, which may include \"/\", guaranteed.\n * 3. Query, including \"?\", optional.\n * 4. Hash, including \"#\", optional.\n */\nconst fileRegex = /^file:(?:\\/\\/((?![a-z]:)[^/#?]*)?)?(\\/?[^#?]*)(\\?[^#]*)?(#.*)?/i;\n\ntype Url = {\n scheme: string;\n user: string;\n host: string;\n port: string;\n path: string;\n query: string;\n hash: string;\n type: UrlType;\n};\n\nconst enum UrlType {\n Empty = 1,\n Hash = 2,\n Query = 3,\n RelativePath = 4,\n AbsolutePath = 5,\n SchemeRelative = 6,\n Absolute = 7,\n}\n\nfunction isAbsoluteUrl(input: string): boolean {\n return schemeRegex.test(input);\n}\n\nfunction isSchemeRelativeUrl(input: string): boolean {\n return input.startsWith('//');\n}\n\nfunction isAbsolutePath(input: string): boolean {\n return input.startsWith('/');\n}\n\nfunction isFileUrl(input: string): boolean {\n return input.startsWith('file:');\n}\n\nfunction isRelative(input: string): boolean {\n return /^[.?#]/.test(input);\n}\n\nfunction parseAbsoluteUrl(input: string): Url {\n const match = urlRegex.exec(input)!;\n return makeUrl(\n match[1],\n match[2] || '',\n match[3],\n match[4] || '',\n match[5] || '/',\n match[6] || '',\n match[7] || '',\n );\n}\n\nfunction parseFileUrl(input: string): Url {\n const match = fileRegex.exec(input)!;\n const path = match[2];\n return makeUrl(\n 'file:',\n '',\n match[1] || '',\n '',\n isAbsolutePath(path) ? path : '/' + path,\n match[3] || '',\n match[4] || '',\n );\n}\n\nfunction makeUrl(\n scheme: string,\n user: string,\n host: string,\n port: string,\n path: string,\n query: string,\n hash: string,\n): Url {\n return {\n scheme,\n user,\n host,\n port,\n path,\n query,\n hash,\n type: UrlType.Absolute,\n };\n}\n\nfunction parseUrl(input: string): Url {\n if (isSchemeRelativeUrl(input)) {\n const url = parseAbsoluteUrl('http:' + input);\n url.scheme = '';\n url.type = UrlType.SchemeRelative;\n return url;\n }\n\n if (isAbsolutePath(input)) {\n const url = parseAbsoluteUrl('http://foo.com' + input);\n url.scheme = '';\n url.host = '';\n url.type = UrlType.AbsolutePath;\n return url;\n }\n\n if (isFileUrl(input)) return parseFileUrl(input);\n\n if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);\n\n const url = parseAbsoluteUrl('http://foo.com/' + input);\n url.scheme = '';\n url.host = '';\n url.type = input\n ? input.startsWith('?')\n ? UrlType.Query\n : input.startsWith('#')\n ? UrlType.Hash\n : UrlType.RelativePath\n : UrlType.Empty;\n return url;\n}\n\nfunction stripPathFilename(path: string): string {\n // If a path ends with a parent directory \"..\", then it's a relative path with excess parent\n // paths. It's not a file, so we can't strip it.\n if (path.endsWith('/..')) return path;\n const index = path.lastIndexOf('/');\n return path.slice(0, index + 1);\n}\n\nfunction mergePaths(url: Url, base: Url) {\n normalizePath(base, base.type);\n\n // If the path is just a \"/\", then it was an empty path to begin with (remember, we're a relative\n // path).\n if (url.path === '/') {\n url.path = base.path;\n } else {\n // Resolution happens relative to the base path's directory, not the file.\n url.path = stripPathFilename(base.path) + url.path;\n }\n}\n\n/**\n * The path can have empty directories \"//\", unneeded parents \"foo/..\", or current directory\n * \"foo/.\". We need to normalize to a standard representation.\n */\nfunction normalizePath(url: Url, type: UrlType) {\n const rel = type <= UrlType.RelativePath;\n const pieces = url.path.split('/');\n\n // We need to preserve the first piece always, so that we output a leading slash. The item at\n // pieces[0] is an empty string.\n let pointer = 1;\n\n // Positive is the number of real directories we've output, used for popping a parent directory.\n // Eg, \"foo/bar/..\" will have a positive 2, and we can decrement to be left with just \"foo\".\n let positive = 0;\n\n // We need to keep a trailing slash if we encounter an empty directory (eg, splitting \"foo/\" will\n // generate `[\"foo\", \"\"]` pieces). And, if we pop a parent directory. But once we encounter a\n // real directory, we won't need to append, unless the other conditions happen again.\n let addTrailingSlash = false;\n\n for (let i = 1; i < pieces.length; i++) {\n const piece = pieces[i];\n\n // An empty directory, could be a trailing slash, or just a double \"//\" in the path.\n if (!piece) {\n addTrailingSlash = true;\n continue;\n }\n\n // If we encounter a real directory, then we don't need to append anymore.\n addTrailingSlash = false;\n\n // A current directory, which we can always drop.\n if (piece === '.') continue;\n\n // A parent directory, we need to see if there are any real directories we can pop. Else, we\n // have an excess of parents, and we'll need to keep the \"..\".\n if (piece === '..') {\n if (positive) {\n addTrailingSlash = true;\n positive--;\n pointer--;\n } else if (rel) {\n // If we're in a relativePath, then we need to keep the excess parents. Else, in an absolute\n // URL, protocol relative URL, or an absolute path, we don't need to keep excess.\n pieces[pointer++] = piece;\n }\n continue;\n }\n\n // We've encountered a real directory. Move it to the next insertion pointer, which accounts for\n // any popped or dropped directories.\n pieces[pointer++] = piece;\n positive++;\n }\n\n let path = '';\n for (let i = 1; i < pointer; i++) {\n path += '/' + pieces[i];\n }\n if (!path || (addTrailingSlash && !path.endsWith('/..'))) {\n path += '/';\n }\n url.path = path;\n}\n\n/**\n * Attempts to resolve `input` URL/path relative to `base`.\n */\nexport default function resolve(input: string, base: string | undefined): string {\n if (!input && !base) return '';\n\n const url = parseUrl(input);\n let inputType = url.type;\n\n if (base && inputType !== UrlType.Absolute) {\n const baseUrl = parseUrl(base);\n const baseType = baseUrl.type;\n\n switch (inputType) {\n case UrlType.Empty:\n url.hash = baseUrl.hash;\n // fall through\n\n case UrlType.Hash:\n url.query = baseUrl.query;\n // fall through\n\n case UrlType.Query:\n case UrlType.RelativePath:\n mergePaths(url, baseUrl);\n // fall through\n\n case UrlType.AbsolutePath:\n // The host, user, and port are joined, you can't copy one without the others.\n url.user = baseUrl.user;\n url.host = baseUrl.host;\n url.port = baseUrl.port;\n // fall through\n\n case UrlType.SchemeRelative:\n // The input doesn't have a schema at least, so we need to copy at least that over.\n url.scheme = baseUrl.scheme;\n }\n if (baseType > inputType) inputType = baseType;\n }\n\n normalizePath(url, inputType);\n\n const queryHash = url.query + url.hash;\n switch (inputType) {\n // This is impossible, because of the empty checks at the start of the function.\n // case UrlType.Empty:\n\n case UrlType.Hash:\n case UrlType.Query:\n return queryHash;\n\n case UrlType.RelativePath: {\n // The first char is always a \"/\", and we need it to be relative.\n const path = url.path.slice(1);\n\n if (!path) return queryHash || '.';\n\n if (isRelative(base || input) && !isRelative(path)) {\n // If base started with a leading \".\", or there is no base and input started with a \".\",\n // then we need to ensure that the relative path starts with a \".\". We don't know if\n // relative starts with a \"..\", though, so check before prepending.\n return './' + path + queryHash;\n }\n\n return path + queryHash;\n }\n\n case UrlType.AbsolutePath:\n return url.path + queryHash;\n\n default:\n return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;\n }\n}\n"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts b/web/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts deleted file mode 100644 index b7f0b3b..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/dist/types/resolve-uri.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Attempts to resolve `input` URL/path relative to `base`. - */ -export default function resolve(input: string, base: string | undefined): string; diff --git a/web/node_modules/@jridgewell/resolve-uri/package.json b/web/node_modules/@jridgewell/resolve-uri/package.json deleted file mode 100644 index 02a4c51..0000000 --- a/web/node_modules/@jridgewell/resolve-uri/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@jridgewell/resolve-uri", - "version": "3.1.2", - "description": "Resolve a URI relative to an optional base URI", - "keywords": [ - "resolve", - "uri", - "url", - "path" - ], - "author": "Justin Ridgewell ", - "license": "MIT", - "repository": "https://github.com/jridgewell/resolve-uri", - "main": "dist/resolve-uri.umd.js", - "module": "dist/resolve-uri.mjs", - "types": "dist/types/resolve-uri.d.ts", - "exports": { - ".": [ - { - "types": "./dist/types/resolve-uri.d.ts", - "browser": "./dist/resolve-uri.umd.js", - "require": "./dist/resolve-uri.umd.js", - "import": "./dist/resolve-uri.mjs" - }, - "./dist/resolve-uri.umd.js" - ], - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "engines": { - "node": ">=6.0.0" - }, - "scripts": { - "prebuild": "rm -rf dist", - "build": "run-s -n build:*", - "build:rollup": "rollup -c rollup.config.js", - "build:ts": "tsc --project tsconfig.build.json", - "lint": "run-s -n lint:*", - "lint:prettier": "npm run test:lint:prettier -- --write", - "lint:ts": "npm run test:lint:ts -- --fix", - "pretest": "run-s build:rollup", - "test": "run-s -n test:lint test:only", - "test:debug": "mocha --inspect-brk", - "test:lint": "run-s -n test:lint:*", - "test:lint:prettier": "prettier --check '{src,test}/**/*.ts'", - "test:lint:ts": "eslint '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:coverage": "c8 mocha", - "test:watch": "mocha --watch", - "prepublishOnly": "npm run preversion", - "preversion": "run-s test build" - }, - "devDependencies": { - "@jridgewell/resolve-uri-latest": "npm:@jridgewell/resolve-uri@*", - "@rollup/plugin-typescript": "8.3.0", - "@typescript-eslint/eslint-plugin": "5.10.0", - "@typescript-eslint/parser": "5.10.0", - "c8": "7.11.0", - "eslint": "8.7.0", - "eslint-config-prettier": "8.3.0", - "mocha": "9.2.0", - "npm-run-all": "4.1.5", - "prettier": "2.5.1", - "rollup": "2.66.0", - "typescript": "4.5.5" - } -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/LICENSE b/web/node_modules/@jridgewell/sourcemap-codec/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@jridgewell/sourcemap-codec/README.md b/web/node_modules/@jridgewell/sourcemap-codec/README.md deleted file mode 100644 index b3e0708..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/README.md +++ /dev/null @@ -1,264 +0,0 @@ -# @jridgewell/sourcemap-codec - -Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). - - -## Why? - -Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. - -This package makes the process slightly easier. - - -## Installation - -```bash -npm install @jridgewell/sourcemap-codec -``` - - -## Usage - -```js -import { encode, decode } from '@jridgewell/sourcemap-codec'; - -var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); - -assert.deepEqual( decoded, [ - // the first line (of the generated code) has no mappings, - // as shown by the starting semi-colon (which separates lines) - [], - - // the second line contains four (comma-separated) segments - [ - // segments are encoded as you'd expect: - // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] - - // i.e. the first segment begins at column 2, and maps back to the second column - // of the second line (both zero-based) of the 0th source, and uses the 0th - // name in the `map.names` array - [ 2, 0, 2, 2, 0 ], - - // the remaining segments are 4-length rather than 5-length, - // because they don't map a name - [ 4, 0, 2, 4 ], - [ 6, 0, 2, 5 ], - [ 7, 0, 2, 7 ] - ], - - // the final line contains two segments - [ - [ 2, 1, 10, 19 ], - [ 12, 1, 11, 20 ] - ] -]); - -var encoded = encode( decoded ); -assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); -``` - -## Benchmarks - -``` -node v20.10.0 - -amp.js.map - 45120 segments - -Decode Memory Usage: -local code 5815135 bytes -@jridgewell/sourcemap-codec 1.4.15 5868160 bytes -sourcemap-codec 5492584 bytes -source-map-0.6.1 13569984 bytes -source-map-0.8.0 6390584 bytes -chrome dev tools 8011136 bytes -Smallest memory usage is sourcemap-codec - -Decode speed: -decode: local code x 492 ops/sec ±1.22% (90 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 499 ops/sec ±1.16% (89 runs sampled) -decode: sourcemap-codec x 376 ops/sec ±1.66% (89 runs sampled) -decode: source-map-0.6.1 x 34.99 ops/sec ±0.94% (48 runs sampled) -decode: source-map-0.8.0 x 351 ops/sec ±0.07% (95 runs sampled) -chrome dev tools x 165 ops/sec ±0.91% (86 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 444248 bytes -@jridgewell/sourcemap-codec 1.4.15 623024 bytes -sourcemap-codec 8696280 bytes -source-map-0.6.1 8745176 bytes -source-map-0.8.0 8736624 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 796 ops/sec ±0.11% (97 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 795 ops/sec ±0.25% (98 runs sampled) -encode: sourcemap-codec x 231 ops/sec ±0.83% (86 runs sampled) -encode: source-map-0.6.1 x 166 ops/sec ±0.57% (86 runs sampled) -encode: source-map-0.8.0 x 203 ops/sec ±0.45% (88 runs sampled) -Fastest is encode: local code,encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -babel.min.js.map - 347793 segments - -Decode Memory Usage: -local code 35424960 bytes -@jridgewell/sourcemap-codec 1.4.15 35424696 bytes -sourcemap-codec 36033464 bytes -source-map-0.6.1 62253704 bytes -source-map-0.8.0 43843920 bytes -chrome dev tools 45111400 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Decode speed: -decode: local code x 38.18 ops/sec ±5.44% (52 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 38.36 ops/sec ±5.02% (52 runs sampled) -decode: sourcemap-codec x 34.05 ops/sec ±4.45% (47 runs sampled) -decode: source-map-0.6.1 x 4.31 ops/sec ±2.76% (15 runs sampled) -decode: source-map-0.8.0 x 55.60 ops/sec ±0.13% (73 runs sampled) -chrome dev tools x 16.94 ops/sec ±3.78% (46 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 2606016 bytes -@jridgewell/sourcemap-codec 1.4.15 2626440 bytes -sourcemap-codec 21152576 bytes -source-map-0.6.1 25023928 bytes -source-map-0.8.0 25256448 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 127 ops/sec ±0.18% (83 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 128 ops/sec ±0.26% (83 runs sampled) -encode: sourcemap-codec x 29.31 ops/sec ±2.55% (53 runs sampled) -encode: source-map-0.6.1 x 18.85 ops/sec ±3.19% (36 runs sampled) -encode: source-map-0.8.0 x 19.34 ops/sec ±1.97% (36 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -preact.js.map - 1992 segments - -Decode Memory Usage: -local code 261696 bytes -@jridgewell/sourcemap-codec 1.4.15 244296 bytes -sourcemap-codec 302816 bytes -source-map-0.6.1 939176 bytes -source-map-0.8.0 336 bytes -chrome dev tools 587368 bytes -Smallest memory usage is source-map-0.8.0 - -Decode speed: -decode: local code x 17,782 ops/sec ±0.32% (97 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 17,863 ops/sec ±0.40% (100 runs sampled) -decode: sourcemap-codec x 12,453 ops/sec ±0.27% (101 runs sampled) -decode: source-map-0.6.1 x 1,288 ops/sec ±1.05% (96 runs sampled) -decode: source-map-0.8.0 x 9,289 ops/sec ±0.27% (101 runs sampled) -chrome dev tools x 4,769 ops/sec ±0.18% (100 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 262944 bytes -@jridgewell/sourcemap-codec 1.4.15 25544 bytes -sourcemap-codec 323048 bytes -source-map-0.6.1 507808 bytes -source-map-0.8.0 507480 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Encode speed: -encode: local code x 24,207 ops/sec ±0.79% (95 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 24,288 ops/sec ±0.48% (96 runs sampled) -encode: sourcemap-codec x 6,761 ops/sec ±0.21% (100 runs sampled) -encode: source-map-0.6.1 x 5,374 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 5,633 ops/sec ±0.32% (99 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15,encode: local code - - -*** - - -react.js.map - 5726 segments - -Decode Memory Usage: -local code 678816 bytes -@jridgewell/sourcemap-codec 1.4.15 678816 bytes -sourcemap-codec 816400 bytes -source-map-0.6.1 2288864 bytes -source-map-0.8.0 721360 bytes -chrome dev tools 1012512 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 6,178 ops/sec ±0.19% (98 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 6,261 ops/sec ±0.22% (100 runs sampled) -decode: sourcemap-codec x 4,472 ops/sec ±0.90% (99 runs sampled) -decode: source-map-0.6.1 x 449 ops/sec ±0.31% (95 runs sampled) -decode: source-map-0.8.0 x 3,219 ops/sec ±0.13% (100 runs sampled) -chrome dev tools x 1,743 ops/sec ±0.20% (99 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 140960 bytes -@jridgewell/sourcemap-codec 1.4.15 159808 bytes -sourcemap-codec 969304 bytes -source-map-0.6.1 930520 bytes -source-map-0.8.0 930248 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 8,013 ops/sec ±0.19% (100 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 7,989 ops/sec ±0.20% (101 runs sampled) -encode: sourcemap-codec x 2,472 ops/sec ±0.21% (99 runs sampled) -encode: source-map-0.6.1 x 2,200 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 2,220 ops/sec ±0.37% (99 runs sampled) -Fastest is encode: local code - - -*** - - -vscode.map - 2141001 segments - -Decode Memory Usage: -local code 198955264 bytes -@jridgewell/sourcemap-codec 1.4.15 199175352 bytes -sourcemap-codec 199102688 bytes -source-map-0.6.1 386323432 bytes -source-map-0.8.0 244116432 bytes -chrome dev tools 293734280 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 3.90 ops/sec ±22.21% (15 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 3.95 ops/sec ±23.53% (15 runs sampled) -decode: sourcemap-codec x 3.82 ops/sec ±17.94% (14 runs sampled) -decode: source-map-0.6.1 x 0.61 ops/sec ±7.81% (6 runs sampled) -decode: source-map-0.8.0 x 9.54 ops/sec ±0.28% (28 runs sampled) -chrome dev tools x 2.18 ops/sec ±10.58% (10 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 13509880 bytes -@jridgewell/sourcemap-codec 1.4.15 13537648 bytes -sourcemap-codec 32540104 bytes -source-map-0.6.1 127531040 bytes -source-map-0.8.0 127535312 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 20.10 ops/sec ±0.19% (38 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 20.26 ops/sec ±0.32% (38 runs sampled) -encode: sourcemap-codec x 5.44 ops/sec ±1.64% (18 runs sampled) -encode: source-map-0.6.1 x 2.30 ops/sec ±4.79% (10 runs sampled) -encode: source-map-0.8.0 x 2.46 ops/sec ±6.53% (10 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 -``` - -# License - -MIT diff --git a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs deleted file mode 100644 index 532bab3..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +++ /dev/null @@ -1,423 +0,0 @@ -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -export { - decode, - decodeGeneratedRanges, - decodeOriginalScopes, - encode, - encodeGeneratedRanges, - encodeOriginalScopes -}; -//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map deleted file mode 100644 index c276844..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts", "../src/sourcemap-codec.ts"], - "mappings": "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", - "names": [] -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js deleted file mode 100644 index 2d8e459..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +++ /dev/null @@ -1,464 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.sourcemapCodec = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module) { -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/sourcemap-codec.ts -var sourcemap_codec_exports = {}; -__export(sourcemap_codec_exports, { - decode: () => decode, - decodeGeneratedRanges: () => decodeGeneratedRanges, - decodeOriginalScopes: () => decodeOriginalScopes, - encode: () => encode, - encodeGeneratedRanges: () => encodeGeneratedRanges, - encodeOriginalScopes: () => encodeOriginalScopes -}); -module.exports = __toCommonJS(sourcemap_codec_exports); - -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -})); -//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map deleted file mode 100644 index abc18d2..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/sourcemap-codec.ts", "../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts"], - "mappings": "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", - "names": [] -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/package.json b/web/node_modules/@jridgewell/sourcemap-codec/package.json deleted file mode 100644 index da55137..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@jridgewell/sourcemap-codec", - "version": "1.5.5", - "description": "Encode/decode sourcemap mappings", - "keywords": [ - "sourcemap", - "vlq" - ], - "main": "dist/sourcemap-codec.umd.js", - "module": "dist/sourcemap-codec.mjs", - "types": "types/sourcemap-codec.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/sourcemap-codec.d.mts", - "default": "./dist/sourcemap-codec.mjs" - }, - "default": { - "types": "./types/sourcemap-codec.d.cts", - "default": "./dist/sourcemap-codec.umd.js" - } - }, - "./dist/sourcemap-codec.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs sourcemap-codec.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/sourcemap-codec" - }, - "author": "Justin Ridgewell ", - "license": "MIT" -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts b/web/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts deleted file mode 100644 index d194c2f..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { StringReader, StringWriter } from './strings'; -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; - -const EMPTY: any[] = []; - -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; - -type Mix = (A & O) | (B & O); - -export type OriginalScope = Mix< - [Line, Column, Line, Column, Kind], - [Line, Column, Line, Column, Kind, Name], - { vars: Var[] } ->; - -export type GeneratedRange = Mix< - [Line, Column, Line, Column], - [Line, Column, Line, Column, SourcesIndex, ScopesIndex], - { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; - } ->; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; - -export function decodeOriginalScopes(input: string): OriginalScope[] { - const { length } = input; - const reader = new StringReader(input); - const scopes: OriginalScope[] = []; - const stack: OriginalScope[] = []; - let line = 0; - - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - - if (!hasMoreVlq(reader, length)) { - const last = stack.pop()!; - last[2] = line; - last[3] = column; - continue; - } - - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 0b0001; - - const scope: OriginalScope = ( - hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind] - ) as OriginalScope; - - let vars: Var[] = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - - scopes.push(scope); - stack.push(scope); - } - - return scopes; -} - -export function encodeOriginalScopes(scopes: OriginalScope[]): string { - const writer = new StringWriter(); - - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - - return writer.flush(); -} - -function _encodeOriginalScopes( - scopes: OriginalScope[], - index: number, - writer: StringWriter, - state: [ - number, // GenColumn - ], -): number { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - - if (index > 0) writer.write(comma); - - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - - const fields = scope.length === 6 ? 0b0001 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - - for (const v of vars) { - encodeInteger(writer, v, 0); - } - - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - - return index; -} - -export function decodeGeneratedRanges(input: string): GeneratedRange[] { - const { length } = input; - const reader = new StringReader(input); - const ranges: GeneratedRange[] = []; - const stack: GeneratedRange[] = []; - - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - - do { - const semi = reader.indexOf(';'); - let genColumn = 0; - - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop()!; - last[2] = genLine; - last[3] = genColumn; - continue; - } - - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 0b0001; - const hasCallsite = fields & 0b0010; - const hasScope = fields & 0b0100; - - let callsite: CallSite | null = null; - let bindings: Binding[] = EMPTY; - let range: GeneratedRange; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0, - ); - - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange; - } else { - range = [genLine, genColumn, 0, 0] as GeneratedRange; - } - - range.isScope = !!hasScope; - - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0, - ); - - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges: BindingExpressionRange[]; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - - ranges.push(range); - stack.push(range); - } - - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - - return ranges; -} - -export function encodeGeneratedRanges(ranges: GeneratedRange[]): string { - if (ranges.length === 0) return ''; - - const writer = new StringWriter(); - - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - - return writer.flush(); -} - -function _encodeGeneratedRanges( - ranges: GeneratedRange[], - index: number, - writer: StringWriter, - state: [ - number, // GenLine - number, // GenColumn - number, // DefSourcesIndex - number, // DefScopesIndex - number, // CallSourcesIndex - number, // CallLine - number, // CallColumn - ], -): number { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings, - } = range; - - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - - state[1] = encodeInteger(writer, range[1], state[1]); - - const fields = - (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); - encodeInteger(writer, fields, 0); - - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn); - encodeInteger(writer, expRange[0]!, 0); - } - } - } - - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - - return index; -} - -function catchupLine(writer: StringWriter, lastLine: number, line: number) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts b/web/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts deleted file mode 100644 index a81f894..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; -import { StringWriter, StringReader } from './strings'; - -export { - decodeOriginalScopes, - encodeOriginalScopes, - decodeGeneratedRanges, - encodeGeneratedRanges, -} from './scopes'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes'; - -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; - -export function decode(mappings: string): SourceMapMappings { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded: SourceMapMappings = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - do { - const semi = reader.indexOf(';'); - const line: SourceMapLine = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - - while (reader.pos < semi) { - let seg: SourceMapSegment; - - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - - line.push(seg); - reader.pos++; - } - - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - - return decoded; -} - -function sort(line: SourceMapSegment[]) { - line.sort(sortComparator); -} - -function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number { - return a[0] - b[0]; -} - -export function encode(decoded: SourceMapMappings): string; -export function encode(decoded: Readonly): string; -export function encode(decoded: Readonly): string { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - - let genColumn = 0; - - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - - genColumn = encodeInteger(writer, segment[0], genColumn); - - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - - return writer.flush(); -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/src/strings.ts b/web/node_modules/@jridgewell/sourcemap-codec/src/strings.ts deleted file mode 100644 index d161965..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +++ /dev/null @@ -1,65 +0,0 @@ -const bufLength = 1024 * 16; - -// Provide a fallback for older environments. -const td = - typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf: Uint8Array): string { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf: Uint8Array): string { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - -export class StringWriter { - pos = 0; - private out = ''; - private buffer = new Uint8Array(bufLength); - - write(v: number): void { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - - flush(): string { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -} - -export class StringReader { - pos = 0; - declare private buffer: string; - - constructor(buffer: string) { - this.buffer = buffer; - } - - next(): number { - return this.buffer.charCodeAt(this.pos++); - } - - peek(): number { - return this.buffer.charCodeAt(this.pos); - } - - indexOf(char: string): number { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts b/web/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts deleted file mode 100644 index a42c681..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { StringReader, StringWriter } from './strings'; - -export const comma = ','.charCodeAt(0); -export const semicolon = ';'.charCodeAt(0); - -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII - -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} - -export function decodeInteger(reader: StringReader, relative: number): number { - let value = 0; - let shift = 0; - let integer = 0; - - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - - const shouldNegate = value & 1; - value >>>= 1; - - if (shouldNegate) { - value = -0x80000000 | -value; - } - - return relative + value; -} - -export function encodeInteger(builder: StringWriter, num: number, relative: number): number { - let delta = num - relative; - - delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; - do { - let clamped = delta & 0b011111; - delta >>>= 5; - if (delta > 0) clamped |= 0b100000; - builder.write(intToChar[clamped]); - } while (delta > 0); - - return num; -} - -export function hasMoreVlq(reader: StringReader, max: number) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts b/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts deleted file mode 100644 index c583c75..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map deleted file mode 100644 index 630e647..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts b/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts deleted file mode 100644 index c583c75..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map deleted file mode 100644 index 630e647..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts b/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts deleted file mode 100644 index 5f35e22..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.cts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.cts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map deleted file mode 100644 index 7123d52..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts b/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts deleted file mode 100644 index 199fb9f..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.mts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.mts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map deleted file mode 100644 index 7123d52..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts b/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts deleted file mode 100644 index 62faceb..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map deleted file mode 100644 index d3602da..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts b/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts deleted file mode 100644 index 62faceb..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map deleted file mode 100644 index d3602da..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts b/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts deleted file mode 100644 index dbd6602..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.cts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map deleted file mode 100644 index 6fdc356..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts b/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts deleted file mode 100644 index 2c739bc..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.mts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map b/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map deleted file mode 100644 index 6fdc356..0000000 --- a/web/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/LICENSE b/web/node_modules/@jridgewell/trace-mapping/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@jridgewell/trace-mapping/README.md b/web/node_modules/@jridgewell/trace-mapping/README.md deleted file mode 100644 index 9fc0ed0..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/README.md +++ /dev/null @@ -1,348 +0,0 @@ -# @jridgewell/trace-mapping - -> Trace the original position through a source map - -`trace-mapping` allows you to take the line and column of an output file and trace it to the -original location in the source file through a source map. - -You may already be familiar with the [`source-map`][source-map] package's `SourceMapConsumer`. This -provides the same `originalPositionFor` and `generatedPositionFor` API, without requiring WASM. - -## Installation - -```sh -npm install @jridgewell/trace-mapping -``` - -## Usage - -```typescript -import { - TraceMap, - originalPositionFor, - generatedPositionFor, - sourceContentFor, - isIgnored, -} from '@jridgewell/trace-mapping'; - -const tracer = new TraceMap({ - version: 3, - sources: ['input.js'], - sourcesContent: ['content of input.js'], - names: ['foo'], - mappings: 'KAyCIA', - ignoreList: [], -}); - -// Lines start at line 1, columns at column 0. -const traced = originalPositionFor(tracer, { line: 1, column: 5 }); -assert.deepEqual(traced, { - source: 'input.js', - line: 42, - column: 4, - name: 'foo', -}); - -const content = sourceContentFor(tracer, traced.source); -assert.strictEqual(content, 'content for input.js'); - -const generated = generatedPositionFor(tracer, { - source: 'input.js', - line: 42, - column: 4, -}); -assert.deepEqual(generated, { - line: 1, - column: 5, -}); - -const ignored = isIgnored(tracer, 'input.js'); -assert.equal(ignored, false); -``` - -We also provide a lower level API to get the actual segment that matches our line and column. Unlike -`originalPositionFor`, `traceSegment` uses a 0-base for `line`: - -```typescript -import { traceSegment } from '@jridgewell/trace-mapping'; - -// line is 0-base. -const traced = traceSegment(tracer, /* line */ 0, /* column */ 5); - -// Segments are [outputColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex] -// Again, line is 0-base and so is sourceLine -assert.deepEqual(traced, [5, 0, 41, 4, 0]); -``` - -### SectionedSourceMaps - -The sourcemap spec defines a special `sections` field that's designed to handle concatenation of -output code with associated sourcemaps. This type of sourcemap is rarely used (no major build tool -produces it), but if you are hand coding a concatenation you may need it. We provide an `AnyMap` -helper that can receive either a regular sourcemap or a `SectionedSourceMap` and returns a -`TraceMap` instance: - -```typescript -import { AnyMap } from '@jridgewell/trace-mapping'; -const fooOutput = 'foo'; -const barOutput = 'bar'; -const output = [fooOutput, barOutput].join('\n'); - -const sectioned = new AnyMap({ - version: 3, - sections: [ - { - // 0-base line and column - offset: { line: 0, column: 0 }, - // fooOutput's sourcemap - map: { - version: 3, - sources: ['foo.js'], - names: ['foo'], - mappings: 'AAAAA', - }, - }, - { - // barOutput's sourcemap will not affect the first line, only the second - offset: { line: 1, column: 0 }, - map: { - version: 3, - sources: ['bar.js'], - names: ['bar'], - mappings: 'AAAAA', - }, - }, - ], -}); - -const traced = originalPositionFor(sectioned, { - line: 2, - column: 0, -}); - -assert.deepEqual(traced, { - source: 'bar.js', - line: 1, - column: 0, - name: 'bar', -}); -``` - -## Benchmarks - -``` -node v20.10.0 - -amp.js.map - 45120 segments - -Memory Usage: -trace-mapping decoded 414164 bytes -trace-mapping encoded 6274352 bytes -source-map-js 10968904 bytes -source-map-0.6.1 17587160 bytes -source-map-0.8.0 8812155 bytes -Chrome dev tools 8672912 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 205 ops/sec ±0.19% (88 runs sampled) -trace-mapping: encoded JSON input x 405 ops/sec ±1.47% (88 runs sampled) -trace-mapping: decoded Object input x 4,645 ops/sec ±0.15% (98 runs sampled) -trace-mapping: encoded Object input x 458 ops/sec ±1.63% (91 runs sampled) -source-map-js: encoded Object input x 75.48 ops/sec ±1.64% (67 runs sampled) -source-map-0.6.1: encoded Object input x 39.37 ops/sec ±1.44% (53 runs sampled) -Chrome dev tools: encoded Object input x 150 ops/sec ±1.76% (79 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed (random): -trace-mapping: decoded originalPositionFor x 44,946 ops/sec ±0.16% (99 runs sampled) -trace-mapping: encoded originalPositionFor x 37,995 ops/sec ±1.81% (89 runs sampled) -source-map-js: encoded originalPositionFor x 9,230 ops/sec ±1.36% (93 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 8,057 ops/sec ±0.84% (96 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 28,198 ops/sec ±1.12% (91 runs sampled) -Chrome dev tools: encoded originalPositionFor x 46,276 ops/sec ±1.35% (95 runs sampled) -Fastest is Chrome dev tools: encoded originalPositionFor - -Trace speed (ascending): -trace-mapping: decoded originalPositionFor x 204,406 ops/sec ±0.19% (97 runs sampled) -trace-mapping: encoded originalPositionFor x 196,695 ops/sec ±0.24% (99 runs sampled) -source-map-js: encoded originalPositionFor x 11,948 ops/sec ±0.94% (99 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 10,730 ops/sec ±0.36% (100 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 51,427 ops/sec ±0.21% (98 runs sampled) -Chrome dev tools: encoded originalPositionFor x 162,615 ops/sec ±0.18% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -babel.min.js.map - 347793 segments - -Memory Usage: -trace-mapping decoded 18504 bytes -trace-mapping encoded 35428008 bytes -source-map-js 51676808 bytes -source-map-0.6.1 63367136 bytes -source-map-0.8.0 43158400 bytes -Chrome dev tools 50721552 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 17.82 ops/sec ±6.35% (35 runs sampled) -trace-mapping: encoded JSON input x 31.57 ops/sec ±7.50% (43 runs sampled) -trace-mapping: decoded Object input x 867 ops/sec ±0.74% (94 runs sampled) -trace-mapping: encoded Object input x 33.83 ops/sec ±7.66% (46 runs sampled) -source-map-js: encoded Object input x 6.58 ops/sec ±3.31% (20 runs sampled) -source-map-0.6.1: encoded Object input x 4.23 ops/sec ±3.43% (15 runs sampled) -Chrome dev tools: encoded Object input x 22.14 ops/sec ±3.79% (41 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed (random): -trace-mapping: decoded originalPositionFor x 78,234 ops/sec ±1.48% (29 runs sampled) -trace-mapping: encoded originalPositionFor x 60,761 ops/sec ±1.35% (21 runs sampled) -source-map-js: encoded originalPositionFor x 51,448 ops/sec ±2.17% (89 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 47,221 ops/sec ±1.99% (15 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 84,002 ops/sec ±1.45% (27 runs sampled) -Chrome dev tools: encoded originalPositionFor x 106,457 ops/sec ±1.38% (37 runs sampled) -Fastest is Chrome dev tools: encoded originalPositionFor - -Trace speed (ascending): -trace-mapping: decoded originalPositionFor x 930,943 ops/sec ±0.25% (99 runs sampled) -trace-mapping: encoded originalPositionFor x 843,545 ops/sec ±0.34% (97 runs sampled) -source-map-js: encoded originalPositionFor x 114,510 ops/sec ±1.37% (36 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 87,412 ops/sec ±0.72% (92 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 197,709 ops/sec ±0.89% (59 runs sampled) -Chrome dev tools: encoded originalPositionFor x 688,983 ops/sec ±0.33% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -preact.js.map - 1992 segments - -Memory Usage: -trace-mapping decoded 33136 bytes -trace-mapping encoded 254240 bytes -source-map-js 837488 bytes -source-map-0.6.1 961928 bytes -source-map-0.8.0 54384 bytes -Chrome dev tools 709680 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 3,709 ops/sec ±0.13% (99 runs sampled) -trace-mapping: encoded JSON input x 6,447 ops/sec ±0.22% (101 runs sampled) -trace-mapping: decoded Object input x 83,062 ops/sec ±0.23% (100 runs sampled) -trace-mapping: encoded Object input x 14,980 ops/sec ±0.28% (100 runs sampled) -source-map-js: encoded Object input x 2,544 ops/sec ±0.16% (99 runs sampled) -source-map-0.6.1: encoded Object input x 1,221 ops/sec ±0.37% (97 runs sampled) -Chrome dev tools: encoded Object input x 4,241 ops/sec ±0.39% (93 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed (random): -trace-mapping: decoded originalPositionFor x 91,028 ops/sec ±0.14% (94 runs sampled) -trace-mapping: encoded originalPositionFor x 84,348 ops/sec ±0.26% (98 runs sampled) -source-map-js: encoded originalPositionFor x 26,998 ops/sec ±0.23% (98 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 18,049 ops/sec ±0.26% (100 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 41,916 ops/sec ±0.28% (98 runs sampled) -Chrome dev tools: encoded originalPositionFor x 88,616 ops/sec ±0.14% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - -Trace speed (ascending): -trace-mapping: decoded originalPositionFor x 319,960 ops/sec ±0.16% (100 runs sampled) -trace-mapping: encoded originalPositionFor x 302,153 ops/sec ±0.18% (100 runs sampled) -source-map-js: encoded originalPositionFor x 35,574 ops/sec ±0.19% (100 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 19,943 ops/sec ±0.12% (101 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 54,648 ops/sec ±0.20% (99 runs sampled) -Chrome dev tools: encoded originalPositionFor x 278,319 ops/sec ±0.17% (102 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -react.js.map - 5726 segments - -Memory Usage: -trace-mapping decoded 10872 bytes -trace-mapping encoded 681512 bytes -source-map-js 2563944 bytes -source-map-0.6.1 2150864 bytes -source-map-0.8.0 88680 bytes -Chrome dev tools 1149576 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 1,887 ops/sec ±0.28% (99 runs sampled) -trace-mapping: encoded JSON input x 4,749 ops/sec ±0.48% (97 runs sampled) -trace-mapping: decoded Object input x 74,236 ops/sec ±0.11% (99 runs sampled) -trace-mapping: encoded Object input x 5,752 ops/sec ±0.38% (100 runs sampled) -source-map-js: encoded Object input x 806 ops/sec ±0.19% (97 runs sampled) -source-map-0.6.1: encoded Object input x 418 ops/sec ±0.33% (94 runs sampled) -Chrome dev tools: encoded Object input x 1,524 ops/sec ±0.57% (92 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed (random): -trace-mapping: decoded originalPositionFor x 620,201 ops/sec ±0.33% (96 runs sampled) -trace-mapping: encoded originalPositionFor x 579,548 ops/sec ±0.35% (97 runs sampled) -source-map-js: encoded originalPositionFor x 230,983 ops/sec ±0.62% (54 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 158,145 ops/sec ±0.80% (46 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 343,801 ops/sec ±0.55% (96 runs sampled) -Chrome dev tools: encoded originalPositionFor x 659,649 ops/sec ±0.49% (98 runs sampled) -Fastest is Chrome dev tools: encoded originalPositionFor - -Trace speed (ascending): -trace-mapping: decoded originalPositionFor x 2,368,079 ops/sec ±0.32% (98 runs sampled) -trace-mapping: encoded originalPositionFor x 2,134,039 ops/sec ±2.72% (87 runs sampled) -source-map-js: encoded originalPositionFor x 290,120 ops/sec ±2.49% (82 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 187,613 ops/sec ±0.86% (49 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 479,569 ops/sec ±0.65% (96 runs sampled) -Chrome dev tools: encoded originalPositionFor x 2,048,414 ops/sec ±0.24% (98 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - - -*** - - -vscode.map - 2141001 segments - -Memory Usage: -trace-mapping decoded 5206584 bytes -trace-mapping encoded 208370336 bytes -source-map-js 278493008 bytes -source-map-0.6.1 391564048 bytes -source-map-0.8.0 257508787 bytes -Chrome dev tools 291053000 bytes -Smallest memory usage is trace-mapping decoded - -Init speed: -trace-mapping: decoded JSON input x 1.63 ops/sec ±33.88% (9 runs sampled) -trace-mapping: encoded JSON input x 3.29 ops/sec ±36.13% (13 runs sampled) -trace-mapping: decoded Object input x 103 ops/sec ±0.93% (77 runs sampled) -trace-mapping: encoded Object input x 5.42 ops/sec ±28.54% (19 runs sampled) -source-map-js: encoded Object input x 1.07 ops/sec ±13.84% (7 runs sampled) -source-map-0.6.1: encoded Object input x 0.60 ops/sec ±2.43% (6 runs sampled) -Chrome dev tools: encoded Object input x 2.61 ops/sec ±22.00% (11 runs sampled) -Fastest is trace-mapping: decoded Object input - -Trace speed (random): -trace-mapping: decoded originalPositionFor x 257,019 ops/sec ±0.97% (93 runs sampled) -trace-mapping: encoded originalPositionFor x 179,163 ops/sec ±0.83% (92 runs sampled) -source-map-js: encoded originalPositionFor x 73,337 ops/sec ±1.35% (87 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 38,797 ops/sec ±1.66% (88 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 107,758 ops/sec ±1.94% (45 runs sampled) -Chrome dev tools: encoded originalPositionFor x 188,550 ops/sec ±1.85% (79 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor - -Trace speed (ascending): -trace-mapping: decoded originalPositionFor x 447,621 ops/sec ±3.64% (94 runs sampled) -trace-mapping: encoded originalPositionFor x 323,698 ops/sec ±5.20% (88 runs sampled) -source-map-js: encoded originalPositionFor x 78,387 ops/sec ±1.69% (89 runs sampled) -source-map-0.6.1: encoded originalPositionFor x 41,016 ops/sec ±3.01% (25 runs sampled) -source-map-0.8.0: encoded originalPositionFor x 124,204 ops/sec ±0.90% (92 runs sampled) -Chrome dev tools: encoded originalPositionFor x 230,087 ops/sec ±2.61% (93 runs sampled) -Fastest is trace-mapping: decoded originalPositionFor -``` - -[source-map]: https://www.npmjs.com/package/source-map diff --git a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs b/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs deleted file mode 100644 index 73a95c7..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +++ /dev/null @@ -1,493 +0,0 @@ -// src/trace-mapping.ts -import { encode, decode } from "@jridgewell/sourcemap-codec"; - -// src/resolve.ts -import resolveUri from "@jridgewell/resolve-uri"; - -// src/strip-filename.ts -function stripFilename(path) { - if (!path) return ""; - const index = path.lastIndexOf("/"); - return path.slice(0, index + 1); -} - -// src/resolve.ts -function resolver(mapUrl, sourceRoot) { - const from = stripFilename(mapUrl); - const prefix = sourceRoot ? sourceRoot + "/" : ""; - return (source) => resolveUri(prefix + (source || ""), from); -} - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; -var REV_GENERATED_LINE = 1; -var REV_GENERATED_COLUMN = 2; - -// src/sort.ts -function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) return mappings; - if (!owned) mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; -} -function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) return i; - } - return mappings.length; -} -function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; -} -function sortSegments(line, owned) { - if (!owned) line = line.slice(); - return line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; -} - -// src/by-source.ts -function buildBySources(decoded, memos) { - const sources = memos.map(() => []); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) continue; - const sourceIndex2 = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const source = sources[sourceIndex2]; - const segs = source[sourceLine] || (source[sourceLine] = []); - segs.push([sourceColumn, i, seg[COLUMN]]); - } - } - for (let i = 0; i < sources.length; i++) { - const source = sources[i]; - for (let j = 0; j < source.length; j++) { - const line = source[j]; - if (line) line.sort(sortComparator); - } - } - return sources; -} - -// src/binary-search.ts -var found = false; -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + (high - low >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1 - }; -} -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - low = lastIndex === -1 ? 0 : lastIndex; - } else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return state.lastIndex = binarySearch(haystack, needle, low, high); -} - -// src/types.ts -function parse(map) { - return typeof map === "string" ? JSON.parse(map) : map; -} - -// src/flatten-map.ts -var FlattenMap = function(map, mapUrl) { - const parsed = parse(map); - if (!("sections" in parsed)) { - return new TraceMap(parsed, mapUrl); - } - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - const ignoreList = []; - recurse( - parsed, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - 0, - 0, - Infinity, - Infinity - ); - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - ignoreList - }; - return presortedDecodedMap(joined); -}; -function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) { - const { sections } = input; - for (let i = 0; i < sections.length; i++) { - const { map, offset } = sections[i]; - let sl = stopLine; - let sc = stopColumn; - if (i + 1 < sections.length) { - const nextOffset = sections[i + 1].offset; - sl = Math.min(stopLine, lineOffset + nextOffset.line); - if (sl === stopLine) { - sc = Math.min(stopColumn, columnOffset + nextOffset.column); - } else if (sl < stopLine) { - sc = columnOffset + nextOffset.column; - } - } - addSection( - map, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - lineOffset + offset.line, - columnOffset + offset.column, - sl, - sc - ); - } -} -function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) { - const parsed = parse(input); - if ("sections" in parsed) return recurse(...arguments); - const map = new TraceMap(parsed, mapUrl); - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = decodedMappings(map); - const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map; - append(sources, resolvedSources); - append(names, map.names); - if (contents) append(sourcesContent, contents); - else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); - if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset); - for (let i = 0; i < decoded.length; i++) { - const lineI = lineOffset + i; - if (lineI > stopLine) return; - const out = getLine(mappings, lineI); - const cOffset = i === 0 ? columnOffset : 0; - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - if (lineI === stopLine && column >= stopColumn) return; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - out.push( - seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]] - ); - } - } -} -function append(arr, other) { - for (let i = 0; i < other.length; i++) arr.push(other[i]); -} -function getLine(arr, index) { - for (let i = arr.length; i <= index; i++) arr[i] = []; - return arr[index]; -} - -// src/trace-mapping.ts -var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; -var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; -var LEAST_UPPER_BOUND = -1; -var GREATEST_LOWER_BOUND = 1; -var TraceMap = class { - constructor(map, mapUrl) { - const isString = typeof map === "string"; - if (!isString && map._decodedMemo) return map; - const parsed = parse(map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names || []; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0; - const resolve = resolver(mapUrl, sourceRoot); - this.resolvedSources = sources.map(resolve); - const { mappings } = parsed; - if (typeof mappings === "string") { - this._encoded = mappings; - this._decoded = void 0; - } else if (Array.isArray(mappings)) { - this._encoded = void 0; - this._decoded = maybeSort(mappings, isString); - } else if (parsed.sections) { - throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`); - } else { - throw new Error(`invalid source map: ${JSON.stringify(parsed)}`); - } - this._decodedMemo = memoizedState(); - this._bySources = void 0; - this._bySourceMemos = void 0; - } -}; -function cast(map) { - return map; -} -function encodedMappings(map) { - var _a, _b; - return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = encode(cast(map)._decoded); -} -function decodedMappings(map) { - var _a; - return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded)); -} -function traceSegment(map, line, column) { - const decoded = decodedMappings(map); - if (line >= decoded.length) return null; - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - GREATEST_LOWER_BOUND - ); - return index === -1 ? null : segments[index]; -} -function originalPositionFor(map, needle) { - let { line, column, bias } = needle; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - if (line >= decoded.length) return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - bias || GREATEST_LOWER_BOUND - ); - if (index === -1) return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping( - resolvedSources[segment[SOURCES_INDEX]], - segment[SOURCE_LINE] + 1, - segment[SOURCE_COLUMN], - segment.length === 5 ? names[segment[NAMES_INDEX]] : null - ); -} -function generatedPositionFor(map, needle) { - const { source, line, column, bias } = needle; - return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); -} -function allGeneratedPositionsFor(map, needle) { - const { source, line, column, bias } = needle; - return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); -} -function eachMapping(map, cb) { - const decoded = decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name - }); - } - } -} -function sourceIndex(map, source) { - const { sources, resolvedSources } = map; - let index = sources.indexOf(source); - if (index === -1) index = resolvedSources.indexOf(source); - return index; -} -function sourceContentFor(map, source) { - const { sourcesContent } = map; - if (sourcesContent == null) return null; - const index = sourceIndex(map, source); - return index === -1 ? null : sourcesContent[index]; -} -function isIgnored(map, source) { - const { ignoreList } = map; - if (ignoreList == null) return false; - const index = sourceIndex(map, source); - return index === -1 ? false : ignoreList.includes(index); -} -function presortedDecodedMap(map, mapUrl) { - const tracer = new TraceMap(clone(map, []), mapUrl); - cast(tracer)._decoded = map.mappings; - return tracer; -} -function decodedMap(map) { - return clone(map, decodedMappings(map)); -} -function encodedMap(map) { - return clone(map, encodedMappings(map)); -} -function clone(map, mappings) { - return { - version: map.version, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings, - ignoreList: map.ignoreList || map.x_google_ignoreList - }; -} -function OMapping(source, line, column, name) { - return { source, line, column, name }; -} -function GMapping(line, column) { - return { line, column }; -} -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } else if (bias === LEAST_UPPER_BOUND) index++; - if (index === -1 || index === segments.length) return -1; - return index; -} -function sliceGeneratedPositions(segments, memo, line, column, bias) { - let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); - if (!found && bias === LEAST_UPPER_BOUND) min++; - if (min === -1 || min === segments.length) return []; - const matchedColumn = found ? column : segments[min][COLUMN]; - if (!found) min = lowerBound(segments, matchedColumn, min); - const max = upperBound(segments, matchedColumn, min); - const result = []; - for (; min <= max; min++) { - const segment = segments[min]; - result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); - } - return result; -} -function generatedPosition(map, source, line, column, bias, all) { - var _a, _b; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex2 = sources.indexOf(source); - if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source); - if (sourceIndex2 === -1) return all ? [] : GMapping(null, null); - const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState)); - const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos)); - const segments = generated[sourceIndex2][line]; - if (segments == null) return all ? [] : GMapping(null, null); - const memo = bySourceMemos[sourceIndex2]; - if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); - const index = traceSegmentInternal(segments, memo, line, column, bias); - if (index === -1) return GMapping(null, null); - const segment = segments[index]; - return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); -} -export { - FlattenMap as AnyMap, - FlattenMap, - GREATEST_LOWER_BOUND, - LEAST_UPPER_BOUND, - TraceMap, - allGeneratedPositionsFor, - decodedMap, - decodedMappings, - eachMapping, - encodedMap, - encodedMappings, - generatedPositionFor, - isIgnored, - originalPositionFor, - presortedDecodedMap, - sourceContentFor, - traceSegment -}; -//# sourceMappingURL=trace-mapping.mjs.map diff --git a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map b/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map deleted file mode 100644 index a789581..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/trace-mapping.ts", "../src/resolve.ts", "../src/strip-filename.ts", "../src/sourcemap-segment.ts", "../src/sort.ts", "../src/by-source.ts", "../src/binary-search.ts", "../src/types.ts", "../src/flatten-map.ts"], - "mappings": "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", - "names": ["sourceIndex", "sourceIndex"] -} diff --git a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js b/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js deleted file mode 100644 index 0387ae3..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +++ /dev/null @@ -1,559 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module, require('@jridgewell/resolve-uri'), require('@jridgewell/sourcemap-codec')); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module', '@jridgewell/resolve-uri', '@jridgewell/sourcemap-codec'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod, global.resolveURI, global.sourcemapCodec); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.traceMapping = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module, require_resolveURI, require_sourcemapCodec) { -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __commonJS = (cb, mod) => function __require() { - return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; -}; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// umd:@jridgewell/sourcemap-codec -var require_sourcemap_codec = __commonJS({ - "umd:@jridgewell/sourcemap-codec"(exports, module2) { - module2.exports = require_sourcemapCodec; - } -}); - -// umd:@jridgewell/resolve-uri -var require_resolve_uri = __commonJS({ - "umd:@jridgewell/resolve-uri"(exports, module2) { - module2.exports = require_resolveURI; - } -}); - -// src/trace-mapping.ts -var trace_mapping_exports = {}; -__export(trace_mapping_exports, { - AnyMap: () => FlattenMap, - FlattenMap: () => FlattenMap, - GREATEST_LOWER_BOUND: () => GREATEST_LOWER_BOUND, - LEAST_UPPER_BOUND: () => LEAST_UPPER_BOUND, - TraceMap: () => TraceMap, - allGeneratedPositionsFor: () => allGeneratedPositionsFor, - decodedMap: () => decodedMap, - decodedMappings: () => decodedMappings, - eachMapping: () => eachMapping, - encodedMap: () => encodedMap, - encodedMappings: () => encodedMappings, - generatedPositionFor: () => generatedPositionFor, - isIgnored: () => isIgnored, - originalPositionFor: () => originalPositionFor, - presortedDecodedMap: () => presortedDecodedMap, - sourceContentFor: () => sourceContentFor, - traceSegment: () => traceSegment -}); -module.exports = __toCommonJS(trace_mapping_exports); -var import_sourcemap_codec = __toESM(require_sourcemap_codec()); - -// src/resolve.ts -var import_resolve_uri = __toESM(require_resolve_uri()); - -// src/strip-filename.ts -function stripFilename(path) { - if (!path) return ""; - const index = path.lastIndexOf("/"); - return path.slice(0, index + 1); -} - -// src/resolve.ts -function resolver(mapUrl, sourceRoot) { - const from = stripFilename(mapUrl); - const prefix = sourceRoot ? sourceRoot + "/" : ""; - return (source) => (0, import_resolve_uri.default)(prefix + (source || ""), from); -} - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; -var REV_GENERATED_LINE = 1; -var REV_GENERATED_COLUMN = 2; - -// src/sort.ts -function maybeSort(mappings, owned) { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) return mappings; - if (!owned) mappings = mappings.slice(); - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; -} -function nextUnsortedSegmentLine(mappings, start) { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) return i; - } - return mappings.length; -} -function isSorted(line) { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; -} -function sortSegments(line, owned) { - if (!owned) line = line.slice(); - return line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[COLUMN] - b[COLUMN]; -} - -// src/by-source.ts -function buildBySources(decoded, memos) { - const sources = memos.map(() => []); - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) continue; - const sourceIndex2 = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - const source = sources[sourceIndex2]; - const segs = source[sourceLine] || (source[sourceLine] = []); - segs.push([sourceColumn, i, seg[COLUMN]]); - } - } - for (let i = 0; i < sources.length; i++) { - const source = sources[i]; - for (let j = 0; j < source.length; j++) { - const line = source[j]; - if (line) line.sort(sortComparator); - } - } - return sources; -} - -// src/binary-search.ts -var found = false; -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + (high - low >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1 - }; -} -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - low = lastIndex === -1 ? 0 : lastIndex; - } else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return state.lastIndex = binarySearch(haystack, needle, low, high); -} - -// src/types.ts -function parse(map) { - return typeof map === "string" ? JSON.parse(map) : map; -} - -// src/flatten-map.ts -var FlattenMap = function(map, mapUrl) { - const parsed = parse(map); - if (!("sections" in parsed)) { - return new TraceMap(parsed, mapUrl); - } - const mappings = []; - const sources = []; - const sourcesContent = []; - const names = []; - const ignoreList = []; - recurse( - parsed, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - 0, - 0, - Infinity, - Infinity - ); - const joined = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - ignoreList - }; - return presortedDecodedMap(joined); -}; -function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) { - const { sections } = input; - for (let i = 0; i < sections.length; i++) { - const { map, offset } = sections[i]; - let sl = stopLine; - let sc = stopColumn; - if (i + 1 < sections.length) { - const nextOffset = sections[i + 1].offset; - sl = Math.min(stopLine, lineOffset + nextOffset.line); - if (sl === stopLine) { - sc = Math.min(stopColumn, columnOffset + nextOffset.column); - } else if (sl < stopLine) { - sc = columnOffset + nextOffset.column; - } - } - addSection( - map, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - lineOffset + offset.line, - columnOffset + offset.column, - sl, - sc - ); - } -} -function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) { - const parsed = parse(input); - if ("sections" in parsed) return recurse(...arguments); - const map = new TraceMap(parsed, mapUrl); - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = decodedMappings(map); - const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map; - append(sources, resolvedSources); - append(names, map.names); - if (contents) append(sourcesContent, contents); - else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); - if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset); - for (let i = 0; i < decoded.length; i++) { - const lineI = lineOffset + i; - if (lineI > stopLine) return; - const out = getLine(mappings, lineI); - const cOffset = i === 0 ? columnOffset : 0; - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - if (lineI === stopLine && column >= stopColumn) return; - if (seg.length === 1) { - out.push([column]); - continue; - } - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - out.push( - seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]] - ); - } - } -} -function append(arr, other) { - for (let i = 0; i < other.length; i++) arr.push(other[i]); -} -function getLine(arr, index) { - for (let i = arr.length; i <= index; i++) arr[i] = []; - return arr[index]; -} - -// src/trace-mapping.ts -var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; -var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; -var LEAST_UPPER_BOUND = -1; -var GREATEST_LOWER_BOUND = 1; -var TraceMap = class { - constructor(map, mapUrl) { - const isString = typeof map === "string"; - if (!isString && map._decodedMemo) return map; - const parsed = parse(map); - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names || []; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0; - const resolve = resolver(mapUrl, sourceRoot); - this.resolvedSources = sources.map(resolve); - const { mappings } = parsed; - if (typeof mappings === "string") { - this._encoded = mappings; - this._decoded = void 0; - } else if (Array.isArray(mappings)) { - this._encoded = void 0; - this._decoded = maybeSort(mappings, isString); - } else if (parsed.sections) { - throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`); - } else { - throw new Error(`invalid source map: ${JSON.stringify(parsed)}`); - } - this._decodedMemo = memoizedState(); - this._bySources = void 0; - this._bySourceMemos = void 0; - } -}; -function cast(map) { - return map; -} -function encodedMappings(map) { - var _a, _b; - return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = (0, import_sourcemap_codec.encode)(cast(map)._decoded); -} -function decodedMappings(map) { - var _a; - return (_a = cast(map))._decoded || (_a._decoded = (0, import_sourcemap_codec.decode)(cast(map)._encoded)); -} -function traceSegment(map, line, column) { - const decoded = decodedMappings(map); - if (line >= decoded.length) return null; - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - GREATEST_LOWER_BOUND - ); - return index === -1 ? null : segments[index]; -} -function originalPositionFor(map, needle) { - let { line, column, bias } = needle; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - if (line >= decoded.length) return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - bias || GREATEST_LOWER_BOUND - ); - if (index === -1) return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping( - resolvedSources[segment[SOURCES_INDEX]], - segment[SOURCE_LINE] + 1, - segment[SOURCE_COLUMN], - segment.length === 5 ? names[segment[NAMES_INDEX]] : null - ); -} -function generatedPositionFor(map, needle) { - const { source, line, column, bias } = needle; - return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); -} -function allGeneratedPositionsFor(map, needle) { - const { source, line, column, bias } = needle; - return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); -} -function eachMapping(map, cb) { - const decoded = decodedMappings(map); - const { names, resolvedSources } = map; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) name = names[seg[4]]; - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name - }); - } - } -} -function sourceIndex(map, source) { - const { sources, resolvedSources } = map; - let index = sources.indexOf(source); - if (index === -1) index = resolvedSources.indexOf(source); - return index; -} -function sourceContentFor(map, source) { - const { sourcesContent } = map; - if (sourcesContent == null) return null; - const index = sourceIndex(map, source); - return index === -1 ? null : sourcesContent[index]; -} -function isIgnored(map, source) { - const { ignoreList } = map; - if (ignoreList == null) return false; - const index = sourceIndex(map, source); - return index === -1 ? false : ignoreList.includes(index); -} -function presortedDecodedMap(map, mapUrl) { - const tracer = new TraceMap(clone(map, []), mapUrl); - cast(tracer)._decoded = map.mappings; - return tracer; -} -function decodedMap(map) { - return clone(map, decodedMappings(map)); -} -function encodedMap(map) { - return clone(map, encodedMappings(map)); -} -function clone(map, mappings) { - return { - version: map.version, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings, - ignoreList: map.ignoreList || map.x_google_ignoreList - }; -} -function OMapping(source, line, column, name) { - return { source, line, column, name }; -} -function GMapping(line, column) { - return { line, column }; -} -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } else if (bias === LEAST_UPPER_BOUND) index++; - if (index === -1 || index === segments.length) return -1; - return index; -} -function sliceGeneratedPositions(segments, memo, line, column, bias) { - let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); - if (!found && bias === LEAST_UPPER_BOUND) min++; - if (min === -1 || min === segments.length) return []; - const matchedColumn = found ? column : segments[min][COLUMN]; - if (!found) min = lowerBound(segments, matchedColumn, min); - const max = upperBound(segments, matchedColumn, min); - const result = []; - for (; min <= max; min++) { - const segment = segments[min]; - result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); - } - return result; -} -function generatedPosition(map, source, line, column, bias, all) { - var _a, _b; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const { sources, resolvedSources } = map; - let sourceIndex2 = sources.indexOf(source); - if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source); - if (sourceIndex2 === -1) return all ? [] : GMapping(null, null); - const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState)); - const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos)); - const segments = generated[sourceIndex2][line]; - if (segments == null) return all ? [] : GMapping(null, null); - const memo = bySourceMemos[sourceIndex2]; - if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); - const index = traceSegmentInternal(segments, memo, line, column, bias); - if (index === -1) return GMapping(null, null); - const segment = segments[index]; - return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); -} -})); -//# sourceMappingURL=trace-mapping.umd.js.map diff --git a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map b/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map deleted file mode 100644 index 68b0c77..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["umd:@jridgewell/sourcemap-codec", "umd:@jridgewell/resolve-uri", "../src/trace-mapping.ts", "../src/resolve.ts", "../src/strip-filename.ts", "../src/sourcemap-segment.ts", "../src/sort.ts", "../src/by-source.ts", "../src/binary-search.ts", "../src/types.ts", "../src/flatten-map.ts"], - "mappings": "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", - "names": ["module", "module", "resolveUri", "sourceIndex", "sourceIndex"] -} diff --git a/web/node_modules/@jridgewell/trace-mapping/package.json b/web/node_modules/@jridgewell/trace-mapping/package.json deleted file mode 100644 index 9d3a1c0..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@jridgewell/trace-mapping", - "version": "0.3.31", - "description": "Trace the original position through a source map", - "keywords": [ - "source", - "map" - ], - "main": "dist/trace-mapping.umd.js", - "module": "dist/trace-mapping.mjs", - "types": "types/trace-mapping.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/trace-mapping.d.mts", - "default": "./dist/trace-mapping.mjs" - }, - "default": { - "types": "./types/trace-mapping.d.cts", - "default": "./dist/trace-mapping.umd.js" - } - }, - "./dist/trace-mapping.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.mjs", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs trace-mapping.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/trace-mapping", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/trace-mapping" - }, - "author": "Justin Ridgewell ", - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/binary-search.ts b/web/node_modules/@jridgewell/trace-mapping/src/binary-search.ts deleted file mode 100644 index c1144ad..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/binary-search.ts +++ /dev/null @@ -1,115 +0,0 @@ -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment'; -import { COLUMN } from './sourcemap-segment'; - -export type MemoState = { - lastKey: number; - lastNeedle: number; - lastIndex: number; -}; - -export let found = false; - -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -export function binarySearch( - haystack: SourceMapSegment[] | ReverseSegment[], - needle: number, - low: number, - high: number, -): number { - while (low <= high) { - const mid = low + ((high - low) >> 1); - const cmp = haystack[mid][COLUMN] - needle; - - if (cmp === 0) { - found = true; - return mid; - } - - if (cmp < 0) { - low = mid + 1; - } else { - high = mid - 1; - } - } - - found = false; - return low - 1; -} - -export function upperBound( - haystack: SourceMapSegment[] | ReverseSegment[], - needle: number, - index: number, -): number { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} - -export function lowerBound( - haystack: SourceMapSegment[] | ReverseSegment[], - needle: number, - index: number, -): number { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} - -export function memoizedState(): MemoState { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1, - }; -} - -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -export function memoizedBinarySearch( - haystack: SourceMapSegment[] | ReverseSegment[], - needle: number, - state: MemoState, - key: number, -): number { - const { lastKey, lastNeedle, lastIndex } = state; - - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - - if (needle >= lastNeedle) { - // lastIndex may be -1 if the previous needle was not found. - low = lastIndex === -1 ? 0 : lastIndex; - } else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - - return (state.lastIndex = binarySearch(haystack, needle, low, high)); -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/by-source.ts b/web/node_modules/@jridgewell/trace-mapping/src/by-source.ts deleted file mode 100644 index 1da6af0..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/by-source.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { COLUMN, SOURCES_INDEX, SOURCE_LINE, SOURCE_COLUMN } from './sourcemap-segment'; -import { sortComparator } from './sort'; - -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment'; - -export type Source = ReverseSegment[][]; - -// Rebuilds the original source files, with mappings that are ordered by source line/column instead -// of generated line/column. -export default function buildBySources( - decoded: readonly SourceMapSegment[][], - memos: unknown[], -): Source[] { - const sources: Source[] = memos.map(() => []); - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - if (seg.length === 1) continue; - - const sourceIndex = seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - - const source = sources[sourceIndex]; - const segs = (source[sourceLine] ||= []); - segs.push([sourceColumn, i, seg[COLUMN]]); - } - } - - for (let i = 0; i < sources.length; i++) { - const source = sources[i]; - for (let j = 0; j < source.length; j++) { - const line = source[j]; - if (line) line.sort(sortComparator); - } - } - - return sources; -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/flatten-map.ts b/web/node_modules/@jridgewell/trace-mapping/src/flatten-map.ts deleted file mode 100644 index 61ac40c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/flatten-map.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { TraceMap, presortedDecodedMap, decodedMappings } from './trace-mapping'; -import { - COLUMN, - SOURCES_INDEX, - SOURCE_LINE, - SOURCE_COLUMN, - NAMES_INDEX, -} from './sourcemap-segment'; -import { parse } from './types'; - -import type { - DecodedSourceMap, - DecodedSourceMapXInput, - EncodedSourceMapXInput, - SectionedSourceMapXInput, - SectionedSourceMapInput, - SectionXInput, - Ro, -} from './types'; -import type { SourceMapSegment } from './sourcemap-segment'; - -type FlattenMap = { - new (map: Ro, mapUrl?: string | null): TraceMap; - (map: Ro, mapUrl?: string | null): TraceMap; -}; - -export const FlattenMap: FlattenMap = function (map, mapUrl) { - const parsed = parse(map as SectionedSourceMapInput); - - if (!('sections' in parsed)) { - return new TraceMap(parsed as DecodedSourceMapXInput | EncodedSourceMapXInput, mapUrl); - } - - const mappings: SourceMapSegment[][] = []; - const sources: string[] = []; - const sourcesContent: (string | null)[] = []; - const names: string[] = []; - const ignoreList: number[] = []; - - recurse( - parsed, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - 0, - 0, - Infinity, - Infinity, - ); - - const joined: DecodedSourceMap = { - version: 3, - file: parsed.file, - names, - sources, - sourcesContent, - mappings, - ignoreList, - }; - - return presortedDecodedMap(joined); -} as FlattenMap; - -function recurse( - input: SectionedSourceMapXInput, - mapUrl: string | null | undefined, - mappings: SourceMapSegment[][], - sources: string[], - sourcesContent: (string | null)[], - names: string[], - ignoreList: number[], - lineOffset: number, - columnOffset: number, - stopLine: number, - stopColumn: number, -) { - const { sections } = input; - for (let i = 0; i < sections.length; i++) { - const { map, offset } = sections[i]; - - let sl = stopLine; - let sc = stopColumn; - if (i + 1 < sections.length) { - const nextOffset = sections[i + 1].offset; - sl = Math.min(stopLine, lineOffset + nextOffset.line); - - if (sl === stopLine) { - sc = Math.min(stopColumn, columnOffset + nextOffset.column); - } else if (sl < stopLine) { - sc = columnOffset + nextOffset.column; - } - } - - addSection( - map, - mapUrl, - mappings, - sources, - sourcesContent, - names, - ignoreList, - lineOffset + offset.line, - columnOffset + offset.column, - sl, - sc, - ); - } -} - -function addSection( - input: SectionXInput['map'], - mapUrl: string | null | undefined, - mappings: SourceMapSegment[][], - sources: string[], - sourcesContent: (string | null)[], - names: string[], - ignoreList: number[], - lineOffset: number, - columnOffset: number, - stopLine: number, - stopColumn: number, -) { - const parsed = parse(input); - if ('sections' in parsed) return recurse(...(arguments as unknown as Parameters)); - - const map = new TraceMap(parsed, mapUrl); - const sourcesOffset = sources.length; - const namesOffset = names.length; - const decoded = decodedMappings(map); - const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map; - - append(sources, resolvedSources); - append(names, map.names); - - if (contents) append(sourcesContent, contents); - else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null); - - if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset); - - for (let i = 0; i < decoded.length; i++) { - const lineI = lineOffset + i; - - // We can only add so many lines before we step into the range that the next section's map - // controls. When we get to the last line, then we'll start checking the segments to see if - // they've crossed into the column range. But it may not have any columns that overstep, so we - // still need to check that we don't overstep lines, too. - if (lineI > stopLine) return; - - // The out line may already exist in mappings (if we're continuing the line started by a - // previous section). Or, we may have jumped ahead several lines to start this section. - const out = getLine(mappings, lineI); - // On the 0th loop, the section's column offset shifts us forward. On all other lines (since the - // map can be multiple lines), it doesn't. - const cOffset = i === 0 ? columnOffset : 0; - - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - const column = cOffset + seg[COLUMN]; - - // If this segment steps into the column range that the next section's map controls, we need - // to stop early. - if (lineI === stopLine && column >= stopColumn) return; - - if (seg.length === 1) { - out.push([column]); - continue; - } - - const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX]; - const sourceLine = seg[SOURCE_LINE]; - const sourceColumn = seg[SOURCE_COLUMN]; - out.push( - seg.length === 4 - ? [column, sourcesIndex, sourceLine, sourceColumn] - : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]], - ); - } - } -} - -function append(arr: T[], other: T[]) { - for (let i = 0; i < other.length; i++) arr.push(other[i]); -} - -function getLine(arr: T[][], index: number): T[] { - for (let i = arr.length; i <= index; i++) arr[i] = []; - return arr[index]; -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/resolve.ts b/web/node_modules/@jridgewell/trace-mapping/src/resolve.ts deleted file mode 100644 index 30bfa3b..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/resolve.ts +++ /dev/null @@ -1,16 +0,0 @@ -import resolveUri from '@jridgewell/resolve-uri'; -import stripFilename from './strip-filename'; - -type Resolve = (source: string | null) => string; -export default function resolver( - mapUrl: string | null | undefined, - sourceRoot: string | undefined, -): Resolve { - const from = stripFilename(mapUrl); - // The sourceRoot is always treated as a directory, if it's not empty. - // https://github.com/mozilla/source-map/blob/8cb3ee57/lib/util.js#L327 - // https://github.com/chromium/chromium/blob/da4adbb3/third_party/blink/renderer/devtools/front_end/sdk/SourceMap.js#L400-L401 - const prefix = sourceRoot ? sourceRoot + '/' : ''; - - return (source) => resolveUri(prefix + (source || ''), from); -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/sort.ts b/web/node_modules/@jridgewell/trace-mapping/src/sort.ts deleted file mode 100644 index 5d016cb..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/sort.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { COLUMN } from './sourcemap-segment'; - -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment'; - -export default function maybeSort( - mappings: SourceMapSegment[][], - owned: boolean, -): SourceMapSegment[][] { - const unsortedIndex = nextUnsortedSegmentLine(mappings, 0); - if (unsortedIndex === mappings.length) return mappings; - - // If we own the array (meaning we parsed it from JSON), then we're free to directly mutate it. If - // not, we do not want to modify the consumer's input array. - if (!owned) mappings = mappings.slice(); - - for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) { - mappings[i] = sortSegments(mappings[i], owned); - } - return mappings; -} - -function nextUnsortedSegmentLine(mappings: SourceMapSegment[][], start: number): number { - for (let i = start; i < mappings.length; i++) { - if (!isSorted(mappings[i])) return i; - } - return mappings.length; -} - -function isSorted(line: SourceMapSegment[]): boolean { - for (let j = 1; j < line.length; j++) { - if (line[j][COLUMN] < line[j - 1][COLUMN]) { - return false; - } - } - return true; -} - -function sortSegments(line: SourceMapSegment[], owned: boolean): SourceMapSegment[] { - if (!owned) line = line.slice(); - return line.sort(sortComparator); -} - -export function sortComparator(a: T, b: T): number { - return a[COLUMN] - b[COLUMN]; -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts b/web/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts deleted file mode 100644 index 94f1b6a..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/sourcemap-segment.ts +++ /dev/null @@ -1,23 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; - -type GeneratedLine = number; - -export type SourceMapSegment = - | [GeneratedColumn] - | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] - | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; - -export type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; - -export const COLUMN = 0; -export const SOURCES_INDEX = 1; -export const SOURCE_LINE = 2; -export const SOURCE_COLUMN = 3; -export const NAMES_INDEX = 4; - -export const REV_GENERATED_LINE = 1; -export const REV_GENERATED_COLUMN = 2; diff --git a/web/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts b/web/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts deleted file mode 100644 index 2c88980..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/strip-filename.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Removes everything after the last "/", but leaves the slash. - */ -export default function stripFilename(path: string | undefined | null): string { - if (!path) return ''; - const index = path.lastIndexOf('/'); - return path.slice(0, index + 1); -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts b/web/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts deleted file mode 100644 index 0b793d5..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/trace-mapping.ts +++ /dev/null @@ -1,502 +0,0 @@ -import { encode, decode } from '@jridgewell/sourcemap-codec'; - -import resolver from './resolve'; -import maybeSort from './sort'; -import buildBySources from './by-source'; -import { - memoizedState, - memoizedBinarySearch, - upperBound, - lowerBound, - found as bsFound, -} from './binary-search'; -import { - COLUMN, - SOURCES_INDEX, - SOURCE_LINE, - SOURCE_COLUMN, - NAMES_INDEX, - REV_GENERATED_LINE, - REV_GENERATED_COLUMN, -} from './sourcemap-segment'; -import { parse } from './types'; - -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment'; -import type { - SourceMapV3, - DecodedSourceMap, - EncodedSourceMap, - InvalidOriginalMapping, - OriginalMapping, - InvalidGeneratedMapping, - GeneratedMapping, - SourceMapInput, - Needle, - SourceNeedle, - SourceMap, - EachMapping, - Bias, - XInput, - SectionedSourceMap, - Ro, -} from './types'; -import type { Source } from './by-source'; -import type { MemoState } from './binary-search'; - -export type { SourceMapSegment } from './sourcemap-segment'; -export type { - SourceMap, - DecodedSourceMap, - EncodedSourceMap, - Section, - SectionedSourceMap, - SourceMapV3, - Bias, - EachMapping, - GeneratedMapping, - InvalidGeneratedMapping, - InvalidOriginalMapping, - Needle, - OriginalMapping, - OriginalMapping as Mapping, - SectionedSourceMapInput, - SourceMapInput, - SourceNeedle, - XInput, - EncodedSourceMapXInput, - DecodedSourceMapXInput, - SectionedSourceMapXInput, - SectionXInput, -} from './types'; - -interface PublicMap { - _encoded: TraceMap['_encoded']; - _decoded: TraceMap['_decoded']; - _decodedMemo: TraceMap['_decodedMemo']; - _bySources: TraceMap['_bySources']; - _bySourceMemos: TraceMap['_bySourceMemos']; -} - -const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)'; -const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)'; - -export const LEAST_UPPER_BOUND = -1; -export const GREATEST_LOWER_BOUND = 1; - -export { FlattenMap, FlattenMap as AnyMap } from './flatten-map'; - -export class TraceMap implements SourceMap { - declare version: SourceMapV3['version']; - declare file: SourceMapV3['file']; - declare names: SourceMapV3['names']; - declare sourceRoot: SourceMapV3['sourceRoot']; - declare sources: SourceMapV3['sources']; - declare sourcesContent: SourceMapV3['sourcesContent']; - declare ignoreList: SourceMapV3['ignoreList']; - - declare resolvedSources: string[]; - declare private _encoded: string | undefined; - - declare private _decoded: SourceMapSegment[][] | undefined; - declare private _decodedMemo: MemoState; - - declare private _bySources: Source[] | undefined; - declare private _bySourceMemos: MemoState[] | undefined; - - constructor(map: Ro, mapUrl?: string | null) { - const isString = typeof map === 'string'; - if (!isString && (map as unknown as { _decodedMemo: any })._decodedMemo) return map as TraceMap; - - const parsed = parse(map as Exclude); - - const { version, file, names, sourceRoot, sources, sourcesContent } = parsed; - this.version = version; - this.file = file; - this.names = names || []; - this.sourceRoot = sourceRoot; - this.sources = sources; - this.sourcesContent = sourcesContent; - this.ignoreList = parsed.ignoreList || (parsed as XInput).x_google_ignoreList || undefined; - - const resolve = resolver(mapUrl, sourceRoot); - this.resolvedSources = sources.map(resolve); - - const { mappings } = parsed; - if (typeof mappings === 'string') { - this._encoded = mappings; - this._decoded = undefined; - } else if (Array.isArray(mappings)) { - this._encoded = undefined; - this._decoded = maybeSort(mappings, isString); - } else if ((parsed as unknown as SectionedSourceMap).sections) { - throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`); - } else { - throw new Error(`invalid source map: ${JSON.stringify(parsed)}`); - } - - this._decodedMemo = memoizedState(); - this._bySources = undefined; - this._bySourceMemos = undefined; - } -} - -/** - * Typescript doesn't allow friend access to private fields, so this just casts the map into a type - * with public access modifiers. - */ -function cast(map: unknown): PublicMap { - return map as any; -} - -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -export function encodedMappings(map: TraceMap): EncodedSourceMap['mappings'] { - return (cast(map)._encoded ??= encode(cast(map)._decoded!)); -} - -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -export function decodedMappings(map: TraceMap): Readonly { - return (cast(map)._decoded ||= decode(cast(map)._encoded!)); -} - -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -export function traceSegment( - map: TraceMap, - line: number, - column: number, -): Readonly | null { - const decoded = decodedMappings(map); - - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) return null; - - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - GREATEST_LOWER_BOUND, - ); - - return index === -1 ? null : segments[index]; -} - -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -export function originalPositionFor( - map: TraceMap, - needle: Needle, -): OriginalMapping | InvalidOriginalMapping { - let { line, column, bias } = needle; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - - const decoded = decodedMappings(map); - - // It's common for parent source maps to have pointers to lines that have no - // mapping (like a "//# sourceMappingURL=") at the end of the child file. - if (line >= decoded.length) return OMapping(null, null, null, null); - - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - bias || GREATEST_LOWER_BOUND, - ); - - if (index === -1) return OMapping(null, null, null, null); - - const segment = segments[index]; - if (segment.length === 1) return OMapping(null, null, null, null); - - const { names, resolvedSources } = map; - return OMapping( - resolvedSources[segment[SOURCES_INDEX]], - segment[SOURCE_LINE] + 1, - segment[SOURCE_COLUMN], - segment.length === 5 ? names[segment[NAMES_INDEX]] : null, - ); -} - -/** - * Finds the generated line/column position of the provided source/line/column source position. - */ -export function generatedPositionFor( - map: TraceMap, - needle: SourceNeedle, -): GeneratedMapping | InvalidGeneratedMapping { - const { source, line, column, bias } = needle; - return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false); -} - -/** - * Finds all generated line/column positions of the provided source/line/column source position. - */ -export function allGeneratedPositionsFor(map: TraceMap, needle: SourceNeedle): GeneratedMapping[] { - const { source, line, column, bias } = needle; - // SourceMapConsumer uses LEAST_UPPER_BOUND for some reason, so we follow suit. - return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true); -} - -/** - * Iterates each mapping in generated position order. - */ -export function eachMapping(map: TraceMap, cb: (mapping: EachMapping) => void): void { - const decoded = decodedMappings(map); - const { names, resolvedSources } = map; - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - for (let j = 0; j < line.length; j++) { - const seg = line[j]; - - const generatedLine = i + 1; - const generatedColumn = seg[0]; - let source = null; - let originalLine = null; - let originalColumn = null; - let name = null; - if (seg.length !== 1) { - source = resolvedSources[seg[1]]; - originalLine = seg[2] + 1; - originalColumn = seg[3]; - } - if (seg.length === 5) name = names[seg[4]]; - - cb({ - generatedLine, - generatedColumn, - source, - originalLine, - originalColumn, - name, - } as EachMapping); - } - } -} - -function sourceIndex(map: TraceMap, source: string): number { - const { sources, resolvedSources } = map; - let index = sources.indexOf(source); - if (index === -1) index = resolvedSources.indexOf(source); - return index; -} - -/** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ -export function sourceContentFor(map: TraceMap, source: string): string | null { - const { sourcesContent } = map; - if (sourcesContent == null) return null; - const index = sourceIndex(map, source); - return index === -1 ? null : sourcesContent[index]; -} - -/** - * Determines if the source is marked to ignore by the source map. - */ -export function isIgnored(map: TraceMap, source: string): boolean { - const { ignoreList } = map; - if (ignoreList == null) return false; - const index = sourceIndex(map, source); - return index === -1 ? false : ignoreList.includes(index); -} - -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -export function presortedDecodedMap(map: DecodedSourceMap, mapUrl?: string): TraceMap { - const tracer = new TraceMap(clone(map, []), mapUrl); - cast(tracer)._decoded = map.mappings; - return tracer; -} - -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export function decodedMap( - map: TraceMap, -): Omit & { mappings: readonly SourceMapSegment[][] } { - return clone(map, decodedMappings(map)); -} - -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export function encodedMap(map: TraceMap): EncodedSourceMap { - return clone(map, encodedMappings(map)); -} - -function clone( - map: TraceMap | DecodedSourceMap, - mappings: T, -): T extends string ? EncodedSourceMap : DecodedSourceMap { - return { - version: map.version, - file: map.file, - names: map.names, - sourceRoot: map.sourceRoot, - sources: map.sources, - sourcesContent: map.sourcesContent, - mappings, - ignoreList: map.ignoreList || (map as XInput).x_google_ignoreList, - } as any; -} - -function OMapping(source: null, line: null, column: null, name: null): InvalidOriginalMapping; -function OMapping( - source: string, - line: number, - column: number, - name: string | null, -): OriginalMapping; -function OMapping( - source: string | null, - line: number | null, - column: number | null, - name: string | null, -): OriginalMapping | InvalidOriginalMapping { - return { source, line, column, name } as any; -} - -function GMapping(line: null, column: null): InvalidGeneratedMapping; -function GMapping(line: number, column: number): GeneratedMapping; -function GMapping( - line: number | null, - column: number | null, -): GeneratedMapping | InvalidGeneratedMapping { - return { line, column } as any; -} - -function traceSegmentInternal( - segments: SourceMapSegment[], - memo: MemoState, - line: number, - column: number, - bias: Bias, -): number; -function traceSegmentInternal( - segments: ReverseSegment[], - memo: MemoState, - line: number, - column: number, - bias: Bias, -): number; -function traceSegmentInternal( - segments: SourceMapSegment[] | ReverseSegment[], - memo: MemoState, - line: number, - column: number, - bias: Bias, -): number { - let index = memoizedBinarySearch(segments, column, memo, line); - if (bsFound) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } else if (bias === LEAST_UPPER_BOUND) index++; - - if (index === -1 || index === segments.length) return -1; - return index; -} - -function sliceGeneratedPositions( - segments: ReverseSegment[], - memo: MemoState, - line: number, - column: number, - bias: Bias, -): GeneratedMapping[] { - let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND); - - // We ignored the bias when tracing the segment so that we're guarnateed to find the first (in - // insertion order) segment that matched. Even if we did respect the bias when tracing, we would - // still need to call `lowerBound()` to find the first segment, which is slower than just looking - // for the GREATEST_LOWER_BOUND to begin with. The only difference that matters for us is when the - // binary search didn't match, in which case GREATEST_LOWER_BOUND just needs to increment to - // match LEAST_UPPER_BOUND. - if (!bsFound && bias === LEAST_UPPER_BOUND) min++; - - if (min === -1 || min === segments.length) return []; - - // We may have found the segment that started at an earlier column. If this is the case, then we - // need to slice all generated segments that match _that_ column, because all such segments span - // to our desired column. - const matchedColumn = bsFound ? column : segments[min][COLUMN]; - - // The binary search is not guaranteed to find the lower bound when a match wasn't found. - if (!bsFound) min = lowerBound(segments, matchedColumn, min); - const max = upperBound(segments, matchedColumn, min); - - const result = []; - for (; min <= max; min++) { - const segment = segments[min]; - result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN])); - } - return result; -} - -function generatedPosition( - map: TraceMap, - source: string, - line: number, - column: number, - bias: Bias, - all: false, -): GeneratedMapping | InvalidGeneratedMapping; -function generatedPosition( - map: TraceMap, - source: string, - line: number, - column: number, - bias: Bias, - all: true, -): GeneratedMapping[]; -function generatedPosition( - map: TraceMap, - source: string, - line: number, - column: number, - bias: Bias, - all: boolean, -): GeneratedMapping | InvalidGeneratedMapping | GeneratedMapping[] { - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - - const { sources, resolvedSources } = map; - let sourceIndex = sources.indexOf(source); - if (sourceIndex === -1) sourceIndex = resolvedSources.indexOf(source); - if (sourceIndex === -1) return all ? [] : GMapping(null, null); - - const bySourceMemos = (cast(map)._bySourceMemos ||= sources.map(memoizedState)); - const generated = (cast(map)._bySources ||= buildBySources(decodedMappings(map), bySourceMemos)); - - const segments = generated[sourceIndex][line]; - if (segments == null) return all ? [] : GMapping(null, null); - - const memo = bySourceMemos[sourceIndex]; - - if (all) return sliceGeneratedPositions(segments, memo, line, column, bias); - - const index = traceSegmentInternal(segments, memo, line, column, bias); - if (index === -1) return GMapping(null, null); - - const segment = segments[index]; - return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]); -} diff --git a/web/node_modules/@jridgewell/trace-mapping/src/types.ts b/web/node_modules/@jridgewell/trace-mapping/src/types.ts deleted file mode 100644 index 730a61f..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/src/types.ts +++ /dev/null @@ -1,114 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment'; -import type { GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap } from './trace-mapping'; - -export interface SourceMapV3 { - file?: string | null; - names: string[]; - sourceRoot?: string; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - ignoreList?: number[]; -} - -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} - -export interface DecodedSourceMap extends SourceMapV3 { - mappings: SourceMapSegment[][]; -} - -export interface Section { - offset: { line: number; column: number }; - map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; -} - -export interface SectionedSourceMap { - file?: string | null; - sections: Section[]; - version: 3; -} - -export type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; - -export type InvalidOriginalMapping = { - source: null; - line: null; - column: null; - name: null; -}; - -export type GeneratedMapping = { - line: number; - column: number; -}; -export type InvalidGeneratedMapping = { - line: null; - column: null; -}; - -export type Bias = typeof GREATEST_LOWER_BOUND | typeof LEAST_UPPER_BOUND; - -export type XInput = { x_google_ignoreList?: SourceMapV3['ignoreList'] }; -export type EncodedSourceMapXInput = EncodedSourceMap & XInput; -export type DecodedSourceMapXInput = DecodedSourceMap & XInput; -export type SectionedSourceMapXInput = Omit & { - sections: SectionXInput[]; -}; -export type SectionXInput = Omit & { - map: SectionedSourceMapInput; -}; - -export type SourceMapInput = string | EncodedSourceMapXInput | DecodedSourceMapXInput | TraceMap; -export type SectionedSourceMapInput = SourceMapInput | SectionedSourceMapXInput; - -export type Needle = { line: number; column: number; bias?: Bias }; -export type SourceNeedle = { source: string; line: number; column: number; bias?: Bias }; - -export type EachMapping = - | { - generatedLine: number; - generatedColumn: number; - source: null; - originalLine: null; - originalColumn: null; - name: null; - } - | { - generatedLine: number; - generatedColumn: number; - source: string | null; - originalLine: number; - originalColumn: number; - name: string | null; - }; - -export abstract class SourceMap { - declare version: SourceMapV3['version']; - declare file: SourceMapV3['file']; - declare names: SourceMapV3['names']; - declare sourceRoot: SourceMapV3['sourceRoot']; - declare sources: SourceMapV3['sources']; - declare sourcesContent: SourceMapV3['sourcesContent']; - declare resolvedSources: SourceMapV3['sources']; - declare ignoreList: SourceMapV3['ignoreList']; -} - -export type Ro = - T extends Array - ? V[] | Readonly | RoArray | Readonly> - : T extends object - ? T | Readonly | RoObject | Readonly> - : T; -type RoArray = Ro[]; -type RoObject = { [K in keyof T]: T[K] | Ro }; - -export function parse(map: T): Exclude { - return typeof map === 'string' ? JSON.parse(map) : (map as Exclude); -} diff --git a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts deleted file mode 100644 index b7bb85c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts +++ /dev/null @@ -1,33 +0,0 @@ -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment.cts'; -export type MemoState = { - lastKey: number; - lastNeedle: number; - lastIndex: number; -}; -export declare let found: boolean; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number; -export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function memoizedState(): MemoState; -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number; -//# sourceMappingURL=binary-search.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts.map deleted file mode 100644 index 648e84c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary-search.d.ts","sourceRoot":"","sources":["../src/binary-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG5E,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,IAAI,KAAK,SAAQ,CAAC;AAEzB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAmBR;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAED,wBAAgB,aAAa,IAAI,SAAS,CAMzC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAsBR"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts deleted file mode 100644 index 19e1e6b..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts +++ /dev/null @@ -1,33 +0,0 @@ -import type { SourceMapSegment, ReverseSegment } from './sourcemap-segment.mts'; -export type MemoState = { - lastKey: number; - lastNeedle: number; - lastIndex: number; -}; -export declare let found: boolean; -/** - * A binary search implementation that returns the index if a match is found. - * If no match is found, then the left-index (the index associated with the item that comes just - * before the desired index) is returned. To maintain proper sort order, a splice would happen at - * the next index: - * - * ```js - * const array = [1, 3]; - * const needle = 2; - * const index = binarySearch(array, needle, (item, needle) => item - needle); - * - * assert.equal(index, 0); - * array.splice(index + 1, 0, needle); - * assert.deepEqual(array, [1, 2, 3]); - * ``` - */ -export declare function binarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, low: number, high: number): number; -export declare function upperBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function lowerBound(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, index: number): number; -export declare function memoizedState(): MemoState; -/** - * This overly complicated beast is just to record the last tested line/column and the resulting - * index, allowing us to skip a few tests if mappings are monotonically increasing. - */ -export declare function memoizedBinarySearch(haystack: SourceMapSegment[] | ReverseSegment[], needle: number, state: MemoState, key: number): number; -//# sourceMappingURL=binary-search.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts.map deleted file mode 100644 index 648e84c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/binary-search.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"binary-search.d.ts","sourceRoot":"","sources":["../src/binary-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG5E,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,IAAI,KAAK,SAAQ,CAAC;AAEzB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAmBR;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,MAAM,CAKR;AAED,wBAAgB,aAAa,IAAI,SAAS,CAMzC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,cAAc,EAAE,EAC/C,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,MAAM,GACV,MAAM,CAsBR"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts deleted file mode 100644 index da49693..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.cts'; -export type Source = ReverseSegment[][]; -export = function buildBySources(decoded: readonly SourceMapSegment[][], memos: unknown[]): Source[]; -//# sourceMappingURL=by-source.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts.map deleted file mode 100644 index 32d2a7a..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"by-source.d.ts","sourceRoot":"","sources":["../src/by-source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,MAAM,MAAM,GAAG,cAAc,EAAE,EAAE,CAAC;AAIxC,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,EACtC,KAAK,EAAE,OAAO,EAAE,GACf,MAAM,EAAE,CA4BV"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts deleted file mode 100644 index f361049..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.mts'; -export type Source = ReverseSegment[][]; -export default function buildBySources(decoded: readonly SourceMapSegment[][], memos: unknown[]): Source[]; -//# sourceMappingURL=by-source.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts.map deleted file mode 100644 index 32d2a7a..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/by-source.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"by-source.d.ts","sourceRoot":"","sources":["../src/by-source.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,MAAM,MAAM,GAAG,cAAc,EAAE,EAAE,CAAC;AAIxC,MAAM,CAAC,OAAO,UAAU,cAAc,CACpC,OAAO,EAAE,SAAS,gBAAgB,EAAE,EAAE,EACtC,KAAK,EAAE,OAAO,EAAE,GACf,MAAM,EAAE,CA4BV"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts deleted file mode 100644 index 433d849..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts +++ /dev/null @@ -1,9 +0,0 @@ -import { TraceMap } from './trace-mapping.cts'; -import type { SectionedSourceMapInput, Ro } from './types.cts'; -type FlattenMap = { - new (map: Ro, mapUrl?: string | null): TraceMap; - (map: Ro, mapUrl?: string | null): TraceMap; -}; -export declare const FlattenMap: FlattenMap; -export {}; -//# sourceMappingURL=flatten-map.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts.map deleted file mode 100644 index 994b208..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flatten-map.d.ts","sourceRoot":"","sources":["../src/flatten-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,iBAAiB,CAAC;AAUjF,OAAO,KAAK,EAKV,uBAAuB,EAEvB,EAAE,EACH,MAAM,SAAS,CAAC;AAGjB,KAAK,UAAU,GAAG;IAChB,KAAK,GAAG,EAAE,EAAE,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;IACzE,CAAC,GAAG,EAAE,EAAE,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAsCV,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts deleted file mode 100644 index 444a1be..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts +++ /dev/null @@ -1,9 +0,0 @@ -import { TraceMap } from './trace-mapping.mts'; -import type { SectionedSourceMapInput, Ro } from './types.mts'; -type FlattenMap = { - new (map: Ro, mapUrl?: string | null): TraceMap; - (map: Ro, mapUrl?: string | null): TraceMap; -}; -export declare const FlattenMap: FlattenMap; -export {}; -//# sourceMappingURL=flatten-map.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts.map deleted file mode 100644 index 994b208..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/flatten-map.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"flatten-map.d.ts","sourceRoot":"","sources":["../src/flatten-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwC,MAAM,iBAAiB,CAAC;AAUjF,OAAO,KAAK,EAKV,uBAAuB,EAEvB,EAAE,EACH,MAAM,SAAS,CAAC;AAGjB,KAAK,UAAU,GAAG;IAChB,KAAK,GAAG,EAAE,EAAE,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;IACzE,CAAC,GAAG,EAAE,EAAE,CAAC,uBAAuB,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,UAsCV,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts deleted file mode 100644 index 62aeedb..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts +++ /dev/null @@ -1,4 +0,0 @@ -type Resolve = (source: string | null) => string; -export = function resolver(mapUrl: string | null | undefined, sourceRoot: string | undefined): Resolve; -export {}; -//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts.map deleted file mode 100644 index 9f155ac..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;AACjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAQT"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts deleted file mode 100644 index e2798a1..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts +++ /dev/null @@ -1,4 +0,0 @@ -type Resolve = (source: string | null) => string; -export default function resolver(mapUrl: string | null | undefined, sourceRoot: string | undefined): Resolve; -export {}; -//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts.map deleted file mode 100644 index 9f155ac..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/resolve.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAGA,KAAK,OAAO,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,CAAC;AACjD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACjC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,OAAO,CAQT"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts deleted file mode 100644 index aa14c12..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.cts'; -export = function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][]; -export declare function sortComparator(a: T, b: T): number; -//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts.map deleted file mode 100644 index 48b8e67..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAC9B,KAAK,EAAE,OAAO,GACb,gBAAgB,EAAE,EAAE,CAYtB;AAuBD,wBAAgB,cAAc,CAAC,CAAC,SAAS,gBAAgB,GAAG,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAE9F"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts deleted file mode 100644 index c5b94e6..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts +++ /dev/null @@ -1,4 +0,0 @@ -import type { ReverseSegment, SourceMapSegment } from './sourcemap-segment.mts'; -export default function maybeSort(mappings: SourceMapSegment[][], owned: boolean): SourceMapSegment[][]; -export declare function sortComparator(a: T, b: T): number; -//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts.map deleted file mode 100644 index 48b8e67..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sort.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../src/sort.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAC9B,KAAK,EAAE,OAAO,GACb,gBAAgB,EAAE,EAAE,CAYtB;AAuBD,wBAAgB,cAAc,CAAC,CAAC,SAAS,gBAAgB,GAAG,cAAc,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,CAE9F"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts deleted file mode 100644 index 8d3cabc..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts +++ /dev/null @@ -1,17 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; -type GeneratedLine = number; -export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export declare const REV_GENERATED_LINE = 1; -export declare const REV_GENERATED_COLUMN = 2; -export {}; -//# sourceMappingURL=sourcemap-segment.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts.map deleted file mode 100644 index 0c94a46..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-segment.d.ts","sourceRoot":"","sources":["../src/sourcemap-segment.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC;AAC9B,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AACzB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,KAAK,aAAa,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GACxB,CAAC,eAAe,CAAC,GACjB,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,GACzD,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAE1E,MAAM,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts deleted file mode 100644 index 8d3cabc..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts +++ /dev/null @@ -1,17 +0,0 @@ -type GeneratedColumn = number; -type SourcesIndex = number; -type SourceLine = number; -type SourceColumn = number; -type NamesIndex = number; -type GeneratedLine = number; -export type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex]; -export type ReverseSegment = [SourceColumn, GeneratedLine, GeneratedColumn]; -export declare const COLUMN = 0; -export declare const SOURCES_INDEX = 1; -export declare const SOURCE_LINE = 2; -export declare const SOURCE_COLUMN = 3; -export declare const NAMES_INDEX = 4; -export declare const REV_GENERATED_LINE = 1; -export declare const REV_GENERATED_COLUMN = 2; -export {}; -//# sourceMappingURL=sourcemap-segment.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts.map deleted file mode 100644 index 0c94a46..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/sourcemap-segment.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-segment.d.ts","sourceRoot":"","sources":["../src/sourcemap-segment.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,MAAM,CAAC;AAC9B,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AACzB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,UAAU,GAAG,MAAM,CAAC;AAEzB,KAAK,aAAa,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,gBAAgB,GACxB,CAAC,eAAe,CAAC,GACjB,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,GACzD,CAAC,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAE1E,MAAM,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;AAE5E,eAAO,MAAM,MAAM,IAAI,CAAC;AACxB,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,oBAAoB,IAAI,CAAC"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts deleted file mode 100644 index 8b3c0e9..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Removes everything after the last "/", but leaves the slash. - */ -export = function stripFilename(path: string | undefined | null): string; -//# sourceMappingURL=strip-filename.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts.map deleted file mode 100644 index 17a25da..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strip-filename.d.ts","sourceRoot":"","sources":["../src/strip-filename.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAI7E"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts deleted file mode 100644 index cbbaee0..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts +++ /dev/null @@ -1,5 +0,0 @@ -/** - * Removes everything after the last "/", but leaves the slash. - */ -export default function stripFilename(path: string | undefined | null): string; -//# sourceMappingURL=strip-filename.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts.map deleted file mode 100644 index 17a25da..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/strip-filename.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strip-filename.d.ts","sourceRoot":"","sources":["../src/strip-filename.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAI7E"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts deleted file mode 100644 index a40f305..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts +++ /dev/null @@ -1,80 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.cts'; -import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping, Ro } from './types.cts'; -export type { SourceMapSegment } from './sourcemap-segment.cts'; -export type { SourceMap, DecodedSourceMap, EncodedSourceMap, Section, SectionedSourceMap, SourceMapV3, Bias, EachMapping, GeneratedMapping, InvalidGeneratedMapping, InvalidOriginalMapping, Needle, OriginalMapping, OriginalMapping as Mapping, SectionedSourceMapInput, SourceMapInput, SourceNeedle, XInput, EncodedSourceMapXInput, DecodedSourceMapXInput, SectionedSourceMapXInput, SectionXInput, } from './types.cts'; -export declare const LEAST_UPPER_BOUND = -1; -export declare const GREATEST_LOWER_BOUND = 1; -export { FlattenMap, FlattenMap as AnyMap } from './flatten-map.cts'; -export declare class TraceMap implements SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - ignoreList: SourceMapV3['ignoreList']; - resolvedSources: string[]; - private _encoded; - private _decoded; - private _decodedMemo; - private _bySources; - private _bySourceMemos; - constructor(map: Ro, mapUrl?: string | null); -} -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -export declare function encodedMappings(map: TraceMap): EncodedSourceMap['mappings']; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -export declare function decodedMappings(map: TraceMap): Readonly; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -export declare function traceSegment(map: TraceMap, line: number, column: number): Readonly | null; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -export declare function originalPositionFor(map: TraceMap, needle: Needle): OriginalMapping | InvalidOriginalMapping; -/** - * Finds the generated line/column position of the provided source/line/column source position. - */ -export declare function generatedPositionFor(map: TraceMap, needle: SourceNeedle): GeneratedMapping | InvalidGeneratedMapping; -/** - * Finds all generated line/column positions of the provided source/line/column source position. - */ -export declare function allGeneratedPositionsFor(map: TraceMap, needle: SourceNeedle): GeneratedMapping[]; -/** - * Iterates each mapping in generated position order. - */ -export declare function eachMapping(map: TraceMap, cb: (mapping: EachMapping) => void): void; -/** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ -export declare function sourceContentFor(map: TraceMap, source: string): string | null; -/** - * Determines if the source is marked to ignore by the source map. - */ -export declare function isIgnored(map: TraceMap, source: string): boolean; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -export declare function presortedDecodedMap(map: DecodedSourceMap, mapUrl?: string): TraceMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function decodedMap(map: TraceMap): Omit & { - mappings: readonly SourceMapSegment[][]; -}; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function encodedMap(map: TraceMap): EncodedSourceMap; -//# sourceMappingURL=trace-mapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts.map deleted file mode 100644 index b5a874c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.d.ts","sourceRoot":"","sources":["../src/trace-mapping.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts deleted file mode 100644 index bc2ff0f..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts +++ /dev/null @@ -1,80 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.mts'; -import type { SourceMapV3, DecodedSourceMap, EncodedSourceMap, InvalidOriginalMapping, OriginalMapping, InvalidGeneratedMapping, GeneratedMapping, SourceMapInput, Needle, SourceNeedle, SourceMap, EachMapping, Ro } from './types.mts'; -export type { SourceMapSegment } from './sourcemap-segment.mts'; -export type { SourceMap, DecodedSourceMap, EncodedSourceMap, Section, SectionedSourceMap, SourceMapV3, Bias, EachMapping, GeneratedMapping, InvalidGeneratedMapping, InvalidOriginalMapping, Needle, OriginalMapping, OriginalMapping as Mapping, SectionedSourceMapInput, SourceMapInput, SourceNeedle, XInput, EncodedSourceMapXInput, DecodedSourceMapXInput, SectionedSourceMapXInput, SectionXInput, } from './types.mts'; -export declare const LEAST_UPPER_BOUND = -1; -export declare const GREATEST_LOWER_BOUND = 1; -export { FlattenMap, FlattenMap as AnyMap } from './flatten-map.mts'; -export declare class TraceMap implements SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - ignoreList: SourceMapV3['ignoreList']; - resolvedSources: string[]; - private _encoded; - private _decoded; - private _decodedMemo; - private _bySources; - private _bySourceMemos; - constructor(map: Ro, mapUrl?: string | null); -} -/** - * Returns the encoded (VLQ string) form of the SourceMap's mappings field. - */ -export declare function encodedMappings(map: TraceMap): EncodedSourceMap['mappings']; -/** - * Returns the decoded (array of lines of segments) form of the SourceMap's mappings field. - */ -export declare function decodedMappings(map: TraceMap): Readonly; -/** - * A low-level API to find the segment associated with a generated line/column (think, from a - * stack trace). Line and column here are 0-based, unlike `originalPositionFor`. - */ -export declare function traceSegment(map: TraceMap, line: number, column: number): Readonly | null; -/** - * A higher-level API to find the source/line/column associated with a generated line/column - * (think, from a stack trace). Line is 1-based, but column is 0-based, due to legacy behavior in - * `source-map` library. - */ -export declare function originalPositionFor(map: TraceMap, needle: Needle): OriginalMapping | InvalidOriginalMapping; -/** - * Finds the generated line/column position of the provided source/line/column source position. - */ -export declare function generatedPositionFor(map: TraceMap, needle: SourceNeedle): GeneratedMapping | InvalidGeneratedMapping; -/** - * Finds all generated line/column positions of the provided source/line/column source position. - */ -export declare function allGeneratedPositionsFor(map: TraceMap, needle: SourceNeedle): GeneratedMapping[]; -/** - * Iterates each mapping in generated position order. - */ -export declare function eachMapping(map: TraceMap, cb: (mapping: EachMapping) => void): void; -/** - * Retrieves the source content for a particular source, if its found. Returns null if not. - */ -export declare function sourceContentFor(map: TraceMap, source: string): string | null; -/** - * Determines if the source is marked to ignore by the source map. - */ -export declare function isIgnored(map: TraceMap, source: string): boolean; -/** - * A helper that skips sorting of the input map's mappings array, which can be expensive for larger - * maps. - */ -export declare function presortedDecodedMap(map: DecodedSourceMap, mapUrl?: string): TraceMap; -/** - * Returns a sourcemap object (with decoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function decodedMap(map: TraceMap): Omit & { - mappings: readonly SourceMapSegment[][]; -}; -/** - * Returns a sourcemap object (with encoded mappings) suitable for passing to a library that expects - * a sourcemap, or to JSON.stringify. - */ -export declare function encodedMap(map: TraceMap): EncodedSourceMap; -//# sourceMappingURL=trace-mapping.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts.map deleted file mode 100644 index b5a874c..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/trace-mapping.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"trace-mapping.d.ts","sourceRoot":"","sources":["../src/trace-mapping.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts b/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts deleted file mode 100644 index 729c2c3..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts +++ /dev/null @@ -1,107 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.cts'; -import type { GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap } from './trace-mapping.cts'; -export interface SourceMapV3 { - file?: string | null; - names: string[]; - sourceRoot?: string; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - ignoreList?: number[]; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: SourceMapSegment[][]; -} -export interface Section { - offset: { - line: number; - column: number; - }; - map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; -} -export interface SectionedSourceMap { - file?: string | null; - sections: Section[]; - version: 3; -} -export type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; -export type InvalidOriginalMapping = { - source: null; - line: null; - column: null; - name: null; -}; -export type GeneratedMapping = { - line: number; - column: number; -}; -export type InvalidGeneratedMapping = { - line: null; - column: null; -}; -export type Bias = typeof GREATEST_LOWER_BOUND | typeof LEAST_UPPER_BOUND; -export type XInput = { - x_google_ignoreList?: SourceMapV3['ignoreList']; -}; -export type EncodedSourceMapXInput = EncodedSourceMap & XInput; -export type DecodedSourceMapXInput = DecodedSourceMap & XInput; -export type SectionedSourceMapXInput = Omit & { - sections: SectionXInput[]; -}; -export type SectionXInput = Omit & { - map: SectionedSourceMapInput; -}; -export type SourceMapInput = string | EncodedSourceMapXInput | DecodedSourceMapXInput | TraceMap; -export type SectionedSourceMapInput = SourceMapInput | SectionedSourceMapXInput; -export type Needle = { - line: number; - column: number; - bias?: Bias; -}; -export type SourceNeedle = { - source: string; - line: number; - column: number; - bias?: Bias; -}; -export type EachMapping = { - generatedLine: number; - generatedColumn: number; - source: null; - originalLine: null; - originalColumn: null; - name: null; -} | { - generatedLine: number; - generatedColumn: number; - source: string | null; - originalLine: number; - originalColumn: number; - name: string | null; -}; -export declare abstract class SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: SourceMapV3['sources']; - ignoreList: SourceMapV3['ignoreList']; -} -export type Ro = T extends Array ? V[] | Readonly | RoArray | Readonly> : T extends object ? T | Readonly | RoObject | Readonly> : T; -type RoArray = Ro[]; -type RoObject = { - [K in keyof T]: T[K] | Ro; -}; -export declare function parse(map: T): Exclude; -export {}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts.map b/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts.map deleted file mode 100644 index 9224783..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/types.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts b/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts deleted file mode 100644 index a26d186..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts +++ /dev/null @@ -1,107 +0,0 @@ -import type { SourceMapSegment } from './sourcemap-segment.mts'; -import type { GREATEST_LOWER_BOUND, LEAST_UPPER_BOUND, TraceMap } from './trace-mapping.mts'; -export interface SourceMapV3 { - file?: string | null; - names: string[]; - sourceRoot?: string; - sources: (string | null)[]; - sourcesContent?: (string | null)[]; - version: 3; - ignoreList?: number[]; -} -export interface EncodedSourceMap extends SourceMapV3 { - mappings: string; -} -export interface DecodedSourceMap extends SourceMapV3 { - mappings: SourceMapSegment[][]; -} -export interface Section { - offset: { - line: number; - column: number; - }; - map: EncodedSourceMap | DecodedSourceMap | SectionedSourceMap; -} -export interface SectionedSourceMap { - file?: string | null; - sections: Section[]; - version: 3; -} -export type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; -export type InvalidOriginalMapping = { - source: null; - line: null; - column: null; - name: null; -}; -export type GeneratedMapping = { - line: number; - column: number; -}; -export type InvalidGeneratedMapping = { - line: null; - column: null; -}; -export type Bias = typeof GREATEST_LOWER_BOUND | typeof LEAST_UPPER_BOUND; -export type XInput = { - x_google_ignoreList?: SourceMapV3['ignoreList']; -}; -export type EncodedSourceMapXInput = EncodedSourceMap & XInput; -export type DecodedSourceMapXInput = DecodedSourceMap & XInput; -export type SectionedSourceMapXInput = Omit & { - sections: SectionXInput[]; -}; -export type SectionXInput = Omit & { - map: SectionedSourceMapInput; -}; -export type SourceMapInput = string | EncodedSourceMapXInput | DecodedSourceMapXInput | TraceMap; -export type SectionedSourceMapInput = SourceMapInput | SectionedSourceMapXInput; -export type Needle = { - line: number; - column: number; - bias?: Bias; -}; -export type SourceNeedle = { - source: string; - line: number; - column: number; - bias?: Bias; -}; -export type EachMapping = { - generatedLine: number; - generatedColumn: number; - source: null; - originalLine: null; - originalColumn: null; - name: null; -} | { - generatedLine: number; - generatedColumn: number; - source: string | null; - originalLine: number; - originalColumn: number; - name: string | null; -}; -export declare abstract class SourceMap { - version: SourceMapV3['version']; - file: SourceMapV3['file']; - names: SourceMapV3['names']; - sourceRoot: SourceMapV3['sourceRoot']; - sources: SourceMapV3['sources']; - sourcesContent: SourceMapV3['sourcesContent']; - resolvedSources: SourceMapV3['sources']; - ignoreList: SourceMapV3['ignoreList']; -} -export type Ro = T extends Array ? V[] | Readonly | RoArray | Readonly> : T extends object ? T | Readonly | RoObject | Readonly> : T; -type RoArray = Ro[]; -type RoObject = { - [K in keyof T]: T[K] | Ro; -}; -export declare function parse(map: T): Exclude; -export {}; -//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts.map b/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts.map deleted file mode 100644 index 9224783..0000000 --- a/web/node_modules/@jridgewell/trace-mapping/types/types.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"} \ No newline at end of file diff --git a/web/node_modules/@polka/url/build.js b/web/node_modules/@polka/url/build.js deleted file mode 100644 index a945343..0000000 --- a/web/node_modules/@polka/url/build.js +++ /dev/null @@ -1,49 +0,0 @@ -const qs = require('querystring'); - -/** - * @typedef ParsedURL - * @type {import('.').ParsedURL} - */ - -/** - * @typedef Request - * @property {string} url - * @property {ParsedURL} _parsedUrl - */ - -/** - * @param {Request} req - * @returns {ParsedURL|void} - */ -function parse(req) { - let raw = req.url; - if (raw == null) return; - - let prev = req._parsedUrl; - if (prev && prev.raw === raw) return prev; - - let pathname=raw, search='', query, hash; - - if (raw.length > 1) { - let idx = raw.indexOf('#', 1); - - if (idx !== -1) { - hash = raw.substring(idx); - pathname = raw.substring(0, idx); - } - - idx = pathname.indexOf('?', 1); - - if (idx !== -1) { - search = pathname.substring(idx); - pathname = pathname.substring(0, idx); - if (search.length > 1) { - query = qs.parse(search.substring(1)); - } - } - } - - return req._parsedUrl = { pathname, search, query, hash, raw }; -} - -exports.parse = parse; \ No newline at end of file diff --git a/web/node_modules/@polka/url/build.mjs b/web/node_modules/@polka/url/build.mjs deleted file mode 100644 index 48ccfaa..0000000 --- a/web/node_modules/@polka/url/build.mjs +++ /dev/null @@ -1,47 +0,0 @@ -import * as qs from 'node:querystring'; - -/** - * @typedef ParsedURL - * @type {import('.').ParsedURL} - */ - -/** - * @typedef Request - * @property {string} url - * @property {ParsedURL} _parsedUrl - */ - -/** - * @param {Request} req - * @returns {ParsedURL|void} - */ -export function parse(req) { - let raw = req.url; - if (raw == null) return; - - let prev = req._parsedUrl; - if (prev && prev.raw === raw) return prev; - - let pathname=raw, search='', query, hash; - - if (raw.length > 1) { - let idx = raw.indexOf('#', 1); - - if (idx !== -1) { - hash = raw.substring(idx); - pathname = raw.substring(0, idx); - } - - idx = pathname.indexOf('?', 1); - - if (idx !== -1) { - search = pathname.substring(idx); - pathname = pathname.substring(0, idx); - if (search.length > 1) { - query = qs.parse(search.substring(1)); - } - } - } - - return req._parsedUrl = { pathname, search, query, hash, raw }; -} diff --git a/web/node_modules/@polka/url/index.d.ts b/web/node_modules/@polka/url/index.d.ts deleted file mode 100644 index 46ecac2..0000000 --- a/web/node_modules/@polka/url/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { IncomingMessage } from 'http'; - -export interface ParsedURL { - pathname: string; - search: string; - query: Record | undefined; - hash: string | undefined; - raw: string; -} - -export function parse(req: IncomingMessage): ParsedURL; diff --git a/web/node_modules/@polka/url/package.json b/web/node_modules/@polka/url/package.json deleted file mode 100644 index d594ee7..0000000 --- a/web/node_modules/@polka/url/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "version": "1.0.0-next.29", - "name": "@polka/url", - "repository": "lukeed/polka", - "description": "Super fast, memoized `req.url` parser", - "module": "build.mjs", - "types": "index.d.ts", - "main": "build.js", - "license": "MIT", - "exports": { - ".": { - "types": "./index.d.ts", - "import": "./build.mjs", - "require": "./build.js" - }, - "./package.json": "./package.json" - }, - "files": [ - "build.*", - "index.d.*" - ], - "author": { - "name": "Luke Edwards", - "email": "luke@lukeed.com", - "url": "https://lukeed.com" - }, - "publishConfig": { - "access": "public" - } -} \ No newline at end of file diff --git a/web/node_modules/@polka/url/readme.md b/web/node_modules/@polka/url/readme.md deleted file mode 100644 index e47645c..0000000 --- a/web/node_modules/@polka/url/readme.md +++ /dev/null @@ -1,68 +0,0 @@ -# @polka/url [![npm](https://badgen.now.sh/npm/v/@polka/url)](https://npmjs.org/package/@polka/url) [![licenses](https://licenses.dev/b/npm/%40polka%2Furl)](https://licenses.dev/npm/%40polka%2Furl) - -> Super fast, memoized `req.url` parser; _not_ limited to [Polka][polka]! - -Parses the `url` from a [`IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) request. The returned object will always only contain the following keys: `search`, `query`, `pathname`, and `raw`. - -> **Note:** This library does not process `protocol`, `hostname`, `port`, etc.
This is because the incoming `req.url` value only begins with the path information. - -Parsed requests will be mutated with a `_parsedUrl` key, containing the returned output. This is used for future memoization, avoiding the need to fully parse the same `url` value multiple times. - -## Install - -``` -$ npm install --save @polka/url -``` - -## Usage - -```js -const parse = require('@polka/url'); - -let req = { - url: '/foo/bar?fizz=buzz' -}; -let output = parse(req); -//=> { -//=> pathname: '/foo/bar', -//=> raw: '/foo/bar?fizz=buzz', -//=> search: '?fizz=buzz', -//=> query: { -//=> fizz: 'buzz' -//=> }, -//=> } - -// Attaches result for future memoization -assert.deepEqual(output, req._parsedUrl); //=> true -``` - -## API - -### url(req) -Returns: `Object` or `undefined` - -> **Important:** The `req` must have a `url` key, otherwise `undefined` will be returned.
If no input is provided at all, a `TypeError` will be thrown. - -#### req -Type: `IncomingMessage` or `{ url: string }` - -The incoming HTTP request (`req`) or a plain `Object` with a `url` key. - -> **Note:** In Node.js servers, the [`req.url`](https://nodejs.org/api/http.html#http_message_url) begins with a pathname & does not include a `hash`. - - -## Benchmarks - -Check out the [`bench`](/bench) directory for in-depth benchmark results and comparisons. - - -## Support - -Any issues or questions can be sent to the [Polka][polka] repository.
However, please specify that your inquiry is about `@polka/url` specifically. - - -## License - -MIT © [Luke Edwards](https://lukeed.com) - -[polka]: https://github.com/lukeed/polka diff --git a/web/node_modules/@rollup/rollup-win32-x64-gnu/README.md b/web/node_modules/@rollup/rollup-win32-x64-gnu/README.md deleted file mode 100644 index e8a624b..0000000 --- a/web/node_modules/@rollup/rollup-win32-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@rollup/rollup-win32-x64-gnu` - -This is the **x86_64-pc-windows-gnu** binary for `rollup` diff --git a/web/node_modules/@rollup/rollup-win32-x64-gnu/package.json b/web/node_modules/@rollup/rollup-win32-x64-gnu/package.json deleted file mode 100644 index 5e43e6d..0000000 --- a/web/node_modules/@rollup/rollup-win32-x64-gnu/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@rollup/rollup-win32-x64-gnu", - "version": "4.60.0", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "files": [ - "rollup.win32-x64-gnu.node" - ], - "description": "Native bindings for Rollup", - "author": "Lukas Taegert-Atkinson", - "homepage": "https://rollupjs.org/", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/rollup/rollup.git" - }, - "main": "./rollup.win32-x64-gnu.node" -} \ No newline at end of file diff --git a/web/node_modules/@rollup/rollup-win32-x64-gnu/rollup.win32-x64-gnu.node b/web/node_modules/@rollup/rollup-win32-x64-gnu/rollup.win32-x64-gnu.node deleted file mode 100644 index 7dea326..0000000 Binary files a/web/node_modules/@rollup/rollup-win32-x64-gnu/rollup.win32-x64-gnu.node and /dev/null differ diff --git a/web/node_modules/@rollup/rollup-win32-x64-msvc/README.md b/web/node_modules/@rollup/rollup-win32-x64-msvc/README.md deleted file mode 100644 index 7382dbc..0000000 --- a/web/node_modules/@rollup/rollup-win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@rollup/rollup-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `rollup` diff --git a/web/node_modules/@rollup/rollup-win32-x64-msvc/package.json b/web/node_modules/@rollup/rollup-win32-x64-msvc/package.json deleted file mode 100644 index a44e192..0000000 --- a/web/node_modules/@rollup/rollup-win32-x64-msvc/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@rollup/rollup-win32-x64-msvc", - "version": "4.60.0", - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "files": [ - "rollup.win32-x64-msvc.node" - ], - "description": "Native bindings for Rollup", - "author": "Lukas Taegert-Atkinson", - "homepage": "https://rollupjs.org/", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/rollup/rollup.git" - }, - "main": "./rollup.win32-x64-msvc.node" -} \ No newline at end of file diff --git a/web/node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node b/web/node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node deleted file mode 100644 index c1adb72..0000000 Binary files a/web/node_modules/@rollup/rollup-win32-x64-msvc/rollup.win32-x64-msvc.node and /dev/null differ diff --git a/web/node_modules/@standard-schema/spec/LICENSE b/web/node_modules/@standard-schema/spec/LICENSE deleted file mode 100644 index ea54e0d..0000000 --- a/web/node_modules/@standard-schema/spec/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Colin McDonnell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/web/node_modules/@standard-schema/spec/README.md b/web/node_modules/@standard-schema/spec/README.md deleted file mode 100644 index f9813ff..0000000 --- a/web/node_modules/@standard-schema/spec/README.md +++ /dev/null @@ -1,198 +0,0 @@ -

- Standard Schema fire logo -
- Standard Schema

-

- A family of specs for interoperable TypeScript -
- standardschema.dev -

-
- - - -The Standard Schema project is a set of interfaces that standardize the provision and consumption of shared functionality in the TypeScript ecosystem. - -Its goal is to allow tools to accept a single input that includes all the types and capabilities they need— no library-specific adapters, no extra dependencies. The result is an ecosystem that's fair for implementers, friendly for consumers, and open for end users. - -## The specifications - -The specifications can be found below in their entirety. Libraries wishing to implement a spec can copy/paste the code block below into their codebase. They're also available at `@standard-schema/spec` on [npm](https://www.npmjs.com/package/@standard-schema/spec) and [JSR](https://jsr.io/@standard-schema/spec). - -```ts -// ######################### -// ### Standard Typed ### -// ######################### - -/** The Standard Typed interface. This is a base type extended by other specs. */ -export interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} - -export declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - export interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - - /** The Standard Typed types interface. */ - export interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - - /** Infers the input type of a Standard Typed. */ - export type InferInput = NonNullable< - Schema["~standard"]["types"] - >["input"]; - - /** Infers the output type of a Standard Typed. */ - export type InferOutput = NonNullable< - Schema["~standard"]["types"] - >["output"]; -} - -// ########################## -// ### Standard Schema ### -// ########################## - -/** The Standard Schema interface. */ -export interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} - -export declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - export interface Props - extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: ( - value: unknown, - options?: StandardSchemaV1.Options | undefined - ) => Result | Promise>; - } - - /** The result interface of the validate function. */ - export type Result = SuccessResult | FailureResult; - - /** The result interface if validation succeeds. */ - export interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - - export interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - - /** The result interface if validation fails. */ - export interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - - /** The issue interface of the failure output. */ - export interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - - /** The path segment interface of the issue. */ - export interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - - /** The Standard types interface. */ - export interface Types - extends StandardTypedV1.Types {} - - /** Infers the input type of a Standard. */ - export type InferInput = - StandardTypedV1.InferInput; - - /** Infers the output type of a Standard. */ - export type InferOutput = - StandardTypedV1.InferOutput; -} - -// ############################### -// ### Standard JSON Schema ### -// ############################### - -/** The Standard JSON Schema interface. */ -export interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} - -export declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - export interface Props - extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - - /** The Standard JSON Schema converter interface. */ - export interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: ( - options: StandardJSONSchemaV1.Options - ) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: ( - options: StandardJSONSchemaV1.Options - ) => Record; - } - - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - export type Target = - | "draft-2020-12" - | "draft-07" - | "openapi-3.0" - // Accepts any string for future targets while preserving autocomplete - | ({} & string); - - /** The options for the input/output methods. */ - export interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - - /** The Standard types interface. */ - export interface Types - extends StandardTypedV1.Types {} - - /** Infers the input type of a Standard. */ - export type InferInput = - StandardTypedV1.InferInput; - - /** Infers the output type of a Standard. */ - export type InferOutput = - StandardTypedV1.InferOutput; -} -``` diff --git a/web/node_modules/@standard-schema/spec/dist/index.cjs b/web/node_modules/@standard-schema/spec/dist/index.cjs deleted file mode 100644 index 321666e..0000000 --- a/web/node_modules/@standard-schema/spec/dist/index.cjs +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var src_exports = {}; -module.exports = __toCommonJS(src_exports); diff --git a/web/node_modules/@standard-schema/spec/dist/index.d.cts b/web/node_modules/@standard-schema/spec/dist/index.d.cts deleted file mode 100644 index 5e4acaa..0000000 --- a/web/node_modules/@standard-schema/spec/dist/index.d.cts +++ /dev/null @@ -1,119 +0,0 @@ -/** The Standard Typed interface. This is a base type extended by other specs. */ -interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} -declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - /** The Standard Typed types interface. */ - interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - /** Infers the input type of a Standard Typed. */ - type InferInput = NonNullable["input"]; - /** Infers the output type of a Standard Typed. */ - type InferOutput = NonNullable["output"]; -} -/** The Standard Schema interface. */ -interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} -declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; - } - /** The result interface of the validate function. */ - type Result = SuccessResult | FailureResult; - /** The result interface if validation succeeds. */ - interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The result interface if validation fails. */ - interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - /** The issue interface of the failure output. */ - interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - /** The path segment interface of the issue. */ - interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -/** The Standard JSON Schema interface. */ -interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} -declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - /** The Standard JSON Schema converter interface. */ - interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: (options: StandardJSONSchemaV1.Options) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: (options: StandardJSONSchemaV1.Options) => Record; - } - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); - /** The options for the input/output methods. */ - interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} - -export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/web/node_modules/@standard-schema/spec/dist/index.d.ts b/web/node_modules/@standard-schema/spec/dist/index.d.ts deleted file mode 100644 index 5e4acaa..0000000 --- a/web/node_modules/@standard-schema/spec/dist/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -/** The Standard Typed interface. This is a base type extended by other specs. */ -interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} -declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - /** The Standard Typed types interface. */ - interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - /** Infers the input type of a Standard Typed. */ - type InferInput = NonNullable["input"]; - /** Infers the output type of a Standard Typed. */ - type InferOutput = NonNullable["output"]; -} -/** The Standard Schema interface. */ -interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} -declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; - } - /** The result interface of the validate function. */ - type Result = SuccessResult | FailureResult; - /** The result interface if validation succeeds. */ - interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The result interface if validation fails. */ - interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - /** The issue interface of the failure output. */ - interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - /** The path segment interface of the issue. */ - interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -/** The Standard JSON Schema interface. */ -interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} -declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - /** The Standard JSON Schema converter interface. */ - interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: (options: StandardJSONSchemaV1.Options) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: (options: StandardJSONSchemaV1.Options) => Record; - } - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); - /** The options for the input/output methods. */ - interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} - -export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/web/node_modules/@standard-schema/spec/dist/index.js b/web/node_modules/@standard-schema/spec/dist/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/web/node_modules/@standard-schema/spec/package.json b/web/node_modules/@standard-schema/spec/package.json deleted file mode 100644 index 62bb551..0000000 --- a/web/node_modules/@standard-schema/spec/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@standard-schema/spec", - "description": "A family of specs for interoperable TypeScript", - "version": "1.1.0", - "license": "MIT", - "author": "Colin McDonnell", - "homepage": "https://standardschema.dev", - "repository": { - "type": "git", - "url": "https://github.com/standard-schema/standard-schema" - }, - "keywords": [ - "typescript", - "schema", - "validation", - "standard", - "interface" - ], - "type": "module", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "standard-schema-spec": "./src/index.ts", - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - } - }, - "sideEffects": false, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "devDependencies": { - "tsup": "^8.3.0", - "typescript": "^5.6.2" - }, - "scripts": { - "lint": "pnpm biome lint ./src", - "format": "pnpm biome format --write ./src", - "check": "pnpm biome check ./src", - "build": "tsup" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/acorn-typescript/LICENSE.md b/web/node_modules/@sveltejs/acorn-typescript/LICENSE.md deleted file mode 100644 index 36d00ff..0000000 --- a/web/node_modules/@sveltejs/acorn-typescript/LICENSE.md +++ /dev/null @@ -1,22 +0,0 @@ -MIT License - -Copyright (c) 2022 Tyreal Hu -Copyright (c) 2025 The Svelte Team - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@sveltejs/acorn-typescript/README.md b/web/node_modules/@sveltejs/acorn-typescript/README.md deleted file mode 100644 index c6305de..0000000 --- a/web/node_modules/@sveltejs/acorn-typescript/README.md +++ /dev/null @@ -1,70 +0,0 @@ -# @sveltejs/acorn-typescript - -[![License](https://img.shields.io/npm/l/svelte.svg)](LICENSE.md) [![Chat](https://img.shields.io/discord/457912077277855764?label=chat&logo=discord)](https://svelte.dev/chat) - -This is a plugin for [Acorn](http://marijnhaverbeke.nl/acorn/) - a tiny, fast JavaScript parser, written completely in JavaScript. - -It was created as an experimental alternative, faster [TypeScript](https://www.typescriptlang.org/) parser. It will help you to parse -TypeScript using Acorn. - -## Usage - -To get started, import the plugin and use Acorn's extension mechanism to register it. You have to enable `options.locations` while using `@sveltejs/acorn-typescript`. - -```typescript -import { Parser } from 'acorn'; -import { tsPlugin } from '@sveltejs/acorn-typescript'; - -const node = Parser.extend(tsPlugin()).parse( - ` -const a = 1 -type A = number -export { - a, - type A as B -} -`, - { - sourceType: 'module', - ecmaVersion: 'latest', - locations: true - } -); -``` - -If you want to enable parsing within a TypeScript ambient context, where certain syntax have different rules (like `.d.ts` files and inside [declare module blocks](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html)): - -```typescript -import { Parser } from 'acorn'; -import { tsPlugin } from '@sveltejs/acorn-typescript'; - -const node = Parser.extend(tsPlugin({ dts: true })).parse( - ` -const a = 1 -type A = number -export { - a, - type A as B -} -`, - { - sourceType: 'module', - ecmaVersion: 'latest', - locations: true - } -); -``` - -## SUPPORTED - -- Typescript normal syntax -- Support to parse TypeScript [Decorators](https://www.typescriptlang.org/docs/handbook/decorators.html) -- Support to parse JSX & TSX - -## CHANGELOG - -[click](./CHANGELOG.md) - -## Acknowledgments - -We want to thank [TyrealHu](https://github.com/TyrealHu) for his original work on this project. He maintained [`acorn-typescript`](https://github.com/TyrealHu/acorn-typescript) until early 2024. diff --git a/web/node_modules/@sveltejs/acorn-typescript/index.d.ts b/web/node_modules/@sveltejs/acorn-typescript/index.d.ts deleted file mode 100644 index 1f357ec..0000000 --- a/web/node_modules/@sveltejs/acorn-typescript/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Parser } from 'acorn'; - -export function tsPlugin(options?: { - dts?: boolean; - /** Whether to use JSX. Defaults to false */ - jsx?: - | boolean - | { - allowNamespaces?: boolean; - allowNamespacedObjects?: boolean; - }; -}): (BaseParser: typeof Parser) => typeof Parser; diff --git a/web/node_modules/@sveltejs/acorn-typescript/index.js b/web/node_modules/@sveltejs/acorn-typescript/index.js deleted file mode 100644 index 44771ea..0000000 --- a/web/node_modules/@sveltejs/acorn-typescript/index.js +++ /dev/null @@ -1,5016 +0,0 @@ -// src/index.ts -import * as acornNamespace from "acorn"; - -// src/tokenType.ts -import { TokenType, keywordTypes, tokTypes, TokContext } from "acorn"; -var startsExpr = true; -function kwLike(_name, options = {}) { - return new TokenType("name", options); -} -var acornTypeScriptMap = /* @__PURE__ */ new WeakMap(); -var keywordTypeValues = Object.values(keywordTypes); -function generateAcornTypeScript(_acorn) { - const acorn = _acorn.Parser.acorn || _acorn; - let acornTypeScript = acornTypeScriptMap.get(acorn); - if (!acornTypeScript) { - let tokenIsLiteralPropertyName = function(token) { - return token === tokTypes.name || token === tokTypes.string || token === tokTypes.num || keywordTypeValues.includes(token) || tsKwTokenTypeValues.includes(token); - }, tokenIsKeywordOrIdentifier = function(token) { - return token === tokTypes.name || keywordTypeValues.includes(token) || tsKwTokenTypeValues.includes(token); - }, tokenIsIdentifier = function(token) { - return token === tokTypes.name || tsKwTokenTypeValues.includes(token); - }, tokenIsTSDeclarationStart = function(token) { - return token === tsKwTokenType.abstract || token === tsKwTokenType.declare || token === tsKwTokenType.enum || token === tsKwTokenType.module || token === tsKwTokenType.namespace || token === tsKwTokenType.interface || token === tsKwTokenType.type; - }, tokenIsTSTypeOperator = function(token) { - return token === tsKwTokenType.keyof || token === tsKwTokenType.readonly || token === tsKwTokenType.unique; - }, tokenIsTemplate = function(token) { - return token === tokTypes.invalidTemplate; - }; - const tsKwTokenType = generateTsKwTokenType(); - const tsKwTokenTypeValues = Object.values(tsKwTokenType); - const tsTokenType = generateTsTokenType(); - const tsTokenContext = generateTsTokenContext(); - const tsKeywordsRegExp = new RegExp(`^(?:${Object.keys(tsKwTokenType).join("|")})$`); - tsTokenType.jsxTagStart.updateContext = function() { - this.context.push(tsTokenContext.tc_expr); - this.context.push(tsTokenContext.tc_oTag); - this.exprAllowed = false; - }; - tsTokenType.jsxTagEnd.updateContext = function(prevType) { - let out = this.context.pop(); - if (out === tsTokenContext.tc_oTag && prevType === tokTypes.slash || out === tsTokenContext.tc_cTag) { - this.context.pop(); - this.exprAllowed = this.curContext() === tsTokenContext.tc_expr; - } else { - this.exprAllowed = true; - } - }; - acornTypeScript = { - tokTypes: { - ...tsKwTokenType, - ...tsTokenType - }, - tokContexts: { - ...tsTokenContext - }, - keywordsRegExp: tsKeywordsRegExp, - tokenIsLiteralPropertyName, - tokenIsKeywordOrIdentifier, - tokenIsIdentifier, - tokenIsTSDeclarationStart, - tokenIsTSTypeOperator, - tokenIsTemplate - }; - } - return acornTypeScript; -} -function generateTsTokenContext() { - return { - tc_oTag: new TokContext("...", true, true) - }; -} -function generateTsTokenType() { - return { - // @ts-expect-error - at: new TokenType("@"), - // @ts-expect-error - jsxName: new TokenType("jsxName"), - // @ts-expect-error - jsxText: new TokenType("jsxText", { beforeExpr: true }), - // @ts-expect-error - jsxTagStart: new TokenType("jsxTagStart", { startsExpr: true }), - // @ts-expect-error - jsxTagEnd: new TokenType("jsxTagEnd") - }; -} -function generateTsKwTokenType() { - return { - assert: kwLike("assert", { startsExpr }), - asserts: kwLike("asserts", { startsExpr }), - global: kwLike("global", { startsExpr }), - keyof: kwLike("keyof", { startsExpr }), - readonly: kwLike("readonly", { startsExpr }), - unique: kwLike("unique", { startsExpr }), - abstract: kwLike("abstract", { startsExpr }), - declare: kwLike("declare", { startsExpr }), - enum: kwLike("enum", { startsExpr }), - module: kwLike("module", { startsExpr }), - namespace: kwLike("namespace", { startsExpr }), - interface: kwLike("interface", { startsExpr }), - type: kwLike("type", { startsExpr }) - }; -} - -// src/scopeflags.ts -var TS_SCOPE_OTHER = 512; -var TS_SCOPE_TS_MODULE = 1024; -var BIND_KIND_VALUE = 1; -var BIND_KIND_TYPE = 2; -var BIND_SCOPE_VAR = 4; -var BIND_SCOPE_LEXICAL = 8; -var BIND_SCOPE_FUNCTION = 16; -var BIND_FLAGS_NONE = 64; -var BIND_FLAGS_CLASS = 128; -var BIND_FLAGS_TS_ENUM = 256; -var BIND_FLAGS_TS_CONST_ENUM = 512; -var BIND_FLAGS_TS_EXPORT_ONLY = 1024; -var BIND_CLASS = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_CLASS; -var BIND_LEXICAL = BIND_KIND_VALUE | 0 | BIND_SCOPE_LEXICAL | 0; -var BIND_VAR = BIND_KIND_VALUE | 0 | BIND_SCOPE_VAR | 0; -var BIND_FUNCTION = BIND_KIND_VALUE | 0 | BIND_SCOPE_FUNCTION | 0; -var BIND_TS_INTERFACE = 0 | BIND_KIND_TYPE | 0 | BIND_FLAGS_CLASS; -var BIND_TS_TYPE = 0 | BIND_KIND_TYPE | 0 | 0; -var BIND_TS_ENUM = BIND_KIND_VALUE | BIND_KIND_TYPE | BIND_SCOPE_LEXICAL | BIND_FLAGS_TS_ENUM; -var BIND_TS_AMBIENT = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY; -var BIND_NONE = 0 | 0 | 0 | BIND_FLAGS_NONE; -var BIND_OUTSIDE = BIND_KIND_VALUE | 0 | 0 | BIND_FLAGS_NONE; -var BIND_TS_CONST_ENUM = BIND_TS_ENUM | BIND_FLAGS_TS_CONST_ENUM; -var BIND_TS_NAMESPACE = 0 | 0 | 0 | BIND_FLAGS_TS_EXPORT_ONLY; -var CLASS_ELEMENT_FLAG_STATIC = 4; -var CLASS_ELEMENT_KIND_GETTER = 2; -var CLASS_ELEMENT_KIND_SETTER = 1; -var CLASS_ELEMENT_KIND_ACCESSOR = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_KIND_SETTER; -var CLASS_ELEMENT_STATIC_GETTER = CLASS_ELEMENT_KIND_GETTER | CLASS_ELEMENT_FLAG_STATIC; -var CLASS_ELEMENT_STATIC_SETTER = CLASS_ELEMENT_KIND_SETTER | CLASS_ELEMENT_FLAG_STATIC; - -// src/whitespace.ts -var skipWhiteSpaceInLine = /(?:[^\S\n\r\u2028\u2029]|\/\/.*|\/\*.*?\*\/)*/y; -var skipWhiteSpaceToLineBreak = new RegExp( - // Unfortunately JS doesn't support Perl's atomic /(?>pattern)/ or - // possessive quantifiers, so we use a trick to prevent backtracking - // when the look-ahead for line terminator fails. - "(?=(" + // Capture the whitespace and comments that should be skipped inside - // a look-ahead assertion, and then re-match the group as a unit. - skipWhiteSpaceInLine.source + "))\\1" + // Look-ahead for either line terminator, start of multi-line comment, - // or end of string. - /(?=[\n\r\u2028\u2029]|\/\*(?!.*?\*\/)|$)/.source, - "y" - // sticky -); - -// src/parseutil.ts -var DestructuringErrors = class { - constructor() { - this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; - } -}; -function isPrivateNameConflicted(privateNameMap, element) { - const name = element.key.name; - const curr = privateNameMap[name]; - let next = "true"; - if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { - next = (element.static ? "s" : "i") + element.kind; - } - if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { - privateNameMap[name] = "true"; - return false; - } else if (!curr) { - privateNameMap[name] = next; - return false; - } else { - return true; - } -} -function checkKeyName(node, name) { - const { computed, key } = node; - return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name); -} - -// src/error.ts -var TypeScriptError = { - AbstractMethodHasImplementation: ({ methodName }) => `Method '${methodName}' cannot have an implementation because it is marked abstract.`, - AbstractPropertyHasInitializer: ({ propertyName }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`, - AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.", - AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.", - CannotFindName: ({ name }) => `Cannot find name '${name}'.`, - ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.", - ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.", - ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.", - ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.", - DeclareAccessor: ({ kind }) => `'declare' is not allowed in ${kind}ters.`, - DeclareClassFieldHasInitializer: "Initializers are not allowed in ambient contexts.", - DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.", - DuplicateAccessibilityModifier: ( - // `Accessibility modifier already seen: ${modifier}` would be more helpful. - // eslint-disable-next-line @typescript-eslint/no-unused-vars - () => `Accessibility modifier already seen.` - ), - DuplicateModifier: ({ modifier }) => `Duplicate modifier: '${modifier}'.`, - // `token` matches the terminology used by typescript: - // https://github.com/microsoft/TypeScript/blob/main/src/compiler/types.ts#L2915 - EmptyHeritageClauseType: ({ token }) => `'${token}' list cannot be empty.`, - EmptyTypeArguments: "Type argument list cannot be empty.", - EmptyTypeParameters: "Type parameter list cannot be empty.", - ExpectedAmbientAfterExportDeclare: "'export declare' must be followed by an ambient declaration.", - ImportAliasHasImportType: "An import alias can not use 'import type'.", - IncompatibleModifiers: ({ modifiers }) => `'${modifiers[0]}' modifier cannot be used with '${modifiers[1]}' modifier.`, - IndexSignatureHasAbstract: "Index signatures cannot have the 'abstract' modifier.", - IndexSignatureHasAccessibility: ({ modifier }) => `Index signatures cannot have an accessibility modifier ('${modifier}').`, - IndexSignatureHasDeclare: "Index signatures cannot have the 'declare' modifier.", - IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.", - IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.", - InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.", - InvalidModifierOnTypeMember: ({ modifier }) => `'${modifier}' modifier cannot appear on a type member.`, - InvalidModifierOnTypeParameter: ({ modifier }) => `'${modifier}' modifier cannot appear on a type parameter.`, - InvalidModifierOnTypeParameterPositions: ({ modifier }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`, - InvalidModifiersOrder: ({ orderedModifiers }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`, - InvalidPropertyAccessAfterInstantiationExpression: "Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.", - InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.", - MissingInterfaceName: "'interface' declarations must be followed by an identifier.", - NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.", - NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.", - OptionalTypeBeforeRequired: "A required element cannot follow an optional element.", - OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.", - PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.", - PrivateElementHasAbstract: "Private elements cannot have the 'abstract' modifier.", - PrivateElementHasAccessibility: ({ modifier }) => `Private elements cannot have an accessibility modifier ('${modifier}').`, - PrivateMethodsHasAccessibility: ({ modifier }) => `Private methods cannot have an accessibility modifier ('${modifier}').`, - ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.", - ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `() => ...`.", - ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.", - SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.", - SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.", - SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.", - SingleTypeParameterWithoutTrailingComma: ({ typeParameterName }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`, - StaticBlockCannotHaveModifier: "Static class blocks cannot have any modifier.", - TypeAnnotationAfterAssign: "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.", - TypeImportCannotSpecifyDefaultAndNamed: "A type-only import can specify a default import or named bindings, but not both.", - TypeModifierIsUsedInTypeExports: "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.", - TypeModifierIsUsedInTypeImports: "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.", - UnexpectedParameterModifier: "A parameter property is only allowed in a constructor implementation.", - UnexpectedReadonly: "'readonly' type modifier is only permitted on array and tuple literal types.", - GenericsEndWithComma: `Trailing comma is not allowed at the end of generics.`, - UnexpectedTypeAnnotation: "Did not expect a type annotation here.", - UnexpectedTypeCastInParameter: "Unexpected type cast in parameter position.", - UnsupportedImportTypeArgument: "Argument in a type import must be a string literal.", - UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.", - UnsupportedSignatureParameterKind: ({ type }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type}.`, - LetInLexicalBinding: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." -}; -var DecoratorsError = { - UnexpectedLeadingDecorator: "Leading decorators must be attached to a class declaration.", - DecoratorConstructor: "Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?", - TrailingDecorator: "Decorators must be attached to a class element.", - SpreadElementDecorator: `Decorators can't be used with SpreadElement` -}; - -// src/extentions/decorators.ts -function generateParseDecorators(Parse, acornTypeScript, acorn) { - const { tokTypes: tt } = acorn; - const { tokTypes: tokTypes2 } = acornTypeScript; - return class ParseDecorators extends Parse { - takeDecorators(node) { - const decorators = this.decoratorStack[this.decoratorStack.length - 1]; - if (decorators.length) { - node.decorators = decorators; - this.resetStartLocationFromNode(node, decorators[0]); - this.decoratorStack[this.decoratorStack.length - 1] = []; - } - } - parseDecorators(allowExport) { - const currentContextDecorators = this.decoratorStack[this.decoratorStack.length - 1]; - while (this.match(tokTypes2.at)) { - const decorator = this.parseDecorator(); - currentContextDecorators.push(decorator); - } - if (this.match(tt._export)) { - if (!allowExport) { - this.unexpected(); - } - } else if (!this.canHaveLeadingDecorator()) { - this.raise(this.start, DecoratorsError.UnexpectedLeadingDecorator); - } - } - parseDecorator() { - const node = this.startNode(); - this.next(); - this.decoratorStack.push([]); - const startPos = this.start; - const startLoc = this.startLoc; - let expr; - if (this.match(tt.parenL)) { - const startPos2 = this.start; - const startLoc2 = this.startLoc; - this.next(); - expr = this.parseExpression(); - this.expect(tt.parenR); - if (this.options.preserveParens) { - let par = this.startNodeAt(startPos2, startLoc2); - par.expression = expr; - expr = this.finishNode(par, "ParenthesizedExpression"); - } - } else { - expr = this.parseIdent(false); - while (this.eat(tt.dot)) { - const node2 = this.startNodeAt(startPos, startLoc); - node2.object = expr; - node2.property = this.parseIdent(true); - node2.computed = false; - expr = this.finishNode(node2, "MemberExpression"); - } - } - node.expression = this.parseMaybeDecoratorArguments(expr); - this.decoratorStack.pop(); - return this.finishNode(node, "Decorator"); - } - parseMaybeDecoratorArguments(expr) { - if (this.eat(tt.parenL)) { - const node = this.startNodeAtNode(expr); - node.callee = expr; - node.arguments = this.parseExprList(tt.parenR, false); - return this.finishNode(node, "CallExpression"); - } - return expr; - } - }; -} - -// src/extentions/jsx/xhtml.ts -var xhtml_default = { - quot: '"', - amp: "&", - apos: "'", - lt: "<", - gt: ">", - nbsp: "\xA0", - iexcl: "\xA1", - cent: "\xA2", - pound: "\xA3", - curren: "\xA4", - yen: "\xA5", - brvbar: "\xA6", - sect: "\xA7", - uml: "\xA8", - copy: "\xA9", - ordf: "\xAA", - laquo: "\xAB", - not: "\xAC", - shy: "\xAD", - reg: "\xAE", - macr: "\xAF", - deg: "\xB0", - plusmn: "\xB1", - sup2: "\xB2", - sup3: "\xB3", - acute: "\xB4", - micro: "\xB5", - para: "\xB6", - middot: "\xB7", - cedil: "\xB8", - sup1: "\xB9", - ordm: "\xBA", - raquo: "\xBB", - frac14: "\xBC", - frac12: "\xBD", - frac34: "\xBE", - iquest: "\xBF", - Agrave: "\xC0", - Aacute: "\xC1", - Acirc: "\xC2", - Atilde: "\xC3", - Auml: "\xC4", - Aring: "\xC5", - AElig: "\xC6", - Ccedil: "\xC7", - Egrave: "\xC8", - Eacute: "\xC9", - Ecirc: "\xCA", - Euml: "\xCB", - Igrave: "\xCC", - Iacute: "\xCD", - Icirc: "\xCE", - Iuml: "\xCF", - ETH: "\xD0", - Ntilde: "\xD1", - Ograve: "\xD2", - Oacute: "\xD3", - Ocirc: "\xD4", - Otilde: "\xD5", - Ouml: "\xD6", - times: "\xD7", - Oslash: "\xD8", - Ugrave: "\xD9", - Uacute: "\xDA", - Ucirc: "\xDB", - Uuml: "\xDC", - Yacute: "\xDD", - THORN: "\xDE", - szlig: "\xDF", - agrave: "\xE0", - aacute: "\xE1", - acirc: "\xE2", - atilde: "\xE3", - auml: "\xE4", - aring: "\xE5", - aelig: "\xE6", - ccedil: "\xE7", - egrave: "\xE8", - eacute: "\xE9", - ecirc: "\xEA", - euml: "\xEB", - igrave: "\xEC", - iacute: "\xED", - icirc: "\xEE", - iuml: "\xEF", - eth: "\xF0", - ntilde: "\xF1", - ograve: "\xF2", - oacute: "\xF3", - ocirc: "\xF4", - otilde: "\xF5", - ouml: "\xF6", - divide: "\xF7", - oslash: "\xF8", - ugrave: "\xF9", - uacute: "\xFA", - ucirc: "\xFB", - uuml: "\xFC", - yacute: "\xFD", - thorn: "\xFE", - yuml: "\xFF", - OElig: "\u0152", - oelig: "\u0153", - Scaron: "\u0160", - scaron: "\u0161", - Yuml: "\u0178", - fnof: "\u0192", - circ: "\u02C6", - tilde: "\u02DC", - Alpha: "\u0391", - Beta: "\u0392", - Gamma: "\u0393", - Delta: "\u0394", - Epsilon: "\u0395", - Zeta: "\u0396", - Eta: "\u0397", - Theta: "\u0398", - Iota: "\u0399", - Kappa: "\u039A", - Lambda: "\u039B", - Mu: "\u039C", - Nu: "\u039D", - Xi: "\u039E", - Omicron: "\u039F", - Pi: "\u03A0", - Rho: "\u03A1", - Sigma: "\u03A3", - Tau: "\u03A4", - Upsilon: "\u03A5", - Phi: "\u03A6", - Chi: "\u03A7", - Psi: "\u03A8", - Omega: "\u03A9", - alpha: "\u03B1", - beta: "\u03B2", - gamma: "\u03B3", - delta: "\u03B4", - epsilon: "\u03B5", - zeta: "\u03B6", - eta: "\u03B7", - theta: "\u03B8", - iota: "\u03B9", - kappa: "\u03BA", - lambda: "\u03BB", - mu: "\u03BC", - nu: "\u03BD", - xi: "\u03BE", - omicron: "\u03BF", - pi: "\u03C0", - rho: "\u03C1", - sigmaf: "\u03C2", - sigma: "\u03C3", - tau: "\u03C4", - upsilon: "\u03C5", - phi: "\u03C6", - chi: "\u03C7", - psi: "\u03C8", - omega: "\u03C9", - thetasym: "\u03D1", - upsih: "\u03D2", - piv: "\u03D6", - ensp: "\u2002", - emsp: "\u2003", - thinsp: "\u2009", - zwnj: "\u200C", - zwj: "\u200D", - lrm: "\u200E", - rlm: "\u200F", - ndash: "\u2013", - mdash: "\u2014", - lsquo: "\u2018", - rsquo: "\u2019", - sbquo: "\u201A", - ldquo: "\u201C", - rdquo: "\u201D", - bdquo: "\u201E", - dagger: "\u2020", - Dagger: "\u2021", - bull: "\u2022", - hellip: "\u2026", - permil: "\u2030", - prime: "\u2032", - Prime: "\u2033", - lsaquo: "\u2039", - rsaquo: "\u203A", - oline: "\u203E", - frasl: "\u2044", - euro: "\u20AC", - image: "\u2111", - weierp: "\u2118", - real: "\u211C", - trade: "\u2122", - alefsym: "\u2135", - larr: "\u2190", - uarr: "\u2191", - rarr: "\u2192", - darr: "\u2193", - harr: "\u2194", - crarr: "\u21B5", - lArr: "\u21D0", - uArr: "\u21D1", - rArr: "\u21D2", - dArr: "\u21D3", - hArr: "\u21D4", - forall: "\u2200", - part: "\u2202", - exist: "\u2203", - empty: "\u2205", - nabla: "\u2207", - isin: "\u2208", - notin: "\u2209", - ni: "\u220B", - prod: "\u220F", - sum: "\u2211", - minus: "\u2212", - lowast: "\u2217", - radic: "\u221A", - prop: "\u221D", - infin: "\u221E", - ang: "\u2220", - and: "\u2227", - or: "\u2228", - cap: "\u2229", - cup: "\u222A", - int: "\u222B", - there4: "\u2234", - sim: "\u223C", - cong: "\u2245", - asymp: "\u2248", - ne: "\u2260", - equiv: "\u2261", - le: "\u2264", - ge: "\u2265", - sub: "\u2282", - sup: "\u2283", - nsub: "\u2284", - sube: "\u2286", - supe: "\u2287", - oplus: "\u2295", - otimes: "\u2297", - perp: "\u22A5", - sdot: "\u22C5", - lceil: "\u2308", - rceil: "\u2309", - lfloor: "\u230A", - rfloor: "\u230B", - lang: "\u2329", - rang: "\u232A", - loz: "\u25CA", - spades: "\u2660", - clubs: "\u2663", - hearts: "\u2665", - diams: "\u2666" -}; - -// src/extentions/jsx/index.ts -var hexNumber = /^[\da-fA-F]+$/; -var decimalNumber = /^\d+$/; -function getQualifiedJSXName(object) { - if (!object) return object; - if (object.type === "JSXIdentifier") return object.name; - if (object.type === "JSXNamespacedName") return object.namespace.name + ":" + object.name.name; - if (object.type === "JSXMemberExpression") - return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property); -} -function generateJsxParser(acorn, acornTypeScript, Parser, jsxOptions) { - const tt = acorn.tokTypes; - const tok = acornTypeScript.tokTypes; - const isNewLine = acorn.isNewLine; - const isIdentifierChar = acorn.isIdentifierChar; - const options = Object.assign( - { - allowNamespaces: true, - allowNamespacedObjects: true - }, - jsxOptions || {} - ); - return class JsxParser extends Parser { - // Reads inline JSX contents token. - jsx_readToken() { - let out = "", chunkStart = this.pos; - for (; ; ) { - if (this.pos >= this.input.length) this.raise(this.start, "Unterminated JSX contents"); - let ch = this.input.charCodeAt(this.pos); - switch (ch) { - case 60: - // '<' - case 123: - if (this.pos === this.start) { - if (ch === 60 && this.exprAllowed) { - ++this.pos; - return this.finishToken(tok.jsxTagStart); - } - return this.getTokenFromCode(ch); - } - out += this.input.slice(chunkStart, this.pos); - return this.finishToken(tok.jsxText, out); - case 38: - out += this.input.slice(chunkStart, this.pos); - out += this.jsx_readEntity(); - chunkStart = this.pos; - break; - case 62: - // '>' - case 125: - this.raise( - this.pos, - "Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + (ch === 62 ? ">" : "}") + '` or `{"' + this.input[this.pos] + '"}`?' - ); - default: - if (isNewLine(ch)) { - out += this.input.slice(chunkStart, this.pos); - out += this.jsx_readNewLine(true); - chunkStart = this.pos; - } else { - ++this.pos; - } - } - } - } - jsx_readNewLine(normalizeCRLF) { - let ch = this.input.charCodeAt(this.pos); - let out; - ++this.pos; - if (ch === 13 && this.input.charCodeAt(this.pos) === 10) { - ++this.pos; - out = normalizeCRLF ? "\n" : "\r\n"; - } else { - out = String.fromCharCode(ch); - } - if (this.options.locations) { - ++this.curLine; - this.lineStart = this.pos; - } - return out; - } - jsx_readString(quote) { - let out = "", chunkStart = ++this.pos; - for (; ; ) { - if (this.pos >= this.input.length) this.raise(this.start, "Unterminated string constant"); - let ch = this.input.charCodeAt(this.pos); - if (ch === quote) break; - if (ch === 38) { - out += this.input.slice(chunkStart, this.pos); - out += this.jsx_readEntity(); - chunkStart = this.pos; - } else if (isNewLine(ch)) { - out += this.input.slice(chunkStart, this.pos); - out += this.jsx_readNewLine(false); - chunkStart = this.pos; - } else { - ++this.pos; - } - } - out += this.input.slice(chunkStart, this.pos++); - return this.finishToken(tt.string, out); - } - jsx_readEntity() { - let str = "", count = 0, entity; - let ch = this.input[this.pos]; - if (ch !== "&") this.raise(this.pos, "Entity must start with an ampersand"); - let startPos = ++this.pos; - while (this.pos < this.input.length && count++ < 10) { - ch = this.input[this.pos++]; - if (ch === ";") { - if (str[0] === "#") { - if (str[1] === "x") { - str = str.substr(2); - if (hexNumber.test(str)) entity = String.fromCharCode(parseInt(str, 16)); - } else { - str = str.substr(1); - if (decimalNumber.test(str)) entity = String.fromCharCode(parseInt(str, 10)); - } - } else { - entity = xhtml_default[str]; - } - break; - } - str += ch; - } - if (!entity) { - this.pos = startPos; - return "&"; - } - return entity; - } - // Read a JSX identifier (valid tag or attribute name). - // - // Optimized version since JSX identifiers can't contain - // escape characters and so can be read as single slice. - // Also assumes that first character was already checked - // by isIdentifierStart in readToken. - jsx_readWord() { - let ch, start = this.pos; - do { - ch = this.input.charCodeAt(++this.pos); - } while (isIdentifierChar(ch) || ch === 45); - return this.finishToken(tok.jsxName, this.input.slice(start, this.pos)); - } - // Parse next token as JSX identifier - jsx_parseIdentifier() { - let node = this.startNode(); - if (this.type === tok.jsxName) node.name = this.value; - else if (this.type.keyword) node.name = this.type.keyword; - else this.unexpected(); - this.next(); - return this.finishNode(node, "JSXIdentifier"); - } - // Parse namespaced identifier. - jsx_parseNamespacedName() { - let startPos = this.start, startLoc = this.startLoc; - let name = this.jsx_parseIdentifier(); - if (!options.allowNamespaces || !this.eat(tt.colon)) return name; - var node = this.startNodeAt(startPos, startLoc); - node.namespace = name; - node.name = this.jsx_parseIdentifier(); - return this.finishNode(node, "JSXNamespacedName"); - } - // Parses element name in any form - namespaced, member - // or single identifier. - jsx_parseElementName() { - if (this.type === tok.jsxTagEnd) return ""; - let startPos = this.start, startLoc = this.startLoc; - let node = this.jsx_parseNamespacedName(); - if (this.type === tt.dot && node.type === "JSXNamespacedName" && !options.allowNamespacedObjects) { - this.unexpected(); - } - while (this.eat(tt.dot)) { - let newNode = this.startNodeAt(startPos, startLoc); - newNode.object = node; - newNode.property = this.jsx_parseIdentifier(); - node = this.finishNode(newNode, "JSXMemberExpression"); - } - return node; - } - // Parses any type of JSX attribute value. - jsx_parseAttributeValue() { - switch (this.type) { - case tt.braceL: - let node = this.jsx_parseExpressionContainer(); - if (node.expression.type === "JSXEmptyExpression") - this.raise(node.start, "JSX attributes must only be assigned a non-empty expression"); - return node; - case tok.jsxTagStart: - case tt.string: - return this.parseExprAtom(); - default: - this.raise(this.start, "JSX value should be either an expression or a quoted JSX text"); - } - } - // JSXEmptyExpression is unique type since it doesn't actually parse anything, - // and so it should start at the end of last read token (left brace) and finish - // at the beginning of the next one (right brace). - jsx_parseEmptyExpression() { - let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc); - return this.finishNodeAt(node, "JSXEmptyExpression", this.start, this.startLoc); - } - // Parses JSX expression enclosed into curly brackets. - jsx_parseExpressionContainer() { - let node = this.startNode(); - this.next(); - node.expression = this.type === tt.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression(); - this.expect(tt.braceR); - return this.finishNode(node, "JSXExpressionContainer"); - } - // Parses following JSX attribute name-value pair. - jsx_parseAttribute() { - let node = this.startNode(); - if (this.eat(tt.braceL)) { - this.expect(tt.ellipsis); - node.argument = this.parseMaybeAssign(); - this.expect(tt.braceR); - return this.finishNode(node, "JSXSpreadAttribute"); - } - node.name = this.jsx_parseNamespacedName(); - node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null; - return this.finishNode(node, "JSXAttribute"); - } - // Parses JSX opening tag starting after '<'. - jsx_parseOpeningElementAt(startPos, startLoc) { - let node = this.startNodeAt(startPos, startLoc); - node.attributes = []; - let nodeName = this.jsx_parseElementName(); - if (nodeName) node.name = nodeName; - while (this.type !== tt.slash && this.type !== tok.jsxTagEnd) - node.attributes.push(this.jsx_parseAttribute()); - node.selfClosing = this.eat(tt.slash); - this.expect(tok.jsxTagEnd); - return this.finishNode(node, nodeName ? "JSXOpeningElement" : "JSXOpeningFragment"); - } - // Parses JSX closing tag starting after '" - ); - } - } - let fragmentOrElement = openingElement.name ? "Element" : "Fragment"; - node["opening" + fragmentOrElement] = openingElement; - node["closing" + fragmentOrElement] = closingElement; - node.children = children; - if (this.type === tt.relational && this.value === "<") { - this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag"); - } - return this.finishNode(node, "JSX" + fragmentOrElement); - } - // Parse JSX text - jsx_parseText() { - let node = this.parseLiteral(this.value); - node.type = "JSXText"; - return node; - } - // Parses entire JSX element from current position. - jsx_parseElement() { - let startPos = this.start, startLoc = this.startLoc; - this.next(); - return this.jsx_parseElementAt(startPos, startLoc); - } - }; -} - -// src/extentions/import-assertions.ts -function generateParseImportAssertions(Parse, acornTypeScript, acorn) { - const { tokTypes: tokTypes2 } = acornTypeScript; - const { tokTypes: tt } = acorn; - return class ImportAttributes extends Parse { - parseMaybeImportAttributes(node) { - if (this.type === tt._with || this.type === tokTypes2.assert) { - this.next(); - const attributes = this.parseImportAttributes(); - if (attributes) { - node.attributes = attributes; - } - } - } - parseImportAttributes() { - this.expect(tt.braceL); - const attrs = this.parseWithEntries(); - this.expect(tt.braceR); - return attrs; - } - parseWithEntries() { - const attrs = []; - const attrNames = /* @__PURE__ */ new Set(); - do { - if (this.type === tt.braceR) { - break; - } - const node = this.startNode(); - let withionKeyNode; - if (this.type === tt.string) { - withionKeyNode = this.parseLiteral(this.value); - } else { - withionKeyNode = this.parseIdent(true); - } - this.next(); - node.key = withionKeyNode; - if (attrNames.has(node.key.name)) { - this.raise(this.pos, "Duplicated key in attributes"); - } - attrNames.add(node.key.name); - if (this.type !== tt.string) { - this.raise(this.pos, "Only string is supported as an attribute value"); - } - node.value = this.parseLiteral(this.value); - attrs.push(this.finishNode(node, "ImportAttribute")); - } while (this.eat(tt.comma)); - return attrs; - } - }; -} - -// src/index.ts -var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g; -function assert(x) { - if (!x) { - throw new Error("Assert fail"); - } -} -function tsIsClassAccessor(modifier) { - return modifier === "accessor"; -} -function tsIsVarianceAnnotations(modifier) { - return modifier === "in" || modifier === "out"; -} -var FUNC_STATEMENT = 1; -var FUNC_HANGING_STATEMENT = 2; -var FUNC_NULLABLE_ID = 4; -var acornScope = { - SCOPE_TOP: 1, - SCOPE_FUNCTION: 2, - SCOPE_ASYNC: 4, - SCOPE_GENERATOR: 8, - SCOPE_ARROW: 16, - SCOPE_SIMPLE_CATCH: 32, - SCOPE_SUPER: 64, - SCOPE_DIRECT_SUPER: 128, - SCOPE_CLASS_STATIC_BLOCK: 256, - SCOPE_VAR: 256, - BIND_NONE: 0, - // Not a binding - BIND_VAR: 1, - // Var-style binding - BIND_LEXICAL: 2, - // Let- or const-style binding - BIND_FUNCTION: 3, - // Function declaration - BIND_SIMPLE_CATCH: 4, - // Simple (identifier pattern) catch binding - BIND_OUTSIDE: 5, - // Special case for function names as bound inside the - BIND_TS_TYPE: 6, - BIND_TS_INTERFACE: 7, - BIND_TS_NAMESPACE: 8, - BIND_FLAGS_TS_EXPORT_ONLY: 1024, - BIND_FLAGS_TS_IMPORT: 4096, - BIND_FLAGS_TS_ENUM: 256, - BIND_FLAGS_TS_CONST_ENUM: 512, - BIND_FLAGS_CLASS: 128 - // function -}; -function functionFlags(async, generator) { - return acornScope.SCOPE_FUNCTION | (async ? acornScope.SCOPE_ASYNC : 0) | (generator ? acornScope.SCOPE_GENERATOR : 0); -} -function isPossiblyLiteralEnum(expression) { - if (expression.type !== "MemberExpression") return false; - const { computed, property } = expression; - if (computed && (property.type !== "TemplateLiteral" || property.expressions.length > 0)) { - return false; - } - return isUncomputedMemberExpressionChain(expression.object); -} -function isUncomputedMemberExpressionChain(expression) { - if (expression.type === "Identifier") return true; - if (expression.type !== "MemberExpression") return false; - if (expression.computed) return false; - return isUncomputedMemberExpressionChain(expression.object); -} -function tsIsAccessModifier(modifier) { - return modifier === "private" || modifier === "public" || modifier === "protected"; -} -function tokenCanStartExpression(token) { - return Boolean(token.startsExpr); -} -function nonNull(x) { - if (x == null) { - throw new Error(`Unexpected ${x} value.`); - } - return x; -} -function keywordTypeFromName(value) { - switch (value) { - case "any": - return "TSAnyKeyword"; - case "boolean": - return "TSBooleanKeyword"; - case "bigint": - return "TSBigIntKeyword"; - case "never": - return "TSNeverKeyword"; - case "number": - return "TSNumberKeyword"; - case "object": - return "TSObjectKeyword"; - case "string": - return "TSStringKeyword"; - case "symbol": - return "TSSymbolKeyword"; - case "undefined": - return "TSUndefinedKeyword"; - case "unknown": - return "TSUnknownKeyword"; - default: - return void 0; - } -} -function tsPlugin(options) { - const { dts = false } = options || {}; - const disallowAmbiguousJSXLike = !!options?.jsx; - return function(Parser) { - const _acorn = Parser.acorn || acornNamespace; - const acornTypeScript = generateAcornTypeScript(_acorn); - const tt = _acorn.tokTypes; - const keywordTypes2 = _acorn.keywordTypes; - const isIdentifierStart = _acorn.isIdentifierStart; - const lineBreak = _acorn.lineBreak; - const isNewLine = _acorn.isNewLine; - const tokContexts = _acorn.tokContexts; - const isIdentifierChar = _acorn.isIdentifierChar; - const { - tokTypes: tokTypes2, - tokContexts: tsTokContexts, - keywordsRegExp, - tokenIsLiteralPropertyName, - tokenIsTemplate, - tokenIsTSDeclarationStart, - tokenIsIdentifier, - tokenIsKeywordOrIdentifier, - tokenIsTSTypeOperator - } = acornTypeScript; - function nextLineBreak(code, from, end = code.length) { - for (let i = from; i < end; i++) { - let next = code.charCodeAt(i); - if (isNewLine(next)) - return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1; - } - return -1; - } - Parser = generateParseDecorators(Parser, acornTypeScript, _acorn); - if (options?.jsx) { - Parser = generateJsxParser( - _acorn, - acornTypeScript, - Parser, - typeof options.jsx === "boolean" ? {} : options.jsx - ); - } - Parser = generateParseImportAssertions(Parser, acornTypeScript, _acorn); - class TypeScriptParser extends Parser { - constructor(options2, input, startPos) { - super(options2, input, startPos); - this.preValue = null; - this.preToken = null; - this.isLookahead = false; - this.isAmbientContext = false; - this.inAbstractClass = false; - this.inType = false; - this.inDisallowConditionalTypesContext = false; - this.maybeInArrowParameters = false; - this.shouldParseArrowReturnType = void 0; - this.shouldParseAsyncArrowReturnType = void 0; - this.decoratorStack = [[]]; - this.importsStack = [[]]; - /** - * we will only parse one import node or export node at same time. - * default kind is undefined - * */ - this.importOrExportOuterKind = void 0; - this.tsParseConstModifier = (node) => { - this.tsParseModifiers({ - modified: node, - allowedModifiers: ["const"], - // for better error recovery - disallowedModifiers: ["in", "out"], - errorTemplate: TypeScriptError.InvalidModifierOnTypeParameterPositions - }); - }; - this.ecmaVersion = this.options.ecmaVersion; - } - // support in Class static - static get acornTypeScript() { - return acornTypeScript; - } - // support in runtime, get acornTypeScript be this - get acornTypeScript() { - return acornTypeScript; - } - getTokenFromCodeInType(code) { - if (code === 62) { - return this.finishOp(tt.relational, 1); - } - if (code === 60) { - return this.finishOp(tt.relational, 1); - } - return super.getTokenFromCode(code); - } - readToken(code) { - if (!this.inType) { - let context = this.curContext(); - if (context === tsTokContexts.tc_expr) return this.jsx_readToken(); - if (context === tsTokContexts.tc_oTag || context === tsTokContexts.tc_cTag) { - if (isIdentifierStart(code)) return this.jsx_readWord(); - if (code == 62) { - ++this.pos; - return this.finishToken(tokTypes2.jsxTagEnd); - } - if ((code === 34 || code === 39) && context == tsTokContexts.tc_oTag) - return this.jsx_readString(code); - } - if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) { - ++this.pos; - if (options?.jsx) { - return this.finishToken(tokTypes2.jsxTagStart); - } else { - return this.finishToken(tt.relational, "<"); - } - } - } - return super.readToken(code); - } - getTokenFromCode(code) { - if (this.inType) { - return this.getTokenFromCodeInType(code); - } - if (code === 64) { - ++this.pos; - return this.finishToken(tokTypes2.at); - } - return super.getTokenFromCode(code); - } - isAbstractClass() { - return this.ts_isContextual(tokTypes2.abstract) && this.lookahead().type === tt._class; - } - finishNode(node, type) { - if (node.type !== "" && node.end !== 0) { - return node; - } - return super.finishNode(node, type); - } - // tryParse will clone parser state. - // It is expensive and should be used with cautions - tryParse(fn, oldState = this.cloneCurLookaheadState()) { - const abortSignal = { node: null }; - try { - const node = fn((node2 = null) => { - abortSignal.node = node2; - throw abortSignal; - }); - return { - node, - error: null, - thrown: false, - aborted: false, - failState: null - }; - } catch (error) { - const failState = this.getCurLookaheadState(); - this.setLookaheadState(oldState); - if (error instanceof SyntaxError) { - return { - node: null, - error, - thrown: true, - aborted: false, - failState - }; - } - if (error === abortSignal) { - return { - node: abortSignal.node, - error: null, - thrown: false, - aborted: true, - failState - }; - } - throw error; - } - } - setOptionalParametersError(refExpressionErrors, resultError) { - refExpressionErrors.optionalParametersLoc = resultError?.loc ?? this.startLoc; - } - // used after we have finished parsing types - reScan_lt_gt() { - if (this.type === tt.relational) { - this.pos -= 1; - this.readToken_lt_gt(this.fullCharCodeAtPos()); - } - } - reScan_lt() { - const { type } = this; - if (type === tt.bitShift) { - this.pos -= 2; - this.finishOp(tt.relational, 1); - return tt.relational; - } - return type; - } - resetEndLocation(node, endPos = this.lastTokEnd, endLoc = this.lastTokEndLoc) { - node.end = endPos; - node.loc.end = endLoc; - if (this.options.ranges) node.range[1] = endPos; - } - startNodeAtNode(type) { - return super.startNodeAt(type.start, type.loc.start); - } - nextTokenStart() { - return this.nextTokenStartSince(this.pos); - } - tsHasSomeModifiers(member, modifiers) { - return modifiers.some((modifier) => { - if (tsIsAccessModifier(modifier)) { - return member.accessibility === modifier; - } - return !!member[modifier]; - }); - } - tsIsStartOfStaticBlocks() { - return this.isContextual("static") && this.lookaheadCharCode() === 123; - } - tsCheckForInvalidTypeCasts(items) { - items.forEach((node) => { - if (node?.type === "TSTypeCastExpression") { - this.raise(node.typeAnnotation.start, TypeScriptError.UnexpectedTypeAnnotation); - } - }); - } - atPossibleAsyncArrow(base) { - return base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && base.start === this.potentialArrowAt; - } - tsIsIdentifier() { - return tokenIsIdentifier(this.type); - } - tsTryParseTypeOrTypePredicateAnnotation() { - return this.match(tt.colon) ? this.tsParseTypeOrTypePredicateAnnotation(tt.colon) : void 0; - } - tsTryParseGenericAsyncArrowFunction(startPos, startLoc, forInit) { - if (!this.tsMatchLeftRelational()) { - return void 0; - } - const oldMaybeInArrowParameters = this.maybeInArrowParameters; - this.maybeInArrowParameters = true; - const res = this.tsTryParseAndCatch(() => { - const node = this.startNodeAt(startPos, startLoc); - node.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier); - super.parseFunctionParams(node); - node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation(); - this.expect(tt.arrow); - return node; - }); - this.maybeInArrowParameters = oldMaybeInArrowParameters; - if (!res) { - return void 0; - } - return super.parseArrowExpression( - res, - /* params are already set */ - null, - /* async */ - true, - /* forInit */ - forInit - ); - } - // Used when parsing type arguments from ES productions, where the first token - // has been created without state.inType. Thus we need to rescan the lt token. - tsParseTypeArgumentsInExpression() { - if (this.reScan_lt() !== tt.relational) { - return void 0; - } - return this.tsParseTypeArguments(); - } - tsInNoContext(cb) { - const oldContext = this.context; - this.context = [oldContext[0]]; - try { - return cb(); - } finally { - this.context = oldContext; - } - } - tsTryParseTypeAnnotation() { - return this.match(tt.colon) ? this.tsParseTypeAnnotation() : void 0; - } - isUnparsedContextual(nameStart, name) { - const nameEnd = nameStart + name.length; - if (this.input.slice(nameStart, nameEnd) === name) { - const nextCh = this.input.charCodeAt(nameEnd); - return !(isIdentifierChar(nextCh) || // check if `nextCh is between 0xd800 - 0xdbff, - // if `nextCh` is NaN, `NaN & 0xfc00` is 0, the function - // returns true - (nextCh & 64512) === 55296); - } - return false; - } - isAbstractConstructorSignature() { - return this.ts_isContextual(tokTypes2.abstract) && this.lookahead().type === tt._new; - } - nextTokenStartSince(pos) { - skipWhiteSpace.lastIndex = pos; - return skipWhiteSpace.test(this.input) ? skipWhiteSpace.lastIndex : pos; - } - lookaheadCharCode() { - return this.input.charCodeAt(this.nextTokenStart()); - } - compareLookaheadState(state, state2) { - for (const key of Object.keys(state)) { - if (state[key] !== state2[key]) return false; - } - return true; - } - createLookaheadState() { - this.value = null; - this.context = [this.curContext()]; - } - getCurLookaheadState() { - return { - endLoc: this.endLoc, - lastTokEnd: this.lastTokEnd, - lastTokStart: this.lastTokStart, - lastTokStartLoc: this.lastTokStartLoc, - pos: this.pos, - value: this.value, - type: this.type, - start: this.start, - end: this.end, - context: this.context, - startLoc: this.startLoc, - lastTokEndLoc: this.lastTokEndLoc, - curLine: this.curLine, - lineStart: this.lineStart, - curPosition: this.curPosition, - containsEsc: this.containsEsc - }; - } - cloneCurLookaheadState() { - return { - pos: this.pos, - value: this.value, - type: this.type, - start: this.start, - end: this.end, - context: this.context && this.context.slice(), - startLoc: this.startLoc, - lastTokEndLoc: this.lastTokEndLoc, - endLoc: this.endLoc, - lastTokEnd: this.lastTokEnd, - lastTokStart: this.lastTokStart, - lastTokStartLoc: this.lastTokStartLoc, - curLine: this.curLine, - lineStart: this.lineStart, - curPosition: this.curPosition, - containsEsc: this.containsEsc - }; - } - setLookaheadState(state) { - this.pos = state.pos; - this.value = state.value; - this.endLoc = state.endLoc; - this.lastTokEnd = state.lastTokEnd; - this.lastTokStart = state.lastTokStart; - this.lastTokStartLoc = state.lastTokStartLoc; - this.type = state.type; - this.start = state.start; - this.end = state.end; - this.context = state.context; - this.startLoc = state.startLoc; - this.lastTokEndLoc = state.lastTokEndLoc; - this.curLine = state.curLine; - this.lineStart = state.lineStart; - this.curPosition = state.curPosition; - this.containsEsc = state.containsEsc; - } - // Utilities - tsLookAhead(f) { - const state = this.getCurLookaheadState(); - const res = f(); - this.setLookaheadState(state); - return res; - } - lookahead(number) { - const oldState = this.getCurLookaheadState(); - this.createLookaheadState(); - this.isLookahead = true; - if (number !== void 0) { - for (let i = 0; i < number; i++) { - this.nextToken(); - } - } else { - this.nextToken(); - } - this.isLookahead = false; - const curState = this.getCurLookaheadState(); - this.setLookaheadState(oldState); - return curState; - } - readWord() { - let word = this.readWord1(); - let type = tt.name; - if (this.keywords.test(word)) { - type = keywordTypes2[word]; - } else if (new RegExp(keywordsRegExp).test(word)) { - type = tokTypes2[word]; - } - return this.finishToken(type, word); - } - skipBlockComment() { - let startLoc; - if (!this.isLookahead) startLoc = this.options.onComment && this.curPosition(); - let start = this.pos, end = this.input.indexOf("*/", this.pos += 2); - if (end === -1) this.raise(this.pos - 2, "Unterminated comment"); - this.pos = end + 2; - if (this.options.locations) { - for (let nextBreak, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1; ) { - ++this.curLine; - pos = this.lineStart = nextBreak; - } - } - if (this.isLookahead) return; - if (this.options.onComment) { - this.options.onComment( - true, - this.input.slice(start + 2, end), - start, - this.pos, - startLoc, - this.curPosition() - ); - } - } - skipLineComment(startSkip) { - let start = this.pos; - let startLoc; - if (!this.isLookahead) startLoc = this.options.onComment && this.curPosition(); - let ch = this.input.charCodeAt(this.pos += startSkip); - while (this.pos < this.input.length && !isNewLine(ch)) { - ch = this.input.charCodeAt(++this.pos); - } - if (this.isLookahead) return; - if (this.options.onComment) - this.options.onComment( - false, - this.input.slice(start + startSkip, this.pos), - start, - this.pos, - startLoc, - this.curPosition() - ); - } - finishToken(type, val) { - this.preValue = this.value; - this.preToken = this.type; - this.end = this.pos; - if (this.options.locations) this.endLoc = this.curPosition(); - let prevType = this.type; - this.type = type; - this.value = val; - if (!this.isLookahead) { - this.updateContext(prevType); - } - } - resetStartLocation(node, start, startLoc) { - node.start = start; - node.loc.start = startLoc; - if (this.options.ranges) node.range[0] = start; - } - isLineTerminator() { - return this.eat(tt.semi) || super.canInsertSemicolon(); - } - hasFollowingLineBreak() { - skipWhiteSpaceToLineBreak.lastIndex = this.end; - return skipWhiteSpaceToLineBreak.test(this.input); - } - addExtra(node, key, value, enumerable = true) { - if (!node) return; - const extra = node.extra = node.extra || {}; - if (enumerable) { - extra[key] = value; - } else { - Object.defineProperty(extra, key, { enumerable, value }); - } - } - /** - * Test if current token is a literal property name - * https://tc39.es/ecma262/#prod-LiteralPropertyName - * LiteralPropertyName: - * IdentifierName - * StringLiteral - * NumericLiteral - * BigIntLiteral - */ - isLiteralPropertyName() { - return tokenIsLiteralPropertyName(this.type); - } - hasPrecedingLineBreak() { - return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); - } - createIdentifier(node, name) { - node.name = name; - return this.finishNode(node, "Identifier"); - } - /** - * Reset the start location of node to the start location of locationNode - */ - resetStartLocationFromNode(node, locationNode) { - this.resetStartLocation(node, locationNode.start, locationNode.loc.start); - } - // This is used in flow and typescript plugin - // Determine whether a parameter is a this param - isThisParam(param) { - return param.type === "Identifier" && param.name === "this"; - } - isLookaheadContextual(name) { - const next = this.nextTokenStart(); - return this.isUnparsedContextual(next, name); - } - /** - * ts type isContextual - * @param {TokenType} type - * @param {TokenType} token - * @returns {boolean} - * */ - ts_type_isContextual(type, token) { - return type === token && !this.containsEsc; - } - /** - * ts isContextual - * @param {TokenType} token - * @returns {boolean} - * */ - ts_isContextual(token) { - return this.type === token && !this.containsEsc; - } - ts_isContextualWithState(state, token) { - return state.type === token && !state.containsEsc; - } - isContextualWithState(keyword, state) { - return state.type === tt.name && state.value === keyword && !state.containsEsc; - } - tsIsStartOfMappedType() { - this.next(); - if (this.eat(tt.plusMin)) { - return this.ts_isContextual(tokTypes2.readonly); - } - if (this.ts_isContextual(tokTypes2.readonly)) { - this.next(); - } - if (!this.match(tt.bracketL)) { - return false; - } - this.next(); - if (!this.tsIsIdentifier()) { - return false; - } - this.next(); - return this.match(tt._in); - } - tsInDisallowConditionalTypesContext(cb) { - const oldInDisallowConditionalTypesContext = this.inDisallowConditionalTypesContext; - this.inDisallowConditionalTypesContext = true; - try { - return cb(); - } finally { - this.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; - } - } - tsTryParseType() { - return this.tsEatThenParseType(tt.colon); - } - /** - * Whether current token matches given type - * - * @param {TokenType} type - * @returns {boolean} - * @memberof Tokenizer - */ - match(type) { - return this.type === type; - } - matchJsx(type) { - return this.type === acornTypeScript.tokTypes[type]; - } - ts_eatWithState(type, nextCount, state) { - const targetType = state.type; - if (type === targetType) { - for (let i = 0; i < nextCount; i++) { - this.next(); - } - return true; - } else { - return false; - } - } - ts_eatContextualWithState(name, nextCount, state) { - if (keywordsRegExp.test(name)) { - if (this.ts_isContextualWithState(state, tokTypes2[name])) { - for (let i = 0; i < nextCount; i++) { - this.next(); - } - return true; - } - return false; - } else { - if (!this.isContextualWithState(name, state)) return false; - for (let i = 0; i < nextCount; i++) { - this.next(); - } - return true; - } - } - canHaveLeadingDecorator() { - return this.match(tt._class) || this.isAbstractClass(); - } - eatContextual(name) { - if (keywordsRegExp.test(name)) { - if (this.ts_isContextual(tokTypes2[name])) { - this.next(); - return true; - } - return false; - } else { - return super.eatContextual(name); - } - } - tsIsExternalModuleReference() { - return this.isContextual("require") && this.lookaheadCharCode() === 40; - } - tsParseExternalModuleReference() { - const node = this.startNode(); - this.expectContextual("require"); - this.expect(tt.parenL); - if (!this.match(tt.string)) { - this.unexpected(); - } - node.expression = this.parseExprAtom(); - this.expect(tt.parenR); - return this.finishNode(node, "TSExternalModuleReference"); - } - tsParseEntityName(allowReservedWords = true) { - let entity = this.parseIdent(allowReservedWords); - while (this.eat(tt.dot)) { - const node = this.startNodeAtNode(entity); - node.left = entity; - node.right = this.parseIdent(allowReservedWords); - entity = this.finishNode(node, "TSQualifiedName"); - } - return entity; - } - tsParseEnumMember() { - const node = this.startNode(); - node.id = this.match(tt.string) ? this.parseLiteral(this.value) : this.parseIdent( - /* liberal */ - true - ); - if (this.eat(tt.eq)) { - node.initializer = this.parseMaybeAssign(); - } - return this.finishNode(node, "TSEnumMember"); - } - tsParseEnumDeclaration(node, properties = {}) { - if (properties.const) node.const = true; - if (properties.declare) node.declare = true; - this.expectContextual("enum"); - node.id = this.parseIdent(); - this.checkLValSimple(node.id); - this.expect(tt.braceL); - node.members = this.tsParseDelimitedList("EnumMembers", this.tsParseEnumMember.bind(this)); - this.expect(tt.braceR); - return this.finishNode(node, "TSEnumDeclaration"); - } - tsParseModuleBlock() { - const node = this.startNode(); - this.enterScope(TS_SCOPE_OTHER); - this.expect(tt.braceL); - node.body = []; - while (this.type !== tt.braceR) { - let stmt = this.parseStatement(null, true); - node.body.push(stmt); - } - this.next(); - super.exitScope(); - return this.finishNode(node, "TSModuleBlock"); - } - tsParseAmbientExternalModuleDeclaration(node) { - if (this.ts_isContextual(tokTypes2.global)) { - node.global = true; - node.id = this.parseIdent(); - } else if (this.match(tt.string)) { - node.id = this.parseLiteral(this.value); - } else { - this.unexpected(); - } - if (this.match(tt.braceL)) { - this.enterScope(TS_SCOPE_TS_MODULE); - node.body = this.tsParseModuleBlock(); - super.exitScope(); - } else { - super.semicolon(); - } - return this.finishNode(node, "TSModuleDeclaration"); - } - tsTryParseDeclare(nany) { - if (this.isLineTerminator()) { - return; - } - let starttype = this.type; - let kind; - if (this.isContextual("let")) { - starttype = tt._var; - kind = "let"; - } - return this.tsInAmbientContext(() => { - if (starttype === tt._function) { - nany.declare = true; - return this.parseFunctionStatement( - nany, - /* async */ - false, - /* declarationPosition */ - true - ); - } - if (starttype === tt._class) { - nany.declare = true; - return this.parseClass(nany, true); - } - if (starttype === tokTypes2.enum) { - return this.tsParseEnumDeclaration(nany, { declare: true }); - } - if (starttype === tokTypes2.global) { - return this.tsParseAmbientExternalModuleDeclaration(nany); - } - if (starttype === tt._const || starttype === tt._var) { - if (!this.match(tt._const) || !this.isLookaheadContextual("enum")) { - nany.declare = true; - return this.parseVarStatement(nany, kind || this.value, true); - } - this.expect(tt._const); - return this.tsParseEnumDeclaration(nany, { - const: true, - declare: true - }); - } - if (starttype === tokTypes2.interface) { - const result = this.tsParseInterfaceDeclaration(nany, { - declare: true - }); - if (result) return result; - } - if (tokenIsIdentifier(starttype)) { - return this.tsParseDeclaration( - nany, - this.value, - /* next */ - true - ); - } - }); - } - tsIsListTerminator(kind) { - switch (kind) { - case "EnumMembers": - case "TypeMembers": - return this.match(tt.braceR); - case "HeritageClauseElement": - return this.match(tt.braceL); - case "TupleElementTypes": - return this.match(tt.bracketR); - case "TypeParametersOrArguments": - return this.tsMatchRightRelational(); - } - } - /** - * If !expectSuccess, returns undefined instead of failing to parse. - * If expectSuccess, parseElement should always return a defined value. - */ - tsParseDelimitedListWorker(kind, parseElement, expectSuccess, refTrailingCommaPos) { - const result = []; - let trailingCommaPos = -1; - for (; ; ) { - if (this.tsIsListTerminator(kind)) { - break; - } - trailingCommaPos = -1; - const element = parseElement(); - if (element == null) { - return void 0; - } - result.push(element); - if (this.eat(tt.comma)) { - trailingCommaPos = this.lastTokStart; - continue; - } - if (this.tsIsListTerminator(kind)) { - break; - } - if (expectSuccess) { - this.expect(tt.comma); - } - return void 0; - } - if (refTrailingCommaPos) { - refTrailingCommaPos.value = trailingCommaPos; - } - return result; - } - tsParseDelimitedList(kind, parseElement, refTrailingCommaPos) { - return nonNull( - this.tsParseDelimitedListWorker( - kind, - parseElement, - /* expectSuccess */ - true, - refTrailingCommaPos - ) - ); - } - tsParseBracketedList(kind, parseElement, bracket, skipFirstToken, refTrailingCommaPos) { - if (!skipFirstToken) { - if (bracket) { - this.expect(tt.bracketL); - } else { - this.expect(tt.relational); - } - } - const result = this.tsParseDelimitedList(kind, parseElement, refTrailingCommaPos); - if (bracket) { - this.expect(tt.bracketR); - } else { - this.expect(tt.relational); - } - return result; - } - tsParseTypeParameterName() { - const typeName = this.parseIdent(); - return typeName.name; - } - tsEatThenParseType(token) { - return !this.match(token) ? void 0 : this.tsNextThenParseType(); - } - tsExpectThenParseType(token) { - return this.tsDoThenParseType(() => this.expect(token)); - } - tsNextThenParseType() { - return this.tsDoThenParseType(() => this.next()); - } - tsDoThenParseType(cb) { - return this.tsInType(() => { - cb(); - return this.tsParseType(); - }); - } - tsSkipParameterStart() { - if (tokenIsIdentifier(this.type) || this.match(tt._this)) { - this.next(); - return true; - } - if (this.match(tt.braceL)) { - try { - this.parseObj(true); - return true; - } catch { - return false; - } - } - if (this.match(tt.bracketL)) { - this.next(); - try { - this.parseBindingList(tt.bracketR, true, true); - return true; - } catch { - return false; - } - } - return false; - } - tsIsUnambiguouslyStartOfFunctionType() { - this.next(); - if (this.match(tt.parenR) || this.match(tt.ellipsis)) { - return true; - } - if (this.tsSkipParameterStart()) { - if (this.match(tt.colon) || this.match(tt.comma) || this.match(tt.question) || this.match(tt.eq)) { - return true; - } - if (this.match(tt.parenR)) { - this.next(); - if (this.match(tt.arrow)) { - return true; - } - } - } - return false; - } - tsIsStartOfFunctionType() { - if (this.tsMatchLeftRelational()) { - return true; - } - return this.match(tt.parenL) && this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this)); - } - tsInAllowConditionalTypesContext(cb) { - const oldInDisallowConditionalTypesContext = this.inDisallowConditionalTypesContext; - this.inDisallowConditionalTypesContext = false; - try { - return cb(); - } finally { - this.inDisallowConditionalTypesContext = oldInDisallowConditionalTypesContext; - } - } - tsParseBindingListForSignature() { - return super.parseBindingList(tt.parenR, true, true).map((pattern) => { - if (pattern.type !== "Identifier" && pattern.type !== "RestElement" && pattern.type !== "ObjectPattern" && pattern.type !== "ArrayPattern") { - this.raise( - pattern.start, - TypeScriptError.UnsupportedSignatureParameterKind({ type: pattern.type }) - ); - } - return pattern; - }); - } - tsParseTypePredicateAsserts() { - if (this.type !== tokTypes2.asserts) { - return false; - } - const containsEsc = this.containsEsc; - this.next(); - if (!tokenIsIdentifier(this.type) && !this.match(tt._this)) { - return false; - } - if (containsEsc) { - this.raise(this.lastTokStart, "Escape sequence in keyword asserts"); - } - return true; - } - tsParseThisTypeNode() { - const node = this.startNode(); - this.next(); - return this.finishNode(node, "TSThisType"); - } - tsParseTypeAnnotation(eatColon = true, t = this.startNode()) { - this.tsInType(() => { - if (eatColon) this.expect(tt.colon); - t.typeAnnotation = this.tsParseType(); - }); - return this.finishNode(t, "TSTypeAnnotation"); - } - tsParseThisTypePredicate(lhs) { - this.next(); - const node = this.startNodeAtNode(lhs); - node.parameterName = lhs; - node.typeAnnotation = this.tsParseTypeAnnotation( - /* eatColon */ - false - ); - node.asserts = false; - return this.finishNode(node, "TSTypePredicate"); - } - tsParseThisTypeOrThisTypePredicate() { - const thisKeyword = this.tsParseThisTypeNode(); - if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { - return this.tsParseThisTypePredicate(thisKeyword); - } else { - return thisKeyword; - } - } - tsParseTypePredicatePrefix() { - const id = this.parseIdent(); - if (this.isContextual("is") && !this.hasPrecedingLineBreak()) { - this.next(); - return id; - } - } - tsParseTypeOrTypePredicateAnnotation(returnToken) { - return this.tsInType(() => { - const t = this.startNode(); - this.expect(returnToken); - const node = this.startNode(); - const asserts = !!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this)); - if (asserts && this.match(tt._this)) { - let thisTypePredicate = this.tsParseThisTypeOrThisTypePredicate(); - if (thisTypePredicate.type === "TSThisType") { - node.parameterName = thisTypePredicate; - node.asserts = true; - node.typeAnnotation = null; - thisTypePredicate = this.finishNode(node, "TSTypePredicate"); - } else { - this.resetStartLocationFromNode(thisTypePredicate, node); - thisTypePredicate.asserts = true; - } - t.typeAnnotation = thisTypePredicate; - return this.finishNode(t, "TSTypeAnnotation"); - } - const typePredicateVariable = this.tsIsIdentifier() && this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this)); - if (!typePredicateVariable) { - if (!asserts) { - return this.tsParseTypeAnnotation( - /* eatColon */ - false, - t - ); - } - node.parameterName = this.parseIdent(); - node.asserts = asserts; - node.typeAnnotation = null; - t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); - return this.finishNode(t, "TSTypeAnnotation"); - } - const type = this.tsParseTypeAnnotation( - /* eatColon */ - false - ); - node.parameterName = typePredicateVariable; - node.typeAnnotation = type; - node.asserts = asserts; - t.typeAnnotation = this.finishNode(node, "TSTypePredicate"); - return this.finishNode(t, "TSTypeAnnotation"); - }); - } - // Note: In TypeScript implementation we must provide `yieldContext` and `awaitContext`, - // but here it's always false, because this is only used for types. - tsFillSignature(returnToken, signature) { - const returnTokenRequired = returnToken === tt.arrow; - const paramsKey = "parameters"; - const returnTypeKey = "typeAnnotation"; - signature.typeParameters = this.tsTryParseTypeParameters(); - this.expect(tt.parenL); - signature[paramsKey] = this.tsParseBindingListForSignature(); - if (returnTokenRequired) { - signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken); - } else if (this.match(returnToken)) { - signature[returnTypeKey] = this.tsParseTypeOrTypePredicateAnnotation(returnToken); - } - } - tsTryNextParseConstantContext() { - if (this.lookahead().type !== tt._const) return null; - this.next(); - const typeReference = this.tsParseTypeReference(); - if (typeReference.typeParameters || typeReference.typeArguments) { - this.raise( - typeReference.typeName.start, - TypeScriptError.CannotFindName({ - name: "const" - }) - ); - } - return typeReference; - } - tsParseFunctionOrConstructorType(type, abstract) { - const node = this.startNode(); - if (type === "TSConstructorType") { - node.abstract = !!abstract; - if (abstract) this.next(); - this.next(); - } - this.tsInAllowConditionalTypesContext(() => this.tsFillSignature(tt.arrow, node)); - return this.finishNode(node, type); - } - tsParseUnionOrIntersectionType(kind, parseConstituentType, operator) { - const node = this.startNode(); - const hasLeadingOperator = this.eat(operator); - const types = []; - do { - types.push(parseConstituentType()); - } while (this.eat(operator)); - if (types.length === 1 && !hasLeadingOperator) { - return types[0]; - } - node.types = types; - return this.finishNode(node, kind); - } - tsCheckTypeAnnotationForReadOnly(node) { - switch (node.typeAnnotation.type) { - case "TSTupleType": - case "TSArrayType": - return; - default: - this.raise(node.start, TypeScriptError.UnexpectedReadonly); - } - } - tsParseTypeOperator() { - const node = this.startNode(); - const operator = this.value; - this.next(); - node.operator = operator; - node.typeAnnotation = this.tsParseTypeOperatorOrHigher(); - if (operator === "readonly") { - this.tsCheckTypeAnnotationForReadOnly(node); - } - return this.finishNode(node, "TSTypeOperator"); - } - tsParseConstraintForInferType() { - if (this.eat(tt._extends)) { - const constraint = this.tsInDisallowConditionalTypesContext(() => this.tsParseType()); - if (this.inDisallowConditionalTypesContext || !this.match(tt.question)) { - return constraint; - } - } - } - tsParseInferType() { - const node = this.startNode(); - this.expectContextual("infer"); - const typeParameter = this.startNode(); - typeParameter.name = this.tsParseTypeParameterName(); - typeParameter.constraint = this.tsTryParse(() => this.tsParseConstraintForInferType()); - node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter"); - return this.finishNode(node, "TSInferType"); - } - tsParseLiteralTypeNode() { - const node = this.startNode(); - node.literal = (() => { - switch (this.type) { - case tt.num: - // we don't need bigint type here - // case tt.bigint: - case tt.string: - case tt._true: - case tt._false: - return this.parseExprAtom(); - default: - this.unexpected(); - } - })(); - return this.finishNode(node, "TSLiteralType"); - } - tsParseImportType() { - const node = this.startNode(); - this.expect(tt._import); - this.expect(tt.parenL); - if (!this.match(tt.string)) { - this.raise(this.start, TypeScriptError.UnsupportedImportTypeArgument); - } - node.argument = this.parseExprAtom(); - this.expect(tt.parenR); - if (this.eat(tt.dot)) { - node.qualifier = this.tsParseEntityName(); - } - if (this.tsMatchLeftRelational()) { - node.typeArguments = this.tsParseTypeArguments(); - } - return this.finishNode(node, "TSImportType"); - } - tsParseTypeQuery() { - const node = this.startNode(); - this.expect(tt._typeof); - if (this.match(tt._import)) { - node.exprName = this.tsParseImportType(); - } else { - node.exprName = this.tsParseEntityName(); - } - if (!this.hasPrecedingLineBreak() && this.tsMatchLeftRelational()) { - node.typeArguments = this.tsParseTypeArguments(); - } - return this.finishNode(node, "TSTypeQuery"); - } - tsParseMappedTypeParameter() { - const node = this.startNode(); - node.name = this.tsParseTypeParameterName(); - node.constraint = this.tsExpectThenParseType(tt._in); - return this.finishNode(node, "TSTypeParameter"); - } - tsParseMappedType() { - const node = this.startNode(); - this.expect(tt.braceL); - if (this.match(tt.plusMin)) { - node.readonly = this.value; - this.next(); - this.expectContextual("readonly"); - } else if (this.eatContextual("readonly")) { - node.readonly = true; - } - this.expect(tt.bracketL); - node.typeParameter = this.tsParseMappedTypeParameter(); - node.nameType = this.eatContextual("as") ? this.tsParseType() : null; - this.expect(tt.bracketR); - if (this.match(tt.plusMin)) { - node.optional = this.value; - this.next(); - this.expect(tt.question); - } else if (this.eat(tt.question)) { - node.optional = true; - } - node.typeAnnotation = this.tsTryParseType(); - this.semicolon(); - this.expect(tt.braceR); - return this.finishNode(node, "TSMappedType"); - } - tsParseTypeLiteral() { - const node = this.startNode(); - node.members = this.tsParseObjectTypeMembers(); - return this.finishNode(node, "TSTypeLiteral"); - } - tsParseTupleElementType() { - const startLoc = this.startLoc; - const startPos = this["start"]; - const rest = this.eat(tt.ellipsis); - let type = this.tsParseType(); - const optional = this.eat(tt.question); - const labeled = this.eat(tt.colon); - if (labeled) { - const labeledNode = this.startNodeAtNode(type); - labeledNode.optional = optional; - if (type.type === "TSTypeReference" && !type.typeArguments && type.typeName.type === "Identifier") { - labeledNode.label = type.typeName; - } else { - this.raise(type.start, TypeScriptError.InvalidTupleMemberLabel); - labeledNode.label = type; - } - labeledNode.elementType = this.tsParseType(); - type = this.finishNode(labeledNode, "TSNamedTupleMember"); - } else if (optional) { - const optionalTypeNode = this.startNodeAtNode(type); - optionalTypeNode.typeAnnotation = type; - type = this.finishNode(optionalTypeNode, "TSOptionalType"); - } - if (rest) { - const restNode = this.startNodeAt(startPos, startLoc); - restNode.typeAnnotation = type; - type = this.finishNode(restNode, "TSRestType"); - } - return type; - } - tsParseTupleType() { - const node = this.startNode(); - node.elementTypes = this.tsParseBracketedList( - "TupleElementTypes", - this.tsParseTupleElementType.bind(this), - /* bracket */ - true, - /* skipFirstToken */ - false - ); - let seenOptionalElement = false; - node.elementTypes.forEach((elementNode) => { - const { type } = elementNode; - if (seenOptionalElement && type !== "TSRestType" && type !== "TSOptionalType" && !(type === "TSNamedTupleMember" && elementNode.optional)) { - this.raise(elementNode.start, TypeScriptError.OptionalTypeBeforeRequired); - } - seenOptionalElement ||= type === "TSNamedTupleMember" && elementNode.optional || type === "TSOptionalType"; - if (type === "TSRestType") { - elementNode = elementNode.typeAnnotation; - } - }); - return this.finishNode(node, "TSTupleType"); - } - tsParseTemplateLiteralType() { - const node = this.startNode(); - node.literal = this.parseTemplate({ isTagged: false }); - return this.finishNode(node, "TSLiteralType"); - } - tsParseTypeReference() { - const node = this.startNode(); - node.typeName = this.tsParseEntityName(); - if (!this.hasPrecedingLineBreak() && this.tsMatchLeftRelational()) { - node.typeArguments = this.tsParseTypeArguments(); - } - return this.finishNode(node, "TSTypeReference"); - } - tsMatchLeftRelational() { - return this.match(tt.relational) && this.value === "<"; - } - tsMatchRightRelational() { - return this.match(tt.relational) && this.value === ">"; - } - tsParseParenthesizedType() { - const node = this.startNode(); - this.expect(tt.parenL); - node.typeAnnotation = this.tsParseType(); - this.expect(tt.parenR); - return this.finishNode(node, "TSParenthesizedType"); - } - tsParseNonArrayType() { - switch (this.type) { - case tt.string: - case tt.num: - // we don't need bigint type here - // case tt.bigint: - case tt._true: - case tt._false: - return this.tsParseLiteralTypeNode(); - case tt.plusMin: - if (this.value === "-") { - const node = this.startNode(); - const nextToken = this.lookahead(); - if (nextToken.type !== tt.num) { - this.unexpected(); - } - node.literal = this.parseMaybeUnary(); - return this.finishNode(node, "TSLiteralType"); - } - break; - case tt._this: - return this.tsParseThisTypeOrThisTypePredicate(); - case tt._typeof: - return this.tsParseTypeQuery(); - case tt._import: - return this.tsParseImportType(); - case tt.braceL: - return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this)) ? this.tsParseMappedType() : this.tsParseTypeLiteral(); - case tt.bracketL: - return this.tsParseTupleType(); - case tt.parenL: - return this.tsParseParenthesizedType(); - // parse template string here - case tt.backQuote: - case tt.dollarBraceL: - return this.tsParseTemplateLiteralType(); - default: { - const { type } = this; - if (tokenIsIdentifier(type) || type === tt._void || type === tt._null) { - const nodeType = type === tt._void ? "TSVoidKeyword" : type === tt._null ? "TSNullKeyword" : keywordTypeFromName(this.value); - if (nodeType !== void 0 && this.lookaheadCharCode() !== 46) { - const node = this.startNode(); - this.next(); - return this.finishNode(node, nodeType); - } - return this.tsParseTypeReference(); - } - } - } - this.unexpected(); - } - tsParseArrayTypeOrHigher() { - let type = this.tsParseNonArrayType(); - while (!this.hasPrecedingLineBreak() && this.eat(tt.bracketL)) { - if (this.match(tt.bracketR)) { - const node = this.startNodeAtNode(type); - node.elementType = type; - this.expect(tt.bracketR); - type = this.finishNode(node, "TSArrayType"); - } else { - const node = this.startNodeAtNode(type); - node.objectType = type; - node.indexType = this.tsParseType(); - this.expect(tt.bracketR); - type = this.finishNode(node, "TSIndexedAccessType"); - } - } - return type; - } - tsParseTypeOperatorOrHigher() { - const isTypeOperator = tokenIsTSTypeOperator(this.type) && !this.containsEsc; - return isTypeOperator ? this.tsParseTypeOperator() : this.isContextual("infer") ? this.tsParseInferType() : this.tsInAllowConditionalTypesContext(() => this.tsParseArrayTypeOrHigher()); - } - tsParseIntersectionTypeOrHigher() { - return this.tsParseUnionOrIntersectionType( - "TSIntersectionType", - this.tsParseTypeOperatorOrHigher.bind(this), - tt.bitwiseAND - ); - } - tsParseUnionTypeOrHigher() { - return this.tsParseUnionOrIntersectionType( - "TSUnionType", - this.tsParseIntersectionTypeOrHigher.bind(this), - tt.bitwiseOR - ); - } - tsParseNonConditionalType() { - if (this.tsIsStartOfFunctionType()) { - return this.tsParseFunctionOrConstructorType("TSFunctionType"); - } - if (this.match(tt._new)) { - return this.tsParseFunctionOrConstructorType("TSConstructorType"); - } else if (this.isAbstractConstructorSignature()) { - return this.tsParseFunctionOrConstructorType( - "TSConstructorType", - /* abstract */ - true - ); - } - return this.tsParseUnionTypeOrHigher(); - } - /** Be sure to be in a type context before calling this, using `tsInType`. */ - tsParseType() { - assert(this.inType); - const type = this.tsParseNonConditionalType(); - if (this.inDisallowConditionalTypesContext || this.hasPrecedingLineBreak() || !this.eat(tt._extends)) { - return type; - } - const node = this.startNodeAtNode(type); - node.checkType = type; - node.extendsType = this.tsInDisallowConditionalTypesContext( - () => this.tsParseNonConditionalType() - ); - this.expect(tt.question); - node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()); - this.expect(tt.colon); - node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()); - return this.finishNode(node, "TSConditionalType"); - } - tsIsUnambiguouslyIndexSignature() { - this.next(); - if (tokenIsIdentifier(this.type)) { - this.next(); - return this.match(tt.colon); - } - return false; - } - /** - * Runs `cb` in a type context. - * This should be called one token *before* the first type token, - * so that the call to `next()` is run in type context. - */ - tsInType(cb) { - const oldInType = this.inType; - this.inType = true; - try { - return cb(); - } finally { - this.inType = oldInType; - } - } - tsTryParseIndexSignature(node) { - if (!(this.match(tt.bracketL) && this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this)))) { - return void 0; - } - this.expect(tt.bracketL); - const id = this.parseIdent(); - id.typeAnnotation = this.tsParseTypeAnnotation(); - this.resetEndLocation(id); - this.expect(tt.bracketR); - node.parameters = [id]; - const type = this.tsTryParseTypeAnnotation(); - if (type) node.typeAnnotation = type; - this.tsParseTypeMemberSemicolon(); - return this.finishNode(node, "TSIndexSignature"); - } - // for better error recover - tsParseNoneModifiers(node) { - this.tsParseModifiers({ - modified: node, - allowedModifiers: [], - disallowedModifiers: ["in", "out"], - errorTemplate: TypeScriptError.InvalidModifierOnTypeParameterPositions - }); - } - tsParseTypeParameter(parseModifiers = this.tsParseNoneModifiers.bind(this)) { - const node = this.startNode(); - parseModifiers(node); - node.name = this.tsParseTypeParameterName(); - node.constraint = this.tsEatThenParseType(tt._extends); - node.default = this.tsEatThenParseType(tt.eq); - return this.finishNode(node, "TSTypeParameter"); - } - tsParseTypeParameters(parseModifiers) { - const node = this.startNode(); - if (this.tsMatchLeftRelational() || this.matchJsx("jsxTagStart")) { - this.next(); - } else { - this.unexpected(); - } - const refTrailingCommaPos = { value: -1 }; - node.params = this.tsParseBracketedList( - "TypeParametersOrArguments", - this.tsParseTypeParameter.bind(this, parseModifiers), - /* bracket */ - false, - /* skipFirstToken */ - true, - refTrailingCommaPos - ); - if (node.params.length === 0) { - this.raise(this.start, TypeScriptError.EmptyTypeParameters); - } - if (refTrailingCommaPos.value !== -1) { - this.addExtra(node, "trailingComma", refTrailingCommaPos.value); - } - return this.finishNode(node, "TSTypeParameterDeclaration"); - } - tsTryParseTypeParameters(parseModifiers) { - if (this.tsMatchLeftRelational()) { - return this.tsParseTypeParameters(parseModifiers); - } - } - tsTryParse(f) { - const state = this.getCurLookaheadState(); - const result = f(); - if (result !== void 0 && result !== false) { - return result; - } else { - this.setLookaheadState(state); - return void 0; - } - } - tsTokenCanFollowModifier() { - return (this.match(tt.bracketL) || this.match(tt.braceL) || this.match(tt.star) || this.match(tt.ellipsis) || this.match(tt.privateId) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak(); - } - tsNextTokenCanFollowModifier() { - this.next(true); - return this.tsTokenCanFollowModifier(); - } - /** Parses a modifier matching one the given modifier names. */ - tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) { - const modifier = this.value; - if (allowedModifiers.indexOf(modifier) !== -1 && !this.containsEsc) { - if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks()) { - return void 0; - } - if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this))) { - return modifier; - } - } - return void 0; - } - tsParseModifiersByMap({ - modified, - map - }) { - for (const key of Object.keys(map)) { - modified[key] = map[key]; - } - } - /** Parses a list of modifiers, in any order. - * If you need a specific order, you must call this function multiple times: - * this.tsParseModifiers({ modified: node, allowedModifiers: ['public'] }); - * this.tsParseModifiers({ modified: node, allowedModifiers: ["abstract", "readonly"] }); - */ - tsParseModifiers({ - modified, - allowedModifiers, - disallowedModifiers, - stopOnStartOfClassStaticBlock, - errorTemplate = TypeScriptError.InvalidModifierOnTypeMember - }) { - const modifiedMap = {}; - const enforceOrder = (loc, modifier, before, after) => { - if (modifier === before && modified[after]) { - this.raise( - loc.column, - TypeScriptError.InvalidModifiersOrder({ orderedModifiers: [before, after] }) - ); - } - }; - const incompatible = (loc, modifier, mod1, mod2) => { - if (modified[mod1] && modifier === mod2 || modified[mod2] && modifier === mod1) { - this.raise( - loc.column, - TypeScriptError.IncompatibleModifiers({ modifiers: [mod1, mod2] }) - ); - } - }; - for (; ; ) { - const startLoc = this.startLoc; - const modifier = this.tsParseModifier( - allowedModifiers.concat(disallowedModifiers ?? []), - stopOnStartOfClassStaticBlock - ); - if (!modifier) break; - if (tsIsAccessModifier(modifier)) { - if (modified.accessibility) { - this.raise(this.start, TypeScriptError.DuplicateAccessibilityModifier()); - } else { - enforceOrder(startLoc, modifier, modifier, "override"); - enforceOrder(startLoc, modifier, modifier, "static"); - enforceOrder(startLoc, modifier, modifier, "readonly"); - enforceOrder(startLoc, modifier, modifier, "accessor"); - modifiedMap.accessibility = modifier; - modified["accessibility"] = modifier; - } - } else if (tsIsVarianceAnnotations(modifier)) { - if (modified[modifier]) { - this.raise(this.start, TypeScriptError.DuplicateModifier({ modifier })); - } else { - enforceOrder(startLoc, modifier, "in", "out"); - modifiedMap[modifier] = modifier; - modified[modifier] = true; - } - } else if (tsIsClassAccessor(modifier)) { - if (modified[modifier]) { - this.raise(this.start, TypeScriptError.DuplicateModifier({ modifier })); - } else { - incompatible(startLoc, modifier, "accessor", "readonly"); - incompatible(startLoc, modifier, "accessor", "static"); - incompatible(startLoc, modifier, "accessor", "override"); - modifiedMap[modifier] = modifier; - modified[modifier] = true; - } - } else if (modifier === "const") { - if (modified[modifier]) { - this.raise(this.start, TypeScriptError.DuplicateModifier({ modifier })); - } else { - modifiedMap[modifier] = modifier; - modified[modifier] = true; - } - } else { - if (Object.hasOwnProperty.call(modified, modifier)) { - this.raise(this.start, TypeScriptError.DuplicateModifier({ modifier })); - } else { - enforceOrder(startLoc, modifier, "static", "readonly"); - enforceOrder(startLoc, modifier, "static", "override"); - enforceOrder(startLoc, modifier, "override", "readonly"); - enforceOrder(startLoc, modifier, "abstract", "override"); - incompatible(startLoc, modifier, "declare", "override"); - incompatible(startLoc, modifier, "static", "abstract"); - modifiedMap[modifier] = modifier; - modified[modifier] = true; - } - } - if (disallowedModifiers?.includes(modifier)) { - this.raise(this.start, errorTemplate); - } - } - return modifiedMap; - } - tsParseInOutModifiers(node) { - this.tsParseModifiers({ - modified: node, - allowedModifiers: ["in", "out"], - disallowedModifiers: [ - "public", - "private", - "protected", - "readonly", - "declare", - "abstract", - "override" - ], - errorTemplate: TypeScriptError.InvalidModifierOnTypeParameter - }); - } - // Handle type assertions - parseMaybeUnary(refExpressionErrors, sawUnary, incDec, forInit) { - if (!options?.jsx && this.tsMatchLeftRelational()) { - return this.tsParseTypeAssertion(); - } else { - return super.parseMaybeUnary(refExpressionErrors, sawUnary, incDec, forInit); - } - } - tsParseTypeAssertion() { - if (disallowAmbiguousJSXLike) { - this.raise(this.start, TypeScriptError.ReservedTypeAssertion); - } - const result = this.tryParse(() => { - const node = this.startNode(); - const _const = this.tsTryNextParseConstantContext(); - node.typeAnnotation = _const || this.tsNextThenParseType(); - this.expect(tt.relational); - node.expression = this.parseMaybeUnary(); - return this.finishNode(node, "TSTypeAssertion"); - }); - if (result.error) { - return this.tsParseTypeParameters(this.tsParseConstModifier); - } else { - return result.node; - } - } - tsParseTypeArguments() { - const node = this.startNode(); - node.params = this.tsInType( - () => ( - // Temporarily remove a JSX parsing context, which makes us scan different tokens. - this.tsInNoContext(() => { - this.expect(tt.relational); - return this.tsParseDelimitedList( - "TypeParametersOrArguments", - this.tsParseType.bind(this) - ); - }) - ) - ); - if (node.params.length === 0) { - this.raise(this.start, TypeScriptError.EmptyTypeArguments); - } - this.exprAllowed = false; - this.expect(tt.relational); - return this.finishNode(node, "TSTypeParameterInstantiation"); - } - tsParseHeritageClause(token) { - const originalStart = this.start; - const delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => { - const node = this.startNode(); - node.expression = this.tsParseEntityName(); - if (this.tsMatchLeftRelational()) { - node.typeParameters = this.tsParseTypeArguments(); - } - return this.finishNode(node, "TSExpressionWithTypeArguments"); - }); - if (!delimitedList.length) { - this.raise(originalStart, TypeScriptError.EmptyHeritageClauseType({ token })); - } - return delimitedList; - } - tsParseTypeMemberSemicolon() { - if (!this.eat(tt.comma) && !this.isLineTerminator()) { - this.expect(tt.semi); - } - } - tsTryParseAndCatch(f) { - const result = this.tryParse( - (abort) => ( - // @ts-expect-error todo(flow->ts) - f() || abort() - ) - ); - if (result.aborted || !result.node) return void 0; - if (result.error) this.setLookaheadState(result.failState); - return result.node; - } - tsParseSignatureMember(kind, node) { - this.tsFillSignature(tt.colon, node); - this.tsParseTypeMemberSemicolon(); - return this.finishNode(node, kind); - } - tsParsePropertyOrMethodSignature(node, readonly) { - if (this.eat(tt.question)) node.optional = true; - const nodeAny = node; - if (this.match(tt.parenL) || this.tsMatchLeftRelational()) { - if (readonly) { - this.raise(node.start, TypeScriptError.ReadonlyForMethodSignature); - } - const method = nodeAny; - if (method.kind && this.tsMatchLeftRelational()) { - this.raise(this.start, TypeScriptError.AccesorCannotHaveTypeParameters); - } - this.tsFillSignature(tt.colon, method); - this.tsParseTypeMemberSemicolon(); - const paramsKey = "parameters"; - const returnTypeKey = "typeAnnotation"; - if (method.kind === "get") { - if (method[paramsKey].length > 0) { - this.raise(this.start, "A 'get' accesor must not have any formal parameters."); - if (this.isThisParam(method[paramsKey][0])) { - this.raise(this.start, TypeScriptError.AccesorCannotDeclareThisParameter); - } - } - } else if (method.kind === "set") { - if (method[paramsKey].length !== 1) { - this.raise(this.start, "A 'get' accesor must not have any formal parameters."); - } else { - const firstParameter = method[paramsKey][0]; - if (this.isThisParam(firstParameter)) { - this.raise(this.start, TypeScriptError.AccesorCannotDeclareThisParameter); - } - if (firstParameter.type === "Identifier" && firstParameter.optional) { - this.raise(this.start, TypeScriptError.SetAccesorCannotHaveOptionalParameter); - } - if (firstParameter.type === "RestElement") { - this.raise(this.start, TypeScriptError.SetAccesorCannotHaveRestParameter); - } - } - if (method[returnTypeKey]) { - this.raise( - method[returnTypeKey].start, - TypeScriptError.SetAccesorCannotHaveReturnType - ); - } - } else { - method.kind = "method"; - } - return this.finishNode(method, "TSMethodSignature"); - } else { - const property = nodeAny; - if (readonly) property.readonly = true; - const type = this.tsTryParseTypeAnnotation(); - if (type) property.typeAnnotation = type; - this.tsParseTypeMemberSemicolon(); - return this.finishNode(property, "TSPropertySignature"); - } - } - tsParseTypeMember() { - const node = this.startNode(); - if (this.match(tt.parenL) || this.tsMatchLeftRelational()) { - return this.tsParseSignatureMember("TSCallSignatureDeclaration", node); - } - if (this.match(tt._new)) { - const id = this.startNode(); - this.next(); - if (this.match(tt.parenL) || this.tsMatchLeftRelational()) { - return this.tsParseSignatureMember("TSConstructSignatureDeclaration", node); - } else { - node.key = this.createIdentifier(id, "new"); - return this.tsParsePropertyOrMethodSignature(node, false); - } - } - this.tsParseModifiers({ - modified: node, - allowedModifiers: ["readonly"], - disallowedModifiers: [ - "declare", - "abstract", - "private", - "protected", - "public", - "static", - "override" - ] - }); - const idx = this.tsTryParseIndexSignature(node); - if (idx) { - return idx; - } - this.parsePropertyName(node); - if (!node.computed && node.key.type === "Identifier" && (node.key.name === "get" || node.key.name === "set") && this.tsTokenCanFollowModifier()) { - node.kind = node.key.name; - this.parsePropertyName(node); - } - return this.tsParsePropertyOrMethodSignature(node, !!node.readonly); - } - tsParseList(kind, parseElement) { - const result = []; - while (!this.tsIsListTerminator(kind)) { - result.push(parseElement()); - } - return result; - } - tsParseObjectTypeMembers() { - this.expect(tt.braceL); - const members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this)); - this.expect(tt.braceR); - return members; - } - tsParseInterfaceDeclaration(node, properties = {}) { - if (this.hasFollowingLineBreak()) return null; - this.expectContextual("interface"); - if (properties.declare) node.declare = true; - if (tokenIsIdentifier(this.type)) { - node.id = this.parseIdent(); - this.checkLValSimple(node.id, acornScope.BIND_TS_INTERFACE); - } else { - node.id = null; - this.raise(this.start, TypeScriptError.MissingInterfaceName); - } - node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this)); - if (this.eat(tt._extends)) { - node.extends = this.tsParseHeritageClause("extends"); - } - const body = this.startNode(); - body.body = this.tsParseInterfaceBody(); - node.body = this.finishNode(body, "TSInterfaceBody"); - return this.finishNode(node, "TSInterfaceDeclaration"); - } - /** - * Parse interface body, ensuring the closing brace is read outside of type context - * so that decorators following the interface are properly tokenized. - */ - tsParseInterfaceBody() { - this.expect(tt.braceL); - const oldInType = this.inType; - this.inType = true; - let members = this.tsParseList("TypeMembers", this.tsParseTypeMember.bind(this)); - this.inType = oldInType; - this.expect(tt.braceR); - return members; - } - tsParseAbstractDeclaration(node) { - if (this.match(tt._class)) { - node.abstract = true; - return this.parseClass(node, true); - } else if (this.ts_isContextual(tokTypes2.interface)) { - if (!this.hasFollowingLineBreak()) { - node.abstract = true; - return this.tsParseInterfaceDeclaration(node); - } - } else { - this.unexpected(node.start); - } - } - tsIsDeclarationStart() { - return tokenIsTSDeclarationStart(this.type); - } - tsParseExpressionStatement(node, expr) { - switch (expr.name) { - case "declare": { - const declaration = this.tsTryParseDeclare(node); - if (declaration) { - declaration.declare = true; - return declaration; - } - break; - } - case "global": - if (this.match(tt.braceL)) { - this.enterScope(TS_SCOPE_TS_MODULE); - const mod = node; - mod.global = true; - mod.id = expr; - mod.body = this.tsParseModuleBlock(); - super.exitScope(); - return this.finishNode(mod, "TSModuleDeclaration"); - } - break; - default: - return this.tsParseDeclaration( - node, - expr.name, - /* next */ - false - ); - } - } - tsParseModuleReference() { - return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName( - /* allowReservedWords */ - false - ); - } - tsIsExportDefaultSpecifier() { - const { type } = this; - const isAsync = this.isAsyncFunction(); - const isLet = this.isLet(); - if (tokenIsIdentifier(type)) { - if (isAsync && !this.containsEsc || isLet) { - return false; - } - if ((type === tokTypes2.type || type === tokTypes2.interface) && !this.containsEsc) { - const ahead = this.lookahead(); - if (tokenIsIdentifier(ahead.type) && !this.isContextualWithState("from", ahead) || ahead.type === tt.braceL) { - return false; - } - } - } else if (!this.match(tt._default)) { - return false; - } - const next = this.nextTokenStart(); - const hasFrom = this.isUnparsedContextual(next, "from"); - if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.type) && hasFrom) { - return true; - } - if (this.match(tt._default) && hasFrom) { - const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4)); - return nextAfterFrom === 34 || nextAfterFrom === 39; - } - return false; - } - tsInAmbientContext(cb) { - const oldIsAmbientContext = this.isAmbientContext; - this.isAmbientContext = true; - try { - return cb(); - } finally { - this.isAmbientContext = oldIsAmbientContext; - } - } - tsCheckLineTerminator(next) { - if (next) { - if (this.hasFollowingLineBreak()) return false; - this.next(); - return true; - } - return !this.isLineTerminator(); - } - tsParseModuleOrNamespaceDeclaration(node, nested = false) { - node.id = this.parseIdent(); - if (!nested) { - this.checkLValSimple(node.id, acornScope.BIND_TS_NAMESPACE); - } - if (this.eat(tt.dot)) { - const inner = this.startNode(); - this.tsParseModuleOrNamespaceDeclaration(inner, true); - node.body = inner; - } else { - this.enterScope(TS_SCOPE_TS_MODULE); - node.body = this.tsParseModuleBlock(); - super.exitScope(); - } - return this.finishNode(node, "TSModuleDeclaration"); - } - checkLValSimple(expr, bindingType = acornScope.BIND_NONE, checkClashes) { - if (expr.type === "TSNonNullExpression" || expr.type === "TSAsExpression") { - expr = expr.expression; - } - return super.checkLValSimple(expr, bindingType, checkClashes); - } - tsParseTypeAliasDeclaration(node) { - node.id = this.parseIdent(); - this.checkLValSimple(node.id, acornScope.BIND_TS_TYPE); - node.typeAnnotation = this.tsInType(() => { - node.typeParameters = this.tsTryParseTypeParameters( - this.tsParseInOutModifiers.bind(this) - ); - this.expect(tt.eq); - if (this.ts_isContextual(tokTypes2.interface) && this.lookahead().type !== tt.dot) { - const node2 = this.startNode(); - this.next(); - return this.finishNode(node2, "TSIntrinsicKeyword"); - } - return this.tsParseType(); - }); - this.semicolon(); - return this.finishNode(node, "TSTypeAliasDeclaration"); - } - // Common to tsTryParseDeclare, tsTryParseExportDeclaration, and tsParseExpressionStatement. - tsParseDeclaration(node, value, next) { - switch (value) { - case "abstract": - if (this.tsCheckLineTerminator(next) && (this.match(tt._class) || tokenIsIdentifier(this.type))) { - return this.tsParseAbstractDeclaration(node); - } - break; - case "module": - if (this.tsCheckLineTerminator(next)) { - if (this.match(tt.string)) { - return this.tsParseAmbientExternalModuleDeclaration(node); - } else if (tokenIsIdentifier(this.type)) { - return this.tsParseModuleOrNamespaceDeclaration(node); - } - } - break; - case "namespace": - if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.type)) { - return this.tsParseModuleOrNamespaceDeclaration(node); - } - break; - case "type": - if (this.tsCheckLineTerminator(next) && tokenIsIdentifier(this.type)) { - return this.tsParseTypeAliasDeclaration(node); - } - break; - } - } - // Note: this won't b·e called unless the keyword is allowed in - // `shouldParseExportDeclaration`. - tsTryParseExportDeclaration() { - return this.tsParseDeclaration( - this.startNode(), - this.value, - /* next */ - true - ); - } - tsParseImportEqualsDeclaration(node, isExport) { - node.isExport = isExport || false; - node.id = this.parseIdent(); - this.checkLValSimple(node.id, acornScope.BIND_LEXICAL); - super.expect(tt.eq); - const moduleReference = this.tsParseModuleReference(); - if (node.importKind === "type" && moduleReference.type !== "TSExternalModuleReference") { - this.raise(moduleReference.start, TypeScriptError.ImportAliasHasImportType); - } - node.moduleReference = moduleReference; - super.semicolon(); - return this.finishNode(node, "TSImportEqualsDeclaration"); - } - isExportDefaultSpecifier() { - if (this.tsIsDeclarationStart()) return false; - const { type } = this; - if (tokenIsIdentifier(type)) { - if (this.isContextual("async") || this.isContextual("let")) { - return false; - } - if ((type === tokTypes2.type || type === tokTypes2.interface) && !this.containsEsc) { - const ahead = this.lookahead(); - if (tokenIsIdentifier(ahead.type) && !this.isContextualWithState("from", ahead) || ahead.type === tt.braceL) { - return false; - } - } - } else if (!this.match(tt._default)) { - return false; - } - const next = this.nextTokenStart(); - const hasFrom = this.isUnparsedContextual(next, "from"); - if (this.input.charCodeAt(next) === 44 || tokenIsIdentifier(this.type) && hasFrom) { - return true; - } - if (this.match(tt._default) && hasFrom) { - const nextAfterFrom = this.input.charCodeAt(this.nextTokenStartSince(next + 4)); - return nextAfterFrom === 34 || nextAfterFrom === 39; - } - return false; - } - parseTemplate({ isTagged = false } = {}) { - let node = this.startNode(); - this.next(); - node.expressions = []; - let curElt = this.parseTemplateElement({ isTagged }); - node.quasis = [curElt]; - while (!curElt.tail) { - if (this.type === tt.eof) this.raise(this.pos, "Unterminated template literal"); - this.expect(tt.dollarBraceL); - node.expressions.push(this.inType ? this.tsParseType() : this.parseExpression()); - this.expect(tt.braceR); - node.quasis.push(curElt = this.parseTemplateElement({ isTagged })); - } - this.next(); - return this.finishNode(node, "TemplateLiteral"); - } - parseFunction(node, statement, allowExpressionBody, isAsync, forInit) { - this.initFunction(node); - if (this.ecmaVersion >= 9 || this.ecmaVersion >= 6 && !isAsync) { - if (this.type === tt.star && statement & FUNC_HANGING_STATEMENT) { - this.unexpected(); - } - node.generator = this.eat(tt.star); - } - if (this.ecmaVersion >= 8) { - node.async = !!isAsync; - } - if (statement & FUNC_STATEMENT) { - node.id = statement & FUNC_NULLABLE_ID && this.type !== tt.name ? null : this.parseIdent(); - } - let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - const oldMaybeInArrowParameters = this.maybeInArrowParameters; - this.maybeInArrowParameters = false; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - this.enterScope(functionFlags(node.async, node.generator)); - if (!(statement & FUNC_STATEMENT)) { - node.id = this.type === tt.name ? this.parseIdent() : null; - } - this.parseFunctionParams(node); - const isDeclaration = statement & FUNC_STATEMENT; - this.parseFunctionBody(node, allowExpressionBody, false, forInit, { - isFunctionDeclaration: isDeclaration - }); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - if (statement & FUNC_STATEMENT && node.id && !(statement & FUNC_HANGING_STATEMENT)) { - if (node.body) { - this.checkLValSimple( - node.id, - this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? acornScope.BIND_VAR : acornScope.BIND_LEXICAL : acornScope.BIND_FUNCTION - ); - } else { - this.checkLValSimple(node.id, acornScope.BIND_NONE); - } - } - this.maybeInArrowParameters = oldMaybeInArrowParameters; - return this.finishNode(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression"); - } - parseFunctionBody(node, isArrowFunction = false, isMethod = false, forInit = false, tsConfig) { - if (this.match(tt.colon)) { - node.returnType = this.tsParseTypeOrTypePredicateAnnotation(tt.colon); - } - const bodilessType = tsConfig?.isFunctionDeclaration ? "TSDeclareFunction" : tsConfig?.isClassMethod ? "TSDeclareMethod" : void 0; - if (bodilessType && !this.match(tt.braceL) && this.isLineTerminator()) { - this.exitScope(); - return this.finishNode(node, bodilessType); - } - if (bodilessType === "TSDeclareFunction" && this.isAmbientContext) { - this.raise(node.start, TypeScriptError.DeclareFunctionHasImplementation); - if (node.declare) { - super.parseFunctionBody(node, isArrowFunction, isMethod, false); - return this.finishNode(node, bodilessType); - } - } - super.parseFunctionBody(node, isArrowFunction, isMethod, forInit); - return node; - } - parseNew() { - if (this.containsEsc) this.raiseRecoverable(this.start, "Escape sequence in keyword new"); - let node = this.startNode(); - let meta = this.parseIdent(true); - if (this.ecmaVersion >= 6 && this.eat(tt.dot)) { - node.meta = meta; - let containsEsc = this.containsEsc; - node.property = this.parseIdent(true); - if (node.property.name !== "target") - this.raiseRecoverable( - node.property.start, - "The only valid meta property for new is 'new.target'" - ); - if (containsEsc) - this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); - if (!this["allowNewDotTarget"]) - this.raiseRecoverable( - node.start, - "'new.target' can only be used in functions and class static block" - ); - return this.finishNode(node, "MetaProperty"); - } - let startPos = this.start, startLoc = this.startLoc, isImport = this.type === tt._import; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); - if (isImport && node.callee.type === "ImportExpression") { - this.raise(startPos, "Cannot use new with import()"); - } - const { callee } = node; - if (callee.type === "TSInstantiationExpression" && !callee.extra?.parenthesized) { - node.typeArguments = callee.typeArguments; - node.callee = callee.expression; - } - if (this.eat(tt.parenL)) - node.arguments = this.parseExprList(tt.parenR, this.ecmaVersion >= 8, false); - else node.arguments = []; - return this.finishNode(node, "NewExpression"); - } - parseExprOp(left, leftStartPos, leftStartLoc, minPrec, forInit) { - if (tt._in.binop > minPrec && !this.hasPrecedingLineBreak()) { - let nodeType; - if (this.isContextual("as")) { - nodeType = "TSAsExpression"; - } - if (this.isContextual("satisfies")) { - nodeType = "TSSatisfiesExpression"; - } - if (nodeType) { - const node = this.startNodeAt(leftStartPos, leftStartLoc); - node.expression = left; - const _const = this.tsTryNextParseConstantContext(); - if (_const) { - node.typeAnnotation = _const; - } else { - node.typeAnnotation = this.tsNextThenParseType(); - } - this.finishNode(node, nodeType); - this.reScan_lt_gt(); - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); - } - } - return super.parseExprOp(left, leftStartPos, leftStartLoc, minPrec, forInit); - } - parseImportSpecifiers() { - let nodes = [], first = true; - if (acornTypeScript.tokenIsIdentifier(this.type)) { - nodes.push(this.parseImportDefaultSpecifier()); - if (!this.eat(tt.comma)) return nodes; - } - if (this.type === tt.star) { - nodes.push(this.parseImportNamespaceSpecifier()); - return nodes; - } - this.expect(tt.braceL); - while (!this.eat(tt.braceR)) { - if (!first) { - this.expect(tt.comma); - if (this.afterTrailingComma(tt.braceR)) break; - } else first = false; - nodes.push(this.parseImportSpecifier()); - } - return nodes; - } - /** - * @param {Node} node this may be ImportDeclaration | - * TsImportEqualsDeclaration - * @returns AnyImport - * */ - parseImport(node) { - let enterHead = this.lookahead(); - node.importKind = "value"; - this.importOrExportOuterKind = "value"; - if (tokenIsIdentifier(enterHead.type) || this.match(tt.star) || this.match(tt.braceL)) { - let ahead = this.lookahead(2); - if ( - // import type, { a } from "b"; - ahead.type !== tt.comma && // import type from "a"; - !this.isContextualWithState("from", ahead) && // import type = require("a"); - ahead.type !== tt.eq && this.ts_eatContextualWithState("type", 1, enterHead) - ) { - this.importOrExportOuterKind = "type"; - node.importKind = "type"; - enterHead = this.lookahead(); - ahead = this.lookahead(2); - } - if (tokenIsIdentifier(enterHead.type) && ahead.type === tt.eq) { - this.next(); - const importNode = this.tsParseImportEqualsDeclaration(node); - this.importOrExportOuterKind = "value"; - return importNode; - } - } - this.next(); - if (this.type === tt.string) { - node.specifiers = []; - node.source = this.parseExprAtom(); - } else { - node.specifiers = this.parseImportSpecifiers(); - this.expectContextual("from"); - node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected(); - } - this.parseMaybeImportAttributes(node); - this.semicolon(); - this.finishNode(node, "ImportDeclaration"); - this.importOrExportOuterKind = "value"; - if (node.importKind === "type" && node.specifiers.length > 1 && node.specifiers[0].type === "ImportDefaultSpecifier") { - this.raise(node.start, TypeScriptError.TypeImportCannotSpecifyDefaultAndNamed); - } - return node; - } - parseExportDefaultDeclaration() { - if (this.isAbstractClass()) { - const cls = this.startNode(); - this.next(); - cls.abstract = true; - return this.parseClass(cls, true); - } - if (this.match(tokTypes2.interface)) { - const result = this.tsParseInterfaceDeclaration(this.startNode()); - if (result) return result; - } - return super.parseExportDefaultDeclaration(); - } - parseExportAllDeclaration(node, exports) { - if (this.ecmaVersion >= 11) { - if (this.eatContextual("as")) { - node.exported = this.parseModuleExportName(); - this.checkExport(exports, node.exported, this.lastTokStart); - } else { - node.exported = null; - } - } - this.expectContextual("from"); - if (this.type !== tt.string) this.unexpected(); - node.source = this.parseExprAtom(); - this.parseMaybeImportAttributes(node); - this.semicolon(); - return this.finishNode(node, "ExportAllDeclaration"); - } - parseDynamicImport(node) { - this.next(); - node.source = this.parseMaybeAssign(); - if (this.eat(tt.comma)) { - const expr = this.parseExpression(); - node.arguments = [expr]; - } - if (!this.eat(tt.parenR)) { - const errorPos = this.start; - if (this.eat(tt.comma) && this.eat(tt.parenR)) { - this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); - } else { - this.unexpected(errorPos); - } - } - return this.finishNode(node, "ImportExpression"); - } - parseExport(node, exports) { - let enterHead = this.lookahead(); - if (this.ts_eatWithState(tt._import, 2, enterHead)) { - if (this.ts_isContextual(tokTypes2.type) && this.lookaheadCharCode() !== 61) { - node.importKind = "type"; - this.importOrExportOuterKind = "type"; - this.next(); - } else { - node.importKind = "value"; - this.importOrExportOuterKind = "value"; - } - const exportEqualsNode = this.tsParseImportEqualsDeclaration( - node, - /* isExport */ - true - ); - this.importOrExportOuterKind = void 0; - return exportEqualsNode; - } else if (this.ts_eatWithState(tt.eq, 2, enterHead)) { - const assign = node; - assign.expression = this.parseExpression(); - this.semicolon(); - this.importOrExportOuterKind = void 0; - return this.finishNode(assign, "TSExportAssignment"); - } else if (this.ts_eatContextualWithState("as", 2, enterHead)) { - const decl = node; - this.expectContextual("namespace"); - decl.id = this.parseIdent(); - this.semicolon(); - this.importOrExportOuterKind = void 0; - return this.finishNode(decl, "TSNamespaceExportDeclaration"); - } else { - const lookahead2 = this.lookahead(2).type; - if (this.ts_isContextualWithState(enterHead, tokTypes2.type) && (lookahead2 === tt.braceL || // export type { ... } - lookahead2 === tt.star)) { - this.next(); - this.importOrExportOuterKind = "type"; - node.exportKind = "type"; - } else { - this.importOrExportOuterKind = "value"; - node.exportKind = "value"; - } - this.next(); - if (this.eat(tt.star)) { - return this.parseExportAllDeclaration(node, exports); - } - if (this.eat(tt._default)) { - this.checkExport(exports, "default", this.lastTokStart); - node.declaration = this.parseExportDefaultDeclaration(); - return this.finishNode(node, "ExportDefaultDeclaration"); - } - if (this.shouldParseExportStatement()) { - node.declaration = this.parseExportDeclaration(node); - if (node.declaration.type === "VariableDeclaration") - this.checkVariableExport(exports, node.declaration.declarations); - else this.checkExport(exports, node.declaration.id, node.declaration.id.start); - node.specifiers = []; - node.source = null; - } else { - node.declaration = null; - node.specifiers = this.parseExportSpecifiers(exports); - if (this.eatContextual("from")) { - if (this.type !== tt.string) this.unexpected(); - node.source = this.parseExprAtom(); - this.parseMaybeImportAttributes(node); - } else { - for (let spec of node.specifiers) { - this.checkUnreserved(spec.local); - this.checkLocalExport(spec.local); - if (spec.local.type === "Literal") { - this.raise( - spec.local.start, - "A string literal cannot be used as an exported binding without `from`." - ); - } - } - node.source = null; - } - this.semicolon(); - } - return this.finishNode(node, "ExportNamedDeclaration"); - } - } - checkExport(exports, name, _) { - if (!exports) { - return; - } - if (typeof name !== "string") { - name = name.type === "Identifier" ? name.name : name.value; - } - exports[name] = true; - } - parseMaybeDefault(startPos, startLoc, left) { - const node = super.parseMaybeDefault(startPos, startLoc, left); - if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) { - this.raise(node.typeAnnotation.start, TypeScriptError.TypeAnnotationAfterAssign); - } - return node; - } - typeCastToParameter(node) { - node.expression.typeAnnotation = node.typeAnnotation; - this.resetEndLocation( - node.expression, - node.typeAnnotation.end, - node.typeAnnotation.loc?.end - ); - return node.expression; - } - toAssignableList(exprList, isBinding) { - if (!exprList) exprList = []; - for (let i = 0; i < exprList.length; i++) { - const expr = exprList[i]; - if (expr?.type === "TSTypeCastExpression") { - exprList[i] = this.typeCastToParameter(expr); - } - } - return super.toAssignableList(exprList, isBinding); - } - reportReservedArrowTypeParam(node) { - if (node.params.length === 1 && !node.extra?.trailingComma && disallowAmbiguousJSXLike) { - this.raise(node.start, TypeScriptError.ReservedArrowTypeParam); - } - } - parseExprAtom(refDestructuringErrors, forInit, forNew) { - if (this.type === tokTypes2.jsxText) { - return this.jsx_parseText(); - } else if (this.type === tokTypes2.jsxTagStart) { - return this.jsx_parseElement(); - } else if (this.type === tokTypes2.at) { - this.parseDecorators(); - return this.parseExprAtom(); - } else if (tokenIsIdentifier(this.type)) { - let canBeArrow = this.potentialArrowAt === this.start; - let startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; - let id = this.parseIdent(false); - if (this.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(tt._function)) { - this.overrideContext(tokContexts.f_expr); - return this.parseFunction( - this.startNodeAt(startPos, startLoc), - 0, - false, - true, - forInit - ); - } - if (canBeArrow && !this.canInsertSemicolon()) { - if (this.eat(tt.arrow)) - return this.parseArrowExpression( - this.startNodeAt(startPos, startLoc), - [id], - false, - forInit - ); - if (this.ecmaVersion >= 8 && id.name === "async" && this.type === tt.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { - id = this.parseIdent(false); - if (this.canInsertSemicolon() || !this.eat(tt.arrow)) this.unexpected(); - return this.parseArrowExpression( - this.startNodeAt(startPos, startLoc), - [id], - true, - forInit - ); - } - } - return id; - } else { - return super.parseExprAtom(refDestructuringErrors, forInit, forNew); - } - } - parseExprAtomDefault() { - if (tokenIsIdentifier(this.type)) { - const canBeArrow = this["potentialArrowAt"] === this.start; - const containsEsc = this.containsEsc; - const id = this.parseIdent(); - if (!containsEsc && id.name === "async" && !this.canInsertSemicolon()) { - const { type } = this; - if (type === tt._function) { - this.next(); - return this.parseFunction(this.startNodeAtNode(id), void 0, true, true); - } else if (tokenIsIdentifier(type)) { - if (this.lookaheadCharCode() === 61) { - const paramId = this.parseIdent(false); - if (this.canInsertSemicolon() || !this.eat(tt.arrow)) this.unexpected(); - return this.parseArrowExpression(this.startNodeAtNode(id), [paramId], true); - } else { - return id; - } - } - } - if (canBeArrow && this.match(tt.arrow) && !this.canInsertSemicolon()) { - this.next(); - return this.parseArrowExpression(this.startNodeAtNode(id), [id], false); - } - return id; - } else { - this.unexpected(); - } - } - parseIdentNode() { - let node = this.startNode(); - if (tokenIsKeywordOrIdentifier(this.type) && // Taken from super-class method - !((this.type.keyword === "class" || this.type.keyword === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46))) { - node.name = this.value; - } else { - return super.parseIdentNode(); - } - return node; - } - parseVarStatement(node, kind, allowMissingInitializer = false) { - const { isAmbientContext } = this; - this.next(); - super.parseVar(node, false, kind, allowMissingInitializer || isAmbientContext); - this.semicolon(); - const declaration = this.finishNode(node, "VariableDeclaration"); - if (!isAmbientContext) return declaration; - for (const { id, init } of declaration.declarations) { - if (!init) continue; - if (kind !== "const" || !!id.typeAnnotation) { - this.raise(init.start, TypeScriptError.InitializerNotAllowedInAmbientContext); - } else if (init.type !== "StringLiteral" && init.type !== "BooleanLiteral" && init.type !== "NumericLiteral" && init.type !== "BigIntLiteral" && (init.type !== "TemplateLiteral" || init.expressions.length > 0) && !isPossiblyLiteralEnum(init)) { - this.raise( - init.start, - TypeScriptError.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference - ); - } - } - return declaration; - } - parseStatement(context, topLevel, exports) { - if (this.match(tokTypes2.at)) { - this.parseDecorators(true); - } - if (this.match(tt._const) && this.isLookaheadContextual("enum")) { - const node = this.startNode(); - this.expect(tt._const); - return this.tsParseEnumDeclaration(node, { const: true }); - } - if (this.ts_isContextual(tokTypes2.enum)) { - return this.tsParseEnumDeclaration(this.startNode()); - } - if (this.ts_isContextual(tokTypes2.interface)) { - const result = this.tsParseInterfaceDeclaration(this.startNode()); - if (result) return result; - } - return super.parseStatement(context, topLevel, exports); - } - // NOTE: unused function - parseAccessModifier() { - return this.tsParseModifier(["public", "protected", "private"]); - } - parsePostMemberNameModifiers(methodOrProp) { - const optional = this.eat(tt.question); - if (optional) methodOrProp.optional = true; - if (methodOrProp.readonly && this.match(tt.parenL)) { - this.raise(methodOrProp.start, TypeScriptError.ClassMethodHasReadonly); - } - if (methodOrProp.declare && this.match(tt.parenL)) { - this.raise(methodOrProp.start, TypeScriptError.ClassMethodHasDeclare); - } - } - // Note: The reason we do this in `parseExpressionStatement` and not `parseStatement` - // is that e.g. `type()` is valid JS, so we must try parsing that first. - // If it's really a type, we will parse `type` as the statement, and can correct it here - // by parsing the rest. - parseExpressionStatement(node, expr) { - const decl = expr.type === "Identifier" ? this.tsParseExpressionStatement(node, expr) : void 0; - return decl || super.parseExpressionStatement(node, expr); - } - shouldParseExportStatement() { - if (this.tsIsDeclarationStart()) return true; - if (this.match(tokTypes2.at)) { - return true; - } - return super.shouldParseExportStatement(); - } - parseConditional(expr, startPos, startLoc, forInit, refDestructuringErrors) { - if (this.eat(tt.question)) { - let node = this.startNodeAt(startPos, startLoc); - node.test = expr; - node.consequent = this.parseMaybeAssign(); - this.expect(tt.colon); - node.alternate = this.parseMaybeAssign(forInit); - return this.finishNode(node, "ConditionalExpression"); - } - return expr; - } - parseMaybeConditional(forInit, refDestructuringErrors) { - let startPos = this.start, startLoc = this.startLoc; - let expr = this.parseExprOps(forInit, refDestructuringErrors); - if (this.checkExpressionErrors(refDestructuringErrors)) return expr; - if (!this.maybeInArrowParameters || !this.match(tt.question)) { - return this.parseConditional(expr, startPos, startLoc, forInit, refDestructuringErrors); - } - const result = this.tryParse( - () => this.parseConditional(expr, startPos, startLoc, forInit, refDestructuringErrors) - ); - if (!result.node) { - if (result.error) { - this.setOptionalParametersError(refDestructuringErrors, result.error); - } - return expr; - } - if (result.error) this.setLookaheadState(result.failState); - return result.node; - } - parseParenItem(node) { - const startPos = this.start; - const startLoc = this.startLoc; - node = super.parseParenItem(node); - if (this.eat(tt.question)) { - node.optional = true; - this.resetEndLocation(node); - } - if (this.match(tt.colon)) { - const typeCastNode = this.startNodeAt(startPos, startLoc); - typeCastNode.expression = node; - typeCastNode.typeAnnotation = this.tsParseTypeAnnotation(); - return this.finishNode(typeCastNode, "TSTypeCastExpression"); - } - return node; - } - parseExportDeclaration(node) { - if (!this.isAmbientContext && this.ts_isContextual(tokTypes2.declare)) { - return this.tsInAmbientContext(() => this.parseExportDeclaration(node)); - } - const startPos = this.start; - const startLoc = this.startLoc; - const isDeclare = this.eatContextual("declare"); - if (isDeclare && (this.ts_isContextual(tokTypes2.declare) || !this.shouldParseExportStatement())) { - this.raise(this.start, TypeScriptError.ExpectedAmbientAfterExportDeclare); - } - const isIdentifier = tokenIsIdentifier(this.type); - const declaration = isIdentifier && this.tsTryParseExportDeclaration() || this.parseStatement(null); - if (!declaration) return null; - if (declaration.type === "TSInterfaceDeclaration" || declaration.type === "TSTypeAliasDeclaration" || isDeclare) { - node.exportKind = "type"; - } - if (isDeclare) { - this.resetStartLocation(declaration, startPos, startLoc); - declaration.declare = true; - } - return declaration; - } - parseClassId(node, isStatement) { - if (!isStatement && this.isContextual("implements")) { - return; - } - super.parseClassId(node, isStatement); - const typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers.bind(this)); - if (typeParameters) node.typeParameters = typeParameters; - } - parseClassPropertyAnnotation(node) { - if (!node.optional) { - if (this.value === "!" && this.eat(tt.prefix)) { - node.definite = true; - } else if (this.eat(tt.question)) { - node.optional = true; - } - } - const type = this.tsTryParseTypeAnnotation(); - if (type) node.typeAnnotation = type; - } - parseClassField(field) { - const isPrivate = field.key.type === "PrivateIdentifier"; - if (isPrivate) { - if (field.abstract) { - this.raise(field.start, TypeScriptError.PrivateElementHasAbstract); - } - if (field.accessibility) { - this.raise( - field.start, - TypeScriptError.PrivateElementHasAccessibility({ - modifier: field.accessibility - }) - ); - } - this.parseClassPropertyAnnotation(field); - } else { - this.parseClassPropertyAnnotation(field); - if (this.isAmbientContext && !(field.readonly && !field.typeAnnotation) && this.match(tt.eq)) { - this.raise(this.start, TypeScriptError.DeclareClassFieldHasInitializer); - } - if (field.abstract && this.match(tt.eq)) { - const { key } = field; - this.raise( - this.start, - TypeScriptError.AbstractPropertyHasInitializer({ - propertyName: key.type === "Identifier" && !field.computed ? key.name : `[${this.input.slice(key.start, key.end)}]` - }) - ); - } - } - return super.parseClassField(field); - } - parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper) { - const isConstructor = method.kind === "constructor"; - const isPrivate = method.key.type === "PrivateIdentifier"; - const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); - if (isPrivate) { - if (typeParameters) method.typeParameters = typeParameters; - if (method.accessibility) { - this.raise( - method.start, - TypeScriptError.PrivateMethodsHasAccessibility({ - modifier: method.accessibility - }) - ); - } - } else { - if (typeParameters && isConstructor) { - this.raise(typeParameters.start, TypeScriptError.ConstructorHasTypeParameters); - } - } - const { declare = false, kind } = method; - if (declare && (kind === "get" || kind === "set")) { - this.raise(method.start, TypeScriptError.DeclareAccessor({ kind })); - } - if (typeParameters) method.typeParameters = typeParameters; - const key = method.key; - if (method.kind === "constructor") { - if (isGenerator) this.raise(key.start, "Constructor can't be a generator"); - if (isAsync) this.raise(key.start, "Constructor can't be an async method"); - } else if (method.static && checkKeyName(method, "prototype")) { - this.raise(key.start, "Classes may not have a static property named prototype"); - } - const value = method.value = this.parseMethod( - isGenerator, - isAsync, - allowsDirectSuper, - true, - method - ); - if (method.kind === "get" && value["params"].length !== 0) - this.raiseRecoverable(value.start, "getter should have no params"); - if (method.kind === "set" && value["params"].length !== 1) - this.raiseRecoverable(value.start, "setter should have exactly one param"); - if (method.kind === "set" && value["params"][0].type === "RestElement") - this.raiseRecoverable(value["params"][0].start, "Setter cannot use rest params"); - return this.finishNode(method, "MethodDefinition"); - } - isClassMethod() { - return this.match(tt.relational); - } - parseClassElement(constructorAllowsSuper) { - if (this.eat(tt.semi)) return null; - let node = this.startNode(); - let keyName = ""; - let isGenerator = false; - let isAsync = false; - let kind = "method"; - let isStatic = false; - const modifiers = [ - "declare", - "private", - "public", - "protected", - "accessor", - "override", - "abstract", - "readonly", - "static" - ]; - const modifierMap = this.tsParseModifiers({ - modified: node, - allowedModifiers: modifiers, - disallowedModifiers: ["in", "out"], - stopOnStartOfClassStaticBlock: true, - errorTemplate: TypeScriptError.InvalidModifierOnTypeParameterPositions - }); - isStatic = Boolean(modifierMap.static); - const callParseClassMemberWithIsStatic = () => { - if (this.tsIsStartOfStaticBlocks()) { - this.next(); - this.next(); - if (this.tsHasSomeModifiers(node, modifiers)) { - this.raise(this.start, TypeScriptError.StaticBlockCannotHaveModifier); - } - if (this.ecmaVersion >= 13) { - super.parseClassStaticBlock(node); - return node; - } - } else { - const idx = this.tsTryParseIndexSignature(node); - if (idx) { - if (node.abstract) { - this.raise(node.start, TypeScriptError.IndexSignatureHasAbstract); - } - if (node.accessibility) { - this.raise( - node.start, - TypeScriptError.IndexSignatureHasAccessibility({ - modifier: node.accessibility - }) - ); - } - if (node.declare) { - this.raise(node.start, TypeScriptError.IndexSignatureHasDeclare); - } - if (node.override) { - this.raise(node.start, TypeScriptError.IndexSignatureHasOverride); - } - return idx; - } - if (!this.inAbstractClass && node.abstract) { - this.raise(node.start, TypeScriptError.NonAbstractClassHasAbstractMethod); - } - if (node.override) { - if (!constructorAllowsSuper) { - this.raise(node.start, TypeScriptError.OverrideNotInSubClass); - } - } - node.static = isStatic; - if (isStatic) { - if (!(this.isClassElementNameStart() || this.type === tt.star)) { - keyName = "static"; - } - } - if (!keyName && this.ecmaVersion >= 8 && this.eatContextual("async")) { - if ((this.isClassElementNameStart() || this.type === tt.star) && !this.canInsertSemicolon()) { - isAsync = true; - } else { - keyName = "async"; - } - } - if (!keyName && (this.ecmaVersion >= 9 || !isAsync) && this.eat(tt.star)) { - isGenerator = true; - } - if (!keyName && !isAsync && !isGenerator) { - const lastValue = this.value; - if (this.eatContextual("get") || this.eatContextual("set")) { - if (this.isClassElementNameStart()) { - kind = lastValue; - } else { - keyName = lastValue; - } - } - } - if (keyName) { - node.computed = false; - node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); - node.key.name = keyName; - this.finishNode(node.key, "Identifier"); - } else { - this.parseClassElementName(node); - } - this.parsePostMemberNameModifiers(node); - if (this.isClassMethod() || this.ecmaVersion < 13 || this.type === tt.parenL || kind !== "method" || isGenerator || isAsync) { - const isConstructor = !node.static && checkKeyName(node, "constructor"); - const allowsDirectSuper = isConstructor && constructorAllowsSuper; - if (isConstructor && kind !== "method") - this.raise(node.key.start, "Constructor can't have get/set modifier"); - node.kind = isConstructor ? "constructor" : kind; - this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); - } else { - this.parseClassField(node); - } - return node; - } - }; - if (node.declare) { - this.tsInAmbientContext(callParseClassMemberWithIsStatic); - } else { - callParseClassMemberWithIsStatic(); - } - return node; - } - isClassElementNameStart() { - if (this.tsIsIdentifier()) { - return true; - } - return super.isClassElementNameStart(); - } - parseClassSuper(node) { - super.parseClassSuper(node); - if (node.superClass && (this.tsMatchLeftRelational() || this.match(tt.bitShift))) { - node.superTypeParameters = this.tsParseTypeArgumentsInExpression(); - } - if (this.eatContextual("implements")) { - node.implements = this.tsParseHeritageClause("implements"); - } - } - parseFunctionParams(node) { - const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); - if (typeParameters) node.typeParameters = typeParameters; - super.parseFunctionParams(node); - } - // `let x: number;` - parseVarId(decl, kind) { - super.parseVarId(decl, kind); - if (decl.id.type === "Identifier" && !this.hasPrecedingLineBreak() && this.value === "!" && this.eat(tt.prefix)) { - decl.definite = true; - } - const type = this.tsTryParseTypeAnnotation(); - if (type) { - decl.id.typeAnnotation = type; - this.resetEndLocation(decl.id); - } - } - // parse the return type of an async arrow function - let foo = (async (): number => {}); - parseArrowExpression(node, params, isAsync, forInit) { - if (this.match(tt.colon)) { - node.returnType = this.tsParseTypeAnnotation(); - } - let oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.enterScope(functionFlags(isAsync, false) | acornScope.SCOPE_ARROW); - this.initFunction(node); - const oldMaybeInArrowParameters = this.maybeInArrowParameters; - if (this.ecmaVersion >= 8) node.async = !!isAsync; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - this.maybeInArrowParameters = true; - node.params = this.toAssignableList(params, true); - this.maybeInArrowParameters = false; - this.parseFunctionBody(node, true, false, forInit); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - this.maybeInArrowParameters = oldMaybeInArrowParameters; - return this.finishNode(node, "ArrowFunctionExpression"); - } - parseMaybeAssignOrigin(forInit, refDestructuringErrors, afterLeftParse) { - if (this.isContextual("yield")) { - if (this.inGenerator) return this.parseYield(forInit); - else this.exprAllowed = false; - } - let ownDestructuringErrors = false, oldParenAssign = -1, oldTrailingComma = -1, oldDoubleProto = -1; - if (refDestructuringErrors) { - oldParenAssign = refDestructuringErrors.parenthesizedAssign; - oldTrailingComma = refDestructuringErrors.trailingComma; - oldDoubleProto = refDestructuringErrors.doubleProto; - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; - } else { - refDestructuringErrors = new DestructuringErrors(); - ownDestructuringErrors = true; - } - let startPos = this.start, startLoc = this.startLoc; - if (this.type === tt.parenL || tokenIsIdentifier(this.type)) { - this.potentialArrowAt = this.start; - this.potentialArrowInForAwait = forInit === "await"; - } - let left = this.parseMaybeConditional(forInit, refDestructuringErrors); - if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc); - if (this.type.isAssign) { - let node = this.startNodeAt(startPos, startLoc); - node.operator = this.value; - if (this.type === tt.eq) left = this.toAssignable(left, true, refDestructuringErrors); - if (!ownDestructuringErrors) { - refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; - } - if (refDestructuringErrors.shorthandAssign >= left.start) - refDestructuringErrors.shorthandAssign = -1; - if (!this.maybeInArrowParameters) { - if (this.type === tt.eq) this.checkLValPattern(left); - else this.checkLValSimple(left); - } - node.left = left; - this.next(); - node.right = this.parseMaybeAssign(forInit); - if (oldDoubleProto > -1) refDestructuringErrors.doubleProto = oldDoubleProto; - return this.finishNode(node, "AssignmentExpression"); - } else { - if (ownDestructuringErrors) this.checkExpressionErrors(refDestructuringErrors, true); - } - if (oldParenAssign > -1) refDestructuringErrors.parenthesizedAssign = oldParenAssign; - if (oldTrailingComma > -1) refDestructuringErrors.trailingComma = oldTrailingComma; - return left; - } - parseMaybeAssign(forInit, refExpressionErrors, afterLeftParse) { - let state; - let jsx; - let typeCast; - if (options?.jsx && (this.matchJsx("jsxTagStart") || this.tsMatchLeftRelational())) { - state = this.cloneCurLookaheadState(); - jsx = this.tryParse( - () => this.parseMaybeAssignOrigin(forInit, refExpressionErrors, afterLeftParse), - state - ); - if (!jsx.error) return jsx.node; - const context = this.context; - const currentContext = context[context.length - 1]; - const lastCurrentContext = context[context.length - 2]; - if (currentContext === acornTypeScript.tokContexts.tc_oTag && lastCurrentContext === acornTypeScript.tokContexts.tc_expr) { - context.pop(); - context.pop(); - } else if (currentContext === acornTypeScript.tokContexts.tc_oTag || currentContext === acornTypeScript.tokContexts.tc_expr) { - context.pop(); - } - } - if (!jsx?.error && !this.tsMatchLeftRelational()) { - return this.parseMaybeAssignOrigin(forInit, refExpressionErrors, afterLeftParse); - } - if (!state || this.compareLookaheadState(state, this.getCurLookaheadState())) { - state = this.cloneCurLookaheadState(); - } - let typeParameters; - const arrow = this.tryParse((abort) => { - typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier); - const expr = this.parseMaybeAssignOrigin(forInit, refExpressionErrors, afterLeftParse); - if (expr.type !== "ArrowFunctionExpression" || expr.extra?.parenthesized) { - abort(); - } - if (typeParameters?.params.length !== 0) { - this.resetStartLocationFromNode(expr, typeParameters); - } - expr.typeParameters = typeParameters; - return expr; - }, state); - if (!arrow.error && !arrow.aborted) { - if (typeParameters) this.reportReservedArrowTypeParam(typeParameters); - return arrow.node; - } - if (!jsx) { - assert(true); - typeCast = this.tryParse( - () => this.parseMaybeAssignOrigin(forInit, refExpressionErrors, afterLeftParse), - state - ); - if (!typeCast.error) return typeCast.node; - } - if (jsx?.node) { - this.setLookaheadState(jsx.failState); - return jsx.node; - } - if (arrow.node) { - this.setLookaheadState(arrow.failState); - if (typeParameters) this.reportReservedArrowTypeParam(typeParameters); - return arrow.node; - } - if (typeCast?.node) { - this.setLookaheadState(typeCast.failState); - return typeCast.node; - } - if (jsx?.thrown) throw jsx.error; - if (arrow.thrown) throw arrow.error; - if (typeCast?.thrown) throw typeCast.error; - throw jsx?.error || arrow.error || typeCast?.error; - } - parseAssignableListItem(allowModifiers) { - const decorators = []; - while (this.match(tokTypes2.at)) { - decorators.push(this.parseDecorator()); - } - const startPos = this.start; - const startLoc = this.startLoc; - let accessibility; - let readonly = false; - let override = false; - if (allowModifiers !== void 0) { - const modified = {}; - this.tsParseModifiers({ - modified, - allowedModifiers: ["public", "private", "protected", "override", "readonly"] - }); - accessibility = modified.accessibility; - override = modified.override; - readonly = modified.readonly; - if (allowModifiers === false && (accessibility || readonly || override)) { - this.raise(startLoc.column, TypeScriptError.UnexpectedParameterModifier); - } - } - const left = this.parseMaybeDefault(startPos, startLoc); - this.parseBindingListItem(left); - const elt = this.parseMaybeDefault(left["start"], left["loc"].start, left); - if (decorators.length) { - elt.decorators = decorators; - } - if (accessibility || readonly || override) { - const pp = this.startNodeAt(startPos, startLoc); - if (accessibility) pp.accessibility = accessibility; - if (readonly) pp.readonly = readonly; - if (override) pp.override = override; - if (elt.type !== "Identifier" && elt.type !== "AssignmentPattern") { - this.raise(pp.start, TypeScriptError.UnsupportedParameterPropertyKind); - } - pp.parameter = elt; - return this.finishNode(pp, "TSParameterProperty"); - } - return elt; - } - // AssignmentPattern - checkLValInnerPattern(expr, bindingType = acornScope.BIND_NONE, checkClashes) { - switch (expr.type) { - case "TSParameterProperty": - this.checkLValInnerPattern(expr.parameter, bindingType, checkClashes); - break; - default: { - super.checkLValInnerPattern(expr, bindingType, checkClashes); - break; - } - } - } - // Allow type annotations inside of a parameter list. - parseBindingListItem(param) { - if (this.eat(tt.question)) { - if (param.type !== "Identifier" && !this.isAmbientContext && !this.inType) { - this.raise(param.start, TypeScriptError.PatternIsOptional); - } - param.optional = true; - } - const type = this.tsTryParseTypeAnnotation(); - if (type) param.typeAnnotation = type; - this.resetEndLocation(param); - return param; - } - isAssignable(node, isBinding) { - switch (node.type) { - case "TSTypeCastExpression": - return this.isAssignable(node.expression, isBinding); - case "TSParameterProperty": - return true; - case "Identifier": - case "ObjectPattern": - case "ArrayPattern": - case "AssignmentPattern": - case "RestElement": - return true; - case "ObjectExpression": { - const last = node.properties.length - 1; - return node.properties.every((prop, i) => { - return prop.type !== "ObjectMethod" && (i === last || prop.type !== "SpreadElement") && this.isAssignable(prop); - }); - } - case "Property": - case "ObjectProperty": - return this.isAssignable(node.value); - case "SpreadElement": - return this.isAssignable(node.argument); - case "ArrayExpression": - return node.elements.every( - (element) => element === null || this.isAssignable(element) - ); - case "AssignmentExpression": - return node.operator === "="; - case "ParenthesizedExpression": - return this.isAssignable(node.expression); - case "MemberExpression": - case "OptionalMemberExpression": - return !isBinding; - default: - return false; - } - } - toAssignable(node, isBinding = false, refDestructuringErrors = new DestructuringErrors()) { - switch (node.type) { - case "ParenthesizedExpression": - return this.toAssignableParenthesizedExpression( - node, - isBinding, - refDestructuringErrors - ); - case "TSAsExpression": - case "TSSatisfiesExpression": - case "TSNonNullExpression": - case "TSTypeAssertion": - if (isBinding) { - } else { - this.raise(node.start, TypeScriptError.UnexpectedTypeCastInParameter); - } - return this.toAssignable(node.expression, isBinding, refDestructuringErrors); - case "MemberExpression": - break; - case "AssignmentExpression": - if (!isBinding && node.left.type === "TSTypeCastExpression") { - node.left = this.typeCastToParameter(node.left); - } - return super.toAssignable(node, isBinding, refDestructuringErrors); - case "TSTypeCastExpression": { - return this.typeCastToParameter(node); - } - default: - return super.toAssignable(node, isBinding, refDestructuringErrors); - } - return node; - } - toAssignableParenthesizedExpression(node, isBinding, refDestructuringErrors) { - switch (node.expression.type) { - case "TSAsExpression": - case "TSSatisfiesExpression": - case "TSNonNullExpression": - case "TSTypeAssertion": - case "ParenthesizedExpression": - return this.toAssignable(node.expression, isBinding, refDestructuringErrors); - default: - return super.toAssignable(node, isBinding, refDestructuringErrors); - } - } - parseBindingAtom() { - switch (this.type) { - case tt._this: - return this.parseIdent( - /* liberal */ - true - ); - default: - return super.parseBindingAtom(); - } - } - shouldParseArrow(exprList) { - let shouldParseArrowRes; - if (this.match(tt.colon)) { - shouldParseArrowRes = exprList.every((expr) => this.isAssignable(expr, true)); - } else { - shouldParseArrowRes = !this.canInsertSemicolon(); - } - if (shouldParseArrowRes) { - if (this.match(tt.colon)) { - const result = this.tryParse((abort) => { - const returnType = this.tsParseTypeOrTypePredicateAnnotation(tt.colon); - if (this.canInsertSemicolon() || !this.match(tt.arrow)) abort(); - return returnType; - }); - if (result.aborted) { - this.shouldParseArrowReturnType = void 0; - return false; - } - if (!result.thrown) { - if (result.error) this.setLookaheadState(result.failState); - this.shouldParseArrowReturnType = result.node; - } - } - if (!this.match(tt.arrow)) { - this.shouldParseArrowReturnType = void 0; - return false; - } - return true; - } - this.shouldParseArrowReturnType = void 0; - return shouldParseArrowRes; - } - parseParenArrowList(startPos, startLoc, exprList, forInit) { - const node = this.startNodeAt(startPos, startLoc); - node.returnType = this.shouldParseArrowReturnType; - this.shouldParseArrowReturnType = void 0; - return this.parseArrowExpression(node, exprList, false, forInit); - } - parseParenAndDistinguishExpression(canBeArrow, forInit) { - let startPos = this.start, startLoc = this.startLoc, val, allowTrailingComma = this.ecmaVersion >= 8; - if (this.ecmaVersion >= 6) { - const oldMaybeInArrowParameters = this.maybeInArrowParameters; - this.maybeInArrowParameters = true; - this.next(); - let innerStartPos = this.start, innerStartLoc = this.startLoc; - let exprList = [], first = true, lastIsComma = false; - let refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, spreadStart; - this.yieldPos = 0; - this.awaitPos = 0; - while (this.type !== tt.parenR) { - first ? first = false : this.expect(tt.comma); - if (allowTrailingComma && this.afterTrailingComma(tt.parenR, true)) { - lastIsComma = true; - break; - } else if (this.type === tt.ellipsis) { - spreadStart = this.start; - exprList.push(this.parseParenItem(this.parseRestBinding())); - if (this.type === tt.comma) { - this.raise(this.start, "Comma is not permitted after the rest element"); - } - break; - } else { - exprList.push( - this.parseMaybeAssign(forInit, refDestructuringErrors, this.parseParenItem) - ); - } - } - let innerEndPos = this.lastTokEnd, innerEndLoc = this.lastTokEndLoc; - this.expect(tt.parenR); - this.maybeInArrowParameters = oldMaybeInArrowParameters; - if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(tt.arrow)) { - this.checkPatternErrors(refDestructuringErrors, false); - this.checkYieldAwaitInDefaultParams(); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - return this.parseParenArrowList(startPos, startLoc, exprList, forInit); - } - if (!exprList.length || lastIsComma) this.unexpected(this.lastTokStart); - if (spreadStart) this.unexpected(spreadStart); - this.checkExpressionErrors(refDestructuringErrors, true); - this.yieldPos = oldYieldPos || this.yieldPos; - this.awaitPos = oldAwaitPos || this.awaitPos; - if (exprList.length > 1) { - val = this.startNodeAt(innerStartPos, innerStartLoc); - val.expressions = exprList; - this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc); - } else { - val = exprList[0]; - } - } else { - val = this.parseParenExpression(); - } - if (this.options.preserveParens) { - let par = this.startNodeAt(startPos, startLoc); - par.expression = val; - return this.finishNode(par, "ParenthesizedExpression"); - } else { - return val; - } - } - parseTaggedTemplateExpression(base, startPos, startLoc, optionalChainMember) { - const node = this.startNodeAt(startPos, startLoc); - node.tag = base; - node.quasi = this.parseTemplate({ isTagged: true }); - if (optionalChainMember) { - this.raise( - startPos, - "Tagged Template Literals are not allowed in optionalChain." - ); - } - return this.finishNode(node, "TaggedTemplateExpression"); - } - shouldParseAsyncArrow() { - if (this.match(tt.colon)) { - const result = this.tryParse((abort) => { - const returnType = this.tsParseTypeOrTypePredicateAnnotation(tt.colon); - if (this.canInsertSemicolon() || !this.match(tt.arrow)) abort(); - return returnType; - }); - if (result.aborted) { - this.shouldParseAsyncArrowReturnType = void 0; - return false; - } - if (!result.thrown) { - if (result.error) this.setLookaheadState(result.failState); - this.shouldParseAsyncArrowReturnType = result.node; - return !this.canInsertSemicolon() && this.eat(tt.arrow); - } - } else { - return !this.canInsertSemicolon() && this.eat(tt.arrow); - } - } - parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit) { - const arrN = this.startNodeAt(startPos, startLoc); - arrN.returnType = this.shouldParseAsyncArrowReturnType; - this.shouldParseAsyncArrowReturnType = void 0; - return this.parseArrowExpression(arrN, exprList, true, forInit); - } - parseExprList(close, allowTrailingComma, allowEmpty, refDestructuringErrors) { - let elts = [], first = true; - while (!this.eat(close)) { - if (!first) { - this.expect(tt.comma); - if (allowTrailingComma && this.afterTrailingComma(close)) break; - } else first = false; - let elt; - if (allowEmpty && this.type === tt.comma) elt = null; - else if (this.type === tt.ellipsis) { - elt = this.parseSpread(refDestructuringErrors); - if (this.maybeInArrowParameters && this.match(tt.colon)) { - elt.typeAnnotation = this.tsParseTypeAnnotation(); - } - if (refDestructuringErrors && this.type === tt.comma && refDestructuringErrors.trailingComma < 0) - refDestructuringErrors.trailingComma = this.start; - } else { - elt = this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem); - } - elts.push(elt); - } - return elts; - } - parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { - let _optionalChained = optionalChained; - if (!this.hasPrecedingLineBreak() && // NODE: replace bang - this.value === "!" && this.match(tt.prefix)) { - this.exprAllowed = false; - this.next(); - const nonNullExpression = this.startNodeAt(startPos, startLoc); - nonNullExpression.expression = base; - base = this.finishNode(nonNullExpression, "TSNonNullExpression"); - return base; - } - let isOptionalCall = false; - if (this.match(tt.questionDot) && this.lookaheadCharCode() === 60) { - if (noCalls) { - return base; - } - base.optional = true; - _optionalChained = isOptionalCall = true; - this.next(); - } - if (this.tsMatchLeftRelational() || this.match(tt.bitShift)) { - let missingParenErrorLoc; - const result = this.tsTryParseAndCatch(() => { - if (!noCalls && this.atPossibleAsyncArrow(base)) { - const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction( - startPos, - startLoc, - forInit - ); - if (asyncArrowFn) { - base = asyncArrowFn; - return base; - } - } - const typeArguments = this.tsParseTypeArgumentsInExpression(); - if (!typeArguments) return base; - if (isOptionalCall && !this.match(tt.parenL)) { - missingParenErrorLoc = this.curPosition(); - return base; - } - if (tokenIsTemplate(this.type) || this.type === tt.backQuote) { - const result2 = this.parseTaggedTemplateExpression( - base, - startPos, - startLoc, - _optionalChained - ); - result2.typeArguments = typeArguments; - return result2; - } - if (!noCalls && this.eat(tt.parenL)) { - let refDestructuringErrors = new DestructuringErrors(); - const node2 = this.startNodeAt(startPos, startLoc); - node2.callee = base; - node2.arguments = this.parseExprList( - tt.parenR, - this.ecmaVersion >= 8, - false, - refDestructuringErrors - ); - this.tsCheckForInvalidTypeCasts(node2.arguments); - node2.typeArguments = typeArguments; - if (_optionalChained) { - node2.optional = isOptionalCall; - } - this.checkExpressionErrors(refDestructuringErrors, true); - base = this.finishNode(node2, "CallExpression"); - return base; - } - const tokenType = this.type; - if ( - // a>c is not (a)>c, but a<(b>>c) - this.tsMatchRightRelational() || // a>>c is not (a)>>c, but a<(b>>>c) - tokenType === tt.bitShift || // ac is (ac - tokenType !== tt.parenL && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak() - ) { - return; - } - const node = this.startNodeAt(startPos, startLoc); - node.expression = base; - node.typeArguments = typeArguments; - return this.finishNode(node, "TSInstantiationExpression"); - }); - if (missingParenErrorLoc) { - this.unexpected(missingParenErrorLoc); - } - if (result) { - if (result.type === "TSInstantiationExpression" && (this.match(tt.dot) || this.match(tt.questionDot) && this.lookaheadCharCode() !== 40)) { - this.raise( - this.start, - TypeScriptError.InvalidPropertyAccessAfterInstantiationExpression - ); - } - base = result; - return base; - } - } - let optionalSupported = this.ecmaVersion >= 11; - let optional = optionalSupported && this.eat(tt.questionDot); - if (noCalls && optional) - this.raise( - this.lastTokStart, - "Optional chaining cannot appear in the callee of new expressions" - ); - let computed = this.eat(tt.bracketL); - if (computed || optional && this.type !== tt.parenL && this.type !== tt.backQuote || this.eat(tt.dot)) { - let node = this.startNodeAt(startPos, startLoc); - node.object = base; - if (computed) { - node.property = this.parseExpression(); - this.expect(tt.bracketR); - } else if (this.type === tt.privateId && base.type !== "Super") { - node.property = this.parsePrivateIdent(); - } else { - node.property = this.parseIdent(this.options.allowReserved !== "never"); - } - node.computed = !!computed; - if (optionalSupported) { - node.optional = optional; - } - base = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.eat(tt.parenL)) { - const oldMaybeInArrowParameters = this.maybeInArrowParameters; - this.maybeInArrowParameters = true; - let refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - let exprList = this.parseExprList( - tt.parenR, - this.ecmaVersion >= 8, - false, - refDestructuringErrors - ); - if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) { - this.checkPatternErrors(refDestructuringErrors, false); - this.checkYieldAwaitInDefaultParams(); - if (this.awaitIdentPos > 0) - this.raise( - this.awaitIdentPos, - "Cannot use 'await' as identifier inside an async function" - ); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - base = this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit); - } else { - this.checkExpressionErrors(refDestructuringErrors, true); - this.yieldPos = oldYieldPos || this.yieldPos; - this.awaitPos = oldAwaitPos || this.awaitPos; - this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos; - let node = this.startNodeAt(startPos, startLoc); - node.callee = base; - node.arguments = exprList; - if (optionalSupported) { - node.optional = optional; - } - base = this.finishNode(node, "CallExpression"); - } - this.maybeInArrowParameters = oldMaybeInArrowParameters; - } else if (this.type === tt.backQuote) { - if (optional || _optionalChained) { - this.raise( - this.start, - "Optional chaining cannot appear in the tag of tagged template expressions" - ); - } - let node = this.startNodeAt(startPos, startLoc); - node.tag = base; - node.quasi = this.parseTemplate({ isTagged: true }); - base = this.finishNode(node, "TaggedTemplateExpression"); - } - return base; - } - parseGetterSetter(prop) { - prop.kind = prop.key.name; - this.parsePropertyName(prop); - const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); - prop.value = this.parseMethod(false); - if (typeParameters) prop.value.typeParameters = typeParameters; - let paramCount = prop.kind === "get" ? 0 : 1; - const firstParam = prop.value.params[0]; - const hasContextParam = firstParam && this.isThisParam(firstParam); - paramCount = hasContextParam ? paramCount + 1 : paramCount; - if (prop.value.params.length !== paramCount) { - let start = prop.value.start; - if (prop.kind === "get") this.raiseRecoverable(start, "getter should have no params"); - else this.raiseRecoverable(start, "setter should have exactly one param"); - } else { - if (prop.kind === "set" && prop.value.params[0].type === "RestElement") - this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params"); - } - } - parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { - if (this.tsMatchLeftRelational()) { - if (isPattern) this.unexpected(); - prop.kind = "init"; - prop.method = true; - const typeParameters = this.tsTryParseTypeParameters(this.tsParseConstModifier); - prop.value = this.parseMethod(isGenerator, isAsync); - if (typeParameters) prop.value.typeParameters = typeParameters; - return; - } - return super.parsePropertyValue( - prop, - isPattern, - isGenerator, - isAsync, - startPos, - startLoc, - refDestructuringErrors, - containsEsc - ); - } - parseProperty(isPattern, refDestructuringErrors) { - if (!isPattern) { - let decorators = []; - if (this.match(tokTypes2.at)) { - while (this.match(tokTypes2.at)) { - decorators.push(this.parseDecorator()); - } - } - const property = super.parseProperty(isPattern, refDestructuringErrors); - if (property.type === "SpreadElement") { - if (decorators.length) - this.raise(property.start, DecoratorsError.SpreadElementDecorator); - } - if (decorators.length) { - property.decorators = decorators; - decorators = []; - } - return property; - } - return super.parseProperty(isPattern, refDestructuringErrors); - } - parseCatchClauseParam() { - const param = this.parseBindingAtom(); - let simple = param.type === "Identifier"; - this.enterScope(simple ? acornScope.SCOPE_SIMPLE_CATCH : 0); - this.checkLValPattern( - param, - simple ? acornScope.BIND_SIMPLE_CATCH : acornScope.BIND_LEXICAL - ); - const type = this.tsTryParseTypeAnnotation(); - if (type) { - param.typeAnnotation = type; - this.resetEndLocation(param); - } - this.expect(tt.parenR); - return param; - } - parseClass(node, isStatement) { - const oldInAbstractClass = this.inAbstractClass; - this.inAbstractClass = !!node.abstract; - try { - this.next(); - this.takeDecorators(node); - const oldStrict = this.strict; - this.strict = true; - this.parseClassId(node, isStatement); - this.parseClassSuper(node); - const privateNameMap = this.enterClassBody(); - const classBody = this.startNode(); - let hadConstructor = false; - classBody.body = []; - let decorators = []; - this.expect(tt.braceL); - while (this.type !== tt.braceR) { - if (this.match(tokTypes2.at)) { - decorators.push(this.parseDecorator()); - continue; - } - const element = this.parseClassElement(node.superClass !== null); - if (decorators.length) { - element.decorators = decorators; - this.resetStartLocationFromNode(element, decorators[0]); - decorators = []; - } - if (element) { - classBody.body.push(element); - if (element.type === "MethodDefinition" && element.kind === "constructor" && element.value.type === "FunctionExpression") { - if (hadConstructor) { - this.raiseRecoverable(element.start, "Duplicate constructor in the same class"); - } - hadConstructor = true; - if (element.decorators && element.decorators.length > 0) { - this.raise(element.start, DecoratorsError.DecoratorConstructor); - } - } else if (element.key && element.key.type === "PrivateIdentifier" && element.value?.type !== "TSDeclareMethod" && isPrivateNameConflicted(privateNameMap, element)) { - this.raiseRecoverable( - element.key.start, - `Identifier '#${element.key.name}' has already been declared` - ); - } - } - } - this.strict = oldStrict; - this.next(); - if (decorators.length) { - this.raise(this.start, DecoratorsError.TrailingDecorator); - } - node.body = this.finishNode(classBody, "ClassBody"); - this.exitClassBody(); - return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); - } finally { - this.inAbstractClass = oldInAbstractClass; - } - } - parseClassFunctionParams() { - const typeParameters = this.tsTryParseTypeParameters(); - let params = this.parseBindingList(tt.parenR, false, this.ecmaVersion >= 8, true); - if (typeParameters) params.typeParameters = typeParameters; - return params; - } - parseMethod(isGenerator, isAsync, allowDirectSuper, inClassScope, method) { - let node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; - this.initFunction(node); - if (this.ecmaVersion >= 6) node.generator = isGenerator; - if (this.ecmaVersion >= 8) node.async = !!isAsync; - this.yieldPos = 0; - this.awaitPos = 0; - this.awaitIdentPos = 0; - this.enterScope( - functionFlags(isAsync, node.generator) | acornScope.SCOPE_SUPER | (allowDirectSuper ? acornScope.SCOPE_DIRECT_SUPER : 0) - ); - this.expect(tt.parenL); - node.params = this.parseClassFunctionParams(); - this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false, true, false, { - isClassMethod: inClassScope - }); - this.yieldPos = oldYieldPos; - this.awaitPos = oldAwaitPos; - this.awaitIdentPos = oldAwaitIdentPos; - if (method && method.abstract) { - const hasBody = !!node.body; - if (hasBody) { - const { key } = method; - this.raise( - method.start, - TypeScriptError.AbstractMethodHasImplementation({ - methodName: key.type === "Identifier" && !method.computed ? key.name : `[${this.input.slice(key.start, key.end)}]` - }) - ); - } - } - return this.finishNode(node, "FunctionExpression"); - } - static parse(input, options2) { - if (options2.locations === false) { - throw new Error(`You have to enable options.locations while using acorn-typescript`); - } else { - options2.locations = true; - } - const parser = new this(options2, input); - if (dts) { - parser.isAmbientContext = true; - } - return parser.parse(); - } - static parseExpressionAt(input, pos, options2) { - if (options2.locations === false) { - throw new Error(`You have to enable options.locations while using acorn-typescript`); - } else { - options2.locations = true; - } - const parser = new this(options2, input, pos); - if (dts) { - parser.isAmbientContext = true; - } - parser.nextToken(); - return parser.parseExpression(); - } - parseImportSpecifier() { - const isMaybeTypeOnly = this.ts_isContextual(tokTypes2.type); - if (isMaybeTypeOnly) { - let node = this.startNode(); - node.imported = this.parseModuleExportName(); - this.parseTypeOnlyImportExportSpecifier( - node, - /* isImport */ - true, - this.importOrExportOuterKind === "type" - ); - return this.finishNode(node, "ImportSpecifier"); - } else { - const node = super.parseImportSpecifier(); - node.importKind = "value"; - return node; - } - } - parseExportSpecifier(exports) { - const isMaybeTypeOnly = this.ts_isContextual(tokTypes2.type); - const isString = this.match(tt.string); - if (!isString && isMaybeTypeOnly) { - let node = this.startNode(); - node.local = this.parseModuleExportName(); - this.parseTypeOnlyImportExportSpecifier( - node, - /* isImport */ - false, - this.importOrExportOuterKind === "type" - ); - this.finishNode(node, "ExportSpecifier"); - this.checkExport(exports, node.exported, node.exported.start); - return node; - } else { - const node = super.parseExportSpecifier(exports); - node.exportKind = "value"; - return node; - } - } - parseTypeOnlyImportExportSpecifier(node, isImport, isInTypeOnlyImportExport) { - const leftOfAsKey = isImport ? "imported" : "local"; - const rightOfAsKey = isImport ? "local" : "exported"; - let leftOfAs = node[leftOfAsKey]; - let rightOfAs; - let hasTypeSpecifier = false; - let canParseAsKeyword = true; - const loc = leftOfAs.start; - if (this.isContextual("as")) { - const firstAs = this.parseIdent(); - if (this.isContextual("as")) { - const secondAs = this.parseIdent(); - if (tokenIsKeywordOrIdentifier(this.type)) { - hasTypeSpecifier = true; - leftOfAs = firstAs; - rightOfAs = isImport ? this.parseIdent() : this.parseModuleExportName(); - canParseAsKeyword = false; - } else { - rightOfAs = secondAs; - canParseAsKeyword = false; - } - } else if (tokenIsKeywordOrIdentifier(this.type)) { - canParseAsKeyword = false; - rightOfAs = isImport ? this.parseIdent() : this.parseModuleExportName(); - } else { - hasTypeSpecifier = true; - leftOfAs = firstAs; - } - } else if (tokenIsKeywordOrIdentifier(this.type)) { - hasTypeSpecifier = true; - if (isImport) { - leftOfAs = super.parseIdent(true); - if (!this.isContextual("as")) { - this.checkUnreserved(leftOfAs); - } - } else { - leftOfAs = this.parseModuleExportName(); - } - } - if (hasTypeSpecifier && isInTypeOnlyImportExport) { - this.raise( - loc, - isImport ? TypeScriptError.TypeModifierIsUsedInTypeImports : TypeScriptError.TypeModifierIsUsedInTypeExports - ); - } - node[leftOfAsKey] = leftOfAs; - node[rightOfAsKey] = rightOfAs; - const kindKey = isImport ? "importKind" : "exportKind"; - node[kindKey] = hasTypeSpecifier ? "type" : "value"; - if (canParseAsKeyword && this.eatContextual("as")) { - node[rightOfAsKey] = isImport ? this.parseIdent() : this.parseModuleExportName(); - } - if (!node[rightOfAsKey]) { - node[rightOfAsKey] = this.copyNode(node[leftOfAsKey]); - } - if (isImport) { - this.checkLValSimple(node[rightOfAsKey], acornScope.BIND_LEXICAL); - } - } - raiseCommonCheck(pos, message, recoverable) { - switch (message) { - case "Comma is not permitted after the rest element": { - if (this.isAmbientContext && this.match(tt.comma) && this.lookaheadCharCode() === 41) { - this.next(); - return; - } else { - return super.raise(pos, message); - } - } - } - return recoverable ? super.raiseRecoverable(pos, message) : super.raise(pos, message); - } - raiseRecoverable(pos, message) { - return this.raiseCommonCheck(pos, message, true); - } - raise(pos, message) { - return this.raiseCommonCheck(pos, message, true); - } - updateContext(prevType) { - const { type } = this; - if (type == tt.braceL) { - var curContext = this.curContext(); - if (curContext == tsTokContexts.tc_oTag) this.context.push(tokContexts.b_expr); - else if (curContext == tsTokContexts.tc_expr) this.context.push(tokContexts.b_tmpl); - else super.updateContext(prevType); - this.exprAllowed = true; - } else if (type === tt.slash && prevType === tokTypes2.jsxTagStart) { - this.context.length -= 2; - this.context.push(tsTokContexts.tc_cTag); - this.exprAllowed = false; - } else { - return super.updateContext(prevType); - } - } - // Parses JSX opening tag starting after '<'. - jsx_parseOpeningElementAt(startPos, startLoc) { - let node = this.startNodeAt(startPos, startLoc); - let nodeName = this.jsx_parseElementName(); - if (nodeName) node.name = nodeName; - if (this.match(tt.relational) || this.match(tt.bitShift)) { - const typeArguments = this.tsTryParseAndCatch( - () => this.tsParseTypeArgumentsInExpression() - ); - if (typeArguments) node.typeArguments = typeArguments; - } - node.attributes = []; - while (this.type !== tt.slash && this.type !== tokTypes2.jsxTagEnd) - node.attributes.push(this.jsx_parseAttribute()); - node.selfClosing = this.eat(tt.slash); - this.expect(tokTypes2.jsxTagEnd); - return this.finishNode(node, nodeName ? "JSXOpeningElement" : "JSXOpeningFragment"); - } - enterScope(flags) { - if (flags === TS_SCOPE_TS_MODULE) { - this.importsStack.push([]); - } - super.enterScope(flags); - const scope = super.currentScope(); - scope.types = []; - scope.enums = []; - scope.constEnums = []; - scope.classes = []; - scope.exportOnlyBindings = []; - } - exitScope() { - const scope = super.currentScope(); - if (scope.flags === TS_SCOPE_TS_MODULE) { - this.importsStack.pop(); - } - super.exitScope(); - } - hasImport(name, allowShadow) { - const len = this.importsStack.length; - if (this.importsStack[len - 1].indexOf(name) > -1) { - return true; - } - if (!allowShadow && len > 1) { - for (let i = 0; i < len - 1; i++) { - if (this.importsStack[i].indexOf(name) > -1) return true; - } - } - return false; - } - maybeExportDefined(scope, name) { - if (this.inModule && scope.flags & acornScope.SCOPE_TOP) { - this.undefinedExports.delete(name); - } - } - declareName(name, bindingType, pos) { - if (bindingType & acornScope.BIND_FLAGS_TS_IMPORT) { - if (this.hasImport(name, true)) { - this.raise(pos, `Identifier '${name}' has already been declared.`); - } - this.importsStack[this.importsStack.length - 1].push(name); - return; - } - const scope = this.currentScope(); - if (bindingType & acornScope.BIND_FLAGS_TS_EXPORT_ONLY) { - this.maybeExportDefined(scope, name); - scope.exportOnlyBindings.push(name); - return; - } - if (bindingType === acornScope.BIND_TS_TYPE || bindingType === acornScope.BIND_TS_INTERFACE) { - if (bindingType === acornScope.BIND_TS_TYPE && scope.types.includes(name)) { - this.raise(pos, `type '${name}' has already been declared.`); - } - scope.types.push(name); - } else { - super.declareName(name, bindingType, pos); - } - if (bindingType & acornScope.BIND_FLAGS_TS_ENUM) scope.enums.push(name); - if (bindingType & acornScope.BIND_FLAGS_TS_CONST_ENUM) scope.constEnums.push(name); - if (bindingType & acornScope.BIND_FLAGS_CLASS) scope.classes.push(name); - } - checkLocalExport(id) { - const { name } = id; - if (this.hasImport(name)) return; - const len = this.scopeStack.length; - for (let i = len - 1; i >= 0; i--) { - const scope = this.scopeStack[i]; - if (scope.types.indexOf(name) > -1 || scope.exportOnlyBindings.indexOf(name) > -1) return; - } - super.checkLocalExport(id); - } - } - return TypeScriptParser; - }; -} -export { - tsPlugin -}; diff --git a/web/node_modules/@sveltejs/acorn-typescript/package.json b/web/node_modules/@sveltejs/acorn-typescript/package.json deleted file mode 100644 index 67536b9..0000000 --- a/web/node_modules/@sveltejs/acorn-typescript/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "@sveltejs/acorn-typescript", - "version": "1.0.9", - "description": "Acorn plugin that parses TypeScript", - "type": "module", - "types": "index.d.ts", - "files": [ - "index.js", - "index.d.ts" - ], - "exports": { - ".": { - "types": "./index.d.ts", - "default": "./index.js" - } - }, - "repository": { - "type": "git", - "url": "git+https://github.com/sveltejs/acorn-typescript.git" - }, - "author": "tyrealhu and the Svelte team", - "license": "MIT", - "bugs": { - "url": "https://github.com/sveltejs/acorn-typescript/issues" - }, - "homepage": "https://github.com/sveltejs/acorn-typescript#readme", - "devDependencies": { - "@changesets/cli": "^2.27.11", - "@svitejs/changesets-changelog-github-compact": "^1.1.0", - "acorn": "^8.14.0", - "acorn-jsx": "~5.3.2", - "cross-env": "^7.0.3", - "esbuild": "^0.25.0", - "prettier": "~3.5.2", - "test262": "git+https://github.com/tc39/test262.git#88ebb1e3755198cd08757bca1698effbbf360345", - "test262-parser-runner": "^0.5.0", - "typescript": "^5.7.3", - "vitest": "^3.0.7" - }, - "peerDependencies": { - "acorn": "^8.9.0" - }, - "scripts": { - "build": "esbuild src/index.ts --bundle --format=esm --outfile=index.js --platform=node --external:acorn", - "format": "prettier --write .", - "check": "tsc --noEmit", - "lint": "prettier --check .", - "test": "vitest run", - "test:update": "cross-env UPDATE_SNAPSHOT=true vitest run && pnpm run format", - "test:test262": "pnpm run build && node ./test/run_test262.js", - "changeset:version": "changeset version && git add --all", - "changeset:release": "changeset publish", - "playground": "pnpm build && node ./playground/index.js" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/adapter-static/LICENSE b/web/node_modules/@sveltejs/adapter-static/LICENSE deleted file mode 100644 index 22efd0c..0000000 --- a/web/node_modules/@sveltejs/adapter-static/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/web/node_modules/@sveltejs/adapter-static/README.md b/web/node_modules/@sveltejs/adapter-static/README.md deleted file mode 100644 index b612f2a..0000000 --- a/web/node_modules/@sveltejs/adapter-static/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# @sveltejs/adapter-static - -[Adapter](https://svelte.dev/docs/kit/adapters) for SvelteKit apps that prerenders your entire site as a collection of static files. It's also possible to create an SPA with it by specifying a fallback page which renders an empty shell. If you'd like to prerender only some pages and not create an SPA for those left out, you will need to use a different adapter together with [the `prerender` option](https://svelte.dev/docs/kit/page-options#prerender). - -## Docs - -[Docs](https://svelte.dev/docs/kit/adapter-static) - -## Changelog - -[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/main/packages/adapter-static/CHANGELOG.md). - -## License - -[MIT](LICENSE) diff --git a/web/node_modules/@sveltejs/adapter-static/index.d.ts b/web/node_modules/@sveltejs/adapter-static/index.d.ts deleted file mode 100644 index 101e02f..0000000 --- a/web/node_modules/@sveltejs/adapter-static/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Adapter } from '@sveltejs/kit'; - -export interface AdapterOptions { - pages?: string; - assets?: string; - fallback?: string; - precompress?: boolean; - strict?: boolean; -} - -export default function plugin(options?: AdapterOptions): Adapter; diff --git a/web/node_modules/@sveltejs/adapter-static/index.js b/web/node_modules/@sveltejs/adapter-static/index.js deleted file mode 100644 index c2b8730..0000000 --- a/web/node_modules/@sveltejs/adapter-static/index.js +++ /dev/null @@ -1,91 +0,0 @@ -import path from 'node:path'; -import { platforms } from './platforms.js'; - -/** @type {import('./index.js').default} */ -export default function (options) { - return { - name: '@sveltejs/adapter-static', - /** @param {import('./internal.js').Builder2_0_0} builder */ - async adapt(builder) { - if (!options?.fallback && builder.config.kit.router?.type !== 'hash') { - const dynamic_routes = builder.routes.filter((route) => route.prerender !== true); - if (dynamic_routes.length > 0 && options?.strict !== false) { - const prefix = path.relative('.', builder.config.kit.files.routes); - const has_param_routes = builder.routes.some((route) => route.id.includes('[')); - const config_option = - has_param_routes || JSON.stringify(builder.config.kit.prerender.entries) !== '["*"]' - ? ` - adjust the \`prerender.entries\` config option ${ - has_param_routes - ? '(routes with parameters are not part of entry points by default)' - : '' - } — see https://svelte.dev/docs/kit/configuration#prerender for more info.` - : ''; - - builder.log.error( - `@sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic: -${dynamic_routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')} - -You have the following options: - - set the \`fallback\` option — see https://svelte.dev/docs/kit/single-page-apps#usage for more info. - - add \`export const prerender = true\` to your root \`+layout.js/.ts\` or \`+layout.server.js/.ts\` file. This will try to prerender all pages. - - add \`export const prerender = true\` to any \`+server.js/ts\` files that are not fetched by page \`load\` functions. -${config_option} - - pass \`strict: false\` to \`adapter-static\` to ignore this error. Only do this if you are sure you don't need the routes in question in your final app, as they will be unavailable. See https://github.com/sveltejs/kit/tree/main/packages/adapter-static#strict for more info. - -If this doesn't help, you may need to use a different adapter. @sveltejs/adapter-static can only be used for sites that don't need a server for dynamic rendering, and can run on just a static file server. -See https://svelte.dev/docs/kit/page-options#prerender for more details` - ); - throw new Error('Encountered dynamic routes'); - } - } - - const platform = platforms.find((platform) => platform.test()); - - if (platform) { - if (options) { - builder.log.warn( - `Detected ${platform.name}. Please remove adapter-static options to enable zero-config mode` - ); - } else { - builder.log.info(`Detected ${platform.name}, using zero-config mode`); - } - } - - const { - // @ts-ignore - pages = 'build', - assets = pages, - fallback, - precompress - } = options ?? platform?.defaults ?? /** @type {import('./index.js').AdapterOptions} */ ({}); - - builder.rimraf(assets); - builder.rimraf(pages); - - builder.generateEnvModule(); - builder.writeClient(assets); - builder.writePrerendered(pages); - - if (fallback) { - await builder.generateFallback(path.join(pages, fallback)); - } - - if (precompress) { - builder.log.minor('Compressing assets and pages'); - if (pages === assets) { - await builder.compress(assets); - } else { - await Promise.all([builder.compress(assets), builder.compress(pages)]); - } - } - - if (pages === assets) { - builder.log(`Wrote site to "${pages}"`); - } else { - builder.log(`Wrote pages to "${pages}" and assets to "${assets}"`); - } - - if (!options) platform?.done(builder); - } - }; -} diff --git a/web/node_modules/@sveltejs/adapter-static/package.json b/web/node_modules/@sveltejs/adapter-static/package.json deleted file mode 100644 index 42cc5e5..0000000 --- a/web/node_modules/@sveltejs/adapter-static/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@sveltejs/adapter-static", - "version": "3.0.10", - "description": "Adapter for SvelteKit apps that prerenders your entire site as a collection of static files", - "keywords": [ - "adapter", - "deploy", - "hosting", - "ssg", - "static site generation", - "svelte", - "sveltekit" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/sveltejs/kit.git", - "directory": "packages/adapter-static" - }, - "license": "MIT", - "homepage": "https://svelte.dev/docs/kit/adapter-static", - "type": "module", - "exports": { - ".": { - "types": "./index.d.ts", - "import": "./index.js" - }, - "./package.json": "./package.json" - }, - "types": "index.d.ts", - "files": [ - "index.js", - "index.d.ts", - "platforms.js" - ], - "devDependencies": { - "@playwright/test": "^1.51.1", - "@sveltejs/vite-plugin-svelte": "^6.0.0-next.3", - "@types/node": "^18.19.119", - "sirv": "^3.0.0", - "svelte": "^5.39.3", - "typescript": "^5.3.3", - "vite": "^6.3.5", - "@sveltejs/kit": "^2.43.7" - }, - "peerDependencies": { - "@sveltejs/kit": "^2.0.0" - }, - "scripts": { - "lint": "prettier --check .", - "check": "tsc", - "format": "pnpm lint --write", - "test": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/adapter-static/platforms.js b/web/node_modules/@sveltejs/adapter-static/platforms.js deleted file mode 100644 index 6ed4216..0000000 --- a/web/node_modules/@sveltejs/adapter-static/platforms.js +++ /dev/null @@ -1,76 +0,0 @@ -import fs from 'node:fs'; -import process from 'node:process'; - -/** - * @typedef {{ - * name: string; - * test: () => boolean; - * defaults: import('./index.js').AdapterOptions; - * done: (builder: import('./internal.js').Builder2_0_0) => void; - * }} - * Platform */ - -// This function is duplicated in adapter-vercel -/** @param {import('./internal.js').Builder2_0_0} builder */ -function static_vercel_config(builder) { - /** @type {any[]} */ - const prerendered_redirects = []; - - /** @type {Record} */ - const overrides = {}; - - for (const [src, redirect] of builder.prerendered.redirects) { - prerendered_redirects.push({ - src, - headers: { - Location: redirect.location - }, - status: redirect.status - }); - } - - for (const [path, page] of builder.prerendered.pages) { - if (path.endsWith('/') && path !== '/') { - prerendered_redirects.push( - { src: path, dest: path.slice(0, -1) }, - { src: path.slice(0, -1), status: 308, headers: { Location: path } } - ); - - overrides[page.file] = { path: path.slice(1, -1) }; - } else { - overrides[page.file] = { path: path.slice(1) }; - } - } - - return { - version: 3, - routes: [ - ...prerendered_redirects, - { - src: `/${builder.getAppPath()}/immutable/.+`, - headers: { - 'cache-control': 'public, immutable, max-age=31536000' - } - }, - { - handle: 'filesystem' - } - ], - overrides - }; -} - -/** @type {Platform[]} */ -export const platforms = [ - { - name: 'Vercel', - test: () => !!process.env.VERCEL, - defaults: { - pages: '.vercel/output/static' - }, - done: (builder) => { - const config = static_vercel_config(builder); - fs.writeFileSync('.vercel/output/config.json', JSON.stringify(config, null, ' ')); - } - } -]; diff --git a/web/node_modules/@sveltejs/kit/LICENSE b/web/node_modules/@sveltejs/kit/LICENSE deleted file mode 100644 index 22efd0c..0000000 --- a/web/node_modules/@sveltejs/kit/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/web/node_modules/@sveltejs/kit/README.md b/web/node_modules/@sveltejs/kit/README.md deleted file mode 100644 index 372a92e..0000000 --- a/web/node_modules/@sveltejs/kit/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# The fastest way to build Svelte apps - -This is the [SvelteKit](https://svelte.dev/docs/kit) framework and CLI. - -The quickest way to get started is via the [sv](https://npmjs.com/package/sv) package: - -```sh -npx sv create my-app -cd my-app -npm install -npm run dev -``` - -See the [documentation](https://svelte.dev/docs/kit) to learn more. - -## Changelog - -[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/main/packages/kit/CHANGELOG.md). diff --git a/web/node_modules/@sveltejs/kit/package.json b/web/node_modules/@sveltejs/kit/package.json deleted file mode 100644 index 6226d65..0000000 --- a/web/node_modules/@sveltejs/kit/package.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "name": "@sveltejs/kit", - "version": "2.55.0", - "description": "SvelteKit is the fastest way to build Svelte apps", - "keywords": [ - "framework", - "official", - "svelte", - "sveltekit", - "vite" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/sveltejs/kit.git", - "directory": "packages/kit" - }, - "license": "MIT", - "homepage": "https://svelte.dev", - "type": "module", - "dependencies": { - "@standard-schema/spec": "^1.0.0", - "@sveltejs/acorn-typescript": "^1.0.5", - "@types/cookie": "^0.6.0", - "acorn": "^8.14.1", - "cookie": "^0.6.0", - "devalue": "^5.6.4", - "esm-env": "^1.2.2", - "kleur": "^4.1.5", - "magic-string": "^0.30.5", - "mrmime": "^2.0.0", - "set-cookie-parser": "^3.0.0", - "sirv": "^3.0.0" - }, - "devDependencies": { - "@opentelemetry/api": "^1.0.0", - "@playwright/test": "1.58.2", - "@sveltejs/vite-plugin-svelte": "^6.0.0-next.3", - "@types/connect": "^3.4.38", - "@types/node": "^18.19.119", - "@types/set-cookie-parser": "^2.4.7", - "dts-buddy": "^0.7.0", - "rollup": "^4.59.0", - "svelte": "^5.53.5", - "svelte-preprocess": "^6.0.0", - "typescript": "^5.3.3", - "vite": "^6.3.5", - "vitest": "^4.0.0" - }, - "peerDependencies": { - "@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0 || ^7.0.0", - "@opentelemetry/api": "^1.0.0", - "svelte": "^4.0.0 || ^5.0.0-next.0", - "typescript": "^5.3.3", - "vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "@opentelemetry/api": { - "optional": true - }, - "typescript": { - "optional": true - } - }, - "bin": { - "svelte-kit": "svelte-kit.js" - }, - "files": [ - "src", - "!src/**/*.spec.js", - "!src/core/**/fixtures", - "!src/core/**/test", - "types", - "svelte-kit.js" - ], - "imports": { - "#app/paths": { - "browser": "./src/runtime/app/paths/client.js", - "default": "./src/runtime/app/paths/server.js" - } - }, - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./types/index.d.ts", - "import": "./src/exports/index.js" - }, - "./internal": { - "types": "./types/index.d.ts", - "import": "./src/exports/internal/index.js" - }, - "./internal/server": { - "types": "./types/index.d.ts", - "import": "./src/exports/internal/server.js" - }, - "./node": { - "types": "./types/index.d.ts", - "import": "./src/exports/node/index.js" - }, - "./node/polyfills": { - "types": "./types/index.d.ts", - "import": "./src/exports/node/polyfills.js" - }, - "./hooks": { - "types": "./types/index.d.ts", - "import": "./src/exports/hooks/index.js" - }, - "./vite": { - "types": "./types/index.d.ts", - "import": "./src/exports/vite/index.js" - } - }, - "types": "types/index.d.ts", - "engines": { - "node": ">=18.13" - }, - "scripts": { - "lint": "prettier --config ../../.prettierrc --check .", - "check": "tsc && cd ./test/types && tsc", - "check:all": "tsc && pnpm -r --filter=\"./**\" check", - "format": "prettier --config ../../.prettierrc --write .", - "test": "pnpm test:unit && pnpm test:integration", - "test:integration": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test", - "test:cross-platform:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:dev", - "test:cross-platform:build": "pnpm test:unit && pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:cross-platform:build", - "test:server-side-route-resolution:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:server-side-route-resolution:dev", - "test:server-side-route-resolution:build": "pnpm test:unit && pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:server-side-route-resolution:build", - "test:svelte-async:dev": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:svelte-async:dev", - "test:svelte-async:build": "pnpm test:unit && pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test:svelte-async:build", - "test:unit:dev": "vitest --config kit.vitest.config.js run", - "test:unit:prod": "NODE_ENV=production vitest --config kit.vitest.config.js run csp.spec.js cookie.spec.js", - "test:unit": "pnpm test:unit:dev && pnpm test:unit:prod", - "generate:version": "node scripts/generate-version.js", - "generate:types": "node scripts/generate-dts.js" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/kit/src/cli.js b/web/node_modules/@sveltejs/kit/src/cli.js deleted file mode 100644 index 99024d1..0000000 --- a/web/node_modules/@sveltejs/kit/src/cli.js +++ /dev/null @@ -1,95 +0,0 @@ -import fs from 'node:fs'; -import process from 'node:process'; -import { parseArgs } from 'node:util'; -import colors from 'kleur'; -import { load_config } from './core/config/index.js'; -import { coalesce_to_error } from './utils/error.js'; - -/** @param {unknown} e */ -function handle_error(e) { - const error = coalesce_to_error(e); - - if (error.name === 'SyntaxError') throw error; - - console.error(colors.bold().red(`> ${error.message}`)); - if (error.stack) { - console.error(colors.gray(error.stack.split('\n').slice(1).join('\n'))); - } - - process.exit(1); -} - -const pkg = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8')); - -const help = ` - Usage: svelte-kit [options] - - Commands: - sync Synchronise generated type definitions - - Options: - --version, -v Show version number - --help, -h Show this help message - - Sync Options: - --mode Specify a mode for loading environment variables (default: development) -`; - -let parsed; -try { - parsed = parseArgs({ - options: { - version: { type: 'boolean', short: 'v' }, - help: { type: 'boolean', short: 'h' }, - mode: { type: 'string', default: 'development' } - }, - allowPositionals: true, - strict: true - }); -} catch (err) { - const error = /** @type {Error} */ (err); - console.error(colors.bold().red(`> ${error.message}`)); - console.log(help); - process.exit(1); -} - -const { values, positionals } = parsed; - -if (values.version) { - console.log(pkg.version); - process.exit(0); -} - -if (values.help) { - console.log(help); - process.exit(0); -} - -const command = positionals[0]; - -if (!command) { - console.log(help); - process.exit(0); -} - -if (command === 'sync') { - const config_files = ['js', 'ts'] - .map((ext) => `svelte.config.${ext}`) - .filter((f) => fs.existsSync(f)); - if (config_files.length === 0) { - console.warn(`Missing Svelte config file in ${process.cwd()} — skipping`); - process.exit(0); - } - - try { - const config = await load_config(); - const sync = await import('./core/sync/sync.js'); - sync.all_types(config, values.mode); - } catch (error) { - handle_error(error); - } -} else { - console.error(colors.bold().red(`> Unknown command: ${command}`)); - console.log(help); - process.exit(1); -} diff --git a/web/node_modules/@sveltejs/kit/src/constants.js b/web/node_modules/@sveltejs/kit/src/constants.js deleted file mode 100644 index 5a6795f..0000000 --- a/web/node_modules/@sveltejs/kit/src/constants.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * A fake asset path used in `vite dev` and `vite preview`, so that we can - * serve local assets while verifying that requests are correctly prefixed - */ -export const SVELTE_KIT_ASSETS = '/_svelte_kit_assets'; - -export const GENERATED_COMMENT = '// this file is generated — do not edit it\n'; - -export const ENDPOINT_METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD']; - -export const MUTATIVE_METHODS = ['POST', 'PUT', 'PATCH', 'DELETE']; - -export const PAGE_METHODS = ['GET', 'POST', 'HEAD']; diff --git a/web/node_modules/@sveltejs/kit/src/core/adapt/builder.js b/web/node_modules/@sveltejs/kit/src/core/adapt/builder.js deleted file mode 100644 index 42ff214..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/adapt/builder.js +++ /dev/null @@ -1,369 +0,0 @@ -/** @import { Builder } from '@sveltejs/kit' */ -/** @import { ResolvedConfig } from 'vite' */ -/** @import { RouteDefinition } from '@sveltejs/kit' */ -/** @import { RouteData, ValidatedConfig, BuildData, ServerMetadata, ServerMetadataRoute, Prerendered, PrerenderMap, Logger, RemoteChunk } from 'types' */ -import colors from 'kleur'; -import { createReadStream, createWriteStream, existsSync, statSync } from 'node:fs'; -import { extname, resolve, join, dirname, relative } from 'node:path'; -import { pipeline } from 'node:stream'; -import { promisify } from 'node:util'; -import zlib from 'node:zlib'; -import { copy, rimraf, mkdirp, posixify } from '../../utils/filesystem.js'; -import { generate_manifest } from '../generate_manifest/index.js'; -import { get_route_segments } from '../../utils/routing.js'; -import { get_env } from '../../exports/vite/utils.js'; -import generate_fallback from '../postbuild/fallback.js'; -import { write } from '../sync/utils.js'; -import { list_files } from '../utils.js'; -import { find_server_assets } from '../generate_manifest/find_server_assets.js'; -import { reserved } from '../env.js'; - -const pipe = promisify(pipeline); -const extensions = ['.html', '.js', '.mjs', '.json', '.css', '.svg', '.xml', '.wasm', '.txt']; - -/** - * Creates the Builder which is passed to adapters for building the application. - * @param {{ - * config: ValidatedConfig; - * build_data: BuildData; - * server_metadata: ServerMetadata; - * route_data: RouteData[]; - * prerendered: Prerendered; - * prerender_map: PrerenderMap; - * log: Logger; - * vite_config: ResolvedConfig; - * remotes: RemoteChunk[] - * }} opts - * @returns {Builder} - */ -export function create_builder({ - config, - build_data, - server_metadata, - route_data, - prerendered, - prerender_map, - log, - vite_config, - remotes -}) { - /** @type {Map} */ - const lookup = new Map(); - - /** - * Rather than exposing the internal `RouteData` type, which is subject to change, - * we expose a stable type that adapters can use to group/filter routes - */ - const routes = route_data.map((route) => { - const { config, methods, page, api } = /** @type {ServerMetadataRoute} */ ( - server_metadata.routes.get(route.id) - ); - - /** @type {RouteDefinition} */ - const facade = { - id: route.id, - api, - page, - segments: get_route_segments(route.id).map((segment) => ({ - dynamic: segment.includes('['), - rest: segment.includes('[...'), - content: segment - })), - pattern: route.pattern, - prerender: prerender_map.get(route.id) ?? false, - methods, - config - }; - - lookup.set(facade, route); - - return facade; - }); - - return { - log, - rimraf, - mkdirp, - copy, - - config, - prerendered, - routes, - - async compress(directory) { - if (!existsSync(directory)) { - return; - } - - const files = list_files(directory, (file) => extensions.includes(extname(file))).map( - (file) => resolve(directory, file) - ); - - await Promise.all( - files.flatMap((file) => [compress_file(file, 'gz'), compress_file(file, 'br')]) - ); - }, - - async createEntries(fn) { - const seen = new Set(); - - for (let i = 0; i < route_data.length; i += 1) { - const route = route_data[i]; - if (prerender_map.get(route.id) === true) continue; - const { id, filter, complete } = fn(routes[i]); - - if (seen.has(id)) continue; - seen.add(id); - - const group = [route]; - - // figure out which lower priority routes should be considered fallbacks - for (let j = i + 1; j < route_data.length; j += 1) { - if (prerender_map.get(routes[j].id) === true) continue; - if (filter(routes[j])) { - group.push(route_data[j]); - } - } - - const filtered = new Set(group); - - // heuristic: if /foo/[bar] is included, /foo/[bar].json should - // also be included, since the page likely needs the endpoint - // TODO is this still necessary, given the new way of doing things? - filtered.forEach((route) => { - if (route.page) { - const endpoint = route_data.find((candidate) => candidate.id === route.id + '.json'); - - if (endpoint) { - filtered.add(endpoint); - } - } - }); - - if (filtered.size > 0) { - await complete({ - generateManifest: ({ relativePath }) => - generate_manifest({ - build_data, - prerendered: [], - relative_path: relativePath, - routes: Array.from(filtered), - remotes - }) - }); - } - } - }, - - findServerAssets(route_data) { - return find_server_assets( - build_data, - route_data.map((route) => /** @type {import('types').RouteData} */ (lookup.get(route))) - ); - }, - - async generateFallback(dest) { - const manifest_path = `${config.kit.outDir}/output/server/manifest-full.js`; - const env = get_env(config.kit.env, vite_config.mode); - - const fallback = await generate_fallback({ - manifest_path, - env: { ...env.private, ...env.public } - }); - - if (existsSync(dest)) { - console.log( - colors - .bold() - .yellow( - `Overwriting ${dest} with fallback page. Consider using a different name for the fallback.` - ) - ); - } - - write(dest, fallback); - }, - - generateEnvModule() { - const dest = `${config.kit.outDir}/output/prerendered/dependencies/${config.kit.appDir}/env.js`; - const env = get_env(config.kit.env, vite_config.mode); - - write(dest, `export const env=${JSON.stringify(env.public)}`); - }, - - generateManifest({ relativePath, routes: subset }) { - return generate_manifest({ - build_data, - prerendered: prerendered.paths, - relative_path: relativePath, - routes: subset - ? subset.map((route) => /** @type {import('types').RouteData} */ (lookup.get(route))) - : route_data.filter((route) => prerender_map.get(route.id) !== true), - remotes - }); - }, - - getBuildDirectory(name) { - return `${config.kit.outDir}/${name}`; - }, - - getClientDirectory() { - return `${config.kit.outDir}/output/client`; - }, - - getServerDirectory() { - return `${config.kit.outDir}/output/server`; - }, - - getAppPath() { - return build_data.app_path; - }, - - writeClient(dest) { - return copy(`${config.kit.outDir}/output/client`, dest, { - // avoid making vite build artefacts public - filter: (basename) => basename !== '.vite' - }); - }, - - writePrerendered(dest) { - const source = `${config.kit.outDir}/output/prerendered`; - - return [ - ...copy(`${source}/pages`, dest), - ...copy(`${source}/dependencies`, dest), - ...copy(`${source}/data`, dest) - ]; - }, - - writeServer(dest) { - return copy(`${config.kit.outDir}/output/server`, dest); - }, - - hasServerInstrumentationFile() { - return existsSync(`${config.kit.outDir}/output/server/instrumentation.server.js`); - }, - - instrument({ - entrypoint, - instrumentation, - start = join(dirname(entrypoint), 'start.js'), - module = { - exports: ['default'] - } - }) { - if (!existsSync(instrumentation)) { - throw new Error( - `Instrumentation file ${instrumentation} not found. This is probably a bug in your adapter.` - ); - } - if (!existsSync(entrypoint)) { - throw new Error( - `Entrypoint file ${entrypoint} not found. This is probably a bug in your adapter.` - ); - } - - copy(entrypoint, start); - if (existsSync(`${entrypoint}.map`)) { - copy(`${entrypoint}.map`, `${start}.map`); - } - - const relative_instrumentation = posixify(relative(dirname(entrypoint), instrumentation)); - const relative_start = posixify(relative(dirname(entrypoint), start)); - - const facade = - 'generateText' in module - ? module.generateText({ - instrumentation: relative_instrumentation, - start: relative_start - }) - : create_instrumentation_facade({ - instrumentation: relative_instrumentation, - start: relative_start, - exports: module.exports - }); - - rimraf(entrypoint); - write(entrypoint, facade); - } - }; -} - -/** - * @param {string} file - * @param {'gz' | 'br'} format - */ -async function compress_file(file, format = 'gz') { - const compress = - format == 'br' - ? zlib.createBrotliCompress({ - params: { - [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT, - [zlib.constants.BROTLI_PARAM_QUALITY]: zlib.constants.BROTLI_MAX_QUALITY, - [zlib.constants.BROTLI_PARAM_SIZE_HINT]: statSync(file).size - } - }) - : zlib.createGzip({ level: zlib.constants.Z_BEST_COMPRESSION }); - - const source = createReadStream(file); - const destination = createWriteStream(`${file}.${format}`); - - await pipe(source, compress, destination); -} - -/** - * Given a list of exports, generate a facade that: - * - Imports the instrumentation file - * - Imports `exports` from the entrypoint (dynamically, if `tla` is true) - * - Re-exports `exports` from the entrypoint - * - * `default` receives special treatment: It will be imported as `default` and exported with `export default`. - * - * @param {{ instrumentation: string; start: string; exports: string[] }} opts - * @returns {string} - */ -function create_instrumentation_facade({ instrumentation, start, exports }) { - const import_instrumentation = `import './${instrumentation}';`; - - let alias_index = 0; - const aliases = new Map(); - - for (const name of exports.filter((name) => reserved.has(name))) { - /* - * you can do evil things like `export { c as class }`. - * in order to import these, you need to alias them, and then un-alias them when re-exporting - * this map will allow us to generate the following: - * import { class as _1 } from 'entrypoint'; - * export { _1 as class }; - */ - let alias = `_${alias_index++}`; - while (exports.includes(alias)) { - alias = `_${alias_index++}`; - } - - aliases.set(name, alias); - } - - const import_statements = []; - const export_statements = []; - - for (const name of exports) { - const alias = aliases.get(name); - if (alias) { - import_statements.push(`${name}: ${alias}`); - export_statements.push(`${alias} as ${name}`); - } else { - import_statements.push(`${name}`); - export_statements.push(`${name}`); - } - } - - const entrypoint_facade = [ - `const { ${import_statements.join(', ')} } = await import('./${start}');`, - export_statements.length > 0 ? `export { ${export_statements.join(', ')} };` : '' - ] - .filter(Boolean) - .join('\n'); - - return `${import_instrumentation}\n${entrypoint_facade}`; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/adapt/index.js b/web/node_modules/@sveltejs/kit/src/core/adapt/index.js deleted file mode 100644 index 48d1411..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/adapt/index.js +++ /dev/null @@ -1,44 +0,0 @@ -import colors from 'kleur'; -import { create_builder } from './builder.js'; - -/** - * @param {import('types').ValidatedConfig} config - * @param {import('types').BuildData} build_data - * @param {import('types').ServerMetadata} server_metadata - * @param {import('types').Prerendered} prerendered - * @param {import('types').PrerenderMap} prerender_map - * @param {import('types').Logger} log - * @param {import('types').RemoteChunk[]} remotes - * @param {import('vite').ResolvedConfig} vite_config - */ -export async function adapt( - config, - build_data, - server_metadata, - prerendered, - prerender_map, - log, - remotes, - vite_config -) { - // This is only called when adapter is truthy, so the cast is safe - const { name, adapt } = /** @type {import('@sveltejs/kit').Adapter} */ (config.kit.adapter); - - console.log(colors.bold().cyan(`\n> Using ${name}`)); - - const builder = create_builder({ - config, - build_data, - server_metadata, - route_data: build_data.manifest_data.routes.filter((route) => route.page || route.endpoint), - prerendered, - prerender_map, - log, - remotes, - vite_config - }); - - await adapt(builder); - - log.success('done'); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/config/default-error.html b/web/node_modules/@sveltejs/kit/src/core/config/default-error.html deleted file mode 100644 index c322e16..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/config/default-error.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - %sveltekit.error.message% - - - - -
- %sveltekit.status% -
-

%sveltekit.error.message%

-
-
- - diff --git a/web/node_modules/@sveltejs/kit/src/core/config/index.js b/web/node_modules/@sveltejs/kit/src/core/config/index.js deleted file mode 100644 index ae35a70..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/config/index.js +++ /dev/null @@ -1,155 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import * as url from 'node:url'; -import options from './options.js'; - -/** - * Loads the template (src/app.html by default) and validates that it has the - * required content. - * @param {string} cwd - * @param {import('types').ValidatedConfig} config - */ -export function load_template(cwd, { kit }) { - const { env, files } = kit; - - const relative = path.relative(cwd, files.appTemplate); - - if (!fs.existsSync(files.appTemplate)) { - throw new Error(`${relative} does not exist`); - } - - const contents = fs.readFileSync(files.appTemplate, 'utf8'); - - const expected_tags = ['%sveltekit.head%', '%sveltekit.body%']; - expected_tags.forEach((tag) => { - if (contents.indexOf(tag) === -1) { - throw new Error(`${relative} is missing ${tag}`); - } - }); - - for (const match of contents.matchAll(/%sveltekit\.env\.([^%]+)%/g)) { - if (!match[1].startsWith(env.publicPrefix)) { - throw new Error( - `Environment variables in ${relative} must start with ${env.publicPrefix} (saw %sveltekit.env.${match[1]}%)` - ); - } - } - - return contents; -} - -/** - * Loads the error page (src/error.html by default) if it exists. - * Falls back to a generic error page content. - * @param {import('types').ValidatedConfig} config - */ -export function load_error_page(config) { - let { errorTemplate } = config.kit.files; - - // Don't do this inside resolving the config, because that would mean - // adding/removing error.html isn't detected and would require a restart. - if (!fs.existsSync(config.kit.files.errorTemplate)) { - errorTemplate = url.fileURLToPath(new URL('./default-error.html', import.meta.url)); - } - - return fs.readFileSync(errorTemplate, 'utf-8'); -} - -/** - * Loads and validates Svelte config file - * @param {{ cwd?: string }} options - * @returns {Promise} - */ -export async function load_config({ cwd = process.cwd() } = {}) { - const config_files = ['js', 'ts'] - .map((ext) => path.join(cwd, `svelte.config.${ext}`)) - .filter((f) => fs.existsSync(f)); - - if (config_files.length === 0) { - console.log( - `No Svelte config file found in ${cwd} - using SvelteKit's default configuration without an adapter.` - ); - return process_config({}, { cwd }); - } - const config_file = config_files[0]; - if (config_files.length > 1) { - console.log( - `Found multiple Svelte config files in ${cwd}: ${config_files.map((f) => path.basename(f)).join(', ')}. Using ${path.basename(config_file)}` - ); - } - const config = await import(`${url.pathToFileURL(config_file).href}?ts=${Date.now()}`); - - try { - return process_config(config.default, { cwd }); - } catch (e) { - const error = /** @type {Error} */ (e); - - // redact the stack trace — it's not helpful to users - error.stack = `Could not load ${config_file}: ${error.message}\n`; - throw error; - } -} - -/** - * @param {import('@sveltejs/kit').Config} config - * @returns {import('types').ValidatedConfig} - */ -function process_config(config, { cwd = process.cwd() } = {}) { - const validated = validate_config(config); - - validated.kit.outDir = path.resolve(cwd, validated.kit.outDir); - - for (const key in validated.kit.files) { - if (key === 'hooks') { - validated.kit.files.hooks.client = path.resolve(cwd, validated.kit.files.hooks.client); - validated.kit.files.hooks.server = path.resolve(cwd, validated.kit.files.hooks.server); - validated.kit.files.hooks.universal = path.resolve(cwd, validated.kit.files.hooks.universal); - } else { - // @ts-expect-error - validated.kit.files[key] = path.resolve(cwd, validated.kit.files[key]); - } - } - - return validated; -} - -/** - * @param {import('@sveltejs/kit').Config} config - * @returns {import('types').ValidatedConfig} - */ -export function validate_config(config) { - if (typeof config !== 'object') { - throw new Error( - 'The Svelte config file must have a configuration object as its default export. See https://svelte.dev/docs/kit/configuration' - ); - } - - const validated = options(config, 'config'); - const files = validated.kit.files; - - files.hooks.client ??= path.join(files.src, 'hooks.client'); - files.hooks.server ??= path.join(files.src, 'hooks.server'); - files.hooks.universal ??= path.join(files.src, 'hooks'); - files.lib ??= path.join(files.src, 'lib'); - files.params ??= path.join(files.src, 'params'); - files.routes ??= path.join(files.src, 'routes'); - files.serviceWorker ??= path.join(files.src, 'service-worker'); - files.appTemplate ??= path.join(files.src, 'app.html'); - files.errorTemplate ??= path.join(files.src, 'error.html'); - - if (validated.kit.router.resolution === 'server') { - if (validated.kit.router.type === 'hash') { - throw new Error( - "The `router.resolution` option cannot be 'server' if `router.type` is 'hash'" - ); - } - if (validated.kit.output.bundleStrategy !== 'split') { - throw new Error( - "The `router.resolution` option cannot be 'server' if `output.bundleStrategy` is 'inline' or 'single'" - ); - } - } - - return validated; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/config/options.js b/web/node_modules/@sveltejs/kit/src/core/config/options.js deleted file mode 100644 index b7140ae..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/config/options.js +++ /dev/null @@ -1,489 +0,0 @@ -import process from 'node:process'; -import colors from 'kleur'; - -/** @typedef {import('./types.js').Validator} Validator */ - -const directives = object({ - 'child-src': string_array(), - 'default-src': string_array(), - 'frame-src': string_array(), - 'worker-src': string_array(), - 'connect-src': string_array(), - 'font-src': string_array(), - 'img-src': string_array(), - 'manifest-src': string_array(), - 'media-src': string_array(), - 'object-src': string_array(), - 'prefetch-src': string_array(), - 'script-src': string_array(), - 'script-src-elem': string_array(), - 'script-src-attr': string_array(), - 'style-src': string_array(), - 'style-src-elem': string_array(), - 'style-src-attr': string_array(), - 'base-uri': string_array(), - sandbox: string_array(), - 'form-action': string_array(), - 'frame-ancestors': string_array(), - 'navigate-to': string_array(), - 'report-uri': string_array(), - 'report-to': string_array(), - 'require-trusted-types-for': string_array(), - 'trusted-types': string_array(), - 'upgrade-insecure-requests': boolean(false), - 'require-sri-for': string_array(), - 'block-all-mixed-content': boolean(false), - 'plugin-types': string_array(), - referrer: string_array() -}); - -/** @type {Validator} */ -const options = object( - { - extensions: validate(['.svelte'], (input, keypath) => { - if (!Array.isArray(input) || !input.every((page) => typeof page === 'string')) { - throw new Error(`${keypath} must be an array of strings`); - } - - input.forEach((extension) => { - if (extension[0] !== '.') { - throw new Error(`Each member of ${keypath} must start with '.' — saw '${extension}'`); - } - - if (!/^(\.[a-z0-9]+)+$/i.test(extension)) { - throw new Error(`File extensions must be alphanumeric — saw '${extension}'`); - } - }); - - return input; - }), - - kit: object({ - adapter: validate(null, (input, keypath) => { - if (typeof input !== 'object' || !input.adapt) { - let message = `${keypath} should be an object with an "adapt" method`; - - if (Array.isArray(input) || typeof input === 'string') { - // for the early adapter adopters - message += ', rather than the name of an adapter'; - } - - throw new Error(`${message}. See https://svelte.dev/docs/kit/adapters`); - } - - return input; - }), - - alias: validate({}, (input, keypath) => { - if (typeof input !== 'object') { - throw new Error(`${keypath} should be an object`); - } - - for (const key in input) { - assert_string(input[key], `${keypath}.${key}`); - } - - return input; - }), - - appDir: validate('_app', (input, keypath) => { - assert_string(input, keypath); - - if (input) { - if (input.startsWith('/') || input.endsWith('/')) { - throw new Error( - "config.kit.appDir cannot start or end with '/'. See https://svelte.dev/docs/kit/configuration" - ); - } - } else { - throw new Error(`${keypath} cannot be empty`); - } - - return input; - }), - - csp: object({ - mode: list(['auto', 'hash', 'nonce']), - directives, - reportOnly: directives - }), - - csrf: object({ - checkOrigin: deprecate( - boolean(true), - (keypath) => - `\`${keypath}\` has been deprecated in favour of \`csrf.trustedOrigins\`. It will be removed in a future version` - ), - trustedOrigins: string_array([]) - }), - - embedded: boolean(false), - - env: object({ - dir: string(process.cwd()), - publicPrefix: string('PUBLIC_'), - privatePrefix: string('') - }), - - experimental: object({ - tracing: object({ - server: boolean(false) - }), - instrumentation: object({ - server: boolean(false) - }), - remoteFunctions: boolean(false), - forkPreloads: boolean(false), - handleRenderingErrors: boolean(false) - }), - - files: object({ - src: string('src'), - assets: string('static'), - hooks: object({ - client: string(null), - server: string(null), - universal: string(null) - }), - lib: string(null), - params: string(null), - routes: string(null), - serviceWorker: string(null), - appTemplate: string(null), - errorTemplate: string(null) - }), - - inlineStyleThreshold: number(0), - - moduleExtensions: string_array(['.js', '.ts']), - - outDir: string('.svelte-kit'), - - output: object({ - preloadStrategy: list(['modulepreload', 'preload-js', 'preload-mjs']), - bundleStrategy: list(['split', 'single', 'inline']) - }), - - paths: object({ - base: validate('', (input, keypath) => { - assert_string(input, keypath); - - if (input !== '' && (input.endsWith('/') || !input.startsWith('/'))) { - throw new Error( - `${keypath} option must either be the empty string or a root-relative path that starts but doesn't end with '/'. See https://svelte.dev/docs/kit/configuration#paths` - ); - } - - return input; - }), - assets: validate('', (input, keypath) => { - assert_string(input, keypath); - - if (input) { - if (!/^[a-z]+:\/\//.test(input)) { - throw new Error( - `${keypath} option must be an absolute path, if specified. See https://svelte.dev/docs/kit/configuration#paths` - ); - } - - if (input.endsWith('/')) { - throw new Error( - `${keypath} option must not end with '/'. See https://svelte.dev/docs/kit/configuration#paths` - ); - } - } - - return input; - }), - relative: boolean(true) - }), - - prerender: object({ - concurrency: number(1), - crawl: boolean(true), - entries: validate(['*'], (input, keypath) => { - if (!Array.isArray(input) || !input.every((page) => typeof page === 'string')) { - throw new Error(`${keypath} must be an array of strings`); - } - - input.forEach((page) => { - if (page !== '*' && page[0] !== '/') { - throw new Error( - `Each member of ${keypath} must be either '*' or an absolute path beginning with '/' — saw '${page}'` - ); - } - }); - - return input; - }), - - handleHttpError: validate( - (/** @type {any} */ { message }) => { - throw new Error( - message + - '\nTo suppress or handle this error, implement `handleHttpError` in https://svelte.dev/docs/kit/configuration#prerender' - ); - }, - (input, keypath) => { - if (typeof input === 'function') return input; - if (['fail', 'warn', 'ignore'].includes(input)) return input; - throw new Error(`${keypath} should be "fail", "warn", "ignore" or a custom function`); - } - ), - - handleMissingId: validate( - (/** @type {any} */ { message }) => { - throw new Error( - message + - '\nTo suppress or handle this error, implement `handleMissingId` in https://svelte.dev/docs/kit/configuration#prerender' - ); - }, - (input, keypath) => { - if (typeof input === 'function') return input; - if (['fail', 'warn', 'ignore'].includes(input)) return input; - throw new Error(`${keypath} should be "fail", "warn", "ignore" or a custom function`); - } - ), - - handleEntryGeneratorMismatch: validate( - (/** @type {any} */ { message }) => { - throw new Error( - message + - '\nTo suppress or handle this error, implement `handleEntryGeneratorMismatch` in https://svelte.dev/docs/kit/configuration#prerender' - ); - }, - (input, keypath) => { - if (typeof input === 'function') return input; - if (['fail', 'warn', 'ignore'].includes(input)) return input; - throw new Error(`${keypath} should be "fail", "warn", "ignore" or a custom function`); - } - ), - - handleUnseenRoutes: validate( - (/** @type {any} */ { message }) => { - throw new Error( - message + - '\nTo suppress or handle this error, implement `handleUnseenRoutes` in https://svelte.dev/docs/kit/configuration#prerender' - ); - }, - (input, keypath) => { - if (typeof input === 'function') return input; - if (['fail', 'warn', 'ignore'].includes(input)) return input; - throw new Error(`${keypath} should be "fail", "warn", "ignore" or a custom function`); - } - ), - - origin: validate('http://sveltekit-prerender', (input, keypath) => { - assert_string(input, keypath); - - let origin; - - try { - origin = new URL(input).origin; - } catch { - throw new Error(`${keypath} must be a valid origin`); - } - - if (input !== origin) { - throw new Error(`${keypath} must be a valid origin (${origin} rather than ${input})`); - } - - return origin; - }) - }), - - router: object({ - type: list(['pathname', 'hash']), - resolution: list(['client', 'server']) - }), - - serviceWorker: object({ - register: boolean(true), - // options could be undefined but if it is defined we only validate that - // it's an object since the type comes from the browser itself - options: validate(undefined, object({}, true)), - files: fun((filename) => !/\.DS_Store/.test(filename)) - }), - - typescript: object({ - config: fun((config) => config) - }), - - version: object({ - name: string(Date.now().toString()), - pollInterval: number(0) - }) - }) - }, - true -); - -/** - * @param {Validator} fn - * @param {(keypath: string) => string} get_message - * @returns {Validator} - */ -function deprecate( - fn, - get_message = (keypath) => - `The \`${keypath}\` option is deprecated, and will be removed in a future version` -) { - return (input, keypath) => { - if (input !== undefined) { - console.warn(colors.bold().yellow(get_message(keypath))); - } - - return fn(input, keypath); - }; -} - -/** - * @param {Record} children - * @param {boolean} [allow_unknown] - * @returns {Validator} - */ -function object(children, allow_unknown = false) { - return (input, keypath) => { - /** @type {Record} */ - const output = {}; - - if ((input && typeof input !== 'object') || Array.isArray(input)) { - throw new Error(`${keypath} should be an object`); - } - - for (const key in input) { - if (!(key in children)) { - if (allow_unknown) { - output[key] = input[key]; - } else { - let message = `Unexpected option ${keypath}.${key}`; - - // special case - if (keypath === 'config.kit' && key in options) { - message += ` (did you mean config.${key}?)`; - } - - throw new Error(message); - } - } - } - - for (const key in children) { - const validator = children[key]; - output[key] = validator(input && input[key], `${keypath}.${key}`); - } - - return output; - }; -} - -/** - * @param {any} fallback - * @param {(value: any, keypath: string) => any} fn - * @returns {Validator} - */ -function validate(fallback, fn) { - return (input, keypath) => { - return input === undefined ? fallback : fn(input, keypath); - }; -} - -/** - * @param {string | null} fallback - * @param {boolean} allow_empty - * @returns {Validator} - */ -function string(fallback, allow_empty = true) { - return validate(fallback, (input, keypath) => { - assert_string(input, keypath); - - if (!allow_empty && input === '') { - throw new Error(`${keypath} cannot be empty`); - } - - return input; - }); -} - -/** - * @param {string[] | undefined} [fallback] - * @returns {Validator} - */ -function string_array(fallback) { - return validate(fallback, (input, keypath) => { - if (!Array.isArray(input) || input.some((value) => typeof value !== 'string')) { - throw new Error(`${keypath} must be an array of strings, if specified`); - } - - return input; - }); -} - -/** - * @param {number} fallback - * @returns {Validator} - */ -function number(fallback) { - return validate(fallback, (input, keypath) => { - if (typeof input !== 'number') { - throw new Error(`${keypath} should be a number, if specified`); - } - return input; - }); -} - -/** - * @param {boolean} fallback - * @returns {Validator} - */ -function boolean(fallback) { - return validate(fallback, (input, keypath) => { - if (typeof input !== 'boolean') { - throw new Error(`${keypath} should be true or false, if specified`); - } - return input; - }); -} - -/** - * @param {string[]} options - * @returns {Validator} - */ -function list(options, fallback = options[0]) { - return validate(fallback, (input, keypath) => { - if (!options.includes(input)) { - // prettier-ignore - const msg = options.length > 2 - ? `${keypath} should be one of ${options.slice(0, -1).map(input => `"${input}"`).join(', ')} or "${options[options.length - 1]}"` - : `${keypath} should be either "${options[0]}" or "${options[1]}"`; - - throw new Error(msg); - } - return input; - }); -} - -/** - * @param {(...args: any) => any} fallback - * @returns {Validator} - */ -function fun(fallback) { - return validate(fallback, (input, keypath) => { - if (typeof input !== 'function') { - throw new Error(`${keypath} should be a function, if specified`); - } - return input; - }); -} - -/** - * @param {string} input - * @param {string} keypath - */ -function assert_string(input, keypath) { - if (typeof input !== 'string') { - throw new Error(`${keypath} should be a string, if specified`); - } -} - -export default options; diff --git a/web/node_modules/@sveltejs/kit/src/core/config/types.d.ts b/web/node_modules/@sveltejs/kit/src/core/config/types.d.ts deleted file mode 100644 index 00d005c..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/config/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type Validator = (input: T, keypath: string) => T; diff --git a/web/node_modules/@sveltejs/kit/src/core/env.js b/web/node_modules/@sveltejs/kit/src/core/env.js deleted file mode 100644 index 455eb0f..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/env.js +++ /dev/null @@ -1,152 +0,0 @@ -import { GENERATED_COMMENT } from '../constants.js'; -import { dedent } from './sync/utils.js'; -import { runtime_base } from './utils.js'; - -/** - * @typedef {'public' | 'private'} EnvType - */ - -/** - * @param {string} id - * @param {Record} env - * @returns {string} - */ -export function create_static_module(id, env) { - /** @type {string[]} */ - const declarations = []; - - for (const key in env) { - if (!valid_identifier.test(key) || reserved.has(key)) { - continue; - } - - const comment = `/** @type {import('${id}').${key}} */`; - const declaration = `export const ${key} = ${JSON.stringify(env[key])};`; - - declarations.push(`${comment}\n${declaration}`); - } - - return GENERATED_COMMENT + declarations.join('\n\n'); -} - -/** - * @param {EnvType} type - * @param {Record | undefined} dev_values If in a development mode, values to pre-populate the module with. - */ -export function create_dynamic_module(type, dev_values) { - if (dev_values) { - const keys = Object.entries(dev_values).map( - ([k, v]) => `${JSON.stringify(k)}: ${JSON.stringify(v)}` - ); - return `export const env = {\n${keys.join(',\n')}\n}`; - } - return `export { ${type}_env as env } from '${runtime_base}/shared-server.js';`; -} - -/** - * @param {EnvType} id - * @param {import('types').Env} env - * @returns {string} - */ -export function create_static_types(id, env) { - const declarations = Object.keys(env[id]) - .filter((k) => valid_identifier.test(k)) - .map((k) => `export const ${k}: string;`); - - return dedent` - declare module '$env/static/${id}' { - ${declarations.join('\n')} - } - `; -} - -/** - * @param {EnvType} id - * @param {import('types').Env} env - * @param {{ - * public_prefix: string; - * private_prefix: string; - * }} prefixes - * @returns {string} - */ -export function create_dynamic_types(id, env, { public_prefix, private_prefix }) { - const properties = Object.keys(env[id]) - .filter((k) => valid_identifier.test(k)) - .map((k) => `${k}: string;`); - - const public_prefixed = `[key: \`${public_prefix}\${string}\`]`; - const private_prefixed = `[key: \`${private_prefix}\${string}\`]`; - - if (id === 'private') { - if (public_prefix) { - properties.push(`${public_prefixed}: undefined;`); - } - properties.push(`${private_prefixed}: string | undefined;`); - } else { - if (private_prefix) { - properties.push(`${private_prefixed}: undefined;`); - } - properties.push(`${public_prefixed}: string | undefined;`); - } - - return dedent` - declare module '$env/dynamic/${id}' { - export const env: { - ${properties.join('\n')} - } - } - `; -} - -export const reserved = new Set([ - 'do', - 'if', - 'in', - 'for', - 'let', - 'new', - 'try', - 'var', - 'case', - 'else', - 'enum', - 'eval', - 'null', - 'this', - 'true', - 'void', - 'with', - 'await', - 'break', - 'catch', - 'class', - 'const', - 'false', - 'super', - 'throw', - 'while', - 'yield', - 'delete', - 'export', - 'import', - 'public', - 'return', - 'static', - 'switch', - 'typeof', - 'default', - 'extends', - 'finally', - 'package', - 'private', - 'continue', - 'debugger', - 'function', - 'arguments', - 'interface', - 'protected', - 'implements', - 'instanceof' -]); - -export const valid_identifier = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/; diff --git a/web/node_modules/@sveltejs/kit/src/core/generate_manifest/find_server_assets.js b/web/node_modules/@sveltejs/kit/src/core/generate_manifest/find_server_assets.js deleted file mode 100644 index 044db84..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/generate_manifest/find_server_assets.js +++ /dev/null @@ -1,56 +0,0 @@ -import { find_deps } from '../../exports/vite/build/utils.js'; - -/** - * Finds all the assets that are imported by server files associated with `routes` - * @param {import('types').BuildData} build_data - * @param {import('types').RouteData[]} routes - */ -export function find_server_assets(build_data, routes) { - /** - * All nodes actually used in the routes definition (prerendered routes are omitted). - * Root layout/error is always included as they are needed for 404 and root errors. - * @type {Set} - */ - const used_nodes = new Set([0, 1]); - - /** @type {Set} */ - const server_assets = new Set(); - - /** @param {string} id */ - function add_assets(id) { - if (id in build_data.server_manifest) { - const deps = find_deps(build_data.server_manifest, id, false); - for (const asset of deps.assets) { - server_assets.add(asset); - } - } - } - - for (const route of routes) { - if (route.page) { - for (const i of route.page.layouts) used_nodes.add(i); - for (const i of route.page.errors) used_nodes.add(i); - used_nodes.add(route.page.leaf); - } - - if (route.endpoint) { - add_assets(route.endpoint.file); - } - } - - for (const n of used_nodes) { - const node = build_data.manifest_data.nodes[n]; - if (node?.universal) add_assets(node.universal); - if (node?.server) add_assets(node.server); - } - - if (build_data.manifest_data.hooks.server) { - add_assets(build_data.manifest_data.hooks.server); - } - - if (build_data.manifest_data.hooks.universal) { - add_assets(build_data.manifest_data.hooks.universal); - } - - return Array.from(server_assets); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/generate_manifest/index.js b/web/node_modules/@sveltejs/kit/src/core/generate_manifest/index.js deleted file mode 100644 index 6b2445a..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/generate_manifest/index.js +++ /dev/null @@ -1,152 +0,0 @@ -/** @import { RemoteChunk } from 'types' */ -import fs from 'node:fs'; -import path from 'node:path'; -import * as mime from 'mrmime'; -import { s } from '../../utils/misc.js'; -import { get_mime_lookup } from '../utils.js'; -import { resolve_symlinks } from '../../exports/vite/build/utils.js'; -import { compact } from '../../utils/array.js'; -import { join_relative } from '../../utils/filesystem.js'; -import { dedent } from '../sync/utils.js'; -import { find_server_assets } from './find_server_assets.js'; -import { uneval } from 'devalue'; - -/** - * Generates the data used to write the server-side manifest.js file. This data is used in the Vite - * build process, to power routing, etc. - * @param {{ - * build_data: import('types').BuildData; - * prerendered: string[]; - * relative_path: string; - * routes: import('types').RouteData[]; - * remotes: RemoteChunk[]; - * }} opts - */ -export function generate_manifest({ build_data, prerendered, relative_path, routes, remotes }) { - /** - * @type {Map} The new index of each node in the filtered nodes array - */ - const reindexed = new Map(); - /** - * All nodes actually used in the routes definition (prerendered routes are omitted). - * Root layout/error is always included as they are needed for 404 and root errors. - * @type {Set} - */ - const used_nodes = new Set([0, 1]); - - const server_assets = find_server_assets(build_data, routes); - - for (const route of routes) { - if (route.page) { - for (const i of route.page.layouts) used_nodes.add(i); - for (const i of route.page.errors) used_nodes.add(i); - used_nodes.add(route.page.leaf); - } - } - - const node_paths = compact( - build_data.manifest_data.nodes.map((_, i) => { - if (used_nodes.has(i)) { - reindexed.set(i, reindexed.size); - return join_relative(relative_path, `/nodes/${i}.js`); - } - }) - ); - - /** @type {(path: string) => string} */ - const loader = (path) => `__memo(() => import('${path}'))`; - - const assets = build_data.manifest_data.assets.map((asset) => asset.file); - if (build_data.service_worker) { - assets.push(build_data.service_worker); - } - - // In case of server-side route resolution, we need to include all matchers. Prerendered routes are not part - // of the server manifest, and they could reference matchers that then would not be included. - const matchers = new Set( - build_data.client?.nodes ? Object.keys(build_data.manifest_data.matchers) : undefined - ); - - /** @param {Array} indexes */ - function get_nodes(indexes) { - const string = indexes.map((n) => reindexed.get(n) ?? '').join(','); - - // since JavaScript ignores trailing commas, we need to insert a dummy - // comma so that the array has the correct length if the last item - // is undefined - return `[${string},]`; - } - - const mime_types = get_mime_lookup(build_data.manifest_data); - - /** @type {Record} */ - const files = {}; - for (const file of server_assets) { - files[file] = fs.statSync(path.resolve(build_data.out_dir, 'server', file)).size; - - const ext = path.extname(file); - mime_types[ext] ??= mime.lookup(ext) || ''; - } - - // prettier-ignore - // String representation of - /** @template {import('@sveltejs/kit').SSRManifest} T */ - const manifest_expr = dedent` - { - appDir: ${s(build_data.app_dir)}, - appPath: ${s(build_data.app_path)}, - assets: new Set(${s(assets)}), - mimeTypes: ${s(mime_types)}, - _: { - client: ${uneval(build_data.client)}, - nodes: [ - ${(node_paths).map(loader).join(',\n')} - ], - remotes: { - ${remotes.map((remote) => `'${remote.hash}': ${loader(join_relative(relative_path, `chunks/remote-${remote.hash}.js`))}`).join(',\n')} - }, - routes: [ - ${routes.map(route => { - if (!route.page && !route.endpoint) return; - - route.params.forEach(param => { - if (param.matcher) matchers.add(param.matcher); - }); - - return dedent` - { - id: ${s(route.id)}, - pattern: ${route.pattern}, - params: ${s(route.params)}, - page: ${route.page ? `{ layouts: ${get_nodes(route.page.layouts)}, errors: ${get_nodes(route.page.errors)}, leaf: ${reindexed.get(route.page.leaf)} }` : 'null'}, - endpoint: ${route.endpoint ? loader(join_relative(relative_path, resolve_symlinks(build_data.server_manifest, route.endpoint.file).chunk.file)) : 'null'} - } - `; - }).filter(Boolean).join(',\n')} - ], - prerendered_routes: new Set(${s(prerendered)}), - matchers: async () => { - ${Array.from( - matchers, - type => `const { match: ${type} } = await import ('${(join_relative(relative_path, `/entries/matchers/${type}.js`))}')` - ).join('\n')} - return { ${Array.from(matchers).join(', ')} }; - }, - server_assets: ${s(files)} - } - } - `; - - // Memoize the loaders to prevent Node from doing unnecessary work - // on every dynamic import call - return dedent` - (() => { - function __memo(fn) { - let value; - return () => value ??= (value = fn()); - } - - return ${manifest_expr} - })() - `; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js deleted file mode 100644 index aa99609..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/analyse.js +++ /dev/null @@ -1,285 +0,0 @@ -/** @import { RemoteChunk } from 'types' */ -import { join } from 'node:path'; -import { pathToFileURL } from 'node:url'; -import { validate_server_exports } from '../../utils/exports.js'; -import { load_config } from '../config/index.js'; -import { forked } from '../../utils/fork.js'; -import { installPolyfills } from '../../exports/node/polyfills.js'; -import { ENDPOINT_METHODS } from '../../constants.js'; -import { filter_env } from '../../utils/env.js'; -import { has_server_load, resolve_route } from '../../utils/routing.js'; -import { check_feature } from '../../utils/features.js'; -import { createReadableStream } from '@sveltejs/kit/node'; -import { PageNodes } from '../../utils/page_nodes.js'; -import { build_server_nodes } from '../../exports/vite/build/build_server.js'; - -export default forked(import.meta.url, analyse); - -/** - * @param {{ - * hash: boolean; - * manifest_path: string; - * manifest_data: import('types').ManifestData; - * server_manifest: import('vite').Manifest; - * tracked_features: Record; - * env: Record; - * out: string; - * output_config: import('types').RecursiveRequired; - * remotes: RemoteChunk[]; - * }} opts - */ -async function analyse({ - hash, - manifest_path, - manifest_data, - server_manifest, - tracked_features, - env, - out, - output_config, - remotes -}) { - /** @type {import('@sveltejs/kit').SSRManifest} */ - const manifest = (await import(pathToFileURL(manifest_path).href)).manifest; - - /** @type {import('types').ValidatedKitConfig} */ - const config = (await load_config()).kit; - - const server_root = join(config.outDir, 'output'); - - /** @type {import('types').ServerInternalModule} */ - const internal = await import(pathToFileURL(`${server_root}/server/internal.js`).href); - - installPolyfills(); - - // configure `import { building } from '$app/environment'` — - // essential we do this before analysing the code - internal.set_building(); - - // set env, `read`, and `manifest`, in case they're used in initialisation - const { publicPrefix: public_prefix, privatePrefix: private_prefix } = config.env; - const private_env = filter_env(env, private_prefix, public_prefix); - const public_env = filter_env(env, public_prefix, private_prefix); - internal.set_private_env(private_env); - internal.set_public_env(public_env); - internal.set_manifest(manifest); - internal.set_read_implementation((file) => createReadableStream(`${server_root}/server/${file}`)); - - // first, build server nodes without the client manifest so we can analyse it - build_server_nodes(out, config, manifest_data, server_manifest, null, null, null, output_config); - - /** @type {import('types').ServerMetadata} */ - const metadata = { - nodes: [], - routes: new Map(), - remotes: new Map() - }; - - const nodes = await Promise.all(manifest._.nodes.map((loader) => loader())); - - // analyse nodes - for (const node of nodes) { - if (hash && node.universal) { - const options = Object.keys(node.universal).filter((o) => o !== 'load'); - if (options.length > 0) { - throw new Error( - `Page options are ignored when \`router.type === 'hash'\` (${node.universal_id} has ${options - .filter((o) => o !== 'load') - .map((o) => `'${o}'`) - .join(', ')})` - ); - } - } - - metadata.nodes[node.index] = { - has_server_load: has_server_load(node), - has_universal_load: node.universal?.load !== undefined - }; - } - - // analyse routes - for (const route of manifest._.routes) { - const page = - route.page && - analyse_page( - route.page.layouts.map((n) => (n === undefined ? n : nodes[n])), - nodes[route.page.leaf] - ); - - const endpoint = route.endpoint && analyse_endpoint(route, await route.endpoint()); - - if (page?.prerender && endpoint?.prerender) { - throw new Error(`Cannot prerender a route with both +page and +server files (${route.id})`); - } - - if (page?.config && endpoint?.config) { - for (const key in { ...page.config, ...endpoint.config }) { - if (JSON.stringify(page.config[key]) !== JSON.stringify(endpoint.config[key])) { - throw new Error( - `Mismatched route config for ${route.id} — the +page and +server files must export the same config, if any` - ); - } - } - } - - const route_config = page?.config ?? endpoint?.config ?? {}; - const prerender = page?.prerender ?? endpoint?.prerender; - - if (prerender !== true) { - for (const feature of list_features( - route, - manifest_data, - server_manifest, - tracked_features - )) { - check_feature(route.id, route_config, feature, config.adapter); - } - } - - const page_methods = page?.methods ?? []; - const api_methods = endpoint?.methods ?? []; - const entries = page?.entries ?? endpoint?.entries; - - metadata.routes.set(route.id, { - config: route_config, - methods: Array.from(new Set([...page_methods, ...api_methods])), - page: { - methods: page_methods - }, - api: { - methods: api_methods - }, - prerender, - entries: - entries && (await entries()).map((entry_object) => resolve_route(route.id, entry_object)) - }); - } - - // analyse remotes - for (const remote of remotes) { - const loader = manifest._.remotes[remote.hash]; - const { default: functions } = await loader(); - - const exports = new Map(); - - for (const name in functions) { - const info = /** @type {import('types').RemoteInfo} */ (functions[name].__); - const type = info.type; - - exports.set(name, { - type, - dynamic: type !== 'prerender' || info.dynamic - }); - } - - metadata.remotes.set(remote.hash, exports); - } - - return { metadata }; -} - -/** - * @param {import('types').SSRRoute} route - * @param {import('types').SSREndpoint} mod - */ -function analyse_endpoint(route, mod) { - validate_server_exports(mod, route.id); - - if (mod.prerender && (mod.POST || mod.PATCH || mod.PUT || mod.DELETE)) { - throw new Error( - `Cannot prerender a +server file with POST, PATCH, PUT, or DELETE (${route.id})` - ); - } - - /** @type {Array} */ - const methods = []; - - for (const method of /** @type {import('types').HttpMethod[]} */ (ENDPOINT_METHODS)) { - if (mod[method]) methods.push(method); - } - - if (mod.fallback) { - methods.push('*'); - } - - return { - config: mod.config, - entries: mod.entries, - methods, - prerender: mod.prerender ?? false - }; -} - -/** - * @param {Array} layouts - * @param {import('types').SSRNode} leaf - */ -function analyse_page(layouts, leaf) { - /** @type {Array<'GET' | 'POST'>} */ - const methods = ['GET']; - if (leaf.server?.actions) methods.push('POST'); - - const nodes = new PageNodes([...layouts, leaf]); - nodes.validate(); - - return { - config: nodes.get_config(), - entries: leaf.universal?.entries ?? leaf.server?.entries, - methods, - prerender: nodes.prerender() - }; -} - -/** - * @param {import('types').SSRRoute} route - * @param {import('types').ManifestData} manifest_data - * @param {import('vite').Manifest} server_manifest - * @param {Record} tracked_features - */ -function list_features(route, manifest_data, server_manifest, tracked_features) { - const features = new Set(); - - const route_data = /** @type {import('types').RouteData} */ ( - manifest_data.routes.find((r) => r.id === route.id) - ); - - const visited = new Set(); - /** @param {string} id */ - function visit(id) { - if (visited.has(id)) return; - visited.add(id); - - const chunk = server_manifest[id]; - if (!chunk) return; - - if (chunk.file in tracked_features) { - for (const feature of tracked_features[chunk.file]) { - features.add(feature); - } - } - - if (chunk.imports) { - for (const id of chunk.imports) { - visit(id); - } - } - } - - let page_node = route_data?.leaf; - while (page_node) { - if (page_node.server) visit(page_node.server); - page_node = page_node.parent ?? null; - } - - if (route_data.endpoint) { - visit(route_data.endpoint.file); - } - - if (manifest_data.hooks.server) { - // TODO if hooks.server.js imports `read`, it will be in the entry chunk - // we don't currently account for that case - visit(manifest_data.hooks.server); - } - - return Array.from(features); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/crawl.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/crawl.js deleted file mode 100644 index 25134d1..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/crawl.js +++ /dev/null @@ -1,243 +0,0 @@ -import { resolve, decode_uri } from '../../utils/url.js'; -import { decode } from './entities.js'; - -const DOCTYPE = 'DOCTYPE'; -const CDATA_OPEN = '[CDATA['; -const CDATA_CLOSE = ']]>'; -const COMMENT_OPEN = '--'; -const COMMENT_CLOSE = '-->'; - -const TAG_OPEN = /[a-zA-Z]/; -const TAG_CHAR = /[a-zA-Z0-9]/; -const ATTRIBUTE_NAME = /[^\t\n\f />"'=]/; - -const WHITESPACE = /[\s\n\r]/; - -const CRAWLABLE_META_NAME_ATTRS = new Set([ - 'og:url', - 'og:image', - 'og:image:url', - 'og:image:secure_url', - 'og:video', - 'og:video:url', - 'og:video:secure_url', - 'og:audio', - 'og:audio:url', - 'og:audio:secure_url', - 'twitter:image' -]); - -/** - * @param {string} html - * @param {string} base - */ -export function crawl(html, base) { - /** @type {string[]} */ - const ids = []; - - /** @type {string[]} */ - const hrefs = []; - - let i = 0; - main: while (i < html.length) { - const char = html[i]; - - if (char === '<') { - if (html[i + 1] === '!') { - i += 2; - - if (html.slice(i, i + DOCTYPE.length).toUpperCase() === DOCTYPE) { - i += DOCTYPE.length; - while (i < html.length) { - if (html[i++] === '>') { - continue main; - } - } - } - - // skip cdata - if (html.slice(i, i + CDATA_OPEN.length) === CDATA_OPEN) { - i += CDATA_OPEN.length; - while (i < html.length) { - if (html.slice(i, i + CDATA_CLOSE.length) === CDATA_CLOSE) { - i += CDATA_CLOSE.length; - continue main; - } - - i += 1; - } - } - - // skip comments - if (html.slice(i, i + COMMENT_OPEN.length) === COMMENT_OPEN) { - i += COMMENT_OPEN.length; - while (i < html.length) { - if (html.slice(i, i + COMMENT_CLOSE.length) === COMMENT_CLOSE) { - i += COMMENT_CLOSE.length; - continue main; - } - - i += 1; - } - } - } - - // parse opening tags - const start = ++i; - if (TAG_OPEN.test(html[start])) { - while (i < html.length) { - if (!TAG_CHAR.test(html[i])) { - break; - } - - i += 1; - } - - const tag = html.slice(start, i).toUpperCase(); - - /** @type {Record} */ - const attributes = {}; - - if (tag === 'SCRIPT' || tag === 'STYLE') { - while (i < html.length) { - if ( - html[i] === '<' && - html[i + 1] === '/' && - html.slice(i + 2, i + 2 + tag.length).toUpperCase() === tag - ) { - continue main; - } - - i += 1; - } - } - - while (i < html.length) { - const start = i; - - const char = html[start]; - if (char === '>') break; - - if (ATTRIBUTE_NAME.test(char)) { - i += 1; - - while (i < html.length) { - if (!ATTRIBUTE_NAME.test(html[i])) { - break; - } - - i += 1; - } - - const name = html.slice(start, i).toLowerCase(); - - while (WHITESPACE.test(html[i])) i += 1; - - if (html[i] === '=') { - i += 1; - while (WHITESPACE.test(html[i])) i += 1; - - let value; - - if (html[i] === "'" || html[i] === '"') { - const quote = html[i++]; - - const start = i; - let escaped = false; - - while (i < html.length) { - if (escaped) { - escaped = false; - } else { - const char = html[i]; - - if (html[i] === quote) { - break; - } - - if (char === '\\') { - escaped = true; - } - } - - i += 1; - } - - value = html.slice(start, i); - } else { - const start = i; - while (html[i] !== '>' && !WHITESPACE.test(html[i])) i += 1; - value = html.slice(start, i); - - i -= 1; - } - - value = decode(value); - attributes[name] = value; - } else { - i -= 1; - } - } - - i += 1; - } - - const { href, id, name, property, rel, src, srcset, content } = attributes; - - if (href) { - if (tag === 'BASE') { - base = resolve(base, href); - } else if (!rel || !/\bexternal\b/i.test(rel)) { - hrefs.push(resolve(base, href)); - } - } - - if (id) { - ids.push(decode_uri(id)); - } - - if (name && tag === 'A') { - ids.push(decode_uri(name)); - } - - if (src) { - hrefs.push(resolve(base, src)); - } - - if (srcset) { - let value = srcset; - const candidates = []; - let insideURL = true; - value = value.trim(); - for (let i = 0; i < value.length; i++) { - if (value[i] === ',' && (!insideURL || (insideURL && WHITESPACE.test(value[i + 1])))) { - candidates.push(value.slice(0, i)); - value = value.substring(i + 1).trim(); - i = 0; - insideURL = true; - } else if (WHITESPACE.test(value[i])) { - insideURL = false; - } - } - candidates.push(value); - for (const candidate of candidates) { - const src = candidate.split(WHITESPACE)[0]; - if (src) hrefs.push(resolve(base, src)); - } - } - - if (tag === 'META' && content) { - const attr = name ?? property; - - if (attr && CRAWLABLE_META_NAME_ATTRS.has(attr)) { - hrefs.push(resolve(base, content)); - } - } - } - } - - i += 1; - } - - return { ids, hrefs }; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/entities.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/entities.js deleted file mode 100644 index 91888a9..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/entities.js +++ /dev/null @@ -1,2252 +0,0 @@ -/** - * A list of all named HTML entities, from https://html.spec.whatwg.org/multipage/named-characters.html - * @type {Record} - */ -const entities = { - AElig: 'Æ', - 'AElig;': 'Æ', - AMP: '&', - 'AMP;': '&', - Aacute: 'Á', - 'Aacute;': 'Á', - 'Abreve;': 'Ă', - Acirc: 'Â', - 'Acirc;': 'Â', - 'Acy;': 'А', - 'Afr;': '𝔄', - Agrave: 'À', - 'Agrave;': 'À', - 'Alpha;': 'Α', - 'Amacr;': 'Ā', - 'And;': '⩓', - 'Aogon;': 'Ą', - 'Aopf;': '𝔸', - 'ApplyFunction;': '⁡', - Aring: 'Å', - 'Aring;': 'Å', - 'Ascr;': '𝒜', - 'Assign;': '≔', - Atilde: 'Ã', - 'Atilde;': 'Ã', - Auml: 'Ä', - 'Auml;': 'Ä', - 'Backslash;': '∖', - 'Barv;': '⫧', - 'Barwed;': '⌆', - 'Bcy;': 'Б', - 'Because;': '∵', - 'Bernoullis;': 'ℬ', - 'Beta;': 'Β', - 'Bfr;': '𝔅', - 'Bopf;': '𝔹', - 'Breve;': '˘', - 'Bscr;': 'ℬ', - 'Bumpeq;': '≎', - 'CHcy;': 'Ч', - COPY: '©', - 'COPY;': '©', - 'Cacute;': 'Ć', - 'Cap;': '⋒', - 'CapitalDifferentialD;': 'ⅅ', - 'Cayleys;': 'ℭ', - 'Ccaron;': 'Č', - Ccedil: 'Ç', - 'Ccedil;': 'Ç', - 'Ccirc;': 'Ĉ', - 'Cconint;': '∰', - 'Cdot;': 'Ċ', - 'Cedilla;': '¸', - 'CenterDot;': '·', - 'Cfr;': 'ℭ', - 'Chi;': 'Χ', - 'CircleDot;': '⊙', - 'CircleMinus;': '⊖', - 'CirclePlus;': '⊕', - 'CircleTimes;': '⊗', - 'ClockwiseContourIntegral;': '∲', - 'CloseCurlyDoubleQuote;': '”', - 'CloseCurlyQuote;': '’', - 'Colon;': '∷', - 'Colone;': '⩴', - 'Congruent;': '≡', - 'Conint;': '∯', - 'ContourIntegral;': '∮', - 'Copf;': 'ℂ', - 'Coproduct;': '∐', - 'CounterClockwiseContourIntegral;': '∳', - 'Cross;': '⨯', - 'Cscr;': '𝒞', - 'Cup;': '⋓', - 'CupCap;': '≍', - 'DD;': 'ⅅ', - 'DDotrahd;': '⤑', - 'DJcy;': 'Ђ', - 'DScy;': 'Ѕ', - 'DZcy;': 'Џ', - 'Dagger;': '‡', - 'Darr;': '↡', - 'Dashv;': '⫤', - 'Dcaron;': 'Ď', - 'Dcy;': 'Д', - 'Del;': '∇', - 'Delta;': 'Δ', - 'Dfr;': '𝔇', - 'DiacriticalAcute;': '´', - 'DiacriticalDot;': '˙', - 'DiacriticalDoubleAcute;': '˝', - 'DiacriticalGrave;': '`', - 'DiacriticalTilde;': '˜', - 'Diamond;': '⋄', - 'DifferentialD;': 'ⅆ', - 'Dopf;': '𝔻', - 'Dot;': '¨', - 'DotDot;': '⃜', - 'DotEqual;': '≐', - 'DoubleContourIntegral;': '∯', - 'DoubleDot;': '¨', - 'DoubleDownArrow;': '⇓', - 'DoubleLeftArrow;': '⇐', - 'DoubleLeftRightArrow;': '⇔', - 'DoubleLeftTee;': '⫤', - 'DoubleLongLeftArrow;': '⟸', - 'DoubleLongLeftRightArrow;': '⟺', - 'DoubleLongRightArrow;': '⟹', - 'DoubleRightArrow;': '⇒', - 'DoubleRightTee;': '⊨', - 'DoubleUpArrow;': '⇑', - 'DoubleUpDownArrow;': '⇕', - 'DoubleVerticalBar;': '∥', - 'DownArrow;': '↓', - 'DownArrowBar;': '⤓', - 'DownArrowUpArrow;': '⇵', - 'DownBreve;': '̑', - 'DownLeftRightVector;': '⥐', - 'DownLeftTeeVector;': '⥞', - 'DownLeftVector;': '↽', - 'DownLeftVectorBar;': '⥖', - 'DownRightTeeVector;': '⥟', - 'DownRightVector;': '⇁', - 'DownRightVectorBar;': '⥗', - 'DownTee;': '⊤', - 'DownTeeArrow;': '↧', - 'Downarrow;': '⇓', - 'Dscr;': '𝒟', - 'Dstrok;': 'Đ', - 'ENG;': 'Ŋ', - ETH: 'Ð', - 'ETH;': 'Ð', - Eacute: 'É', - 'Eacute;': 'É', - 'Ecaron;': 'Ě', - Ecirc: 'Ê', - 'Ecirc;': 'Ê', - 'Ecy;': 'Э', - 'Edot;': 'Ė', - 'Efr;': '𝔈', - Egrave: 'È', - 'Egrave;': 'È', - 'Element;': '∈', - 'Emacr;': 'Ē', - 'EmptySmallSquare;': '◻', - 'EmptyVerySmallSquare;': '▫', - 'Eogon;': 'Ę', - 'Eopf;': '𝔼', - 'Epsilon;': 'Ε', - 'Equal;': '⩵', - 'EqualTilde;': '≂', - 'Equilibrium;': '⇌', - 'Escr;': 'ℰ', - 'Esim;': '⩳', - 'Eta;': 'Η', - Euml: 'Ë', - 'Euml;': 'Ë', - 'Exists;': '∃', - 'ExponentialE;': 'ⅇ', - 'Fcy;': 'Ф', - 'Ffr;': '𝔉', - 'FilledSmallSquare;': '◼', - 'FilledVerySmallSquare;': '▪', - 'Fopf;': '𝔽', - 'ForAll;': '∀', - 'Fouriertrf;': 'ℱ', - 'Fscr;': 'ℱ', - 'GJcy;': 'Ѓ', - GT: '>', - 'GT;': '>', - 'Gamma;': 'Γ', - 'Gammad;': 'Ϝ', - 'Gbreve;': 'Ğ', - 'Gcedil;': 'Ģ', - 'Gcirc;': 'Ĝ', - 'Gcy;': 'Г', - 'Gdot;': 'Ġ', - 'Gfr;': '𝔊', - 'Gg;': '⋙', - 'Gopf;': '𝔾', - 'GreaterEqual;': '≥', - 'GreaterEqualLess;': '⋛', - 'GreaterFullEqual;': '≧', - 'GreaterGreater;': '⪢', - 'GreaterLess;': '≷', - 'GreaterSlantEqual;': '⩾', - 'GreaterTilde;': '≳', - 'Gscr;': '𝒢', - 'Gt;': '≫', - 'HARDcy;': 'Ъ', - 'Hacek;': 'ˇ', - 'Hat;': '^', - 'Hcirc;': 'Ĥ', - 'Hfr;': 'ℌ', - 'HilbertSpace;': 'ℋ', - 'Hopf;': 'ℍ', - 'HorizontalLine;': '─', - 'Hscr;': 'ℋ', - 'Hstrok;': 'Ħ', - 'HumpDownHump;': '≎', - 'HumpEqual;': '≏', - 'IEcy;': 'Е', - 'IJlig;': 'IJ', - 'IOcy;': 'Ё', - Iacute: 'Í', - 'Iacute;': 'Í', - Icirc: 'Î', - 'Icirc;': 'Î', - 'Icy;': 'И', - 'Idot;': 'İ', - 'Ifr;': 'ℑ', - Igrave: 'Ì', - 'Igrave;': 'Ì', - 'Im;': 'ℑ', - 'Imacr;': 'Ī', - 'ImaginaryI;': 'ⅈ', - 'Implies;': '⇒', - 'Int;': '∬', - 'Integral;': '∫', - 'Intersection;': '⋂', - 'InvisibleComma;': '⁣', - 'InvisibleTimes;': '⁢', - 'Iogon;': 'Į', - 'Iopf;': '𝕀', - 'Iota;': 'Ι', - 'Iscr;': 'ℐ', - 'Itilde;': 'Ĩ', - 'Iukcy;': 'І', - Iuml: 'Ï', - 'Iuml;': 'Ï', - 'Jcirc;': 'Ĵ', - 'Jcy;': 'Й', - 'Jfr;': '𝔍', - 'Jopf;': '𝕁', - 'Jscr;': '𝒥', - 'Jsercy;': 'Ј', - 'Jukcy;': 'Є', - 'KHcy;': 'Х', - 'KJcy;': 'Ќ', - 'Kappa;': 'Κ', - 'Kcedil;': 'Ķ', - 'Kcy;': 'К', - 'Kfr;': '𝔎', - 'Kopf;': '𝕂', - 'Kscr;': '𝒦', - 'LJcy;': 'Љ', - LT: '<', - 'LT;': '<', - 'Lacute;': 'Ĺ', - 'Lambda;': 'Λ', - 'Lang;': '⟪', - 'Laplacetrf;': 'ℒ', - 'Larr;': '↞', - 'Lcaron;': 'Ľ', - 'Lcedil;': 'Ļ', - 'Lcy;': 'Л', - 'LeftAngleBracket;': '⟨', - 'LeftArrow;': '←', - 'LeftArrowBar;': '⇤', - 'LeftArrowRightArrow;': '⇆', - 'LeftCeiling;': '⌈', - 'LeftDoubleBracket;': '⟦', - 'LeftDownTeeVector;': '⥡', - 'LeftDownVector;': '⇃', - 'LeftDownVectorBar;': '⥙', - 'LeftFloor;': '⌊', - 'LeftRightArrow;': '↔', - 'LeftRightVector;': '⥎', - 'LeftTee;': '⊣', - 'LeftTeeArrow;': '↤', - 'LeftTeeVector;': '⥚', - 'LeftTriangle;': '⊲', - 'LeftTriangleBar;': '⧏', - 'LeftTriangleEqual;': '⊴', - 'LeftUpDownVector;': '⥑', - 'LeftUpTeeVector;': '⥠', - 'LeftUpVector;': '↿', - 'LeftUpVectorBar;': '⥘', - 'LeftVector;': '↼', - 'LeftVectorBar;': '⥒', - 'Leftarrow;': '⇐', - 'Leftrightarrow;': '⇔', - 'LessEqualGreater;': '⋚', - 'LessFullEqual;': '≦', - 'LessGreater;': '≶', - 'LessLess;': '⪡', - 'LessSlantEqual;': '⩽', - 'LessTilde;': '≲', - 'Lfr;': '𝔏', - 'Ll;': '⋘', - 'Lleftarrow;': '⇚', - 'Lmidot;': 'Ŀ', - 'LongLeftArrow;': '⟵', - 'LongLeftRightArrow;': '⟷', - 'LongRightArrow;': '⟶', - 'Longleftarrow;': '⟸', - 'Longleftrightarrow;': '⟺', - 'Longrightarrow;': '⟹', - 'Lopf;': '𝕃', - 'LowerLeftArrow;': '↙', - 'LowerRightArrow;': '↘', - 'Lscr;': 'ℒ', - 'Lsh;': '↰', - 'Lstrok;': 'Ł', - 'Lt;': '≪', - 'Map;': '⤅', - 'Mcy;': 'М', - 'MediumSpace;': ' ', - 'Mellintrf;': 'ℳ', - 'Mfr;': '𝔐', - 'MinusPlus;': '∓', - 'Mopf;': '𝕄', - 'Mscr;': 'ℳ', - 'Mu;': 'Μ', - 'NJcy;': 'Њ', - 'Nacute;': 'Ń', - 'Ncaron;': 'Ň', - 'Ncedil;': 'Ņ', - 'Ncy;': 'Н', - 'NegativeMediumSpace;': '​', - 'NegativeThickSpace;': '​', - 'NegativeThinSpace;': '​', - 'NegativeVeryThinSpace;': '​', - 'NestedGreaterGreater;': '≫', - 'NestedLessLess;': '≪', - 'NewLine;': '\n', - 'Nfr;': '𝔑', - 'NoBreak;': '⁠', - 'NonBreakingSpace;': ' ', - 'Nopf;': 'ℕ', - 'Not;': '⫬', - 'NotCongruent;': '≢', - 'NotCupCap;': '≭', - 'NotDoubleVerticalBar;': '∦', - 'NotElement;': '∉', - 'NotEqual;': '≠', - 'NotEqualTilde;': '≂̸', - 'NotExists;': '∄', - 'NotGreater;': '≯', - 'NotGreaterEqual;': '≱', - 'NotGreaterFullEqual;': '≧̸', - 'NotGreaterGreater;': '≫̸', - 'NotGreaterLess;': '≹', - 'NotGreaterSlantEqual;': '⩾̸', - 'NotGreaterTilde;': '≵', - 'NotHumpDownHump;': '≎̸', - 'NotHumpEqual;': '≏̸', - 'NotLeftTriangle;': '⋪', - 'NotLeftTriangleBar;': '⧏̸', - 'NotLeftTriangleEqual;': '⋬', - 'NotLess;': '≮', - 'NotLessEqual;': '≰', - 'NotLessGreater;': '≸', - 'NotLessLess;': '≪̸', - 'NotLessSlantEqual;': '⩽̸', - 'NotLessTilde;': '≴', - 'NotNestedGreaterGreater;': '⪢̸', - 'NotNestedLessLess;': '⪡̸', - 'NotPrecedes;': '⊀', - 'NotPrecedesEqual;': '⪯̸', - 'NotPrecedesSlantEqual;': '⋠', - 'NotReverseElement;': '∌', - 'NotRightTriangle;': '⋫', - 'NotRightTriangleBar;': '⧐̸', - 'NotRightTriangleEqual;': '⋭', - 'NotSquareSubset;': '⊏̸', - 'NotSquareSubsetEqual;': '⋢', - 'NotSquareSuperset;': '⊐̸', - 'NotSquareSupersetEqual;': '⋣', - 'NotSubset;': '⊂⃒', - 'NotSubsetEqual;': '⊈', - 'NotSucceeds;': '⊁', - 'NotSucceedsEqual;': '⪰̸', - 'NotSucceedsSlantEqual;': '⋡', - 'NotSucceedsTilde;': '≿̸', - 'NotSuperset;': '⊃⃒', - 'NotSupersetEqual;': '⊉', - 'NotTilde;': '≁', - 'NotTildeEqual;': '≄', - 'NotTildeFullEqual;': '≇', - 'NotTildeTilde;': '≉', - 'NotVerticalBar;': '∤', - 'Nscr;': '𝒩', - Ntilde: 'Ñ', - 'Ntilde;': 'Ñ', - 'Nu;': 'Ν', - 'OElig;': 'Œ', - Oacute: 'Ó', - 'Oacute;': 'Ó', - Ocirc: 'Ô', - 'Ocirc;': 'Ô', - 'Ocy;': 'О', - 'Odblac;': 'Ő', - 'Ofr;': '𝔒', - Ograve: 'Ò', - 'Ograve;': 'Ò', - 'Omacr;': 'Ō', - 'Omega;': 'Ω', - 'Omicron;': 'Ο', - 'Oopf;': '𝕆', - 'OpenCurlyDoubleQuote;': '“', - 'OpenCurlyQuote;': '‘', - 'Or;': '⩔', - 'Oscr;': '𝒪', - Oslash: 'Ø', - 'Oslash;': 'Ø', - Otilde: 'Õ', - 'Otilde;': 'Õ', - 'Otimes;': '⨷', - Ouml: 'Ö', - 'Ouml;': 'Ö', - 'OverBar;': '‾', - 'OverBrace;': '⏞', - 'OverBracket;': '⎴', - 'OverParenthesis;': '⏜', - 'PartialD;': '∂', - 'Pcy;': 'П', - 'Pfr;': '𝔓', - 'Phi;': 'Φ', - 'Pi;': 'Π', - 'PlusMinus;': '±', - 'Poincareplane;': 'ℌ', - 'Popf;': 'ℙ', - 'Pr;': '⪻', - 'Precedes;': '≺', - 'PrecedesEqual;': '⪯', - 'PrecedesSlantEqual;': '≼', - 'PrecedesTilde;': '≾', - 'Prime;': '″', - 'Product;': '∏', - 'Proportion;': '∷', - 'Proportional;': '∝', - 'Pscr;': '𝒫', - 'Psi;': 'Ψ', - QUOT: '"', - 'QUOT;': '"', - 'Qfr;': '𝔔', - 'Qopf;': 'ℚ', - 'Qscr;': '𝒬', - 'RBarr;': '⤐', - REG: '®', - 'REG;': '®', - 'Racute;': 'Ŕ', - 'Rang;': '⟫', - 'Rarr;': '↠', - 'Rarrtl;': '⤖', - 'Rcaron;': 'Ř', - 'Rcedil;': 'Ŗ', - 'Rcy;': 'Р', - 'Re;': 'ℜ', - 'ReverseElement;': '∋', - 'ReverseEquilibrium;': '⇋', - 'ReverseUpEquilibrium;': '⥯', - 'Rfr;': 'ℜ', - 'Rho;': 'Ρ', - 'RightAngleBracket;': '⟩', - 'RightArrow;': '→', - 'RightArrowBar;': '⇥', - 'RightArrowLeftArrow;': '⇄', - 'RightCeiling;': '⌉', - 'RightDoubleBracket;': '⟧', - 'RightDownTeeVector;': '⥝', - 'RightDownVector;': '⇂', - 'RightDownVectorBar;': '⥕', - 'RightFloor;': '⌋', - 'RightTee;': '⊢', - 'RightTeeArrow;': '↦', - 'RightTeeVector;': '⥛', - 'RightTriangle;': '⊳', - 'RightTriangleBar;': '⧐', - 'RightTriangleEqual;': '⊵', - 'RightUpDownVector;': '⥏', - 'RightUpTeeVector;': '⥜', - 'RightUpVector;': '↾', - 'RightUpVectorBar;': '⥔', - 'RightVector;': '⇀', - 'RightVectorBar;': '⥓', - 'Rightarrow;': '⇒', - 'Ropf;': 'ℝ', - 'RoundImplies;': '⥰', - 'Rrightarrow;': '⇛', - 'Rscr;': 'ℛ', - 'Rsh;': '↱', - 'RuleDelayed;': '⧴', - 'SHCHcy;': 'Щ', - 'SHcy;': 'Ш', - 'SOFTcy;': 'Ь', - 'Sacute;': 'Ś', - 'Sc;': '⪼', - 'Scaron;': 'Š', - 'Scedil;': 'Ş', - 'Scirc;': 'Ŝ', - 'Scy;': 'С', - 'Sfr;': '𝔖', - 'ShortDownArrow;': '↓', - 'ShortLeftArrow;': '←', - 'ShortRightArrow;': '→', - 'ShortUpArrow;': '↑', - 'Sigma;': 'Σ', - 'SmallCircle;': '∘', - 'Sopf;': '𝕊', - 'Sqrt;': '√', - 'Square;': '□', - 'SquareIntersection;': '⊓', - 'SquareSubset;': '⊏', - 'SquareSubsetEqual;': '⊑', - 'SquareSuperset;': '⊐', - 'SquareSupersetEqual;': '⊒', - 'SquareUnion;': '⊔', - 'Sscr;': '𝒮', - 'Star;': '⋆', - 'Sub;': '⋐', - 'Subset;': '⋐', - 'SubsetEqual;': '⊆', - 'Succeeds;': '≻', - 'SucceedsEqual;': '⪰', - 'SucceedsSlantEqual;': '≽', - 'SucceedsTilde;': '≿', - 'SuchThat;': '∋', - 'Sum;': '∑', - 'Sup;': '⋑', - 'Superset;': '⊃', - 'SupersetEqual;': '⊇', - 'Supset;': '⋑', - THORN: 'Þ', - 'THORN;': 'Þ', - 'TRADE;': '™', - 'TSHcy;': 'Ћ', - 'TScy;': 'Ц', - 'Tab;': '\t', - 'Tau;': 'Τ', - 'Tcaron;': 'Ť', - 'Tcedil;': 'Ţ', - 'Tcy;': 'Т', - 'Tfr;': '𝔗', - 'Therefore;': '∴', - 'Theta;': 'Θ', - 'ThickSpace;': '  ', - 'ThinSpace;': ' ', - 'Tilde;': '∼', - 'TildeEqual;': '≃', - 'TildeFullEqual;': '≅', - 'TildeTilde;': '≈', - 'Topf;': '𝕋', - 'TripleDot;': '⃛', - 'Tscr;': '𝒯', - 'Tstrok;': 'Ŧ', - Uacute: 'Ú', - 'Uacute;': 'Ú', - 'Uarr;': '↟', - 'Uarrocir;': '⥉', - 'Ubrcy;': 'Ў', - 'Ubreve;': 'Ŭ', - Ucirc: 'Û', - 'Ucirc;': 'Û', - 'Ucy;': 'У', - 'Udblac;': 'Ű', - 'Ufr;': '𝔘', - Ugrave: 'Ù', - 'Ugrave;': 'Ù', - 'Umacr;': 'Ū', - 'UnderBar;': '_', - 'UnderBrace;': '⏟', - 'UnderBracket;': '⎵', - 'UnderParenthesis;': '⏝', - 'Union;': '⋃', - 'UnionPlus;': '⊎', - 'Uogon;': 'Ų', - 'Uopf;': '𝕌', - 'UpArrow;': '↑', - 'UpArrowBar;': '⤒', - 'UpArrowDownArrow;': '⇅', - 'UpDownArrow;': '↕', - 'UpEquilibrium;': '⥮', - 'UpTee;': '⊥', - 'UpTeeArrow;': '↥', - 'Uparrow;': '⇑', - 'Updownarrow;': '⇕', - 'UpperLeftArrow;': '↖', - 'UpperRightArrow;': '↗', - 'Upsi;': 'ϒ', - 'Upsilon;': 'Υ', - 'Uring;': 'Ů', - 'Uscr;': '𝒰', - 'Utilde;': 'Ũ', - Uuml: 'Ü', - 'Uuml;': 'Ü', - 'VDash;': '⊫', - 'Vbar;': '⫫', - 'Vcy;': 'В', - 'Vdash;': '⊩', - 'Vdashl;': '⫦', - 'Vee;': '⋁', - 'Verbar;': '‖', - 'Vert;': '‖', - 'VerticalBar;': '∣', - 'VerticalLine;': '|', - 'VerticalSeparator;': '❘', - 'VerticalTilde;': '≀', - 'VeryThinSpace;': ' ', - 'Vfr;': '𝔙', - 'Vopf;': '𝕍', - 'Vscr;': '𝒱', - 'Vvdash;': '⊪', - 'Wcirc;': 'Ŵ', - 'Wedge;': '⋀', - 'Wfr;': '𝔚', - 'Wopf;': '𝕎', - 'Wscr;': '𝒲', - 'Xfr;': '𝔛', - 'Xi;': 'Ξ', - 'Xopf;': '𝕏', - 'Xscr;': '𝒳', - 'YAcy;': 'Я', - 'YIcy;': 'Ї', - 'YUcy;': 'Ю', - Yacute: 'Ý', - 'Yacute;': 'Ý', - 'Ycirc;': 'Ŷ', - 'Ycy;': 'Ы', - 'Yfr;': '𝔜', - 'Yopf;': '𝕐', - 'Yscr;': '𝒴', - 'Yuml;': 'Ÿ', - 'ZHcy;': 'Ж', - 'Zacute;': 'Ź', - 'Zcaron;': 'Ž', - 'Zcy;': 'З', - 'Zdot;': 'Ż', - 'ZeroWidthSpace;': '​', - 'Zeta;': 'Ζ', - 'Zfr;': 'ℨ', - 'Zopf;': 'ℤ', - 'Zscr;': '𝒵', - aacute: 'á', - 'aacute;': 'á', - 'abreve;': 'ă', - 'ac;': '∾', - 'acE;': '∾̳', - 'acd;': '∿', - acirc: 'â', - 'acirc;': 'â', - acute: '´', - 'acute;': '´', - 'acy;': 'а', - aelig: 'æ', - 'aelig;': 'æ', - 'af;': '⁡', - 'afr;': '𝔞', - agrave: 'à', - 'agrave;': 'à', - 'alefsym;': 'ℵ', - 'aleph;': 'ℵ', - 'alpha;': 'α', - 'amacr;': 'ā', - 'amalg;': '⨿', - amp: '&', - 'amp;': '&', - 'and;': '∧', - 'andand;': '⩕', - 'andd;': '⩜', - 'andslope;': '⩘', - 'andv;': '⩚', - 'ang;': '∠', - 'ange;': '⦤', - 'angle;': '∠', - 'angmsd;': '∡', - 'angmsdaa;': '⦨', - 'angmsdab;': '⦩', - 'angmsdac;': '⦪', - 'angmsdad;': '⦫', - 'angmsdae;': '⦬', - 'angmsdaf;': '⦭', - 'angmsdag;': '⦮', - 'angmsdah;': '⦯', - 'angrt;': '∟', - 'angrtvb;': '⊾', - 'angrtvbd;': '⦝', - 'angsph;': '∢', - 'angst;': 'Å', - 'angzarr;': '⍼', - 'aogon;': 'ą', - 'aopf;': '𝕒', - 'ap;': '≈', - 'apE;': '⩰', - 'apacir;': '⩯', - 'ape;': '≊', - 'apid;': '≋', - 'apos;': "'", - 'approx;': '≈', - 'approxeq;': '≊', - aring: 'å', - 'aring;': 'å', - 'ascr;': '𝒶', - 'ast;': '*', - 'asymp;': '≈', - 'asympeq;': '≍', - atilde: 'ã', - 'atilde;': 'ã', - auml: 'ä', - 'auml;': 'ä', - 'awconint;': '∳', - 'awint;': '⨑', - 'bNot;': '⫭', - 'backcong;': '≌', - 'backepsilon;': '϶', - 'backprime;': '‵', - 'backsim;': '∽', - 'backsimeq;': '⋍', - 'barvee;': '⊽', - 'barwed;': '⌅', - 'barwedge;': '⌅', - 'bbrk;': '⎵', - 'bbrktbrk;': '⎶', - 'bcong;': '≌', - 'bcy;': 'б', - 'bdquo;': '„', - 'becaus;': '∵', - 'because;': '∵', - 'bemptyv;': '⦰', - 'bepsi;': '϶', - 'bernou;': 'ℬ', - 'beta;': 'β', - 'beth;': 'ℶ', - 'between;': '≬', - 'bfr;': '𝔟', - 'bigcap;': '⋂', - 'bigcirc;': '◯', - 'bigcup;': '⋃', - 'bigodot;': '⨀', - 'bigoplus;': '⨁', - 'bigotimes;': '⨂', - 'bigsqcup;': '⨆', - 'bigstar;': '★', - 'bigtriangledown;': '▽', - 'bigtriangleup;': '△', - 'biguplus;': '⨄', - 'bigvee;': '⋁', - 'bigwedge;': '⋀', - 'bkarow;': '⤍', - 'blacklozenge;': '⧫', - 'blacksquare;': '▪', - 'blacktriangle;': '▴', - 'blacktriangledown;': '▾', - 'blacktriangleleft;': '◂', - 'blacktriangleright;': '▸', - 'blank;': '␣', - 'blk12;': '▒', - 'blk14;': '░', - 'blk34;': '▓', - 'block;': '█', - 'bne;': '=⃥', - 'bnequiv;': '≡⃥', - 'bnot;': '⌐', - 'bopf;': '𝕓', - 'bot;': '⊥', - 'bottom;': '⊥', - 'bowtie;': '⋈', - 'boxDL;': '╗', - 'boxDR;': '╔', - 'boxDl;': '╖', - 'boxDr;': '╓', - 'boxH;': '═', - 'boxHD;': '╦', - 'boxHU;': '╩', - 'boxHd;': '╤', - 'boxHu;': '╧', - 'boxUL;': '╝', - 'boxUR;': '╚', - 'boxUl;': '╜', - 'boxUr;': '╙', - 'boxV;': '║', - 'boxVH;': '╬', - 'boxVL;': '╣', - 'boxVR;': '╠', - 'boxVh;': '╫', - 'boxVl;': '╢', - 'boxVr;': '╟', - 'boxbox;': '⧉', - 'boxdL;': '╕', - 'boxdR;': '╒', - 'boxdl;': '┐', - 'boxdr;': '┌', - 'boxh;': '─', - 'boxhD;': '╥', - 'boxhU;': '╨', - 'boxhd;': '┬', - 'boxhu;': '┴', - 'boxminus;': '⊟', - 'boxplus;': '⊞', - 'boxtimes;': '⊠', - 'boxuL;': '╛', - 'boxuR;': '╘', - 'boxul;': '┘', - 'boxur;': '└', - 'boxv;': '│', - 'boxvH;': '╪', - 'boxvL;': '╡', - 'boxvR;': '╞', - 'boxvh;': '┼', - 'boxvl;': '┤', - 'boxvr;': '├', - 'bprime;': '‵', - 'breve;': '˘', - brvbar: '¦', - 'brvbar;': '¦', - 'bscr;': '𝒷', - 'bsemi;': '⁏', - 'bsim;': '∽', - 'bsime;': '⋍', - 'bsol;': '\\', - 'bsolb;': '⧅', - 'bsolhsub;': '⟈', - 'bull;': '•', - 'bullet;': '•', - 'bump;': '≎', - 'bumpE;': '⪮', - 'bumpe;': '≏', - 'bumpeq;': '≏', - 'cacute;': 'ć', - 'cap;': '∩', - 'capand;': '⩄', - 'capbrcup;': '⩉', - 'capcap;': '⩋', - 'capcup;': '⩇', - 'capdot;': '⩀', - 'caps;': '∩︀', - 'caret;': '⁁', - 'caron;': 'ˇ', - 'ccaps;': '⩍', - 'ccaron;': 'č', - ccedil: 'ç', - 'ccedil;': 'ç', - 'ccirc;': 'ĉ', - 'ccups;': '⩌', - 'ccupssm;': '⩐', - 'cdot;': 'ċ', - cedil: '¸', - 'cedil;': '¸', - 'cemptyv;': '⦲', - cent: '¢', - 'cent;': '¢', - 'centerdot;': '·', - 'cfr;': '𝔠', - 'chcy;': 'ч', - 'check;': '✓', - 'checkmark;': '✓', - 'chi;': 'χ', - 'cir;': '○', - 'cirE;': '⧃', - 'circ;': 'ˆ', - 'circeq;': '≗', - 'circlearrowleft;': '↺', - 'circlearrowright;': '↻', - 'circledR;': '®', - 'circledS;': 'Ⓢ', - 'circledast;': '⊛', - 'circledcirc;': '⊚', - 'circleddash;': '⊝', - 'cire;': '≗', - 'cirfnint;': '⨐', - 'cirmid;': '⫯', - 'cirscir;': '⧂', - 'clubs;': '♣', - 'clubsuit;': '♣', - 'colon;': ':', - 'colone;': '≔', - 'coloneq;': '≔', - 'comma;': ',', - 'commat;': '@', - 'comp;': '∁', - 'compfn;': '∘', - 'complement;': '∁', - 'complexes;': 'ℂ', - 'cong;': '≅', - 'congdot;': '⩭', - 'conint;': '∮', - 'copf;': '𝕔', - 'coprod;': '∐', - copy: '©', - 'copy;': '©', - 'copysr;': '℗', - 'crarr;': '↵', - 'cross;': '✗', - 'cscr;': '𝒸', - 'csub;': '⫏', - 'csube;': '⫑', - 'csup;': '⫐', - 'csupe;': '⫒', - 'ctdot;': '⋯', - 'cudarrl;': '⤸', - 'cudarrr;': '⤵', - 'cuepr;': '⋞', - 'cuesc;': '⋟', - 'cularr;': '↶', - 'cularrp;': '⤽', - 'cup;': '∪', - 'cupbrcap;': '⩈', - 'cupcap;': '⩆', - 'cupcup;': '⩊', - 'cupdot;': '⊍', - 'cupor;': '⩅', - 'cups;': '∪︀', - 'curarr;': '↷', - 'curarrm;': '⤼', - 'curlyeqprec;': '⋞', - 'curlyeqsucc;': '⋟', - 'curlyvee;': '⋎', - 'curlywedge;': '⋏', - curren: '¤', - 'curren;': '¤', - 'curvearrowleft;': '↶', - 'curvearrowright;': '↷', - 'cuvee;': '⋎', - 'cuwed;': '⋏', - 'cwconint;': '∲', - 'cwint;': '∱', - 'cylcty;': '⌭', - 'dArr;': '⇓', - 'dHar;': '⥥', - 'dagger;': '†', - 'daleth;': 'ℸ', - 'darr;': '↓', - 'dash;': '‐', - 'dashv;': '⊣', - 'dbkarow;': '⤏', - 'dblac;': '˝', - 'dcaron;': 'ď', - 'dcy;': 'д', - 'dd;': 'ⅆ', - 'ddagger;': '‡', - 'ddarr;': '⇊', - 'ddotseq;': '⩷', - deg: '°', - 'deg;': '°', - 'delta;': 'δ', - 'demptyv;': '⦱', - 'dfisht;': '⥿', - 'dfr;': '𝔡', - 'dharl;': '⇃', - 'dharr;': '⇂', - 'diam;': '⋄', - 'diamond;': '⋄', - 'diamondsuit;': '♦', - 'diams;': '♦', - 'die;': '¨', - 'digamma;': 'ϝ', - 'disin;': '⋲', - 'div;': '÷', - divide: '÷', - 'divide;': '÷', - 'divideontimes;': '⋇', - 'divonx;': '⋇', - 'djcy;': 'ђ', - 'dlcorn;': '⌞', - 'dlcrop;': '⌍', - 'dollar;': '$', - 'dopf;': '𝕕', - 'dot;': '˙', - 'doteq;': '≐', - 'doteqdot;': '≑', - 'dotminus;': '∸', - 'dotplus;': '∔', - 'dotsquare;': '⊡', - 'doublebarwedge;': '⌆', - 'downarrow;': '↓', - 'downdownarrows;': '⇊', - 'downharpoonleft;': '⇃', - 'downharpoonright;': '⇂', - 'drbkarow;': '⤐', - 'drcorn;': '⌟', - 'drcrop;': '⌌', - 'dscr;': '𝒹', - 'dscy;': 'ѕ', - 'dsol;': '⧶', - 'dstrok;': 'đ', - 'dtdot;': '⋱', - 'dtri;': '▿', - 'dtrif;': '▾', - 'duarr;': '⇵', - 'duhar;': '⥯', - 'dwangle;': '⦦', - 'dzcy;': 'џ', - 'dzigrarr;': '⟿', - 'eDDot;': '⩷', - 'eDot;': '≑', - eacute: 'é', - 'eacute;': 'é', - 'easter;': '⩮', - 'ecaron;': 'ě', - 'ecir;': '≖', - ecirc: 'ê', - 'ecirc;': 'ê', - 'ecolon;': '≕', - 'ecy;': 'э', - 'edot;': 'ė', - 'ee;': 'ⅇ', - 'efDot;': '≒', - 'efr;': '𝔢', - 'eg;': '⪚', - egrave: 'è', - 'egrave;': 'è', - 'egs;': '⪖', - 'egsdot;': '⪘', - 'el;': '⪙', - 'elinters;': '⏧', - 'ell;': 'ℓ', - 'els;': '⪕', - 'elsdot;': '⪗', - 'emacr;': 'ē', - 'empty;': '∅', - 'emptyset;': '∅', - 'emptyv;': '∅', - 'emsp13;': ' ', - 'emsp14;': ' ', - 'emsp;': ' ', - 'eng;': 'ŋ', - 'ensp;': ' ', - 'eogon;': 'ę', - 'eopf;': '𝕖', - 'epar;': '⋕', - 'eparsl;': '⧣', - 'eplus;': '⩱', - 'epsi;': 'ε', - 'epsilon;': 'ε', - 'epsiv;': 'ϵ', - 'eqcirc;': '≖', - 'eqcolon;': '≕', - 'eqsim;': '≂', - 'eqslantgtr;': '⪖', - 'eqslantless;': '⪕', - 'equals;': '=', - 'equest;': '≟', - 'equiv;': '≡', - 'equivDD;': '⩸', - 'eqvparsl;': '⧥', - 'erDot;': '≓', - 'erarr;': '⥱', - 'escr;': 'ℯ', - 'esdot;': '≐', - 'esim;': '≂', - 'eta;': 'η', - eth: 'ð', - 'eth;': 'ð', - euml: 'ë', - 'euml;': 'ë', - 'euro;': '€', - 'excl;': '!', - 'exist;': '∃', - 'expectation;': 'ℰ', - 'exponentiale;': 'ⅇ', - 'fallingdotseq;': '≒', - 'fcy;': 'ф', - 'female;': '♀', - 'ffilig;': 'ffi', - 'fflig;': 'ff', - 'ffllig;': 'ffl', - 'ffr;': '𝔣', - 'filig;': 'fi', - 'fjlig;': 'fj', - 'flat;': '♭', - 'fllig;': 'fl', - 'fltns;': '▱', - 'fnof;': 'ƒ', - 'fopf;': '𝕗', - 'forall;': '∀', - 'fork;': '⋔', - 'forkv;': '⫙', - 'fpartint;': '⨍', - frac12: '½', - 'frac12;': '½', - 'frac13;': '⅓', - frac14: '¼', - 'frac14;': '¼', - 'frac15;': '⅕', - 'frac16;': '⅙', - 'frac18;': '⅛', - 'frac23;': '⅔', - 'frac25;': '⅖', - frac34: '¾', - 'frac34;': '¾', - 'frac35;': '⅗', - 'frac38;': '⅜', - 'frac45;': '⅘', - 'frac56;': '⅚', - 'frac58;': '⅝', - 'frac78;': '⅞', - 'frasl;': '⁄', - 'frown;': '⌢', - 'fscr;': '𝒻', - 'gE;': '≧', - 'gEl;': '⪌', - 'gacute;': 'ǵ', - 'gamma;': 'γ', - 'gammad;': 'ϝ', - 'gap;': '⪆', - 'gbreve;': 'ğ', - 'gcirc;': 'ĝ', - 'gcy;': 'г', - 'gdot;': 'ġ', - 'ge;': '≥', - 'gel;': '⋛', - 'geq;': '≥', - 'geqq;': '≧', - 'geqslant;': '⩾', - 'ges;': '⩾', - 'gescc;': '⪩', - 'gesdot;': '⪀', - 'gesdoto;': '⪂', - 'gesdotol;': '⪄', - 'gesl;': '⋛︀', - 'gesles;': '⪔', - 'gfr;': '𝔤', - 'gg;': '≫', - 'ggg;': '⋙', - 'gimel;': 'ℷ', - 'gjcy;': 'ѓ', - 'gl;': '≷', - 'glE;': '⪒', - 'gla;': '⪥', - 'glj;': '⪤', - 'gnE;': '≩', - 'gnap;': '⪊', - 'gnapprox;': '⪊', - 'gne;': '⪈', - 'gneq;': '⪈', - 'gneqq;': '≩', - 'gnsim;': '⋧', - 'gopf;': '𝕘', - 'grave;': '`', - 'gscr;': 'ℊ', - 'gsim;': '≳', - 'gsime;': '⪎', - 'gsiml;': '⪐', - gt: '>', - 'gt;': '>', - 'gtcc;': '⪧', - 'gtcir;': '⩺', - 'gtdot;': '⋗', - 'gtlPar;': '⦕', - 'gtquest;': '⩼', - 'gtrapprox;': '⪆', - 'gtrarr;': '⥸', - 'gtrdot;': '⋗', - 'gtreqless;': '⋛', - 'gtreqqless;': '⪌', - 'gtrless;': '≷', - 'gtrsim;': '≳', - 'gvertneqq;': '≩︀', - 'gvnE;': '≩︀', - 'hArr;': '⇔', - 'hairsp;': ' ', - 'half;': '½', - 'hamilt;': 'ℋ', - 'hardcy;': 'ъ', - 'harr;': '↔', - 'harrcir;': '⥈', - 'harrw;': '↭', - 'hbar;': 'ℏ', - 'hcirc;': 'ĥ', - 'hearts;': '♥', - 'heartsuit;': '♥', - 'hellip;': '…', - 'hercon;': '⊹', - 'hfr;': '𝔥', - 'hksearow;': '⤥', - 'hkswarow;': '⤦', - 'hoarr;': '⇿', - 'homtht;': '∻', - 'hookleftarrow;': '↩', - 'hookrightarrow;': '↪', - 'hopf;': '𝕙', - 'horbar;': '―', - 'hscr;': '𝒽', - 'hslash;': 'ℏ', - 'hstrok;': 'ħ', - 'hybull;': '⁃', - 'hyphen;': '‐', - iacute: 'í', - 'iacute;': 'í', - 'ic;': '⁣', - icirc: 'î', - 'icirc;': 'î', - 'icy;': 'и', - 'iecy;': 'е', - iexcl: '¡', - 'iexcl;': '¡', - 'iff;': '⇔', - 'ifr;': '𝔦', - igrave: 'ì', - 'igrave;': 'ì', - 'ii;': 'ⅈ', - 'iiiint;': '⨌', - 'iiint;': '∭', - 'iinfin;': '⧜', - 'iiota;': '℩', - 'ijlig;': 'ij', - 'imacr;': 'ī', - 'image;': 'ℑ', - 'imagline;': 'ℐ', - 'imagpart;': 'ℑ', - 'imath;': 'ı', - 'imof;': '⊷', - 'imped;': 'Ƶ', - 'in;': '∈', - 'incare;': '℅', - 'infin;': '∞', - 'infintie;': '⧝', - 'inodot;': 'ı', - 'int;': '∫', - 'intcal;': '⊺', - 'integers;': 'ℤ', - 'intercal;': '⊺', - 'intlarhk;': '⨗', - 'intprod;': '⨼', - 'iocy;': 'ё', - 'iogon;': 'į', - 'iopf;': '𝕚', - 'iota;': 'ι', - 'iprod;': '⨼', - iquest: '¿', - 'iquest;': '¿', - 'iscr;': '𝒾', - 'isin;': '∈', - 'isinE;': '⋹', - 'isindot;': '⋵', - 'isins;': '⋴', - 'isinsv;': '⋳', - 'isinv;': '∈', - 'it;': '⁢', - 'itilde;': 'ĩ', - 'iukcy;': 'і', - iuml: 'ï', - 'iuml;': 'ï', - 'jcirc;': 'ĵ', - 'jcy;': 'й', - 'jfr;': '𝔧', - 'jmath;': 'ȷ', - 'jopf;': '𝕛', - 'jscr;': '𝒿', - 'jsercy;': 'ј', - 'jukcy;': 'є', - 'kappa;': 'κ', - 'kappav;': 'ϰ', - 'kcedil;': 'ķ', - 'kcy;': 'к', - 'kfr;': '𝔨', - 'kgreen;': 'ĸ', - 'khcy;': 'х', - 'kjcy;': 'ќ', - 'kopf;': '𝕜', - 'kscr;': '𝓀', - 'lAarr;': '⇚', - 'lArr;': '⇐', - 'lAtail;': '⤛', - 'lBarr;': '⤎', - 'lE;': '≦', - 'lEg;': '⪋', - 'lHar;': '⥢', - 'lacute;': 'ĺ', - 'laemptyv;': '⦴', - 'lagran;': 'ℒ', - 'lambda;': 'λ', - 'lang;': '⟨', - 'langd;': '⦑', - 'langle;': '⟨', - 'lap;': '⪅', - laquo: '«', - 'laquo;': '«', - 'larr;': '←', - 'larrb;': '⇤', - 'larrbfs;': '⤟', - 'larrfs;': '⤝', - 'larrhk;': '↩', - 'larrlp;': '↫', - 'larrpl;': '⤹', - 'larrsim;': '⥳', - 'larrtl;': '↢', - 'lat;': '⪫', - 'latail;': '⤙', - 'late;': '⪭', - 'lates;': '⪭︀', - 'lbarr;': '⤌', - 'lbbrk;': '❲', - 'lbrace;': '{', - 'lbrack;': '[', - 'lbrke;': '⦋', - 'lbrksld;': '⦏', - 'lbrkslu;': '⦍', - 'lcaron;': 'ľ', - 'lcedil;': 'ļ', - 'lceil;': '⌈', - 'lcub;': '{', - 'lcy;': 'л', - 'ldca;': '⤶', - 'ldquo;': '“', - 'ldquor;': '„', - 'ldrdhar;': '⥧', - 'ldrushar;': '⥋', - 'ldsh;': '↲', - 'le;': '≤', - 'leftarrow;': '←', - 'leftarrowtail;': '↢', - 'leftharpoondown;': '↽', - 'leftharpoonup;': '↼', - 'leftleftarrows;': '⇇', - 'leftrightarrow;': '↔', - 'leftrightarrows;': '⇆', - 'leftrightharpoons;': '⇋', - 'leftrightsquigarrow;': '↭', - 'leftthreetimes;': '⋋', - 'leg;': '⋚', - 'leq;': '≤', - 'leqq;': '≦', - 'leqslant;': '⩽', - 'les;': '⩽', - 'lescc;': '⪨', - 'lesdot;': '⩿', - 'lesdoto;': '⪁', - 'lesdotor;': '⪃', - 'lesg;': '⋚︀', - 'lesges;': '⪓', - 'lessapprox;': '⪅', - 'lessdot;': '⋖', - 'lesseqgtr;': '⋚', - 'lesseqqgtr;': '⪋', - 'lessgtr;': '≶', - 'lesssim;': '≲', - 'lfisht;': '⥼', - 'lfloor;': '⌊', - 'lfr;': '𝔩', - 'lg;': '≶', - 'lgE;': '⪑', - 'lhard;': '↽', - 'lharu;': '↼', - 'lharul;': '⥪', - 'lhblk;': '▄', - 'ljcy;': 'љ', - 'll;': '≪', - 'llarr;': '⇇', - 'llcorner;': '⌞', - 'llhard;': '⥫', - 'lltri;': '◺', - 'lmidot;': 'ŀ', - 'lmoust;': '⎰', - 'lmoustache;': '⎰', - 'lnE;': '≨', - 'lnap;': '⪉', - 'lnapprox;': '⪉', - 'lne;': '⪇', - 'lneq;': '⪇', - 'lneqq;': '≨', - 'lnsim;': '⋦', - 'loang;': '⟬', - 'loarr;': '⇽', - 'lobrk;': '⟦', - 'longleftarrow;': '⟵', - 'longleftrightarrow;': '⟷', - 'longmapsto;': '⟼', - 'longrightarrow;': '⟶', - 'looparrowleft;': '↫', - 'looparrowright;': '↬', - 'lopar;': '⦅', - 'lopf;': '𝕝', - 'loplus;': '⨭', - 'lotimes;': '⨴', - 'lowast;': '∗', - 'lowbar;': '_', - 'loz;': '◊', - 'lozenge;': '◊', - 'lozf;': '⧫', - 'lpar;': '(', - 'lparlt;': '⦓', - 'lrarr;': '⇆', - 'lrcorner;': '⌟', - 'lrhar;': '⇋', - 'lrhard;': '⥭', - 'lrm;': '‎', - 'lrtri;': '⊿', - 'lsaquo;': '‹', - 'lscr;': '𝓁', - 'lsh;': '↰', - 'lsim;': '≲', - 'lsime;': '⪍', - 'lsimg;': '⪏', - 'lsqb;': '[', - 'lsquo;': '‘', - 'lsquor;': '‚', - 'lstrok;': 'ł', - lt: '<', - 'lt;': '<', - 'ltcc;': '⪦', - 'ltcir;': '⩹', - 'ltdot;': '⋖', - 'lthree;': '⋋', - 'ltimes;': '⋉', - 'ltlarr;': '⥶', - 'ltquest;': '⩻', - 'ltrPar;': '⦖', - 'ltri;': '◃', - 'ltrie;': '⊴', - 'ltrif;': '◂', - 'lurdshar;': '⥊', - 'luruhar;': '⥦', - 'lvertneqq;': '≨︀', - 'lvnE;': '≨︀', - 'mDDot;': '∺', - macr: '¯', - 'macr;': '¯', - 'male;': '♂', - 'malt;': '✠', - 'maltese;': '✠', - 'map;': '↦', - 'mapsto;': '↦', - 'mapstodown;': '↧', - 'mapstoleft;': '↤', - 'mapstoup;': '↥', - 'marker;': '▮', - 'mcomma;': '⨩', - 'mcy;': 'м', - 'mdash;': '—', - 'measuredangle;': '∡', - 'mfr;': '𝔪', - 'mho;': '℧', - micro: 'µ', - 'micro;': 'µ', - 'mid;': '∣', - 'midast;': '*', - 'midcir;': '⫰', - middot: '·', - 'middot;': '·', - 'minus;': '−', - 'minusb;': '⊟', - 'minusd;': '∸', - 'minusdu;': '⨪', - 'mlcp;': '⫛', - 'mldr;': '…', - 'mnplus;': '∓', - 'models;': '⊧', - 'mopf;': '𝕞', - 'mp;': '∓', - 'mscr;': '𝓂', - 'mstpos;': '∾', - 'mu;': 'μ', - 'multimap;': '⊸', - 'mumap;': '⊸', - 'nGg;': '⋙̸', - 'nGt;': '≫⃒', - 'nGtv;': '≫̸', - 'nLeftarrow;': '⇍', - 'nLeftrightarrow;': '⇎', - 'nLl;': '⋘̸', - 'nLt;': '≪⃒', - 'nLtv;': '≪̸', - 'nRightarrow;': '⇏', - 'nVDash;': '⊯', - 'nVdash;': '⊮', - 'nabla;': '∇', - 'nacute;': 'ń', - 'nang;': '∠⃒', - 'nap;': '≉', - 'napE;': '⩰̸', - 'napid;': '≋̸', - 'napos;': 'ʼn', - 'napprox;': '≉', - 'natur;': '♮', - 'natural;': '♮', - 'naturals;': 'ℕ', - nbsp: ' ', - 'nbsp;': ' ', - 'nbump;': '≎̸', - 'nbumpe;': '≏̸', - 'ncap;': '⩃', - 'ncaron;': 'ň', - 'ncedil;': 'ņ', - 'ncong;': '≇', - 'ncongdot;': '⩭̸', - 'ncup;': '⩂', - 'ncy;': 'н', - 'ndash;': '–', - 'ne;': '≠', - 'neArr;': '⇗', - 'nearhk;': '⤤', - 'nearr;': '↗', - 'nearrow;': '↗', - 'nedot;': '≐̸', - 'nequiv;': '≢', - 'nesear;': '⤨', - 'nesim;': '≂̸', - 'nexist;': '∄', - 'nexists;': '∄', - 'nfr;': '𝔫', - 'ngE;': '≧̸', - 'nge;': '≱', - 'ngeq;': '≱', - 'ngeqq;': '≧̸', - 'ngeqslant;': '⩾̸', - 'nges;': '⩾̸', - 'ngsim;': '≵', - 'ngt;': '≯', - 'ngtr;': '≯', - 'nhArr;': '⇎', - 'nharr;': '↮', - 'nhpar;': '⫲', - 'ni;': '∋', - 'nis;': '⋼', - 'nisd;': '⋺', - 'niv;': '∋', - 'njcy;': 'њ', - 'nlArr;': '⇍', - 'nlE;': '≦̸', - 'nlarr;': '↚', - 'nldr;': '‥', - 'nle;': '≰', - 'nleftarrow;': '↚', - 'nleftrightarrow;': '↮', - 'nleq;': '≰', - 'nleqq;': '≦̸', - 'nleqslant;': '⩽̸', - 'nles;': '⩽̸', - 'nless;': '≮', - 'nlsim;': '≴', - 'nlt;': '≮', - 'nltri;': '⋪', - 'nltrie;': '⋬', - 'nmid;': '∤', - 'nopf;': '𝕟', - not: '¬', - 'not;': '¬', - 'notin;': '∉', - 'notinE;': '⋹̸', - 'notindot;': '⋵̸', - 'notinva;': '∉', - 'notinvb;': '⋷', - 'notinvc;': '⋶', - 'notni;': '∌', - 'notniva;': '∌', - 'notnivb;': '⋾', - 'notnivc;': '⋽', - 'npar;': '∦', - 'nparallel;': '∦', - 'nparsl;': '⫽⃥', - 'npart;': '∂̸', - 'npolint;': '⨔', - 'npr;': '⊀', - 'nprcue;': '⋠', - 'npre;': '⪯̸', - 'nprec;': '⊀', - 'npreceq;': '⪯̸', - 'nrArr;': '⇏', - 'nrarr;': '↛', - 'nrarrc;': '⤳̸', - 'nrarrw;': '↝̸', - 'nrightarrow;': '↛', - 'nrtri;': '⋫', - 'nrtrie;': '⋭', - 'nsc;': '⊁', - 'nsccue;': '⋡', - 'nsce;': '⪰̸', - 'nscr;': '𝓃', - 'nshortmid;': '∤', - 'nshortparallel;': '∦', - 'nsim;': '≁', - 'nsime;': '≄', - 'nsimeq;': '≄', - 'nsmid;': '∤', - 'nspar;': '∦', - 'nsqsube;': '⋢', - 'nsqsupe;': '⋣', - 'nsub;': '⊄', - 'nsubE;': '⫅̸', - 'nsube;': '⊈', - 'nsubset;': '⊂⃒', - 'nsubseteq;': '⊈', - 'nsubseteqq;': '⫅̸', - 'nsucc;': '⊁', - 'nsucceq;': '⪰̸', - 'nsup;': '⊅', - 'nsupE;': '⫆̸', - 'nsupe;': '⊉', - 'nsupset;': '⊃⃒', - 'nsupseteq;': '⊉', - 'nsupseteqq;': '⫆̸', - 'ntgl;': '≹', - ntilde: 'ñ', - 'ntilde;': 'ñ', - 'ntlg;': '≸', - 'ntriangleleft;': '⋪', - 'ntrianglelefteq;': '⋬', - 'ntriangleright;': '⋫', - 'ntrianglerighteq;': '⋭', - 'nu;': 'ν', - 'num;': '#', - 'numero;': '№', - 'numsp;': ' ', - 'nvDash;': '⊭', - 'nvHarr;': '⤄', - 'nvap;': '≍⃒', - 'nvdash;': '⊬', - 'nvge;': '≥⃒', - 'nvgt;': '>⃒', - 'nvinfin;': '⧞', - 'nvlArr;': '⤂', - 'nvle;': '≤⃒', - 'nvlt;': '<⃒', - 'nvltrie;': '⊴⃒', - 'nvrArr;': '⤃', - 'nvrtrie;': '⊵⃒', - 'nvsim;': '∼⃒', - 'nwArr;': '⇖', - 'nwarhk;': '⤣', - 'nwarr;': '↖', - 'nwarrow;': '↖', - 'nwnear;': '⤧', - 'oS;': 'Ⓢ', - oacute: 'ó', - 'oacute;': 'ó', - 'oast;': '⊛', - 'ocir;': '⊚', - ocirc: 'ô', - 'ocirc;': 'ô', - 'ocy;': 'о', - 'odash;': '⊝', - 'odblac;': 'ő', - 'odiv;': '⨸', - 'odot;': '⊙', - 'odsold;': '⦼', - 'oelig;': 'œ', - 'ofcir;': '⦿', - 'ofr;': '𝔬', - 'ogon;': '˛', - ograve: 'ò', - 'ograve;': 'ò', - 'ogt;': '⧁', - 'ohbar;': '⦵', - 'ohm;': 'Ω', - 'oint;': '∮', - 'olarr;': '↺', - 'olcir;': '⦾', - 'olcross;': '⦻', - 'oline;': '‾', - 'olt;': '⧀', - 'omacr;': 'ō', - 'omega;': 'ω', - 'omicron;': 'ο', - 'omid;': '⦶', - 'ominus;': '⊖', - 'oopf;': '𝕠', - 'opar;': '⦷', - 'operp;': '⦹', - 'oplus;': '⊕', - 'or;': '∨', - 'orarr;': '↻', - 'ord;': '⩝', - 'order;': 'ℴ', - 'orderof;': 'ℴ', - ordf: 'ª', - 'ordf;': 'ª', - ordm: 'º', - 'ordm;': 'º', - 'origof;': '⊶', - 'oror;': '⩖', - 'orslope;': '⩗', - 'orv;': '⩛', - 'oscr;': 'ℴ', - oslash: 'ø', - 'oslash;': 'ø', - 'osol;': '⊘', - otilde: 'õ', - 'otilde;': 'õ', - 'otimes;': '⊗', - 'otimesas;': '⨶', - ouml: 'ö', - 'ouml;': 'ö', - 'ovbar;': '⌽', - 'par;': '∥', - para: '¶', - 'para;': '¶', - 'parallel;': '∥', - 'parsim;': '⫳', - 'parsl;': '⫽', - 'part;': '∂', - 'pcy;': 'п', - 'percnt;': '%', - 'period;': '.', - 'permil;': '‰', - 'perp;': '⊥', - 'pertenk;': '‱', - 'pfr;': '𝔭', - 'phi;': 'φ', - 'phiv;': 'ϕ', - 'phmmat;': 'ℳ', - 'phone;': '☎', - 'pi;': 'π', - 'pitchfork;': '⋔', - 'piv;': 'ϖ', - 'planck;': 'ℏ', - 'planckh;': 'ℎ', - 'plankv;': 'ℏ', - 'plus;': '+', - 'plusacir;': '⨣', - 'plusb;': '⊞', - 'pluscir;': '⨢', - 'plusdo;': '∔', - 'plusdu;': '⨥', - 'pluse;': '⩲', - plusmn: '±', - 'plusmn;': '±', - 'plussim;': '⨦', - 'plustwo;': '⨧', - 'pm;': '±', - 'pointint;': '⨕', - 'popf;': '𝕡', - pound: '£', - 'pound;': '£', - 'pr;': '≺', - 'prE;': '⪳', - 'prap;': '⪷', - 'prcue;': '≼', - 'pre;': '⪯', - 'prec;': '≺', - 'precapprox;': '⪷', - 'preccurlyeq;': '≼', - 'preceq;': '⪯', - 'precnapprox;': '⪹', - 'precneqq;': '⪵', - 'precnsim;': '⋨', - 'precsim;': '≾', - 'prime;': '′', - 'primes;': 'ℙ', - 'prnE;': '⪵', - 'prnap;': '⪹', - 'prnsim;': '⋨', - 'prod;': '∏', - 'profalar;': '⌮', - 'profline;': '⌒', - 'profsurf;': '⌓', - 'prop;': '∝', - 'propto;': '∝', - 'prsim;': '≾', - 'prurel;': '⊰', - 'pscr;': '𝓅', - 'psi;': 'ψ', - 'puncsp;': ' ', - 'qfr;': '𝔮', - 'qint;': '⨌', - 'qopf;': '𝕢', - 'qprime;': '⁗', - 'qscr;': '𝓆', - 'quaternions;': 'ℍ', - 'quatint;': '⨖', - 'quest;': '?', - 'questeq;': '≟', - quot: '"', - 'quot;': '"', - 'rAarr;': '⇛', - 'rArr;': '⇒', - 'rAtail;': '⤜', - 'rBarr;': '⤏', - 'rHar;': '⥤', - 'race;': '∽̱', - 'racute;': 'ŕ', - 'radic;': '√', - 'raemptyv;': '⦳', - 'rang;': '⟩', - 'rangd;': '⦒', - 'range;': '⦥', - 'rangle;': '⟩', - raquo: '»', - 'raquo;': '»', - 'rarr;': '→', - 'rarrap;': '⥵', - 'rarrb;': '⇥', - 'rarrbfs;': '⤠', - 'rarrc;': '⤳', - 'rarrfs;': '⤞', - 'rarrhk;': '↪', - 'rarrlp;': '↬', - 'rarrpl;': '⥅', - 'rarrsim;': '⥴', - 'rarrtl;': '↣', - 'rarrw;': '↝', - 'ratail;': '⤚', - 'ratio;': '∶', - 'rationals;': 'ℚ', - 'rbarr;': '⤍', - 'rbbrk;': '❳', - 'rbrace;': '}', - 'rbrack;': ']', - 'rbrke;': '⦌', - 'rbrksld;': '⦎', - 'rbrkslu;': '⦐', - 'rcaron;': 'ř', - 'rcedil;': 'ŗ', - 'rceil;': '⌉', - 'rcub;': '}', - 'rcy;': 'р', - 'rdca;': '⤷', - 'rdldhar;': '⥩', - 'rdquo;': '”', - 'rdquor;': '”', - 'rdsh;': '↳', - 'real;': 'ℜ', - 'realine;': 'ℛ', - 'realpart;': 'ℜ', - 'reals;': 'ℝ', - 'rect;': '▭', - reg: '®', - 'reg;': '®', - 'rfisht;': '⥽', - 'rfloor;': '⌋', - 'rfr;': '𝔯', - 'rhard;': '⇁', - 'rharu;': '⇀', - 'rharul;': '⥬', - 'rho;': 'ρ', - 'rhov;': 'ϱ', - 'rightarrow;': '→', - 'rightarrowtail;': '↣', - 'rightharpoondown;': '⇁', - 'rightharpoonup;': '⇀', - 'rightleftarrows;': '⇄', - 'rightleftharpoons;': '⇌', - 'rightrightarrows;': '⇉', - 'rightsquigarrow;': '↝', - 'rightthreetimes;': '⋌', - 'ring;': '˚', - 'risingdotseq;': '≓', - 'rlarr;': '⇄', - 'rlhar;': '⇌', - 'rlm;': '‏', - 'rmoust;': '⎱', - 'rmoustache;': '⎱', - 'rnmid;': '⫮', - 'roang;': '⟭', - 'roarr;': '⇾', - 'robrk;': '⟧', - 'ropar;': '⦆', - 'ropf;': '𝕣', - 'roplus;': '⨮', - 'rotimes;': '⨵', - 'rpar;': ')', - 'rpargt;': '⦔', - 'rppolint;': '⨒', - 'rrarr;': '⇉', - 'rsaquo;': '›', - 'rscr;': '𝓇', - 'rsh;': '↱', - 'rsqb;': ']', - 'rsquo;': '’', - 'rsquor;': '’', - 'rthree;': '⋌', - 'rtimes;': '⋊', - 'rtri;': '▹', - 'rtrie;': '⊵', - 'rtrif;': '▸', - 'rtriltri;': '⧎', - 'ruluhar;': '⥨', - 'rx;': '℞', - 'sacute;': 'ś', - 'sbquo;': '‚', - 'sc;': '≻', - 'scE;': '⪴', - 'scap;': '⪸', - 'scaron;': 'š', - 'sccue;': '≽', - 'sce;': '⪰', - 'scedil;': 'ş', - 'scirc;': 'ŝ', - 'scnE;': '⪶', - 'scnap;': '⪺', - 'scnsim;': '⋩', - 'scpolint;': '⨓', - 'scsim;': '≿', - 'scy;': 'с', - 'sdot;': '⋅', - 'sdotb;': '⊡', - 'sdote;': '⩦', - 'seArr;': '⇘', - 'searhk;': '⤥', - 'searr;': '↘', - 'searrow;': '↘', - sect: '§', - 'sect;': '§', - 'semi;': ';', - 'seswar;': '⤩', - 'setminus;': '∖', - 'setmn;': '∖', - 'sext;': '✶', - 'sfr;': '𝔰', - 'sfrown;': '⌢', - 'sharp;': '♯', - 'shchcy;': 'щ', - 'shcy;': 'ш', - 'shortmid;': '∣', - 'shortparallel;': '∥', - shy: '­', - 'shy;': '­', - 'sigma;': 'σ', - 'sigmaf;': 'ς', - 'sigmav;': 'ς', - 'sim;': '∼', - 'simdot;': '⩪', - 'sime;': '≃', - 'simeq;': '≃', - 'simg;': '⪞', - 'simgE;': '⪠', - 'siml;': '⪝', - 'simlE;': '⪟', - 'simne;': '≆', - 'simplus;': '⨤', - 'simrarr;': '⥲', - 'slarr;': '←', - 'smallsetminus;': '∖', - 'smashp;': '⨳', - 'smeparsl;': '⧤', - 'smid;': '∣', - 'smile;': '⌣', - 'smt;': '⪪', - 'smte;': '⪬', - 'smtes;': '⪬︀', - 'softcy;': 'ь', - 'sol;': '/', - 'solb;': '⧄', - 'solbar;': '⌿', - 'sopf;': '𝕤', - 'spades;': '♠', - 'spadesuit;': '♠', - 'spar;': '∥', - 'sqcap;': '⊓', - 'sqcaps;': '⊓︀', - 'sqcup;': '⊔', - 'sqcups;': '⊔︀', - 'sqsub;': '⊏', - 'sqsube;': '⊑', - 'sqsubset;': '⊏', - 'sqsubseteq;': '⊑', - 'sqsup;': '⊐', - 'sqsupe;': '⊒', - 'sqsupset;': '⊐', - 'sqsupseteq;': '⊒', - 'squ;': '□', - 'square;': '□', - 'squarf;': '▪', - 'squf;': '▪', - 'srarr;': '→', - 'sscr;': '𝓈', - 'ssetmn;': '∖', - 'ssmile;': '⌣', - 'sstarf;': '⋆', - 'star;': '☆', - 'starf;': '★', - 'straightepsilon;': 'ϵ', - 'straightphi;': 'ϕ', - 'strns;': '¯', - 'sub;': '⊂', - 'subE;': '⫅', - 'subdot;': '⪽', - 'sube;': '⊆', - 'subedot;': '⫃', - 'submult;': '⫁', - 'subnE;': '⫋', - 'subne;': '⊊', - 'subplus;': '⪿', - 'subrarr;': '⥹', - 'subset;': '⊂', - 'subseteq;': '⊆', - 'subseteqq;': '⫅', - 'subsetneq;': '⊊', - 'subsetneqq;': '⫋', - 'subsim;': '⫇', - 'subsub;': '⫕', - 'subsup;': '⫓', - 'succ;': '≻', - 'succapprox;': '⪸', - 'succcurlyeq;': '≽', - 'succeq;': '⪰', - 'succnapprox;': '⪺', - 'succneqq;': '⪶', - 'succnsim;': '⋩', - 'succsim;': '≿', - 'sum;': '∑', - 'sung;': '♪', - sup1: '¹', - 'sup1;': '¹', - sup2: '²', - 'sup2;': '²', - sup3: '³', - 'sup3;': '³', - 'sup;': '⊃', - 'supE;': '⫆', - 'supdot;': '⪾', - 'supdsub;': '⫘', - 'supe;': '⊇', - 'supedot;': '⫄', - 'suphsol;': '⟉', - 'suphsub;': '⫗', - 'suplarr;': '⥻', - 'supmult;': '⫂', - 'supnE;': '⫌', - 'supne;': '⊋', - 'supplus;': '⫀', - 'supset;': '⊃', - 'supseteq;': '⊇', - 'supseteqq;': '⫆', - 'supsetneq;': '⊋', - 'supsetneqq;': '⫌', - 'supsim;': '⫈', - 'supsub;': '⫔', - 'supsup;': '⫖', - 'swArr;': '⇙', - 'swarhk;': '⤦', - 'swarr;': '↙', - 'swarrow;': '↙', - 'swnwar;': '⤪', - szlig: 'ß', - 'szlig;': 'ß', - 'target;': '⌖', - 'tau;': 'τ', - 'tbrk;': '⎴', - 'tcaron;': 'ť', - 'tcedil;': 'ţ', - 'tcy;': 'т', - 'tdot;': '⃛', - 'telrec;': '⌕', - 'tfr;': '𝔱', - 'there4;': '∴', - 'therefore;': '∴', - 'theta;': 'θ', - 'thetasym;': 'ϑ', - 'thetav;': 'ϑ', - 'thickapprox;': '≈', - 'thicksim;': '∼', - 'thinsp;': ' ', - 'thkap;': '≈', - 'thksim;': '∼', - thorn: 'þ', - 'thorn;': 'þ', - 'tilde;': '˜', - times: '×', - 'times;': '×', - 'timesb;': '⊠', - 'timesbar;': '⨱', - 'timesd;': '⨰', - 'tint;': '∭', - 'toea;': '⤨', - 'top;': '⊤', - 'topbot;': '⌶', - 'topcir;': '⫱', - 'topf;': '𝕥', - 'topfork;': '⫚', - 'tosa;': '⤩', - 'tprime;': '‴', - 'trade;': '™', - 'triangle;': '▵', - 'triangledown;': '▿', - 'triangleleft;': '◃', - 'trianglelefteq;': '⊴', - 'triangleq;': '≜', - 'triangleright;': '▹', - 'trianglerighteq;': '⊵', - 'tridot;': '◬', - 'trie;': '≜', - 'triminus;': '⨺', - 'triplus;': '⨹', - 'trisb;': '⧍', - 'tritime;': '⨻', - 'trpezium;': '⏢', - 'tscr;': '𝓉', - 'tscy;': 'ц', - 'tshcy;': 'ћ', - 'tstrok;': 'ŧ', - 'twixt;': '≬', - 'twoheadleftarrow;': '↞', - 'twoheadrightarrow;': '↠', - 'uArr;': '⇑', - 'uHar;': '⥣', - uacute: 'ú', - 'uacute;': 'ú', - 'uarr;': '↑', - 'ubrcy;': 'ў', - 'ubreve;': 'ŭ', - ucirc: 'û', - 'ucirc;': 'û', - 'ucy;': 'у', - 'udarr;': '⇅', - 'udblac;': 'ű', - 'udhar;': '⥮', - 'ufisht;': '⥾', - 'ufr;': '𝔲', - ugrave: 'ù', - 'ugrave;': 'ù', - 'uharl;': '↿', - 'uharr;': '↾', - 'uhblk;': '▀', - 'ulcorn;': '⌜', - 'ulcorner;': '⌜', - 'ulcrop;': '⌏', - 'ultri;': '◸', - 'umacr;': 'ū', - uml: '¨', - 'uml;': '¨', - 'uogon;': 'ų', - 'uopf;': '𝕦', - 'uparrow;': '↑', - 'updownarrow;': '↕', - 'upharpoonleft;': '↿', - 'upharpoonright;': '↾', - 'uplus;': '⊎', - 'upsi;': 'υ', - 'upsih;': 'ϒ', - 'upsilon;': 'υ', - 'upuparrows;': '⇈', - 'urcorn;': '⌝', - 'urcorner;': '⌝', - 'urcrop;': '⌎', - 'uring;': 'ů', - 'urtri;': '◹', - 'uscr;': '𝓊', - 'utdot;': '⋰', - 'utilde;': 'ũ', - 'utri;': '▵', - 'utrif;': '▴', - 'uuarr;': '⇈', - uuml: 'ü', - 'uuml;': 'ü', - 'uwangle;': '⦧', - 'vArr;': '⇕', - 'vBar;': '⫨', - 'vBarv;': '⫩', - 'vDash;': '⊨', - 'vangrt;': '⦜', - 'varepsilon;': 'ϵ', - 'varkappa;': 'ϰ', - 'varnothing;': '∅', - 'varphi;': 'ϕ', - 'varpi;': 'ϖ', - 'varpropto;': '∝', - 'varr;': '↕', - 'varrho;': 'ϱ', - 'varsigma;': 'ς', - 'varsubsetneq;': '⊊︀', - 'varsubsetneqq;': '⫋︀', - 'varsupsetneq;': '⊋︀', - 'varsupsetneqq;': '⫌︀', - 'vartheta;': 'ϑ', - 'vartriangleleft;': '⊲', - 'vartriangleright;': '⊳', - 'vcy;': 'в', - 'vdash;': '⊢', - 'vee;': '∨', - 'veebar;': '⊻', - 'veeeq;': '≚', - 'vellip;': '⋮', - 'verbar;': '|', - 'vert;': '|', - 'vfr;': '𝔳', - 'vltri;': '⊲', - 'vnsub;': '⊂⃒', - 'vnsup;': '⊃⃒', - 'vopf;': '𝕧', - 'vprop;': '∝', - 'vrtri;': '⊳', - 'vscr;': '𝓋', - 'vsubnE;': '⫋︀', - 'vsubne;': '⊊︀', - 'vsupnE;': '⫌︀', - 'vsupne;': '⊋︀', - 'vzigzag;': '⦚', - 'wcirc;': 'ŵ', - 'wedbar;': '⩟', - 'wedge;': '∧', - 'wedgeq;': '≙', - 'weierp;': '℘', - 'wfr;': '𝔴', - 'wopf;': '𝕨', - 'wp;': '℘', - 'wr;': '≀', - 'wreath;': '≀', - 'wscr;': '𝓌', - 'xcap;': '⋂', - 'xcirc;': '◯', - 'xcup;': '⋃', - 'xdtri;': '▽', - 'xfr;': '𝔵', - 'xhArr;': '⟺', - 'xharr;': '⟷', - 'xi;': 'ξ', - 'xlArr;': '⟸', - 'xlarr;': '⟵', - 'xmap;': '⟼', - 'xnis;': '⋻', - 'xodot;': '⨀', - 'xopf;': '𝕩', - 'xoplus;': '⨁', - 'xotime;': '⨂', - 'xrArr;': '⟹', - 'xrarr;': '⟶', - 'xscr;': '𝓍', - 'xsqcup;': '⨆', - 'xuplus;': '⨄', - 'xutri;': '△', - 'xvee;': '⋁', - 'xwedge;': '⋀', - yacute: 'ý', - 'yacute;': 'ý', - 'yacy;': 'я', - 'ycirc;': 'ŷ', - 'ycy;': 'ы', - yen: '¥', - 'yen;': '¥', - 'yfr;': '𝔶', - 'yicy;': 'ї', - 'yopf;': '𝕪', - 'yscr;': '𝓎', - 'yucy;': 'ю', - yuml: 'ÿ', - 'yuml;': 'ÿ', - 'zacute;': 'ź', - 'zcaron;': 'ž', - 'zcy;': 'з', - 'zdot;': 'ż', - 'zeetrf;': 'ℨ', - 'zeta;': 'ζ', - 'zfr;': '𝔷', - 'zhcy;': 'ж', - 'zigrarr;': '⇝', - 'zopf;': '𝕫', - 'zscr;': '𝓏', - 'zwj;': '‍', - 'zwnj;': '‌' -}; - -const numeric = /&#(x)?([0-9a-f]+);/i; -const named = new RegExp( - `&(${Object.keys(entities) - .sort((a, b) => b.length - a.length) - .join('|')})`, - 'g' -); - -/** @param {string} str */ -export function decode(str) { - return str - .replace(numeric, (_match, hex, code) => String.fromCharCode(hex ? parseInt(code, 16) : +code)) - .replace(named, (_match, entity) => entities[entity]); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/fallback.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/fallback.js deleted file mode 100644 index 3935688..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/fallback.js +++ /dev/null @@ -1,55 +0,0 @@ -import { readFileSync } from 'node:fs'; -import { join } from 'node:path'; -import { pathToFileURL } from 'node:url'; -import { installPolyfills } from '../../exports/node/polyfills.js'; -import { load_config } from '../config/index.js'; -import { forked } from '../../utils/fork.js'; - -export default forked(import.meta.url, generate_fallback); - -/** - * @param {{ - * manifest_path: string; - * env: Record - * }} opts - */ -async function generate_fallback({ manifest_path, env }) { - /** @type {import('types').ValidatedKitConfig} */ - const config = (await load_config()).kit; - - installPolyfills(); - - const server_root = join(config.outDir, 'output'); - - /** @type {import('types').ServerInternalModule} */ - const { set_building } = await import(pathToFileURL(`${server_root}/server/internal.js`).href); - - /** @type {import('types').ServerModule} */ - const { Server } = await import(pathToFileURL(`${server_root}/server/index.js`).href); - - /** @type {import('@sveltejs/kit').SSRManifest} */ - const manifest = (await import(pathToFileURL(manifest_path).href)).manifest; - - set_building(); - - const server = new Server(manifest); - await server.init({ env }); - - const response = await server.respond(new Request(config.prerender.origin + '/[fallback]'), { - getClientAddress: () => { - throw new Error('Cannot read clientAddress during prerendering'); - }, - prerendering: { - fallback: true, - dependencies: new Map(), - remote_responses: new Map() - }, - read: (file) => readFileSync(join(config.files.assets, file)) - }); - - if (response.ok) { - return await response.text(); - } - - throw new Error(`Could not create a fallback page — failed with status ${response.status}`); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js deleted file mode 100644 index 8caa68f..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/prerender.js +++ /dev/null @@ -1,593 +0,0 @@ -import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs'; -import { dirname, join } from 'node:path'; -import { pathToFileURL } from 'node:url'; -import { installPolyfills } from '../../exports/node/polyfills.js'; -import { mkdirp, posixify, walk } from '../../utils/filesystem.js'; -import { decode_uri, is_root_relative, resolve } from '../../utils/url.js'; -import { escape_html } from '../../utils/escape.js'; -import { logger } from '../utils.js'; -import { load_config } from '../config/index.js'; -import { get_route_segments } from '../../utils/routing.js'; -import { queue } from './queue.js'; -import { crawl } from './crawl.js'; -import { forked } from '../../utils/fork.js'; -import * as devalue from 'devalue'; -import { createReadableStream } from '@sveltejs/kit/node'; -import generate_fallback from './fallback.js'; -import { stringify_remote_arg } from '../../runtime/shared.js'; -import { filter_env } from '../../utils/env.js'; - -export default forked(import.meta.url, prerender); - -// https://html.spec.whatwg.org/multipage/browsing-the-web.html#scrolling-to-a-fragment -// "If fragment is the empty string, then return the special value top of the document." -// ...and -// "If decodedFragment is an ASCII case-insensitive match for the string 'top', then return the top of the document." -const SPECIAL_HASHLINKS = new Set(['', 'top']); - -/** - * @param {{ - * hash: boolean; - * out: string; - * manifest_path: string; - * metadata: import('types').ServerMetadata; - * verbose: boolean; - * env: Record - * }} opts - */ -async function prerender({ hash, out, manifest_path, metadata, verbose, env }) { - /** @type {import('@sveltejs/kit').SSRManifest} */ - const manifest = (await import(pathToFileURL(manifest_path).href)).manifest; - - /** @type {import('types').ServerInternalModule} */ - const internal = await import(pathToFileURL(`${out}/server/internal.js`).href); - - /** @type {import('types').ServerModule} */ - const { Server } = await import(pathToFileURL(`${out}/server/index.js`).href); - - // configure `import { building } from '$app/environment'` — - // essential we do this before analysing the code - internal.set_building(); - internal.set_prerendering(); - - /** - * @template {{message: string}} T - * @template {Omit} K - * @param {import('types').Logger} log - * @param {'fail' | 'warn' | 'ignore' | ((details: T) => void)} input - * @param {(details: K) => string} format - * @returns {(details: K) => void} - */ - function normalise_error_handler(log, input, format) { - switch (input) { - case 'fail': - return (details) => { - throw new Error(format(details)); - }; - case 'warn': - return (details) => { - log.error(format(details)); - }; - case 'ignore': - return () => {}; - default: - // @ts-expect-error TS thinks T might be of a different kind, but it's not - return (details) => input({ ...details, message: format(details) }); - } - } - - const OK = 2; - const REDIRECT = 3; - - /** @type {import('types').Prerendered} */ - const prerendered = { - pages: new Map(), - assets: new Map(), - redirects: new Map(), - paths: [] - }; - - /** @type {import('types').PrerenderMap} */ - const prerender_map = new Map(); - - for (const [id, { prerender }] of metadata.routes) { - if (prerender !== undefined) { - prerender_map.set(id, prerender); - } - } - - /** @type {Set} */ - const prerendered_routes = new Set(); - - /** @type {import('types').ValidatedKitConfig} */ - const config = (await load_config()).kit; - - if (hash) { - const fallback = await generate_fallback({ - manifest_path, - env - }); - - const file = output_filename('/', true); - const dest = `${config.outDir}/output/prerendered/pages/${file}`; - - mkdirp(dirname(dest)); - writeFileSync(dest, fallback); - - prerendered.pages.set('/', { file }); - - return { prerendered, prerender_map }; - } - - const emulator = await config.adapter?.emulate?.(); - - /** @type {import('types').Logger} */ - const log = logger({ verbose }); - - installPolyfills(); - - /** @type {Map} */ - const saved = new Map(); - - const handle_http_error = normalise_error_handler( - log, - config.prerender.handleHttpError, - ({ status, path, referrer, referenceType }) => { - const message = - status === 404 && !path.startsWith(config.paths.base) - ? `${path} does not begin with \`base\`, which is configured in \`paths.base\` and can be imported from \`$app/paths\` - see https://svelte.dev/docs/kit/configuration#paths for more info` - : path; - - return `${status} ${message}${referrer ? ` (${referenceType} from ${referrer})` : ''}`; - } - ); - - const handle_missing_id = normalise_error_handler( - log, - config.prerender.handleMissingId, - ({ path, id, referrers }) => { - return ( - `The following pages contain links to ${path}#${id}, but no element with id="${id}" exists on ${path} - see the \`handleMissingId\` option in https://svelte.dev/docs/kit/configuration#prerender for more info:` + - referrers.map((l) => `\n - ${l}`).join('') - ); - } - ); - - const handle_entry_generator_mismatch = normalise_error_handler( - log, - config.prerender.handleEntryGeneratorMismatch, - ({ generatedFromId, entry, matchedId }) => { - return `The entries export from ${generatedFromId} generated entry ${entry}, which was matched by ${matchedId} - see the \`handleEntryGeneratorMismatch\` option in https://svelte.dev/docs/kit/configuration#prerender for more info.`; - } - ); - - const handle_not_prerendered_route = normalise_error_handler( - log, - config.prerender.handleUnseenRoutes, - ({ routes }) => { - const list = routes.map((id) => ` - ${id}`).join('\n'); - return `The following routes were marked as prerenderable, but were not prerendered because they were not found while crawling your app:\n${list}\n\nSee the \`handleUnseenRoutes\` option in https://svelte.dev/docs/kit/configuration#prerender for more info.`; - } - ); - - const q = queue(config.prerender.concurrency); - - /** - * @param {string} path - * @param {boolean} is_html - */ - function output_filename(path, is_html) { - const file = path.slice(config.paths.base.length + 1) || 'index.html'; - - if (is_html && !file.endsWith('.html')) { - return file + (file.endsWith('/') ? 'index.html' : '.html'); - } - - return file; - } - - const files = new Set(walk(`${out}/client`).map(posixify)); - files.add(`${config.appDir}/env.js`); - - const immutable = `${config.appDir}/immutable`; - if (existsSync(`${out}/server/${immutable}`)) { - for (const file of walk(`${out}/server/${immutable}`)) { - files.add(posixify(`${config.appDir}/immutable/${file}`)); - } - } - - const remote_prefix = `${config.paths.base}/${config.appDir}/remote/`; - - const seen = new Set(); - const written = new Set(); - const remote_responses = new Map(); - - /** @type {Map>} */ - const expected_hashlinks = new Map(); - - /** @type {Map} */ - const actual_hashlinks = new Map(); - - /** - * @param {string | null} referrer - * @param {string} decoded - * @param {string} [encoded] - * @param {string} [generated_from_id] - */ - function enqueue(referrer, decoded, encoded, generated_from_id) { - if (seen.has(decoded)) return; - seen.add(decoded); - - const file = decoded.slice(config.paths.base.length + 1); - if (files.has(file)) return; - - return q.add(() => visit(decoded, encoded || encodeURI(decoded), referrer, generated_from_id)); - } - - /** - * @param {string} decoded - * @param {string} encoded - * @param {string?} referrer - * @param {string} [generated_from_id] - */ - async function visit(decoded, encoded, referrer, generated_from_id) { - if (!decoded.startsWith(config.paths.base)) { - handle_http_error({ status: 404, path: decoded, referrer, referenceType: 'linked' }); - return; - } - - /** @type {Map} */ - const dependencies = new Map(); - - const response = await server.respond(new Request(config.prerender.origin + encoded), { - getClientAddress() { - throw new Error('Cannot read clientAddress during prerendering'); - }, - prerendering: { - dependencies, - remote_responses - }, - read: (file) => { - // stuff we just wrote - const filepath = saved.get(file); - if (filepath) return readFileSync(filepath); - - // Static assets emitted during build - if (file.startsWith(config.appDir)) { - return readFileSync(`${out}/server/${file}`); - } - - // stuff in `static` - return readFileSync(join(config.files.assets, file)); - }, - emulator - }); - - const encoded_id = response.headers.get('x-sveltekit-routeid'); - const decoded_id = encoded_id && decode_uri(encoded_id); - if ( - decoded_id !== null && - generated_from_id !== undefined && - decoded_id !== generated_from_id - ) { - handle_entry_generator_mismatch({ - generatedFromId: generated_from_id, - entry: decoded, - matchedId: decoded_id - }); - } - - const body = Buffer.from(await response.arrayBuffer()); - - const category = decoded.startsWith(remote_prefix) ? 'data' : 'pages'; - save(category, response, body, decoded, encoded, referrer, 'linked'); - - for (const [dependency_path, result] of dependencies) { - // this seems circuitous, but using new URL allows us to not care - // whether dependency_path is encoded or not - const encoded_dependency_path = new URL(dependency_path, 'http://localhost').pathname; - const decoded_dependency_path = decode_uri(encoded_dependency_path); - - const headers = Object.fromEntries(result.response.headers); - - const prerender = headers['x-sveltekit-prerender']; - if (prerender) { - const encoded_route_id = headers['x-sveltekit-routeid']; - if (encoded_route_id != null) { - const route_id = decode_uri(encoded_route_id); - const existing_value = prerender_map.get(route_id); - if (existing_value !== 'auto') { - prerender_map.set(route_id, prerender === 'true' ? true : 'auto'); - } - } - } - - const body = result.body ?? new Uint8Array(await result.response.arrayBuffer()); - - const category = decoded_dependency_path.startsWith(remote_prefix) ? 'data' : 'dependencies'; - - save( - category, - result.response, - body, - decoded_dependency_path, - encoded_dependency_path, - decoded, - 'fetched' - ); - } - - // avoid triggering `filterSerializeResponseHeaders` guard - const headers = Object.fromEntries(response.headers); - - // if it's a 200 HTML response, crawl it. Skip error responses, as we don't save those - if (response.ok && config.prerender.crawl && headers['content-type'] === 'text/html') { - const { ids, hrefs } = crawl(body.toString(), decoded); - - actual_hashlinks.set(decoded, ids); - - /** @param {string} href */ - const removePrerenderOrigin = (href) => { - if (href.startsWith(config.prerender.origin)) { - if (href === config.prerender.origin) return '/'; - if (href.at(config.prerender.origin.length) !== '/') return href; - return href.slice(config.prerender.origin.length); - } - return href; - }; - - for (const href of hrefs.map(removePrerenderOrigin)) { - if (!is_root_relative(href)) continue; - - const { pathname, search, hash } = new URL(href, 'http://localhost'); - - if (search) { - // TODO warn that query strings have no effect on statically-exported pages - } - - if (hash) { - const key = decode_uri(pathname + hash); - - if (!expected_hashlinks.has(key)) { - expected_hashlinks.set(key, new Set()); - } - - /** @type {Set} */ (expected_hashlinks.get(key)).add(decoded); - } - - void enqueue(decoded, decode_uri(pathname), pathname); - } - } - } - - /** - * @param {'pages' | 'dependencies' | 'data'} category - * @param {Response} response - * @param {string | Uint8Array} body - * @param {string} decoded - * @param {string} encoded - * @param {string | null} referrer - * @param {'linked' | 'fetched'} referenceType - */ - function save(category, response, body, decoded, encoded, referrer, referenceType) { - const response_type = Math.floor(response.status / 100); - const headers = Object.fromEntries(response.headers); - - const type = headers['content-type']; - const is_html = response_type === REDIRECT || type === 'text/html'; - - const file = output_filename(decoded, is_html); - const dest = `${config.outDir}/output/prerendered/${category}/${file}`; - - if (written.has(file)) return; - - const encoded_route_id = response.headers.get('x-sveltekit-routeid'); - const route_id = encoded_route_id != null ? decode_uri(encoded_route_id) : null; - if (route_id !== null) prerendered_routes.add(route_id); - - if (response_type === REDIRECT) { - const location = headers['location']; - - if (location) { - const resolved = resolve(encoded, location); - if (is_root_relative(resolved)) { - void enqueue(decoded, decode_uri(resolved), resolved); - } - - if (!headers['x-sveltekit-normalize']) { - mkdirp(dirname(dest)); - - log.warn(`${response.status} ${decoded} -> ${location}`); - - writeFileSync( - dest, - `` - ); - - written.add(file); - - if (!prerendered.redirects.has(decoded)) { - prerendered.redirects.set(decoded, { - status: response.status, - location: resolved - }); - - prerendered.paths.push(decoded); - } - } - } else { - log.warn(`location header missing on redirect received from ${decoded}`); - } - - return; - } - - if (response.status === 200) { - if (existsSync(dest) && statSync(dest).isDirectory()) { - throw new Error( - `Cannot save ${decoded} as it is already a directory. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information` - ); - } - - const dir = dirname(dest); - - if (existsSync(dir) && !statSync(dir).isDirectory()) { - const parent = decoded.split('/').slice(0, -1).join('/'); - throw new Error( - `Cannot save ${decoded} as ${parent} is already a file. See https://svelte.dev/docs/kit/page-options#prerender-route-conflicts for more information` - ); - } - - mkdirp(dir); - - log.info(`${response.status} ${decoded}`); - writeFileSync(dest, body); - written.add(file); - - if (is_html) { - prerendered.pages.set(decoded, { - file - }); - } else { - prerendered.assets.set(decoded, { - type - }); - } - - prerendered.paths.push(decoded); - } else if (response_type !== OK) { - handle_http_error({ status: response.status, path: decoded, referrer, referenceType }); - } - - manifest.assets.add(file); - saved.set(file, dest); - } - - /** @type {Array<{ id: string, entries: Array}>} */ - const route_level_entries = []; - for (const [id, { entries }] of metadata.routes.entries()) { - if (entries) { - route_level_entries.push({ id, entries }); - } - } - - let should_prerender = false; - - for (const value of prerender_map.values()) { - if (value) { - should_prerender = true; - break; - } - } - - // the user's remote function modules may reference environment variables, - // `read` or the `manifest` at the top-level so we need to set them before - // evaluating those modules to avoid potential runtime errors - const { publicPrefix: public_prefix, privatePrefix: private_prefix } = config.env; - const private_env = filter_env(env, private_prefix, public_prefix); - const public_env = filter_env(env, public_prefix, private_prefix); - internal.set_private_env(private_env); - internal.set_public_env(public_env); - internal.set_manifest(manifest); - internal.set_read_implementation((file) => createReadableStream(`${out}/server/${file}`)); - - /** @type {Array} */ - const prerender_functions = []; - - for (const loader of Object.values(manifest._.remotes)) { - const module = await loader(); - - for (const fn of Object.values(module.default)) { - if (fn?.__?.type === 'prerender') { - prerender_functions.push(fn.__); - should_prerender = true; - } - } - } - - if (!should_prerender) { - return { prerendered, prerender_map }; - } - - // only run the server after the `should_prerender` check so that we - // don't run the user's init hook unnecessarily - const server = new Server(manifest); - await server.init({ - env, - read: (file) => createReadableStream(`${config.outDir}/output/server/${file}`) - }); - - log.info('Prerendering'); - - for (const entry of config.prerender.entries) { - if (entry === '*') { - for (const [id, prerender] of prerender_map) { - if (prerender) { - // remove optional parameters from the route - const segments = get_route_segments(id).filter((segment) => !segment.startsWith('[[')); - const processed_id = '/' + segments.join('/'); - - if (processed_id.includes('[')) continue; - const path = `/${get_route_segments(processed_id).join('/')}`; - void enqueue(null, config.paths.base + path); - } - } - } else { - void enqueue(null, config.paths.base + entry); - } - } - - for (const { id, entries } of route_level_entries) { - for (const entry of entries) { - void enqueue(null, config.paths.base + entry, undefined, id); - } - } - - const transport = (await internal.get_hooks()).transport ?? {}; - for (const info of prerender_functions) { - if (info.has_arg) { - for (const arg of (await info.inputs?.()) ?? []) { - void enqueue(null, remote_prefix + info.id + '/' + stringify_remote_arg(arg, transport)); - } - } else { - void enqueue(null, remote_prefix + info.id); - } - } - - await q.done(); - - // handle invalid fragment links - for (const [key, referrers] of expected_hashlinks) { - const index = key.indexOf('#'); - const path = key.slice(0, index); - const id = key.slice(index + 1); - - const hashlinks = actual_hashlinks.get(path); - // ignore fragment links to pages that were not prerendered - if (!hashlinks) continue; - - if (!hashlinks.includes(id) && !SPECIAL_HASHLINKS.has(id)) { - handle_missing_id({ id, path, referrers: Array.from(referrers) }); - } - } - - /** @type {string[]} */ - const not_prerendered = []; - - for (const [route_id, prerender] of prerender_map) { - if (prerender === true && !prerendered_routes.has(route_id)) { - not_prerendered.push(route_id); - } - } - - if (not_prerendered.length > 0) { - handle_not_prerendered_route({ routes: not_prerendered }); - } - - return { prerendered, prerender_map }; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/postbuild/queue.js b/web/node_modules/@sveltejs/kit/src/core/postbuild/queue.js deleted file mode 100644 index a816e6e..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/postbuild/queue.js +++ /dev/null @@ -1,72 +0,0 @@ -/** @import { PromiseWithResolvers } from '../../utils/promise.js' */ -import { with_resolvers } from '../../utils/promise.js'; - -/** - * @typedef {{ - * fn: () => Promise, - * fulfil: (value: any) => void, - * reject: (error: Error) => void - * }} Task - */ - -/** @param {number} concurrency */ -export function queue(concurrency) { - /** @type {Task[]} */ - const tasks = []; - const { promise, resolve, reject } = /** @type {PromiseWithResolvers} */ (with_resolvers()); - - let current = 0; - let closed = false; - - promise.catch(() => { - // this is necessary in case a catch handler is never added - // to the done promise by the user - }); - - function dequeue() { - if (current < concurrency) { - const task = tasks.shift(); - - if (task) { - current += 1; - const promise = Promise.resolve(task.fn()); - - void promise - .then(task.fulfil, (err) => { - task.reject(err); - reject(err); - }) - .then(() => { - current -= 1; - dequeue(); - }); - } else if (current === 0) { - closed = true; - resolve(); - } - } - } - - return { - /** @param {() => any} fn */ - add: (fn) => { - if (closed) throw new Error('Cannot add tasks to a queue that has ended'); - - const promise = new Promise((fulfil, reject) => { - tasks.push({ fn, fulfil, reject }); - }); - - dequeue(); - return promise; - }, - - done: () => { - if (current === 0) { - closed = true; - resolve(); - } - - return promise; - } - }; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/conflict.js b/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/conflict.js deleted file mode 100644 index e69de29..0000000 diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/index.js b/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/index.js deleted file mode 100644 index 5facdc7..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/index.js +++ /dev/null @@ -1,613 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import colors from 'kleur'; -import { lookup } from 'mrmime'; -import { list_files, runtime_directory } from '../../utils.js'; -import { posixify, resolve_entry } from '../../../utils/filesystem.js'; -import { parse_route_id } from '../../../utils/routing.js'; -import { sort_routes } from './sort.js'; -import { isSvelte5Plus } from '../utils.js'; -import { - create_node_analyser, - get_page_options -} from '../../../exports/vite/static_analysis/index.js'; - -/** - * Generates the manifest data used for the client-side manifest and types generation. - * @param {{ - * config: import('types').ValidatedConfig; - * fallback?: string; - * cwd?: string; - * }} opts - * @returns {import('types').ManifestData} - */ -export default function create_manifest_data({ - config, - fallback = `${runtime_directory}/components/${isSvelte5Plus() ? 'svelte-5' : 'svelte-4'}`, - cwd = process.cwd() -}) { - const assets = create_assets(config); - const hooks = create_hooks(config, cwd); - const matchers = create_matchers(config, cwd); - const { nodes, routes } = create_routes_and_nodes(cwd, config, fallback); - - for (const route of routes) { - for (const param of route.params) { - if (param.matcher && !matchers[param.matcher]) { - throw new Error(`No matcher found for parameter '${param.matcher}' in route ${route.id}`); - } - } - } - - return { - assets, - hooks, - matchers, - nodes, - routes - }; -} - -/** - * @param {import('types').ValidatedConfig} config - */ -export function create_assets(config) { - return list_files(config.kit.files.assets).map((file) => ({ - file, - size: fs.statSync(path.resolve(config.kit.files.assets, file)).size, - type: lookup(file) || null - })); -} - -/** - * @param {import('types').ValidatedConfig} config - * @param {string} cwd - */ -function create_hooks(config, cwd) { - const client = resolve_entry(config.kit.files.hooks.client); - const server = resolve_entry(config.kit.files.hooks.server); - const universal = resolve_entry(config.kit.files.hooks.universal); - - return { - client: client && posixify(path.relative(cwd, client)), - server: server && posixify(path.relative(cwd, server)), - universal: universal && posixify(path.relative(cwd, universal)) - }; -} - -/** - * @param {import('types').ValidatedConfig} config - * @param {string} cwd - */ -function create_matchers(config, cwd) { - const params_base = path.relative(cwd, config.kit.files.params); - - /** @type {Record} */ - const matchers = {}; - if (fs.existsSync(config.kit.files.params)) { - for (const file of fs.readdirSync(config.kit.files.params)) { - const ext = path.extname(file); - if (!config.kit.moduleExtensions.includes(ext)) continue; - const type = file.slice(0, -ext.length); - - if (/^\w+$/.test(type)) { - const matcher_file = path.join(params_base, file); - - // Disallow same matcher with different extensions - if (matchers[type]) { - throw new Error(`Duplicate matchers: ${matcher_file} and ${matchers[type]}`); - } else { - matchers[type] = matcher_file; - } - } else { - // Allow for matcher test collocation - if (type.endsWith('.test') || type.endsWith('.spec')) continue; - - throw new Error( - `Matcher names can only have underscores and alphanumeric characters — "${file}" is invalid` - ); - } - } - } - - return matchers; -} - -/** - * @param {import('types').ValidatedConfig} config - * @param {string} cwd - * @param {string} fallback - */ -function create_routes_and_nodes(cwd, config, fallback) { - /** @type {import('types').RouteData[]} */ - const routes = []; - - const routes_base = posixify(path.relative(cwd, config.kit.files.routes)); - - const valid_extensions = [...config.extensions, ...config.kit.moduleExtensions]; - - /** @type {import('types').PageNode[]} */ - const nodes = []; - - if (fs.existsSync(config.kit.files.routes)) { - /** - * @param {number} depth - * @param {string} id - * @param {string} segment - * @param {import('types').RouteData | null} parent - */ - const walk = (depth, id, segment, parent) => { - const unescaped = id.replace(/\[([ux])\+([^\]]+)\]/gi, (match, type, code) => { - if (match !== match.toLowerCase()) { - throw new Error(`Character escape sequence in ${id} must be lowercase`); - } - - if (!/[0-9a-f]+/.test(code)) { - throw new Error(`Invalid character escape sequence in ${id}`); - } - - if (type === 'x') { - if (code.length !== 2) { - throw new Error(`Hexadecimal escape sequence in ${id} must be two characters`); - } - - return String.fromCharCode(parseInt(code, 16)); - } else { - if (code.length < 4 || code.length > 6) { - throw new Error( - `Unicode escape sequence in ${id} must be between four and six characters` - ); - } - - return String.fromCharCode(parseInt(code, 16)); - } - }); - - if (/\]\[/.test(unescaped)) { - throw new Error(`Invalid route ${id} — parameters must be separated`); - } - - if (count_occurrences('[', id) !== count_occurrences(']', id)) { - throw new Error(`Invalid route ${id} — brackets are unbalanced`); - } - - if (/#/.test(segment)) { - // Vite will barf on files with # in them - throw new Error(`Route ${id} should be renamed to ${id.replace(/#/g, '[x+23]')}`); - } - - if (/\[\.\.\.\w+\]\/\[\[/.test(id)) { - throw new Error( - `Invalid route ${id} — an [[optional]] route segment cannot follow a [...rest] route segment` - ); - } - - if (/\[\[\.\.\./.test(id)) { - throw new Error( - `Invalid route ${id} — a rest route segment is always optional, remove the outer square brackets` - ); - } - - const { pattern, params } = parse_route_id(id); - - /** @type {import('types').RouteData} */ - const route = { - id, - parent, - - segment, - pattern, - params, - - layout: null, - error: null, - leaf: null, - page: null, - endpoint: null - }; - - // important to do this before walking children, so that child - // routes appear later - routes.push(route); - - // if we don't do this, the route map becomes unwieldy to console.log - Object.defineProperty(route, 'parent', { enumerable: false }); - - const dir = path.join(cwd, routes_base, id); - - // We can't use withFileTypes because of a NodeJs bug which returns wrong results - // with isDirectory() in case of symlinks: https://github.com/nodejs/node/issues/30646 - const files = fs.readdirSync(dir).map((name) => ({ - is_dir: fs.statSync(path.join(dir, name)).isDirectory(), - name - })); - - // process files first - for (const file of files) { - if (file.is_dir) continue; - - const ext = valid_extensions.find((ext) => file.name.endsWith(ext)); - if (!ext) continue; - - if (!file.name.startsWith('+')) { - const name = file.name.slice(0, -ext.length); - // check if it is a valid route filename but missing the + prefix - const typo = - /^(?:(page(?:@(.*))?)|(layout(?:@(.*))?)|(error))$/.test(name) || - /^(?:(server)|(page(?:(@[a-zA-Z0-9_-]*))?(\.server)?)|(layout(?:(@[a-zA-Z0-9_-]*))?(\.server)?))$/.test( - name - ); - if (typo) { - console.log( - colors - .bold() - .yellow( - `Missing route file prefix. Did you mean +${file.name}?` + - ` at ${path.join(dir, file.name)}` - ) - ); - } - - continue; - } - - if (file.name.endsWith('.d.ts')) { - let name = file.name.slice(0, -5); - const ext = valid_extensions.find((ext) => name.endsWith(ext)); - if (ext) name = name.slice(0, -ext.length); - - const valid = - /^\+(?:(page(?:@(.*))?)|(layout(?:@(.*))?)|(error))$/.test(name) || - /^\+(?:(server)|(page(?:(@[a-zA-Z0-9_-]*))?(\.server)?)|(layout(?:(@[a-zA-Z0-9_-]*))?(\.server)?))$/.test( - name - ); - - if (valid) continue; - } - - const project_relative = posixify(path.relative(cwd, path.join(dir, file.name))); - - const item = analyze( - project_relative, - file.name, - config.extensions, - config.kit.moduleExtensions - ); - - if (config.kit.router.type === 'hash' && item.kind === 'server') { - throw new Error( - `Cannot use server-only files in an app with \`router.type === 'hash': ${project_relative}` - ); - } - - /** - * @param {string} type - * @param {string} existing_file - */ - function duplicate_files_error(type, existing_file) { - return new Error( - `Multiple ${type} files found in ${routes_base}${route.id} : ${path.basename( - existing_file - )} and ${file.name}` - ); - } - - if (item.kind === 'component') { - if (item.is_error) { - route.error = { - depth, - component: project_relative - }; - } else if (item.is_layout) { - if (!route.layout) { - route.layout = { depth, child_pages: [] }; - } else if (route.layout.component) { - throw duplicate_files_error('layout component', route.layout.component); - } - - route.layout.component = project_relative; - if (item.uses_layout !== undefined) route.layout.parent_id = item.uses_layout; - } else { - if (!route.leaf) { - route.leaf = { depth }; - } else if (route.leaf.component) { - throw duplicate_files_error('page component', route.leaf.component); - } - - route.leaf.component = project_relative; - if (item.uses_layout !== undefined) route.leaf.parent_id = item.uses_layout; - } - } else if (item.is_layout) { - if (!route.layout) { - route.layout = { depth, child_pages: [] }; - } else if (route.layout[item.kind]) { - throw duplicate_files_error( - item.kind + ' layout module', - /** @type {string} */ (route.layout[item.kind]) - ); - } - - route.layout[item.kind] = project_relative; - } else if (item.is_page) { - if (!route.leaf) { - route.leaf = { depth }; - } else if (route.leaf[item.kind]) { - throw duplicate_files_error( - item.kind + ' page module', - /** @type {string} */ (route.leaf[item.kind]) - ); - } - - route.leaf[item.kind] = project_relative; - } else { - if (route.endpoint) { - throw duplicate_files_error('endpoint', route.endpoint.file); - } - - route.endpoint = { - file: project_relative, - page_options: null // will be filled later - }; - } - } - - // then handle children - for (const file of files) { - if (file.is_dir) { - walk(depth + 1, path.posix.join(id, file.name), file.name, route); - } - } - }; - - walk(0, '/', '', null); - - if (routes.length === 1) { - const root = routes[0]; - if (!root.leaf && !root.error && !root.layout && !root.endpoint) { - throw new Error( - 'No routes found. If you are using a custom src/routes directory, make sure it is specified in your Svelte config file' - ); - } - } - } else { - // If there's no routes directory, we'll just create a single empty route. This ensures the root layout and - // error components are included in the manifest, which is needed for subsequent build/dev commands to work - routes.push({ - id: '/', - segment: '', - pattern: /^$/, - params: [], - parent: null, - layout: null, - error: null, - leaf: null, - page: null, - endpoint: null - }); - } - - prevent_conflicts(routes); - - const root = routes[0]; - - if (!root.layout?.component) { - if (!root.layout) root.layout = { depth: 0, child_pages: [] }; - root.layout.component = posixify(path.relative(cwd, `${fallback}/layout.svelte`)); - } - - if (!root.error?.component) { - if (!root.error) root.error = { depth: 0 }; - root.error.component = posixify(path.relative(cwd, `${fallback}/error.svelte`)); - } - - // we do layouts/errors first as they are more likely to be reused, - // and smaller indexes take fewer bytes. also, this guarantees that - // the default error/layout are 0/1 - for (const route of routes) { - if (route.layout) { - if (!route.layout?.component) { - route.layout.component = posixify(path.relative(cwd, `${fallback}/layout.svelte`)); - } - nodes.push(route.layout); - } - if (route.error) nodes.push(route.error); - } - - for (const route of routes) { - if (route.leaf) nodes.push(route.leaf); - } - - const indexes = new Map(nodes.map((node, i) => [node, i])); - - const node_analyser = create_node_analyser(); - - for (const route of routes) { - if (!route.leaf) continue; - - route.page = { - layouts: [], - errors: [], - leaf: /** @type {number} */ (indexes.get(route.leaf)) - }; - - /** @type {import('types').RouteData | null} */ - let current_route = route; - let current_node = route.leaf; - let parent_id = route.leaf.parent_id; - - while (current_route) { - if (parent_id === undefined || current_route.segment === parent_id) { - if (current_route.layout || current_route.error) { - route.page.layouts.unshift( - current_route.layout ? indexes.get(current_route.layout) : undefined - ); - route.page.errors.unshift( - current_route.error ? indexes.get(current_route.error) : undefined - ); - } - - if (current_route.layout) { - /** @type {import('types').PageNode[]} */ (current_route.layout.child_pages).push( - route.leaf - ); - current_node.parent = current_node = current_route.layout; - parent_id = current_node.parent_id; - } else { - parent_id = undefined; - } - } - - current_route = current_route.parent; - } - - if (parent_id !== undefined) { - throw new Error(`${current_node.component} references missing segment "${parent_id}"`); - } - } - - for (const node of nodes) { - node.page_options = node_analyser.get_page_options(node); - } - - for (const route of routes) { - if (route.endpoint) { - route.endpoint.page_options = get_page_options(route.endpoint.file); - } - } - - return { - nodes, - routes: sort_routes(routes) - }; -} - -/** - * @param {string} project_relative - * @param {string} file - * @param {string[]} component_extensions - * @param {string[]} module_extensions - * @returns {import('./types.js').RouteFile} - */ -function analyze(project_relative, file, component_extensions, module_extensions) { - const component_extension = component_extensions.find((ext) => file.endsWith(ext)); - if (component_extension) { - const name = file.slice(0, -component_extension.length); - const pattern = /^\+(?:(page(?:@(.*))?)|(layout(?:@(.*))?)|(error))$/; - const match = pattern.exec(name); - if (!match) { - throw new Error(`Files prefixed with + are reserved (saw ${project_relative})`); - } - - return { - kind: 'component', - is_page: !!match[1], - is_layout: !!match[3], - is_error: !!match[5], - uses_layout: match[2] ?? match[4] - }; - } - - const module_extension = module_extensions.find((ext) => file.endsWith(ext)); - if (module_extension) { - const name = file.slice(0, -module_extension.length); - const pattern = - /^\+(?:(server)|(page(?:(@[a-zA-Z0-9_-]*))?(\.server)?)|(layout(?:(@[a-zA-Z0-9_-]*))?(\.server)?))$/; - const match = pattern.exec(name); - if (!match) { - throw new Error(`Files prefixed with + are reserved (saw ${project_relative})`); - } else if (match[3] || match[6]) { - throw new Error( - // prettier-ignore - `Only Svelte files can reference named layouts. Remove '${match[3] || match[6]}' from ${file} (at ${project_relative})` - ); - } - - const kind = match[1] || match[4] || match[7] ? 'server' : 'universal'; - - return { - kind, - is_page: !!match[2], - is_layout: !!match[5] - }; - } - - throw new Error(`Files and directories prefixed with + are reserved (saw ${project_relative})`); -} - -/** - * @param {string} needle - * @param {string} haystack - */ -function count_occurrences(needle, haystack) { - let count = 0; - for (let i = 0; i < haystack.length; i += 1) { - if (haystack[i] === needle) count += 1; - } - return count; -} - -/** @param {import('types').RouteData[]} routes */ -function prevent_conflicts(routes) { - /** @type {Map} */ - const lookup = new Map(); - - for (const route of routes) { - if (!route.leaf && !route.endpoint) continue; - - const normalized = normalize_route_id(route.id); - - // find all permutations created by optional parameters - const split = normalized.split(/<\?(.+?)>/g); - - let permutations = [/** @type {string} */ (split[0])]; - - // turn `x/[[optional]]/y` into `x/y` and `x/[required]/y` - for (let i = 1; i < split.length; i += 2) { - const matcher = split[i]; - const next = split[i + 1]; - - permutations = permutations.reduce((a, b) => { - a.push(b + next); - if (!(matcher === '*' && b.endsWith('//'))) a.push(b + `<${matcher}>${next}`); - return a; - }, /** @type {string[]} */ ([])); - } - - for (const permutation of permutations) { - // remove leading/trailing/duplicated slashes caused by prior - // manipulation of optional parameters and (groups) - const key = permutation - .replace(/\/{2,}/, '/') - .replace(/^\//, '') - .replace(/\/$/, ''); - - if (lookup.has(key)) { - throw new Error( - `The "${lookup.get(key)}" and "${route.id}" routes conflict with each other` - ); - } - - lookup.set(key, route.id); - } - } -} - -/** @param {string} id */ -function normalize_route_id(id) { - return ( - id - // remove groups - .replace(/(?<=^|\/)\(.+?\)(?=$|\/)/g, '') - - .replace(/\[[ux]\+([0-9a-f]+)\]/g, (_, x) => - String.fromCharCode(parseInt(x, 16)).replace(/\//g, '%2f') - ) - - // replace `[param]` with `<*>`, `[param=x]` with ``, and `[[param]]` with `` - .replace( - /\[(?:(\[)|(\.\.\.))?.+?(=.+?)?\]\]?/g, - (_, optional, rest, matcher) => `<${optional ? '?' : ''}${rest ?? ''}${matcher ?? '*'}>` - ) - ); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/sort.js b/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/sort.js deleted file mode 100644 index 1629d14..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/sort.js +++ /dev/null @@ -1,162 +0,0 @@ -import { get_route_segments } from '../../../utils/routing.js'; - -/** - * @typedef {{ - * type: 'static' | 'required' | 'optional' | 'rest'; - * content: string; - * matched: boolean; - * }} Part - */ - -/** - * @typedef {Part[]} Segment - */ - -const EMPTY = { type: 'static', content: '', matched: false }; - -/** @param {import('types').RouteData[]} routes */ -export function sort_routes(routes) { - /** @type {Map} */ - const segment_cache = new Map(); - - /** @param {string} segment */ - function get_parts(segment) { - if (!segment_cache.has(segment)) { - segment_cache.set(segment, split(segment)); - } - - return segment_cache.get(segment); - } - - /** @param {string} id */ - function split(id) { - /** @type {Part[]} */ - const parts = []; - - let i = 0; - while (i <= id.length) { - const start = id.indexOf('[', i); - if (start === -1) { - parts.push({ type: 'static', content: id.slice(i), matched: false }); - break; - } - - parts.push({ type: 'static', content: id.slice(i, start), matched: false }); - - const type = id[start + 1] === '[' ? 'optional' : id[start + 1] === '.' ? 'rest' : 'required'; - const delimiter = type === 'optional' ? ']]' : ']'; - const end = id.indexOf(delimiter, start); - - if (end === -1) { - throw new Error(`Invalid route ID ${id}`); - } - - const content = id.slice(start, (i = end + delimiter.length)); - - parts.push({ - type, - content, - matched: content.includes('=') - }); - } - - return parts; - } - - return routes.sort((route_a, route_b) => { - const segments_a = split_route_id(route_a.id).map(get_parts); - const segments_b = split_route_id(route_b.id).map(get_parts); - - for (let i = 0; i < Math.max(segments_a.length, segments_b.length); i += 1) { - const segment_a = segments_a[i] ?? [EMPTY]; - const segment_b = segments_b[i] ?? [EMPTY]; - - for (let j = 0; j < Math.max(segment_a.length, segment_b.length); j += 1) { - const a = segment_a[j]; - const b = segment_b[j]; - - // first part of each segment is always static - // (though it may be the empty string), then - // it alternates between dynamic and static - // (i.e. [foo][bar] is disallowed) - const dynamic = j % 2 === 1; - - if (dynamic) { - if (!a) return -1; - if (!b) return +1; - - // get the next static chunk, so we can handle [...rest] edge cases - const next_a = segment_a[j + 1].content || segments_a[i + 1]?.[0].content; - const next_b = segment_b[j + 1].content || segments_b[i + 1]?.[0].content; - - // `[...rest]/x` outranks `[...rest]` - if (a.type === 'rest' && b.type === 'rest') { - if (next_a && next_b) continue; - if (next_a) return -1; - if (next_b) return +1; - } - - // `[...rest]/x` outranks `[required]` or `[required]/[required]` - // but not `[required]/x` - if (a.type === 'rest') { - return next_a && !next_b ? -1 : +1; - } - - if (b.type === 'rest') { - return next_b && !next_a ? +1 : -1; - } - - // part with matcher outranks one without - if (a.matched !== b.matched) { - return a.matched ? -1 : +1; - } - - if (a.type !== b.type) { - // `[...rest]` has already been accounted for, so here - // we're comparing between `[required]` and `[[optional]]` - if (a.type === 'required') return -1; - if (b.type === 'required') return +1; - } - } else if (a.content !== b.content) { - // shallower path outranks deeper path - if (a === EMPTY) return -1; - if (b === EMPTY) return +1; - - return sort_static(a.content, b.content); - } - } - } - - return route_a.id < route_b.id ? +1 : -1; - }); -} - -/** @param {string} id */ -function split_route_id(id) { - return get_route_segments( - id - // remove all [[optional]] parts unless they're at the very end - // or it ends with a route group - .replace(/\[\[[^\]]+\]\](?!(?:\/\([^/]+\))*$)/g, '') - ).filter(Boolean); -} - -/** - * Sort two strings lexicographically, except `foobar` outranks `foo` - * @param {string} a - * @param {string} b - */ -function sort_static(a, b) { - if (a === b) return 0; - - for (let i = 0; true; i += 1) { - const char_a = a[i]; - const char_b = b[i]; - - if (char_a !== char_b) { - if (char_a === undefined) return +1; - if (char_b === undefined) return -1; - return char_a < char_b ? -1 : +1; - } - } -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/types.d.ts b/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/types.d.ts deleted file mode 100644 index ec5c01b..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/create_manifest_data/types.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { PageNode } from 'types'; - -interface Part { - dynamic: boolean; - optional: boolean; - rest: boolean; - type: string | null; -} - -interface RouteTreeNode { - error: PageNode | undefined; - layout: PageNode | undefined; -} - -export type RouteTree = Map; - -interface RouteComponent { - kind: 'component'; - is_page: boolean; - is_layout: boolean; - is_error: boolean; - uses_layout: string | undefined; -} - -interface RouteSharedModule { - kind: 'universal'; - is_page: boolean; - is_layout: boolean; -} - -interface RouteServerModule { - kind: 'server'; - is_page: boolean; - is_layout: boolean; -} - -export type RouteFile = RouteComponent | RouteSharedModule | RouteServerModule; diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/sync.js b/web/node_modules/@sveltejs/kit/src/core/sync/sync.js deleted file mode 100644 index d9680e8..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/sync.js +++ /dev/null @@ -1,96 +0,0 @@ -import path from 'node:path'; -import create_manifest_data from './create_manifest_data/index.js'; -import { write_client_manifest } from './write_client_manifest.js'; -import { write_root } from './write_root.js'; -import { write_tsconfig } from './write_tsconfig.js'; -import { write_types, write_all_types } from './write_types/index.js'; -import { write_ambient } from './write_ambient.js'; -import { write_non_ambient } from './write_non_ambient.js'; -import { write_server } from './write_server.js'; -import { - create_node_analyser, - get_page_options -} from '../../exports/vite/static_analysis/index.js'; - -/** - * Initialize SvelteKit's generated files that only depend on the config and mode. - * @param {import('types').ValidatedConfig} config - * @param {string} mode - */ -export function init(config, mode) { - write_tsconfig(config.kit); - write_ambient(config.kit, mode); -} - -/** - * Update SvelteKit's generated files - * @param {import('types').ValidatedConfig} config - */ -export function create(config) { - const manifest_data = create_manifest_data({ config }); - - const output = path.join(config.kit.outDir, 'generated'); - - write_client_manifest(config.kit, manifest_data, `${output}/client`); - write_server(config, output); - write_root(manifest_data, config, output); - write_all_types(config, manifest_data); - write_non_ambient(config.kit, manifest_data); - - return { manifest_data }; -} - -/** - * Update SvelteKit's generated files in response to a single file content update. - * Do not call this when the file in question was created/deleted. - * - * @param {import('types').ValidatedConfig} config - * @param {import('types').ManifestData} manifest_data - * @param {string} file - */ -export function update(config, manifest_data, file) { - const node_analyser = create_node_analyser(); - - for (const node of manifest_data.nodes) { - node.page_options = node_analyser.get_page_options(node); - } - - for (const route of manifest_data.routes) { - if (route.endpoint) { - route.endpoint.page_options = get_page_options(route.endpoint.file); - } - } - - write_types(config, manifest_data, file); - write_non_ambient(config.kit, manifest_data); -} - -/** - * Run sync.init and sync.create in series, returning the result from sync.create. - * @param {import('types').ValidatedConfig} config - * @param {string} mode The Vite mode - */ -export function all(config, mode) { - init(config, mode); - return create(config); -} - -/** - * Run sync.init and then generate all type files. - * @param {import('types').ValidatedConfig} config - * @param {string} mode The Vite mode - */ -export function all_types(config, mode) { - init(config, mode); - const manifest_data = create_manifest_data({ config }); - write_all_types(config, manifest_data); - write_non_ambient(config.kit, manifest_data); -} - -/** - * Regenerate __SERVER__/internal.js in response to src/{app.html,error.html,service-worker.js} changing - * @param {import('types').ValidatedConfig} config - */ -export function server(config) { - write_server(config, path.join(config.kit.outDir, 'generated')); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/ts.js b/web/node_modules/@sveltejs/kit/src/core/sync/ts.js deleted file mode 100644 index 61c79e3..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/ts.js +++ /dev/null @@ -1,6 +0,0 @@ -/** @type {import('typescript')} */ -// @ts-ignore -export let ts = undefined; -try { - ts = (await import('typescript')).default; -} catch {} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/utils.js b/web/node_modules/@sveltejs/kit/src/core/sync/utils.js deleted file mode 100644 index be3ecc2..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/utils.js +++ /dev/null @@ -1,78 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { mkdirp } from '../../utils/filesystem.js'; -import { import_peer } from '../../utils/import.js'; - -/** @type {{ VERSION: string }} */ -const { VERSION } = await import_peer('svelte/compiler'); - -/** @type {Map} */ -const previous_contents = new Map(); - -/** - * @param {string} file - * @param {string} code - */ -export function write_if_changed(file, code) { - if (code !== previous_contents.get(file)) { - write(file, code); - } -} - -/** - * @param {string} file - * @param {string} code - */ -export function write(file, code) { - previous_contents.set(file, code); - mkdirp(path.dirname(file)); - fs.writeFileSync(file, code); -} - -/** @type {WeakMap} */ -const dedent_map = new WeakMap(); - -/** - * Allows indenting template strings without the extra indentation ending up in the result. - * Still allows indentation of lines relative to one another in the template string. - * @param {TemplateStringsArray} strings - * @param {any[]} values - */ -export function dedent(strings, ...values) { - let dedented = dedent_map.get(strings); - - if (!dedented) { - const indentation = /** @type {RegExpExecArray} */ (/\n?([ \t]*)/.exec(strings[0]))[1]; - const pattern = new RegExp(`^${indentation}`, 'gm'); - - dedented = { - strings: strings.map((str) => str.replace(pattern, '')), - indents: [] - }; - - let current = '\n'; - - for (let i = 0; i < values.length; i += 1) { - const string = dedented.strings[i]; - const match = /\n([ \t]*)$/.exec(string); - - if (match) current = match[0]; - dedented.indents[i] = current; - } - - dedent_map.set(strings, dedented); - } - - let str = dedented.strings[0]; - for (let i = 0; i < values.length; i += 1) { - str += String(values[i]).replace(/\n/g, dedented.indents[i]) + dedented.strings[i + 1]; - } - - str = str.trim(); - - return str; -} - -export function isSvelte5Plus() { - return Number(VERSION[0]) >= 5; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_ambient.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_ambient.js deleted file mode 100644 index 1f21880..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_ambient.js +++ /dev/null @@ -1,63 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { get_env } from '../../exports/vite/utils.js'; -import { GENERATED_COMMENT } from '../../constants.js'; -import { create_dynamic_types, create_static_types } from '../env.js'; -import { write_if_changed } from './utils.js'; - -// TODO these types should be described in a neutral place, rather than -// inside either `packages/kit` or `svelte.dev/docs/kit` -const descriptions_dir = fileURLToPath(new URL('../../../src/types/synthetic', import.meta.url)); - -/** @param {string} filename */ -function read_description(filename) { - const content = fs.readFileSync(`${descriptions_dir}/${filename}`, 'utf8'); - return `/**\n${content - .trim() - .split('\n') - .map((line) => ` * ${line}`) - .join('\n')}\n */`; -} - -/** - * @param {import('types').Env} env - * @param {{ - * public_prefix: string; - * private_prefix: string; - * }} prefixes - */ -const template = (env, prefixes) => ` -${GENERATED_COMMENT} - -/// - -${read_description('$env+static+private.md')} -${create_static_types('private', env)} - -${read_description('$env+static+public.md')} -${create_static_types('public', env)} - -${read_description('$env+dynamic+private.md')} -${create_dynamic_types('private', env, prefixes)} - -${read_description('$env+dynamic+public.md')} -${create_dynamic_types('public', env, prefixes)} -`; - -/** - * Writes ambient declarations including types reference to @sveltejs/kit, - * and the existing environment variables in process.env to - * $env/static/private and $env/static/public - * @param {import('types').ValidatedKitConfig} config - * @param {string} mode The Vite mode - */ -export function write_ambient(config, mode) { - const env = get_env(config.env, mode); - const { publicPrefix: public_prefix, privatePrefix: private_prefix } = config.env; - - write_if_changed( - path.join(config.outDir, 'ambient.d.ts'), - template(env, { public_prefix, private_prefix }) - ); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_client_manifest.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_client_manifest.js deleted file mode 100644 index 7495e31..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_client_manifest.js +++ /dev/null @@ -1,203 +0,0 @@ -import path from 'node:path'; -import { relative_path, resolve_entry } from '../../utils/filesystem.js'; -import { s } from '../../utils/misc.js'; -import { dedent, isSvelte5Plus, write_if_changed } from './utils.js'; -import colors from 'kleur'; - -/** - * Writes the client manifest to disk. The manifest is used to power the router. It contains the - * list of routes and corresponding Svelte components (i.e. pages and layouts). - * @param {import('types').ValidatedKitConfig} kit - * @param {import('types').ManifestData} manifest_data - * @param {string} output - * @param {import('types').ServerMetadata['nodes']} [metadata] If this is omitted, we have to assume that all routes with a `+layout/page.server.js` file have a server load function - */ -export function write_client_manifest(kit, manifest_data, output, metadata) { - const client_routing = kit.router.resolution === 'client'; - - /** - * Creates a module that exports a `CSRPageNode` - * @param {import('types').PageNode} node - */ - function generate_node(node) { - const declarations = []; - - if (node.universal) { - declarations.push( - `import * as universal from ${s(relative_path(`${output}/nodes`, node.universal))};`, - 'export { universal };' - ); - } - - if (node.component) { - declarations.push( - `export { default as component } from ${s( - relative_path(`${output}/nodes`, node.component) - )};` - ); - } - - return declarations.join('\n'); - } - - /** @type {Map} */ - const indices = new Map(); - const nodes = manifest_data.nodes - .map((node, i) => { - indices.set(node, i); - - write_if_changed(`${output}/nodes/${i}.js`, generate_node(node)); - return `() => import('./nodes/${i}')`; - }) - // If route resolution happens on the server, we only need the root layout and root error page - // upfront, the rest is loaded on demand as the user navigates the app - .slice(0, client_routing ? manifest_data.nodes.length : 2) - .join(',\n'); - - const layouts_with_server_load = new Set(); - - let dictionary = dedent` - { - ${manifest_data.routes - .map((route) => { - if (route.page) { - const errors = route.page.errors.slice(1).map((n) => n ?? ''); - const layouts = route.page.layouts.slice(1).map((n) => n ?? ''); - - while (layouts.at(-1) === '') layouts.pop(); - while (errors.at(-1) === '') errors.pop(); - - let leaf_has_server_load = false; - if (route.leaf) { - if (metadata) { - const i = /** @type {number} */ (indices.get(route.leaf)); - - leaf_has_server_load = metadata[i].has_server_load; - } else if (route.leaf.server) { - leaf_has_server_load = true; - } - } - - // Encode whether or not the route uses server data - // using the ones' complement, to save space - const array = [`${leaf_has_server_load ? '~' : ''}${route.page.leaf}`]; - - // Encode whether or not the layout uses server data. - // It's a different method compared to pages because layouts - // are reused across pages, so we save space by doing it this way. - route.page.layouts.forEach((layout) => { - if (layout == undefined) return; - - let layout_has_server_load = false; - - if (metadata) { - layout_has_server_load = metadata[layout].has_server_load; - } else if (manifest_data.nodes[layout].server) { - layout_has_server_load = true; - } - - if (layout_has_server_load) { - layouts_with_server_load.add(layout); - } - }); - - // only include non-root layout/error nodes if they exist - if (layouts.length > 0 || errors.length > 0) array.push(`[${layouts.join(',')}]`); - if (errors.length > 0) array.push(`[${errors.join(',')}]`); - - return `${s(route.id)}: [${array.join(',')}]`; - } - }) - .filter(Boolean) - .join(',\n')} - } - `; - - if (!client_routing) { - dictionary = '{}'; - const root_layout = layouts_with_server_load.has(0); - layouts_with_server_load.clear(); - if (root_layout) layouts_with_server_load.add(0); - } - - const client_hooks_file = resolve_entry(kit.files.hooks.client); - const universal_hooks_file = resolve_entry(kit.files.hooks.universal); - - const typo = resolve_entry('src/+hooks.client'); - if (typo) { - console.log( - colors - .bold() - .yellow( - `Unexpected + prefix. Did you mean ${typo.split('/').at(-1)?.slice(1)}?` + - ` at ${path.resolve(typo)}` - ) - ); - } - - // Stringified version of - /** @type {import('../../runtime/client/types.js').SvelteKitApp} */ - write_if_changed( - `${output}/app.js`, - dedent` - ${ - client_hooks_file - ? `import * as client_hooks from '${relative_path(output, client_hooks_file)}';` - : '' - } - ${ - universal_hooks_file - ? `import * as universal_hooks from '${relative_path(output, universal_hooks_file)}';` - : '' - } - - ${client_routing ? "export { matchers } from './matchers.js';" : 'export const matchers = {};'} - - export const nodes = [ - ${nodes} - ]; - - export const server_loads = [${[...layouts_with_server_load].join(',')}]; - - export const dictionary = ${dictionary}; - - export const hooks = { - handleError: ${ - client_hooks_file ? 'client_hooks.handleError || ' : '' - }(({ error }) => { console.error(error) }), - ${client_hooks_file ? 'init: client_hooks.init,' : ''} - reroute: ${universal_hooks_file ? 'universal_hooks.reroute || ' : ''}(() => {}), - transport: ${universal_hooks_file ? 'universal_hooks.transport || ' : ''}{} - }; - - export const decoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.decode])); - export const encoders = Object.fromEntries(Object.entries(hooks.transport).map(([k, v]) => [k, v.encode])); - - export const hash = ${s(kit.router.type === 'hash')}; - - export const decode = (type, value) => decoders[type](value); - - export { default as root } from '../root.${isSvelte5Plus() ? 'js' : 'svelte'}'; - ` - ); - - if (client_routing) { - // write matchers to a separate module so that we don't - // need to worry about name conflicts - const imports = []; - const matchers = []; - - for (const key in manifest_data.matchers) { - const src = manifest_data.matchers[key]; - - imports.push(`import { match as ${key} } from ${s(relative_path(output, src))};`); - matchers.push(key); - } - - const module = imports.length - ? `${imports.join('\n')}\n\nexport const matchers = { ${matchers.join(', ')} };` - : 'export const matchers = {};'; - - write_if_changed(`${output}/matchers.js`, module); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_non_ambient.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_non_ambient.js deleted file mode 100644 index 3b92b73..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_non_ambient.js +++ /dev/null @@ -1,266 +0,0 @@ -import path from 'node:path'; -import { GENERATED_COMMENT } from '../../constants.js'; -import { posixify } from '../../utils/filesystem.js'; -import { write_if_changed } from './utils.js'; -import { s } from '../../utils/misc.js'; -import { get_route_segments } from '../../utils/routing.js'; - -const replace_optional_params = (/** @type {string} */ id) => - id.replace(/\/\[\[[^\]]+\]\]/g, '${string}'); -const replace_required_params = (/** @type {string} */ id) => - id.replace(/\/\[[^\]]+\]/g, '/${string}'); -/** Convert route ID to pathname by removing layout groups */ -const remove_group_segments = (/** @type {string} */ id) => { - return '/' + get_route_segments(id).join('/'); -}; - -/** - * Get pathnames to add based on trailingSlash settings - * @param {string} pathname - * @param {import('types').RouteData} route - * @returns {string[]} - */ -function get_pathnames_for_trailing_slash(pathname, route) { - if (pathname === '/') { - return [pathname]; - } - - /** @type {Set} */ - const pathnames = new Set(); - - /** - * @param {{ trailingSlash?: import('types').TrailingSlash } | null | undefined} page_options - */ - const add_pathnames = (page_options) => { - if (page_options === null || page_options?.trailingSlash === 'ignore') { - pathnames.add(pathname); - pathnames.add(pathname + '/'); - } else if (page_options?.trailingSlash === 'always') { - pathnames.add(pathname + '/'); - } else { - pathnames.add(pathname); - } - }; - - if (route.leaf) add_pathnames(route.leaf.page_options ?? null); - if (route.endpoint) add_pathnames(route.endpoint.page_options); - - return Array.from(pathnames); -} - -// `declare module "svelte/elements"` needs to happen in a non-ambient module, and dts-buddy generates one big ambient module, -// so we can't add it there - therefore generate the typings ourselves here. -// We're not using the `declare namespace svelteHTML` variant because that one doesn't augment the HTMLAttributes interface -// people could use to type their own components. -// The T generic is needed or else there's a "all declarations must have identical type parameters" error. -const template = ` -${GENERATED_COMMENT} - -declare module "svelte/elements" { - export interface HTMLAttributes { - 'data-sveltekit-keepfocus'?: true | '' | 'off' | undefined | null; - 'data-sveltekit-noscroll'?: true | '' | 'off' | undefined | null; - 'data-sveltekit-preload-code'?: - | true - | '' - | 'eager' - | 'viewport' - | 'hover' - | 'tap' - | 'off' - | undefined - | null; - 'data-sveltekit-preload-data'?: true | '' | 'hover' | 'tap' | 'off' | undefined | null; - 'data-sveltekit-reload'?: true | '' | 'off' | undefined | null; - 'data-sveltekit-replacestate'?: true | '' | 'off' | undefined | null; - } -} - -export {}; -`; - -/** - * Generate app types interface extension - * @param {import('types').ManifestData} manifest_data - * @param {import('types').ValidatedKitConfig} config - */ -function generate_app_types(manifest_data, config) { - /** @param {string} matcher */ - const path_to_matcher = (matcher) => - posixify(path.relative(config.outDir, path.join(config.files.params, matcher + '.js'))); - - /** @type {Map} */ - const matcher_types = new Map(); - - /** @param {string | undefined} matcher */ - const get_matcher_type = (matcher) => { - if (!matcher) return 'string'; - - let type = matcher_types.get(matcher); - if (!type) { - type = `MatcherParam`; - matcher_types.set(matcher, type); - } - - return type; - }; - - /** @param {Set | null} matchers */ - const get_matchers_type = (matchers) => { - if (matchers === null) return 'string'; - - return Array.from(matchers) - .map((matcher) => get_matcher_type(matcher)) - .join(' | '); - }; - - /** @type {Set} */ - const route_ids = new Set(manifest_data.routes.map((route) => route.id)); - - /** - * @param {string} id - * @returns {string[]} - */ - const get_ancestor_route_ids = (id) => { - /** @type {string[]} */ - const ancestors = []; - - if (route_ids.has('/')) { - ancestors.push('/'); - } - - let current = ''; - for (const segment of id.slice(1).split('/')) { - if (!segment) continue; - - current += '/' + segment; - if (route_ids.has(current)) { - ancestors.push(current); - } - } - - return ancestors; - }; - - /** @type {Set} */ - const pathnames = new Set(); - - /** @type {string[]} */ - const dynamic_routes = []; - - /** @type {string[]} */ - const layouts = []; - - /** @type {Map | null }>>} */ - const layout_params_by_route = new Map( - manifest_data.routes.map((route) => [ - route.id, - new Map( - route.params.map((p) => [ - p.name, - { optional: p.optional, matchers: p.matcher ? new Set([p.matcher]) : null } - ]) - ) - ]) - ); - - for (const route of manifest_data.routes) { - const ancestors = get_ancestor_route_ids(route.id); - - for (const ancestor_id of ancestors) { - const ancestor_params = layout_params_by_route.get(ancestor_id); - if (!ancestor_params) continue; - - for (const p of route.params) { - const matcher = p.matcher ?? null; - const entry = ancestor_params.get(p.name); - if (!entry) { - ancestor_params.set(p.name, { - optional: true, - matchers: matcher === null ? null : new Set([matcher]) - }); - continue; - } - - if (entry.matchers === null) continue; - - if (matcher === null) { - entry.matchers = null; - continue; - } - - entry.matchers.add(matcher); - } - } - } - - for (const route of manifest_data.routes) { - const pathname = remove_group_segments(route.id); - let normalized_pathname = pathname; - - /** @type {(path: string) => string} */ - let serialise = s; - - if (route.params.length > 0) { - const params = route.params.map((p) => { - const type = get_matcher_type(p.matcher); - return `${p.name}${p.optional ? '?:' : ':'} ${type}`; - }); - const route_type = `${s(route.id)}: { ${params.join('; ')} }`; - - dynamic_routes.push(route_type); - - normalized_pathname = replace_required_params(replace_optional_params(pathname)); - serialise = (p) => `\`${p}\` & {}`; - } - - for (const p of get_pathnames_for_trailing_slash(normalized_pathname, route)) { - pathnames.add(serialise(p)); - } - - let layout_type = 'Record'; - - const layout_params = layout_params_by_route.get(route.id); - if (layout_params) { - const params = Array.from(layout_params) - .map(([name, { optional, matchers }]) => { - const type = get_matchers_type(matchers); - return `${name}${optional ? '?:' : ':'} ${type}`; - }) - .join('; '); - - if (params.length > 0) layout_type = `{ ${params} }`; - } - - layouts.push(`${s(route.id)}: ${layout_type}`); - } - - const assets = manifest_data.assets.map((asset) => s('/' + asset.file)); - - return [ - 'declare module "$app/types" {', - '\ttype MatcherParam = M extends (param : string) => param is (infer U extends string) ? U : string;', - '', - '\texport interface AppTypes {', - `\t\tRouteId(): ${manifest_data.routes.map((r) => s(r.id)).join(' | ')};`, - `\t\tRouteParams(): {\n\t\t\t${dynamic_routes.join(';\n\t\t\t')}\n\t\t};`, - `\t\tLayoutParams(): {\n\t\t\t${layouts.join(';\n\t\t\t')}\n\t\t};`, - `\t\tPathname(): ${Array.from(pathnames).join(' | ')};`, - '\t\tResolvedPathname(): `${"" | `/${string}`}${ReturnType}`;', - `\t\tAsset(): ${assets.concat('string & {}').join(' | ')};`, - '\t}', - '}' - ].join('\n'); -} - -/** - * Writes non-ambient declarations to the output directory - * @param {import('types').ValidatedKitConfig} config - * @param {import('types').ManifestData} manifest_data - */ -export function write_non_ambient(config, manifest_data) { - const app_types = generate_app_types(manifest_data, config); - const content = [template, app_types].join('\n\n'); - - write_if_changed(path.join(config.outDir, 'non-ambient.d.ts'), content); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_root.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_root.js deleted file mode 100644 index 445c17e..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_root.js +++ /dev/null @@ -1,196 +0,0 @@ -import { dedent, isSvelte5Plus, write_if_changed } from './utils.js'; - -/** - * @param {import('types').ManifestData} manifest_data - * @param {import('types').ValidatedConfig} config - * @param {string} output - */ -export function write_root(manifest_data, config, output) { - // TODO remove default layout altogether - - const use_boundaries = config.kit.experimental.handleRenderingErrors && isSvelte5Plus(); - - const max_depth = Math.max( - ...manifest_data.routes.map((route) => - route.page ? route.page.layouts.filter(Boolean).length + 1 : 0 - ), - 1 - ); - - const levels = []; - for (let i = 0; i <= max_depth; i += 1) { - levels.push(i); - } - - let l = max_depth; - /** @type {string} */ - let pyramid; - - if (isSvelte5Plus() && use_boundaries) { - // with the @const we force the data[depth] access to be derived, which is important to not fire updates needlessly - // TODO in Svelte 5 we should rethink the client.js side, we can likely make data a $state and only update indexes that changed there, simplifying this a lot - pyramid = dedent` - {#snippet pyramid(depth)} - {@const Pyramid = constructors[depth]} - {#snippet failed(error)} - {@const ErrorPage = errors[depth]} - - {/snippet} - - {#if constructors[depth + 1]} - {@const d = data[depth]} - - - {@render pyramid(depth + 1)} - - {:else} - {@const d = data[depth]} - - - {/if} - - {/snippet} - - {@render pyramid(0)} - `; - } else { - pyramid = dedent` - ${ - isSvelte5Plus() - ? ` - ` - : `` - }`; - - while (l--) { - pyramid = dedent` - {#if constructors[${l + 1}]} - ${ - isSvelte5Plus() - ? dedent`{@const Pyramid_${l} = constructors[${l}]} - - - ${pyramid} - ` - : dedent` - ${pyramid} - ` - } - - {:else} - ${ - isSvelte5Plus() - ? dedent` - {@const Pyramid_${l} = constructors[${l}]} - - - ` - : dedent`` - } - - {/if} - `; - } - } - - write_if_changed( - `${output}/root.svelte`, - dedent` - - ${isSvelte5Plus() ? '' : ''} - - - ${pyramid} - - {#if mounted} -
- {#if navigated} - {title} - {/if} -
- {/if} - ` - ); - - if (isSvelte5Plus()) { - write_if_changed( - `${output}/root.js`, - dedent` - import { asClassComponent } from 'svelte/legacy'; - import Root from './root.svelte'; - export default asClassComponent(Root); - ` - ); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_server.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_server.js deleted file mode 100644 index 711a007..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_server.js +++ /dev/null @@ -1,143 +0,0 @@ -import path from 'node:path'; -import process from 'node:process'; -import { hash } from '../../utils/hash.js'; -import { posixify, resolve_entry } from '../../utils/filesystem.js'; -import { s } from '../../utils/misc.js'; -import { load_error_page, load_template } from '../config/index.js'; -import { runtime_directory } from '../utils.js'; -import { isSvelte5Plus, write_if_changed } from './utils.js'; -import colors from 'kleur'; -import { escape_html } from '../../utils/escape.js'; - -/** - * @param {{ - * server_hooks: string | null; - * universal_hooks: string | null; - * config: import('types').ValidatedConfig; - * has_service_worker: boolean; - * runtime_directory: string; - * template: string; - * error_page: string; - * }} opts - */ -const server_template = ({ - config, - server_hooks, - universal_hooks, - has_service_worker, - runtime_directory, - template, - error_page -}) => ` -import root from '../root.${isSvelte5Plus() ? 'js' : 'svelte'}'; -import { set_building, set_prerendering } from '__sveltekit/environment'; -import { set_assets } from '$app/paths/internal/server'; -import { set_manifest, set_read_implementation } from '__sveltekit/server'; -import { set_private_env, set_public_env } from '${runtime_directory}/shared-server.js'; - -export const options = { - app_template_contains_nonce: ${template.includes('%sveltekit.nonce%')}, - async: ${s(!!config.compilerOptions?.experimental?.async)}, - csp: ${s(config.kit.csp)}, - csrf_check_origin: ${s(config.kit.csrf.checkOrigin && !config.kit.csrf.trustedOrigins.includes('*'))}, - csrf_trusted_origins: ${s(config.kit.csrf.trustedOrigins)}, - embedded: ${config.kit.embedded}, - env_public_prefix: '${config.kit.env.publicPrefix}', - env_private_prefix: '${config.kit.env.privatePrefix}', - hash_routing: ${s(config.kit.router.type === 'hash')}, - hooks: null, // added lazily, via \`get_hooks\` - preload_strategy: ${s(config.kit.output.preloadStrategy)}, - root, - service_worker: ${has_service_worker}, - service_worker_options: ${config.kit.serviceWorker.register ? s(config.kit.serviceWorker.options) : 'null'}, - server_error_boundaries: ${s(!!config.kit.experimental.handleRenderingErrors)}, - templates: { - app: ({ head, body, assets, nonce, env }) => ${s(template) - .replace('%sveltekit.head%', '" + head + "') - .replace('%sveltekit.body%', '" + body + "') - .replace(/%sveltekit\.assets%/g, '" + assets + "') - .replace(/%sveltekit\.nonce%/g, '" + nonce + "') - .replace(/%sveltekit\.version%/g, escape_html(config.kit.version.name)) - .replace( - /%sveltekit\.env\.([^%]+)%/g, - (_match, capture) => `" + (env[${s(capture)}] ?? "") + "` - )}, - error: ({ status, message }) => ${s(error_page) - .replace(/%sveltekit\.status%/g, '" + status + "') - .replace(/%sveltekit\.error\.message%/g, '" + message + "')} - }, - version_hash: ${s(hash(config.kit.version.name))} -}; - -export async function get_hooks() { - let handle; - let handleFetch; - let handleError; - let handleValidationError; - let init; - ${server_hooks ? `({ handle, handleFetch, handleError, handleValidationError, init } = await import(${s(server_hooks)}));` : ''} - - let reroute; - let transport; - ${universal_hooks ? `({ reroute, transport } = await import(${s(universal_hooks)}));` : ''} - - return { - handle, - handleFetch, - handleError, - handleValidationError, - init, - reroute, - transport - }; -} - -export { set_assets, set_building, set_manifest, set_prerendering, set_private_env, set_public_env, set_read_implementation }; -`; - -// TODO need to re-run this whenever src/app.html or src/error.html are -// created or changed, or src/service-worker.js is created or deleted. -// Also, need to check that updating hooks.server.js works - -/** - * Write server configuration to disk - * @param {import('types').ValidatedConfig} config - * @param {string} output - */ -export function write_server(config, output) { - const server_hooks_file = resolve_entry(config.kit.files.hooks.server); - const universal_hooks_file = resolve_entry(config.kit.files.hooks.universal); - - const typo = resolve_entry('src/+hooks.server'); - if (typo) { - console.log( - colors - .bold() - .yellow( - `Unexpected + prefix. Did you mean ${typo.split('/').at(-1)?.slice(1)}?` + - ` at ${path.resolve(typo)}` - ) - ); - } - - /** @param {string} file */ - function relative(file) { - return posixify(path.relative(`${output}/server`, file)); - } - - // Contains the stringified version of - /** @type {import('types').SSROptions} */ - write_if_changed( - `${output}/server/internal.js`, - server_template({ - config, - server_hooks: server_hooks_file ? relative(server_hooks_file) : null, - universal_hooks: universal_hooks_file ? relative(universal_hooks_file) : null, - has_service_worker: - config.kit.serviceWorker.register && !!resolve_entry(config.kit.files.serviceWorker), - runtime_directory: relative(runtime_directory), - template: load_template(process.cwd(), config), - error_page: load_error_page(config) - }) - ); -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_tsconfig.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_tsconfig.js deleted file mode 100644 index 9451c8a..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_tsconfig.js +++ /dev/null @@ -1,243 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import colors from 'kleur'; -import { posixify } from '../../utils/filesystem.js'; -import { write_if_changed } from './utils.js'; - -/** - * @param {string} cwd - * @param {string} file - */ -function maybe_file(cwd, file) { - const resolved = path.resolve(cwd, file); - if (fs.existsSync(resolved)) { - return resolved; - } -} - -/** - * @param {string} file - */ -function project_relative(file) { - return posixify(path.relative('.', file)); -} - -/** - * @param {string} file - */ -function remove_trailing_slashstar(file) { - if (file.endsWith('/*')) { - return file.slice(0, -2); - } else { - return file; - } -} - -/** - * Generates the tsconfig that the user's tsconfig inherits from. - * @param {import('types').ValidatedKitConfig} kit - */ -export function write_tsconfig(kit, cwd = process.cwd()) { - const out = path.join(kit.outDir, 'tsconfig.json'); - - const user_config = load_user_tsconfig(cwd); - if (user_config) validate_user_config(cwd, out, user_config); - - write_if_changed(out, JSON.stringify(get_tsconfig(kit), null, '\t')); -} - -/** - * Generates the tsconfig that the user's tsconfig inherits from. - * @param {import('types').ValidatedKitConfig} kit - */ -export function get_tsconfig(kit) { - /** @param {string} file */ - const config_relative = (file) => posixify(path.relative(kit.outDir, file)); - - const include = new Set([ - 'ambient.d.ts', // careful: changing this name would be a breaking change, because it's referenced in the service-workers documentation - 'non-ambient.d.ts', - './types/**/$types.d.ts', - config_relative('vite.config.js'), - config_relative('vite.config.ts') - ]); - const src_includes = [kit.files.routes, kit.files.lib, kit.files.src].filter((dir) => { - const relative = path.relative(kit.files.src, dir); - return !relative || relative.startsWith('..'); - }); - for (const dir of src_includes) { - include.add(config_relative(`${dir}/**/*.js`)); - include.add(config_relative(`${dir}/**/*.ts`)); - include.add(config_relative(`${dir}/**/*.svelte`)); - } - - // Test folder is a special case - we advocate putting tests in a top-level test folder - // and it's not configurable (should we make it?) - const test_folder = project_relative('test'); - include.add(config_relative(`${test_folder}/**/*.js`)); - include.add(config_relative(`${test_folder}/**/*.ts`)); - include.add(config_relative(`${test_folder}/**/*.svelte`)); - const tests_folder = project_relative('tests'); - include.add(config_relative(`${tests_folder}/**/*.js`)); - include.add(config_relative(`${tests_folder}/**/*.ts`)); - include.add(config_relative(`${tests_folder}/**/*.svelte`)); - - const exclude = [config_relative('node_modules/**')]; - // Add service worker to exclude list so that worker types references in it don't spill over into the rest of the app - // (i.e. suddenly ServiceWorkerGlobalScope would be available throughout the app, and some types might even clash) - if (path.extname(kit.files.serviceWorker)) { - exclude.push(config_relative(kit.files.serviceWorker)); - } else { - exclude.push(config_relative(`${kit.files.serviceWorker}.js`)); - exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.js`)); - exclude.push(config_relative(`${kit.files.serviceWorker}.ts`)); - exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.ts`)); - exclude.push(config_relative(`${kit.files.serviceWorker}.d.ts`)); - exclude.push(config_relative(`${kit.files.serviceWorker}/**/*.d.ts`)); - } - - const config = { - compilerOptions: { - // generated options - paths: { - ...get_tsconfig_paths(kit), - '$app/types': ['./types/index.d.ts'] - }, - rootDirs: [config_relative('.'), './types'], - - // essential options - // svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript - // to enforce using \`import type\` instead of \`import\` for Types. - // Also, TypeScript doesn't know about import usages in the template because it only sees the - // script of a Svelte file. Therefore preserve all value imports. - verbatimModuleSyntax: true, - // Vite compiles modules one at a time - isolatedModules: true, - - // This is required for svelte-package to work as expected - // Can be overwritten - lib: ['esnext', 'DOM', 'DOM.Iterable'], - moduleResolution: 'bundler', - module: 'esnext', - noEmit: true, // prevent tsconfig error "overwriting input files" - Vite handles the build and ignores this - target: 'esnext' - }, - include: [...include], - exclude - }; - - return kit.typescript.config(config) ?? config; -} - -/** @param {string} cwd */ -function load_user_tsconfig(cwd) { - const file = maybe_file(cwd, 'tsconfig.json') || maybe_file(cwd, 'jsconfig.json'); - - if (!file) return; - - // we have to eval the file, since it's not parseable as JSON (contains comments) - const json = fs.readFileSync(file, 'utf-8'); - - return { - kind: path.basename(file), - options: (0, eval)(`(${json})`) - }; -} - -/** - * @param {string} cwd - * @param {string} out - * @param {{ kind: string, options: any }} config - */ -function validate_user_config(cwd, out, config) { - // we need to check that the user's tsconfig extends the framework config - const extend = config.options.extends; - const extends_framework_config = - typeof extend === 'string' - ? path.resolve(cwd, extend) === out - : Array.isArray(extend) - ? extend.some((e) => path.resolve(cwd, e) === out) - : false; - - const options = config.options.compilerOptions || {}; - - if (extends_framework_config) { - const { paths, baseUrl } = options; - - if (baseUrl || paths) { - console.warn( - colors - .bold() - .yellow( - `You have specified a baseUrl and/or paths in your ${config.kind} which interferes with SvelteKit's auto-generated tsconfig.json. ` + - 'Remove it to avoid problems with intellisense. For path aliases, use `kit.alias` instead: https://svelte.dev/docs/kit/configuration#alias' - ) - ); - } - } else { - let relative = posixify(path.relative('.', out)); - if (!relative.startsWith('./')) relative = './' + relative; - - console.warn( - colors - .bold() - .yellow(`Your ${config.kind} should extend the configuration generated by SvelteKit:`) - ); - console.warn(`{\n "extends": "${relative}"\n}`); - } -} - -// -const alias_regex = /^(.+?)(\/\*)?$/; -// -const value_regex = /^(.*?)((\/\*)|(\.\w+))?$/; - -/** - * Generates tsconfig path aliases from kit's aliases. - * Related to vite alias creation. - * - * @param {import('types').ValidatedKitConfig} config - */ -function get_tsconfig_paths(config) { - /** @param {string} file */ - const config_relative = (file) => { - let relative_path = path.relative(config.outDir, file); - if (!relative_path.startsWith('..')) { - relative_path = './' + relative_path; - } - return posixify(relative_path); - }; - - const alias = { ...config.alias }; - if (fs.existsSync(project_relative(config.files.lib))) { - alias['$lib'] = project_relative(config.files.lib); - } - - /** @type {Record} */ - const paths = {}; - - for (const [key, value] of Object.entries(alias)) { - const key_match = alias_regex.exec(key); - if (!key_match) throw new Error(`Invalid alias key: ${key}`); - - const value_match = value_regex.exec(value); - if (!value_match) throw new Error(`Invalid alias value: ${value}`); - - const rel_path = config_relative(remove_trailing_slashstar(value)); - const slashstar = key_match[2]; - - if (slashstar) { - paths[key] = [rel_path + '/*']; - } else { - paths[key] = [rel_path]; - const fileending = value_match[4]; - - if (!fileending && !(key + '/*' in alias)) { - paths[key + '/*'] = [rel_path + '/*']; - } - } - } - - return paths; -} diff --git a/web/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js b/web/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js deleted file mode 100644 index bbf63ec..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/sync/write_types/index.js +++ /dev/null @@ -1,869 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import MagicString from 'magic-string'; -import { posixify, rimraf, walk } from '../../../utils/filesystem.js'; -import { compact } from '../../../utils/array.js'; -import { ts } from '../ts.js'; -const remove_relative_parent_traversals = (/** @type {string} */ path) => - path.replace(/\.\.\//g, ''); -const is_whitespace = (/** @type {string} */ char) => /\s/.test(char); - -/** - * @typedef {{ - * file_name: string; - * modified: boolean; - * code: string; - * exports: any[]; - * } | null} Proxy - * - * @typedef {{ - * server: Proxy, - * universal: Proxy - * }} Proxies - * - * @typedef {Map} RoutesMap - */ - -const cwd = process.cwd(); - -/** - * Creates types for the whole manifest - * @param {import('types').ValidatedConfig} config - * @param {import('types').ManifestData} manifest_data - */ -export function write_all_types(config, manifest_data) { - if (!ts) return; - - const types_dir = `${config.kit.outDir}/types`; - - // empty out files that no longer need to exist - const routes_dir = remove_relative_parent_traversals( - posixify(path.relative('.', config.kit.files.routes)) - ); - const expected_directories = new Set( - manifest_data.routes.map((route) => path.join(routes_dir, route.id)) - ); - - if (fs.existsSync(types_dir)) { - for (const file of walk(types_dir)) { - const dir = path.dirname(file); - if (!expected_directories.has(dir)) { - rimraf(path.join(types_dir, file)); - } - } - } - - // Read/write meta data on each invocation, not once per node process, - // it could be invoked by another process in the meantime. - const meta_data_file = `${types_dir}/route_meta_data.json`; - const has_meta_data = fs.existsSync(meta_data_file); - const meta_data = has_meta_data - ? /** @type {Record} */ (JSON.parse(fs.readFileSync(meta_data_file, 'utf-8'))) - : {}; - const routes_map = create_routes_map(manifest_data); - // For each directory, write $types.d.ts - for (const route of manifest_data.routes) { - if (!route.leaf && !route.layout && !route.endpoint) continue; // nothing to do - - const outdir = path.join(config.kit.outDir, 'types', routes_dir, route.id); - - // check if the types are out of date - /** @type {string[]} */ - const input_files = []; - - /** @type {import('types').PageNode | null} */ - let node = route.leaf; - while (node) { - if (node.universal) input_files.push(node.universal); - if (node.server) input_files.push(node.server); - node = node.parent ?? null; - } - - /** @type {import('types').PageNode | null} */ - node = route.layout; - while (node) { - if (node.universal) input_files.push(node.universal); - if (node.server) input_files.push(node.server); - node = node.parent ?? null; - } - - if (route.endpoint) { - input_files.push(route.endpoint.file); - } - - try { - fs.mkdirSync(outdir, { recursive: true }); - } catch {} - - const output_files = compact( - fs.readdirSync(outdir).map((name) => { - const stats = fs.statSync(path.join(outdir, name)); - if (stats.isDirectory()) return; - return { - name, - updated: stats.mtimeMs - }; - }) - ); - - const source_last_updated = Math.max( - // ctimeMs includes move operations whereas mtimeMs does not - ...input_files.map((file) => fs.statSync(file).ctimeMs) - ); - const types_last_updated = Math.max(...output_files.map((file) => file.updated)); - - const should_generate = - // source files were generated more recently than the types - source_last_updated > types_last_updated || - // no meta data file exists yet - !has_meta_data || - // some file was deleted - !meta_data[route.id]?.every((file) => input_files.includes(file)); - - if (should_generate) { - // track which old files end up being surplus to requirements - const to_delete = new Set(output_files.map((file) => file.name)); - update_types(config, routes_map, route, to_delete); - meta_data[route.id] = input_files; - } - } - - fs.writeFileSync(meta_data_file, JSON.stringify(meta_data, null, '\t')); -} - -/** - * Creates types related to the given file. This should only be called - * if the file in question was edited, not if it was created/deleted/moved. - * @param {import('types').ValidatedConfig} config - * @param {import('types').ManifestData} manifest_data - * @param {string} file - */ -export function write_types(config, manifest_data, file) { - if (!ts) return; - - if (!path.basename(file).startsWith('+')) { - // Not a route file - return; - } - - const id = '/' + posixify(path.relative(config.kit.files.routes, path.dirname(file))); - - const route = manifest_data.routes.find((route) => route.id === id); - if (!route) return; - if (!route.leaf && !route.layout && !route.endpoint) return; // nothing to do - - update_types(config, create_routes_map(manifest_data), route); -} - -/** - * Collect all leafs into a leaf -> route map - * @param {import('types').ManifestData} manifest_data - */ -function create_routes_map(manifest_data) { - /** @type {RoutesMap} */ - const map = new Map(); - for (const route of manifest_data.routes) { - if (route.leaf) { - map.set(route.leaf, { route, proxies: { server: null, universal: null } }); - } - } - return map; -} - -/** - * Update types for a specific route - * @param {import('types').ValidatedConfig} config - * @param {RoutesMap} routes - * @param {import('types').RouteData} route - * @param {Set} [to_delete] - */ -function update_types(config, routes, route, to_delete = new Set()) { - const routes_dir = remove_relative_parent_traversals( - posixify(path.relative('.', config.kit.files.routes)) - ); - const outdir = path.join(config.kit.outDir, 'types', routes_dir, route.id); - - // now generate new types - const imports = ["import type * as Kit from '@sveltejs/kit';"]; - - /** @type {string[]} */ - const declarations = []; - - /** @type {string[]} */ - const exports = []; - - // add 'Expand' helper - // Makes sure a type is "repackaged" and therefore more readable - declarations.push('type Expand = T extends infer O ? { [K in keyof O]: O[K] } : never;'); - - // returns the predicate of a matcher's type guard - or string if there is no type guard - declarations.push( - 'type MatcherParam = M extends (param : string) => param is (infer U extends string) ? U : string;' - ); - - declarations.push( - 'type RouteParams = ' + generate_params_type(route.params, outdir, config) + ';' - ); - - if (route.params.length > 0) { - exports.push( - 'export type EntryGenerator = () => Promise> | Array;' - ); - } - - declarations.push(`type RouteId = '${route.id}';`); - - // These could also be placed in our public types, but it would bloat them unnecessarily and we may want to change these in the future - if (route.layout || route.leaf) { - declarations.push( - // If T extends the empty object, void is also allowed as a return type - 'type MaybeWithVoid = {} extends T ? T | void : T;', - - // Returns the key of the object whose values are required. - 'export type RequiredKeys = { [K in keyof T]-?: {} extends { [P in K]: T[K] } ? never : K; }[keyof T];', - - // Helper type to get the correct output type for load functions. It should be passed the parent type to check what types from App.PageData are still required. - // If none, void is also allowed as a return type. - 'type OutputDataShape = MaybeWithVoid> & Partial> & Record>', - - // null & {} == null, we need to prevent that in some situations - 'type EnsureDefined = T extends null | undefined ? {} : T;', - - // Takes a union type and returns a union type where each type also has all properties - // of all possible types (typed as undefined), making accessing them more ergonomic - 'type OptionalUnion, A extends keyof U = U extends U ? keyof U : never> = U extends unknown ? { [P in Exclude]?: never } & U : never;', - - // Re-export `Snapshot` from @sveltejs/kit — in future we could use this to infer from the return type of `snapshot.capture` - 'export type Snapshot = Kit.Snapshot;' - ); - } - - if (route.leaf) { - let route_info = routes.get(route.leaf); - if (!route_info) { - // This should be defined, but belts and braces - route_info = { route, proxies: { server: null, universal: null } }; - routes.set(route.leaf, route_info); - } - - const { - declarations: d, - exports: e, - proxies - } = process_node(route.leaf, outdir, true, route_info.proxies); - - exports.push(...e); - declarations.push(...d); - - if (proxies.server) { - route_info.proxies.server = proxies.server; - if (proxies.server?.modified) to_delete.delete(proxies.server.file_name); - } - if (proxies.universal) { - route_info.proxies.universal = proxies.universal; - if (proxies.universal?.modified) to_delete.delete(proxies.universal.file_name); - } - - if (route.leaf.server) { - exports.push( - 'export type Action | void = Record | void> = Kit.Action' - ); - exports.push( - 'export type Actions | void = Record | void> = Kit.Actions' - ); - } - - if (route.leaf.server) { - exports.push( - 'export type PageProps = { params: RouteParams; data: PageData; form: ActionData }' - ); - } else { - exports.push('export type PageProps = { params: RouteParams; data: PageData }'); - } - } - - if (route.layout) { - let all_pages_have_load = true; - /** @type {import('types').RouteParam[]} */ - const layout_params = []; - const ids = ['RouteId']; - - route.layout.child_pages?.forEach((page) => { - const leaf = routes.get(page); - if (leaf) { - if (leaf.route.page) ids.push(`"${leaf.route.id}"`); - - for (const param of leaf.route.params) { - // skip if already added - if (layout_params.some((p) => p.name === param.name)) continue; - layout_params.push({ ...param, optional: true }); - } - - ensureProxies(page, leaf.proxies); - - if ( - // Be defensive - if a proxy doesn't exist (because it couldn't be created), assume a load function exists. - // If we didn't and it's a false negative, the user could wrongfully get a type error on layouts. - (leaf.proxies.server && !leaf.proxies.server.exports.includes('load')) || - (leaf.proxies.universal && !leaf.proxies.universal.exports.includes('load')) - ) { - all_pages_have_load = false; - } - } - if (!page.server && !page.universal) { - all_pages_have_load = false; - } - }); - - if (route.id === '/') { - // root layout is used for fallback error page, where ID can be null - ids.push('null'); - } - - declarations.push(`type LayoutRouteId = ${ids.join(' | ')}`); - - declarations.push( - 'type LayoutParams = RouteParams & ' + generate_params_type(layout_params, outdir, config) - ); - - const { - exports: e, - declarations: d, - proxies - } = process_node( - route.layout, - outdir, - false, - { server: null, universal: null }, - all_pages_have_load - ); - - exports.push(...e); - declarations.push(...d); - - if (proxies.server?.modified) to_delete.delete(proxies.server.file_name); - if (proxies.universal?.modified) to_delete.delete(proxies.universal.file_name); - - exports.push( - 'export type LayoutProps = { params: LayoutParams; data: LayoutData; children: import("svelte").Snippet }' - ); - } - - if (route.endpoint) { - exports.push('export type RequestHandler = Kit.RequestHandler;'); - } - - if (route.leaf?.server || route.layout?.server || route.endpoint) { - exports.push('export type RequestEvent = Kit.RequestEvent;'); - } - - const output = [imports.join('\n'), declarations.join('\n'), exports.join('\n')] - .filter(Boolean) - .join('\n\n'); - - fs.writeFileSync(`${outdir}/$types.d.ts`, output); - to_delete.delete('$types.d.ts'); - - for (const file of to_delete) { - fs.unlinkSync(path.join(outdir, file)); - } -} - -/** - * @param {import('types').PageNode} node - * @param {string} outdir - * @param {boolean} is_page - * @param {Proxies} proxies - * @param {boolean} [all_pages_have_load] - */ -function process_node(node, outdir, is_page, proxies, all_pages_have_load = true) { - const params = `${is_page ? 'Route' : 'Layout'}Params`; - const prefix = is_page ? 'Page' : 'Layout'; - - const route_id = is_page ? 'RouteId' : 'LayoutRouteId'; - - /** @type {string[]} */ - const declarations = []; - /** @type {string[]} */ - const exports = []; - - /** @type {string} */ - let server_data; - /** @type {string} */ - let data; - - ensureProxies(node, proxies); - - if (node.server) { - const basename = path.basename(node.server); - const proxy = proxies.server; - if (proxy?.modified) { - fs.writeFileSync(`${outdir}/proxy${basename}`, proxy.code); - } - - server_data = get_data_type(node.server, 'null', proxy, true); - - const parent_type = `${prefix}ServerParentData`; - - declarations.push(`type ${parent_type} = ${get_parent_type(node, 'LayoutServerData')};`); - - // +page.js load present -> server can return all-optional data - const output_data_shape = - node.universal || (!is_page && all_pages_have_load) - ? 'Partial & Record | void' - : `OutputDataShape<${parent_type}>`; - exports.push( - `export type ${prefix}ServerLoad = Kit.ServerLoad<${params}, ${parent_type}, OutputData, ${route_id}>;` - ); - - exports.push(`export type ${prefix}ServerLoadEvent = Parameters<${prefix}ServerLoad>[0];`); - - if (is_page) { - let type = 'unknown'; - if (proxy && proxy.exports.includes('actions')) { - // If the file wasn't tweaked, we can use the return type of the original file. - // The advantage is that type updates are reflected without saving. - const from = proxy.modified - ? `./proxy${replace_ext_with_js(basename)}` - : path_to_original(outdir, node.server); - - exports.push( - 'type ExcludeActionFailure = T extends Kit.ActionFailure ? never : T extends void ? never : T;', - 'type ActionsSuccess any>> = { [Key in keyof T]: ExcludeActionFailure>>; }[keyof T];', - 'type ExtractActionFailure = T extends Kit.ActionFailure ? X extends void ? never : X : never;', - 'type ActionsFailure any>> = { [Key in keyof T]: Exclude>>, void>; }[keyof T];', - `type ActionsExport = typeof import('${from}').actions`, - 'export type SubmitFunction = Kit.SubmitFunction>, Expand>>' - ); - - type = 'Expand> | null'; - } - exports.push(`export type ActionData = ${type};`); - } - } else { - server_data = 'null'; - } - exports.push(`export type ${prefix}ServerData = ${server_data};`); - - const parent_type = `${prefix}ParentData`; - declarations.push(`type ${parent_type} = ${get_parent_type(node, 'LayoutData')};`); - - if (node.universal) { - const proxy = proxies.universal; - if (proxy?.modified) { - fs.writeFileSync(`${outdir}/proxy${path.basename(node.universal)}`, proxy.code); - } - - const type = get_data_type( - node.universal, - `${parent_type} & EnsureDefined<${prefix}ServerData>`, - proxy - ); - - data = `Expand & OptionalUnion>>`; - - const output_data_shape = - !is_page && all_pages_have_load - ? 'Partial & Record | void' - : `OutputDataShape<${parent_type}>`; - exports.push( - `export type ${prefix}Load = Kit.Load<${params}, ${prefix}ServerData, ${parent_type}, OutputData, ${route_id}>;` - ); - - exports.push(`export type ${prefix}LoadEvent = Parameters<${prefix}Load>[0];`); - } else if (server_data === 'null') { - data = `Expand<${parent_type}>`; - } else { - data = `Expand & EnsureDefined<${prefix}ServerData>>`; - } - - exports.push(`export type ${prefix}Data = ${data};`); - - return { declarations, exports, proxies }; - - /** - * @param {string} file_path - * @param {string} fallback - * @param {Proxy} proxy - * @param {boolean} expand - */ - function get_data_type(file_path, fallback, proxy, expand = false) { - if (proxy) { - if (proxy.exports.includes('load')) { - // If the file wasn't tweaked, we can use the return type of the original file. - // The advantage is that type updates are reflected without saving. - const from = proxy.modified - ? `./proxy${replace_ext_with_js(path.basename(file_path))}` - : path_to_original(outdir, file_path); - const type = `Kit.LoadProperties>>`; - return expand ? `Expand>>` : type; - } else { - return fallback; - } - } else { - return 'unknown'; - } - } -} - -/** - * This function populates the proxies object, if necessary and not already done. - * Proxies are used to tweak the code of a file before it's typechecked. - * They are needed in two places - when generating the types for a page or layout. - * To not do the same work twice, we generate the proxies once and pass them around. - * - * @param {import('types').PageNode} node - * @param {Proxies} proxies - */ -function ensureProxies(node, proxies) { - if (node.server && !proxies.server) { - proxies.server = createProxy(node.server, true); - } - - if (node.universal && !proxies.universal) { - proxies.universal = createProxy(node.universal, false); - } -} - -/** - * @param {string} file_path - * @param {boolean} is_server - * @returns {Proxy} - */ -function createProxy(file_path, is_server) { - const proxy = tweak_types(fs.readFileSync(file_path, 'utf8'), is_server); - if (proxy) { - return { - ...proxy, - file_name: `proxy${path.basename(file_path)}` - }; - } else { - return null; - } -} - -/** - * Get the parent type string by recursively looking up the parent layout and accumulate them to one type. - * @param {import('types').PageNode} node - * @param {string} type - */ -function get_parent_type(node, type) { - const parent_imports = []; - - let parent = node.parent; - - while (parent) { - const d = node.depth - parent.depth; - // unshift because we need it the other way round for the import string - parent_imports.unshift( - `${d === 0 ? '' : `import('${'../'.repeat(d)}${'$types.js'}').`}${type}` - ); - parent = parent.parent; - } - - let parent_str = `EnsureDefined<${parent_imports[0] || '{}'}>`; - for (let i = 1; i < parent_imports.length; i++) { - // Omit is necessary because a parent could have a property with the same key which would - // cause a type conflict. At runtime the child overwrites the parent property in this case, - // so reflect that in the type definition. - // EnsureDefined is necessary because {something: string} & null becomes null. - // Output types of server loads can be null but when passed in through the `parent` parameter they are the empty object instead. - parent_str = `Omit<${parent_str}, keyof ${parent_imports[i]}> & EnsureDefined<${parent_imports[i]}>`; - } - return parent_str; -} - -/** - * @param {string} outdir - * @param {string} file_path - */ -function path_to_original(outdir, file_path) { - return posixify(path.relative(outdir, path.join(cwd, replace_ext_with_js(file_path)))); -} - -/** - * @param {string} file_path - */ -function replace_ext_with_js(file_path) { - // Another extension than `.js` (or nothing, but that fails with node16 moduleResolution) - // will result in TS failing to lookup the file - const ext = path.extname(file_path); - return file_path.slice(0, -ext.length) + '.js'; -} - -/** - * @param {import('types').RouteParam[]} params - * @param {string} outdir - * @param {import('types').ValidatedConfig} config - */ -function generate_params_type(params, outdir, config) { - /** @param {string} matcher */ - const path_to_matcher = (matcher) => - posixify(path.relative(outdir, path.join(config.kit.files.params, matcher + '.js'))); - - return `{ ${params - .map( - (param) => - `${param.name}${param.optional ? '?' : ''}: ${ - param.matcher - ? `MatcherParam` - : 'string' - }` - ) - .join('; ')} }`; -} - -/** - * @param {string} content - * @param {boolean} is_server - * @returns {Omit, 'file_name'> | null} - */ -export function tweak_types(content, is_server) { - const names = new Set(is_server ? ['load', 'actions'] : ['load']); - - try { - let modified = false; - - const ast = ts.createSourceFile( - 'filename.ts', - content, - ts.ScriptTarget.Latest, - false, - ts.ScriptKind.TS - ); - - const code = new MagicString(content); - - const exports = new Map(); - - ast.forEachChild((node) => { - if ( - ts.isExportDeclaration(node) && - node.exportClause && - ts.isNamedExports(node.exportClause) - ) { - node.exportClause.elements.forEach((element) => { - const exported = element.name; - if (names.has(element.name.text)) { - const local = element.propertyName || element.name; - exports.set(exported.text, local.text); - } - }); - } - - if ( - ts.canHaveModifiers(node) && - ts.getModifiers(node)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) - ) { - if (ts.isFunctionDeclaration(node) && node.name?.text && names.has(node.name?.text)) { - exports.set(node.name.text, node.name.text); - } - - if (ts.isVariableStatement(node)) { - node.declarationList.declarations.forEach((declaration) => { - if (ts.isIdentifier(declaration.name) && names.has(declaration.name.text)) { - exports.set(declaration.name.text, declaration.name.text); - } - }); - } - } - }); - - /** - * @param {import('typescript').Node} node - * @param {import('typescript').Node} value - */ - function replace_jsdoc_type_tags(node, value) { - let _modified = false; - // @ts-ignore - if (node.jsDoc) { - // @ts-ignore - for (const comment of node.jsDoc) { - for (const tag of comment.tags ?? []) { - if (ts.isJSDocTypeTag(tag)) { - const is_fn = - ts.isFunctionDeclaration(value) || - ts.isFunctionExpression(value) || - ts.isArrowFunction(value); - - if (is_fn && value.parameters?.length > 0) { - const name = ts.isIdentifier(value.parameters[0].name) - ? value.parameters[0].name.text - : 'event'; - code.overwrite(tag.tagName.pos, tag.tagName.end, 'param'); - code.prependRight(tag.typeExpression.pos + 1, 'Parameters<'); - code.appendLeft(tag.typeExpression.end - 1, '>[0]'); - code.appendLeft(tag.typeExpression.end, ` ${name}`); - } else { - code.overwrite(tag.pos, tag.end, ''); - } - _modified = true; - } - } - } - } - modified = modified || _modified; - return _modified; - } - - ast.forEachChild((node) => { - if (ts.isFunctionDeclaration(node) && node.name?.text && node.name?.text === 'load') { - // remove JSDoc comment above `export function load ...` - replace_jsdoc_type_tags(node, node); - } - - if (ts.isVariableStatement(node)) { - // remove JSDoc comment above `export const load = ...` - if ( - ts.isIdentifier(node.declarationList.declarations[0].name) && - names.has(node.declarationList.declarations[0].name.text) && - node.declarationList.declarations[0].initializer - ) { - replace_jsdoc_type_tags(node, node.declarationList.declarations[0].initializer); - } - - for (const declaration of node.declarationList.declarations) { - if ( - ts.isIdentifier(declaration.name) && - declaration.name.text === 'load' && - declaration.initializer - ) { - // edge case — remove JSDoc comment above individual export - replace_jsdoc_type_tags(declaration, declaration.initializer); - - // remove type from `export const load: Load ...` - if (declaration.type) { - let a = declaration.type.pos; - const b = declaration.type.end; - while (is_whitespace(content[a])) a += 1; - - const type = content.slice(a, b); - code.remove(declaration.name.end, declaration.type.end); - - const rhs = declaration.initializer; - - if ( - rhs && - (ts.isArrowFunction(rhs) || ts.isFunctionExpression(rhs)) && - rhs.parameters.length - ) { - const arg = rhs.parameters[0]; - const add_parens = content[arg.pos - 1] !== '('; - - if (add_parens) code.prependRight(arg.pos, '('); - - if (arg && !arg.type) { - code.appendLeft( - arg.name.end, - `: Parameters<${type}>[0]` + (add_parens ? ')' : '') - ); - } else { - // prevent "type X is imported but not used" (isn't silenced by @ts-nocheck) when svelte-check runs - code.append(`;null as any as ${type};`); - } - } else { - // prevent "type X is imported but not used" (isn't silenced by @ts-nocheck) when svelte-check runs - code.append(`;null as any as ${type};`); - } - - modified = true; - } - } else if ( - is_server && - ts.isIdentifier(declaration.name) && - declaration.name?.text === 'actions' && - declaration.initializer - ) { - // remove JSDoc comment from `export const actions = ..` - const removed = replace_jsdoc_type_tags(node, declaration.initializer); - // ... and move type to each individual action - if (removed) { - const rhs = declaration.initializer; - if (ts.isObjectLiteralExpression(rhs)) { - for (const prop of rhs.properties) { - if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) { - const rhs = prop.initializer; - const replaced = replace_jsdoc_type_tags(prop, rhs); - if ( - !replaced && - rhs && - (ts.isArrowFunction(rhs) || ts.isFunctionExpression(rhs)) && - rhs.parameters?.[0] - ) { - const name = ts.isIdentifier(rhs.parameters[0].name) - ? rhs.parameters[0].name.text - : 'event'; - code.prependRight( - rhs.pos, - `/** @param {import('./$types').RequestEvent} ${name} */ ` - ); - } - } - } - } - } - - // remove type from `export const actions: Actions ...` - if (declaration.type) { - let a = declaration.type.pos; - const b = declaration.type.end; - while (is_whitespace(content[a])) a += 1; - - const type = content.slice(a, b); - code.remove(declaration.name.end, declaration.type.end); - code.append(`;null as any as ${type};`); - modified = true; - - // ... and move type to each individual action - const rhs = declaration.initializer; - if (ts.isObjectLiteralExpression(rhs)) { - for (const prop of rhs.properties) { - if (ts.isPropertyAssignment(prop) && ts.isIdentifier(prop.name)) { - const rhs = prop.initializer; - - if ( - rhs && - (ts.isArrowFunction(rhs) || ts.isFunctionExpression(rhs)) && - rhs.parameters.length - ) { - const arg = rhs.parameters[0]; - const add_parens = content[arg.pos - 1] !== '('; - - if (add_parens) code.prependRight(arg.pos, '('); - - if (arg && !arg.type) { - code.appendLeft( - arg.name.end, - ": import('./$types').RequestEvent" + (add_parens ? ')' : '') - ); - } - } - } - } - } - } - } - } - } - }); - - if (modified) { - // Ignore all type errors so they don't show up twice when svelte-check runs - // Account for possible @ts-check which would overwrite @ts-nocheck - if (code.original.startsWith('// @ts-check')) { - code.prependLeft('// @ts-check'.length, '\n// @ts-nocheck\n'); - } else { - code.prepend('// @ts-nocheck\n'); - } - } - - return { - modified, - code: code.toString(), - exports: Array.from(exports.keys()) - }; - } catch { - return null; - } -} diff --git a/web/node_modules/@sveltejs/kit/src/core/utils.js b/web/node_modules/@sveltejs/kit/src/core/utils.js deleted file mode 100644 index 668306e..0000000 --- a/web/node_modules/@sveltejs/kit/src/core/utils.js +++ /dev/null @@ -1,87 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import { fileURLToPath } from 'node:url'; -import colors from 'kleur'; -import { posixify, to_fs } from '../utils/filesystem.js'; - -/** - * Resolved path of the `runtime` directory - * - * TODO Windows issue: - * Vite or sth else somehow sets the driver letter inconsistently to lower or upper case depending on the run environment. - * In playwright debug mode run through VS Code this a root-to-lowercase conversion is needed in order for the tests to run. - * If we do this conversion in other cases it has the opposite effect though and fails. - */ -export const runtime_directory = posixify(fileURLToPath(new URL('../runtime', import.meta.url))); - -/** - * This allows us to import SvelteKit internals that aren't exposed via `pkg.exports` in a - * way that works whether `@sveltejs/kit` is installed inside the project's `node_modules` - * or in a workspace root - */ -export const runtime_base = runtime_directory.startsWith(process.cwd()) - ? `/${path.relative('.', runtime_directory)}` - : to_fs(runtime_directory); - -function noop() {} - -/** @param {{ verbose: boolean }} opts */ -export function logger({ verbose }) { - /** @type {import('types').Logger} */ - const log = (msg) => console.log(msg.replace(/^/gm, ' ')); - - /** @param {string} msg */ - const err = (msg) => console.error(msg.replace(/^/gm, ' ')); - - log.success = (msg) => log(colors.green(`✔ ${msg}`)); - log.error = (msg) => err(colors.bold().red(msg)); - log.warn = (msg) => log(colors.bold().yellow(msg)); - - log.minor = verbose ? (msg) => log(colors.grey(msg)) : noop; - log.info = verbose ? log : noop; - - return log; -} - -/** @param {import('types').ManifestData} manifest_data */ -export function get_mime_lookup(manifest_data) { - /** @type {Record} */ - const mime = {}; - - manifest_data.assets.forEach((asset) => { - if (asset.type) { - const ext = path.extname(asset.file); - mime[ext] = asset.type; - } - }); - - return mime; -} - -/** - * @param {string} dir - * @param {(file: string) => boolean} [filter] - */ -export function list_files(dir, filter) { - /** @type {string[]} */ - const files = []; - - /** @param {string} current */ - function walk(current) { - for (const file of fs.readdirSync(path.resolve(dir, current))) { - const child = path.posix.join(current, file); - if (fs.statSync(path.resolve(dir, child)).isDirectory()) { - walk(child); - } else { - if (!filter || filter(child)) { - files.push(child); - } - } - } - } - - if (fs.existsSync(dir)) walk(''); - - return files; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/hooks/index.js b/web/node_modules/@sveltejs/kit/src/exports/hooks/index.js deleted file mode 100644 index 98e1e53..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/hooks/index.js +++ /dev/null @@ -1 +0,0 @@ -export { sequence } from './sequence.js'; diff --git a/web/node_modules/@sveltejs/kit/src/exports/hooks/sequence.js b/web/node_modules/@sveltejs/kit/src/exports/hooks/sequence.js deleted file mode 100644 index 3668c50..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/hooks/sequence.js +++ /dev/null @@ -1,145 +0,0 @@ -/** @import { Handle, RequestEvent, ResolveOptions } from '@sveltejs/kit' */ -/** @import { MaybePromise } from 'types' */ -import { - merge_tracing, - get_request_store, - with_request_store -} from '@sveltejs/kit/internal/server'; - -/** - * A helper function for sequencing multiple `handle` calls in a middleware-like manner. - * The behavior for the `handle` options is as follows: - * - `transformPageChunk` is applied in reverse order and merged - * - `preload` is applied in forward order, the first option "wins" and no `preload` options after it are called - * - `filterSerializedResponseHeaders` behaves the same as `preload` - * - * ```js - * /// file: src/hooks.server.js - * import { sequence } from '@sveltejs/kit/hooks'; - * - * /// type: import('@sveltejs/kit').Handle - * async function first({ event, resolve }) { - * console.log('first pre-processing'); - * const result = await resolve(event, { - * transformPageChunk: ({ html }) => { - * // transforms are applied in reverse order - * console.log('first transform'); - * return html; - * }, - * preload: () => { - * // this one wins as it's the first defined in the chain - * console.log('first preload'); - * return true; - * } - * }); - * console.log('first post-processing'); - * return result; - * } - * - * /// type: import('@sveltejs/kit').Handle - * async function second({ event, resolve }) { - * console.log('second pre-processing'); - * const result = await resolve(event, { - * transformPageChunk: ({ html }) => { - * console.log('second transform'); - * return html; - * }, - * preload: () => { - * console.log('second preload'); - * return true; - * }, - * filterSerializedResponseHeaders: () => { - * // this one wins as it's the first defined in the chain - * console.log('second filterSerializedResponseHeaders'); - * return true; - * } - * }); - * console.log('second post-processing'); - * return result; - * } - * - * export const handle = sequence(first, second); - * ``` - * - * The example above would print: - * - * ``` - * first pre-processing - * first preload - * second pre-processing - * second filterSerializedResponseHeaders - * second transform - * first transform - * second post-processing - * first post-processing - * ``` - * - * @param {...Handle} handlers The chain of `handle` functions - * @returns {Handle} - */ -export function sequence(...handlers) { - const length = handlers.length; - if (!length) return ({ event, resolve }) => resolve(event); - - return ({ event, resolve }) => { - const { state } = get_request_store(); - return apply_handle(0, event, {}); - - /** - * @param {number} i - * @param {RequestEvent} event - * @param {ResolveOptions | undefined} parent_options - * @returns {MaybePromise} - */ - function apply_handle(i, event, parent_options) { - const handle = handlers[i]; - - return state.tracing.record_span({ - name: `sveltekit.handle.sequenced.${handle.name ? handle.name : i}`, - attributes: {}, - fn: async (current) => { - const traced_event = merge_tracing(event, current); - return await with_request_store({ event: traced_event, state }, () => - handle({ - event: traced_event, - resolve: (event, options) => { - /** @type {ResolveOptions['transformPageChunk']} */ - const transformPageChunk = async ({ html, done }) => { - if (options?.transformPageChunk) { - html = (await options.transformPageChunk({ html, done })) ?? ''; - } - - if (parent_options?.transformPageChunk) { - html = (await parent_options.transformPageChunk({ html, done })) ?? ''; - } - - return html; - }; - - /** @type {ResolveOptions['filterSerializedResponseHeaders']} */ - const filterSerializedResponseHeaders = - parent_options?.filterSerializedResponseHeaders ?? - options?.filterSerializedResponseHeaders; - - /** @type {ResolveOptions['preload']} */ - const preload = parent_options?.preload ?? options?.preload; - - return i < length - 1 - ? apply_handle(i + 1, event, { - transformPageChunk, - filterSerializedResponseHeaders, - preload - }) - : resolve(event, { - transformPageChunk, - filterSerializedResponseHeaders, - preload - }); - } - }) - ); - } - }); - } - }; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/index.js b/web/node_modules/@sveltejs/kit/src/exports/index.js deleted file mode 100644 index 5cc5429..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/index.js +++ /dev/null @@ -1,308 +0,0 @@ -/** @import { StandardSchemaV1 } from '@standard-schema/spec' */ - -import { HttpError, Redirect, ActionFailure, ValidationError } from './internal/index.js'; -import { BROWSER, DEV } from 'esm-env'; -import { - add_data_suffix, - add_resolution_suffix, - has_data_suffix, - has_resolution_suffix, - strip_data_suffix, - strip_resolution_suffix -} from '../runtime/pathname.js'; -import { text_encoder } from '../runtime/utils.js'; - -export { VERSION } from '../version.js'; - -// TODO 3.0: remove these types as they are not used anymore (we can't remove them yet because that would be a breaking change) -/** - * @template {number} TNumber - * @template {any[]} [TArray=[]] - * @typedef {TNumber extends TArray['length'] ? TArray[number] : LessThan} LessThan - */ - -/** - * @template {number} TStart - * @template {number} TEnd - * @typedef {Exclude, LessThan>} NumericRange - */ - -// Keep the status codes as `number` because restricting to certain numbers makes it unnecessarily hard to use compared to the benefits -// (we have runtime errors already to check for invalid codes). Also see https://github.com/sveltejs/kit/issues/11780 - -// we have to repeat the JSDoc because the display for function overloads is broken -// see https://github.com/microsoft/TypeScript/issues/55056 - -/** - * Throws an error with a HTTP status code and an optional message. - * When called during request handling, this will cause SvelteKit to - * return an error response without invoking `handleError`. - * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. - * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param {App.Error} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. - * @overload - * @param {number} status - * @param {App.Error} body - * @return {never} - * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling. - * @throws {Error} If the provided status is invalid (not between 400 and 599). - */ -/** - * Throws an error with a HTTP status code and an optional message. - * When called during request handling, this will cause SvelteKit to - * return an error response without invoking `handleError`. - * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. - * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. - * @overload - * @param {number} status - * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} [body] - * @return {never} - * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling. - * @throws {Error} If the provided status is invalid (not between 400 and 599). - */ -/** - * Throws an error with a HTTP status code and an optional message. - * When called during request handling, this will cause SvelteKit to - * return an error response without invoking `handleError`. - * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. - * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param {{ message: string } extends App.Error ? App.Error | string | undefined : never} body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. - * @return {never} - * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling. - * @throws {Error} If the provided status is invalid (not between 400 and 599). - */ -export function error(status, body) { - if ((!BROWSER || DEV) && (isNaN(status) || status < 400 || status > 599)) { - throw new Error(`HTTP error status codes must be between 400 and 599 — ${status} is invalid`); - } - - throw new HttpError(status, body); -} - -/** - * Checks whether this is an error thrown by {@link error}. - * @template {number} T - * @param {unknown} e - * @param {T} [status] The status to filter for. - * @return {e is (HttpError & { status: T extends undefined ? never : T })} - */ -export function isHttpError(e, status) { - if (!(e instanceof HttpError)) return false; - return !status || e.status === status; -} - -/** - * Redirect a request. When called during request handling, SvelteKit will return a redirect response. - * Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it. - * - * Most common status codes: - * * `303 See Other`: redirect as a GET request (often used after a form POST request) - * * `307 Temporary Redirect`: redirect will keep the request method - * * `308 Permanent Redirect`: redirect will keep the request method, SEO will be transferred to the new page - * - * [See all redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages) - * - * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number)} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308. - * @param {string | URL} location The location to redirect to. - * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location. - * @throws {Error} If the provided status is invalid. - * @return {never} - */ -export function redirect(status, location) { - if ((!BROWSER || DEV) && (isNaN(status) || status < 300 || status > 308)) { - throw new Error('Invalid status code'); - } - - throw new Redirect( - // @ts-ignore - status, - location.toString() - ); -} - -/** - * Checks whether this is a redirect thrown by {@link redirect}. - * @param {unknown} e The object to check. - * @return {e is Redirect} - */ -export function isRedirect(e) { - return e instanceof Redirect; -} - -/** - * Create a JSON `Response` object from the supplied data. - * @param {any} data The value that will be serialized as JSON. - * @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically. - */ -export function json(data, init) { - // TODO deprecate this in favour of `Response.json` when it's - // more widely supported - const body = JSON.stringify(data); - - // we can't just do `text(JSON.stringify(data), init)` because - // it will set a default `content-type` header. duplicated code - // means less duplicated work - const headers = new Headers(init?.headers); - if (!headers.has('content-length')) { - headers.set('content-length', text_encoder.encode(body).byteLength.toString()); - } - - if (!headers.has('content-type')) { - headers.set('content-type', 'application/json'); - } - - return new Response(body, { - ...init, - headers - }); -} - -/** - * Create a `Response` object from the supplied body. - * @param {string} body The value that will be used as-is. - * @param {ResponseInit} [init] Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically. - */ -export function text(body, init) { - const headers = new Headers(init?.headers); - if (!headers.has('content-length')) { - const encoded = text_encoder.encode(body); - headers.set('content-length', encoded.byteLength.toString()); - return new Response(encoded, { - ...init, - headers - }); - } - - return new Response(body, { - ...init, - headers - }); -} - -/** - * Create an `ActionFailure` object. Call when form submission fails. - * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @overload - * @param {number} status - * @returns {import('./public.js').ActionFailure} - */ -/** - * Create an `ActionFailure` object. Call when form submission fails. - * @template [T=undefined] - * @param {number} status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param {T} data Data associated with the failure (e.g. validation errors) - * @overload - * @param {number} status - * @param {T} data - * @returns {import('./public.js').ActionFailure} - */ -/** - * Create an `ActionFailure` object. Call when form submission fails. - * @param {number} status - * @param {any} [data] - * @returns {import('./public.js').ActionFailure} - */ -export function fail(status, data) { - // @ts-expect-error unique symbol missing - return new ActionFailure(status, data); -} - -/** - * Checks whether this is an action failure thrown by {@link fail}. - * @param {unknown} e The object to check. - * @return {e is import('./public.js').ActionFailure} - */ -export function isActionFailure(e) { - return e instanceof ActionFailure; -} - -/** - * Use this to throw a validation error to imperatively fail form validation. - * Can be used in combination with `issue` passed to form actions to create field-specific issues. - * - * @example - * ```ts - * import { invalid } from '@sveltejs/kit'; - * import { form } from '$app/server'; - * import { tryLogin } from '$lib/server/auth'; - * import * as v from 'valibot'; - * - * export const login = form( - * v.object({ name: v.string(), _password: v.string() }), - * async ({ name, _password }) => { - * const success = tryLogin(name, _password); - * if (!success) { - * invalid('Incorrect username or password'); - * } - * - * // ... - * } - * ); - * ``` - * @param {...(StandardSchemaV1.Issue | string)} issues - * @returns {never} - * @since 2.47.3 - */ -export function invalid(...issues) { - throw new ValidationError( - issues.map((issue) => (typeof issue === 'string' ? { message: issue } : issue)) - ); -} - -/** - * Checks whether this is an validation error thrown by {@link invalid}. - * @param {unknown} e The object to check. - * @return {e is import('./public.js').ActionFailure} - * @since 2.47.3 - */ -export function isValidationError(e) { - return e instanceof ValidationError; -} - -/** - * Strips possible SvelteKit-internal suffixes and trailing slashes from the URL pathname. - * Returns the normalized URL as well as a method for adding the potential suffix back - * based on a new pathname (possibly including search) or URL. - * ```js - * import { normalizeUrl } from '@sveltejs/kit'; - * - * const { url, denormalize } = normalizeUrl('/blog/post/__data.json'); - * console.log(url.pathname); // /blog/post - * console.log(denormalize('/blog/post/a')); // /blog/post/a/__data.json - * ``` - * @param {URL | string} url - * @returns {{ url: URL, wasNormalized: boolean, denormalize: (url?: string | URL) => URL }} - * @since 2.18.0 - */ -export function normalizeUrl(url) { - url = new URL(url, 'a://a'); - - const is_route_resolution = has_resolution_suffix(url.pathname); - const is_data_request = has_data_suffix(url.pathname); - const has_trailing_slash = url.pathname !== '/' && url.pathname.endsWith('/'); - - if (is_route_resolution) { - url.pathname = strip_resolution_suffix(url.pathname); - } else if (is_data_request) { - url.pathname = strip_data_suffix(url.pathname); - } else if (has_trailing_slash) { - url.pathname = url.pathname.slice(0, -1); - } - - return { - url, - wasNormalized: is_data_request || is_route_resolution || has_trailing_slash, - denormalize: (new_url = url) => { - new_url = new URL(new_url, url); - if (is_route_resolution) { - new_url.pathname = add_resolution_suffix(new_url.pathname); - } else if (is_data_request) { - new_url.pathname = add_data_suffix(new_url.pathname); - } else if (has_trailing_slash && !new_url.pathname.endsWith('/')) { - new_url.pathname += '/'; - } - return new_url; - } - }; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/internal/event.js b/web/node_modules/@sveltejs/kit/src/exports/internal/event.js deleted file mode 100644 index 9d65849..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/internal/event.js +++ /dev/null @@ -1,85 +0,0 @@ -/** @import { RequestEvent } from '@sveltejs/kit' */ -/** @import { RequestStore } from 'types' */ -/** @import { AsyncLocalStorage } from 'node:async_hooks' */ - -import { IN_WEBCONTAINER } from '../../runtime/server/constants.js'; - -/** @type {RequestStore | null} */ -let sync_store = null; - -/** @type {AsyncLocalStorage | null} */ -let als; - -import('node:async_hooks') - .then((hooks) => (als = new hooks.AsyncLocalStorage())) - .catch(() => { - // can't use AsyncLocalStorage, but can still call getRequestEvent synchronously. - // this isn't behind `supports` because it's basically just StackBlitz (i.e. - // in-browser usage) that doesn't support it AFAICT - }); - -/** - * Returns the current `RequestEvent`. Can be used inside server hooks, server `load` functions, actions, and endpoints (and functions called by them). - * - * In environments without [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage), this must be called synchronously (i.e. not after an `await`). - * @since 2.20.0 - * - * @returns {RequestEvent} - */ -export function getRequestEvent() { - const event = try_get_request_store()?.event; - - if (!event) { - let message = - 'Can only read the current request event inside functions invoked during `handle`, such as server `load` functions, actions, endpoints, and other server hooks.'; - - if (!als) { - message += - ' In environments without `AsyncLocalStorage`, the event must be read synchronously, not after an `await`.'; - } - - throw new Error(message); - } - - return event; -} - -export function get_request_store() { - const result = try_get_request_store(); - if (!result) { - let message = 'Could not get the request store.'; - - if (als) { - message += ' This is an internal error.'; - } else { - message += - ' In environments without `AsyncLocalStorage`, the request store (used by e.g. remote functions) must be accessed synchronously, not after an `await`.' + - ' If it was accessed synchronously then this is an internal error.'; - } - - throw new Error(message); - } - return result; -} - -export function try_get_request_store() { - return sync_store ?? als?.getStore() ?? null; -} - -/** - * @template T - * @param {RequestStore | null} store - * @param {() => T} fn - */ -export function with_request_store(store, fn) { - try { - sync_store = store; - return als ? als.run(store, fn) : fn(); - } finally { - // Since AsyncLocalStorage is not working in webcontainers, we don't reset `sync_store` - // and handle only one request at a time in `src/runtime/server/index.js`. - if (!IN_WEBCONTAINER) { - sync_store = null; - } - } -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/internal/index.js b/web/node_modules/@sveltejs/kit/src/exports/internal/index.js deleted file mode 100644 index 8ef0a32..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/internal/index.js +++ /dev/null @@ -1,81 +0,0 @@ -/** @import { StandardSchemaV1 } from '@standard-schema/spec' */ - -export class HttpError { - /** - * @param {number} status - * @param {{message: string} extends App.Error ? (App.Error | string | undefined) : App.Error} body - */ - constructor(status, body) { - this.status = status; - if (typeof body === 'string') { - this.body = { message: body }; - } else if (body) { - this.body = body; - } else { - this.body = { message: `Error: ${status}` }; - } - } - - toString() { - return JSON.stringify(this.body); - } -} - -export class Redirect { - /** - * @param {300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308} status - * @param {string} location - */ - constructor(status, location) { - this.status = status; - this.location = location; - } -} - -/** - * An error that was thrown from within the SvelteKit runtime that is not fatal and doesn't result in a 500, such as a 404. - * `SvelteKitError` goes through `handleError`. - * @extends Error - */ -export class SvelteKitError extends Error { - /** - * @param {number} status - * @param {string} text - * @param {string} message - */ - constructor(status, text, message) { - super(message); - this.status = status; - this.text = text; - } -} - -/** - * @template [T=undefined] - */ -export class ActionFailure { - /** - * @param {number} status - * @param {T} data - */ - constructor(status, data) { - this.status = status; - this.data = data; - } -} - -/** - * Error thrown when form validation fails imperatively - */ -export class ValidationError extends Error { - /** - * @param {StandardSchemaV1.Issue[]} issues - */ - constructor(issues) { - super('Validation failed'); - this.name = 'ValidationError'; - this.issues = issues; - } -} - -export { init_remote_functions } from './remote-functions.js'; diff --git a/web/node_modules/@sveltejs/kit/src/exports/internal/remote-functions.js b/web/node_modules/@sveltejs/kit/src/exports/internal/remote-functions.js deleted file mode 100644 index ae83ed5..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/internal/remote-functions.js +++ /dev/null @@ -1,28 +0,0 @@ -/** @import { RemoteInfo } from 'types' */ - -/** @type {RemoteInfo['type'][]} */ -const types = ['command', 'form', 'prerender', 'query', 'query_batch']; - -/** - * @param {Record} module - * @param {string} file - * @param {string} hash - */ -export function init_remote_functions(module, file, hash) { - if (module.default) { - throw new Error( - `Cannot export \`default\` from a remote module (${file}) — please use named exports instead` - ); - } - - for (const [name, fn] of Object.entries(module)) { - if (!types.includes(fn?.__?.type)) { - throw new Error( - `\`${name}\` exported from ${file} is invalid — all exports from this file must be remote functions` - ); - } - - fn.__.id = `${hash}/${name}`; - fn.__.name = name; - } -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/internal/server.js b/web/node_modules/@sveltejs/kit/src/exports/internal/server.js deleted file mode 100644 index ed42506..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/internal/server.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @template {{ tracing: { enabled: boolean, root: import('@opentelemetry/api').Span, current: import('@opentelemetry/api').Span } }} T - * @param {T} event_like - * @param {import('@opentelemetry/api').Span} current - * @returns {T} - */ -export function merge_tracing(event_like, current) { - return { - ...event_like, - tracing: { - ...event_like.tracing, - current - } - }; -} - -export { - with_request_store, - getRequestEvent, - get_request_store, - try_get_request_store -} from './event.js'; diff --git a/web/node_modules/@sveltejs/kit/src/exports/node/index.js b/web/node_modules/@sveltejs/kit/src/exports/node/index.js deleted file mode 100644 index ae2cae9..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/node/index.js +++ /dev/null @@ -1,238 +0,0 @@ -import { createReadStream } from 'node:fs'; -import { Readable } from 'node:stream'; -import * as set_cookie_parser from 'set-cookie-parser'; -import { SvelteKitError } from '../internal/index.js'; - -/** - * @param {import('http').IncomingMessage} req - * @param {number} [body_size_limit] - */ -function get_raw_body(req, body_size_limit) { - const h = req.headers; - - if (!h['content-type']) { - return null; - } - - const content_length = Number(h['content-length']); - - // check if no request body - if ( - (req.httpVersionMajor === 1 && isNaN(content_length) && h['transfer-encoding'] == null) || - content_length === 0 - ) { - return null; - } - - if (req.destroyed) { - const readable = new ReadableStream(); - void readable.cancel(); - return readable; - } - - let size = 0; - let cancelled = false; - - return new ReadableStream({ - start(controller) { - if (body_size_limit !== undefined && content_length > body_size_limit) { - let message = `Content-length of ${content_length} exceeds limit of ${body_size_limit} bytes.`; - - if (body_size_limit === 0) { - // https://github.com/sveltejs/kit/pull/11589 - // TODO this exists to aid migration — remove in a future version - message += ' To disable body size limits, specify Infinity rather than 0.'; - } - - const error = new SvelteKitError(413, 'Payload Too Large', message); - - controller.error(error); - return; - } - - req.on('error', (error) => { - cancelled = true; - controller.error(error); - }); - - req.on('end', () => { - if (cancelled) return; - controller.close(); - }); - - req.on('data', (chunk) => { - if (cancelled) return; - - size += chunk.length; - if (size > content_length) { - cancelled = true; - - const constraint = content_length ? 'content-length' : 'BODY_SIZE_LIMIT'; - const message = `request body size exceeded ${constraint} of ${content_length}`; - - const error = new SvelteKitError(413, 'Payload Too Large', message); - controller.error(error); - - return; - } - - controller.enqueue(chunk); - - if (controller.desiredSize === null || controller.desiredSize <= 0) { - req.pause(); - } - }); - }, - - pull() { - req.resume(); - }, - - cancel(reason) { - cancelled = true; - req.destroy(reason); - } - }); -} - -/** - * @param {{ - * request: import('http').IncomingMessage; - * base: string; - * bodySizeLimit?: number; - * }} options - * @returns {Promise} - */ -// TODO 3.0 make the signature synchronous? -// eslint-disable-next-line @typescript-eslint/require-await -export async function getRequest({ request, base, bodySizeLimit }) { - let headers = /** @type {Record} */ (request.headers); - if (request.httpVersionMajor >= 2) { - // the Request constructor rejects headers with ':' in the name - headers = Object.assign({}, headers); - // https://www.rfc-editor.org/rfc/rfc9113.html#section-8.3.1-2.3.5 - if (headers[':authority']) { - headers.host = headers[':authority']; - } - delete headers[':authority']; - delete headers[':method']; - delete headers[':path']; - delete headers[':scheme']; - } - - // TODO: Whenever Node >=22 is minimum supported version, we can use `request.readableAborted` - // @see https://github.com/nodejs/node/blob/5cf3c3e24c7257a0c6192ed8ef71efec8ddac22b/lib/internal/streams/readable.js#L1443-L1453 - const controller = new AbortController(); - let errored = false; - let end_emitted = false; - request.once('error', () => (errored = true)); - request.once('end', () => (end_emitted = true)); - request.once('close', () => { - if ((errored || request.destroyed) && !end_emitted) { - controller.abort(); - } - }); - - return new Request(base + request.url, { - // @ts-expect-error - duplex: 'half', - method: request.method, - headers: Object.entries(headers), - signal: controller.signal, - body: - request.method === 'GET' || request.method === 'HEAD' - ? undefined - : get_raw_body(request, bodySizeLimit) - }); -} - -/** - * @param {import('http').ServerResponse} res - * @param {Response} response - * @returns {Promise} - */ -// TODO 3.0 make the signature synchronous? -// eslint-disable-next-line @typescript-eslint/require-await -export async function setResponse(res, response) { - for (const [key, value] of response.headers) { - try { - res.setHeader( - key, - key === 'set-cookie' - ? set_cookie_parser.splitCookiesString( - // This is absurd but necessary, TODO: investigate why - /** @type {string}*/ (response.headers.get(key)) - ) - : value - ); - } catch (error) { - res.getHeaderNames().forEach((name) => res.removeHeader(name)); - res.writeHead(500).end(String(error)); - return; - } - } - - res.writeHead(response.status); - - if (!response.body) { - res.end(); - return; - } - - if (response.body.locked) { - res.end( - 'Fatal error: Response body is locked. ' + - "This can happen when the response was already read (for example through 'response.json()' or 'response.text()')." - ); - return; - } - - const reader = response.body.getReader(); - - if (res.destroyed) { - void reader.cancel(); - return; - } - - const cancel = (/** @type {Error|undefined} */ error) => { - res.off('close', cancel); - res.off('error', cancel); - - // If the reader has already been interrupted with an error earlier, - // then it will appear here, it is useless, but it needs to be catch. - reader.cancel(error).catch(() => {}); - if (error) res.destroy(error); - }; - - res.on('close', cancel); - res.on('error', cancel); - - void next(); - async function next() { - try { - for (;;) { - const { done, value } = await reader.read(); - - if (done) break; - - if (!res.write(value)) { - res.once('drain', next); - return; - } - } - res.end(); - } catch (error) { - cancel(error instanceof Error ? error : new Error(String(error))); - } - } -} - -/** - * Converts a file on disk to a readable stream - * @param {string} file - * @returns {ReadableStream} - * @since 2.4.0 - */ -export function createReadableStream(file) { - return /** @type {ReadableStream} */ (Readable.toWeb(createReadStream(file))); -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/node/polyfills.js b/web/node_modules/@sveltejs/kit/src/exports/node/polyfills.js deleted file mode 100644 index 347c68c..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/node/polyfills.js +++ /dev/null @@ -1,30 +0,0 @@ -import buffer from 'node:buffer'; -import { webcrypto as crypto } from 'node:crypto'; - -// `buffer.File` was added in Node 18.13.0 while the `File` global was added in Node 20.0.0 -const File = /** @type {import('node:buffer') & { File?: File}} */ (buffer).File; - -/** @type {Record} */ -const globals = { - crypto, - File -}; - -// exported for dev/preview and node environments -/** - * Make various web APIs available as globals: - * - `crypto` - * - `File` - */ -export function installPolyfills() { - for (const name in globals) { - if (name in globalThis) continue; - - Object.defineProperty(globalThis, name, { - enumerable: true, - configurable: true, - writable: true, - value: globals[name] - }); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/public.d.ts b/web/node_modules/@sveltejs/kit/src/exports/public.d.ts deleted file mode 100644 index c67fbfe..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/public.d.ts +++ /dev/null @@ -1,2186 +0,0 @@ -import 'svelte'; // pick up `declare module "*.svelte"` -import 'vite/client'; // pick up `declare module "*.jpg"`, etc. -import '../types/ambient.js'; - -import { - AdapterEntry, - CspDirectives, - HttpMethod, - Logger, - MaybePromise, - Prerendered, - PrerenderEntryGeneratorMismatchHandlerValue, - PrerenderHttpErrorHandlerValue, - PrerenderMissingIdHandlerValue, - PrerenderUnseenRoutesHandlerValue, - PrerenderOption, - RequestOptions, - RouteSegment, - DeepPartial, - IsAny -} from '../types/private.js'; -import { BuildData, SSRNodeLoader, SSRRoute, ValidatedConfig } from 'types'; -import { SvelteConfig } from '@sveltejs/vite-plugin-svelte'; -import { StandardSchemaV1 } from '@standard-schema/spec'; -import { - RouteId as AppRouteId, - LayoutParams as AppLayoutParams, - ResolvedPathname -} from '$app/types'; - -export { PrerenderOption } from '../types/private.js'; - -// @ts-ignore this is an optional peer dependency so could be missing. Written like this so dts-buddy preserves the ts-ignore -type Span = import('@opentelemetry/api').Span; - -/** - * [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing. - */ -export interface Adapter { - /** - * The name of the adapter, using for logging. Will typically correspond to the package name. - */ - name: string; - /** - * This function is called after SvelteKit has built your app. - * @param builder An object provided by SvelteKit that contains methods for adapting the app - */ - adapt: (builder: Builder) => MaybePromise; - /** - * Checks called during dev and build to determine whether specific features will work in production with this adapter. - */ - supports?: { - /** - * Test support for `read` from `$app/server`. - * @param details.config The merged route config - */ - read?: (details: { config: any; route: { id: string } }) => boolean; - - /** - * Test support for `instrumentation.server.js`. To pass, the adapter must support running `instrumentation.server.js` prior to the application code. - * @since 2.31.0 - */ - instrumentation?: () => boolean; - }; - /** - * Creates an `Emulator`, which allows the adapter to influence the environment - * during dev, build and prerendering. - */ - emulate?: () => MaybePromise; -} - -export type LoadProperties | void> = input extends void - ? undefined // needs to be undefined, because void will break intellisense - : input extends Record - ? input - : unknown; - -export type AwaitedActions any>> = OptionalUnion< - { - [Key in keyof T]: UnpackValidationError>>; - }[keyof T] ->; - -// Takes a union type and returns a union type where each type also has all properties -// of all possible types (typed as undefined), making accessing them more ergonomic -type OptionalUnion< - U extends Record, // not unknown, else interfaces don't satisfy this constraint - A extends keyof U = U extends U ? keyof U : never -> = U extends unknown ? { [P in Exclude]?: never } & U : never; - -declare const uniqueSymbol: unique symbol; - -export interface ActionFailure { - status: number; - data: T; - [uniqueSymbol]: true; // necessary or else UnpackValidationError could wrongly unpack objects with the same shape as ActionFailure -} - -type UnpackValidationError = - T extends ActionFailure - ? X - : T extends void - ? undefined // needs to be undefined, because void will corrupt union type - : T; - -/** - * This object is passed to the `adapt` function of adapters. - * It contains various methods and properties that are useful for adapting the app. - */ -export interface Builder { - /** Print messages to the console. `log.info` and `log.minor` are silent unless Vite's `logLevel` is `info`. */ - log: Logger; - /** Remove `dir` and all its contents. */ - rimraf: (dir: string) => void; - /** Create `dir` and any required parent directories. */ - mkdirp: (dir: string) => void; - - /** The fully resolved Svelte config. */ - config: ValidatedConfig; - /** Information about prerendered pages and assets, if any. */ - prerendered: Prerendered; - /** An array of all routes (including prerendered) */ - routes: RouteDefinition[]; - - // TODO 3.0 remove this method - /** - * Create separate functions that map to one or more routes of your app. - * @param fn A function that groups a set of routes into an entry point - * @deprecated Use `builder.routes` instead - */ - createEntries: (fn: (route: RouteDefinition) => AdapterEntry) => Promise; - - /** - * Find all the assets imported by server files belonging to `routes` - */ - findServerAssets: (routes: RouteDefinition[]) => string[]; - - /** - * Generate a fallback page for a static webserver to use when no route is matched. Useful for single-page apps. - */ - generateFallback: (dest: string) => Promise; - - /** - * Generate a module exposing build-time environment variables as `$env/dynamic/public`. - */ - generateEnvModule: () => void; - - /** - * Generate a server-side manifest to initialise the SvelteKit [server](https://svelte.dev/docs/kit/@sveltejs-kit#Server) with. - * @param opts a relative path to the base directory of the app and optionally in which format (esm or cjs) the manifest should be generated - */ - generateManifest: (opts: { relativePath: string; routes?: RouteDefinition[] }) => string; - - /** - * Resolve a path to the `name` directory inside `outDir`, e.g. `/path/to/.svelte-kit/my-adapter`. - * @param name path to the file, relative to the build directory - */ - getBuildDirectory: (name: string) => string; - /** Get the fully resolved path to the directory containing client-side assets, including the contents of your `static` directory. */ - getClientDirectory: () => string; - /** Get the fully resolved path to the directory containing server-side code. */ - getServerDirectory: () => string; - /** Get the application path including any configured `base` path, e.g. `my-base-path/_app`. */ - getAppPath: () => string; - - /** - * Write client assets to `dest`. - * @param dest the destination folder - * @returns an array of files written to `dest` - */ - writeClient: (dest: string) => string[]; - /** - * Write prerendered files to `dest`. - * @param dest the destination folder - * @returns an array of files written to `dest` - */ - writePrerendered: (dest: string) => string[]; - /** - * Write server-side code to `dest`. - * @param dest the destination folder - * @returns an array of files written to `dest` - */ - writeServer: (dest: string) => string[]; - /** - * Copy a file or directory. - * @param from the source file or directory - * @param to the destination file or directory - * @param opts.filter a function to determine whether a file or directory should be copied - * @param opts.replace a map of strings to replace - * @returns an array of files that were copied - */ - copy: ( - from: string, - to: string, - opts?: { - filter?(basename: string): boolean; - replace?: Record; - } - ) => string[]; - - /** - * Check if the server instrumentation file exists. - * @returns true if the server instrumentation file exists, false otherwise - * @since 2.31.0 - */ - hasServerInstrumentationFile: () => boolean; - - /** - * Instrument `entrypoint` with `instrumentation`. - * - * Renames `entrypoint` to `start` and creates a new module at - * `entrypoint` which imports `instrumentation` and then dynamically imports `start`. This allows - * the module hooks necessary for instrumentation libraries to be loaded prior to any application code. - * - * Caveats: - * - "Live exports" will not work. If your adapter uses live exports, your users will need to manually import the server instrumentation on startup. - * - If `tla` is `false`, OTEL auto-instrumentation may not work properly. Use it if your environment supports it. - * - Use `hasServerInstrumentationFile` to check if the user has a server instrumentation file; if they don't, you shouldn't do this. - * - * @param options an object containing the following properties: - * @param options.entrypoint the path to the entrypoint to trace. - * @param options.instrumentation the path to the instrumentation file. - * @param options.start the name of the start file. This is what `entrypoint` will be renamed to. - * @param options.module configuration for the resulting entrypoint module. - * @param options.module.exports - * @param options.module.generateText a function that receives the relative paths to the instrumentation and start files, and generates the text of the module to be traced. If not provided, the default implementation will be used, which uses top-level await. - * @since 2.31.0 - */ - instrument: (args: { - entrypoint: string; - instrumentation: string; - start?: string; - module?: - | { - exports: string[]; - } - | { - generateText: (args: { instrumentation: string; start: string }) => string; - }; - }) => void; - - /** - * Compress files in `directory` with gzip and brotli, where appropriate. Generates `.gz` and `.br` files alongside the originals. - * @param {string} directory The directory containing the files to be compressed - */ - compress: (directory: string) => Promise; -} - -/** - * An extension of [`vite-plugin-svelte`'s options](https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#svelte-options). - */ -export interface Config extends SvelteConfig { - /** - * SvelteKit options. - * - * @see https://svelte.dev/docs/kit/configuration - */ - kit?: KitConfig; - /** Any additional options required by tooling that integrates with Svelte. */ - [key: string]: any; -} - -export interface Cookies { - /** - * Gets a cookie that was previously set with `cookies.set`, or from the request headers. - * @param name the name of the cookie - * @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options) - */ - get: (name: string, opts?: import('cookie').CookieParseOptions) => string | undefined; - - /** - * Gets all cookies that were previously set with `cookies.set`, or from the request headers. - * @param opts the options, passed directly to `cookie.parse`. See documentation [here](https://github.com/jshttp/cookie#cookieparsestr-options) - */ - getAll: (opts?: import('cookie').CookieParseOptions) => Array<{ name: string; value: string }>; - - /** - * Sets a cookie. This will add a `set-cookie` header to the response, but also make the cookie available via `cookies.get` or `cookies.getAll` during the current request. - * - * The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP. The `sameSite` option defaults to `lax`. - * - * You must specify a `path` for the cookie. In most cases you should explicitly set `path: '/'` to make the cookie available throughout your app. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children - * @param name the name of the cookie - * @param value the cookie value - * @param opts the options, passed directly to `cookie.serialize`. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options) - */ - set: ( - name: string, - value: string, - opts: import('cookie').CookieSerializeOptions & { path: string } - ) => void; - - /** - * Deletes a cookie by setting its value to an empty string and setting the expiry date in the past. - * - * You must specify a `path` for the cookie. In most cases you should explicitly set `path: '/'` to make the cookie available throughout your app. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children - * @param name the name of the cookie - * @param opts the options, passed directly to `cookie.serialize`. The `path` must match the path of the cookie you want to delete. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options) - */ - delete: (name: string, opts: import('cookie').CookieSerializeOptions & { path: string }) => void; - - /** - * Serialize a cookie name-value pair into a `Set-Cookie` header string, but don't apply it to the response. - * - * The `httpOnly` and `secure` options are `true` by default (except on http://localhost, where `secure` is `false`), and must be explicitly disabled if you want cookies to be readable by client-side JavaScript and/or transmitted over HTTP. The `sameSite` option defaults to `lax`. - * - * You must specify a `path` for the cookie. In most cases you should explicitly set `path: '/'` to make the cookie available throughout your app. You can use relative paths, or set `path: ''` to make the cookie only available on the current path and its children - * - * @param name the name of the cookie - * @param value the cookie value - * @param opts the options, passed directly to `cookie.serialize`. See documentation [here](https://github.com/jshttp/cookie#cookieserializename-value-options) - */ - serialize: ( - name: string, - value: string, - opts: import('cookie').CookieSerializeOptions & { path: string } - ) => string; -} - -/** - * A collection of functions that influence the environment during dev, build and prerendering - */ -export interface Emulator { - /** - * A function that is called with the current route `config` and `prerender` option - * and returns an `App.Platform` object - */ - platform?(details: { config: any; prerender: PrerenderOption }): MaybePromise; -} - -export interface KitConfig { - /** - * Your [adapter](https://svelte.dev/docs/kit/adapters) is run when executing `vite build`. It determines how the output is converted for different platforms. - * @default undefined - */ - adapter?: Adapter; - /** - * An object containing zero or more aliases used to replace values in `import` statements. These aliases are automatically passed to Vite and TypeScript. - * - * ```js - * /// file: svelte.config.js - * /// type: import('@sveltejs/kit').Config - * const config = { - * kit: { - * alias: { - * // this will match a file - * 'my-file': 'path/to/my-file.js', - * - * // this will match a directory and its contents - * // (`my-directory/x` resolves to `path/to/my-directory/x`) - * 'my-directory': 'path/to/my-directory', - * - * // an alias ending /* will only match - * // the contents of a directory, not the directory itself - * 'my-directory/*': 'path/to/my-directory/*' - * } - * } - * }; - * ``` - * - * > [!NOTE] You will need to run `npm run dev` to have SvelteKit automatically generate the required alias configuration in `jsconfig.json` or `tsconfig.json`. - * @default {} - */ - alias?: Record; - /** - * The directory where SvelteKit keeps its stuff, including static assets (such as JS and CSS) and internally-used routes. - * - * If `paths.assets` is specified, there will be two app directories — `${paths.assets}/${appDir}` and `${paths.base}/${appDir}`. - * @default "_app" - */ - appDir?: string; - /** - * [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy) configuration. CSP helps to protect your users against cross-site scripting (XSS) attacks, by limiting the places resources can be loaded from. For example, a configuration like this... - * - * ```js - * /// file: svelte.config.js - * /// type: import('@sveltejs/kit').Config - * const config = { - * kit: { - * csp: { - * directives: { - * 'script-src': ['self'] - * }, - * // must be specified with either the `report-uri` or `report-to` directives, or both - * reportOnly: { - * 'script-src': ['self'], - * 'report-uri': ['/'] - * } - * } - * } - * }; - * - * export default config; - * ``` - * - * ...would prevent scripts loading from external sites. SvelteKit will augment the specified directives with nonces or hashes (depending on `mode`) for any inline styles and scripts it generates. - * - * To add a nonce for scripts and links manually included in `src/app.html`, you may use the placeholder `%sveltekit.nonce%` (for example ` - * - * - * - * - * - * ``` - * @default 'split' - * @since 2.13.0 - */ - bundleStrategy?: 'split' | 'single' | 'inline'; - }; - paths?: { - /** - * An absolute path that your app's files are served from. This is useful if your files are served from a storage bucket of some kind. - * @default "" - */ - assets?: '' | `http://${string}` | `https://${string}`; - /** - * A root-relative path that must start, but not end with `/` (e.g. `/base-path`), unless it is the empty string. This specifies where your app is served from and allows the app to live on a non-root path. Note that you need to prepend all your root-relative links with the base value or they will point to the root of your domain, not your `base` (this is how the browser works). You can use [`base` from `$app/paths`](https://svelte.dev/docs/kit/$app-paths#base) for that: `Link`. If you find yourself writing this often, it may make sense to extract this into a reusable component. - * @default "" - */ - base?: '' | `/${string}`; - /** - * Whether to use relative asset paths. - * - * If `true`, `base` and `assets` imported from `$app/paths` will be replaced with relative asset paths during server-side rendering, resulting in more portable HTML. - * If `false`, `%sveltekit.assets%` and references to build artifacts will always be root-relative paths, unless `paths.assets` is an external URL - * - * [Single-page app](https://svelte.dev/docs/kit/single-page-apps) fallback pages will always use absolute paths, regardless of this setting. - * - * If your app uses a `` element, you should set this to `false`, otherwise asset URLs will incorrectly be resolved against the `` URL rather than the current page. - * - * In 1.0, `undefined` was a valid value, which was set by default. In that case, if `paths.assets` was not external, SvelteKit would replace `%sveltekit.assets%` with a relative path and use relative paths to reference build artifacts, but `base` and `assets` imported from `$app/paths` would be as specified in your config. - * - * @default true - * @since 1.9.0 - */ - relative?: boolean; - }; - /** - * See [Prerendering](https://svelte.dev/docs/kit/page-options#prerender). - */ - prerender?: { - /** - * How many pages can be prerendered simultaneously. JS is single-threaded, but in cases where prerendering performance is network-bound (for example loading content from a remote CMS) this can speed things up by processing other tasks while waiting on the network response. - * @default 1 - */ - concurrency?: number; - /** - * Whether SvelteKit should find pages to prerender by following links from `entries`. - * @default true - */ - crawl?: boolean; - /** - * An array of pages to prerender, or start crawling from (if `crawl: true`). The `*` string includes all routes containing no required `[parameters]` with optional parameters included as being empty (since SvelteKit doesn't know what value any parameters should have). - * @default ["*"] - */ - entries?: Array<'*' | `/${string}`>; - /** - * How to respond to HTTP errors encountered while prerendering the app. - * - * - `'fail'` — fail the build - * - `'ignore'` - silently ignore the failure and continue - * - `'warn'` — continue, but print a warning - * - `(details) => void` — a custom error handler that takes a `details` object with `status`, `path`, `referrer`, `referenceType` and `message` properties. If you `throw` from this function, the build will fail - * - * ```js - * /// file: svelte.config.js - * /// type: import('@sveltejs/kit').Config - * const config = { - * kit: { - * prerender: { - * handleHttpError: ({ path, referrer, message }) => { - * // ignore deliberate link to shiny 404 page - * if (path === '/not-found' && referrer === '/blog/how-we-built-our-404-page') { - * return; - * } - * - * // otherwise fail the build - * throw new Error(message); - * } - * } - * } - * }; - * ``` - * - * @default "fail" - * @since 1.15.7 - */ - handleHttpError?: PrerenderHttpErrorHandlerValue; - /** - * How to respond when hash links from one prerendered page to another don't correspond to an `id` on the destination page. - * - * - `'fail'` — fail the build - * - `'ignore'` - silently ignore the failure and continue - * - `'warn'` — continue, but print a warning - * - `(details) => void` — a custom error handler that takes a `details` object with `path`, `id`, `referrers` and `message` properties. If you `throw` from this function, the build will fail - * - * @default "fail" - * @since 1.15.7 - */ - handleMissingId?: PrerenderMissingIdHandlerValue; - /** - * How to respond when an entry generated by the `entries` export doesn't match the route it was generated from. - * - * - `'fail'` — fail the build - * - `'ignore'` - silently ignore the failure and continue - * - `'warn'` — continue, but print a warning - * - `(details) => void` — a custom error handler that takes a `details` object with `generatedFromId`, `entry`, `matchedId` and `message` properties. If you `throw` from this function, the build will fail - * - * @default "fail" - * @since 1.16.0 - */ - handleEntryGeneratorMismatch?: PrerenderEntryGeneratorMismatchHandlerValue; - /** - * How to respond when a route is marked as prerenderable but has not been prerendered. - * - * - `'fail'` — fail the build - * - `'ignore'` - silently ignore the failure and continue - * - `'warn'` — continue, but print a warning - * - `(details) => void` — a custom error handler that takes a `details` object with a `routes` property which contains all routes that haven't been prerendered. If you `throw` from this function, the build will fail - * - * The default behavior is to fail the build. This may be undesirable when you know that some of your routes may never be reached under certain - * circumstances such as a CMS not returning data for a specific area, resulting in certain routes never being reached. - * - * @default "fail" - * @since 2.16.0 - */ - handleUnseenRoutes?: PrerenderUnseenRoutesHandlerValue; - /** - * The value of `url.origin` during prerendering; useful if it is included in rendered content. - * @default "http://sveltekit-prerender" - */ - origin?: string; - }; - router?: { - /** - * What type of client-side router to use. - * - `'pathname'` is the default and means the current URL pathname determines the route - * - `'hash'` means the route is determined by `location.hash`. In this case, SSR and prerendering are disabled. This is only recommended if `pathname` is not an option, for example because you don't control the webserver where your app is deployed. - * It comes with some caveats: you can't use server-side rendering (or indeed any server logic), and you have to make sure that the links in your app all start with #/, or they won't work. Beyond that, everything works exactly like a normal SvelteKit app. - * - * @default "pathname" - * @since 2.14.0 - */ - type?: 'pathname' | 'hash'; - /** - * How to determine which route to load when navigating to a new page. - * - * By default, SvelteKit will serve a route manifest to the browser. - * When navigating, this manifest is used (along with the `reroute` hook, if it exists) to determine which components to load and which `load` functions to run. - * Because everything happens on the client, this decision can be made immediately. The drawback is that the manifest needs to be - * loaded and parsed before the first navigation can happen, which may have an impact if your app contains many routes. - * - * Alternatively, SvelteKit can determine the route on the server. This means that for every navigation to a path that has not yet been visited, the server will be asked to determine the route. - * This has several advantages: - * - The client does not need to load the routing manifest upfront, which can lead to faster initial page loads - * - The list of routes is hidden from public view - * - The server has an opportunity to intercept each navigation (for example through a middleware), enabling (for example) A/B testing opaque to SvelteKit - - * The drawback is that for unvisited paths, resolution will take slightly longer (though this is mitigated by [preloading](https://svelte.dev/docs/kit/link-options#data-sveltekit-preload-data)). - * - * > [!NOTE] When using server-side route resolution and prerendering, the resolution is prerendered along with the route itself. - * - * @default "client" - * @since 2.17.0 - */ - resolution?: 'client' | 'server'; - }; - serviceWorker?: { - /** - * Determine which files in your `static` directory will be available in `$service-worker.files`. - * @default (filename) => !/\.DS_Store/.test(filename) - */ - files?: (file: string) => boolean; - } & ( - | { - /** - * Whether to automatically register the service worker, if it exists. - * @default true - */ - register: true; - /** - * Options for serviceWorker.register("...", options); - */ - options?: RegistrationOptions; - } - | { - /** - * Whether to automatically register the service worker, if it exists. - * @default true - */ - register?: false; - } - ); - typescript?: { - /** - * A function that allows you to edit the generated `tsconfig.json`. You can mutate the config (recommended) or return a new one. - * This is useful for extending a shared `tsconfig.json` in a monorepo root, for example. - * - * Note that any paths configured here should be relative to the generated config file, which is written to `.svelte-kit/tsconfig.json`. - * - * @default (config) => config - * @since 1.3.0 - */ - config?: (config: Record) => Record | void; - }; - /** - * Client-side navigation can be buggy if you deploy a new version of your app while people are using it. If the code for the new page is already loaded, it may have stale content; if it isn't, the app's route manifest may point to a JavaScript file that no longer exists. - * SvelteKit helps you solve this problem through version management. - * If SvelteKit encounters an error while loading the page and detects that a new version has been deployed (using the `name` specified here, which defaults to a timestamp of the build) it will fall back to traditional full-page navigation. - * Not all navigations will result in an error though, for example if the JavaScript for the next page is already loaded. If you still want to force a full-page navigation in these cases, use techniques such as setting the `pollInterval` and then using `beforeNavigate`: - * ```html - * /// file: +layout.svelte - * - * ``` - * - * If you set `pollInterval` to a non-zero value, SvelteKit will poll for new versions in the background and set the value of [`updated.current`](https://svelte.dev/docs/kit/$app-state#updated) `true` when it detects one. - */ - version?: { - /** - * The current app version string. If specified, this must be deterministic (e.g. a commit ref rather than `Math.random()` or `Date.now().toString()`), otherwise defaults to a timestamp of the build. - * - * For example, to use the current commit hash, you could do use `git rev-parse HEAD`: - * - * ```js - * /// file: svelte.config.js - * import * as child_process from 'node:child_process'; - * - * export default { - * kit: { - * version: { - * name: child_process.execSync('git rev-parse HEAD').toString().trim() - * } - * } - * }; - * ``` - */ - name?: string; - /** - * The interval in milliseconds to poll for version changes. If this is `0`, no polling occurs. - * @default 0 - */ - pollInterval?: number; - }; -} - -/** - * The [`handle`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) hook runs every time the SvelteKit server receives a [request](https://svelte.dev/docs/kit/web-standards#Fetch-APIs-Request) and - * determines the [response](https://svelte.dev/docs/kit/web-standards#Fetch-APIs-Response). - * It receives an `event` object representing the request and a function called `resolve`, which renders the route and generates a `Response`. - * This allows you to modify response headers or bodies, or bypass SvelteKit entirely (for implementing routes programmatically, for example). - */ -export type Handle = (input: { - event: RequestEvent; - resolve: (event: RequestEvent, opts?: ResolveOptions) => MaybePromise; -}) => MaybePromise; - -/** - * The server-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while responding to a request. - * - * If an unexpected error is thrown during loading or rendering, this function will be called with the error and the event. - * Make sure that this function _never_ throws an error. - */ -export type HandleServerError = (input: { - error: unknown; - event: RequestEvent; - status: number; - message: string; -}) => MaybePromise; - -/** - * The [`handleValidationError`](https://svelte.dev/docs/kit/hooks#Server-hooks-handleValidationError) hook runs when the argument to a remote function fails validation. - * - * It will be called with the validation issues and the event, and must return an object shape that matches `App.Error`. - */ -export type HandleValidationError = - (input: { issues: Issue[]; event: RequestEvent }) => MaybePromise; - -/** - * The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating. - * - * If an unexpected error is thrown during loading or the following render, this function will be called with the error and the event. - * Make sure that this function _never_ throws an error. - */ -export type HandleClientError = (input: { - error: unknown; - event: NavigationEvent; - status: number; - message: string; -}) => MaybePromise; - -/** - * The [`handleFetch`](https://svelte.dev/docs/kit/hooks#Server-hooks-handleFetch) hook allows you to modify (or replace) the result of an [`event.fetch`](https://svelte.dev/docs/kit/load#Making-fetch-requests) call that runs on the server (or during prerendering) inside an endpoint, `load`, `action`, `handle`, `handleError` or `reroute`. - */ -export type HandleFetch = (input: { - event: RequestEvent; - request: Request; - fetch: typeof fetch; -}) => MaybePromise; - -/** - * The [`init`](https://svelte.dev/docs/kit/hooks#Shared-hooks-init) will be invoked before the server responds to its first request - * @since 2.10.0 - */ -export type ServerInit = () => MaybePromise; - -/** - * The [`init`](https://svelte.dev/docs/kit/hooks#Shared-hooks-init) will be invoked once the app starts in the browser - * @since 2.10.0 - */ -export type ClientInit = () => MaybePromise; - -/** - * The [`reroute`](https://svelte.dev/docs/kit/hooks#Universal-hooks-reroute) hook allows you to modify the URL before it is used to determine which route to render. - * @since 2.3.0 - */ -export type Reroute = (event: { url: URL; fetch: typeof fetch }) => MaybePromise; - -/** - * The [`transport`](https://svelte.dev/docs/kit/hooks#Universal-hooks-transport) hook allows you to transport custom types across the server/client boundary. - * - * Each transporter has a pair of `encode` and `decode` functions. On the server, `encode` determines whether a value is an instance of the custom type and, if so, returns a non-falsy encoding of the value which can be an object or an array (or `false` otherwise). - * - * In the browser, `decode` turns the encoding back into an instance of the custom type. - * - * ```ts - * import type { Transport } from '@sveltejs/kit'; - * - * declare class MyCustomType { - * data: any - * } - * - * // hooks.js - * export const transport: Transport = { - * MyCustomType: { - * encode: (value) => value instanceof MyCustomType && [value.data], - * decode: ([data]) => new MyCustomType(data) - * } - * }; - * ``` - * @since 2.11.0 - */ -export type Transport = Record; - -/** - * A member of the [`transport`](https://svelte.dev/docs/kit/hooks#Universal-hooks-transport) hook. - */ -export interface Transporter< - T = any, - U = Exclude -> { - encode: (value: T) => false | U; - decode: (data: U) => T; -} - -/** - * The generic form of `PageLoad` and `LayoutLoad`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) - * rather than using `Load` directly. - */ -export type Load< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - InputData extends Record | null = Record | null, - ParentData extends Record = Record, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null -> = (event: LoadEvent) => MaybePromise; - -/** - * The generic form of `PageLoadEvent` and `LayoutLoadEvent`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) - * rather than using `LoadEvent` directly. - */ -export interface LoadEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - Data extends Record | null = Record | null, - ParentData extends Record = Record, - RouteId extends AppRouteId | null = AppRouteId | null -> extends NavigationEvent { - /** - * `fetch` is equivalent to the [native `fetch` web API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), with a few additional features: - * - * - It can be used to make credentialed requests on the server, as it inherits the `cookie` and `authorization` headers for the page request. - * - It can make relative requests on the server (ordinarily, `fetch` requires a URL with an origin when used in a server context). - * - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call. - * - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) - * - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request. - * - * You can learn more about making credentialed requests with cookies [here](https://svelte.dev/docs/kit/load#Cookies) - */ - fetch: typeof fetch; - /** - * Contains the data returned by the route's server `load` function (in `+layout.server.js` or `+page.server.js`), if any. - */ - data: Data; - /** - * If you need to set headers for the response, you can do so using the this method. This is useful if you want the page to be cached, for example: - * - * ```js - * /// file: src/routes/blog/+page.js - * export async function load({ fetch, setHeaders }) { - * const url = `https://cms.example.com/articles.json`; - * const response = await fetch(url); - * - * setHeaders({ - * age: response.headers.get('age'), - * 'cache-control': response.headers.get('cache-control') - * }); - * - * return response.json(); - * } - * ``` - * - * Setting the same header multiple times (even in separate `load` functions) is an error — you can only set a given header once. - * - * You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API in a server-only `load` function instead. - * - * `setHeaders` has no effect when a `load` function runs in the browser. - */ - setHeaders: (headers: Record) => void; - /** - * `await parent()` returns data from parent `+layout.js` `load` functions. - * Implicitly, a missing `+layout.js` is treated as a `({ data }) => data` function, meaning that it will return and forward data from parent `+layout.server.js` files. - * - * Be careful not to introduce accidental waterfalls when using `await parent()`. If for example you only want to merge parent data into the returned output, call it _after_ fetching your other data. - */ - parent: () => Promise; - /** - * This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun. - * - * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`. - * - * URLs can be absolute or relative to the page being loaded, and must be [encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding). - * - * Custom identifiers have to be prefixed with one or more lowercase letters followed by a colon to conform to the [URI specification](https://www.rfc-editor.org/rfc/rfc3986.html). - * - * The following example shows how to use `depends` to register a dependency on a custom identifier, which is `invalidate`d after a button click, making the `load` function rerun. - * - * ```js - * /// file: src/routes/+page.js - * let count = 0; - * export async function load({ depends }) { - * depends('increase:count'); - * - * return { count: count++ }; - * } - * ``` - * - * ```html - * /// file: src/routes/+page.svelte - * - * - *

{data.count}

- * - * ``` - */ - depends: (...deps: Array<`${string}:${string}`>) => void; - /** - * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example: - * - * ```js - * /// file: src/routes/+page.server.js - * export async function load({ untrack, url }) { - * // Untrack url.pathname so that path changes don't trigger a rerun - * if (untrack(() => url.pathname === '/')) { - * return { message: 'Welcome!' }; - * } - * } - * ``` - */ - untrack: (fn: () => T) => T; - - /** - * Access to spans for tracing. If tracing is not enabled or the function is being run in the browser, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current `load` function. */ - current: Span; - }; -} - -export interface NavigationEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null -> { - /** - * The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object - */ - params: Params; - /** - * Info about the current route - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * The URL of the current page - */ - url: URL; -} - -/** - * Information about the target of a specific navigation. - */ -export interface NavigationTarget< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null -> { - /** - * Parameters of the target page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - * Is `null` if the target is not part of the SvelteKit app (could not be resolved to a route). - */ - params: Params | null; - /** - * Info about the target route - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId | null; - }; - /** - * The URL that is navigated to - */ - url: URL; - /** - * The scroll position associated with this navigation. - * - * For the `from` target, this is the scroll position at the moment of navigation. - * - * For the `to` target, this represents the scroll position that will be or was restored: - * - In `beforeNavigate` and `onNavigate`, this is only available for `popstate` navigations (back/forward button) - * and will be `null` for other navigation types, since the final scroll position isn't known - * ahead of time. - * - In `afterNavigate`, this is always the scroll position that was applied after the navigation - * completed. - */ - scroll: { x: number; y: number } | null; -} - -/** - * - `enter`: The app has hydrated/started - * - `form`: The user submitted a `

` - * - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring - * - `link`: Navigation was triggered by a link click - * - `goto`: Navigation was triggered by a `goto(...)` call or a redirect - * - `popstate`: Navigation was triggered by back/forward navigation - */ -export type NavigationType = 'enter' | 'form' | 'leave' | 'link' | 'goto' | 'popstate'; - -export interface NavigationBase { - /** - * Where navigation was triggered from - */ - from: NavigationTarget | null; - /** - * Where navigation is going to/has gone to - */ - to: NavigationTarget | null; - /** - * Whether or not the navigation will result in the page being unloaded (i.e. not a client-side navigation). - */ - willUnload: boolean; - /** - * A promise that resolves once the navigation is complete, and rejects if the navigation - * fails or is aborted. In the case of a `willUnload` navigation, the promise will never resolve - */ - complete: Promise; -} - -export interface NavigationEnter extends NavigationBase { - /** - * The type of navigation: - * - `enter`: The app has hydrated/started - */ - type: 'enter'; - - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - - /** - * Dispatched `Event` object when navigation occurred by `popstate` or `link`. - */ - event?: undefined; -} - -export type NavigationExternal = NavigationGoto | NavigationLeave; - -export interface NavigationGoto extends NavigationBase { - /** - * The type of navigation: - * - `goto`: Navigation was triggered by a `goto(...)` call or a redirect - */ - type: 'goto'; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; -} - -export interface NavigationLeave extends NavigationBase { - /** - * The type of navigation: - * - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring - */ - type: 'leave'; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; -} - -export interface NavigationFormSubmit extends NavigationBase { - /** - * The type of navigation: - * - `form`: The user submitted a `` - */ - type: 'form'; - - /** - * The `SubmitEvent` that caused the navigation - */ - event: SubmitEvent; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; -} - -export interface NavigationPopState extends NavigationBase { - /** - * The type of navigation: - * - `popstate`: Navigation was triggered by back/forward navigation - */ - type: 'popstate'; - - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta: number; - - /** - * The `PopStateEvent` that caused the navigation - */ - event: PopStateEvent; -} - -export interface NavigationLink extends NavigationBase { - /** - * The type of navigation: - * - `link`: Navigation was triggered by a link click - */ - type: 'link'; - - /** - * The `PointerEvent` that caused the navigation - */ - event: PointerEvent; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; -} - -export type Navigation = - | NavigationExternal - | NavigationFormSubmit - | NavigationPopState - | NavigationLink; - -/** - * The argument passed to [`beforeNavigate`](https://svelte.dev/docs/kit/$app-navigation#beforeNavigate) callbacks. - */ -export type BeforeNavigate = Navigation & { - /** - * Call this to prevent the navigation from starting. - */ - cancel: () => void; -}; - -/** - * The argument passed to [`onNavigate`](https://svelte.dev/docs/kit/$app-navigation#onNavigate) callbacks. - */ -export type OnNavigate = Navigation & { - type: Exclude; - /** - * Since `onNavigate` callbacks are called immediately before a client-side navigation, they will never be called with a navigation that unloads the page. - */ - willUnload: false; -}; - -/** - * The argument passed to [`afterNavigate`](https://svelte.dev/docs/kit/$app-navigation#afterNavigate) callbacks. - */ -export type AfterNavigate = (Navigation | NavigationEnter) & { - type: Exclude; - /** - * Since `afterNavigate` callbacks are called after a navigation completes, they will never be called with a navigation that unloads the page. - */ - willUnload: false; -}; - -/** - * The shape of the [`page`](https://svelte.dev/docs/kit/$app-state#page) reactive object and the [`$page`](https://svelte.dev/docs/kit/$app-stores) store. - */ -export interface Page< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null -> { - /** - * The URL of the current page. - */ - url: URL & { pathname: ResolvedPathname }; - /** - * The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - */ - params: Params; - /** - * Info about the current route. - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * HTTP status code of the current page. - */ - status: number; - /** - * The error object of the current page, if any. Filled from the `handleError` hooks. - */ - error: App.Error | null; - /** - * The merged result of all data from all `load` functions on the current page. You can type a common denominator through `App.PageData`. - */ - data: App.PageData & Record; - /** - * The page state, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`. - */ - state: App.PageState; - /** - * Filled only after a form submission. See [form actions](https://svelte.dev/docs/kit/form-actions) for more info. - */ - form: any; -} - -/** - * The shape of a param matcher. See [matching](https://svelte.dev/docs/kit/advanced-routing#Matching) for more info. - */ -export type ParamMatcher = (param: string) => boolean; - -export interface RequestEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null -> { - /** - * Get or set cookies related to the current request - */ - cookies: Cookies; - /** - * `fetch` is equivalent to the [native `fetch` web API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), with a few additional features: - * - * - It can be used to make credentialed requests on the server, as it inherits the `cookie` and `authorization` headers for the page request. - * - It can make relative requests on the server (ordinarily, `fetch` requires a URL with an origin when used in a server context). - * - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call. - * - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) - * - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request. - * - * You can learn more about making credentialed requests with cookies [here](https://svelte.dev/docs/kit/load#Cookies). - */ - fetch: typeof fetch; - /** - * The client's IP address, set by the adapter. - */ - getClientAddress: () => string; - /** - * Contains custom data that was added to the request within the [`server handle hook`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle). - */ - locals: App.Locals; - /** - * The parameters of the current route - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - */ - params: Params; - /** - * Additional data made available through the adapter. - */ - platform: Readonly | undefined; - /** - * The original request object. - */ - request: Request; - /** - * Info about the current route. - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * If you need to set headers for the response, you can do so using the this method. This is useful if you want the page to be cached, for example: - * - * ```js - * /// file: src/routes/blog/+page.js - * export async function load({ fetch, setHeaders }) { - * const url = `https://cms.example.com/articles.json`; - * const response = await fetch(url); - * - * setHeaders({ - * age: response.headers.get('age'), - * 'cache-control': response.headers.get('cache-control') - * }); - * - * return response.json(); - * } - * ``` - * - * Setting the same header multiple times (even in separate `load` functions) is an error — you can only set a given header once. - * - * You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API instead. - */ - setHeaders: (headers: Record) => void; - /** - * The requested URL. - */ - url: URL; - /** - * `true` if the request comes from the client asking for `+page/layout.server.js` data. The `url` property will be stripped of the internal information - * related to the data request in this case. Use this property instead if the distinction is important to you. - */ - isDataRequest: boolean; - /** - * `true` for `+server.js` calls coming from SvelteKit without the overhead of actually making an HTTP request. This happens when you make same-origin `fetch` requests on the server. - */ - isSubRequest: boolean; - - /** - * Access to spans for tracing. If tracing is not enabled, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current `handle` hook, `load` function, or form action. */ - current: Span; - }; - - /** - * `true` if the request comes from the client via a remote function. The `url` property will be stripped of the internal information - * related to the data request in this case. Use this property instead if the distinction is important to you. - */ - isRemoteRequest: boolean; -} - -/** - * A `(event: RequestEvent) => Response` function exported from a `+server.js` file that corresponds to an HTTP verb (`GET`, `PUT`, `PATCH`, etc) and handles requests with that method. - * - * It receives `Params` as the first generic argument, which you can skip by using [generated types](https://svelte.dev/docs/kit/types#Generated-types) instead. - */ -export type RequestHandler< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null -> = (event: RequestEvent) => MaybePromise; - -export interface ResolveOptions { - /** - * Applies custom transforms to HTML. If `done` is true, it's the final chunk. Chunks are not guaranteed to be well-formed HTML - * (they could include an element's opening tag but not its closing tag, for example) - * but they will always be split at sensible boundaries such as `%sveltekit.head%` or layout/page components. - * @param input the html chunk and the info if this is the last chunk - */ - transformPageChunk?: (input: { html: string; done: boolean }) => MaybePromise; - /** - * Determines which headers should be included in serialized responses when a `load` function loads a resource with `fetch`. - * By default, none will be included. - * @param name header name - * @param value header value - */ - filterSerializedResponseHeaders?: (name: string, value: string) => boolean; - /** - * Determines what should be added to the `` tag to preload it. - * By default, `js` and `css` files will be preloaded. - * @param input the type of the file and its path - */ - preload?: (input: { type: 'font' | 'css' | 'js' | 'asset'; path: string }) => boolean; -} - -export interface RouteDefinition { - id: string; - api: { - methods: Array; - }; - page: { - methods: Array>; - }; - pattern: RegExp; - prerender: PrerenderOption; - segments: RouteSegment[]; - methods: Array; - config: Config; -} - -export class Server { - constructor(manifest: SSRManifest); - init(options: ServerInitOptions): Promise; - respond(request: Request, options: RequestOptions): Promise; -} - -export interface ServerInitOptions { - /** A map of environment variables. */ - env: Record; - /** A function that turns an asset filename into a `ReadableStream`. Required for the `read` export from `$app/server` to work. */ - read?: (file: string) => MaybePromise; -} - -export interface SSRManifest { - appDir: string; - appPath: string; - /** Static files from `kit.config.files.assets` and the service worker (if any). */ - assets: Set; - mimeTypes: Record; - - /** private fields */ - _: { - client: NonNullable; - nodes: SSRNodeLoader[]; - /** hashed filename -> import to that file */ - remotes: Record Promise>; - routes: SSRRoute[]; - prerendered_routes: Set; - matchers: () => Promise>; - /** A `[file]: size` map of all assets imported by server code. */ - server_assets: Record; - }; -} - -/** - * The generic form of `PageServerLoad` and `LayoutServerLoad`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) - * rather than using `ServerLoad` directly. - */ -export type ServerLoad< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - ParentData extends Record = Record, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null -> = (event: ServerLoadEvent) => MaybePromise; - -export interface ServerLoadEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - ParentData extends Record = Record, - RouteId extends AppRouteId | null = AppRouteId | null -> extends RequestEvent { - /** - * `await parent()` returns data from parent `+layout.server.js` `load` functions. - * - * Be careful not to introduce accidental waterfalls when using `await parent()`. If for example you only want to merge parent data into the returned output, call it _after_ fetching your other data. - */ - parent: () => Promise; - /** - * This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun. - * - * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`. - * - * URLs can be absolute or relative to the page being loaded, and must be [encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding). - * - * Custom identifiers have to be prefixed with one or more lowercase letters followed by a colon to conform to the [URI specification](https://www.rfc-editor.org/rfc/rfc3986.html). - * - * The following example shows how to use `depends` to register a dependency on a custom identifier, which is `invalidate`d after a button click, making the `load` function rerun. - * - * ```js - * /// file: src/routes/+page.js - * let count = 0; - * export async function load({ depends }) { - * depends('increase:count'); - * - * return { count: count++ }; - * } - * ``` - * - * ```html - * /// file: src/routes/+page.svelte - * - * - *

{data.count}

- * - * ``` - */ - depends: (...deps: string[]) => void; - /** - * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example: - * - * ```js - * /// file: src/routes/+page.js - * export async function load({ untrack, url }) { - * // Untrack url.pathname so that path changes don't trigger a rerun - * if (untrack(() => url.pathname === '/')) { - * return { message: 'Welcome!' }; - * } - * } - * ``` - */ - untrack: (fn: () => T) => T; - - /** - * Access to spans for tracing. If tracing is not enabled, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current server `load` function. */ - current: Span; - }; -} - -/** - * Shape of a form action method that is part of `export const actions = {...}` in `+page.server.js`. - * See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. - */ -export type Action< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null -> = (event: RequestEvent) => MaybePromise; - -/** - * Shape of the `export const actions = {...}` object in `+page.server.js`. - * See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. - */ -export type Actions< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null -> = Record>; - -/** - * When calling a form action via fetch, the response will be one of these shapes. - * ```svelte - * { - * return ({ result }) => { - * // result is of type ActionResult - * }; - * }} - * ``` - */ -export type ActionResult< - Success extends Record | undefined = Record, - Failure extends Record | undefined = Record -> = - | { type: 'success'; status: number; data?: Success } - | { type: 'failure'; status: number; data?: Failure } - | { type: 'redirect'; status: number; location: string } - | { type: 'error'; status?: number; error: any }; - -/** - * The object returned by the [`error`](https://svelte.dev/docs/kit/@sveltejs-kit#error) function. - */ -export interface HttpError { - /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses), in the range 400-599. */ - status: number; - /** The content of the error. */ - body: App.Error; -} - -/** - * The object returned by the [`redirect`](https://svelte.dev/docs/kit/@sveltejs-kit#redirect) function. - */ -export interface Redirect { - /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages), in the range 300-308. */ - status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308; - /** The location to redirect to. */ - location: string; -} - -export type SubmitFunction< - Success extends Record | undefined = Record, - Failure extends Record | undefined = Record -> = (input: { - action: URL; - formData: FormData; - formElement: HTMLFormElement; - controller: AbortController; - submitter: HTMLElement | null; - cancel: () => void; -}) => MaybePromise< - | void - | ((opts: { - formData: FormData; - formElement: HTMLFormElement; - action: URL; - result: ActionResult; - /** - * Call this to get the default behavior of a form submission response. - * @param options Set `reset: false` if you don't want the `` values to be reset after a successful submission. - * @param invalidateAll Set `invalidateAll: false` if you don't want the action to call `invalidateAll` after submission. - */ - update: (options?: { reset?: boolean; invalidateAll?: boolean }) => Promise; - }) => MaybePromise) ->; - -/** - * The type of `export const snapshot` exported from a page or layout component. - */ -export interface Snapshot { - capture: () => T; - restore: (snapshot: T) => void; -} - -// If T is unknown or has an index signature, the types below will recurse indefinitely and create giant unions that TS can't handle -type WillRecurseIndefinitely = unknown extends T ? true : string extends keyof T ? true : false; - -// Input type mappings for form fields -type InputTypeMap = { - text: string; - email: string; - password: string; - url: string; - tel: string; - search: string; - number: number; - range: number; - date: string; - 'datetime-local': string; - time: string; - month: string; - week: string; - color: string; - checkbox: boolean | string[]; - radio: string; - file: File; - hidden: string; - submit: string; - button: string; - reset: string; - image: string; - select: string; - 'select multiple': string[]; - 'file multiple': File[]; -}; - -// Valid input types for a given value type -export type RemoteFormFieldType = { - [K in keyof InputTypeMap]: T extends InputTypeMap[K] ? K : never; -}[keyof InputTypeMap]; - -// Input element properties based on type -type InputElementProps = T extends 'checkbox' | 'radio' - ? { - name: string; - type: T; - value?: string; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get checked(): boolean; - set checked(value: boolean); - } - : T extends 'file' - ? { - name: string; - type: 'file'; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get files(): FileList | null; - set files(v: FileList | null); - } - : T extends 'select' | 'select multiple' - ? { - name: string; - multiple: T extends 'select' ? false : true; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - } - : T extends 'text' - ? { - name: string; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - } - : { - name: string; - type: T; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - }; - -type RemoteFormFieldMethods = { - /** The values that will be submitted */ - value(): DeepPartial; - /** Set the values that will be submitted */ - set(input: DeepPartial): DeepPartial; - /** Validation issues, if any */ - issues(): RemoteFormIssue[] | undefined; -}; - -export type RemoteFormFieldValue = string | string[] | number | boolean | File | File[]; - -type AsArgs = Type extends 'checkbox' - ? Value extends string[] - ? [type: Type, value: Value[number] | (string & {})] - : [type: Type] - : Type extends 'radio' | 'submit' | 'hidden' - ? [type: Type, value: Value | (string & {})] - : [type: Type]; - -/** - * Form field accessor type that provides name(), value(), and issues() methods - */ -export type RemoteFormField = RemoteFormFieldMethods & { - /** - * Returns an object that can be spread onto an input element with the correct type attribute, - * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. - * @example - * ```svelte - * - * - * - * ``` - */ - as>(...args: AsArgs): InputElementProps; -}; - -type RemoteFormFieldContainer = RemoteFormFieldMethods & { - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; -}; - -type UnknownField = RemoteFormFieldMethods & { - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; - /** - * Returns an object that can be spread onto an input element with the correct type attribute, - * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. - * @example - * ```svelte - * - * - * - * ``` - */ - as>(...args: AsArgs): InputElementProps; -} & { - [key: string | number]: UnknownField; -}; - -type RemoteFormFieldsRoot = - IsAny extends true - ? RecursiveFormFields - : Input extends void - ? { - /** Validation issues, if any */ - issues(): RemoteFormIssue[] | undefined; - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; - } - : RemoteFormFields; - -/** - * Recursive type to build form fields structure with proxy access - */ -export type RemoteFormFields = - WillRecurseIndefinitely extends true - ? RecursiveFormFields - : NonNullable extends string | number | boolean | File - ? RemoteFormField> - : T extends string[] | File[] - ? RemoteFormField & { [K in number]: RemoteFormField } - : T extends Array - ? RemoteFormFieldContainer & { - [K in number]: RemoteFormFields; - } - : RemoteFormFieldContainer & { - [K in keyof T]-?: RemoteFormFields; - }; - -// By breaking this out into its own type, we avoid the TS recursion depth limit -type RecursiveFormFields = RemoteFormFieldContainer & { - [key: string | number]: UnknownField; -}; - -type MaybeArray = T | T[]; - -export interface RemoteFormInput { - [key: string]: MaybeArray; -} - -export interface RemoteFormIssue { - message: string; - path: Array; -} - -// If the schema specifies `id` as a string or number, ensure that `for(...)` -// only accepts that type. Otherwise, accept `string | number` -type ExtractId = Input extends { id: infer Id } - ? Id extends string | number - ? Id - : string | number - : string | number; - -/** - * A function and proxy object used to imperatively create validation errors in form handlers. - * - * Access properties to create field-specific issues: `issue.fieldName('message')`. - * The type structure mirrors the input data structure for type-safe field access. - * Call `invalid(issue.foo(...), issue.nested.bar(...))` to throw a validation error. - */ -export type InvalidField = - WillRecurseIndefinitely extends true - ? Record - : NonNullable extends string | number | boolean | File - ? (message: string) => StandardSchemaV1.Issue - : NonNullable extends Array - ? { - [K in number]: InvalidField; - } & ((message: string) => StandardSchemaV1.Issue) - : NonNullable extends RemoteFormInput - ? { - [K in keyof T]-?: InvalidField; - } & ((message: string) => StandardSchemaV1.Issue) - : Record; - -/** - * A validation error thrown by `invalid`. - */ -export interface ValidationError { - /** The validation issues */ - issues: StandardSchemaV1.Issue[]; -} - -/** - * The return value of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation. - */ -export type RemoteForm = { - /** Attachment that sets up an event handler that intercepts the form submission on the client to prevent a full page reload */ - [attachment: symbol]: (node: HTMLFormElement) => void; - method: 'POST'; - /** The URL to send the form to. */ - action: string; - /** Use the `enhance` method to influence what happens when the form is submitted. */ - enhance( - callback: (opts: { - form: HTMLFormElement; - data: Input; - submit: () => Promise & { - updates: (...queries: Array | RemoteQueryOverride>) => Promise; - }; - }) => void | Promise - ): { - method: 'POST'; - action: string; - [attachment: symbol]: (node: HTMLFormElement) => void; - }; - /** - * Create an instance of the form for the given `id`. - * The `id` is stringified and used for deduplication to potentially reuse existing instances. - * Useful when you have multiple forms that use the same remote form action, for example in a loop. - * ```svelte - * {#each todos as todo} - * {@const todoForm = updateTodo.for(todo.id)} - * - * {#if todoForm.result?.invalid}

Invalid data

{/if} - * ... - * - * {/each} - * ``` - */ - for(id: ExtractId): Omit, 'for'>; - /** Preflight checks */ - preflight(schema: StandardSchemaV1): RemoteForm; - /** Validate the form contents programmatically */ - validate(options?: { - /** Set this to `true` to also show validation issues of fields that haven't been touched yet. */ - includeUntouched?: boolean; - /** Set this to `true` to only run the `preflight` validation. */ - preflightOnly?: boolean; - }): Promise; - /** The result of the form submission */ - get result(): Output | undefined; - /** The number of pending submissions */ - get pending(): number; - /** Access form fields using object notation */ - fields: RemoteFormFieldsRoot; -}; - -/** - * The return value of a remote `command` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation. - */ -export type RemoteCommand = { - (arg: undefined extends Input ? Input | void : Input): Promise> & { - updates(...queries: Array | RemoteQueryOverride>): Promise>; - }; - /** The number of pending command executions */ - get pending(): number; -}; - -export type RemoteResource = Promise> & { - /** The error in case the query fails. Most often this is a [`HttpError`](https://svelte.dev/docs/kit/@sveltejs-kit#HttpError) but it isn't guaranteed to be. */ - get error(): any; - /** `true` before the first result is available and during refreshes */ - get loading(): boolean; -} & ( - | { - /** The current value of the query. Undefined until `ready` is `true` */ - get current(): undefined; - ready: false; - } - | { - /** The current value of the query. Undefined until `ready` is `true` */ - get current(): Awaited; - ready: true; - } - ); - -export type RemoteQuery = RemoteResource & { - /** - * On the client, this function will update the value of the query without re-fetching it. - * - * On the server, this can be called in the context of a `command` or `form` and the specified data will accompany the action response back to the client. - * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip. - */ - set(value: T): void; - /** - * On the client, this function will re-fetch the query from the server. - * - * On the server, this can be called in the context of a `command` or `form` and the refreshed data will accompany the action response back to the client. - * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip. - */ - refresh(): Promise; - /** - * Temporarily override the value of a query. This is used with the `updates` method of a [command](https://svelte.dev/docs/kit/remote-functions#command-Updating-queries) or [enhanced form submission](https://svelte.dev/docs/kit/remote-functions#form-enhance) to provide optimistic updates. - * - * ```svelte - * - * - *
{ - * await submit().updates( - * todos.withOverride((todos) => [...todos, { text: data.get('text') }]) - * ); - * })}> - * - * - *
- * ``` - */ - withOverride(update: (current: Awaited) => Awaited): RemoteQueryOverride; -}; - -export interface RemoteQueryOverride { - _key: string; - release(): void; -} - -/** - * The return value of a remote `prerender` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation. - */ -export type RemotePrerenderFunction = ( - arg: undefined extends Input ? Input | void : Input -) => RemoteResource; - -/** - * The return value of a remote `query` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation. - */ -export type RemoteQueryFunction = ( - arg: undefined extends Input ? Input | void : Input -) => RemoteQuery; - -export * from './index.js'; diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_server.js b/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_server.js deleted file mode 100644 index 379e0be..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_server.js +++ /dev/null @@ -1,240 +0,0 @@ -import fs from 'node:fs'; -import { mkdirp } from '../../../utils/filesystem.js'; -import { create_function_as_string, filter_fonts, find_deps, resolve_symlinks } from './utils.js'; -import { s } from '../../../utils/misc.js'; -import { normalizePath } from 'vite'; -import { basename } from 'node:path'; -import { fix_css_urls } from '../../../utils/css.js'; - -/** - * @param {string} out - * @param {import('types').ValidatedKitConfig} kit - * @param {import('types').ManifestData} manifest_data - * @param {import('vite').Manifest} server_manifest - * @param {import('vite').Manifest | null} client_manifest - * @param {string | null} assets_path - * @param {import('vite').Rollup.RollupOutput['output'] | null} client_chunks - * @param {import('types').RecursiveRequired} output_config - */ -export function build_server_nodes( - out, - kit, - manifest_data, - server_manifest, - client_manifest, - assets_path, - client_chunks, - output_config -) { - mkdirp(`${out}/server/nodes`); - mkdirp(`${out}/server/stylesheets`); - - /** - * Stylesheet names and their contents which are below the inline threshold - * @type {Map} - */ - const stylesheets_to_inline = new Map(); - - /** - * For CSS inlining, we either store a string or a function that returns the - * styles with the correct relative URLs - * @type {(css: string, eager_assets: Set) => string} - */ - let prepare_css_for_inlining = (css) => s(css); - - if (client_chunks && kit.inlineStyleThreshold > 0 && output_config.bundleStrategy === 'split') { - for (const chunk of client_chunks) { - if (chunk.type !== 'asset' || !chunk.fileName.endsWith('.css')) { - continue; - } - - const source = chunk.source.toString(); - if (source.length < kit.inlineStyleThreshold) { - stylesheets_to_inline.set(chunk.fileName, source); - } - } - - // If the client CSS has URL references to assets, we need to adjust the - // relative path so that they are correct when inlined into the document. - // Although `paths.assets` is static, we need to pass in a fake path - // `/_svelte_kit_assets` at runtime when running `vite preview` - if (kit.paths.assets || kit.paths.relative) { - const static_assets = new Set( - manifest_data.assets.map((asset) => decodeURIComponent(asset.file)) - ); - - const segments = /** @type {string} */ (assets_path).split('/'); - const static_asset_prefix = segments.map(() => '..').join('/') + '/'; - - prepare_css_for_inlining = (css, eager_assets) => { - const transformed_css = fix_css_urls({ - css, - vite_assets: eager_assets, - static_assets, - paths_assets: '${assets}', - base: '${base}', - static_asset_prefix - }); - - // only convert to a function if we have adjusted any URLs - if (css !== transformed_css) { - return create_function_as_string('css', ['assets', 'base'], transformed_css); - } - - return s(css); - }; - } - } - - for (let i = 0; i < manifest_data.nodes.length; i++) { - const node = manifest_data.nodes[i]; - - /** @type {string[]} */ - const imports = []; - - // String representation of - /** @type {import('types').SSRNode} */ - /** @type {string[]} */ - const exports = [`export const index = ${i};`]; - - /** @type {string[]} */ - let imported = []; - - /** @type {string[]} */ - let stylesheets = []; - - /** @type {string[]} */ - let fonts = []; - - /** @type {Set} */ - const eager_assets = new Set(); - - if (node.component && client_manifest) { - exports.push( - 'let component_cache;', - `export const component = async () => component_cache ??= (await import('../${ - resolve_symlinks(server_manifest, node.component).chunk.file - }')).default;` - ); - } - - if (node.universal) { - if (!!node.page_options && node.page_options.ssr === false) { - exports.push(`export const universal = ${s(node.page_options, null, 2)};`); - } else { - imports.push( - `import * as universal from '../${resolve_symlinks(server_manifest, node.universal).chunk.file}';` - ); - // TODO: when building for analysis, explain why the file was loaded on the server if we fail to load it - exports.push('export { universal };'); - } - exports.push(`export const universal_id = ${s(node.universal)};`); - } - - if (node.server) { - imports.push( - `import * as server from '../${resolve_symlinks(server_manifest, node.server).chunk.file}';` - ); - exports.push('export { server };'); - exports.push(`export const server_id = ${s(node.server)};`); - } - - if ( - client_manifest && - (node.universal || node.component) && - output_config.bundleStrategy === 'split' - ) { - const entry_path = `${normalizePath(kit.outDir)}/generated/client-optimized/nodes/${i}.js`; - const entry = find_deps(client_manifest, entry_path, true); - - // Eagerly load client stylesheets and fonts imported by the SSR-ed page to avoid FOUC. - // However, if it is not used during SSR (not present in the server manifest), - // then it can be lazily loaded in the browser. - - /** @type {import('types').AssetDependencies | undefined} */ - let component; - if (node.component) { - component = find_deps(server_manifest, node.component, true); - } - - /** @type {import('types').AssetDependencies | undefined} */ - let universal; - if (node.universal) { - universal = find_deps(server_manifest, node.universal, true); - } - - /** @type {Set} */ - const eager_css = new Set(); - - entry.stylesheet_map.forEach((value, filepath) => { - // pages and layouts are renamed to node indexes when optimised for the client - // so we use the original filename instead to check against the server manifest - if (filepath === entry_path) { - filepath = node.component ?? filepath; - } - - if (component?.stylesheet_map.has(filepath) || universal?.stylesheet_map.has(filepath)) { - value.css.forEach((file) => eager_css.add(file)); - value.assets.forEach((file) => eager_assets.add(file)); - } - }); - - imported = entry.imports; - stylesheets = Array.from(eager_css); - fonts = filter_fonts(Array.from(eager_assets)); - } - - exports.push( - `export const imports = ${s(imported)};`, - `export const stylesheets = ${s(stylesheets)};`, - `export const fonts = ${s(fonts)};` - ); - - /** - * Assets that have been processed by Vite (decoded and with the asset path stripped) - * @type {Set} - */ - let vite_assets = new Set(); - - // Keep track of Vite asset filenames so that we avoid touching unrelated ones - // when adjusting the inlined CSS - if (stylesheets_to_inline.size && assets_path && eager_assets.size) { - vite_assets = new Set( - Array.from(eager_assets).map((asset) => { - return decodeURIComponent(asset.replace(`${assets_path}/`, '')); - }) - ); - } - - if (stylesheets_to_inline.size) { - /** @type {string[]} */ - const inline_styles = []; - - stylesheets.forEach((file, i) => { - if (stylesheets_to_inline.has(file)) { - const filename = basename(file); - const dest = `${out}/server/stylesheets/${filename}.js`; - - const css = /** @type {string} */ (stylesheets_to_inline.get(file)); - - fs.writeFileSync( - dest, - `// ${filename}\nexport default ${prepare_css_for_inlining(css, vite_assets)};` - ); - const name = `stylesheet_${i}`; - imports.push(`import ${name} from '../stylesheets/${filename}.js';`); - inline_styles.push(`\t${s(file)}: ${name}`); - } - }); - - if (inline_styles.length > 0) { - exports.push(`export const inline_styles = () => ({\n${inline_styles.join(',\n')}\n});`); - } - } - - fs.writeFileSync( - `${out}/server/nodes/${i}.js`, - `${imports.join('\n')}\n\n${exports.join('\n')}\n` - ); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_service_worker.js b/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_service_worker.js deleted file mode 100644 index e4daf37..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/build/build_service_worker.js +++ /dev/null @@ -1,139 +0,0 @@ -import fs from 'node:fs'; -import process from 'node:process'; -import * as vite from 'vite'; -import { dedent } from '../../../core/sync/utils.js'; -import { s } from '../../../utils/misc.js'; -import { get_config_aliases, strip_virtual_prefix, get_env, normalize_id } from '../utils.js'; -import { create_static_module } from '../../../core/env.js'; -import { env_static_public, service_worker } from '../module_ids.js'; - -// @ts-ignore `vite.rolldownVersion` only exists in `rolldown-vite` -const isRolldown = !!vite.rolldownVersion; - -/** - * @param {string} out - * @param {import('types').ValidatedKitConfig} kit - * @param {import('vite').ResolvedConfig} vite_config - * @param {import('types').ManifestData} manifest_data - * @param {string} service_worker_entry_file - * @param {import('types').Prerendered} prerendered - * @param {import('vite').Manifest} client_manifest - */ -export async function build_service_worker( - out, - kit, - vite_config, - manifest_data, - service_worker_entry_file, - prerendered, - client_manifest -) { - const build = new Set(); - for (const key in client_manifest) { - const { file, css = [], assets = [] } = client_manifest[key]; - build.add(file); - css.forEach((file) => build.add(file)); - assets.forEach((file) => build.add(file)); - } - - // in a service worker, `location` is the location of the service worker itself, - // which is guaranteed to be `/service-worker.js` - const base = "location.pathname.split('/').slice(0, -1).join('/')"; - - const service_worker_code = dedent` - export const base = /*@__PURE__*/ ${base}; - - export const build = [ - ${Array.from(build) - .map((file) => `base + ${s(`/${file}`)}`) - .join(',\n')} - ]; - - export const files = [ - ${manifest_data.assets - .filter((asset) => kit.serviceWorker.files(asset.file)) - .map((asset) => `base + ${s(`/${asset.file}`)}`) - .join(',\n')} - ]; - - export const prerendered = [ - ${prerendered.paths.map((path) => `base + ${s(path.replace(kit.paths.base, ''))}`).join(',\n')} - ]; - - export const version = ${s(kit.version.name)}; - `; - - const env = get_env(kit.env, vite_config.mode); - - /** - * @type {import('vite').Plugin} - */ - const sw_virtual_modules = { - name: 'service-worker-build-virtual-modules', - resolveId(id) { - if (id.startsWith('$env/') || id.startsWith('$app/') || id === '$service-worker') { - // ids with :$ don't work with reverse proxies like nginx - return `\0virtual:${id.substring(1)}`; - } - }, - - load(id) { - if (!id.startsWith('\0virtual:')) return; - - if (id === service_worker) { - return service_worker_code; - } - - if (id === env_static_public) { - return create_static_module('$env/static/public', env.public); - } - - const normalized_cwd = vite.normalizePath(process.cwd()); - const normalized_lib = vite.normalizePath(kit.files.lib); - const relative = normalize_id(id, normalized_lib, normalized_cwd); - const stripped = strip_virtual_prefix(relative); - throw new Error( - `Cannot import ${stripped} into service-worker code. Only the modules $service-worker and $env/static/public are available in service workers.` - ); - } - }; - - await vite.build({ - build: { - modulePreload: false, - rollupOptions: { - input: { - 'service-worker': service_worker_entry_file - }, - output: { - // .mjs so that esbuild doesn't incorrectly inject `export` https://github.com/vitejs/vite/issues/15379 - entryFileNames: `service-worker.${isRolldown ? 'js' : 'mjs'}`, - assetFileNames: `${kit.appDir}/immutable/assets/[name].[hash][extname]`, - inlineDynamicImports: true - } - }, - outDir: `${out}/client`, - emptyOutDir: false, - minify: vite_config.build.minify - }, - configFile: false, - define: vite_config.define, - publicDir: false, - plugins: [sw_virtual_modules], - resolve: { - alias: [...get_config_aliases(kit)] - }, - experimental: { - renderBuiltUrl(filename) { - return { - runtime: `new URL(${JSON.stringify(filename)}, location.href).pathname` - }; - } - } - }); - - // rename .mjs to .js to avoid incorrect MIME types with ancient webservers - if (!isRolldown) { - fs.renameSync(`${out}/client/service-worker.mjs`, `${out}/client/service-worker.js`); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/build/utils.js b/web/node_modules/@sveltejs/kit/src/exports/vite/build/utils.js deleted file mode 100644 index 8da2e70..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/build/utils.js +++ /dev/null @@ -1,147 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import { normalizePath } from 'vite'; -import { s } from '../../../utils/misc.js'; - -/** - * Adds transitive JS and CSS dependencies to the js and css inputs. - * @param {import('vite').Manifest} manifest - * @param {string} entry - * @param {boolean} add_dynamic_css - * @returns {import('types').AssetDependencies} - */ -export function find_deps(manifest, entry, add_dynamic_css) { - /** @type {Set} */ - const seen = new Set(); - - /** @type {Set} */ - const imports = new Set(); - - /** @type {Set} */ - const stylesheets = new Set(); - - /** @type {Set} */ - const imported_assets = new Set(); - - /** @type {Map; assets: Set }>} */ - const stylesheet_map = new Map(); - - /** - * @param {string} current - * @param {boolean} add_js - * @param {string} initial_importer - * @param {number} dynamic_import_depth - */ - function traverse(current, add_js, initial_importer, dynamic_import_depth) { - if (seen.has(current)) return; - seen.add(current); - - const { chunk } = resolve_symlinks(manifest, current); - - if (add_js) imports.add(chunk.file); - - if (chunk.assets) { - chunk.assets.forEach((asset) => imported_assets.add(asset)); - } - - if (chunk.css) { - chunk.css.forEach((file) => stylesheets.add(file)); - } - - if (chunk.imports) { - chunk.imports.forEach((file) => - traverse(file, add_js, initial_importer, dynamic_import_depth) - ); - } - - if (!add_dynamic_css) return; - - if ((chunk.css || chunk.assets) && dynamic_import_depth <= 1) { - // group files based on the initial importer because if a file is only ever - // a transitive dependency, it doesn't have a suitable name we can map back to - // the server manifest - if (stylesheet_map.has(initial_importer)) { - const { css, assets } = /** @type {{ css: Set; assets: Set }} */ ( - stylesheet_map.get(initial_importer) - ); - if (chunk.css) chunk.css.forEach((file) => css.add(file)); - if (chunk.assets) chunk.assets.forEach((file) => assets.add(file)); - } else { - stylesheet_map.set(initial_importer, { - css: new Set(chunk.css), - assets: new Set(chunk.assets) - }); - } - } - - if (chunk.dynamicImports) { - dynamic_import_depth++; - chunk.dynamicImports.forEach((file) => { - traverse(file, false, file, dynamic_import_depth); - }); - } - } - - const { chunk, file } = resolve_symlinks(manifest, entry); - - traverse(file, true, entry, 0); - - const assets = Array.from(imported_assets); - - return { - assets, - file: chunk.file, - imports: Array.from(imports), - stylesheets: Array.from(stylesheets), - // TODO do we need this separately? - fonts: filter_fonts(assets), - stylesheet_map - }; -} - -/** - * @param {import('vite').Manifest} manifest - * @param {string} file - */ -export function resolve_symlinks(manifest, file) { - while (!manifest[file]) { - const next = normalizePath(path.relative('.', fs.realpathSync(file))); - if (next === file) throw new Error(`Could not find file "${file}" in Vite manifest`); - file = next; - } - - const chunk = manifest[file]; - - return { chunk, file }; -} - -/** - * @param {string[]} assets - * @returns {string[]} - */ -export function filter_fonts(assets) { - return assets.filter((asset) => /\.(woff2?|ttf|otf)$/.test(asset)); -} - -/** - * @param {import('types').ValidatedKitConfig} config - * @returns {string} - */ -export function assets_base(config) { - return (config.paths.assets || config.paths.base || '.') + '/'; -} - -/** - * Writes a function with arguments used by a template literal. - * This helps us store strings in a module and inject values at runtime. - * @param {string} name The name of the function - * @param {string[]} placeholder_names The names of the placeholders in the string - * @param {string} str A string with placeholders such as "Hello ${arg0}". - * It must have backticks and dollar signs escaped. - * @returns {string} The function written as a string - */ -export function create_function_as_string(name, placeholder_names, str) { - str = s(str).slice(1, -1); - const args = placeholder_names ? placeholder_names.join(', ') : ''; - return `function ${name}(${args}) { return \`${str}\`; }`; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js b/web/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js deleted file mode 100644 index 031856f..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js +++ /dev/null @@ -1,669 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import { URL } from 'node:url'; -import { AsyncLocalStorage } from 'node:async_hooks'; -import colors from 'kleur'; -import sirv from 'sirv'; -import { isCSSRequest, loadEnv, buildErrorMessage } from 'vite'; -import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js'; -import { installPolyfills } from '../../../exports/node/polyfills.js'; -import { coalesce_to_error } from '../../../utils/error.js'; -import { from_fs, posixify, resolve_entry, to_fs } from '../../../utils/filesystem.js'; -import { load_error_page } from '../../../core/config/index.js'; -import { SVELTE_KIT_ASSETS } from '../../../constants.js'; -import * as sync from '../../../core/sync/sync.js'; -import { get_mime_lookup, runtime_base } from '../../../core/utils.js'; -import { compact } from '../../../utils/array.js'; -import { not_found } from '../utils.js'; -import { SCHEME } from '../../../utils/url.js'; -import { check_feature } from '../../../utils/features.js'; -import { escape_html } from '../../../utils/escape.js'; - -const cwd = process.cwd(); -// vite-specifc queries that we should skip handling for css urls -const vite_css_query_regex = /(?:\?|&)(?:raw|url|inline)(?:&|$)/; - -/** - * @param {import('vite').ViteDevServer} vite - * @param {import('vite').ResolvedConfig} vite_config - * @param {import('types').ValidatedConfig} svelte_config - * @param {() => Array<{ hash: string, file: string }>} get_remotes - * @return {Promise void>>} - */ -export async function dev(vite, vite_config, svelte_config, get_remotes) { - installPolyfills(); - - const async_local_storage = new AsyncLocalStorage(); - - globalThis.__SVELTEKIT_TRACK__ = (label) => { - const context = async_local_storage.getStore(); - if (!context || context.prerender === true) return; - - check_feature(context.event.route.id, context.config, label, svelte_config.kit.adapter); - }; - - const fetch = globalThis.fetch; - globalThis.fetch = (info, init) => { - if (typeof info === 'string' && !SCHEME.test(info)) { - throw new Error( - `Cannot use relative URL (${info}) with global fetch — use \`event.fetch\` instead: https://svelte.dev/docs/kit/web-standards#fetch-apis` - ); - } - - return fetch(info, init); - }; - - sync.init(svelte_config, vite_config.mode); - - /** @type {import('types').ManifestData} */ - let manifest_data; - /** @type {import('@sveltejs/kit').SSRManifest} */ - let manifest; - - /** @type {Error | null} */ - let manifest_error = null; - - /** @param {string} url */ - async function loud_ssr_load_module(url) { - try { - return await vite.ssrLoadModule(url, { fixStacktrace: true }); - } catch (/** @type {any} */ err) { - const msg = buildErrorMessage(err, [colors.red(`Internal server error: ${err.message}`)]); - - if (!vite.config.logger.hasErrorLogged(err)) { - vite.config.logger.error(msg, { error: err }); - } - - vite.ws.send({ - type: 'error', - err: { - ...err, - // these properties are non-enumerable and will - // not be serialized unless we explicitly include them - message: err.message, - stack: err.stack - } - }); - - throw err; - } - } - - /** @param {string} id */ - async function resolve(id) { - const url = id.startsWith('..') ? to_fs(path.posix.resolve(id)) : `/${id}`; - - const module = await loud_ssr_load_module(url); - - const module_node = await vite.moduleGraph.getModuleByUrl(url); - if (!module_node) throw new Error(`Could not find node for ${url}`); - - return { module, module_node, url }; - } - - function update_manifest() { - try { - ({ manifest_data } = sync.create(svelte_config)); - - if (manifest_error) { - manifest_error = null; - vite.ws.send({ type: 'full-reload' }); - } - } catch (error) { - manifest_error = /** @type {Error} */ (error); - - console.error(colors.bold().red(manifest_error.message)); - vite.ws.send({ - type: 'error', - err: { - message: manifest_error.message ?? 'Invalid routes', - stack: '' - } - }); - - return; - } - - manifest = { - appDir: svelte_config.kit.appDir, - appPath: svelte_config.kit.appDir, - assets: new Set(manifest_data.assets.map((asset) => asset.file)), - mimeTypes: get_mime_lookup(manifest_data), - _: { - client: { - start: `${runtime_base}/client/entry.js`, - app: `${to_fs(svelte_config.kit.outDir)}/generated/client/app.js`, - imports: [], - stylesheets: [], - fonts: [], - uses_env_dynamic_public: true, - nodes: - svelte_config.kit.router.resolution === 'client' - ? undefined - : manifest_data.nodes.map((node, i) => { - if (node.component || node.universal) { - return `${svelte_config.kit.paths.base}${to_fs(svelte_config.kit.outDir)}/generated/client/nodes/${i}.js`; - } - }), - // `css` is not necessary in dev, as the JS file from `nodes` will reference the CSS file - routes: - svelte_config.kit.router.resolution === 'client' - ? undefined - : compact( - manifest_data.routes.map((route) => { - if (!route.page) return; - - return { - id: route.id, - pattern: route.pattern, - params: route.params, - layouts: route.page.layouts.map((l) => - l !== undefined ? [!!manifest_data.nodes[l].server, l] : undefined - ), - errors: route.page.errors, - leaf: [!!manifest_data.nodes[route.page.leaf].server, route.page.leaf] - }; - }) - ) - }, - server_assets: new Proxy( - {}, - { - has: (_, /** @type {string} */ file) => fs.existsSync(from_fs(file)), - get: (_, /** @type {string} */ file) => fs.statSync(from_fs(file)).size - } - ), - nodes: manifest_data.nodes.map((node, index) => { - return async () => { - /** @type {import('types').SSRNode} */ - const result = {}; - result.index = index; - result.universal_id = node.universal; - result.server_id = node.server; - - // these are unused in dev, but it's easier to include them - result.imports = []; - result.stylesheets = []; - result.fonts = []; - - /** @type {import('vite').ModuleNode[]} */ - const module_nodes = []; - - if (node.component) { - result.component = async () => { - const { module_node, module } = await resolve( - /** @type {string} */ (node.component) - ); - - module_nodes.push(module_node); - - return module.default; - }; - } - - if (node.universal) { - if (node.page_options?.ssr === false) { - result.universal = node.page_options; - } else { - // TODO: explain why the file was loaded on the server if we fail to load it - const { module, module_node } = await resolve(node.universal); - module_nodes.push(module_node); - result.universal = module; - } - } - - if (node.server) { - const { module } = await resolve(node.server); - result.server = module; - } - - // in dev we inline all styles to avoid FOUC. this gets populated lazily so that - // components/stylesheets loaded via import() during `load` are included - result.inline_styles = async () => { - /** @type {Set} */ - const deps = new Set(); - - for (const module_node of module_nodes) { - await find_deps(vite, module_node, deps); - } - - /** @type {Record} */ - const styles = {}; - - for (const dep of deps) { - if (isCSSRequest(dep.url) && !vite_css_query_regex.test(dep.url)) { - const inlineCssUrl = dep.url.includes('?') - ? dep.url.replace('?', '?inline&') - : dep.url + '?inline'; - try { - const mod = await vite.ssrLoadModule(inlineCssUrl); - styles[dep.url] = mod.default; - } catch { - // this can happen with dynamically imported modules, I think - // because the Vite module graph doesn't distinguish between - // static and dynamic imports? TODO investigate, submit fix - } - } - } - - return styles; - }; - - return result; - }; - }), - prerendered_routes: new Set(), - get remotes() { - return Object.fromEntries( - get_remotes().map((remote) => [ - remote.hash, - () => vite.ssrLoadModule(remote.file).then((module) => ({ default: module })) - ]) - ); - }, - routes: compact( - manifest_data.routes.map((route) => { - if (!route.page && !route.endpoint) return null; - - const endpoint = route.endpoint; - - return { - id: route.id, - pattern: route.pattern, - params: route.params, - page: route.page, - endpoint: endpoint - ? async () => { - const url = path.resolve(cwd, endpoint.file); - return await loud_ssr_load_module(url); - } - : null, - endpoint_id: endpoint?.file - }; - }) - ), - matchers: async () => { - /** @type {Record} */ - const matchers = {}; - - for (const key in manifest_data.matchers) { - const file = manifest_data.matchers[key]; - const url = path.resolve(cwd, file); - const module = await vite.ssrLoadModule(url, { fixStacktrace: true }); - - if (module.match) { - matchers[key] = module.match; - } else { - throw new Error(`${file} does not export a \`match\` function`); - } - } - - return matchers; - } - } - }; - } - - /** @param {Error} error */ - function fix_stack_trace(error) { - try { - vite.ssrFixStacktrace(error); - } catch { - // ssrFixStacktrace can fail on StackBlitz web containers and we don't know why - // by ignoring it the line numbers are wrong, but at least we can show the error - } - return error.stack; - } - - update_manifest(); - - /** - * @param {string} event - * @param {(file: string) => void} cb - */ - const watch = (event, cb) => { - vite.watcher.on(event, (file) => { - if ( - file.startsWith(svelte_config.kit.files.routes + path.sep) || - file.startsWith(svelte_config.kit.files.params + path.sep) || - svelte_config.kit.moduleExtensions.some((ext) => file.endsWith(`.remote${ext}`)) || - // in contrast to server hooks, client hooks are written to the client manifest - // and therefore need rebuilding when they are added/removed - file.startsWith(svelte_config.kit.files.hooks.client) - ) { - cb(file); - } - }); - }; - /** @type {NodeJS.Timeout | null } */ - let timeout = null; - /** @param {() => void} to_run */ - const debounce = (to_run) => { - timeout && clearTimeout(timeout); - timeout = setTimeout(() => { - timeout = null; - to_run(); - }, 100); - }; - - // flag to skip watchers if server is already restarting - let restarting = false; - - // Debounce add/unlink events because in case of folder deletion or moves - // they fire in rapid succession, causing needless invocations. - // These watchers only run for routes, param matchers, and client hooks. - watch('add', () => debounce(update_manifest)); - watch('unlink', () => debounce(update_manifest)); - watch('change', (file) => { - // Don't run for a single file if the whole manifest is about to get updated - // Unless it's a file where the trailing slash page option might have changed - if (timeout || restarting || !/\+(page|layout|server).*$/.test(file)) return; - sync.update(svelte_config, manifest_data, file); - }); - - const { appTemplate, errorTemplate, serviceWorker, hooks } = svelte_config.kit.files; - - // vite client only executes a full reload if the triggering html file path is index.html - // kit defaults to src/app.html, so unless user changed that to index.html - // send the vite client a full-reload event without path being set - if (appTemplate !== 'index.html') { - vite.watcher.on('change', (file) => { - if (file === appTemplate && !restarting) { - vite.ws.send({ type: 'full-reload' }); - } - }); - } - - vite.watcher.on('all', (_, file) => { - if ( - file === appTemplate || - file === errorTemplate || - file.startsWith(serviceWorker) || - file.startsWith(hooks.server) - ) { - sync.server(svelte_config); - } - }); - - vite.watcher.on('change', async (file) => { - // changing the svelte config requires restarting the dev server - // the config is only read on start and passed on to vite-plugin-svelte - // which needs up-to-date values to operate correctly - if (file.match(/[/\\]svelte\.config\.[jt]s$/)) { - console.log(`svelte config changed, restarting vite dev-server. changed file: ${file}`); - restarting = true; - await vite.restart(); - } - }); - - const assets = svelte_config.kit.paths.assets ? SVELTE_KIT_ASSETS : svelte_config.kit.paths.base; - const asset_server = sirv(svelte_config.kit.files.assets, { - dev: true, - etag: true, - maxAge: 0, - extensions: [], - setHeaders: (res) => { - res.setHeader('access-control-allow-origin', '*'); - } - }); - - vite.middlewares.use((req, res, next) => { - const base = `${vite.config.server.https ? 'https' : 'http'}://${ - req.headers[':authority'] || req.headers.host - }`; - - const decoded = decodeURI(new URL(base + req.url).pathname); - - if (decoded.startsWith(assets)) { - const pathname = decoded.slice(assets.length); - const file = svelte_config.kit.files.assets + pathname; - - if (fs.existsSync(file) && !fs.statSync(file).isDirectory()) { - if (has_correct_case(file, svelte_config.kit.files.assets)) { - req.url = encodeURI(pathname); // don't need query/hash - asset_server(req, res); - return; - } - } - } - - next(); - }); - - const env = loadEnv(vite_config.mode, svelte_config.kit.env.dir, ''); - const emulator = await svelte_config.kit.adapter?.emulate?.(); - - return () => { - const serve_static_middleware = vite.middlewares.stack.find( - (middleware) => - /** @type {function} */ (middleware.handle).name === 'viteServeStaticMiddleware' - ); - - // Vite will give a 403 on URLs like /test, /static, and /package.json preventing us from - // serving routes with those names. See https://github.com/vitejs/vite/issues/7363 - remove_static_middlewares(vite.middlewares); - - vite.middlewares.use(async (req, res) => { - // Vite's base middleware strips out the base path. Restore it - const original_url = req.url; - req.url = req.originalUrl; - try { - const base = `${vite.config.server.https ? 'https' : 'http'}://${ - req.headers[':authority'] || req.headers.host - }`; - - const decoded = decodeURI(new URL(base + req.url).pathname); - const file = posixify(path.resolve(decoded.slice(svelte_config.kit.paths.base.length + 1))); - const is_file = fs.existsSync(file) && !fs.statSync(file).isDirectory(); - const allowed = - !vite_config.server.fs.strict || - vite_config.server.fs.allow.some((dir) => file.startsWith(dir)); - - if (is_file && allowed) { - req.url = original_url; - // @ts-expect-error - serve_static_middleware.handle(req, res); - return; - } - - if (!decoded.startsWith(svelte_config.kit.paths.base)) { - return not_found(req, res, svelte_config.kit.paths.base); - } - - if (decoded === svelte_config.kit.paths.base + '/service-worker.js') { - const resolved = resolve_entry(svelte_config.kit.files.serviceWorker); - - if (resolved) { - res.writeHead(200, { - 'content-type': 'application/javascript' - }); - res.end(`import '${svelte_config.kit.paths.base}${to_fs(resolved)}';`); - } else { - res.writeHead(404); - res.end('not found'); - } - - return; - } - - const resolved_instrumentation = resolve_entry( - path.join(svelte_config.kit.files.src, 'instrumentation.server') - ); - - if (resolved_instrumentation) { - await vite.ssrLoadModule(resolved_instrumentation); - } - - // we have to import `Server` before calling `set_assets` - const { Server } = /** @type {import('types').ServerModule} */ ( - await vite.ssrLoadModule(`${runtime_base}/server/index.js`, { fixStacktrace: true }) - ); - - const { set_fix_stack_trace } = await vite.ssrLoadModule( - `${runtime_base}/shared-server.js` - ); - set_fix_stack_trace(fix_stack_trace); - - const { set_assets } = await vite.ssrLoadModule('$app/paths/internal/server'); - set_assets(assets); - - const server = new Server(manifest); - - await server.init({ - env, - read: (file) => createReadableStream(from_fs(file)) - }); - - const request = await getRequest({ - base, - request: req - }); - - if (manifest_error) { - console.error(colors.bold().red(manifest_error.message)); - - const error_page = load_error_page(svelte_config); - - /** @param {{ status: number; message: string }} opts */ - const error_template = ({ status, message }) => { - return error_page - .replace(/%sveltekit\.status%/g, String(status)) - .replace(/%sveltekit\.error\.message%/g, escape_html(message)); - }; - - res.writeHead(500, { - 'Content-Type': 'text/html; charset=utf-8' - }); - res.end( - error_template({ status: 500, message: manifest_error.message ?? 'Invalid routes' }) - ); - - return; - } - - const rendered = await server.respond(request, { - getClientAddress: () => { - const { remoteAddress } = req.socket; - if (remoteAddress) return remoteAddress; - throw new Error('Could not determine clientAddress'); - }, - read: (file) => { - if (file in manifest._.server_assets) { - return fs.readFileSync(from_fs(file)); - } - - return fs.readFileSync(path.join(svelte_config.kit.files.assets, file)); - }, - before_handle: (event, config, prerender) => { - async_local_storage.enterWith({ event, config, prerender }); - }, - emulator - }); - - if (rendered.status === 404) { - // @ts-expect-error - serve_static_middleware.handle(req, res, () => { - void setResponse(res, rendered); - }); - } else { - void setResponse(res, rendered); - } - } catch (e) { - const error = coalesce_to_error(e); - res.statusCode = 500; - res.end(fix_stack_trace(error)); - } - }); - }; -} - -/** - * @param {import('connect').Server} server - */ -function remove_static_middlewares(server) { - const static_middlewares = ['viteServeStaticMiddleware', 'viteServePublicMiddleware']; - for (let i = server.stack.length - 1; i > 0; i--) { - // @ts-expect-error using internals - if (static_middlewares.includes(server.stack[i].handle.name)) { - server.stack.splice(i, 1); - } - } -} - -/** - * @param {import('vite').ViteDevServer} vite - * @param {import('vite').ModuleNode | import('vite').EnvironmentModuleNode} node - * @param {Set} deps - */ -async function find_deps(vite, node, deps) { - // since `ssrTransformResult.deps` contains URLs instead of `ModuleNode`s, this process is asynchronous. - // instead of using `await`, we resolve all branches in parallel. - /** @type {Promise[]} */ - const branches = []; - - /** @param {import('vite').ModuleNode | import('vite').EnvironmentModuleNode} node */ - async function add(node) { - if (!deps.has(node)) { - deps.add(node); - await find_deps(vite, node, deps); - } - } - - /** @param {string} url */ - async function add_by_url(url) { - const node = await get_server_module_by_url(vite, url); - - if (node) { - await add(node); - } - } - - const transform_result = - /** @type {import('vite').ModuleNode} */ (node).ssrTransformResult || node.transformResult; - - if (transform_result) { - if (transform_result.deps) { - transform_result.deps.forEach((url) => branches.push(add_by_url(url))); - } - - if (transform_result.dynamicDeps) { - transform_result.dynamicDeps.forEach((url) => branches.push(add_by_url(url))); - } - } else { - node.importedModules.forEach((node) => branches.push(add(node))); - } - - await Promise.all(branches); -} - -/** - * @param {import('vite').ViteDevServer} vite - * @param {string} url - */ -function get_server_module_by_url(vite, url) { - return vite.environments - ? vite.environments.ssr.moduleGraph.getModuleByUrl(url) - : vite.moduleGraph.getModuleByUrl(url, true); -} - -/** - * Determine if a file is being requested with the correct case, - * to ensure consistent behaviour between dev and prod and across - * operating systems. Note that we can't use realpath here, - * because we don't want to follow symlinks - * @param {string} file - * @param {string} assets - * @returns {boolean} - */ -function has_correct_case(file, assets) { - if (file === assets) return true; - - const parent = path.dirname(file); - - if (fs.readdirSync(parent).includes(path.basename(file))) { - return has_correct_case(parent, assets); - } - - return false; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/index.js b/web/node_modules/@sveltejs/kit/src/exports/vite/index.js deleted file mode 100644 index 7e22d5e..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/index.js +++ /dev/null @@ -1,1464 +0,0 @@ -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; - -import colors from 'kleur'; - -import { copy, mkdirp, posixify, read, resolve_entry, rimraf } from '../../utils/filesystem.js'; -import { create_static_module, create_dynamic_module } from '../../core/env.js'; -import * as sync from '../../core/sync/sync.js'; -import { create_assets } from '../../core/sync/create_manifest_data/index.js'; -import { runtime_directory, logger } from '../../core/utils.js'; -import { load_config } from '../../core/config/index.js'; -import { generate_manifest } from '../../core/generate_manifest/index.js'; -import { build_server_nodes } from './build/build_server.js'; -import { build_service_worker } from './build/build_service_worker.js'; -import { assets_base, find_deps, resolve_symlinks } from './build/utils.js'; -import { dev } from './dev/index.js'; -import { preview } from './preview/index.js'; -import { - error_for_missing_config, - get_config_aliases, - get_env, - normalize_id, - stackless -} from './utils.js'; -import { write_client_manifest } from '../../core/sync/write_client_manifest.js'; -import prerender from '../../core/postbuild/prerender.js'; -import analyse from '../../core/postbuild/analyse.js'; -import { s } from '../../utils/misc.js'; -import { hash } from '../../utils/hash.js'; -import { dedent, isSvelte5Plus } from '../../core/sync/utils.js'; -import { - env_dynamic_private, - env_dynamic_public, - env_static_private, - env_static_public, - service_worker, - sveltekit_environment, - sveltekit_server -} from './module_ids.js'; -import { import_peer } from '../../utils/import.js'; -import { compact } from '../../utils/array.js'; -import { should_ignore, has_children } from './static_analysis/utils.js'; - -const cwd = posixify(process.cwd()); - -/** @type {import('./types.js').EnforcedConfig} */ -const enforced_config = { - appType: true, - base: true, - build: { - cssCodeSplit: true, - emptyOutDir: true, - lib: { - entry: true, - name: true, - formats: true - }, - manifest: true, - outDir: true, - rollupOptions: { - input: true, - output: { - format: true, - entryFileNames: true, - chunkFileNames: true, - assetFileNames: true - }, - preserveEntrySignatures: true - }, - ssr: true - }, - publicDir: true, - resolve: { - alias: { - $app: true, - $lib: true, - '$service-worker': true - } - }, - root: true -}; - -const options_regex = /(export\s+const\s+(prerender|csr|ssr|trailingSlash))\s*=/s; - -/** @type {Set} */ -const warned = new Set(); - -/** @type {import('svelte/compiler').PreprocessorGroup} */ -const warning_preprocessor = { - script: ({ content, filename }) => { - if (!filename) return; - - const basename = path.basename(filename); - if (basename.startsWith('+page.') || basename.startsWith('+layout.')) { - const match = content.match(options_regex); - if (match && match.index !== undefined && !should_ignore(content, match.index)) { - const fixed = basename.replace('.svelte', '(.server).js/ts'); - - const message = - `\n${colors.bold().red(path.relative('.', filename))}\n` + - `\`${match[1]}\` will be ignored — move it to ${fixed} instead. See https://svelte.dev/docs/kit/page-options for more information.`; - - if (!warned.has(message)) { - console.log(message); - warned.add(message); - } - } - } - }, - markup: ({ content, filename }) => { - if (!filename) return; - - const basename = path.basename(filename); - - if (basename.startsWith('+layout.') && !has_children(content, isSvelte5Plus())) { - const message = - `\n${colors.bold().red(path.relative('.', filename))}\n` + - `\`\`${isSvelte5Plus() ? ' or `{@render ...}` tag' : ''}` + - ' missing — inner content will not be rendered'; - - if (!warned.has(message)) { - console.log(message); - warned.add(message); - } - } - } -}; - -/** - * Returns the SvelteKit Vite plugins. - * @returns {Promise} - */ -export async function sveltekit() { - const svelte_config = await load_config(); - - /** @type {import('@sveltejs/vite-plugin-svelte').Options['preprocess']} */ - let preprocess = svelte_config.preprocess; - if (Array.isArray(preprocess)) { - preprocess = [...preprocess, warning_preprocessor]; - } else if (preprocess) { - preprocess = [preprocess, warning_preprocessor]; - } else { - preprocess = warning_preprocessor; - } - - /** @type {import('@sveltejs/vite-plugin-svelte').Options} */ - const vite_plugin_svelte_options = { - configFile: false, - extensions: svelte_config.extensions, - preprocess, - onwarn: svelte_config.onwarn, - compilerOptions: { - // @ts-ignore - ignore this property when running `pnpm check` against Svelte 5 in the ecosystem CI - hydratable: isSvelte5Plus() ? undefined : true, - ...svelte_config.compilerOptions - }, - ...svelte_config.vitePlugin - }; - - const { svelte } = await import_peer('@sveltejs/vite-plugin-svelte'); - - return [...svelte(vite_plugin_svelte_options), ...(await kit({ svelte_config }))]; -} - -// These variables live outside the `kit()` function because it is re-invoked by each Vite build - -let secondary_build_started = false; - -/** @type {import('types').ManifestData} */ -let manifest_data; - -/** @type {import('types').ServerMetadata | undefined} only set at build time once analysis is finished */ -let build_metadata = undefined; - -/** - * Returns the SvelteKit Vite plugin. Vite executes Rollup hooks as well as some of its own. - * Background reading is available at: - * - https://vitejs.dev/guide/api-plugin.html - * - https://rollupjs.org/guide/en/#plugin-development - * - * You can get an idea of the lifecycle by looking at the flow charts here: - * - https://rollupjs.org/guide/en/#build-hooks - * - https://rollupjs.org/guide/en/#output-generation-hooks - * - * @param {{ svelte_config: import('types').ValidatedConfig }} options - * @return {Promise} - */ -async function kit({ svelte_config }) { - /** @type {import('vite')} */ - const vite = await import_peer('vite'); - - // @ts-ignore `vite.rolldownVersion` only exists in `vite 8` - const is_rolldown = !!vite.rolldownVersion; - - const { kit } = svelte_config; - const out = `${kit.outDir}/output`; - - const version_hash = hash(kit.version.name); - - /** @type {import('vite').ResolvedConfig} */ - let vite_config; - - /** @type {import('vite').ConfigEnv} */ - let vite_config_env; - - /** @type {boolean} */ - let is_build; - - /** @type {{ public: Record; private: Record }} */ - let env; - - /** @type {() => Promise} */ - let finalise; - - /** @type {import('vite').UserConfig} */ - let initial_config; - - const service_worker_entry_file = resolve_entry(kit.files.serviceWorker); - const parsed_service_worker = path.parse(kit.files.serviceWorker); - - const normalized_cwd = vite.normalizePath(cwd); - const normalized_lib = vite.normalizePath(kit.files.lib); - const normalized_node_modules = vite.normalizePath(path.resolve('node_modules')); - - /** - * A map showing which features (such as `$app/server:read`) are defined - * in which chunks, so that we can later determine which routes use which features - * @type {Record} - */ - const tracked_features = {}; - - const sourcemapIgnoreList = /** @param {string} relative_path */ (relative_path) => - relative_path.includes('node_modules') || relative_path.includes(kit.outDir); - - /** @type {import('vite').Plugin} */ - const plugin_setup = { - name: 'vite-plugin-sveltekit-setup', - - /** - * Build the SvelteKit-provided Vite config to be merged with the user's vite.config.js file. - * @see https://vitejs.dev/guide/api-plugin.html#config - */ - config(config, config_env) { - initial_config = config; - vite_config_env = config_env; - is_build = config_env.command === 'build'; - - env = get_env(kit.env, vite_config_env.mode); - - const allow = new Set([ - kit.files.lib, - kit.files.routes, - kit.outDir, - path.resolve('src'), // TODO this isn't correct if user changed all his files to sth else than src (like in test/options) - path.resolve('node_modules'), - path.resolve(vite.searchForWorkspaceRoot(cwd), 'node_modules') - ]); - - // We can only add directories to the allow list, so we find out - // if there's a client hooks file and pass its directory - const client_hooks = resolve_entry(kit.files.hooks.client); - if (client_hooks) allow.add(path.dirname(client_hooks)); - - const generated = path.posix.join(kit.outDir, 'generated'); - - // dev and preview config can be shared - /** @type {import('vite').UserConfig} */ - const new_config = { - resolve: { - alias: [ - { find: '__SERVER__', replacement: `${generated}/server` }, - { find: '$app', replacement: `${runtime_directory}/app` }, - ...get_config_aliases(kit) - ] - }, - root: cwd, - server: { - cors: { preflightContinue: true }, - fs: { - allow: [...allow] - }, - sourcemapIgnoreList, - watch: { - ignored: [ - // Ignore all siblings of config.kit.outDir/generated - `${posixify(kit.outDir)}/!(generated)` - ] - } - }, - preview: { - cors: { preflightContinue: true } - }, - optimizeDeps: { - entries: [ - `${kit.files.routes}/**/+*.{svelte,js,ts}`, - `!${kit.files.routes}/**/+*server.*` - ], - exclude: [ - // Without this SvelteKit will be prebundled on the client, which means we end up with two versions of Redirect etc. - // Also see https://github.com/sveltejs/kit/issues/5952#issuecomment-1218844057 - '@sveltejs/kit', - // exclude kit features so that libraries using them work even when they are prebundled - // this does not affect app code, just handling of imported libraries that use $app or $env - '$app', - '$env' - ] - }, - ssr: { - noExternal: [ - // This ensures that esm-env is inlined into the server output with the - // export conditions resolved correctly through Vite. This prevents adapters - // that bundle later on from resolving the export conditions incorrectly - // and for example include browser-only code in the server output - // because they for example use esbuild.build with `platform: 'browser'` - 'esm-env', - // This forces `$app/*` modules to be bundled, since they depend on - // virtual modules like `__sveltekit/environment` (this isn't a valid bare - // import, but it works with vite-node's externalization logic, which - // uses basic concatenation) - '@sveltejs/kit/src/runtime' - ] - } - }; - - if (kit.experimental.remoteFunctions) { - // treat .remote.js files as empty for the purposes of prebundling - // detects rolldown to avoid a warning message in vite 8 beta - const remote_id_filter = new RegExp( - `.remote(${kit.moduleExtensions.join('|')})$`.replaceAll('.', '\\.') - ); - new_config.optimizeDeps ??= {}; // for some reason ts says this could be undefined even though it was set above - if (is_rolldown) { - // @ts-ignore - new_config.optimizeDeps.rolldownOptions ??= {}; - // @ts-ignore - new_config.optimizeDeps.rolldownOptions.plugins ??= []; - // @ts-ignore - new_config.optimizeDeps.rolldownOptions.plugins.push({ - name: 'vite-plugin-sveltekit-setup:optimize-remote-functions', - load: { - filter: { id: remote_id_filter }, - handler() { - return ''; - } - } - }); - } else { - new_config.optimizeDeps.esbuildOptions ??= {}; - new_config.optimizeDeps.esbuildOptions.plugins ??= []; - new_config.optimizeDeps.esbuildOptions.plugins.push({ - name: 'vite-plugin-sveltekit-setup:optimize-remote-functions', - setup(build) { - build.onLoad({ filter: remote_id_filter }, () => ({ contents: '' })); - } - }); - } - } - - const define = { - __SVELTEKIT_APP_DIR__: s(kit.appDir), - __SVELTEKIT_EMBEDDED__: s(kit.embedded), - __SVELTEKIT_EXPERIMENTAL__REMOTE_FUNCTIONS__: s(kit.experimental.remoteFunctions), - __SVELTEKIT_FORK_PRELOADS__: s(kit.experimental.forkPreloads), - __SVELTEKIT_PATHS_ASSETS__: s(kit.paths.assets), - __SVELTEKIT_PATHS_BASE__: s(kit.paths.base), - __SVELTEKIT_PATHS_RELATIVE__: s(kit.paths.relative), - __SVELTEKIT_CLIENT_ROUTING__: s(kit.router.resolution === 'client'), - __SVELTEKIT_HASH_ROUTING__: s(kit.router.type === 'hash'), - __SVELTEKIT_SERVER_TRACING_ENABLED__: s(kit.experimental.tracing.server), - __SVELTEKIT_EXPERIMENTAL_USE_TRANSFORM_ERROR__: s(kit.experimental.handleRenderingErrors) - }; - - if (is_build) { - if (!new_config.build) new_config.build = {}; - new_config.build.ssr = !secondary_build_started; - - new_config.define = { - ...define, - __SVELTEKIT_ADAPTER_NAME__: s(kit.adapter?.name), - __SVELTEKIT_APP_VERSION_FILE__: s(`${kit.appDir}/version.json`), - __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: s(kit.version.pollInterval), - __SVELTEKIT_PAYLOAD__: new_config.build.ssr - ? '{}' - : `globalThis.__sveltekit_${version_hash}` - }; - - if (!secondary_build_started) { - manifest_data = sync.all(svelte_config, config_env.mode).manifest_data; - // During the initial server build we don't know yet - new_config.define.__SVELTEKIT_HAS_SERVER_LOAD__ = 'true'; - new_config.define.__SVELTEKIT_HAS_UNIVERSAL_LOAD__ = 'true'; - } else { - const nodes = Object.values( - /** @type {import('types').ServerMetadata} */ (build_metadata).nodes - ); - - // Through the finished analysis we can now check if any node has server or universal load functions - const has_server_load = nodes.some((node) => node.has_server_load); - const has_universal_load = nodes.some((node) => node.has_universal_load); - - new_config.define.__SVELTEKIT_HAS_SERVER_LOAD__ = s(has_server_load); - new_config.define.__SVELTEKIT_HAS_UNIVERSAL_LOAD__ = s(has_universal_load); - } - } else { - new_config.define = { - ...define, - __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0', - __SVELTEKIT_PAYLOAD__: 'globalThis.__sveltekit_dev', - __SVELTEKIT_HAS_SERVER_LOAD__: 'true', - __SVELTEKIT_HAS_UNIVERSAL_LOAD__: 'true' - }; - - // @ts-ignore this prevents a reference error if `client.js` is imported on the server - globalThis.__sveltekit_dev = {}; - - // These Kit dependencies are packaged as CommonJS, which means they must always be externalized. - // Without this, the tests will still pass but `pnpm dev` will fail in projects that link `@sveltejs/kit`. - /** @type {NonNullable} */ (new_config.ssr).external = [ - 'cookie', - 'set-cookie-parser' - ]; - } - - warn_overridden_config(config, new_config); - - return new_config; - }, - - /** - * Stores the final config. - */ - configResolved(config) { - vite_config = config; - } - }; - - /** @type {import('vite').Plugin} */ - const plugin_virtual_modules = { - name: 'vite-plugin-sveltekit-virtual-modules', - - resolveId(id, importer) { - if (id === '__sveltekit/manifest') { - return `${kit.outDir}/generated/client-optimized/app.js`; - } - - // If importing from a service-worker, only allow $service-worker & $env/static/public, but none of the other virtual modules. - // This check won't catch transitive imports, but it will warn when the import comes from a service-worker directly. - // Transitive imports will be caught during the build. - // TODO move this logic to plugin_guard - if (importer) { - const parsed_importer = path.parse(importer); - - const importer_is_service_worker = - parsed_importer.dir === parsed_service_worker.dir && - parsed_importer.name === parsed_service_worker.name; - - if (importer_is_service_worker && id !== '$service-worker' && id !== '$env/static/public') { - throw new Error( - `Cannot import ${normalize_id( - id, - normalized_lib, - normalized_cwd - )} into service-worker code. Only the modules $service-worker and $env/static/public are available in service workers.` - ); - } - } - - // treat $env/static/[public|private] as virtual - if (id.startsWith('$env/') || id === '$service-worker') { - // ids with :$ don't work with reverse proxies like nginx - return `\0virtual:${id.substring(1)}`; - } - - if (id === '__sveltekit/remote') { - return `${runtime_directory}/client/remote-functions/index.js`; - } - - if (id.startsWith('__sveltekit/')) { - return `\0virtual:${id}`; - } - }, - - load(id, options) { - const browser = !options?.ssr; - - const global = is_build - ? `globalThis.__sveltekit_${version_hash}` - : 'globalThis.__sveltekit_dev'; - - switch (id) { - case env_static_private: - return create_static_module('$env/static/private', env.private); - - case env_static_public: - return create_static_module('$env/static/public', env.public); - - case env_dynamic_private: - return create_dynamic_module( - 'private', - vite_config_env.command === 'serve' ? env.private : undefined - ); - - case env_dynamic_public: - // populate `$env/dynamic/public` from `window` - if (browser) { - return `export const env = ${global}.env;`; - } - - return create_dynamic_module( - 'public', - vite_config_env.command === 'serve' ? env.public : undefined - ); - - case service_worker: - return create_service_worker_module(svelte_config); - - case sveltekit_environment: { - const { version } = svelte_config.kit; - - return dedent` - export const version = ${s(version.name)}; - export let building = false; - export let prerendering = false; - - export function set_building() { - building = true; - } - - export function set_prerendering() { - prerendering = true; - } - `; - } - - case sveltekit_server: { - return dedent` - export let read_implementation = null; - - export let manifest = null; - - export function set_read_implementation(fn) { - read_implementation = fn; - } - - export function set_manifest(_) { - manifest = _; - } - `; - } - } - } - }; - - /** @type {Map>} */ - const import_map = new Map(); - const server_only_pattern = /.*\.server\..+/; - - /** - * Ensures that client-side code can't accidentally import server-side code, - * whether in `*.server.js` files, `$app/server`, `$lib/server`, or `$env/[static|dynamic]/private` - * @type {import('vite').Plugin} - */ - const plugin_guard = { - name: 'vite-plugin-sveltekit-guard', - - // Run this plugin before built-in resolution, so that relative imports - // are added to the module graph - enforce: 'pre', - - async resolveId(id, importer, options) { - if (importer && !importer.endsWith('index.html')) { - const resolved = await this.resolve(id, importer, { ...options, skipSelf: true }); - - if (resolved) { - const normalized = normalize_id(resolved.id, normalized_lib, normalized_cwd); - - let importers = import_map.get(normalized); - - if (!importers) { - importers = new Set(); - import_map.set(normalized, importers); - } - - importers.add(normalize_id(importer, normalized_lib, normalized_cwd)); - } - } - }, - - load(id, options) { - if (options?.ssr === true || process.env.TEST === 'true') { - return; - } - - // skip .server.js files outside the cwd or in node_modules, as the filename might not mean 'server-only module' in this context - const is_internal = id.startsWith(normalized_cwd) && !id.startsWith(normalized_node_modules); - - const normalized = normalize_id(id, normalized_lib, normalized_cwd); - - const is_server_only = - normalized === '$env/static/private' || - normalized === '$env/dynamic/private' || - normalized === '$app/server' || - normalized.startsWith('$lib/server/') || - (is_internal && server_only_pattern.test(path.basename(id))); - - if (is_server_only) { - // in dev, this doesn't exist, so we need to create it - manifest_data ??= sync.all(svelte_config, vite_config_env.mode).manifest_data; - - /** @type {Set} */ - const entrypoints = new Set(); - for (const node of manifest_data.nodes) { - if (node.component) entrypoints.add(node.component); - if (node.universal) entrypoints.add(node.universal); - } - - if (manifest_data.hooks.client) entrypoints.add(manifest_data.hooks.client); - if (manifest_data.hooks.universal) entrypoints.add(manifest_data.hooks.universal); - - const normalized = normalize_id(id, normalized_lib, normalized_cwd); - const chain = [normalized]; - - let current = normalized; - let includes_remote_file = false; - - while (true) { - const importers = import_map.get(current); - if (!importers) break; - - const candidates = Array.from(importers).filter((importer) => !chain.includes(importer)); - if (candidates.length === 0) break; - - chain.push((current = candidates[0])); - - includes_remote_file ||= svelte_config.kit.moduleExtensions.some((ext) => { - return current.endsWith(`.remote${ext}`); - }); - - if (entrypoints.has(current)) { - const pyramid = chain - .reverse() - .map((id, i) => { - return `${' '.repeat(i + 1)}${id}`; - }) - .join(' imports\n'); - - if (includes_remote_file) { - error_for_missing_config( - 'remote functions', - 'kit.experimental.remoteFunctions', - 'true' - ); - } - - let message = `Cannot import ${normalized} into code that runs in the browser, as this could leak sensitive information.`; - message += `\n\n${pyramid}`; - message += `\n\nIf you're only using the import as a type, change it to \`import type\`.`; - - throw stackless(message); - } - } - - throw new Error('An impossible situation occurred'); - } - } - }; - - /** @type {import('vite').ViteDevServer} */ - let dev_server; - - /** @type {Array<{ hash: string, file: string }>} */ - const remotes = []; - - /** @type {Map} Maps remote hash -> original module id */ - const remote_original_by_hash = new Map(); - - /** @type {Set} Track which remote hashes have already been emitted */ - const emitted_remote_hashes = new Set(); - - /** @type {import('vite').Plugin} */ - const plugin_remote = { - name: 'vite-plugin-sveltekit-remote', - - resolveId(id) { - if (id.startsWith('\0sveltekit-remote:')) return id; - }, - - load(id) { - // On-the-fly generated entry point for remote file just forwards the original module - // We're not using manualChunks because it can cause problems with circular dependencies - // (e.g. https://github.com/sveltejs/kit/issues/14679) and module ordering in general - // (e.g. https://github.com/sveltejs/kit/issues/14590). - if (id.startsWith('\0sveltekit-remote:')) { - const hash_id = id.slice('\0sveltekit-remote:'.length); - const original = remote_original_by_hash.get(hash_id); - if (!original) throw new Error(`Expected to find metadata for remote file ${id}`); - return `import * as m from ${s(original)};\nexport default m;`; - } - }, - - configureServer(_dev_server) { - dev_server = _dev_server; - }, - - async transform(code, id, opts) { - const normalized = normalize_id(id, normalized_lib, normalized_cwd); - if (!svelte_config.kit.moduleExtensions.some((ext) => normalized.endsWith(`.remote${ext}`))) { - return; - } - - const file = posixify(path.relative(cwd, id)); - const remote = { - hash: hash(file), - file - }; - - remotes.push(remote); - - if (opts?.ssr) { - // we need to add an `await Promise.resolve()` because if the user imports this function - // on the client AND in a load function when loading the client module we will trigger - // an ssrLoadModule during dev. During a link preload, the module can be mistakenly - // loaded and transformed twice and the first time all its exports would be undefined - // triggering a dev server error. By adding a microtask we ensure that the module is fully loaded - - // Extra newlines to prevent syntax errors around missing semicolons or comments - code += - '\n\n' + - dedent` - import * as $$_self_$$ from './${path.basename(id)}'; - import { init_remote_functions as $$_init_$$ } from '@sveltejs/kit/internal'; - - ${dev_server ? 'await Promise.resolve()' : ''} - - $$_init_$$($$_self_$$, ${s(file)}, ${s(remote.hash)}); - - for (const [name, fn] of Object.entries($$_self_$$)) { - fn.__.id = ${s(remote.hash)} + '/' + name; - fn.__.name = name; - } - `; - - // Emit a dedicated entry chunk for this remote in SSR builds (prod only) - if (!dev_server) { - remote_original_by_hash.set(remote.hash, id); - if (!emitted_remote_hashes.has(remote.hash)) { - this.emitFile({ - type: 'chunk', - id: `\0sveltekit-remote:${remote.hash}`, - name: `remote-${remote.hash}` - }); - emitted_remote_hashes.add(remote.hash); - } - } - - return code; - } - - // For the client, read the exports and create a new module that only contains fetch functions with the correct metadata - - /** @type {Map} */ - const map = new Map(); - - // in dev, load the server module here (which will result in this hook - // being called again with `opts.ssr === true` if the module isn't - // already loaded) so we can determine what it exports - if (dev_server) { - const module = await dev_server.ssrLoadModule(id); - - for (const [name, value] of Object.entries(module)) { - const type = value?.__?.type; - if (type) { - map.set(name, type); - } - } - } - - // in prod, we already built and analysed the server code before - // building the client code, so `remote_exports` is populated - else if (build_metadata?.remotes) { - const exports = build_metadata?.remotes.get(remote.hash); - if (!exports) throw new Error('Expected to find metadata for remote file ' + id); - - for (const [name, value] of exports) { - map.set(name, value.type); - } - } - - let namespace = '__remote'; - let uid = 1; - while (map.has(namespace)) namespace = `__remote${uid++}`; - - const exports = Array.from(map).map(([name, type]) => { - return `export const ${name} = ${namespace}.${type}('${remote.hash}/${name}');`; - }); - - let result = `import * as ${namespace} from '__sveltekit/remote';\n\n${exports.join('\n')}\n`; - - if (dev_server) { - result += `\nimport.meta.hot?.accept();\n`; - } - - return { - code: result - }; - } - }; - - /** @type {import('vite').Plugin} */ - const plugin_compile = { - name: 'vite-plugin-sveltekit-compile', - - /** - * Build the SvelteKit-provided Vite config to be merged with the user's vite.config.js file. - * @see https://vitejs.dev/guide/api-plugin.html#config - */ - config(config) { - /** @type {import('vite').UserConfig} */ - let new_config; - - const kit_paths_base = kit.paths.base || '/'; - - if (is_build) { - const ssr = /** @type {boolean} */ (config.build?.ssr); - const prefix = `${kit.appDir}/immutable`; - - /** @type {Record} */ - const input = {}; - - if (ssr) { - input.index = `${runtime_directory}/server/index.js`; - input.internal = `${kit.outDir}/generated/server/internal.js`; - input['remote-entry'] = `${runtime_directory}/app/server/remote/index.js`; - - // add entry points for every endpoint... - manifest_data.routes.forEach((route) => { - if (route.endpoint) { - const resolved = path.resolve(route.endpoint.file); - const relative = decodeURIComponent(path.relative(kit.files.routes, resolved)); - const name = posixify(path.join('entries/endpoints', relative.replace(/\.js$/, ''))); - input[name] = resolved; - } - }); - - // ...and every component used by pages... - manifest_data.nodes.forEach((node) => { - for (const file of [node.component, node.universal, node.server]) { - if (file) { - const resolved = path.resolve(file); - const relative = decodeURIComponent(path.relative(kit.files.routes, resolved)); - - const name = relative.startsWith('..') - ? posixify(path.join('entries/fallbacks', path.basename(file))) - : posixify(path.join('entries/pages', relative.replace(/\.js$/, ''))); - input[name] = resolved; - } - } - }); - - // ...and every matcher - Object.entries(manifest_data.matchers).forEach(([key, file]) => { - const name = posixify(path.join('entries/matchers', key)); - input[name] = path.resolve(file); - }); - - // ...and the hooks files - if (manifest_data.hooks.server) { - input['entries/hooks.server'] = path.resolve(manifest_data.hooks.server); - } - if (manifest_data.hooks.universal) { - input['entries/hooks.universal'] = path.resolve(manifest_data.hooks.universal); - } - - // ...and the server instrumentation file - const server_instrumentation = resolve_entry( - path.join(kit.files.src, 'instrumentation.server') - ); - if (server_instrumentation) { - const { adapter } = kit; - if (adapter && !adapter.supports?.instrumentation?.()) { - throw new Error(`${server_instrumentation} is unsupported in ${adapter.name}.`); - } - if (!kit.experimental.instrumentation.server) { - error_for_missing_config( - '`instrumentation.server.js`', - 'kit.experimental.instrumentation.server', - 'true' - ); - } - input['instrumentation.server'] = server_instrumentation; - } - } else if (svelte_config.kit.output.bundleStrategy !== 'split') { - input['bundle'] = `${runtime_directory}/client/bundle.js`; - } else { - input['entry/start'] = `${runtime_directory}/client/entry.js`; - input['entry/app'] = `${kit.outDir}/generated/client-optimized/app.js`; - manifest_data.nodes.forEach((node, i) => { - if (node.component || node.universal) { - input[`nodes/${i}`] = `${kit.outDir}/generated/client-optimized/nodes/${i}.js`; - } - }); - } - - // see the kit.output.preloadStrategy option for details on why we have multiple options here - const ext = kit.output.preloadStrategy === 'preload-mjs' ? 'mjs' : 'js'; - - // We could always use a relative asset base path here, but it's better for performance not to. - // E.g. Vite generates `new URL('/asset.png', import.meta).href` for a relative path vs just '/asset.png'. - // That's larger and takes longer to run and also causes an HTML diff between SSR and client - // causing us to do a more expensive hydration check. - const client_base = - kit.paths.relative !== false || kit.paths.assets ? './' : kit_paths_base; - - const inline = !ssr && svelte_config.kit.output.bundleStrategy === 'inline'; - const split = ssr || svelte_config.kit.output.bundleStrategy === 'split'; - - new_config = { - base: ssr ? assets_base(kit) : client_base, - build: { - copyPublicDir: !ssr, - cssCodeSplit: svelte_config.kit.output.bundleStrategy !== 'inline', - cssMinify: initial_config.build?.minify == null ? true : !!initial_config.build.minify, - manifest: true, - outDir: `${out}/${ssr ? 'server' : 'client'}`, - rollupOptions: { - input: inline ? input['bundle'] : input, - output: { - format: inline ? 'iife' : 'esm', - name: `__sveltekit_${version_hash}.app`, - entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`, - chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[hash].${ext}`, - assetFileNames: `${prefix}/assets/[name].[hash][extname]`, - hoistTransitiveImports: false, - sourcemapIgnoreList, - inlineDynamicImports: is_rolldown ? undefined : !split - }, - preserveEntrySignatures: 'strict', - onwarn(warning, handler) { - if ( - (is_rolldown - ? warning.code === 'IMPORT_IS_UNDEFINED' - : warning.code === 'MISSING_EXPORT') && - warning.id === `${kit.outDir}/generated/client-optimized/app.js` - ) { - // ignore e.g. undefined `handleError` hook when - // referencing `client_hooks.handleError` - return; - } - - handler(warning); - } - }, - ssrEmitAssets: true, - target: ssr ? 'node18.13' : undefined - }, - publicDir: kit.files.assets, - worker: { - rollupOptions: { - output: { - entryFileNames: `${prefix}/workers/[name]-[hash].js`, - chunkFileNames: `${prefix}/workers/chunks/[hash].js`, - assetFileNames: `${prefix}/workers/assets/[name]-[hash][extname]`, - hoistTransitiveImports: false - } - } - } - }; - - // we must reference Vite 8 options conditionally. Otherwise, older Vite - // versions throw an error about unknown config options - if (is_rolldown && new_config?.build?.rollupOptions?.output) { - // @ts-ignore only available in Vite 8 - new_config.build.rollupOptions.output.codeSplitting = split; - } - } else { - new_config = { - appType: 'custom', - base: kit_paths_base, - build: { - rollupOptions: { - // Vite dependency crawler needs an explicit JS entry point - // even though server otherwise works without it - input: `${runtime_directory}/client/entry.js` - } - }, - publicDir: kit.files.assets - }; - } - - warn_overridden_config(config, new_config); - - return new_config; - }, - - /** - * Adds the SvelteKit middleware to do SSR in dev mode. - * @see https://vitejs.dev/guide/api-plugin.html#configureserver - */ - async configureServer(vite) { - return await dev(vite, vite_config, svelte_config, () => remotes); - }, - - /** - * Adds the SvelteKit middleware to do SSR in preview mode. - * @see https://vitejs.dev/guide/api-plugin.html#configurepreviewserver - */ - configurePreviewServer(vite) { - return preview(vite, vite_config, svelte_config); - }, - - /** - * Clears the output directories. - */ - buildStart() { - if (secondary_build_started) return; - - if (is_build) { - if (!vite_config.build.watch) { - rimraf(out); - } - mkdirp(out); - } - }, - - renderChunk(code, chunk) { - if (code.includes('__SVELTEKIT_TRACK__')) { - return { - // Rolldown changes our single quotes to double quotes so we need it in the regex too - code: code.replace(/__SVELTEKIT_TRACK__\(['"](.+?)['"]\)/g, (_, label) => { - (tracked_features[chunk.name + '.js'] ??= []).push(label); - // put extra whitespace at the end of the comment to preserve the source size and avoid interfering with source maps - return `/* track ${label} */`; - }), - map: null // TODO we may need to generate a sourcemap in future - }; - } - }, - - generateBundle() { - if (vite_config.build.ssr) return; - - this.emitFile({ - type: 'asset', - fileName: `${kit.appDir}/version.json`, - source: s({ version: kit.version.name }) - }); - }, - - /** - * Vite builds a single bundle. We need three bundles: client, server, and service worker. - * The user's package.json scripts will invoke the Vite CLI to execute the server build. We - * then use this hook to kick off builds for the client and service worker. - */ - writeBundle: { - sequential: true, - async handler(_options) { - if (secondary_build_started) return; // only run this once - - const verbose = vite_config.logLevel === 'info'; - const log = logger({ verbose }); - - /** @type {import('vite').Manifest} */ - const server_manifest = JSON.parse(read(`${out}/server/.vite/manifest.json`)); - - /** @type {import('types').BuildData} */ - const build_data = { - app_dir: kit.appDir, - app_path: `${kit.paths.base.slice(1)}${kit.paths.base ? '/' : ''}${kit.appDir}`, - manifest_data, - out_dir: out, - service_worker: service_worker_entry_file ? 'service-worker.js' : null, // TODO make file configurable? - client: null, - server_manifest - }; - - const manifest_path = `${out}/server/manifest-full.js`; - fs.writeFileSync( - manifest_path, - `export const manifest = ${generate_manifest({ - build_data, - prerendered: [], - relative_path: '.', - routes: manifest_data.routes, - remotes - })};\n` - ); - - log.info('Analysing routes'); - - const { metadata } = await analyse({ - hash: kit.router.type === 'hash', - manifest_path, - manifest_data, - server_manifest, - tracked_features, - env: { ...env.private, ...env.public }, - out, - output_config: svelte_config.output, - remotes - }); - - build_metadata = metadata; - - log.info('Building app'); - - // create client build - write_client_manifest( - kit, - manifest_data, - `${kit.outDir}/generated/client-optimized`, - metadata.nodes - ); - - secondary_build_started = true; - - let client_chunks; - - try { - const bundle = /** @type {import('vite').Rollup.RollupOutput} */ ( - await vite.build({ - configFile: vite_config.configFile, - // CLI args - mode: vite_config_env.mode, - logLevel: vite_config.logLevel, - clearScreen: vite_config.clearScreen, - build: { - minify: initial_config.build?.minify, - assetsInlineLimit: vite_config.build.assetsInlineLimit, - sourcemap: vite_config.build.sourcemap - }, - optimizeDeps: { - force: vite_config.optimizeDeps.force - } - }) - ); - - client_chunks = bundle.output; - } catch (e) { - const error = - e instanceof Error ? e : new Error(/** @type {any} */ (e).message ?? e ?? ''); - - // without this, errors that occur during the secondary build - // will be logged twice - throw stackless(error.stack ?? error.message); - } - - // We use `build.ssrEmitAssets` so that asset URLs created from - // imports in server-only modules correspond to files in the build, - // but we don't want to copy over CSS imports as these are already - // accounted for in the client bundle. In most cases it would be - // a no-op, but for SSR builds `url(...)` paths are handled - // differently (relative for client, absolute for server) - // resulting in different hashes, and thus duplication - const ssr_stylesheets = new Set( - Object.values(server_manifest) - .map((chunk) => chunk.css ?? []) - .flat() - ); - - const assets_path = `${kit.appDir}/immutable/assets`; - const server_assets = `${out}/server/${assets_path}`; - const client_assets = `${out}/client/${assets_path}`; - - if (fs.existsSync(server_assets)) { - for (const file of fs.readdirSync(server_assets)) { - const src = `${server_assets}/${file}`; - const dest = `${client_assets}/${file}`; - - if (fs.existsSync(dest) || ssr_stylesheets.has(`${assets_path}/${file}`)) { - continue; - } - - if (file.endsWith('.css')) { - // make absolute paths in CSS relative, for portability - const content = fs - .readFileSync(src, 'utf-8') - .replaceAll(`${kit.paths.base}/${assets_path}`, '.'); - - fs.writeFileSync(src, content); - } - - copy(src, dest); - } - } - - /** @type {import('vite').Manifest} */ - const client_manifest = JSON.parse(read(`${out}/client/.vite/manifest.json`)); - - /** - * @param {string} entry - * @param {boolean} [add_dynamic_css] - */ - const deps_of = (entry, add_dynamic_css = false) => - find_deps(client_manifest, posixify(path.relative('.', entry)), add_dynamic_css); - - if (svelte_config.kit.output.bundleStrategy === 'split') { - const start = deps_of(`${runtime_directory}/client/entry.js`); - const app = deps_of(`${kit.outDir}/generated/client-optimized/app.js`); - - build_data.client = { - start: start.file, - app: app.file, - imports: [...start.imports, ...app.imports], - stylesheets: [...start.stylesheets, ...app.stylesheets], - fonts: [...start.fonts, ...app.fonts], - uses_env_dynamic_public: client_chunks.some( - (chunk) => chunk.type === 'chunk' && chunk.modules[env_dynamic_public] - ) - }; - - // In case of server-side route resolution, we create a purpose-built route manifest that is - // similar to that on the client, with as much information computed upfront so that we - // don't need to include any code of the actual routes in the server bundle. - if (svelte_config.kit.router.resolution === 'server') { - const nodes = manifest_data.nodes.map((node, i) => { - if (node.component || node.universal) { - const entry = `${kit.outDir}/generated/client-optimized/nodes/${i}.js`; - const deps = deps_of(entry, true); - const file = resolve_symlinks( - client_manifest, - `${kit.outDir}/generated/client-optimized/nodes/${i}.js` - ).chunk.file; - - return { file, css: deps.stylesheets }; - } - }); - build_data.client.nodes = nodes.map((node) => node?.file); - build_data.client.css = nodes.map((node) => node?.css); - - build_data.client.routes = compact( - manifest_data.routes.map((route) => { - if (!route.page) return; - - return { - id: route.id, - pattern: route.pattern, - params: route.params, - layouts: route.page.layouts.map((l) => - l !== undefined ? [metadata.nodes[l].has_server_load, l] : undefined - ), - errors: route.page.errors, - leaf: [metadata.nodes[route.page.leaf].has_server_load, route.page.leaf] - }; - }) - ); - } - } else { - const start = deps_of(`${runtime_directory}/client/bundle.js`); - - build_data.client = { - start: start.file, - imports: start.imports, - stylesheets: start.stylesheets, - fonts: start.fonts, - uses_env_dynamic_public: client_chunks.some( - (chunk) => chunk.type === 'chunk' && chunk.modules[env_dynamic_public] - ) - }; - - if (svelte_config.kit.output.bundleStrategy === 'inline') { - const style = /** @type {import('vite').Rollup.OutputAsset} */ ( - client_chunks.find( - (chunk) => - chunk.type === 'asset' && - chunk.names.length === 1 && - chunk.names[0] === 'style.css' - ) - ); - - build_data.client.inline = { - script: read(`${out}/client/${start.file}`), - style: /** @type {string | undefined} */ (style?.source) - }; - } - } - - // regenerate manifest now that we have client entry... - fs.writeFileSync( - manifest_path, - `export const manifest = ${generate_manifest({ - build_data, - prerendered: [], - relative_path: '.', - routes: manifest_data.routes, - remotes - })};\n` - ); - - // regenerate nodes with the client manifest... - build_server_nodes( - out, - kit, - manifest_data, - server_manifest, - client_manifest, - assets_path, - client_chunks, - svelte_config.kit.output - ); - - // ...and prerender - const { prerendered, prerender_map } = await prerender({ - hash: kit.router.type === 'hash', - out, - manifest_path, - metadata, - verbose, - env: { ...env.private, ...env.public } - }); - - // generate a new manifest that doesn't include prerendered pages - fs.writeFileSync( - `${out}/server/manifest.js`, - `export const manifest = ${generate_manifest({ - build_data, - prerendered: prerendered.paths, - relative_path: '.', - routes: manifest_data.routes.filter((route) => prerender_map.get(route.id) !== true), - remotes - })};\n` - ); - - if (service_worker_entry_file) { - if (kit.paths.assets) { - throw new Error('Cannot use service worker alongside config.kit.paths.assets'); - } - - log.info('Building service worker'); - - await build_service_worker( - out, - kit, - { - ...vite_config, - build: { - ...vite_config.build, - minify: initial_config.build?.minify ?? true - } - }, - manifest_data, - service_worker_entry_file, - prerendered, - client_manifest - ); - } - - // we need to defer this to closeBundle, so that adapters copy files - // created by other Vite plugins - finalise = async () => { - console.log( - `\nRun ${colors - .bold() - .cyan('npm run preview')} to preview your production build locally.` - ); - - if (kit.adapter) { - const { adapt } = await import('../../core/adapt/index.js'); - await adapt( - svelte_config, - build_data, - metadata, - prerendered, - prerender_map, - log, - remotes, - vite_config - ); - } else { - console.log(colors.bold().yellow('\nNo adapter specified')); - - const link = colors.bold().cyan('https://svelte.dev/docs/kit/adapters'); - console.log( - `See ${link} to learn how to configure your app to run on the platform of your choosing` - ); - } - - secondary_build_started = false; - }; - } - }, - - /** - * Runs the adapter. - */ - closeBundle: { - sequential: true, - async handler() { - if (!vite_config.build.ssr) return; - await finalise?.(); - } - } - }; - - return [ - plugin_setup, - kit.experimental.remoteFunctions && plugin_remote, - plugin_virtual_modules, - plugin_guard, - plugin_compile - ].filter((p) => !!p); -} - -/** - * @param {Record} config - * @param {Record} resolved_config - */ -function warn_overridden_config(config, resolved_config) { - const overridden = find_overridden_config(config, resolved_config, enforced_config, '', []); - - if (overridden.length > 0) { - console.error( - colors.bold().red('The following Vite config options will be overridden by SvelteKit:') + - overridden.map((key) => `\n - ${key}`).join('') - ); - } -} - -/** - * @param {Record} config - * @param {Record} resolved_config - * @param {import('./types.js').EnforcedConfig} enforced_config - * @param {string} path - * @param {string[]} out used locally to compute the return value - */ -function find_overridden_config(config, resolved_config, enforced_config, path, out) { - if (config == null || resolved_config == null) { - return out; - } - - for (const key in enforced_config) { - if (typeof config === 'object' && key in config && key in resolved_config) { - const enforced = enforced_config[key]; - - if (enforced === true) { - if (config[key] !== resolved_config[key]) { - out.push(path + key); - } - } else { - find_overridden_config(config[key], resolved_config[key], enforced, path + key + '.', out); - } - } - } - return out; -} - -/** - * @param {import('types').ValidatedConfig} config - */ -const create_service_worker_module = (config) => dedent` - if (typeof self === 'undefined' || self instanceof ServiceWorkerGlobalScope === false) { - throw new Error('This module can only be imported inside a service worker'); - } - - export const build = []; - export const files = [ - ${create_assets(config) - .filter((asset) => config.kit.serviceWorker.files(asset.file)) - .map((asset) => `${s(`${config.kit.paths.base}/${asset.file}`)}`) - .join(',\n')} - ]; - export const prerendered = []; - export const version = ${s(config.kit.version.name)}; -`; diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/module_ids.js b/web/node_modules/@sveltejs/kit/src/exports/vite/module_ids.js deleted file mode 100644 index 69325f3..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/module_ids.js +++ /dev/null @@ -1,16 +0,0 @@ -import { fileURLToPath } from 'node:url'; -import { posixify } from '../../utils/filesystem.js'; - -export const env_static_private = '\0virtual:env/static/private'; -export const env_static_public = '\0virtual:env/static/public'; -export const env_dynamic_private = '\0virtual:env/dynamic/private'; -export const env_dynamic_public = '\0virtual:env/dynamic/public'; - -export const service_worker = '\0virtual:service-worker'; - -export const sveltekit_environment = '\0virtual:__sveltekit/environment'; -export const sveltekit_server = '\0virtual:__sveltekit/server'; - -export const app_server = posixify( - fileURLToPath(new URL('../../runtime/app/server/index.js', import.meta.url)) -); diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js b/web/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js deleted file mode 100644 index 02a89e9..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/preview/index.js +++ /dev/null @@ -1,261 +0,0 @@ -import fs from 'node:fs'; -import { join } from 'node:path'; -import { pathToFileURL } from 'node:url'; -import { lookup } from 'mrmime'; -import sirv from 'sirv'; -import { loadEnv, normalizePath } from 'vite'; -import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js'; -import { installPolyfills } from '../../../exports/node/polyfills.js'; -import { SVELTE_KIT_ASSETS } from '../../../constants.js'; -import { not_found } from '../utils.js'; - -/** @typedef {import('http').IncomingMessage} Req */ -/** @typedef {import('http').ServerResponse} Res */ -/** @typedef {(req: Req, res: Res, next: () => void) => void} Handler */ - -/** - * @param {import('vite').PreviewServer} vite - * @param {import('vite').ResolvedConfig} vite_config - * @param {import('types').ValidatedConfig} svelte_config - */ -export async function preview(vite, vite_config, svelte_config) { - installPolyfills(); - - const { paths } = svelte_config.kit; - const base = paths.base; - const assets = paths.assets ? SVELTE_KIT_ASSETS : paths.base; - - const protocol = vite_config.preview.https ? 'https' : 'http'; - - const etag = `"${Date.now()}"`; - - const dir = join(svelte_config.kit.outDir, 'output/server'); - - if (!fs.existsSync(dir)) { - throw new Error(`Server files not found at ${dir}, did you run \`build\` first?`); - } - - const instrumentation = join(dir, 'instrumentation.server.js'); - if (fs.existsSync(instrumentation)) { - await import(pathToFileURL(instrumentation).href); - } - - /** @type {import('types').ServerInternalModule} */ - const { set_assets } = await import(pathToFileURL(join(dir, 'internal.js')).href); - - /** @type {import('types').ServerModule} */ - const { Server } = await import(pathToFileURL(join(dir, 'index.js')).href); - - const { manifest } = await import(pathToFileURL(join(dir, 'manifest.js')).href); - - set_assets(assets); - - const server = new Server(manifest); - await server.init({ - env: loadEnv(vite_config.mode, svelte_config.kit.env.dir, ''), - read: (file) => createReadableStream(`${dir}/${file}`) - }); - - const emulator = await svelte_config.kit.adapter?.emulate?.(); - - return () => { - // Remove the base middleware. It screws with the URL. - // It also only lets through requests beginning with the base path, so that requests beginning - // with the assets URL never reach us. We could serve assets separately before the base - // middleware, but we'd need that to occur after the compression and cors middlewares, so would - // need to insert it manually into the stack, which would be at least as bad as doing this. - for (let i = vite.middlewares.stack.length - 1; i > 0; i--) { - // @ts-expect-error using internals - if (vite.middlewares.stack[i].handle.name === 'viteBaseMiddleware') { - vite.middlewares.stack.splice(i, 1); - } - } - - // generated client assets and the contents of `static` - vite.middlewares.use( - scoped( - assets, - sirv(join(svelte_config.kit.outDir, 'output/client'), { - setHeaders: (res, pathname) => { - // only apply to immutable directory, not e.g. version.json - if (pathname.startsWith(`/${svelte_config.kit.appDir}/immutable`)) { - res.setHeader('cache-control', 'public,max-age=31536000,immutable'); - } - } - }) - ) - ); - - vite.middlewares.use((req, res, next) => { - const original_url = /** @type {string} */ (req.url); - const { pathname, search } = new URL(original_url, 'http://dummy'); - - // if `paths.base === '/a/b/c`, then the root route is `/a/b/c/`, - // regardless of the `trailingSlash` route option - if (base.length > 1 && pathname === base) { - let location = base + '/'; - if (search) location += search; - res.writeHead(307, { - location - }); - res.end(); - return; - } - - if (pathname.startsWith(base)) { - next(); - } else { - res.statusCode = 404; - not_found(req, res, base); - } - }); - - // prerendered dependencies - vite.middlewares.use( - scoped(base, mutable(join(svelte_config.kit.outDir, 'output/prerendered/dependencies'))) - ); - - // prerendered pages (we can't just use sirv because we need to - // preserve the correct trailingSlash behaviour) - vite.middlewares.use( - scoped(base, (req, res, next) => { - let if_none_match_value = req.headers['if-none-match']; - - if (if_none_match_value?.startsWith('W/"')) { - if_none_match_value = if_none_match_value.substring(2); - } - - if (if_none_match_value === etag) { - res.statusCode = 304; - res.end(); - return; - } - - const { pathname, search } = new URL(/** @type {string} */ (req.url), 'http://dummy'); - - const dir = pathname.startsWith(`/${svelte_config.kit.appDir}/remote/`) ? 'data' : 'pages'; - - let filename = normalizePath( - join(svelte_config.kit.outDir, `output/prerendered/${dir}` + pathname) - ); - - try { - filename = decodeURI(filename); - } catch { - // malformed URI - } - - let prerendered = is_file(filename); - - if (!prerendered) { - const has_trailing_slash = pathname.endsWith('/'); - const html_filename = `${filename}${has_trailing_slash ? 'index.html' : '.html'}`; - - /** @type {string | undefined} */ - let redirect; - - if (is_file(html_filename)) { - filename = html_filename; - prerendered = true; - } else if (has_trailing_slash) { - if (is_file(filename.slice(0, -1) + '.html')) { - redirect = pathname.slice(0, -1); - } - } else if (is_file(filename + '/index.html')) { - redirect = pathname + '/'; - } - - if (redirect) { - if (search) redirect += search; - res.writeHead(307, { - location: redirect - }); - - res.end(); - - return; - } - } - - if (prerendered) { - res.writeHead(200, { - 'content-type': lookup(pathname) || 'text/html', - etag - }); - - fs.createReadStream(filename).pipe(res); - } else { - next(); - } - }) - ); - - // SSR - vite.middlewares.use(async (req, res) => { - const host = req.headers[':authority'] || req.headers.host; - - const request = await getRequest({ - base: `${protocol}://${host}`, - request: req - }); - - await setResponse( - res, - await server.respond(request, { - getClientAddress: () => { - const { remoteAddress } = req.socket; - if (remoteAddress) return remoteAddress; - throw new Error('Could not determine clientAddress'); - }, - read: (file) => { - if (file in manifest._.server_assets) { - return fs.readFileSync(join(dir, file)); - } - - return fs.readFileSync(join(svelte_config.kit.files.assets, file)); - }, - emulator - }) - ); - }); - }; -} - -/** - * @param {string} dir - * @returns {Handler} - */ -const mutable = (dir) => - fs.existsSync(dir) - ? sirv(dir, { - etag: true, - maxAge: 0 - }) - : (_req, _res, next) => next(); - -/** - * @param {string} scope - * @param {Handler} handler - * @returns {Handler} - */ -function scoped(scope, handler) { - if (scope === '') return handler; - - return (req, res, next) => { - if (req.url?.startsWith(scope)) { - const original_url = req.url; - req.url = req.url.slice(scope.length); - handler(req, res, () => { - req.url = original_url; - next(); - }); - } else { - next(); - } - }; -} - -/** @param {string} path */ -function is_file(path) { - return fs.existsSync(path) && !fs.statSync(path).isDirectory(); -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/index.js b/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/index.js deleted file mode 100644 index 6d42480..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/index.js +++ /dev/null @@ -1,301 +0,0 @@ -import { tsPlugin } from '@sveltejs/acorn-typescript'; -import { Parser } from 'acorn'; -import { read } from '../../../utils/filesystem.js'; - -const valid_page_options_array = /** @type {const} */ ([ - 'ssr', - 'prerender', - 'csr', - 'trailingSlash', - 'config', - 'entries', - 'load' -]); - -/** @type {Set} */ -const valid_page_options = new Set(valid_page_options_array); - -/** @typedef {typeof valid_page_options_array[number]} ValidPageOption */ -/** @typedef {Partial>} PageOptions */ - -const skip_parsing_regex = new RegExp( - `${Array.from(valid_page_options).join('|')}|(?:export[\\s\\n]+\\*[\\s\\n]+from)` -); - -const parser = Parser.extend(tsPlugin()); - -/** - * Collects page options from a +page.js/+layout.js file, ignoring reassignments - * and using the declared value (except for load functions, for which the value is `true`). - * Returns `null` if any export is too difficult to analyse. - * @param {string} filename The name of the file to report when an error occurs - * @param {string} input - * @returns {PageOptions | null} - */ -export function statically_analyse_page_options(filename, input) { - // if there's a chance there are no page exports or an unparseable - // export all declaration, then we can skip the AST parsing which is expensive - if (!skip_parsing_regex.test(input)) { - return {}; - } - - try { - const source = parser.parse(input, { - sourceType: 'module', - ecmaVersion: 'latest' - }); - - /** @type {Map} */ - const page_options = new Map(); - - for (const statement of source.body) { - // ignore export all declarations with aliases that are not page options - if ( - statement.type === 'ExportAllDeclaration' && - statement.exported && - !valid_page_options.has(get_name(statement.exported)) - ) { - continue; - } - - if ( - statement.type === 'ExportDefaultDeclaration' || - statement.type === 'ExportAllDeclaration' - ) { - return null; - } else if (statement.type !== 'ExportNamedDeclaration') { - continue; - } - - if (statement.specifiers.length) { - /** @type {Map} */ - const export_specifiers = new Map(); - for (const specifier of statement.specifiers) { - const exported_name = get_name(specifier.exported); - if (!valid_page_options.has(exported_name)) { - continue; - } - - if (statement.source) { - return null; - } - - export_specifiers.set(get_name(specifier.local), exported_name); - } - - for (const statement of source.body) { - switch (statement.type) { - case 'ImportDeclaration': { - for (const import_specifier of statement.specifiers) { - if (export_specifiers.has(import_specifier.local.name)) { - return null; - } - } - break; - } - case 'ExportNamedDeclaration': - case 'VariableDeclaration': - case 'FunctionDeclaration': - case 'ClassDeclaration': { - const declaration = - statement.type === 'ExportNamedDeclaration' ? statement.declaration : statement; - - if (!declaration) { - break; - } - - // class and function declarations - if (declaration.type !== 'VariableDeclaration') { - if (export_specifiers.has(declaration.id.name)) { - return null; - } - break; - } - - for (const variable_declarator of declaration.declarations) { - if ( - variable_declarator.id.type !== 'Identifier' || - !export_specifiers.has(variable_declarator.id.name) - ) { - continue; - } - - if (variable_declarator.init?.type === 'Literal') { - page_options.set( - /** @type {string} */ (export_specifiers.get(variable_declarator.id.name)), - variable_declarator.init.value - ); - export_specifiers.delete(variable_declarator.id.name); - continue; - } - - // Special case: We only want to know that 'load' is exported (in a way that doesn't cause truthy checks in other places to trigger) - if (variable_declarator.id.name === 'load') { - page_options.set('load', null); - export_specifiers.delete('load'); - continue; - } - - // references a declaration we can't easily evaluate statically - return null; - } - break; - } - } - } - - // there were some export specifiers that we couldn't resolve - if (export_specifiers.size) { - return null; - } - continue; - } - - if (!statement.declaration) { - continue; - } - - // class and function declarations - if (statement.declaration.type !== 'VariableDeclaration') { - if (valid_page_options.has(statement.declaration.id.name)) { - // Special case: We only want to know that 'load' is exported (in a way that doesn't cause truthy checks in other places to trigger) - if (statement.declaration.id.name === 'load') { - page_options.set('load', null); - } else { - return null; - } - } - continue; - } - - for (const declaration of statement.declaration.declarations) { - if (declaration.id.type !== 'Identifier') { - return null; - } - - if (!valid_page_options.has(declaration.id.name)) { - continue; - } - - if (declaration.init?.type === 'Literal') { - page_options.set(declaration.id.name, declaration.init.value); - continue; - } - - // Special case: We only want to know that 'load' is exported (in a way that doesn't cause truthy checks in other places to trigger) - if (declaration.id.name === 'load') { - page_options.set('load', null); - continue; - } - - // references a declaration we can't easily evaluate statically - return null; - } - } - - return Object.fromEntries(page_options); - } catch (error) { - if (error instanceof Error) { - error.message = `Failed to statically analyse page options for ${filename}. ${error.message}`; - } - throw error; - } -} - -/** - * @param {import('acorn').Identifier | import('acorn').Literal} node - * @returns {string} - */ -function get_name(node) { - return node.type === 'Identifier' ? node.name : /** @type {string} */ (node.value); -} - -/** - * Reads and statically analyses a file for page options - * @param {string} filepath - * @returns {PageOptions | null} Returns the page options for the file or `null` if unanalysable - */ -export function get_page_options(filepath) { - try { - const input = read(filepath); - const page_options = statically_analyse_page_options(filepath, input); - if (page_options === null) { - return null; - } - - return page_options; - } catch { - return null; - } -} - -export function create_node_analyser() { - const static_exports = new Map(); - - /** - * @param {string | undefined} key - * @param {PageOptions | null} page_options - */ - const cache = (key, page_options) => { - if (key) static_exports.set(key, { page_options, children: [] }); - }; - - /** - * Computes the final page options (may include load function as `load: null`; special case) for a node (if possible). Otherwise, returns `null`. - * @param {import('types').PageNode} node - * @returns {PageOptions | null} - */ - const crawl = (node) => { - const key = node.universal || node.server; - if (key && static_exports.has(key)) { - return { ...static_exports.get(key)?.page_options }; - } - - /** @type {PageOptions} */ - let page_options = {}; - - if (node.parent) { - const parent_options = crawl(node.parent); - - const parent_key = node.parent.universal || node.parent.server; - if (key && parent_key) { - static_exports.get(parent_key)?.children.push(key); - } - - if (parent_options === null) { - // if the parent cannot be analysed, we can't know what page options - // the child node inherits, so we also mark it as unanalysable - cache(key, null); - return null; - } - - page_options = { ...parent_options }; - } - - if (node.server) { - const server_page_options = get_page_options(node.server); - if (server_page_options === null) { - cache(key, null); - return null; - } - page_options = { ...page_options, ...server_page_options }; - } - - if (node.universal) { - const universal_page_options = get_page_options(node.universal); - if (universal_page_options === null) { - cache(key, null); - return null; - } - page_options = { ...page_options, ...universal_page_options }; - } - - cache(key, page_options); - - return page_options; - }; - - return { - get_page_options: crawl - }; -} diff --git a/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/utils.js b/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/utils.js deleted file mode 100644 index c39cc06..0000000 --- a/web/node_modules/@sveltejs/kit/src/exports/vite/static_analysis/utils.js +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Check if content has children rendering (slot, @render, or children prop forwarding) - * @param {string} content - The markup content - * @param {boolean} is_svelte_5_plus - Whether the project uses Svelte 5+ - * @returns {boolean} - */ -export function has_children(content, is_svelte_5_plus) { - return ( - content.includes('') { - in_html_comment = false; - i += 2; // Skip the '-->' part - continue; - } - - // If we're in any comment, skip processing - if (in_single_line_comment || in_multi_line_comment || in_html_comment) { - continue; - } - - // Handle escape sequences in strings - if ((in_single_quote || in_double_quote || in_template_literal) && char === '\\') { - i++; // Skip the escaped character - continue; - } - - // Handle string boundaries - if (!in_double_quote && !in_template_literal && char === "'") { - in_single_quote = !in_single_quote; - continue; - } - - if (!in_single_quote && !in_template_literal && char === '"') { - in_double_quote = !in_double_quote; - continue; - } - - if (!in_single_quote && !in_double_quote && char === '`') { - in_template_literal = !in_template_literal; - continue; - } - - // If we're inside any string, don't process comment delimiters - if (in_single_quote || in_double_quote || in_template_literal) { - continue; - } - - // Check for comment starts - if (next_two === '//') { - in_single_line_comment = true; - i++; // Skip the second '/' - continue; - } - - if (next_two === '/*') { - in_multi_line_comment = true; - i++; // Skip the '*' - continue; - } - - if (next_four === ' - * - * - *

Currently at {page.url.pathname}

- * - * {#if page.error} - * Problem detected - * {:else} - * All systems operational - * {/if} - * ``` - * - * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes) - * - * ```svelte - * - * - * ``` - * - * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time. - * - * @type {import('@sveltejs/kit').Page} - */ -export const page = BROWSER ? client_page : server_page; - -/** - * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. - * Values are `null` when no navigation is occurring, or during server rendering. - * @type {import('@sveltejs/kit').Navigation | { from: null, to: null, type: null, willUnload: null, delta: null, complete: null }} - */ -// @ts-expect-error -export const navigating = BROWSER ? client_navigating : server_navigating; - -/** - * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. - * @type {{ get current(): boolean; check(): Promise; }} - */ -export const updated = BROWSER ? client_updated : server_updated; diff --git a/web/node_modules/@sveltejs/kit/src/runtime/app/state/server.js b/web/node_modules/@sveltejs/kit/src/runtime/app/state/server.js deleted file mode 100644 index 0be1693..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/app/state/server.js +++ /dev/null @@ -1,63 +0,0 @@ -import { DEV } from 'esm-env'; -import { getContext } from 'svelte'; - -function context() { - return getContext('__request__'); -} - -/** @param {string} name */ -function context_dev(name) { - try { - return context(); - } catch { - throw new Error( - `Can only read '${name}' on the server during rendering (not in e.g. \`load\` functions), as it is bound to the current request via component context. This prevents state from leaking between users. ` + - 'For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server' - ); - } -} - -export const page = { - get data() { - return (DEV ? context_dev('page.data') : context()).page.data; - }, - get error() { - return (DEV ? context_dev('page.error') : context()).page.error; - }, - get form() { - return (DEV ? context_dev('page.form') : context()).page.form; - }, - get params() { - return (DEV ? context_dev('page.params') : context()).page.params; - }, - get route() { - return (DEV ? context_dev('page.route') : context()).page.route; - }, - get state() { - return (DEV ? context_dev('page.state') : context()).page.state; - }, - get status() { - return (DEV ? context_dev('page.status') : context()).page.status; - }, - get url() { - return (DEV ? context_dev('page.url') : context()).page.url; - } -}; - -export const navigating = { - from: null, - to: null, - type: null, - willUnload: null, - delta: null, - complete: null -}; - -export const updated = { - get current() { - return false; - }, - check: () => { - throw new Error('Can only call updated.check() in the browser'); - } -}; diff --git a/web/node_modules/@sveltejs/kit/src/runtime/app/stores.js b/web/node_modules/@sveltejs/kit/src/runtime/app/stores.js deleted file mode 100644 index 11e84fe..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/app/stores.js +++ /dev/null @@ -1,101 +0,0 @@ -import { getContext } from 'svelte'; -import { BROWSER, DEV } from 'esm-env'; -import { stores as browser_stores } from '../client/client.js'; - -/** - * A function that returns all of the contextual stores. On the server, this must be called during component initialization. - * Only use this if you need to defer store subscription until after the component has mounted, for some reason. - * - * @deprecated Use `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - */ -export const getStores = () => { - const stores = BROWSER ? browser_stores : getContext('__svelte__'); - - return { - /** @type {typeof page} */ - page: { - subscribe: stores.page.subscribe - }, - /** @type {typeof navigating} */ - navigating: { - subscribe: stores.navigating.subscribe - }, - /** @type {typeof updated} */ - updated: stores.updated - }; -}; - -/** - * A readable store whose value contains page data. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * @type {import('svelte/store').Readable} - */ -export const page = { - subscribe(fn) { - const store = DEV ? get_store('page') : getStores().page; - return store.subscribe(fn); - } -}; - -/** - * A readable store. - * When navigating starts, its value is a `Navigation` object with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. - * When navigating finishes, its value reverts to `null`. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `navigating` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * @type {import('svelte/store').Readable} - */ -export const navigating = { - subscribe(fn) { - const store = DEV ? get_store('navigating') : getStores().navigating; - return store.subscribe(fn); - } -}; - -/** - * A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `updated` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * @type {import('svelte/store').Readable & { check(): Promise }} - */ -export const updated = { - subscribe(fn) { - const store = DEV ? get_store('updated') : getStores().updated; - - if (BROWSER) { - updated.check = store.check; - } - - return store.subscribe(fn); - }, - check: () => { - throw new Error( - BROWSER - ? 'Cannot check updated store before subscribing' - : 'Can only check updated store in browser' - ); - } -}; - -/** - * @template {keyof ReturnType} Name - * @param {Name} name - * @returns {ReturnType[Name]} - */ -function get_store(name) { - try { - return getStores()[name]; - } catch { - throw new Error( - `Cannot subscribe to '${name}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.` + - 'For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server' - ); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/bundle.js b/web/node_modules/@sveltejs/kit/src/runtime/client/bundle.js deleted file mode 100644 index f375d02..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/bundle.js +++ /dev/null @@ -1,17 +0,0 @@ -/* if `bundleStrategy` is 'single' or 'inline', this file is used as the entry point */ - -import * as kit from './entry.js'; - -// @ts-expect-error -import * as app from '__sveltekit/manifest'; - -/** - * - * @param {HTMLElement} element - * @param {import('./types.js').HydrateOptions} options - */ -export function start(element, options) { - void kit.start(app, element, options); -} - -export { app }; diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/client.js b/web/node_modules/@sveltejs/kit/src/runtime/client/client.js deleted file mode 100644 index d6ece57..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/client.js +++ /dev/null @@ -1,3309 +0,0 @@ -import { BROWSER, DEV } from 'esm-env'; -import * as svelte from 'svelte'; -import { HttpError, Redirect, SvelteKitError } from '@sveltejs/kit/internal'; -const { onMount, tick } = svelte; -// Svelte 4 and under don't have `untrack`, so we have to fallback if `untrack` is not exported -const untrack = svelte.untrack ?? ((value) => value()); -import { - decode_params, - decode_pathname, - strip_hash, - make_trackable, - normalize_path -} from '../../utils/url.js'; -import { dev_fetch, initial_fetch, lock_fetch, subsequent_fetch, unlock_fetch } from './fetcher.js'; -import { parse, parse_server_route } from './parse.js'; -import * as storage from './session-storage.js'; -import { - find_anchor, - resolve_url, - get_link_info, - get_router_options, - is_external_url, - origin, - scroll_state, - notifiable_store, - create_updated_store, - load_css -} from './utils.js'; -import { base } from '$app/paths'; -import * as devalue from 'devalue'; -import { - HISTORY_INDEX, - NAVIGATION_INDEX, - PRELOAD_PRIORITIES, - SCROLL_KEY, - STATES_KEY, - SNAPSHOT_KEY, - PAGE_URL_KEY -} from './constants.js'; -import { validate_page_exports } from '../../utils/exports.js'; -import { compact } from '../../utils/array.js'; -import { - INVALIDATED_PARAM, - TRAILING_SLASH_PARAM, - validate_depends, - validate_load_response -} from '../shared.js'; -import { get_message, get_status } from '../../utils/error.js'; -import { writable } from 'svelte/store'; -import { page, update, navigating } from './state.svelte.js'; -import { add_data_suffix, add_resolution_suffix } from '../pathname.js'; -import { noop_span } from '../telemetry/noop.js'; -import { text_decoder } from '../utils.js'; - -export { load_css }; -const ICON_REL_ATTRIBUTES = new Set(['icon', 'shortcut icon', 'apple-touch-icon']); - -let errored = false; -/** - * Set via transformError, reset and read at the end of navigate. - * Necessary because a navigation might succeed loading but during rendering - * an error occurs, at which point the navigation result needs to be overridden with the error result. - * TODO this is all very hacky, rethink for SvelteKit 3 where we can assume Svelte 5 and do an overhaul of client.js - * @type {{ error: App.Error, status: number } | null} - */ -let rendering_error = null; - -// We track the scroll position associated with each history entry in sessionStorage, -// rather than on history.state itself, because when navigation is driven by -// popstate it's too late to update the scroll position associated with the -// state we're navigating from -/** - * history index -> { x, y } - * @type {Record} - */ -const scroll_positions = storage.get(SCROLL_KEY) ?? {}; - -/** - * navigation index -> any - * @type {Record} - */ -const snapshots = storage.get(SNAPSHOT_KEY) ?? {}; - -if (DEV && BROWSER) { - let warned = false; - - const current_module_url = import.meta.url.split('?')[0]; // remove query params that vite adds to the URL when it is loaded from node_modules - - const warn = () => { - if (warned) return; - - // Rather than saving a pointer to the original history methods, which would prevent monkeypatching by other libs, - // inspect the stack trace to see if we're being called from within SvelteKit. - let stack = new Error().stack?.split('\n'); - if (!stack) return; - if (!stack[0].includes('https:') && !stack[0].includes('http:')) stack = stack.slice(1); // Chrome includes the error message in the stack - stack = stack.slice(2); // remove `warn` and the place where `warn` was called - // Can be falsy if was called directly from an anonymous function - if (stack[0]?.includes(current_module_url)) return; - - warned = true; - - console.warn( - "Avoid using `history.pushState(...)` and `history.replaceState(...)` as these will conflict with SvelteKit's router. Use the `pushState` and `replaceState` imports from `$app/navigation` instead." - ); - }; - - const push_state = history.pushState; - history.pushState = (...args) => { - warn(); - return push_state.apply(history, args); - }; - - const replace_state = history.replaceState; - history.replaceState = (...args) => { - warn(); - return replace_state.apply(history, args); - }; -} - -export const stores = { - url: /* @__PURE__ */ notifiable_store({}), - page: /* @__PURE__ */ notifiable_store({}), - navigating: /* @__PURE__ */ writable( - /** @type {import('@sveltejs/kit').Navigation | null} */ (null) - ), - updated: /* @__PURE__ */ create_updated_store() -}; - -/** @param {number} index */ -function update_scroll_positions(index) { - scroll_positions[index] = scroll_state(); -} - -/** - * @param {number} current_history_index - * @param {number} current_navigation_index - */ -function clear_onward_history(current_history_index, current_navigation_index) { - // if we navigated back, then pushed a new state, we can - // release memory by pruning the scroll/snapshot lookup - let i = current_history_index + 1; - while (scroll_positions[i]) { - delete scroll_positions[i]; - i += 1; - } - - i = current_navigation_index + 1; - while (snapshots[i]) { - delete snapshots[i]; - i += 1; - } -} - -/** - * Loads `href` the old-fashioned way, with a full page reload. - * Returns a `Promise` that never resolves (to prevent any - * subsequent work, e.g. history manipulation, from happening) - * @param {URL} url - * @param {boolean} [replace] If `true`, will replace the current `history` entry rather than creating a new one with `pushState` - */ -function native_navigation(url, replace = false) { - if (replace) { - location.replace(url.href); - } else { - location.href = url.href; - } - return new Promise(() => {}); -} - -/** - * Checks whether a service worker is registered, and if it is, - * tries to update it. - */ -async function update_service_worker() { - if ('serviceWorker' in navigator) { - const registration = await navigator.serviceWorker.getRegistration(base || '/'); - if (registration) { - await registration.update(); - } - } -} - -function noop() {} - -/** @type {import('types').CSRRoute[]} All routes of the app. Only available when kit.router.resolution=client */ -let routes; -/** @type {import('types').CSRPageNodeLoader} */ -let default_layout_loader; -/** @type {import('types').CSRPageNodeLoader} */ -let default_error_loader; -/** @type {HTMLElement} */ -let container; -/** @type {HTMLElement} */ -let target; - -/** @type {import('./types.js').SvelteKitApp} */ -export let app; - -/** - * Data that was serialized during SSR. This is cleared when the user first navigates - * @type {Record} - */ -export let remote_responses = {}; - -/** @type {Array<((url: URL) => boolean)>} */ -const invalidated = []; - -/** - * An array of the `+layout.svelte` and `+page.svelte` component instances - * that currently live on the page — used for capturing and restoring snapshots. - * It's updated/manipulated through `bind:this` in `Root.svelte`. - * @type {import('svelte').SvelteComponent[]} - */ -const components = []; - -/** @type {{id: string, token: {}, promise: Promise, fork: Promise | null} | null} */ -let load_cache = null; - -function discard_load_cache() { - void load_cache?.fork?.then((f) => f?.discard()); - load_cache = null; -} - -/** - * @type {Map>} - * Cache for client-side rerouting, since it could contain async calls which we want to - * avoid running multiple times which would slow down navigations (e.g. else preloading - * wouldn't help because on navigation it would be called again). Since `reroute` should be - * a pure function (i.e. always return the same) value it's safe to cache across navigations. - * The server reroute calls don't need to be cached because they are called using `import(...)` - * which is cached per the JS spec. - */ -const reroute_cache = new Map(); - -/** - * Note on before_navigate_callbacks, on_navigate_callbacks and after_navigate_callbacks: - * do not re-assign as some closures keep references to these Sets - */ -/** @type {Set<(navigation: import('@sveltejs/kit').BeforeNavigate) => void>} */ -const before_navigate_callbacks = new Set(); - -/** @type {Set<(navigation: import('@sveltejs/kit').OnNavigate) => import('types').MaybePromise<(() => void) | void>>} */ -const on_navigate_callbacks = new Set(); - -/** @type {Set<(navigation: import('@sveltejs/kit').AfterNavigate) => void>} */ -const after_navigate_callbacks = new Set(); - -/** @type {import('./types.js').NavigationState & { nav: import('@sveltejs/kit').NavigationEvent }} */ -let current = { - branch: [], - error: null, - // @ts-ignore - we need the initial value to be null - url: null, - // @ts-ignore - we need the initial value to be null - nav: null -}; - -/** this being true means we SSR'd */ -let hydrated = false; -let started = false; -let autoscroll = true; -let updating = false; -let is_navigating = false; -let hash_navigating = false; -/** True as soon as there happened one client-side navigation (excluding the SvelteKit-initialized initial one when in SPA mode) */ -let has_navigated = false; - -let force_invalidation = false; - -/** @type {import('svelte').SvelteComponent} */ -let root; - -/** @type {number} keeping track of the history index in order to prevent popstate navigation events if needed */ -let current_history_index; - -/** @type {number} */ -let current_navigation_index; - -/** @type {{}} */ -let token; - -/** - * A set of tokens which are associated to current preloads. - * If a preload becomes a real navigation, it's removed from the set. - * If a preload token is in the set and the preload errors, the error - * handling logic (for example reloading) is skipped. - */ -const preload_tokens = new Set(); - -/** @type {Promise | null} */ -export let pending_invalidate; - -/** - * @type {Map} - * A map of id -> query info with all queries that currently exist in the app. - */ -export const query_map = new Map(); - -/** - * @param {import('./types.js').SvelteKitApp} _app - * @param {HTMLElement} _target - * @param {Parameters[1]} [hydrate] - */ -export async function start(_app, _target, hydrate) { - if (DEV && _target === document.body) { - console.warn( - 'Placing %sveltekit.body% directly inside is not recommended, as your app may break for users who have certain browser extensions installed.\n\nConsider wrapping it in an element:\n\n
\n %sveltekit.body%\n
' - ); - } - - if (__SVELTEKIT_PAYLOAD__?.data) { - remote_responses = __SVELTEKIT_PAYLOAD__.data; - } - - // detect basic auth credentials in the current URL - // https://github.com/sveltejs/kit/pull/11179 - // if so, refresh the page without credentials - if (document.URL !== location.href) { - // eslint-disable-next-line no-self-assign - location.href = location.href; - } - - app = _app; - - await _app.hooks.init?.(); - - routes = __SVELTEKIT_CLIENT_ROUTING__ ? parse(_app) : []; - container = __SVELTEKIT_EMBEDDED__ ? _target : document.documentElement; - target = _target; - - // we import the root layout/error nodes eagerly, so that - // connectivity errors after initialisation don't nuke the app - default_layout_loader = _app.nodes[0]; - default_error_loader = _app.nodes[1]; - void default_layout_loader(); - void default_error_loader(); - - current_history_index = history.state?.[HISTORY_INDEX]; - current_navigation_index = history.state?.[NAVIGATION_INDEX]; - - if (!current_history_index) { - // we use Date.now() as an offset so that cross-document navigations - // within the app don't result in data loss - current_history_index = current_navigation_index = Date.now(); - - // create initial history entry, so we can return here - history.replaceState( - { - ...history.state, - [HISTORY_INDEX]: current_history_index, - [NAVIGATION_INDEX]: current_navigation_index - }, - '' - ); - } - - // if we reload the page, or Cmd-Shift-T back to it, - // recover scroll position - const scroll = scroll_positions[current_history_index]; - function restore_scroll() { - if (scroll) { - history.scrollRestoration = 'manual'; - scrollTo(scroll.x, scroll.y); - } - } - - if (hydrate) { - restore_scroll(); - - await _hydrate(target, hydrate); - } else { - await navigate({ - type: 'enter', - url: resolve_url(app.hash ? decode_hash(new URL(location.href)) : location.href), - replace_state: true - }); - - restore_scroll(); - } - - _start_router(); -} - -async function _invalidate(include_load_functions = true, reset_page_state = true) { - // Accept all invalidations as they come, don't swallow any while another invalidation - // is running because subsequent invalidations may make earlier ones outdated, - // but batch multiple synchronous invalidations. - await (pending_invalidate ||= Promise.resolve()); - if (!pending_invalidate) return; - pending_invalidate = null; - - const nav_token = (token = {}); - const intent = await get_navigation_intent(current.url, true); - - // Clear preload, it might be affected by the invalidation. - // Also solves an edge case where a preload is triggered, the navigation for it - // was then triggered and is still running while the invalidation kicks in, - // at which point the invalidation should take over and "win". - discard_load_cache(); - - // Rerun queries - if (force_invalidation) { - query_map.forEach(({ resource }) => { - resource.refresh?.(); - }); - } - - if (include_load_functions) { - const prev_state = page.state; - const navigation_result = intent && (await load_route(intent)); - if (!navigation_result || nav_token !== token) return; - - if (navigation_result.type === 'redirect') { - return _goto( - new URL(navigation_result.location, current.url).href, - { replaceState: true }, - 1, - nav_token - ); - } - - // This is a bit hacky but allows us not having to pass that boolean around, making things harder to reason about - if (!reset_page_state) { - navigation_result.props.page.state = prev_state; - } - update(navigation_result.props.page); - current = { ...navigation_result.state, nav: current.nav }; - reset_invalidation(); - root.$set(navigation_result.props); - } else { - reset_invalidation(); - } - - // Don't use allSettled yet because it's too new - await Promise.all([...query_map.values()].map(({ resource }) => resource)).catch(noop); -} - -function reset_invalidation() { - invalidated.length = 0; - force_invalidation = false; -} - -/** @param {number} index */ -function capture_snapshot(index) { - if (components.some((c) => c?.snapshot)) { - snapshots[index] = components.map((c) => c?.snapshot?.capture()); - } -} - -/** @param {number} index */ -function restore_snapshot(index) { - snapshots[index]?.forEach((value, i) => { - components[i]?.snapshot?.restore(value); - }); -} - -function persist_state() { - update_scroll_positions(current_history_index); - storage.set(SCROLL_KEY, scroll_positions); - - capture_snapshot(current_navigation_index); - storage.set(SNAPSHOT_KEY, snapshots); -} - -/** - * @param {string | URL} url - * @param {{ replaceState?: boolean; noScroll?: boolean; keepFocus?: boolean; invalidateAll?: boolean; invalidate?: Array boolean)>; state?: Record }} options - * @param {number} redirect_count - * @param {{}} [nav_token] - */ -export async function _goto(url, options, redirect_count, nav_token) { - /** @type {string[]} */ - let query_keys; - - // Clear preload cache when invalidateAll is true to ensure fresh data - // after form submissions or explicit invalidations - if (options.invalidateAll) { - discard_load_cache(); - } - - await navigate({ - type: 'goto', - url: resolve_url(url), - keepfocus: options.keepFocus, - noscroll: options.noScroll, - replace_state: options.replaceState, - state: options.state, - redirect_count, - nav_token, - accept: () => { - if (options.invalidateAll) { - force_invalidation = true; - query_keys = [...query_map.keys()]; - } - - if (options.invalidate) { - options.invalidate.forEach(push_invalidated); - } - } - }); - - if (options.invalidateAll) { - // TODO the ticks shouldn't be necessary, something inside Svelte itself is buggy - // when a query in a layout that still exists after page change is refreshed earlier than this - void svelte - .tick() - .then(svelte.tick) - .then(() => { - query_map.forEach(({ resource }, key) => { - // Only refresh those that already existed on the old page - if (query_keys?.includes(key)) { - resource.refresh?.(); - } - }); - }); - } -} - -/** @param {import('./types.js').NavigationIntent} intent */ -async function _preload_data(intent) { - // Reuse the existing pending preload if it's for the same navigation. - // Prevents an edge case where same preload is triggered multiple times, - // then a later one is becoming the real navigation and the preload tokens - // get out of sync. - if (intent.id !== load_cache?.id) { - discard_load_cache(); - - const preload = {}; - preload_tokens.add(preload); - load_cache = { - id: intent.id, - token: preload, - promise: load_route({ ...intent, preload }).then((result) => { - preload_tokens.delete(preload); - if (result.type === 'loaded' && result.state.error) { - // Don't cache errors, because they might be transient - discard_load_cache(); - } - return result; - }), - fork: null - }; - - if (__SVELTEKIT_FORK_PRELOADS__ && svelte.fork) { - const lc = load_cache; - - lc.fork = lc.promise.then((result) => { - // if load_cache was discarded before load_cache.promise could - // resolve, bail rather than creating an orphan fork - if (lc === load_cache && result.type === 'loaded') { - try { - return svelte.fork(() => { - root.$set(result.props); - update(result.props.page); - }); - } catch { - // if it errors, it's because the experimental flag isn't enabled in Svelte - } - } - - return null; - }); - } - } - - return load_cache.promise; -} - -/** - * @param {URL} url - * @returns {Promise} - */ -async function _preload_code(url) { - const route = (await get_navigation_intent(url, false))?.route; - - if (route) { - await Promise.all( - /** @type {[has_server_load: boolean, node_loader: import('types').CSRPageNodeLoader][]} */ ( - [...route.layouts, route.leaf].filter(Boolean) - ).map((load) => load[1]()) - ); - } -} - -/** - * @param {import('./types.js').NavigationFinished} result - * @param {HTMLElement} target - * @param {boolean} hydrate - */ -async function initialize(result, target, hydrate) { - if (DEV && result.state.error && document.querySelector('vite-error-overlay')) return; - - /** @type {import('@sveltejs/kit').NavigationEvent} */ - const nav = { - params: current.params, - route: { id: current.route?.id ?? null }, - url: new URL(location.href) - }; - - current = { - ...result.state, - nav - }; - - const style = document.querySelector('style[data-sveltekit]'); - if (style) style.remove(); - - Object.assign(page, /** @type {import('@sveltejs/kit').Page} */ (result.props.page)); - - root = new app.root({ - target, - props: { ...result.props, stores, components }, - hydrate, - // @ts-ignore Svelte 5 specific: asynchronously instantiate the component, i.e. don't call flushSync - sync: false, - // @ts-ignore Svelte 5 specific: transformError allows to transform errors before they are passed to boundaries - transformError: __SVELTEKIT_EXPERIMENTAL_USE_TRANSFORM_ERROR__ - ? /** @param {unknown} e */ async (e) => { - const error = await handle_error(e, current.nav); - rendering_error = { error, status: get_status(e) }; - page.error = error; - page.status = rendering_error.status; - return error; - } - : undefined - }); - - // Wait for a microtask in case svelte experimental async is enabled, - // which causes component script blocks to run asynchronously - void (await Promise.resolve()); - - restore_snapshot(current_navigation_index); - - if (hydrate) { - /** @type {import('@sveltejs/kit').AfterNavigate} */ - const navigation = { - from: null, - to: { - ...nav, - scroll: scroll_positions[current_history_index] ?? scroll_state() - }, - willUnload: false, - type: 'enter', - complete: Promise.resolve() - }; - - after_navigate_callbacks.forEach((fn) => fn(navigation)); - } - - started = true; -} - -/** - * - * @param {{ - * url: URL; - * params: Record; - * branch: Array; - * errors?: Array; - * status: number; - * error: App.Error | null; - * route: import('types').CSRRoute | null; - * form?: Record | null; - * }} opts - */ -async function get_navigation_result_from_branch({ - url, - params, - branch, - errors, - status, - error, - route, - form -}) { - /** @type {import('types').TrailingSlash} */ - let slash = 'never'; - - // if `paths.base === '/a/b/c`, then the root route is always `/a/b/c/`, regardless of - // the `trailingSlash` route option, so that relative paths to JS and CSS work - if (base && (url.pathname === base || url.pathname === base + '/')) { - slash = 'always'; - } else { - for (const node of branch) { - if (node?.slash !== undefined) slash = node.slash; - } - } - - url.pathname = normalize_path(url.pathname, slash); - // eslint-disable-next-line no-self-assign - url.search = url.search; // turn `/?` into `/` - - /** @type {import('./types.js').NavigationFinished} */ - const result = { - type: 'loaded', - state: { - url, - params, - branch, - error, - route - }, - props: { - // @ts-ignore Somehow it's getting SvelteComponent and SvelteComponentDev mixed up - constructors: compact(branch).map((branch_node) => branch_node.node.component), - page: clone_page(page) - } - }; - - if (errors && __SVELTEKIT_EXPERIMENTAL_USE_TRANSFORM_ERROR__) { - let last_idx = -1; - result.props.errors = await Promise.all( - // eslint-disable-next-line @typescript-eslint/await-thenable - branch - .map((b, i) => { - if (i === 0) return undefined; // root layout wraps root error component, not the other way around - if (!b) return null; - - i--; - // Find the closest error component up to the previous branch - while (i > last_idx + 1 && !errors[i]) i -= 1; - last_idx = i; - return errors[i]?.() - .then((e) => e.component) - .catch(() => undefined); - }) - // filter out indexes where there was no branch, but keep indexes where there was a branch but no error component - .filter((e) => e !== null) - ); - } - - if (error && __SVELTEKIT_EXPERIMENTAL_USE_TRANSFORM_ERROR__) { - result.props.error = error; - } - - if (form !== undefined) { - result.props.form = form; - } - - let data = {}; - let data_changed = !page; - - let p = 0; - - for (let i = 0; i < Math.max(branch.length, current.branch.length); i += 1) { - const node = branch[i]; - const prev = current.branch[i]; - - if (node?.data !== prev?.data) data_changed = true; - if (!node) continue; - - data = { ...data, ...node.data }; - - // Only set props if the node actually updated. This prevents needless rerenders. - if (data_changed) { - result.props[`data_${p}`] = data; - } - - p += 1; - } - - const page_changed = - !current.url || - url.href !== current.url.href || - current.error !== error || - (form !== undefined && form !== page.form) || - data_changed; - - if (page_changed) { - result.props.page = { - error, - params, - route: { - id: route?.id ?? null - }, - state: {}, - status, - url: new URL(url), - form: form ?? null, - // The whole page store is updated, but this way the object reference stays the same - data: data_changed ? data : page.data - }; - } - - return result; -} - -/** - * Call the universal load function of the given node, if it exists. - * - * @param {{ - * loader: import('types').CSRPageNodeLoader; - * parent: () => Promise>; - * url: URL; - * params: Record; - * route: { id: string | null }; - * server_data_node: import('./types.js').DataNode | null; - * }} options - * @returns {Promise} - */ -async function load_node({ loader, parent, url, params, route, server_data_node }) { - /** @type {Record | null} */ - let data = null; - - let is_tracking = true; - - /** @type {import('types').Uses} */ - const uses = { - dependencies: new Set(), - params: new Set(), - parent: false, - route: false, - url: false, - search_params: new Set() - }; - - const node = await loader(); - - if (DEV) { - validate_page_exports(node.universal); - - if (node.universal && app.hash) { - const options = Object.keys(node.universal).filter((o) => o !== 'load'); - - if (options.length > 0) { - throw new Error( - `Page options are ignored when \`router.type === 'hash'\` (${route.id} has ${options - .filter((o) => o !== 'load') - .map((o) => `'${o}'`) - .join(', ')})` - ); - } - } - } - - if (__SVELTEKIT_HAS_UNIVERSAL_LOAD__ && node.universal?.load) { - /** @param {string[]} deps */ - function depends(...deps) { - for (const dep of deps) { - if (DEV) validate_depends(/** @type {string} */ (route.id), dep); - - const { href } = new URL(dep, url); - uses.dependencies.add(href); - } - } - - /** @type {import('@sveltejs/kit').LoadEvent} */ - const load_input = { - tracing: { enabled: false, root: noop_span, current: noop_span }, - route: new Proxy(route, { - get: (target, key) => { - if (is_tracking) { - uses.route = true; - } - return target[/** @type {'id'} */ (key)]; - } - }), - params: new Proxy(params, { - get: (target, key) => { - if (is_tracking) { - uses.params.add(/** @type {string} */ (key)); - } - return target[/** @type {string} */ (key)]; - } - }), - data: server_data_node?.data ?? null, - url: make_trackable( - url, - () => { - if (is_tracking) { - uses.url = true; - } - }, - (param) => { - if (is_tracking) { - uses.search_params.add(param); - } - }, - app.hash - ), - async fetch(resource, init) { - if (resource instanceof Request) { - // we're not allowed to modify the received `Request` object, so in order - // to fixup relative urls we create a new equivalent `init` object instead - init = { - // the request body must be consumed in memory until browsers - // implement streaming request bodies and/or the body getter - body: - resource.method === 'GET' || resource.method === 'HEAD' - ? undefined - : await resource.blob(), - cache: resource.cache, - credentials: resource.credentials, - // the server sets headers to `undefined` if there are no headers but - // the client defaults to an empty Headers object in the Request object. - // To keep the two values in sync, we explicitly set the headers to `undefined`. - // Also, not sure why, but sometimes 0 is evaluated as truthy so we need to - // explicitly compare the headers length to a number here - headers: [...resource.headers].length > 0 ? resource?.headers : undefined, - integrity: resource.integrity, - keepalive: resource.keepalive, - method: resource.method, - mode: resource.mode, - redirect: resource.redirect, - referrer: resource.referrer, - referrerPolicy: resource.referrerPolicy, - signal: resource.signal, - ...init - }; - } - - const { resolved, promise } = resolve_fetch_url(resource, init, url); - - if (is_tracking) { - depends(resolved.href); - } - - return promise; - }, - setHeaders: () => {}, // noop - depends, - parent() { - if (is_tracking) { - uses.parent = true; - } - return parent(); - }, - untrack(fn) { - is_tracking = false; - try { - return fn(); - } finally { - is_tracking = true; - } - } - }; - - if (DEV) { - try { - lock_fetch(); - data = (await node.universal.load.call(null, load_input)) ?? null; - validate_load_response(data, `related to route '${route.id}'`); - } finally { - unlock_fetch(); - } - } else { - data = (await node.universal.load.call(null, load_input)) ?? null; - } - } - - return { - node, - loader, - server: server_data_node, - universal: node.universal?.load ? { type: 'data', data, uses } : null, - data: data ?? server_data_node?.data ?? null, - slash: node.universal?.trailingSlash ?? server_data_node?.slash - }; -} - -/** - * @param {Request | string | URL} input - * @param {RequestInit | undefined} init - * @param {URL} url - */ -function resolve_fetch_url(input, init, url) { - let requested = input instanceof Request ? input.url : input; - - // we must fixup relative urls so they are resolved from the target page - const resolved = new URL(requested, url); - - // match ssr serialized data url, which is important to find cached responses - if (resolved.origin === url.origin) { - requested = resolved.href.slice(url.origin.length); - } - - // prerendered pages may be served from any origin, so `initial_fetch` urls shouldn't be resolved - const promise = started - ? subsequent_fetch(requested, resolved.href, init) - : initial_fetch(requested, init); - - return { resolved, promise }; -} - -/** - * @param {boolean} parent_changed - * @param {boolean} route_changed - * @param {boolean} url_changed - * @param {Set} search_params_changed - * @param {import('types').Uses | undefined} uses - * @param {Record} params - */ -function has_changed( - parent_changed, - route_changed, - url_changed, - search_params_changed, - uses, - params -) { - if (force_invalidation) return true; - - if (!uses) return false; - - if (uses.parent && parent_changed) return true; - if (uses.route && route_changed) return true; - if (uses.url && url_changed) return true; - - for (const tracked_params of uses.search_params) { - if (search_params_changed.has(tracked_params)) return true; - } - - for (const param of uses.params) { - if (params[param] !== current.params[param]) return true; - } - - for (const href of uses.dependencies) { - if (invalidated.some((fn) => fn(new URL(href)))) return true; - } - - return false; -} - -/** - * @param {import('types').ServerDataNode | import('types').ServerDataSkippedNode | null} node - * @param {import('./types.js').DataNode | null} [previous] - * @returns {import('./types.js').DataNode | null} - */ -function create_data_node(node, previous) { - if (node?.type === 'data') return node; - if (node?.type === 'skip') return previous ?? null; - return null; -} - -/** - * @param {URL | null} old_url - * @param {URL} new_url - */ -function diff_search_params(old_url, new_url) { - if (!old_url) return new Set(new_url.searchParams.keys()); - - const changed = new Set([...old_url.searchParams.keys(), ...new_url.searchParams.keys()]); - - for (const key of changed) { - const old_values = old_url.searchParams.getAll(key); - const new_values = new_url.searchParams.getAll(key); - - if ( - old_values.every((value) => new_values.includes(value)) && - new_values.every((value) => old_values.includes(value)) - ) { - changed.delete(key); - } - } - - return changed; -} - -/** - * @param {Omit & { error: App.Error }} opts - * @returns {import('./types.js').NavigationFinished} - */ -function preload_error({ error, url, route, params }) { - return { - type: 'loaded', - state: { - error, - url, - route, - params, - branch: [] - }, - props: { - page: clone_page(page), - constructors: [] - } - }; -} - -/** - * @param {import('./types.js').NavigationIntent & { preload?: {} }} intent - * @returns {Promise} - */ -async function load_route({ id, invalidating, url, params, route, preload }) { - if (load_cache?.id === id) { - // the preload becomes the real navigation - preload_tokens.delete(load_cache.token); - return load_cache.promise; - } - - const { errors, layouts, leaf } = route; - - const loaders = [...layouts, leaf]; - - // preload modules to avoid waterfall, but handle rejections - // so they don't get reported to Sentry et al (we don't need - // to act on the failures at this point) - errors.forEach((loader) => loader?.().catch(() => {})); - loaders.forEach((loader) => loader?.[1]().catch(() => {})); - - /** @type {import('types').ServerNodesResponse | import('types').ServerRedirectNode | null} */ - let server_data = null; - const url_changed = current.url ? id !== get_page_key(current.url) : false; - const route_changed = current.route ? route.id !== current.route.id : false; - const search_params_changed = diff_search_params(current.url, url); - - let parent_invalid = false; - - if (__SVELTEKIT_HAS_SERVER_LOAD__) { - const invalid_server_nodes = loaders.map((loader, i) => { - const previous = current.branch[i]; - - const invalid = - !!loader?.[0] && - (previous?.loader !== loader[1] || - has_changed( - parent_invalid, - route_changed, - url_changed, - search_params_changed, - previous.server?.uses, - params - )); - - if (invalid) { - // For the next one - parent_invalid = true; - } - - return invalid; - }); - - if (invalid_server_nodes.some(Boolean)) { - try { - server_data = await load_data(url, invalid_server_nodes); - } catch (error) { - const handled_error = await handle_error(error, { url, params, route: { id } }); - - if (preload_tokens.has(preload)) { - return preload_error({ error: handled_error, url, params, route }); - } - - return load_root_error_page({ - status: get_status(error), - error: handled_error, - url, - route - }); - } - - if (server_data.type === 'redirect') { - return server_data; - } - } - } - - const server_data_nodes = server_data?.nodes; - - let parent_changed = false; - - const branch_promises = loaders.map(async (loader, i) => { - if (!loader) return; - - /** @type {import('./types.js').BranchNode | undefined} */ - const previous = current.branch[i]; - - const server_data_node = server_data_nodes?.[i]; - - // re-use data from previous load if it's still valid - const valid = - (!server_data_node || server_data_node.type === 'skip') && - loader[1] === previous?.loader && - !has_changed( - parent_changed, - route_changed, - url_changed, - search_params_changed, - previous.universal?.uses, - params - ); - if (valid) return previous; - - parent_changed = true; - - if (server_data_node?.type === 'error') { - // rethrow and catch below - throw server_data_node; - } - - return load_node({ - loader: loader[1], - url, - params, - route, - parent: async () => { - const data = {}; - for (let j = 0; j < i; j += 1) { - Object.assign(data, (await branch_promises[j])?.data); - } - return data; - }, - server_data_node: create_data_node( - // server_data_node is undefined if it wasn't reloaded from the server; - // and if current loader uses server data, we want to reuse previous data. - server_data_node === undefined && loader[0] ? { type: 'skip' } : (server_data_node ?? null), - loader[0] ? previous?.server : undefined - ) - }); - }); - - // if we don't do this, rejections will be unhandled - for (const p of branch_promises) p.catch(() => {}); - - /** @type {Array} */ - const branch = []; - - for (let i = 0; i < loaders.length; i += 1) { - if (loaders[i]) { - try { - branch.push(await branch_promises[i]); - } catch (err) { - if (err instanceof Redirect) { - return { - type: 'redirect', - location: err.location - }; - } - - if (preload_tokens.has(preload)) { - return preload_error({ - error: await handle_error(err, { params, url, route: { id: route.id } }), - url, - params, - route - }); - } - - let status = get_status(err); - /** @type {App.Error} */ - let error; - - if (server_data_nodes?.includes(/** @type {import('types').ServerErrorNode} */ (err))) { - // this is the server error rethrown above, reconstruct but don't invoke - // the client error handler; it should've already been handled on the server - status = /** @type {import('types').ServerErrorNode} */ (err).status ?? status; - error = /** @type {import('types').ServerErrorNode} */ (err).error; - } else if (err instanceof HttpError) { - error = err.body; - } else { - // Referenced node could have been removed due to redeploy, check - const updated = await stores.updated.check(); - if (updated) { - // Before reloading, try to update the service worker if it exists - await update_service_worker(); - return await native_navigation(url); - } - - error = await handle_error(err, { params, url, route: { id: route.id } }); - } - - const error_load = await load_nearest_error_page(i, branch, errors); - if (error_load) { - return get_navigation_result_from_branch({ - url, - params, - branch: branch.slice(0, error_load.idx).concat(error_load.node), - errors, - status, - error, - route - }); - } else { - return await server_fallback(url, { id: route.id }, error, status); - } - } - } else { - // push an empty slot so we can rewind past gaps to the - // layout that corresponds with an +error.svelte page - branch.push(undefined); - } - } - - return get_navigation_result_from_branch({ - url, - params, - branch, - errors, - status: 200, - error: null, - route, - // Reset `form` on navigation, but not invalidation - form: invalidating ? undefined : null - }); -} - -/** - * @param {number} i Start index to backtrack from - * @param {Array} branch Branch to backtrack - * @param {Array} errors All error pages for this branch - * @returns {Promise<{idx: number; node: import('./types.js').BranchNode} | undefined>} - */ -async function load_nearest_error_page(i, branch, errors) { - while (i--) { - if (errors[i]) { - let j = i; - while (!branch[j]) j -= 1; - try { - return { - idx: j + 1, - node: { - node: await /** @type {import('types').CSRPageNodeLoader } */ (errors[i])(), - loader: /** @type {import('types').CSRPageNodeLoader } */ (errors[i]), - data: {}, - server: null, - universal: null - } - }; - } catch { - continue; - } - } - } -} - -/** - * @param {{ - * status: number; - * error: App.Error; - * url: URL; - * route: { id: string | null } - * }} opts - * @returns {Promise} - */ -async function load_root_error_page({ status, error, url, route }) { - /** @type {Record} */ - const params = {}; // error page does not have params - - /** @type {import('types').ServerDataNode | null} */ - let server_data_node = null; - - if (__SVELTEKIT_HAS_SERVER_LOAD__) { - const default_layout_has_server_load = app.server_loads[0] === 0; - - if (default_layout_has_server_load) { - // TODO post-https://github.com/sveltejs/kit/discussions/6124 we can use - // existing root layout data - try { - const server_data = await load_data(url, [true]); - - if ( - server_data.type !== 'data' || - (server_data.nodes[0] && server_data.nodes[0].type !== 'data') - ) { - throw 0; - } - - server_data_node = server_data.nodes[0] ?? null; - } catch { - // at this point we have no choice but to fall back to the server, if it wouldn't - // bring us right back here, turning this into an endless loop - if (url.origin !== origin || url.pathname !== location.pathname || hydrated) { - await native_navigation(url); - } - } - } - } - - try { - const root_layout = await load_node({ - loader: default_layout_loader, - url, - params, - route, - parent: () => Promise.resolve({}), - server_data_node: create_data_node(server_data_node) - }); - - /** @type {import('./types.js').BranchNode} */ - const root_error = { - node: await default_error_loader(), - loader: default_error_loader, - universal: null, - server: null, - data: null - }; - - return get_navigation_result_from_branch({ - url, - params, - branch: [root_layout, root_error], - status, - error, - errors: [], - route: null - }); - } catch (error) { - if (error instanceof Redirect) { - // @ts-expect-error TODO investigate this - return _goto(new URL(error.location, location.href), {}, 0); - } - - // TODO: this falls back to the server when a server exists, but what about SPA mode? - throw error; - } -} - -/** - * Resolve the relative rerouted URL for a client-side navigation - * @param {URL} url - * @returns {Promise} - */ -async function get_rerouted_url(url) { - const href = url.href; - - if (reroute_cache.has(href)) { - return reroute_cache.get(href); - } - - let rerouted; - - try { - const promise = (async () => { - // reroute could alter the given URL, so we pass a copy - let rerouted = - (await app.hooks.reroute({ - url: new URL(url), - fetch: async (input, init) => { - return resolve_fetch_url(input, init, url).promise; - } - })) ?? url; - - if (typeof rerouted === 'string') { - const tmp = new URL(url); // do not mutate the incoming URL - - if (app.hash) { - tmp.hash = rerouted; - } else { - tmp.pathname = rerouted; - } - - rerouted = tmp; - } - - return rerouted; - })(); - - reroute_cache.set(href, promise); - rerouted = await promise; - } catch (e) { - reroute_cache.delete(href); - if (DEV) { - // in development, print the error... - console.error(e); - - // ...and pause execution, since otherwise we will immediately reload the page - debugger; // eslint-disable-line - } - - // fall back to native navigation - return; - } - - return rerouted; -} - -/** - * Resolve the full info (which route, params, etc.) for a client-side navigation from the URL, - * taking the reroute hook into account. If this isn't a client-side-navigation (or the URL is undefined), - * returns undefined. - * @param {URL | undefined} url - * @param {boolean} invalidating - * @returns {Promise} - */ -export async function get_navigation_intent(url, invalidating) { - if (!url) return; - if (is_external_url(url, base, app.hash)) return; - - if (__SVELTEKIT_CLIENT_ROUTING__) { - const rerouted = await get_rerouted_url(url); - if (!rerouted) return; - - const path = get_url_path(rerouted); - - for (const route of routes) { - const params = route.exec(path); - - if (params) { - return { - id: get_page_key(url), - invalidating, - route, - params: decode_params(params), - url - }; - } - } - } else { - /** @type {{ route?: import('types').CSRRouteServer, params: Record}} */ - const { route, params } = await import( - /* @vite-ignore */ - add_resolution_suffix(url.pathname) - ); - - if (!route) return; - - return { - id: get_page_key(url), - invalidating, - route: parse_server_route(route, app.nodes), - params, - url - }; - } -} - -/** @param {URL} url */ -function get_url_path(url) { - return ( - decode_pathname( - app.hash ? url.hash.replace(/^#/, '').replace(/[?#].+/, '') : url.pathname.slice(base.length) - ) || '/' - ); -} - -/** @param {URL} url */ -function get_page_key(url) { - return (app.hash ? url.hash.replace(/^#/, '') : url.pathname) + url.search; -} - -/** - * @param {{ - * url: URL; - * type: import('@sveltejs/kit').Navigation["type"]; - * intent?: import('./types.js').NavigationIntent; - * delta?: number; - * event?: PopStateEvent | MouseEvent; - * scroll?: { x: number, y: number }; - * }} opts - */ -function _before_navigate({ url, type, intent, delta, event, scroll }) { - let should_block = false; - - const nav = create_navigation(current, intent, url, type, scroll ?? null); - - if (delta !== undefined) { - nav.navigation.delta = delta; - } - - if (event !== undefined) { - // @ts-ignore - nav.navigation.event = event; - } - - const cancellable = { - ...nav.navigation, - cancel: () => { - should_block = true; - nav.reject(new Error('navigation cancelled')); - } - }; - - if (!is_navigating) { - // Don't run the event during redirects - before_navigate_callbacks.forEach((fn) => fn(cancellable)); - } - - return should_block ? null : nav; -} - -/** - * @param {{ - * type: import('@sveltejs/kit').NavigationType; - * url: URL; - * popped?: { - * state: Record; - * scroll: { x: number, y: number }; - * delta: number; - * }; - * keepfocus?: boolean; - * noscroll?: boolean; - * replace_state?: boolean; - * state?: Record; - * redirect_count?: number; - * nav_token?: {}; - * accept?: () => void; - * block?: () => void; - * event?: Event - * }} opts - */ -async function navigate({ - type, - url, - popped, - keepfocus, - noscroll, - replace_state, - state = {}, - redirect_count = 0, - nav_token = {}, - accept = noop, - block = noop, - event -}) { - remote_responses = {}; - - const prev_token = token; - token = nav_token; - - const intent = await get_navigation_intent(url, false); - const nav = - type === 'enter' - ? create_navigation(current, intent, url, type) - : _before_navigate({ - url, - type, - delta: popped?.delta, - intent, - scroll: popped?.scroll, - // @ts-ignore - event - }); - - if (!nav) { - block(); - if (token === nav_token) token = prev_token; - return; - } - - // store this before calling `accept()`, which may change the index - const previous_history_index = current_history_index; - const previous_navigation_index = current_navigation_index; - - accept(); - - is_navigating = true; - - if (started && nav.navigation.type !== 'enter') { - stores.navigating.set((navigating.current = nav.navigation)); - } - - let navigation_result = intent && (await load_route(intent)); - - if (!navigation_result) { - if (is_external_url(url, base, app.hash)) { - if (DEV && app.hash) { - // Special case for hash mode during DEV: If someone accidentally forgets to use a hash for the link, - // they would end up here in an endless loop. Fall back to error page in that case - navigation_result = await server_fallback( - url, - { id: null }, - await handle_error( - new SvelteKitError( - 404, - 'Not Found', - `Not found: ${url.pathname} (did you forget the hash?)` - ), - { - url, - params: {}, - route: { id: null } - } - ), - 404, - replace_state - ); - } else { - return await native_navigation(url, replace_state); - } - } else { - navigation_result = await server_fallback( - url, - { id: null }, - await handle_error(new SvelteKitError(404, 'Not Found', `Not found: ${url.pathname}`), { - url, - params: {}, - route: { id: null } - }), - 404, - replace_state - ); - } - } - - // if this is an internal navigation intent, use the normalized - // URL for the rest of the function - url = intent?.url || url; - - // abort if user navigated during update - if (token !== nav_token) { - nav.reject(new Error('navigation aborted')); - return false; - } - - if (navigation_result.type === 'redirect') { - // whatwg fetch spec https://fetch.spec.whatwg.org/#http-redirect-fetch says to error after 20 redirects - if (redirect_count < 20) { - await navigate({ - type, - url: new URL(navigation_result.location, url), - popped, - keepfocus, - noscroll, - replace_state, - state, - redirect_count: redirect_count + 1, - nav_token - }); - - nav.fulfil(undefined); - return; - } - - navigation_result = await load_root_error_page({ - status: 500, - error: await handle_error(new Error('Redirect loop'), { - url, - params: {}, - route: { id: null } - }), - url, - route: { id: null } - }); - } else if (/** @type {number} */ (navigation_result.props.page.status) >= 400) { - const updated = await stores.updated.check(); - if (updated) { - // Before reloading, try to update the service worker if it exists - await update_service_worker(); - await native_navigation(url, replace_state); - } - } - - // reset invalidation only after a finished navigation. If there are redirects or - // additional invalidations, they should get the same invalidation treatment - reset_invalidation(); - - updating = true; - - update_scroll_positions(previous_history_index); - capture_snapshot(previous_navigation_index); - - // ensure the url pathname matches the page's trailing slash option - if (navigation_result.props.page.url.pathname !== url.pathname) { - url.pathname = navigation_result.props.page.url.pathname; - } - - state = popped ? popped.state : state; - - if (!popped) { - // this is a new navigation, rather than a popstate - const change = replace_state ? 0 : 1; - - const entry = { - [HISTORY_INDEX]: (current_history_index += change), - [NAVIGATION_INDEX]: (current_navigation_index += change), - [STATES_KEY]: state - }; - - const fn = replace_state ? history.replaceState : history.pushState; - fn.call(history, entry, '', url); - - if (!replace_state) { - clear_onward_history(current_history_index, current_navigation_index); - } - } - - // also compare ids to avoid using wrong fork (e.g. a new one could've been added while navigating) - const load_cache_fork = intent && load_cache?.id === intent.id ? load_cache.fork : null; - // reset preload synchronously after the history state has been set to avoid race conditions - load_cache = null; - - navigation_result.props.page.state = state; - - /** - * @type {Promise | undefined} - */ - let commit_promise; - if (started) { - const after_navigate = ( - await Promise.all( - // eslint-disable-next-line @typescript-eslint/await-thenable -- we need to await because they can be asynchronous - Array.from(on_navigate_callbacks, (fn) => - fn(/** @type {import('@sveltejs/kit').OnNavigate} */ (nav.navigation)) - ) - ) - ).filter(/** @returns {value is () => void} */ (value) => typeof value === 'function'); - - if (after_navigate.length > 0) { - function cleanup() { - after_navigate.forEach((fn) => { - after_navigate_callbacks.delete(fn); - }); - } - - after_navigate.push(cleanup); - - after_navigate.forEach((fn) => { - after_navigate_callbacks.add(fn); - }); - } - - // Type-casts are save because we know this resolved a proper SvelteKit route - const target = /** @type {import('@sveltejs/kit').NavigationTarget} */ (nav.navigation.to); - current = { - ...navigation_result.state, - nav: { - params: /** @type {Record} */ (target.params), - route: target.route, - url: target.url - } - }; - - // reset url before updating page store - if (navigation_result.props.page) { - navigation_result.props.page.url = url; - } - - const fork = load_cache_fork && (await load_cache_fork); - - if (fork) { - commit_promise = fork.commit(); - } else { - rendering_error = null; // TODO this can break with forks, rethink for SvelteKit 3 where we can assume Svelte 5 - root.$set(navigation_result.props); - // Check for sync rendering error - if (rendering_error) { - Object.assign(navigation_result.props.page, rendering_error); - } - update(navigation_result.props.page); - - commit_promise = svelte.settled?.(); - } - - has_navigated = true; - } else { - await initialize(navigation_result, target, false); - } - - const { activeElement } = document; - - await commit_promise; - - // TODO 3.0 remote — the double tick is probably necessary because - // of some store shenanigans. `settled()` and `f.commit()` - // should resolve after DOM updates in newer versions - await svelte.tick(); - await svelte.tick(); - - // we reset scroll before dealing with focus, to avoid a flash of unscrolled content - /** @type {Element | null | ''} */ - let deep_linked = null; - - if (autoscroll) { - const scroll = popped ? popped.scroll : noscroll ? scroll_state() : null; - if (scroll) { - scrollTo(scroll.x, scroll.y); - } else if ((deep_linked = url.hash && document.getElementById(get_id(url)))) { - // Here we use `scrollIntoView` on the element instead of `scrollTo` - // because it natively supports the `scroll-margin` and `scroll-behavior` - // CSS properties. - deep_linked.scrollIntoView(); - } else { - scrollTo(0, 0); - } - } - - const changed_focus = - // reset focus only if any manual focus management didn't override it - document.activeElement !== activeElement && - // also refocus when activeElement is body already because the - // focus event might not have been fired on it yet - document.activeElement !== document.body; - - if (!keepfocus && !changed_focus) { - // We don't need to manually restore the scroll position if we're navigating - // to a fragment identifier. It is automatically done for us when we set the - // sequential navigation starting point with `location.replace` - reset_focus(url, !deep_linked); - } - - autoscroll = true; - - if (navigation_result.props.page) { - // Check for async rendering error - if (rendering_error) { - Object.assign(navigation_result.props.page, rendering_error); - } - Object.assign(page, navigation_result.props.page); - } - - is_navigating = false; - - if (type === 'popstate') { - restore_snapshot(current_navigation_index); - } - - nav.fulfil(undefined); - - // Update to.scroll to the actual scroll position after navigation completed - if (nav.navigation.to) { - nav.navigation.to.scroll = scroll_state(); - } - - after_navigate_callbacks.forEach((fn) => - fn(/** @type {import('@sveltejs/kit').AfterNavigate} */ (nav.navigation)) - ); - - stores.navigating.set((navigating.current = null)); - - updating = false; -} - -/** - * Does a full page reload if it wouldn't result in an endless loop in the SPA case - * @param {URL} url - * @param {{ id: string | null }} route - * @param {App.Error} error - * @param {number} status - * @param {boolean} [replace_state] - * @returns {Promise} - */ -async function server_fallback(url, route, error, status, replace_state) { - if (url.origin === origin && url.pathname === location.pathname && !hydrated) { - // We would reload the same page we're currently on, which isn't hydrated, - // which means no SSR, which means we would end up in an endless loop - return await load_root_error_page({ - status, - error, - url, - route - }); - } - - if (DEV && status !== 404) { - console.error( - 'An error occurred while loading the page. This will cause a full page reload. (This message will only appear during development.)' - ); - - debugger; // eslint-disable-line - } - - return await native_navigation(url, replace_state); -} - -if (import.meta.hot) { - import.meta.hot.on('vite:beforeUpdate', () => { - if (current.error) location.reload(); - }); -} - -/** @typedef {(typeof PRELOAD_PRIORITIES)['hover'] | (typeof PRELOAD_PRIORITIES)['tap']} PreloadDataPriority */ - -function setup_preload() { - /** @type {NodeJS.Timeout} */ - let mousemove_timeout; - /** @type {{ element: Element | SVGAElement | undefined; href: string | SVGAnimatedString | undefined }} */ - let current_a = { element: undefined, href: undefined }; - /** @type {PreloadDataPriority} */ - let current_priority; - - container.addEventListener('mousemove', (event) => { - const target = /** @type {Element} */ (event.target); - - clearTimeout(mousemove_timeout); - mousemove_timeout = setTimeout(() => { - void preload(target, PRELOAD_PRIORITIES.hover); - }, 20); - }); - - /** @param {Event} event */ - function tap(event) { - if (event.defaultPrevented) return; - void preload(/** @type {Element} */ (event.composedPath()[0]), PRELOAD_PRIORITIES.tap); - } - - container.addEventListener('mousedown', tap); - container.addEventListener('touchstart', tap, { passive: true }); - - const observer = new IntersectionObserver( - (entries) => { - for (const entry of entries) { - if (entry.isIntersecting) { - void _preload_code(new URL(/** @type {HTMLAnchorElement} */ (entry.target).href)); - observer.unobserve(entry.target); - } - } - }, - { threshold: 0 } - ); - - /** - * @param {Element} element - * @param {PreloadDataPriority} priority - */ - async function preload(element, priority) { - const a = find_anchor(element, container); - - // we don't want to preload data again if the user has already hovered/tapped - const interacted = - a === current_a.element && a?.href === current_a.href && priority >= current_priority; - if (!a || interacted) return; - - const { url, external, download } = get_link_info(a, base, app.hash); - if (external || download) return; - - const options = get_router_options(a); - - // we don't want to preload data for a page we're already on - const same_url = url && get_page_key(current.url) === get_page_key(url); - if (options.reload || same_url) return; - - if (priority <= options.preload_data) { - current_a = { element: a, href: a.href }; - // we don't want to preload data again on tap if we've already preloaded it on hover - current_priority = PRELOAD_PRIORITIES.tap; - - const intent = await get_navigation_intent(url, false); - if (!intent) return; - - if (DEV) { - void _preload_data(intent).then((result) => { - if (result.type === 'loaded' && result.state.error) { - console.warn( - `Preloading data for ${intent.url.pathname} failed with the following error: ${result.state.error.message}\n` + - 'If this error is transient, you can ignore it. Otherwise, consider disabling preloading for this route. ' + - 'This route was preloaded due to a data-sveltekit-preload-data attribute. ' + - 'See https://svelte.dev/docs/kit/link-options for more info' - ); - } - }); - } else { - void _preload_data(intent); - } - } else if (priority <= options.preload_code) { - current_a = { element: a, href: a.href }; - current_priority = priority; - void _preload_code(/** @type {URL} */ (url)); - } - } - - function after_navigate() { - observer.disconnect(); - - for (const a of container.querySelectorAll('a')) { - const { url, external, download } = get_link_info(a, base, app.hash); - if (external || download) continue; - - const options = get_router_options(a); - if (options.reload) continue; - - if (options.preload_code === PRELOAD_PRIORITIES.viewport) { - observer.observe(a); - } - - if (options.preload_code === PRELOAD_PRIORITIES.eager) { - void _preload_code(/** @type {URL} */ (url)); - } - } - } - - after_navigate_callbacks.add(after_navigate); - after_navigate(); -} - -/** - * @param {unknown} error - * @param {import('@sveltejs/kit').NavigationEvent} event - * @returns {import('types').MaybePromise} - */ -function handle_error(error, event) { - if (error instanceof HttpError) { - return error.body; - } - - if (DEV) { - errored = true; - console.warn('The next HMR update will cause the page to reload'); - } - - const status = get_status(error); - const message = get_message(error); - - return ( - app.hooks.handleError({ error, event, status, message }) ?? /** @type {any} */ ({ message }) - ); -} - -/** - * @template {Function} T - * @param {Set} callbacks - * @param {T} callback - */ -function add_navigation_callback(callbacks, callback) { - onMount(() => { - callbacks.add(callback); - - return () => { - callbacks.delete(callback); - }; - }); -} - -/** - * A lifecycle function that runs the supplied `callback` when the current component mounts, and also whenever we navigate to a URL. - * - * `afterNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * @param {(navigation: import('@sveltejs/kit').AfterNavigate) => void} callback - * @returns {void} - */ -export function afterNavigate(callback) { - add_navigation_callback(after_navigate_callbacks, callback); -} - -/** - * A navigation interceptor that triggers before we navigate to a URL, whether by clicking a link, calling `goto(...)`, or using the browser back/forward controls. - * - * Calling `cancel()` will prevent the navigation from completing. If `navigation.type === 'leave'` — meaning the user is navigating away from the app (or closing the tab) — calling `cancel` will trigger the native browser unload confirmation dialog. In this case, the navigation may or may not be cancelled depending on the user's response. - * - * When a navigation isn't to a SvelteKit-owned route (and therefore controlled by SvelteKit's client-side router), `navigation.to.route.id` will be `null`. - * - * If the navigation will (if not cancelled) cause the document to unload — in other words `'leave'` navigations and `'link'` navigations where `navigation.to.route === null` — `navigation.willUnload` is `true`. - * - * `beforeNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * @param {(navigation: import('@sveltejs/kit').BeforeNavigate) => void} callback - * @returns {void} - */ -export function beforeNavigate(callback) { - add_navigation_callback(before_navigate_callbacks, callback); -} - -/** - * A lifecycle function that runs the supplied `callback` immediately before we navigate to a new URL except during full-page navigations. - * - * If you return a `Promise`, SvelteKit will wait for it to resolve before completing the navigation. This allows you to — for example — use `document.startViewTransition`. Avoid promises that are slow to resolve, since navigation will appear stalled to the user. - * - * If a function (or a `Promise` that resolves to a function) is returned from the callback, it will be called once the DOM has updated. - * - * `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * @param {(navigation: import('@sveltejs/kit').OnNavigate) => import('types').MaybePromise<(() => void) | void>} callback - * @returns {void} - */ -export function onNavigate(callback) { - add_navigation_callback(on_navigate_callbacks, callback); -} - -/** - * If called when the page is being updated following a navigation (in `onMount` or `afterNavigate` or an action, for example), this disables SvelteKit's built-in scroll handling. - * This is generally discouraged, since it breaks user expectations. - * @returns {void} - */ -export function disableScrollHandling() { - if (!BROWSER) { - throw new Error('Cannot call disableScrollHandling() on the server'); - } - - if (DEV && started && !updating) { - throw new Error('Can only disable scroll handling during navigation'); - } - - if (updating || !started) { - autoscroll = false; - } -} - -/** - * Allows you to navigate programmatically to a given route, with options such as keeping the current element focused. - * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`. - * - * For external URLs, use `window.location = url` instead of calling `goto(url)`. - * - * @param {string | URL} url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app. - * @param {Object} [opts] Options related to the navigation - * @param {boolean} [opts.replaceState] If `true`, will replace the current `history` entry rather than creating a new one with `pushState` - * @param {boolean} [opts.noScroll] If `true`, the browser will maintain its scroll position rather than scrolling to the top of the page after navigation - * @param {boolean} [opts.keepFocus] If `true`, the currently focused element will retain focus after navigation. Otherwise, focus will be reset to the body - * @param {boolean} [opts.invalidateAll] If `true`, all `load` functions of the page will be rerun. See https://svelte.dev/docs/kit/load#rerunning-load-functions for more info on invalidation. - * @param {Array boolean)>} [opts.invalidate] Causes any load functions to re-run if they depend on one of the urls - * @param {App.PageState} [opts.state] An optional object that will be available as `page.state` - * @returns {Promise} - */ -export function goto(url, opts = {}) { - if (!BROWSER) { - throw new Error('Cannot call goto(...) on the server'); - } - - url = new URL(resolve_url(url)); - - if (url.origin !== origin) { - return Promise.reject( - new Error( - DEV - ? `Cannot use \`goto\` with an external URL. Use \`window.location = "${url}"\` instead` - : 'goto: invalid URL' - ) - ); - } - - return _goto(url, opts, 0); -} - -/** - * Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated. - * - * If the argument is given as a `string` or `URL`, it must resolve to the same URL that was passed to `fetch` or `depends` (including query parameters). - * To create a custom identifier, use a string beginning with `[a-z]+:` (e.g. `custom:state`) — this is a valid URL. - * - * The `function` argument can be used define a custom predicate. It receives the full `URL` and causes `load` to rerun if `true` is returned. - * This can be useful if you want to invalidate based on a pattern instead of a exact match. - * - * ```ts - * // Example: Match '/path' regardless of the query parameters - * import { invalidate } from '$app/navigation'; - * - * invalidate((url) => url.pathname === '/path'); - * ``` - * @param {string | URL | ((url: URL) => boolean)} resource The invalidated URL - * @returns {Promise} - */ -export function invalidate(resource) { - if (!BROWSER) { - throw new Error('Cannot call invalidate(...) on the server'); - } - - push_invalidated(resource); - - return _invalidate(); -} - -/** - * @param {string | URL | ((url: URL) => boolean)} resource The invalidated URL - */ -function push_invalidated(resource) { - if (typeof resource === 'function') { - invalidated.push(resource); - } else { - const { href } = new URL(resource, location.href); - invalidated.push((url) => url.href === href); - } -} - -/** - * Causes all `load` and `query` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated. - * @returns {Promise} - */ -export function invalidateAll() { - if (!BROWSER) { - throw new Error('Cannot call invalidateAll() on the server'); - } - - force_invalidation = true; - return _invalidate(); -} - -/** - * Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run (unless disabled via the option argument). - * Returns a `Promise` that resolves when the page is subsequently updated. - * @param {{ includeLoadFunctions?: boolean }} [options] - * @returns {Promise} - */ -export function refreshAll({ includeLoadFunctions = true } = {}) { - if (!BROWSER) { - throw new Error('Cannot call refreshAll() on the server'); - } - - remote_responses = {}; - - force_invalidation = true; - return _invalidate(includeLoadFunctions, false); -} - -/** - * Programmatically preloads the given page, which means - * 1. ensuring that the code for the page is loaded, and - * 2. calling the page's load function with the appropriate options. - * - * This is the same behaviour that SvelteKit triggers when the user taps or mouses over an `` element with `data-sveltekit-preload-data`. - * If the next navigation is to `href`, the values returned from load will be used, making navigation instantaneous. - * Returns a Promise that resolves with the result of running the new route's `load` functions once the preload is complete. - * - * @param {string} href Page to preload - * @returns {Promise<{ type: 'loaded'; status: number; data: Record } | { type: 'redirect'; location: string }>} - */ -export async function preloadData(href) { - if (!BROWSER) { - throw new Error('Cannot call preloadData(...) on the server'); - } - - const url = resolve_url(href); - const intent = await get_navigation_intent(url, false); - - if (!intent) { - throw new Error(`Attempted to preload a URL that does not belong to this app: ${url}`); - } - - const result = await _preload_data(intent); - if (result.type === 'redirect') { - return { - type: result.type, - location: result.location - }; - } - - const { status, data } = result.props.page ?? page; - return { type: result.type, status, data }; -} - -/** - * Programmatically imports the code for routes that haven't yet been fetched. - * Typically, you might call this to speed up subsequent navigation. - * - * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about/+page.svelte`) or `/blog/*` (to match `src/routes/blog/[slug]/+page.svelte`). - * - * Unlike `preloadData`, this won't call `load` functions. - * Returns a Promise that resolves when the modules have been imported. - * - * @param {string} pathname - * @returns {Promise} - */ -export async function preloadCode(pathname) { - if (!BROWSER) { - throw new Error('Cannot call preloadCode(...) on the server'); - } - - const url = new URL(pathname, current.url); - - if (DEV) { - if (!pathname.startsWith('/')) { - throw new Error( - 'argument passed to preloadCode must be a pathname (i.e. "/about" rather than "http://example.com/about"' - ); - } - - if (!pathname.startsWith(base)) { - throw new Error( - `pathname passed to preloadCode must start with \`paths.base\` (i.e. "${base}${pathname}" rather than "${pathname}")` - ); - } - - if (__SVELTEKIT_CLIENT_ROUTING__) { - const rerouted = await get_rerouted_url(url); - if (!rerouted || !routes.find((route) => route.exec(get_url_path(rerouted)))) { - throw new Error(`'${pathname}' did not match any routes`); - } - } - } - - return _preload_code(url); -} - -/** - * Programmatically create a new history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing). - * - * @param {string | URL} url - * @param {App.PageState} state - * @returns {void} - */ -export function pushState(url, state) { - if (!BROWSER) { - throw new Error('Cannot call pushState(...) on the server'); - } - - if (DEV) { - if (!started) { - throw new Error('Cannot call pushState(...) before router is initialized'); - } - - try { - // use `devalue.stringify` as a convenient way to ensure we exclude values that can't be properly rehydrated, such as custom class instances - devalue.stringify(state); - } catch (error) { - // @ts-expect-error - throw new Error(`Could not serialize state${error.path}`, { cause: error }); - } - } - - update_scroll_positions(current_history_index); - - const opts = { - [HISTORY_INDEX]: (current_history_index += 1), - [NAVIGATION_INDEX]: current_navigation_index, - [PAGE_URL_KEY]: page.url.href, - [STATES_KEY]: state - }; - - history.pushState(opts, '', resolve_url(url)); - has_navigated = true; - - page.state = state; - root.$set({ - // we need to assign a new page object so that subscribers are correctly notified - page: untrack(() => clone_page(page)) - }); - - clear_onward_history(current_history_index, current_navigation_index); -} - -/** - * Programmatically replace the current history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing). - * - * @param {string | URL} url - * @param {App.PageState} state - * @returns {void} - */ -export function replaceState(url, state) { - if (!BROWSER) { - throw new Error('Cannot call replaceState(...) on the server'); - } - - if (DEV) { - if (!started) { - throw new Error('Cannot call replaceState(...) before router is initialized'); - } - - try { - // use `devalue.stringify` as a convenient way to ensure we exclude values that can't be properly rehydrated, such as custom class instances - devalue.stringify(state); - } catch (error) { - // @ts-expect-error - throw new Error(`Could not serialize state${error.path}`, { cause: error }); - } - } - - const opts = { - [HISTORY_INDEX]: current_history_index, - [NAVIGATION_INDEX]: current_navigation_index, - [PAGE_URL_KEY]: page.url.href, - [STATES_KEY]: state - }; - - history.replaceState(opts, '', resolve_url(url)); - - page.state = state; - root.$set({ - page: untrack(() => clone_page(page)) - }); -} - -/** - * This action updates the `form` property of the current page with the given data and updates `page.status`. - * In case of an error, it redirects to the nearest error page. - * @template {Record | undefined} Success - * @template {Record | undefined} Failure - * @param {import('@sveltejs/kit').ActionResult} result - * @returns {Promise} - */ -export async function applyAction(result) { - if (!BROWSER) { - throw new Error('Cannot call applyAction(...) on the server'); - } - - if (result.type === 'error') { - await set_nearest_error_page(result.error, result.status); - } else if (result.type === 'redirect') { - await _goto(result.location, { invalidateAll: true }, 0); - } else { - page.form = result.data; - page.status = result.status; - - /** @type {Record} */ - root.$set({ - // this brings Svelte's view of the world in line with SvelteKit's - // after use:enhance reset the form.... - form: null, - page: clone_page(page) - }); - - // ...so that setting the `form` prop takes effect and isn't ignored - await tick(); - root.$set({ form: result.data }); - - if (result.type === 'success') { - reset_focus(page.url); - } - } -} - -/** - * @param {App.Error} error - * @param {number} status - */ -export async function set_nearest_error_page(error, status = 500) { - const url = new URL(location.href); - - const { branch, route } = current; - if (!route) return; - - const error_load = await load_nearest_error_page(current.branch.length, branch, route.errors); - if (error_load) { - const navigation_result = await get_navigation_result_from_branch({ - url, - params: current.params, - branch: branch.slice(0, error_load.idx).concat(error_load.node), - status, - error, - // do not set errors, we haven't changed the page so the previous ones are still current - route - }); - - current = { ...navigation_result.state, nav: current.nav }; - - root.$set(navigation_result.props); - update(navigation_result.props.page); - - void tick().then(() => reset_focus(current.url)); - } -} - -function _start_router() { - history.scrollRestoration = 'manual'; - - // Adopted from Nuxt.js - // Reset scrollRestoration to auto when leaving page, allowing page reload - // and back-navigation from other pages to use the browser to restore the - // scrolling position. - addEventListener('beforeunload', (e) => { - let should_block = false; - - persist_state(); - - if (!is_navigating) { - const nav = create_navigation(current, undefined, null, 'leave'); - - // If we're navigating, beforeNavigate was already called. If we end up in here during navigation, - // it's due to an external or full-page-reload link, for which we don't want to call the hook again. - /** @type {import('@sveltejs/kit').BeforeNavigate} */ - const navigation = { - ...nav.navigation, - cancel: () => { - should_block = true; - nav.reject(new Error('navigation cancelled')); - } - }; - - before_navigate_callbacks.forEach((fn) => fn(navigation)); - } - - if (should_block) { - e.preventDefault(); - e.returnValue = ''; - } else { - history.scrollRestoration = 'auto'; - } - }); - - addEventListener('visibilitychange', () => { - if (document.visibilityState === 'hidden') { - persist_state(); - } - }); - - // @ts-expect-error this isn't supported everywhere yet - if (!navigator.connection?.saveData) { - setup_preload(); - } - - /** @param {MouseEvent} event */ - container.addEventListener('click', async (event) => { - // Adapted from https://github.com/visionmedia/page.js - // MIT license https://github.com/visionmedia/page.js#license - if (event.button || event.which !== 1) return; - if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return; - if (event.defaultPrevented) return; - - const a = find_anchor(/** @type {Element} */ (event.composedPath()[0]), container); - if (!a) return; - - const { url, external, target, download } = get_link_info(a, base, app.hash); - if (!url) return; - - // bail out before `beforeNavigate` if link opens in a different tab - if (target === '_parent' || target === '_top') { - if (window.parent !== window) return; - } else if (target && target !== '_self') { - return; - } - - const options = get_router_options(a); - const is_svg_a_element = a instanceof SVGAElement; - - // Ignore URL protocols that differ to the current one and are not http(s) (e.g. `mailto:`, `tel:`, `myapp:`, etc.) - // This may be wrong when the protocol is x: and the link goes to y:.. which should be treated as an external - // navigation, but it's not clear how to handle that case and it's not likely to come up in practice. - // MEMO: Without this condition, firefox will open mailer twice. - // See: - // - https://github.com/sveltejs/kit/issues/4045 - // - https://github.com/sveltejs/kit/issues/5725 - // - https://github.com/sveltejs/kit/issues/6496 - if ( - !is_svg_a_element && - url.protocol !== location.protocol && - !(url.protocol === 'https:' || url.protocol === 'http:') - ) - return; - - if (download) return; - - const [nonhash, hash] = (app.hash ? url.hash.replace(/^#/, '') : url.href).split('#'); - const same_pathname = nonhash === strip_hash(location); - - // Ignore the following but fire beforeNavigate - if (external || (options.reload && (!same_pathname || !hash))) { - if (_before_navigate({ url, type: 'link', event })) { - // set `navigating` to `true` to prevent `beforeNavigate` callbacks - // being called when the page unloads - is_navigating = true; - } else { - event.preventDefault(); - } - - return; - } - - // Check if new url only differs by hash and use the browser default behavior in that case - // This will ensure the `hashchange` event is fired - // Removing the hash does a full page navigation in the browser, so make sure a hash is present - if (hash !== undefined && same_pathname) { - // If we are trying to navigate to the same hash, we should only - // attempt to scroll to that element and avoid any history changes. - // Otherwise, this can cause Firefox to incorrectly assign a null - // history state value without any signal that we can detect. - const [, current_hash] = current.url.href.split('#'); - if (current_hash === hash) { - event.preventDefault(); - - // We're already on /# and click on a link that goes to /#, or we're on - // /#top and click on a link that goes to /#top. In those cases just go to - // the top of the page, and avoid a history change. - if (hash === '' || (hash === 'top' && a.ownerDocument.getElementById('top') === null)) { - scrollTo({ top: 0 }); - } else { - const element = a.ownerDocument.getElementById(decodeURIComponent(hash)); - if (element) { - element.scrollIntoView(); - element.focus(); - } - } - - return; - } - // set this flag to distinguish between navigations triggered by - // clicking a hash link and those triggered by popstate - hash_navigating = true; - - update_scroll_positions(current_history_index); - - update_url(url); - - if (!options.replace_state) return; - - // hashchange event shouldn't occur if the router is replacing state. - hash_navigating = false; - } - - event.preventDefault(); - - // allow the browser to repaint before navigating — - // this prevents INP scores being penalised - await new Promise((fulfil) => { - requestAnimationFrame(() => { - setTimeout(fulfil, 0); - }); - - setTimeout(fulfil, 100); // fallback for edge case where rAF doesn't fire because e.g. tab was backgrounded - }); - - await navigate({ - type: 'link', - url, - keepfocus: options.keepfocus, - noscroll: options.noscroll, - replace_state: options.replace_state ?? url.href === location.href, - event - }); - }); - - container.addEventListener('submit', (event) => { - if (event.defaultPrevented) return; - - const form = /** @type {HTMLFormElement} */ ( - HTMLFormElement.prototype.cloneNode.call(event.target) - ); - - const submitter = /** @type {HTMLButtonElement | HTMLInputElement | null} */ (event.submitter); - - const target = submitter?.formTarget || form.target; - - if (target === '_blank') return; - - const method = submitter?.formMethod || form.method; - - if (method !== 'get') return; - - // It is impossible to use form actions with hash router, so we just ignore handling them here - const url = new URL( - (submitter?.hasAttribute('formaction') && submitter?.formAction) || form.action - ); - - if (is_external_url(url, base, false)) return; - - const event_form = /** @type {HTMLFormElement} */ (event.target); - - const options = get_router_options(event_form); - if (options.reload) return; - - event.preventDefault(); - event.stopPropagation(); - - const data = new FormData(event_form, submitter); - - // @ts-expect-error `URLSearchParams(fd)` is kosher, but typescript doesn't know that - url.search = new URLSearchParams(data).toString(); - - void navigate({ - type: 'form', - url, - keepfocus: options.keepfocus, - noscroll: options.noscroll, - replace_state: options.replace_state ?? url.href === location.href, - event - }); - }); - - addEventListener('popstate', async (event) => { - if (resetting_focus) return; - - if (event.state?.[HISTORY_INDEX]) { - const history_index = event.state[HISTORY_INDEX]; - token = {}; - - // if a popstate-driven navigation is cancelled, we need to counteract it - // with history.go, which means we end up back here, hence this check - if (history_index === current_history_index) return; - - const scroll = scroll_positions[history_index]; - const state = event.state[STATES_KEY] ?? {}; - const url = new URL(event.state[PAGE_URL_KEY] ?? location.href); - const navigation_index = event.state[NAVIGATION_INDEX]; - const is_hash_change = current.url ? strip_hash(location) === strip_hash(current.url) : false; - const shallow = - navigation_index === current_navigation_index && (has_navigated || is_hash_change); - - if (shallow) { - // We don't need to navigate, we just need to update scroll and/or state. - // This happens with hash links and `pushState`/`replaceState`. The - // exception is if we haven't navigated yet, since we could have - // got here after a modal navigation then a reload - if (state !== page.state) { - page.state = state; - } - - update_url(url); - - scroll_positions[current_history_index] = scroll_state(); - if (scroll) scrollTo(scroll.x, scroll.y); - - current_history_index = history_index; - return; - } - - const delta = history_index - current_history_index; - - await navigate({ - type: 'popstate', - url, - popped: { - state, - scroll, - delta - }, - accept: () => { - current_history_index = history_index; - current_navigation_index = navigation_index; - }, - block: () => { - history.go(-delta); - }, - nav_token: token, - event - }); - } else { - // since popstate event is also emitted when an anchor referencing the same - // document is clicked, we have to check that the router isn't already handling - // the navigation. otherwise we would be updating the page store twice. - if (!hash_navigating) { - const url = new URL(location.href); - update_url(url); - - // if the user edits the hash via the browser URL bar, trigger a full-page - // reload to align with pathname router behavior - if (app.hash) { - location.reload(); - } - } - } - }); - - addEventListener('hashchange', () => { - // if the hashchange happened as a result of clicking on a link, - // we need to update history, otherwise we have to leave it alone - if (hash_navigating) { - hash_navigating = false; - history.replaceState( - { - ...history.state, - [HISTORY_INDEX]: ++current_history_index, - [NAVIGATION_INDEX]: current_navigation_index - }, - '', - location.href - ); - } - }); - - // fix link[rel=icon], because browsers will occasionally try to load relative - // URLs after a pushState/replaceState, resulting in a 404 — see - // https://github.com/sveltejs/kit/issues/3748#issuecomment-1125980897 - for (const link of document.querySelectorAll('link')) { - if (ICON_REL_ATTRIBUTES.has(link.rel)) { - link.href = link.href; // eslint-disable-line - } - } - - addEventListener('pageshow', (event) => { - // If the user navigates to another site and then uses the back button and - // bfcache hits, we need to set navigating to null, the site doesn't know - // the navigation away from it was successful. - // Info about bfcache here: https://web.dev/bfcache - if (event.persisted) { - stores.navigating.set((navigating.current = null)); - } - }); - - /** - * @param {URL} url - */ - function update_url(url) { - current.url = page.url = url; - stores.page.set(clone_page(page)); - stores.page.notify(); - } -} - -/** - * @param {HTMLElement} target - * @param {import('./types.js').HydrateOptions} opts - */ -async function _hydrate( - target, - { status = 200, error, node_ids, params, route, server_route, data: server_data_nodes, form } -) { - hydrated = true; - - const url = new URL(location.href); - - /** @type {import('types').CSRRoute | undefined} */ - let parsed_route; - - if (__SVELTEKIT_CLIENT_ROUTING__) { - if (!__SVELTEKIT_EMBEDDED__) { - // See https://github.com/sveltejs/kit/pull/4935#issuecomment-1328093358 for one motivation - // of determining the params on the client side. - ({ params = {}, route = { id: null } } = (await get_navigation_intent(url, false)) || {}); - } - - parsed_route = routes.find(({ id }) => id === route.id); - } else { - // undefined in case of 404 - if (server_route) { - parsed_route = route = parse_server_route(server_route, app.nodes); - } else { - route = { id: null }; - params = {}; - } - } - - /** @type {import('./types.js').NavigationFinished | undefined} */ - let result; - let hydrate = true; - - try { - const branch_promises = node_ids.map(async (n, i) => { - const server_data_node = server_data_nodes[i]; - // Type isn't completely accurate, we still need to deserialize uses - if (server_data_node?.uses) { - server_data_node.uses = deserialize_uses(server_data_node.uses); - } - - return load_node({ - loader: app.nodes[n], - url, - params, - route, - parent: async () => { - const data = {}; - for (let j = 0; j < i; j += 1) { - Object.assign(data, (await branch_promises[j]).data); - } - return data; - }, - server_data_node: create_data_node(server_data_node) - }); - }); - - /** @type {Array} */ - const branch = await Promise.all(branch_promises); - - // server-side will have compacted the branch, reinstate empty slots - // so that error boundaries can be lined up correctly - if (parsed_route) { - const layouts = parsed_route.layouts; - for (let i = 0; i < layouts.length; i++) { - if (!layouts[i]) { - branch.splice(i, 0, undefined); - } - } - } - - result = await get_navigation_result_from_branch({ - url, - params, - branch, - status, - error, - errors: parsed_route?.errors, // TODO load earlier? - form, - route: parsed_route ?? null - }); - } catch (error) { - if (error instanceof Redirect) { - // this is a real edge case — `load` would need to return - // a redirect but only in the browser - await native_navigation(new URL(error.location, location.href)); - return; - } - - result = await load_root_error_page({ - status: get_status(error), - error: await handle_error(error, { url, params, route }), - url, - route - }); - - target.textContent = ''; - hydrate = false; - } - - if (result.props.page) { - result.props.page.state = {}; - } - - await initialize(result, target, hydrate); -} - -/** - * @param {URL} url - * @param {boolean[]} invalid - * @returns {Promise} - */ -async function load_data(url, invalid) { - const data_url = new URL(url); - data_url.pathname = add_data_suffix(url.pathname); - if (url.pathname.endsWith('/')) { - data_url.searchParams.append(TRAILING_SLASH_PARAM, '1'); - } - if (DEV && url.searchParams.has(INVALIDATED_PARAM)) { - throw new Error(`Cannot used reserved query parameter "${INVALIDATED_PARAM}"`); - } - data_url.searchParams.append(INVALIDATED_PARAM, invalid.map((i) => (i ? '1' : '0')).join('')); - - // use window.fetch directly to allow using a 3rd party-patched fetch implementation - const fetcher = DEV ? dev_fetch : window.fetch; - const res = await fetcher(data_url.href, {}); - - if (!res.ok) { - // error message is a JSON-stringified string which devalue can't handle at the top level - // turn it into a HttpError to not call handleError on the client again (was already handled on the server) - // if `__data.json` doesn't exist or the server has an internal error, - // avoid parsing the HTML error page as a JSON - /** @type {string | undefined} */ - let message; - if (res.headers.get('content-type')?.includes('application/json')) { - message = await res.json(); - } else if (res.status === 404) { - message = 'Not Found'; - } else if (res.status === 500) { - message = 'Internal Error'; - } - throw new HttpError(res.status, message); - } - - // TODO: fix eslint error / figure out if it actually applies to our situation - // eslint-disable-next-line - return new Promise(async (resolve) => { - /** - * Map of deferred promises that will be resolved by a subsequent chunk of data - * @type {Map} - */ - const deferreds = new Map(); - const reader = /** @type {ReadableStream} */ (res.body).getReader(); - - /** - * @param {any} data - */ - function deserialize(data) { - return devalue.unflatten(data, { - ...app.decoders, - Promise: (id) => { - return new Promise((fulfil, reject) => { - deferreds.set(id, { fulfil, reject }); - }); - } - }); - } - - let text = ''; - - while (true) { - // Format follows ndjson (each line is a JSON object) or regular JSON spec - const { done, value } = await reader.read(); - if (done && !text) break; - - text += !value && text ? '\n' : text_decoder.decode(value, { stream: true }); // no value -> final chunk -> add a new line to trigger the last parse - - while (true) { - const split = text.indexOf('\n'); - if (split === -1) { - break; - } - - const node = JSON.parse(text.slice(0, split)); - text = text.slice(split + 1); - - if (node.type === 'redirect') { - return resolve(node); - } - - if (node.type === 'data') { - // This is the first (and possibly only, if no pending promises) chunk - node.nodes?.forEach((/** @type {any} */ node) => { - if (node?.type === 'data') { - node.uses = deserialize_uses(node.uses); - node.data = deserialize(node.data); - } - }); - - resolve(node); - } else if (node.type === 'chunk') { - // This is a subsequent chunk containing deferred data - const { id, data, error } = node; - const deferred = /** @type {import('types').Deferred} */ (deferreds.get(id)); - deferreds.delete(id); - - if (error) { - deferred.reject(deserialize(error)); - } else { - deferred.fulfil(deserialize(data)); - } - } - } - } - }); - - // TODO edge case handling necessary? stream() read fails? -} - -/** - * @param {any} uses - * @return {import('types').Uses} - */ -function deserialize_uses(uses) { - return { - dependencies: new Set(uses?.dependencies ?? []), - params: new Set(uses?.params ?? []), - parent: !!uses?.parent, - route: !!uses?.route, - url: !!uses?.url, - search_params: new Set(uses?.search_params ?? []) - }; -} - -/** - * This flag is used to avoid client-side navigation when we're only using - * `location.replace()` to set focus. - */ -let resetting_focus = false; - -/** - * @param {URL} url - * @param {boolean} [scroll] - */ -function reset_focus(url, scroll = true) { - const autofocus = document.querySelector('[autofocus]'); - if (autofocus) { - // @ts-ignore - autofocus.focus(); - } else { - // Reset page selection and focus - - // Mimic the browsers' behaviour and set the sequential focus navigation - // starting point to the fragment identifier. - const id = get_id(url); - if (id && document.getElementById(id)) { - const { x, y } = scroll_state(); - - // `element.focus()` doesn't work on Safari and Firefox Ubuntu so we need - // to use this hack with `location.replace()` instead. - setTimeout(() => { - const history_state = history.state; - - resetting_focus = true; - location.replace(new URL(`#${id}`, location.href)); - - // Firefox has a bug that sets the history state to `null` so we need to - // restore it after. See https://bugzilla.mozilla.org/show_bug.cgi?id=1199924 - // This is also needed to restore the original hash if we're using hash routing - history.replaceState(history_state, '', url); - - // If scroll management has already happened earlier, we need to restore - // the scroll position after setting the sequential focus navigation starting point - if (scroll) scrollTo(x, y); - resetting_focus = false; - }); - } else { - // If the ID doesn't exist, we try to mimic browsers' behaviour as closely - // as possible by targeting the first scrollable region. Unfortunately, it's - // not a perfect match — e.g. shift-tabbing won't immediately cycle up from - // the end of the page on Chromium - // See https://html.spec.whatwg.org/multipage/interaction.html#get-the-focusable-area - const root = document.body; - const tabindex = root.getAttribute('tabindex'); - - root.tabIndex = -1; - // @ts-expect-error options.focusVisible is only supported in Firefox - // See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility - root.focus({ preventScroll: true, focusVisible: false }); - - // restore `tabindex` as to prevent `root` from stealing input from elements - if (tabindex !== null) { - root.setAttribute('tabindex', tabindex); - } else { - root.removeAttribute('tabindex'); - } - } - - // capture current selection, so we can compare the state after - // snapshot restoration and afterNavigate callbacks have run - const selection = getSelection(); - - if (selection && selection.type !== 'None') { - /** @type {Range[]} */ - const ranges = []; - - for (let i = 0; i < selection.rangeCount; i += 1) { - ranges.push(selection.getRangeAt(i)); - } - - setTimeout(() => { - if (selection.rangeCount !== ranges.length) return; - - for (let i = 0; i < selection.rangeCount; i += 1) { - const a = ranges[i]; - const b = selection.getRangeAt(i); - - // we need to do a deep comparison rather than just `a !== b` because - // Safari behaves differently to other browsers - if ( - a.commonAncestorContainer !== b.commonAncestorContainer || - a.startContainer !== b.startContainer || - a.endContainer !== b.endContainer || - a.startOffset !== b.startOffset || - a.endOffset !== b.endOffset - ) { - return; - } - } - - // if the selection hasn't changed (as a result of an element being (auto)focused, - // or a programmatic selection, we reset everything as part of the navigation) - // fixes https://github.com/sveltejs/kit/issues/8439 - selection.removeAllRanges(); - }); - } - } -} - -/** - * @template {import('@sveltejs/kit').NavigationType} T - * @param {import('./types.js').NavigationState} current - * @param {import('./types.js').NavigationIntent | undefined} intent - * @param {URL | null} url - * @param {T} type - * @param {{ x: number, y: number } | null} [target_scroll] The scroll position for the target (for popstate navigations) - */ -function create_navigation(current, intent, url, type, target_scroll = null) { - /** @type {(value: any) => void} */ - let fulfil; - - /** @type {(error: any) => void} */ - let reject; - - const complete = new Promise((f, r) => { - fulfil = f; - reject = r; - }); - - // Handle any errors off-chain so that it doesn't show up as an unhandled rejection - complete.catch(() => {}); - - /** @type {(import('@sveltejs/kit').Navigation | import('@sveltejs/kit').AfterNavigate) & { type: T }} */ - const navigation = /** @type {any} */ ({ - from: { - params: current.params, - route: { id: current.route?.id ?? null }, - url: current.url, - scroll: scroll_state() - }, - to: url && { - params: intent?.params ?? null, - route: { id: intent?.route?.id ?? null }, - url, - scroll: target_scroll - }, - willUnload: !intent, - type, - complete - }); - - return { - navigation, - // @ts-expect-error - fulfil, - // @ts-expect-error - reject - }; -} - -/** - * TODO: remove this in 3.0 when the page store is also removed - * - * We need to assign a new page object so that subscribers are correctly notified. - * However, spreading `{ ...page }` returns an empty object so we manually - * assign to each property instead. - * - * @param {import('@sveltejs/kit').Page} page - */ -function clone_page(page) { - return { - data: page.data, - error: page.error, - form: page.form, - params: page.params, - route: page.route, - state: page.state, - status: page.status, - url: page.url - }; -} - -/** - * @param {URL} url - * @returns {URL} - */ -function decode_hash(url) { - const new_url = new URL(url); - // Safari, for some reason, does change # to %23, when entered through the address bar - new_url.hash = decodeURIComponent(url.hash); - return new_url; -} - -/** - * @param {URL} url - * @returns {string} - */ -function get_id(url) { - let id; - - if (app.hash) { - const [, , second] = url.hash.split('#', 3); - id = second ?? ''; - } else { - id = url.hash.slice(1); - } - - return decodeURIComponent(id); -} - -if (DEV) { - // Nasty hack to silence harmless warnings the user can do nothing about - const console_warn = console.warn; - console.warn = function warn(...args) { - if ( - args.length === 1 && - /<(Layout|Page|Error)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test( - args[0] - ) - ) { - return; - } - console_warn(...args); - }; - - if (import.meta.hot) { - import.meta.hot.on('vite:beforeUpdate', () => { - if (errored) { - location.reload(); - } - }); - } -} diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/constants.js b/web/node_modules/@sveltejs/kit/src/runtime/client/constants.js deleted file mode 100644 index 982c25d..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/constants.js +++ /dev/null @@ -1,16 +0,0 @@ -export const SNAPSHOT_KEY = 'sveltekit:snapshot'; -export const SCROLL_KEY = 'sveltekit:scroll'; -export const STATES_KEY = 'sveltekit:states'; -export const PAGE_URL_KEY = 'sveltekit:pageurl'; - -export const HISTORY_INDEX = 'sveltekit:history'; -export const NAVIGATION_INDEX = 'sveltekit:navigation'; - -export const PRELOAD_PRIORITIES = /** @type {const} */ ({ - tap: 1, - hover: 2, - viewport: 3, - eager: 4, - off: -1, - false: -1 -}); diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/entry.js b/web/node_modules/@sveltejs/kit/src/runtime/client/entry.js deleted file mode 100644 index 74b0fb2..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/entry.js +++ /dev/null @@ -1,3 +0,0 @@ -// we expose this as a separate entry point (rather than treating client.js as the entry point) -// so that everything other than `start`/`load_css` can be treeshaken -export { start, load_css } from './client.js'; diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/fetcher.js b/web/node_modules/@sveltejs/kit/src/runtime/client/fetcher.js deleted file mode 100644 index ae0b4dd..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/fetcher.js +++ /dev/null @@ -1,178 +0,0 @@ -import { BROWSER, DEV } from 'esm-env'; -import { hash } from '../../utils/hash.js'; -import { base64_decode } from '../utils.js'; - -let loading = 0; - -/** @type {typeof fetch} */ -const native_fetch = BROWSER ? window.fetch : /** @type {any} */ (() => {}); - -export function lock_fetch() { - loading += 1; -} - -export function unlock_fetch() { - loading -= 1; -} - -if (DEV && BROWSER) { - let can_inspect_stack_trace = false; - - // detect whether async stack traces work - // eslint-disable-next-line @typescript-eslint/require-await - const check_stack_trace = async () => { - const stack = /** @type {string} */ (new Error().stack); - can_inspect_stack_trace = stack.includes('check_stack_trace'); - }; - - void check_stack_trace(); - - /** - * @param {RequestInfo | URL} input - * @param {RequestInit & Record | undefined} init - */ - window.fetch = (input, init) => { - // Check if fetch was called via load_node. the lock method only checks if it was called at the - // same time, but not necessarily if it was called from `load`. - // We use just the filename as the method name sometimes does not appear on the CI. - const url = input instanceof Request ? input.url : input.toString(); - const stack_array = /** @type {string} */ (new Error().stack).split('\n'); - // We need to do a cutoff because Safari and Firefox maintain the stack - // across events and for example traces a `fetch` call triggered from a button - // back to the creation of the event listener and the element creation itself, - // where at some point client.js will show up, leading to false positives. - const cutoff = stack_array.findIndex((a) => a.includes('load@') || a.includes('at load')); - const stack = stack_array.slice(0, cutoff + 2).join('\n'); - - const in_load_heuristic = can_inspect_stack_trace - ? stack.includes('src/runtime/client/client.js') - : loading; - - // This flag is set in initial_fetch and subsequent_fetch - const used_kit_fetch = init?.__sveltekit_fetch__; - - if (in_load_heuristic && !used_kit_fetch) { - console.warn( - `Loading ${url} using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://svelte.dev/docs/kit/load#making-fetch-requests` - ); - } - - const method = input instanceof Request ? input.method : init?.method || 'GET'; - - if (method !== 'GET') { - cache.delete(build_selector(input)); - } - - return native_fetch(input, init); - }; -} else if (BROWSER) { - window.fetch = (input, init) => { - const method = input instanceof Request ? input.method : init?.method || 'GET'; - - if (method !== 'GET') { - cache.delete(build_selector(input)); - } - - return native_fetch(input, init); - }; -} - -const cache = new Map(); - -/** - * Should be called on the initial run of load functions that hydrate the page. - * Saves any requests with cache-control max-age to the cache. - * @param {URL | string} resource - * @param {RequestInit} [opts] - */ -export function initial_fetch(resource, opts) { - const selector = build_selector(resource, opts); - - const script = document.querySelector(selector); - if (script?.textContent) { - script.remove(); // In case multiple script tags match the same selector - let { body, ...init } = JSON.parse(script.textContent); - - const ttl = script.getAttribute('data-ttl'); - if (ttl) cache.set(selector, { body, init, ttl: 1000 * Number(ttl) }); - const b64 = script.getAttribute('data-b64'); - if (b64 !== null) { - // Can't use native_fetch('data:...;base64,${body}') - // csp can block the request - body = base64_decode(body); - } - - return Promise.resolve(new Response(body, init)); - } - - return DEV ? dev_fetch(resource, opts) : window.fetch(resource, opts); -} - -/** - * Tries to get the response from the cache, if max-age allows it, else does a fetch. - * @param {URL | string} resource - * @param {string} resolved - * @param {RequestInit} [opts] - */ -export function subsequent_fetch(resource, resolved, opts) { - if (cache.size > 0) { - const selector = build_selector(resource, opts); - const cached = cache.get(selector); - if (cached) { - // https://developer.mozilla.org/en-US/docs/Web/API/Request/cache#value - if ( - performance.now() < cached.ttl && - ['default', 'force-cache', 'only-if-cached', undefined].includes(opts?.cache) - ) { - return new Response(cached.body, cached.init); - } - - cache.delete(selector); - } - } - - return DEV ? dev_fetch(resolved, opts) : window.fetch(resolved, opts); -} - -/** - * @param {RequestInfo | URL} resource - * @param {RequestInit & Record | undefined} opts - */ -export function dev_fetch(resource, opts) { - const patched_opts = { ...opts }; - // This assigns the __sveltekit_fetch__ flag and makes it non-enumerable - Object.defineProperty(patched_opts, '__sveltekit_fetch__', { - value: true, - writable: true, - configurable: true - }); - return window.fetch(resource, patched_opts); -} - -/** - * Build the cache key for a given request - * @param {URL | RequestInfo} resource - * @param {RequestInit} [opts] - */ -function build_selector(resource, opts) { - const url = JSON.stringify(resource instanceof Request ? resource.url : resource); - - let selector = `script[data-sveltekit-fetched][data-url=${url}]`; - - if (opts?.headers || opts?.body) { - /** @type {import('types').StrictBody[]} */ - const values = []; - - if (opts.headers) { - values.push([...new Headers(opts.headers)].join(',')); - } - - if (opts.body && (typeof opts.body === 'string' || ArrayBuffer.isView(opts.body))) { - values.push(opts.body); - } - - selector += `[data-hash="${hash(...values)}"]`; - } - - return selector; -} diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/parse.js b/web/node_modules/@sveltejs/kit/src/runtime/client/parse.js deleted file mode 100644 index 20445fc..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/parse.js +++ /dev/null @@ -1,77 +0,0 @@ -import { exec, parse_route_id } from '../../utils/routing.js'; - -/** - * @param {import('./types.js').SvelteKitApp} app - * @returns {import('types').CSRRoute[]} - */ -export function parse({ nodes, server_loads, dictionary, matchers }) { - const layouts_with_server_load = new Set(server_loads); - - return Object.entries(dictionary).map(([id, [leaf, layouts, errors]]) => { - const { pattern, params } = parse_route_id(id); - - /** @type {import('types').CSRRoute} */ - const route = { - id, - /** @param {string} path */ - exec: (path) => { - const match = pattern.exec(path); - if (match) return exec(match, params, matchers); - }, - errors: [1, ...(errors || [])].map((n) => nodes[n]), - layouts: [0, ...(layouts || [])].map(create_layout_loader), - leaf: create_leaf_loader(leaf) - }; - - // bit of a hack, but ensures that layout/error node lists are the same - // length, without which the wrong data will be applied if the route - // manifest looks like `[[a, b], [c,], d]` - route.errors.length = route.layouts.length = Math.max( - route.errors.length, - route.layouts.length - ); - - return route; - }); - - /** - * @param {number} id - * @returns {[boolean, import('types').CSRPageNodeLoader]} - */ - function create_leaf_loader(id) { - // whether or not the route uses the server data is - // encoded using the ones' complement, to save space - const uses_server_data = id < 0; - if (uses_server_data) id = ~id; - return [uses_server_data, nodes[id]]; - } - - /** - * @param {number | undefined} id - * @returns {[boolean, import('types').CSRPageNodeLoader] | undefined} - */ - function create_layout_loader(id) { - // whether or not the layout uses the server data is - // encoded in the layouts array, to save space - return id === undefined ? id : [layouts_with_server_load.has(id), nodes[id]]; - } -} - -/** - * @param {import('types').CSRRouteServer} input - * @param {import('types').CSRPageNodeLoader[]} app_nodes Will be modified if a new node is loaded that's not already in the array - * @returns {import('types').CSRRoute} - */ -export function parse_server_route({ nodes, id, leaf, layouts, errors }, app_nodes) { - return { - id, - exec: () => ({}), // dummy function; exec already happened on the server - // By writing to app_nodes only when a loader at that index is not already defined, - // we ensure that loaders have referential equality when they load the same node. - // Code elsewhere in client.js relies on this referential equality to determine - // if a loader is different and should therefore (re-)run. - errors: errors.map((n) => (n ? (app_nodes[n] ||= nodes[n]) : undefined)), - layouts: layouts.map((n) => (n ? [n[0], (app_nodes[n[1]] ||= nodes[n[1]])] : undefined)), - leaf: [leaf[0], (app_nodes[leaf[1]] ||= nodes[leaf[1]])] - }; -} diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/command.svelte.js b/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/command.svelte.js deleted file mode 100644 index 5838f40..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/command.svelte.js +++ /dev/null @@ -1,96 +0,0 @@ -/** @import { RemoteCommand, RemoteQueryOverride } from '@sveltejs/kit' */ -/** @import { RemoteFunctionResponse } from 'types' */ -/** @import { Query } from './query.svelte.js' */ -import { app_dir, base } from '$app/paths/internal/client'; -import * as devalue from 'devalue'; -import { HttpError } from '@sveltejs/kit/internal'; -import { app } from '../client.js'; -import { stringify_remote_arg } from '../../shared.js'; -import { get_remote_request_headers, refresh_queries, release_overrides } from './shared.svelte.js'; - -/** - * Client-version of the `command` function from `$app/server`. - * @param {string} id - * @returns {RemoteCommand} - */ -export function command(id) { - /** @type {number} */ - let pending_count = $state(0); - - // Careful: This function MUST be synchronous (can't use the async keyword) because the return type has to be a promise with an updates() method. - // If we make it async, the return type will be a promise that resolves to a promise with an updates() method, which is not what we want. - /** @type {RemoteCommand} */ - const command_function = (arg) => { - /** @type {Array | RemoteQueryOverride>} */ - let updates = []; - - // Increment pending count when command starts - pending_count++; - - // Noone should call commands during rendering but belts and braces. - // Do this here, after await Svelte' reactivity context is gone. - const headers = { - 'Content-Type': 'application/json', - ...get_remote_request_headers() - }; - - /** @type {Promise & { updates: (...args: any[]) => any }} */ - const promise = (async () => { - try { - // Wait a tick to give room for the `updates` method to be called - await Promise.resolve(); - - const response = await fetch(`${base}/${app_dir}/remote/${id}`, { - method: 'POST', - body: JSON.stringify({ - payload: stringify_remote_arg(arg, app.hooks.transport), - refreshes: updates.map((u) => u._key) - }), - headers - }); - - if (!response.ok) { - release_overrides(updates); - // We only end up here in case of a network error or if the server has an internal error - // (which shouldn't happen because we handle errors on the server and always send a 200 response) - throw new Error('Failed to execute remote function'); - } - - const result = /** @type {RemoteFunctionResponse} */ (await response.json()); - if (result.type === 'redirect') { - release_overrides(updates); - throw new Error( - 'Redirects are not allowed in commands. Return a result instead and use goto on the client' - ); - } else if (result.type === 'error') { - release_overrides(updates); - throw new HttpError(result.status ?? 500, result.error); - } else { - if (result.refreshes) { - refresh_queries(result.refreshes, updates); - } - - return devalue.parse(result.result, app.decoders); - } - } finally { - // Decrement pending count when command completes - pending_count--; - } - })(); - - promise.updates = (/** @type {any} */ ...args) => { - updates = args; - // @ts-expect-error Don't allow updates to be called multiple times - delete promise.updates; - return promise; - }; - - return promise; - }; - - Object.defineProperty(command_function, 'pending', { - get: () => pending_count - }); - - return command_function; -} diff --git a/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/form.svelte.js b/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/form.svelte.js deleted file mode 100644 index 090fd27..0000000 --- a/web/node_modules/@sveltejs/kit/src/runtime/client/remote-functions/form.svelte.js +++ /dev/null @@ -1,650 +0,0 @@ -/** @import { StandardSchemaV1 } from '@standard-schema/spec' */ -/** @import { RemoteFormInput, RemoteForm, RemoteQueryOverride } from '@sveltejs/kit' */ -/** @import { InternalRemoteFormIssue, RemoteFunctionResponse } from 'types' */ -/** @import { Query } from './query.svelte.js' */ -import { app_dir, base } from '$app/paths/internal/client'; -import * as devalue from 'devalue'; -import { DEV } from 'esm-env'; -import { HttpError } from '@sveltejs/kit/internal'; -import { app, remote_responses, _goto, set_nearest_error_page, invalidateAll } from '../client.js'; -import { tick } from 'svelte'; -import { refresh_queries, release_overrides } from './shared.svelte.js'; -import { createAttachmentKey } from 'svelte/attachments'; -import { - convert_formdata, - flatten_issues, - create_field_proxy, - deep_set, - set_nested_value, - throw_on_old_property_access, - build_path_string, - normalize_issue, - serialize_binary_form, - BINARY_FORM_CONTENT_TYPE -} from '../../form-utils.js'; - -/** - * Merge client issues into server issues. Server issues are persisted unless - * a client-issue exists for the same path, in which case the client-issue overrides it. - * @param {FormData} form_data - * @param {InternalRemoteFormIssue[]} current_issues - * @param {InternalRemoteFormIssue[]} client_issues - * @returns {InternalRemoteFormIssue[]} - */ -function merge_with_server_issues(form_data, current_issues, client_issues) { - const merged = [ - ...current_issues.filter( - (issue) => issue.server && !client_issues.some((i) => i.name === issue.name) - ), - ...client_issues - ]; - - const keys = Array.from(form_data.keys()); - - return merged.sort((a, b) => keys.indexOf(a.name) - keys.indexOf(b.name)); -} - -/** - * Client-version of the `form` function from `$app/server`. - * @template {RemoteFormInput} T - * @template U - * @param {string} id - * @returns {RemoteForm} - */ -export function form(id) { - /** @type {Map }>} */ - // eslint-disable-next-line svelte/prefer-svelte-reactivity -- we don't need reactivity for this - const instances = new Map(); - - /** @param {string | number | boolean} [key] */ - function create_instance(key) { - const action_id_without_key = id; - const action_id = id + (key != undefined ? `/${JSON.stringify(key)}` : ''); - const action = '?/remote=' + encodeURIComponent(action_id); - - /** - * @type {Record} - */ - let input = $state({}); - - /** @type {InternalRemoteFormIssue[]} */ - let raw_issues = $state.raw([]); - - const issues = $derived(flatten_issues(raw_issues)); - - /** @type {any} */ - let result = $state.raw(remote_responses[action_id]); - - /** @type {number} */ - let pending_count = $state(0); - - /** @type {StandardSchemaV1 | undefined} */ - let preflight_schema = undefined; - - /** @type {HTMLFormElement | null} */ - let element = null; - - /** @type {Record} */ - let touched = {}; - - let submitted = false; - - /** - * @param {FormData} form_data - * @returns {Record} - */ - function convert(form_data) { - const data = convert_formdata(form_data); - if (key !== undefined && !form_data.has('id')) { - data.id = key; - } - return data; - } - - /** - * @param {HTMLFormElement} form - * @param {FormData} form_data - * @param {Parameters['enhance']>[0]} callback - */ - async function handle_submit(form, form_data, callback) { - const data = convert(form_data); - - submitted = true; - - // Increment pending count immediately so that `pending` reflects - // the in-progress state during async preflight validation - pending_count++; - - const validated = await preflight_schema?.['~standard'].validate(data); - - if (validated?.issues) { - raw_issues = merge_with_server_issues( - form_data, - raw_issues, - validated.issues.map((issue) => normalize_issue(issue, false)) - ); - pending_count--; - return; - } - - // Preflight passed - clear stale client-side preflight issues - if (preflight_schema) { - raw_issues = raw_issues.filter((issue) => issue.server); - } - - // TODO 3.0 remove this warning - if (DEV) { - const error = () => { - throw new Error( - 'Remote form functions no longer get passed a FormData object. The payload is now a POJO. See https://kit.svelte.dev/docs/remote-functions#form for details.' - ); - }; - for (const key of [ - 'append', - 'delete', - 'entries', - 'forEach', - 'get', - 'getAll', - 'has', - 'keys', - 'set', - 'values' - ]) { - if (!(key in data)) { - Object.defineProperty(data, key, { get: error }); - } - } - } - - try { - await callback({ - form, - data, - submit: () => submit(form_data) - }); - } catch (e) { - const error = e instanceof HttpError ? e.body : { message: /** @type {any} */ (e).message }; - const status = e instanceof HttpError ? e.status : 500; - void set_nearest_error_page(error, status); - } - } - - /** - * @param {FormData} data - * @returns {Promise & { updates: (...args: any[]) => any }} - */ - function submit(data) { - // Store a reference to the current instance and increment the usage count for the duration - // of the request. This ensures that the instance is not deleted in case of an optimistic update - // (e.g. when deleting an item in a list) that fails and wants to surface an error to the user afterwards. - // If the instance would be deleted in the meantime, the error property would be assigned to the old, - // no-longer-visible instance, so it would never be shown to the user. - const entry = instances.get(key); - if (entry) { - entry.count++; - } - - /** @type {Array | RemoteQueryOverride>} */ - let updates = []; - - /** @type {Promise & { updates: (...args: any[]) => any }} */ - const promise = (async () => { - try { - await Promise.resolve(); - - const { blob } = serialize_binary_form(convert(data), { - remote_refreshes: updates.map((u) => u._key) - }); - - const response = await fetch(`${base}/${app_dir}/remote/${action_id_without_key}`, { - method: 'POST', - headers: { - 'Content-Type': BINARY_FORM_CONTENT_TYPE, - // Forms cannot be called during rendering, so it's save to use location here - 'x-sveltekit-pathname': location.pathname, - 'x-sveltekit-search': location.search - }, - body: blob - }); - - if (!response.ok) { - // We only end up here in case of a network error or if the server has an internal error - // (which shouldn't happen because we handle errors on the server and always send a 200 response) - throw new Error('Failed to execute remote function'); - } - - const form_result = /** @type { RemoteFunctionResponse} */ (await response.json()); - - // reset issues in case it's a redirect or error (but issues passed in that case) - raw_issues = []; - - if (form_result.type === 'result') { - ({ issues: raw_issues = [], result } = devalue.parse(form_result.result, app.decoders)); - - if (issues.$) { - release_overrides(updates); - } else { - if (form_result.refreshes) { - refresh_queries(form_result.refreshes, updates); - } else { - void invalidateAll(); - } - } - } else if (form_result.type === 'redirect') { - const refreshes = form_result.refreshes ?? ''; - const invalidateAll = !refreshes && updates.length === 0; - if (!invalidateAll) { - refresh_queries(refreshes, updates); - } - // Use internal version to allow redirects to external URLs - void _goto(form_result.location, { invalidateAll }, 0); - } else { - throw new HttpError(form_result.status ?? 500, form_result.error); - } - } catch (e) { - result = undefined; - release_overrides(updates); - throw e; - } finally { - // Decrement pending count when submission completes - pending_count--; - - void tick().then(() => { - if (entry) { - entry.count--; - if (entry.count === 0) { - instances.delete(key); - } - } - }); - } - })(); - - promise.updates = (...args) => { - updates = args; - return promise; - }; - - return promise; - } - - /** @type {RemoteForm} */ - const instance = {}; - - instance.method = 'POST'; - instance.action = action; - - /** @param {Parameters['enhance']>[0]} callback */ - const form_onsubmit = (callback) => { - /** @param {SubmitEvent} event */ - return async (event) => { - const form = /** @type {HTMLFormElement} */ (event.target); - const method = event.submitter?.hasAttribute('formmethod') - ? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formMethod - : clone(form).method; - - if (method !== 'post') return; - - // eslint-disable-next-line svelte/prefer-svelte-reactivity - const action = new URL( - // We can't do submitter.formAction directly because that property is always set - event.submitter?.hasAttribute('formaction') - ? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formAction - : clone(form).action - ); - - if (action.searchParams.get('/remote') !== action_id) { - return; - } - - const target = event.submitter?.hasAttribute('formtarget') - ? /** @type {HTMLButtonElement | HTMLInputElement} */ (event.submitter).formTarget - : clone(form).target; - - if (target === '_blank') { - return; - } - - event.preventDefault(); - - const form_data = new FormData(form, event.submitter); - - if (DEV) { - validate_form_data(form_data, clone(form).enctype); - } - - await handle_submit(form, form_data, callback); - }; - }; - - /** @param {(event: SubmitEvent) => void} onsubmit */ - function create_attachment(onsubmit) { - return (/** @type {HTMLFormElement} */ form) => { - if (element) { - let message = `A form object can only be attached to a single \`
\` element`; - if (DEV && !key) { - const name = id.split('/').pop(); - message += `. To create multiple instances, use \`${name}.for(key)\``; - } - - throw new Error(message); - } - - element = form; - - touched = {}; - - form.addEventListener('submit', onsubmit); - - /** @param {Event} e */ - const handle_input = (e) => { - // strictly speaking it can be an HTMLTextAreaElement or HTMLSelectElement - // but that makes the types unnecessarily awkward - const element = /** @type {HTMLInputElement} */ (e.target); - - let name = element.name; - if (!name) return; - - const is_array = name.endsWith('[]'); - if (is_array) name = name.slice(0, -2); - - const is_file = element.type === 'file'; - - touched[name] = true; - - if (is_array) { - let value; - - if (element.tagName === 'SELECT') { - value = Array.from( - element.querySelectorAll('option:checked'), - (e) => /** @type {HTMLOptionElement} */ (e).value - ); - } else { - const elements = /** @type {HTMLInputElement[]} */ ( - Array.from(form.querySelectorAll(`[name="${name}[]"]`)) - ); - - if (DEV) { - for (const e of elements) { - if ((e.type === 'file') !== is_file) { - throw new Error( - `Cannot mix and match file and non-file inputs under the same name ("${element.name}")` - ); - } - } - } - - value = is_file - ? elements.map((input) => Array.from(input.files ?? [])).flat() - : elements.map((element) => element.value); - if (element.type === 'checkbox') { - value = /** @type {string[]} */ (value.filter((_, i) => elements[i].checked)); - } - } - - set_nested_value(input, name, value); - } else if (is_file) { - if (DEV && element.multiple) { - throw new Error( - `Can only use the \`multiple\` attribute when \`name\` includes a \`[]\` suffix — consider changing "${name}" to "${name}[]"` - ); - } - - const file = /** @type {HTMLInputElement & { files: FileList }} */ (element).files[0]; - - if (file) { - set_nested_value(input, name, file); - } else { - // Remove the property by setting to undefined and clean up - const path_parts = name.split(/\.|\[|\]/).filter(Boolean); - let current = /** @type {any} */ (input); - for (let i = 0; i < path_parts.length - 1; i++) { - if (current[path_parts[i]] == null) return; - current = current[path_parts[i]]; - } - delete current[path_parts[path_parts.length - 1]]; - } - } else { - set_nested_value( - input, - name, - element.type === 'checkbox' && !element.checked ? null : element.value - ); - } - - name = name.replace(/^[nb]:/, ''); - - touched[name] = true; - }; - - form.addEventListener('input', handle_input); - - const handle_reset = async () => { - // need to wait a moment, because the `reset` event occurs before - // the inputs are actually updated (so that it can be cancelled) - await tick(); - - input = convert_formdata(new FormData(form)); - }; - - form.addEventListener('reset', handle_reset); - - return () => { - form.removeEventListener('submit', onsubmit); - form.removeEventListener('input', handle_input); - form.removeEventListener('reset', handle_reset); - element = null; - preflight_schema = undefined; - }; - }; - } - - instance[createAttachmentKey()] = create_attachment( - form_onsubmit(({ submit, form }) => - submit().then(() => { - if (!issues.$) { - form.reset(); - } - }) - ) - ); - - let validate_id = 0; - - // TODO 3.0 remove - if (DEV) { - throw_on_old_property_access(instance); - - Object.defineProperty(instance, 'buttonProps', { - get() { - throw new Error( - '`form.buttonProps` has been removed: Instead of ` - * ``` - */ - depends: (...deps: Array<`${string}:${string}`>) => void; - /** - * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example: - * - * ```js - * /// file: src/routes/+page.server.js - * export async function load({ untrack, url }) { - * // Untrack url.pathname so that path changes don't trigger a rerun - * if (untrack(() => url.pathname === '/')) { - * return { message: 'Welcome!' }; - * } - * } - * ``` - */ - untrack: (fn: () => T) => T; - - /** - * Access to spans for tracing. If tracing is not enabled or the function is being run in the browser, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current `load` function. */ - current: Span; - }; - } - - export interface NavigationEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null - > { - /** - * The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object - */ - params: Params; - /** - * Info about the current route - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * The URL of the current page - */ - url: URL; - } - - /** - * Information about the target of a specific navigation. - */ - export interface NavigationTarget< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null - > { - /** - * Parameters of the target page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - * Is `null` if the target is not part of the SvelteKit app (could not be resolved to a route). - */ - params: Params | null; - /** - * Info about the target route - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId | null; - }; - /** - * The URL that is navigated to - */ - url: URL; - /** - * The scroll position associated with this navigation. - * - * For the `from` target, this is the scroll position at the moment of navigation. - * - * For the `to` target, this represents the scroll position that will be or was restored: - * - In `beforeNavigate` and `onNavigate`, this is only available for `popstate` navigations (back/forward button) - * and will be `null` for other navigation types, since the final scroll position isn't known - * ahead of time. - * - In `afterNavigate`, this is always the scroll position that was applied after the navigation - * completed. - */ - scroll: { x: number; y: number } | null; - } - - /** - * - `enter`: The app has hydrated/started - * - `form`: The user submitted a `` - * - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring - * - `link`: Navigation was triggered by a link click - * - `goto`: Navigation was triggered by a `goto(...)` call or a redirect - * - `popstate`: Navigation was triggered by back/forward navigation - */ - export type NavigationType = 'enter' | 'form' | 'leave' | 'link' | 'goto' | 'popstate'; - - export interface NavigationBase { - /** - * Where navigation was triggered from - */ - from: NavigationTarget | null; - /** - * Where navigation is going to/has gone to - */ - to: NavigationTarget | null; - /** - * Whether or not the navigation will result in the page being unloaded (i.e. not a client-side navigation). - */ - willUnload: boolean; - /** - * A promise that resolves once the navigation is complete, and rejects if the navigation - * fails or is aborted. In the case of a `willUnload` navigation, the promise will never resolve - */ - complete: Promise; - } - - export interface NavigationEnter extends NavigationBase { - /** - * The type of navigation: - * - `enter`: The app has hydrated/started - */ - type: 'enter'; - - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - - /** - * Dispatched `Event` object when navigation occurred by `popstate` or `link`. - */ - event?: undefined; - } - - export type NavigationExternal = NavigationGoto | NavigationLeave; - - export interface NavigationGoto extends NavigationBase { - /** - * The type of navigation: - * - `goto`: Navigation was triggered by a `goto(...)` call or a redirect - */ - type: 'goto'; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - } - - export interface NavigationLeave extends NavigationBase { - /** - * The type of navigation: - * - `leave`: The app is being left either because the tab is being closed or a navigation to a different document is occurring - */ - type: 'leave'; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - } - - export interface NavigationFormSubmit extends NavigationBase { - /** - * The type of navigation: - * - `form`: The user submitted a `` - */ - type: 'form'; - - /** - * The `SubmitEvent` that caused the navigation - */ - event: SubmitEvent; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - } - - export interface NavigationPopState extends NavigationBase { - /** - * The type of navigation: - * - `popstate`: Navigation was triggered by back/forward navigation - */ - type: 'popstate'; - - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta: number; - - /** - * The `PopStateEvent` that caused the navigation - */ - event: PopStateEvent; - } - - export interface NavigationLink extends NavigationBase { - /** - * The type of navigation: - * - `link`: Navigation was triggered by a link click - */ - type: 'link'; - - /** - * The `PointerEvent` that caused the navigation - */ - event: PointerEvent; - - // TODO 3.0 remove this property, so that it only exists when type is 'popstate' - // (would possibly be a breaking change to do it prior to that) - /** - * In case of a history back/forward navigation, the number of steps to go back/forward - */ - delta?: undefined; - } - - export type Navigation = - | NavigationExternal - | NavigationFormSubmit - | NavigationPopState - | NavigationLink; - - /** - * The argument passed to [`beforeNavigate`](https://svelte.dev/docs/kit/$app-navigation#beforeNavigate) callbacks. - */ - export type BeforeNavigate = Navigation & { - /** - * Call this to prevent the navigation from starting. - */ - cancel: () => void; - }; - - /** - * The argument passed to [`onNavigate`](https://svelte.dev/docs/kit/$app-navigation#onNavigate) callbacks. - */ - export type OnNavigate = Navigation & { - type: Exclude; - /** - * Since `onNavigate` callbacks are called immediately before a client-side navigation, they will never be called with a navigation that unloads the page. - */ - willUnload: false; - }; - - /** - * The argument passed to [`afterNavigate`](https://svelte.dev/docs/kit/$app-navigation#afterNavigate) callbacks. - */ - export type AfterNavigate = (Navigation | NavigationEnter) & { - type: Exclude; - /** - * Since `afterNavigate` callbacks are called after a navigation completes, they will never be called with a navigation that unloads the page. - */ - willUnload: false; - }; - - /** - * The shape of the [`page`](https://svelte.dev/docs/kit/$app-state#page) reactive object and the [`$page`](https://svelte.dev/docs/kit/$app-stores) store. - */ - export interface Page< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null - > { - /** - * The URL of the current page. - */ - url: URL & { pathname: ResolvedPathname }; - /** - * The parameters of the current page - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - */ - params: Params; - /** - * Info about the current route. - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * HTTP status code of the current page. - */ - status: number; - /** - * The error object of the current page, if any. Filled from the `handleError` hooks. - */ - error: App.Error | null; - /** - * The merged result of all data from all `load` functions on the current page. You can type a common denominator through `App.PageData`. - */ - data: App.PageData & Record; - /** - * The page state, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`. - */ - state: App.PageState; - /** - * Filled only after a form submission. See [form actions](https://svelte.dev/docs/kit/form-actions) for more info. - */ - form: any; - } - - /** - * The shape of a param matcher. See [matching](https://svelte.dev/docs/kit/advanced-routing#Matching) for more info. - */ - export type ParamMatcher = (param: string) => boolean; - - export interface RequestEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null - > { - /** - * Get or set cookies related to the current request - */ - cookies: Cookies; - /** - * `fetch` is equivalent to the [native `fetch` web API](https://developer.mozilla.org/en-US/docs/Web/API/fetch), with a few additional features: - * - * - It can be used to make credentialed requests on the server, as it inherits the `cookie` and `authorization` headers for the page request. - * - It can make relative requests on the server (ordinarily, `fetch` requires a URL with an origin when used in a server context). - * - Internal requests (e.g. for `+server.js` routes) go directly to the handler function when running on the server, without the overhead of an HTTP call. - * - During server-side rendering, the response will be captured and inlined into the rendered HTML by hooking into the `text` and `json` methods of the `Response` object. Note that headers will _not_ be serialized, unless explicitly included via [`filterSerializedResponseHeaders`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle) - * - During hydration, the response will be read from the HTML, guaranteeing consistency and preventing an additional network request. - * - * You can learn more about making credentialed requests with cookies [here](https://svelte.dev/docs/kit/load#Cookies). - */ - fetch: typeof fetch; - /** - * The client's IP address, set by the adapter. - */ - getClientAddress: () => string; - /** - * Contains custom data that was added to the request within the [`server handle hook`](https://svelte.dev/docs/kit/hooks#Server-hooks-handle). - */ - locals: App.Locals; - /** - * The parameters of the current route - e.g. for a route like `/blog/[slug]`, a `{ slug: string }` object. - */ - params: Params; - /** - * Additional data made available through the adapter. - */ - platform: Readonly | undefined; - /** - * The original request object. - */ - request: Request; - /** - * Info about the current route. - */ - route: { - /** - * The ID of the current route - e.g. for `src/routes/blog/[slug]`, it would be `/blog/[slug]`. It is `null` when no route is matched. - */ - id: RouteId; - }; - /** - * If you need to set headers for the response, you can do so using the this method. This is useful if you want the page to be cached, for example: - * - * ```js - * /// file: src/routes/blog/+page.js - * export async function load({ fetch, setHeaders }) { - * const url = `https://cms.example.com/articles.json`; - * const response = await fetch(url); - * - * setHeaders({ - * age: response.headers.get('age'), - * 'cache-control': response.headers.get('cache-control') - * }); - * - * return response.json(); - * } - * ``` - * - * Setting the same header multiple times (even in separate `load` functions) is an error — you can only set a given header once. - * - * You cannot add a `set-cookie` header with `setHeaders` — use the [`cookies`](https://svelte.dev/docs/kit/@sveltejs-kit#Cookies) API instead. - */ - setHeaders: (headers: Record) => void; - /** - * The requested URL. - */ - url: URL; - /** - * `true` if the request comes from the client asking for `+page/layout.server.js` data. The `url` property will be stripped of the internal information - * related to the data request in this case. Use this property instead if the distinction is important to you. - */ - isDataRequest: boolean; - /** - * `true` for `+server.js` calls coming from SvelteKit without the overhead of actually making an HTTP request. This happens when you make same-origin `fetch` requests on the server. - */ - isSubRequest: boolean; - - /** - * Access to spans for tracing. If tracing is not enabled, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current `handle` hook, `load` function, or form action. */ - current: Span; - }; - - /** - * `true` if the request comes from the client via a remote function. The `url` property will be stripped of the internal information - * related to the data request in this case. Use this property instead if the distinction is important to you. - */ - isRemoteRequest: boolean; - } - - /** - * A `(event: RequestEvent) => Response` function exported from a `+server.js` file that corresponds to an HTTP verb (`GET`, `PUT`, `PATCH`, etc) and handles requests with that method. - * - * It receives `Params` as the first generic argument, which you can skip by using [generated types](https://svelte.dev/docs/kit/types#Generated-types) instead. - */ - export type RequestHandler< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - RouteId extends AppRouteId | null = AppRouteId | null - > = (event: RequestEvent) => MaybePromise; - - export interface ResolveOptions { - /** - * Applies custom transforms to HTML. If `done` is true, it's the final chunk. Chunks are not guaranteed to be well-formed HTML - * (they could include an element's opening tag but not its closing tag, for example) - * but they will always be split at sensible boundaries such as `%sveltekit.head%` or layout/page components. - * @param input the html chunk and the info if this is the last chunk - */ - transformPageChunk?: (input: { html: string; done: boolean }) => MaybePromise; - /** - * Determines which headers should be included in serialized responses when a `load` function loads a resource with `fetch`. - * By default, none will be included. - * @param name header name - * @param value header value - */ - filterSerializedResponseHeaders?: (name: string, value: string) => boolean; - /** - * Determines what should be added to the `` tag to preload it. - * By default, `js` and `css` files will be preloaded. - * @param input the type of the file and its path - */ - preload?: (input: { type: 'font' | 'css' | 'js' | 'asset'; path: string }) => boolean; - } - - export interface RouteDefinition { - id: string; - api: { - methods: Array; - }; - page: { - methods: Array>; - }; - pattern: RegExp; - prerender: PrerenderOption; - segments: RouteSegment[]; - methods: Array; - config: Config; - } - - export class Server { - constructor(manifest: SSRManifest); - init(options: ServerInitOptions): Promise; - respond(request: Request, options: RequestOptions): Promise; - } - - export interface ServerInitOptions { - /** A map of environment variables. */ - env: Record; - /** A function that turns an asset filename into a `ReadableStream`. Required for the `read` export from `$app/server` to work. */ - read?: (file: string) => MaybePromise; - } - - export interface SSRManifest { - appDir: string; - appPath: string; - /** Static files from `kit.config.files.assets` and the service worker (if any). */ - assets: Set; - mimeTypes: Record; - - /** private fields */ - _: { - client: NonNullable; - nodes: SSRNodeLoader[]; - /** hashed filename -> import to that file */ - remotes: Record Promise>; - routes: SSRRoute[]; - prerendered_routes: Set; - matchers: () => Promise>; - /** A `[file]: size` map of all assets imported by server code. */ - server_assets: Record; - }; - } - - /** - * The generic form of `PageServerLoad` and `LayoutServerLoad`. You should import those from `./$types` (see [generated types](https://svelte.dev/docs/kit/types#Generated-types)) - * rather than using `ServerLoad` directly. - */ - export type ServerLoad< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - ParentData extends Record = Record, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null - > = (event: ServerLoadEvent) => MaybePromise; - - export interface ServerLoadEvent< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - ParentData extends Record = Record, - RouteId extends AppRouteId | null = AppRouteId | null - > extends RequestEvent { - /** - * `await parent()` returns data from parent `+layout.server.js` `load` functions. - * - * Be careful not to introduce accidental waterfalls when using `await parent()`. If for example you only want to merge parent data into the returned output, call it _after_ fetching your other data. - */ - parent: () => Promise; - /** - * This function declares that the `load` function has a _dependency_ on one or more URLs or custom identifiers, which can subsequently be used with [`invalidate()`](https://svelte.dev/docs/kit/$app-navigation#invalidate) to cause `load` to rerun. - * - * Most of the time you won't need this, as `fetch` calls `depends` on your behalf — it's only necessary if you're using a custom API client that bypasses `fetch`. - * - * URLs can be absolute or relative to the page being loaded, and must be [encoded](https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding). - * - * Custom identifiers have to be prefixed with one or more lowercase letters followed by a colon to conform to the [URI specification](https://www.rfc-editor.org/rfc/rfc3986.html). - * - * The following example shows how to use `depends` to register a dependency on a custom identifier, which is `invalidate`d after a button click, making the `load` function rerun. - * - * ```js - * /// file: src/routes/+page.js - * let count = 0; - * export async function load({ depends }) { - * depends('increase:count'); - * - * return { count: count++ }; - * } - * ``` - * - * ```html - * /// file: src/routes/+page.svelte - * - * - *

{data.count}

- * - * ``` - */ - depends: (...deps: string[]) => void; - /** - * Use this function to opt out of dependency tracking for everything that is synchronously called within the callback. Example: - * - * ```js - * /// file: src/routes/+page.js - * export async function load({ untrack, url }) { - * // Untrack url.pathname so that path changes don't trigger a rerun - * if (untrack(() => url.pathname === '/')) { - * return { message: 'Welcome!' }; - * } - * } - * ``` - */ - untrack: (fn: () => T) => T; - - /** - * Access to spans for tracing. If tracing is not enabled, these spans will do nothing. - * @since 2.31.0 - */ - tracing: { - /** Whether tracing is enabled. */ - enabled: boolean; - /** The root span for the request. This span is named `sveltekit.handle.root`. */ - root: Span; - /** The span associated with the current server `load` function. */ - current: Span; - }; - } - - /** - * Shape of a form action method that is part of `export const actions = {...}` in `+page.server.js`. - * See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. - */ - export type Action< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null - > = (event: RequestEvent) => MaybePromise; - - /** - * Shape of the `export const actions = {...}` object in `+page.server.js`. - * See [form actions](https://svelte.dev/docs/kit/form-actions) for more information. - */ - export type Actions< - Params extends AppLayoutParams<'/'> = AppLayoutParams<'/'>, - OutputData extends Record | void = Record | void, - RouteId extends AppRouteId | null = AppRouteId | null - > = Record>; - - /** - * When calling a form action via fetch, the response will be one of these shapes. - * ```svelte - * { - * return ({ result }) => { - * // result is of type ActionResult - * }; - * }} - * ``` - */ - export type ActionResult< - Success extends Record | undefined = Record, - Failure extends Record | undefined = Record - > = - | { type: 'success'; status: number; data?: Success } - | { type: 'failure'; status: number; data?: Failure } - | { type: 'redirect'; status: number; location: string } - | { type: 'error'; status?: number; error: any }; - - /** - * The object returned by the [`error`](https://svelte.dev/docs/kit/@sveltejs-kit#error) function. - */ - export interface HttpError { - /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses), in the range 400-599. */ - status: number; - /** The content of the error. */ - body: App.Error; - } - - /** - * The object returned by the [`redirect`](https://svelte.dev/docs/kit/@sveltejs-kit#redirect) function. - */ - export interface Redirect { - /** The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages), in the range 300-308. */ - status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308; - /** The location to redirect to. */ - location: string; - } - - export type SubmitFunction< - Success extends Record | undefined = Record, - Failure extends Record | undefined = Record - > = (input: { - action: URL; - formData: FormData; - formElement: HTMLFormElement; - controller: AbortController; - submitter: HTMLElement | null; - cancel: () => void; - }) => MaybePromise< - | void - | ((opts: { - formData: FormData; - formElement: HTMLFormElement; - action: URL; - result: ActionResult; - /** - * Call this to get the default behavior of a form submission response. - * @param options Set `reset: false` if you don't want the `` values to be reset after a successful submission. - * @param invalidateAll Set `invalidateAll: false` if you don't want the action to call `invalidateAll` after submission. - */ - update: (options?: { reset?: boolean; invalidateAll?: boolean }) => Promise; - }) => MaybePromise) - >; - - /** - * The type of `export const snapshot` exported from a page or layout component. - */ - export interface Snapshot { - capture: () => T; - restore: (snapshot: T) => void; - } - - // If T is unknown or has an index signature, the types below will recurse indefinitely and create giant unions that TS can't handle - type WillRecurseIndefinitely = unknown extends T ? true : string extends keyof T ? true : false; - - // Input type mappings for form fields - type InputTypeMap = { - text: string; - email: string; - password: string; - url: string; - tel: string; - search: string; - number: number; - range: number; - date: string; - 'datetime-local': string; - time: string; - month: string; - week: string; - color: string; - checkbox: boolean | string[]; - radio: string; - file: File; - hidden: string; - submit: string; - button: string; - reset: string; - image: string; - select: string; - 'select multiple': string[]; - 'file multiple': File[]; - }; - - // Valid input types for a given value type - export type RemoteFormFieldType = { - [K in keyof InputTypeMap]: T extends InputTypeMap[K] ? K : never; - }[keyof InputTypeMap]; - - // Input element properties based on type - type InputElementProps = T extends 'checkbox' | 'radio' - ? { - name: string; - type: T; - value?: string; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get checked(): boolean; - set checked(value: boolean); - } - : T extends 'file' - ? { - name: string; - type: 'file'; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get files(): FileList | null; - set files(v: FileList | null); - } - : T extends 'select' | 'select multiple' - ? { - name: string; - multiple: T extends 'select' ? false : true; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - } - : T extends 'text' - ? { - name: string; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - } - : { - name: string; - type: T; - 'aria-invalid': boolean | 'false' | 'true' | undefined; - get value(): string | number; - set value(v: string | number); - }; - - type RemoteFormFieldMethods = { - /** The values that will be submitted */ - value(): DeepPartial; - /** Set the values that will be submitted */ - set(input: DeepPartial): DeepPartial; - /** Validation issues, if any */ - issues(): RemoteFormIssue[] | undefined; - }; - - export type RemoteFormFieldValue = string | string[] | number | boolean | File | File[]; - - type AsArgs = Type extends 'checkbox' - ? Value extends string[] - ? [type: Type, value: Value[number] | (string & {})] - : [type: Type] - : Type extends 'radio' | 'submit' | 'hidden' - ? [type: Type, value: Value | (string & {})] - : [type: Type]; - - /** - * Form field accessor type that provides name(), value(), and issues() methods - */ - export type RemoteFormField = RemoteFormFieldMethods & { - /** - * Returns an object that can be spread onto an input element with the correct type attribute, - * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. - * @example - * ```svelte - * - * - * - * ``` - */ - as>(...args: AsArgs): InputElementProps; - }; - - type RemoteFormFieldContainer = RemoteFormFieldMethods & { - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; - }; - - type UnknownField = RemoteFormFieldMethods & { - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; - /** - * Returns an object that can be spread onto an input element with the correct type attribute, - * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters. - * @example - * ```svelte - * - * - * - * ``` - */ - as>(...args: AsArgs): InputElementProps; - } & { - [key: string | number]: UnknownField; - }; - - type RemoteFormFieldsRoot = - IsAny extends true - ? RecursiveFormFields - : Input extends void - ? { - /** Validation issues, if any */ - issues(): RemoteFormIssue[] | undefined; - /** Validation issues belonging to this or any of the fields that belong to it, if any */ - allIssues(): RemoteFormIssue[] | undefined; - } - : RemoteFormFields; - - /** - * Recursive type to build form fields structure with proxy access - */ - export type RemoteFormFields = - WillRecurseIndefinitely extends true - ? RecursiveFormFields - : NonNullable extends string | number | boolean | File - ? RemoteFormField> - : T extends string[] | File[] - ? RemoteFormField & { [K in number]: RemoteFormField } - : T extends Array - ? RemoteFormFieldContainer & { - [K in number]: RemoteFormFields; - } - : RemoteFormFieldContainer & { - [K in keyof T]-?: RemoteFormFields; - }; - - // By breaking this out into its own type, we avoid the TS recursion depth limit - type RecursiveFormFields = RemoteFormFieldContainer & { - [key: string | number]: UnknownField; - }; - - type MaybeArray = T | T[]; - - export interface RemoteFormInput { - [key: string]: MaybeArray; - } - - export interface RemoteFormIssue { - message: string; - path: Array; - } - - // If the schema specifies `id` as a string or number, ensure that `for(...)` - // only accepts that type. Otherwise, accept `string | number` - type ExtractId = Input extends { id: infer Id } - ? Id extends string | number - ? Id - : string | number - : string | number; - - /** - * A function and proxy object used to imperatively create validation errors in form handlers. - * - * Access properties to create field-specific issues: `issue.fieldName('message')`. - * The type structure mirrors the input data structure for type-safe field access. - * Call `invalid(issue.foo(...), issue.nested.bar(...))` to throw a validation error. - */ - export type InvalidField = - WillRecurseIndefinitely extends true - ? Record - : NonNullable extends string | number | boolean | File - ? (message: string) => StandardSchemaV1.Issue - : NonNullable extends Array - ? { - [K in number]: InvalidField; - } & ((message: string) => StandardSchemaV1.Issue) - : NonNullable extends RemoteFormInput - ? { - [K in keyof T]-?: InvalidField; - } & ((message: string) => StandardSchemaV1.Issue) - : Record; - - /** - * A validation error thrown by `invalid`. - */ - export interface ValidationError { - /** The validation issues */ - issues: StandardSchemaV1.Issue[]; - } - - /** - * The return value of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation. - */ - export type RemoteForm = { - /** Attachment that sets up an event handler that intercepts the form submission on the client to prevent a full page reload */ - [attachment: symbol]: (node: HTMLFormElement) => void; - method: 'POST'; - /** The URL to send the form to. */ - action: string; - /** Use the `enhance` method to influence what happens when the form is submitted. */ - enhance( - callback: (opts: { - form: HTMLFormElement; - data: Input; - submit: () => Promise & { - updates: (...queries: Array | RemoteQueryOverride>) => Promise; - }; - }) => void | Promise - ): { - method: 'POST'; - action: string; - [attachment: symbol]: (node: HTMLFormElement) => void; - }; - /** - * Create an instance of the form for the given `id`. - * The `id` is stringified and used for deduplication to potentially reuse existing instances. - * Useful when you have multiple forms that use the same remote form action, for example in a loop. - * ```svelte - * {#each todos as todo} - * {@const todoForm = updateTodo.for(todo.id)} - * - * {#if todoForm.result?.invalid}

Invalid data

{/if} - * ... - * - * {/each} - * ``` - */ - for(id: ExtractId): Omit, 'for'>; - /** Preflight checks */ - preflight(schema: StandardSchemaV1): RemoteForm; - /** Validate the form contents programmatically */ - validate(options?: { - /** Set this to `true` to also show validation issues of fields that haven't been touched yet. */ - includeUntouched?: boolean; - /** Set this to `true` to only run the `preflight` validation. */ - preflightOnly?: boolean; - }): Promise; - /** The result of the form submission */ - get result(): Output | undefined; - /** The number of pending submissions */ - get pending(): number; - /** Access form fields using object notation */ - fields: RemoteFormFieldsRoot; - }; - - /** - * The return value of a remote `command` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation. - */ - export type RemoteCommand = { - (arg: undefined extends Input ? Input | void : Input): Promise> & { - updates(...queries: Array | RemoteQueryOverride>): Promise>; - }; - /** The number of pending command executions */ - get pending(): number; - }; - - export type RemoteResource = Promise> & { - /** The error in case the query fails. Most often this is a [`HttpError`](https://svelte.dev/docs/kit/@sveltejs-kit#HttpError) but it isn't guaranteed to be. */ - get error(): any; - /** `true` before the first result is available and during refreshes */ - get loading(): boolean; - } & ( - | { - /** The current value of the query. Undefined until `ready` is `true` */ - get current(): undefined; - ready: false; - } - | { - /** The current value of the query. Undefined until `ready` is `true` */ - get current(): Awaited; - ready: true; - } - ); - - export type RemoteQuery = RemoteResource & { - /** - * On the client, this function will update the value of the query without re-fetching it. - * - * On the server, this can be called in the context of a `command` or `form` and the specified data will accompany the action response back to the client. - * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip. - */ - set(value: T): void; - /** - * On the client, this function will re-fetch the query from the server. - * - * On the server, this can be called in the context of a `command` or `form` and the refreshed data will accompany the action response back to the client. - * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip. - */ - refresh(): Promise; - /** - * Temporarily override the value of a query. This is used with the `updates` method of a [command](https://svelte.dev/docs/kit/remote-functions#command-Updating-queries) or [enhanced form submission](https://svelte.dev/docs/kit/remote-functions#form-enhance) to provide optimistic updates. - * - * ```svelte - * - * - *
{ - * await submit().updates( - * todos.withOverride((todos) => [...todos, { text: data.get('text') }]) - * ); - * })}> - * - * - *
- * ``` - */ - withOverride(update: (current: Awaited) => Awaited): RemoteQueryOverride; - }; - - export interface RemoteQueryOverride { - _key: string; - release(): void; - } - - /** - * The return value of a remote `prerender` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation. - */ - export type RemotePrerenderFunction = ( - arg: undefined extends Input ? Input | void : Input - ) => RemoteResource; - - /** - * The return value of a remote `query` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation. - */ - export type RemoteQueryFunction = ( - arg: undefined extends Input ? Input | void : Input - ) => RemoteQuery; - interface AdapterEntry { - /** - * A string that uniquely identifies an HTTP service (e.g. serverless function) and is used for deduplication. - * For example, `/foo/a-[b]` and `/foo/[c]` are different routes, but would both - * be represented in a Netlify _redirects file as `/foo/:param`, so they share an ID - */ - id: string; - - /** - * A function that compares the candidate route with the current route to determine - * if it should be grouped with the current route. - * - * Use cases: - * - Fallback pages: `/foo/[c]` is a fallback for `/foo/a-[b]`, and `/[...catchall]` is a fallback for all routes - * - Grouping routes that share a common `config`: `/foo` should be deployed to the edge, `/bar` and `/baz` should be deployed to a serverless function - */ - filter(route: RouteDefinition): boolean; - - /** - * A function that is invoked once the entry has been created. This is where you - * should write the function to the filesystem and generate redirect manifests. - */ - complete(entry: { generateManifest(opts: { relativePath: string }): string }): MaybePromise; - } - - // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts - // - // MIT License - // - // Copyright (c) 2021-present, Joshua Hemphill - // Copyright (c) 2021, Tecnico Corporation - // - // Permission is hereby granted, free of charge, to any person obtaining a copy - // of this software and associated documentation files (the "Software"), to deal - // in the Software without restriction, including without limitation the rights - // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - // copies of the Software, and to permit persons to whom the Software is - // furnished to do so, subject to the following conditions: - // - // The above copyright notice and this permission notice shall be included in all - // copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - // SOFTWARE. - - namespace Csp { - type ActionSource = 'strict-dynamic' | 'report-sample'; - type BaseSource = - | 'self' - | 'unsafe-eval' - | 'unsafe-hashes' - | 'unsafe-inline' - | 'wasm-unsafe-eval' - | 'none'; - type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`; - type FrameSource = HostSource | SchemeSource | 'self' | 'none'; - type HostNameScheme = `${string}.${string}` | 'localhost'; - type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`; - type HostProtocolSchemes = `${string}://` | ''; - type HttpDelineator = '/' | '?' | '#' | '\\'; - type PortScheme = `:${number}` | '' | ':*'; - type SchemeSource = 'http:' | 'https:' | 'data:' | 'mediastream:' | 'blob:' | 'filesystem:'; - type Source = HostSource | SchemeSource | CryptoSource | BaseSource; - type Sources = Source[]; - } - - interface CspDirectives { - 'child-src'?: Csp.Sources; - 'default-src'?: Array; - 'frame-src'?: Csp.Sources; - 'worker-src'?: Csp.Sources; - 'connect-src'?: Csp.Sources; - 'font-src'?: Csp.Sources; - 'img-src'?: Csp.Sources; - 'manifest-src'?: Csp.Sources; - 'media-src'?: Csp.Sources; - 'object-src'?: Csp.Sources; - 'prefetch-src'?: Csp.Sources; - 'script-src'?: Array; - 'script-src-elem'?: Csp.Sources; - 'script-src-attr'?: Csp.Sources; - 'style-src'?: Array; - 'style-src-elem'?: Csp.Sources; - 'style-src-attr'?: Csp.Sources; - 'base-uri'?: Array; - sandbox?: Array< - | 'allow-downloads-without-user-activation' - | 'allow-forms' - | 'allow-modals' - | 'allow-orientation-lock' - | 'allow-pointer-lock' - | 'allow-popups' - | 'allow-popups-to-escape-sandbox' - | 'allow-presentation' - | 'allow-same-origin' - | 'allow-scripts' - | 'allow-storage-access-by-user-activation' - | 'allow-top-navigation' - | 'allow-top-navigation-by-user-activation' - >; - 'form-action'?: Array; - 'frame-ancestors'?: Array; - 'navigate-to'?: Array; - 'report-uri'?: string[]; - 'report-to'?: string[]; - - 'require-trusted-types-for'?: Array<'script'>; - 'trusted-types'?: Array<'none' | 'allow-duplicates' | '*' | string>; - 'upgrade-insecure-requests'?: boolean; - - /** @deprecated */ - 'require-sri-for'?: Array<'script' | 'style' | 'script style'>; - - /** @deprecated */ - 'block-all-mixed-content'?: boolean; - - /** @deprecated */ - 'plugin-types'?: Array<`${string}/${string}` | 'none'>; - - /** @deprecated */ - referrer?: Array< - | 'no-referrer' - | 'no-referrer-when-downgrade' - | 'origin' - | 'origin-when-cross-origin' - | 'same-origin' - | 'strict-origin' - | 'strict-origin-when-cross-origin' - | 'unsafe-url' - | 'none' - >; - } - - type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS'; - - interface Logger { - (msg: string): void; - success(msg: string): void; - error(msg: string): void; - warn(msg: string): void; - minor(msg: string): void; - info(msg: string): void; - } - - type MaybePromise = T | Promise; - - interface Prerendered { - /** - * A map of `path` to `{ file }` objects, where a path like `/foo` corresponds to `foo.html` and a path like `/bar/` corresponds to `bar/index.html`. - */ - pages: Map< - string, - { - /** The location of the .html file relative to the output directory */ - file: string; - } - >; - /** - * A map of `path` to `{ type }` objects. - */ - assets: Map< - string, - { - /** The MIME type of the asset */ - type: string; - } - >; - /** - * A map of redirects encountered during prerendering. - */ - redirects: Map< - string, - { - status: number; - location: string; - } - >; - /** An array of prerendered paths (without trailing slashes, regardless of the trailingSlash config) */ - paths: string[]; - } - - interface PrerenderHttpErrorHandler { - (details: { - status: number; - path: string; - referrer: string | null; - referenceType: 'linked' | 'fetched'; - message: string; - }): void; - } - - interface PrerenderMissingIdHandler { - (details: { path: string; id: string; referrers: string[]; message: string }): void; - } - - interface PrerenderEntryGeneratorMismatchHandler { - (details: { generatedFromId: string; entry: string; matchedId: string; message: string }): void; - } - - interface PrerenderUnseenRoutesHandler { - (details: { routes: string[]; message: string }): void; - } - - type PrerenderHttpErrorHandlerValue = 'fail' | 'warn' | 'ignore' | PrerenderHttpErrorHandler; - type PrerenderMissingIdHandlerValue = 'fail' | 'warn' | 'ignore' | PrerenderMissingIdHandler; - type PrerenderUnseenRoutesHandlerValue = - | 'fail' - | 'warn' - | 'ignore' - | PrerenderUnseenRoutesHandler; - type PrerenderEntryGeneratorMismatchHandlerValue = - | 'fail' - | 'warn' - | 'ignore' - | PrerenderEntryGeneratorMismatchHandler; - - export type PrerenderOption = boolean | 'auto'; - - interface RequestOptions { - getClientAddress(): string; - platform?: App.Platform; - } - - interface RouteSegment { - content: string; - dynamic: boolean; - rest: boolean; - } - - /** @default 'never' */ - type TrailingSlash = 'never' | 'always' | 'ignore'; - - type DeepPartial = T extends Record | unknown[] - ? { - [K in keyof T]?: T[K] extends Record | unknown[] - ? DeepPartial - : T[K]; - } - : T | undefined; - - type IsAny = 0 extends 1 & T ? true : false; - interface Asset { - file: string; - size: number; - type: string | null; - } - - interface BuildData { - app_dir: string; - app_path: string; - manifest_data: ManifestData; - out_dir: string; - service_worker: string | null; - client: { - /** Path to the client entry point. */ - start: string; - /** Path to the generated `app.js` file that contains the client manifest. Only set in case of `bundleStrategy === 'split'`. */ - app?: string; - /** JS files that the client entry point relies on. */ - imports: string[]; - /** - * JS files that represent the entry points of the layouts/pages. - * An entry is undefined if the layout/page has no component or universal file (i.e. only has a `.server.js` file). - * Only set in case of `router.resolution === 'server'`. - */ - nodes?: Array; - /** - * CSS files referenced in the entry points of the layouts/pages. - * An entry is undefined if the layout/page has no component or universal file (i.e. only has a `.server.js` file) or if has no CSS. - * Only set in case of `router.resolution === 'server'`. - */ - css?: Array; - /** - * Contains the client route manifest in a form suitable for the server which is used for server-side route resolution. - * Notably, it contains all routes, regardless of whether they are prerendered or not (those are missing in the optimized server route manifest). - * Only set in case of `router.resolution === 'server'`. - */ - routes?: SSRClientRoute[]; - stylesheets: string[]; - fonts: string[]; - uses_env_dynamic_public: boolean; - /** Only set in case of `bundleStrategy === 'inline'`. */ - inline?: { - script: string; - style: string | undefined; - }; - } | null; - server_manifest: import('vite').Manifest; - } - - interface ManifestData { - /** Static files from `kit.config.files.assets`. */ - assets: Asset[]; - hooks: { - client: string | null; - server: string | null; - universal: string | null; - }; - nodes: PageNode[]; - routes: RouteData[]; - matchers: Record; - } - - interface PageNode { - depth: number; - /** The `+page/layout.svelte`. */ - component?: string; // TODO supply default component if it's missing (bit of an edge case) - /** The `+page/layout.js/.ts`. */ - universal?: string; - /** The `+page/layout.server.js/ts`. */ - server?: string; - parent_id?: string; - parent?: PageNode; - /** Filled with the pages that reference this layout (if this is a layout). */ - child_pages?: PageNode[]; - /** The final page options for a node if it was statically analysable */ - page_options?: PageOptions | null; - } - - type RecursiveRequired = { - // Recursive implementation of TypeScript's Required utility type. - // Will recursively continue until it reaches a primitive or Function - // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type - [K in keyof T]-?: Extract extends never // If it does not have a Function type - ? RecursiveRequired // recursively continue through. - : T[K]; // Use the exact type for everything else - }; - - interface RouteParam { - name: string; - matcher: string; - optional: boolean; - rest: boolean; - chained: boolean; - } - - /** - * Represents a route segment in the app. It can either be an intermediate node - * with only layout/error pages, or a leaf, at which point either `page` and `leaf` - * or `endpoint` is set. - */ - interface RouteData { - id: string; - parent: RouteData | null; - - segment: string; - pattern: RegExp; - params: RouteParam[]; - - layout: PageNode | null; - error: PageNode | null; - leaf: PageNode | null; - - page: { - layouts: Array; - errors: Array; - leaf: number; - } | null; - - endpoint: { - file: string; - /** The final page options for the endpoint if it was statically analysable */ - page_options: PageOptions | null; - } | null; - } - - interface SSRComponent { - default: { - render( - props: Record, - opts: { context: Map; csp?: { nonce?: string; hash?: boolean } } - ): { - html: string; - head: string; - css: { - code: string; - map: any; // TODO - }; - /** Until we require all Svelte versions that support hashes, this might not be defined */ - hashes?: { - script: Array<`sha256-${string}`>; - }; - }; - }; - } - - type SSRComponentLoader = () => Promise; - - interface UniversalNode { - /** Is `null` in case static analysis succeeds but the node is ssr=false */ - load?: Load; - prerender?: PrerenderOption; - ssr?: boolean; - csr?: boolean; - trailingSlash?: TrailingSlash; - config?: any; - entries?: PrerenderEntryGenerator; - } - - interface ServerNode { - load?: ServerLoad; - prerender?: PrerenderOption; - ssr?: boolean; - csr?: boolean; - trailingSlash?: TrailingSlash; - actions?: Actions; - config?: any; - entries?: PrerenderEntryGenerator; - } - - interface SSRNode { - /** index into the `nodes` array in the generated `client/app.js`. */ - index: number; - /** external JS files that are loaded on the client. `imports[0]` is the entry point (e.g. `client/nodes/0.js`) */ - imports: string[]; - /** external CSS files that are loaded on the client */ - stylesheets: string[]; - /** external font files that are loaded on the client */ - fonts: string[]; - - universal_id?: string; - server_id?: string; - - /** inlined styles */ - inline_styles?(): MaybePromise< - Record string)> - >; - /** Svelte component */ - component?: SSRComponentLoader; - /** +page.js or +layout.js */ - universal?: UniversalNode; - /** +page.server.js, +layout.server.js, or +server.js */ - server?: ServerNode; - } - - type SSRNodeLoader = () => Promise; - - interface PageNodeIndexes { - errors: Array; - layouts: Array; - leaf: number; - } - - type PrerenderEntryGenerator = () => MaybePromise>>; - - type SSREndpoint = Partial> & { - prerender?: PrerenderOption; - trailingSlash?: TrailingSlash; - config?: any; - entries?: PrerenderEntryGenerator; - fallback?: RequestHandler; - }; - - interface SSRRoute { - id: string; - pattern: RegExp; - params: RouteParam[]; - page: PageNodeIndexes | null; - endpoint: (() => Promise) | null; - endpoint_id?: string; - } - - interface SSRClientRoute { - id: string; - pattern: RegExp; - params: RouteParam[]; - errors: Array; - layouts: Array<[has_server_load: boolean, node_id: number] | undefined>; - leaf: [has_server_load: boolean, node_id: number]; - } - - type ValidatedConfig = Config & { - kit: ValidatedKitConfig; - extensions: string[]; - }; - - type ValidatedKitConfig = Omit, 'adapter'> & { - adapter?: Adapter; - }; - /** - * Throws an error with a HTTP status code and an optional message. - * When called during request handling, this will cause SvelteKit to - * return an error response without invoking `handleError`. - * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. - * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. - * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling. - * @throws {Error} If the provided status is invalid (not between 400 and 599). - */ - export function error(status: number, body: App.Error): never; - /** - * Throws an error with a HTTP status code and an optional message. - * When called during request handling, this will cause SvelteKit to - * return an error response without invoking `handleError`. - * Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it. - * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property. - * @throws {HttpError} This error instructs SvelteKit to initiate HTTP error handling. - * @throws {Error} If the provided status is invalid (not between 400 and 599). - */ - export function error(status: number, body?: { - message: string; - } extends App.Error ? App.Error | string | undefined : never): never; - /** - * Checks whether this is an error thrown by {@link error}. - * @param status The status to filter for. - * */ - export function isHttpError(e: unknown, status?: T): e is (HttpError_1 & { - status: T extends undefined ? never : T; - }); - /** - * Redirect a request. When called during request handling, SvelteKit will return a redirect response. - * Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it. - * - * Most common status codes: - * * `303 See Other`: redirect as a GET request (often used after a form POST request) - * * `307 Temporary Redirect`: redirect will keep the request method - * * `308 Permanent Redirect`: redirect will keep the request method, SEO will be transferred to the new page - * - * [See all redirect status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages) - * - * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308. - * @param location The location to redirect to. - * @throws {Redirect} This error instructs SvelteKit to redirect to the specified location. - * @throws {Error} If the provided status is invalid. - * */ - export function redirect(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | ({} & number), location: string | URL): never; - /** - * Checks whether this is a redirect thrown by {@link redirect}. - * @param e The object to check. - * */ - export function isRedirect(e: unknown): e is Redirect_1; - /** - * Create a JSON `Response` object from the supplied data. - * @param data The value that will be serialized as JSON. - * @param init Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically. - */ - export function json(data: any, init?: ResponseInit): Response; - /** - * Create a `Response` object from the supplied body. - * @param body The value that will be used as-is. - * @param init Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically. - */ - export function text(body: string, init?: ResponseInit): Response; - /** - * Create an `ActionFailure` object. Call when form submission fails. - * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * */ - export function fail(status: number): ActionFailure; - /** - * Create an `ActionFailure` object. Call when form submission fails. - * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599. - * @param data Data associated with the failure (e.g. validation errors) - * */ - export function fail(status: number, data: T): ActionFailure; - /** - * Checks whether this is an action failure thrown by {@link fail}. - * @param e The object to check. - * */ - export function isActionFailure(e: unknown): e is ActionFailure; - /** - * Use this to throw a validation error to imperatively fail form validation. - * Can be used in combination with `issue` passed to form actions to create field-specific issues. - * - * @example - * ```ts - * import { invalid } from '@sveltejs/kit'; - * import { form } from '$app/server'; - * import { tryLogin } from '$lib/server/auth'; - * import * as v from 'valibot'; - * - * export const login = form( - * v.object({ name: v.string(), _password: v.string() }), - * async ({ name, _password }) => { - * const success = tryLogin(name, _password); - * if (!success) { - * invalid('Incorrect username or password'); - * } - * - * // ... - * } - * ); - * ``` - * @since 2.47.3 - */ - export function invalid(...issues: (StandardSchemaV1.Issue | string)[]): never; - /** - * Checks whether this is an validation error thrown by {@link invalid}. - * @param e The object to check. - * @since 2.47.3 - */ - export function isValidationError(e: unknown): e is ActionFailure; - /** - * Strips possible SvelteKit-internal suffixes and trailing slashes from the URL pathname. - * Returns the normalized URL as well as a method for adding the potential suffix back - * based on a new pathname (possibly including search) or URL. - * ```js - * import { normalizeUrl } from '@sveltejs/kit'; - * - * const { url, denormalize } = normalizeUrl('/blog/post/__data.json'); - * console.log(url.pathname); // /blog/post - * console.log(denormalize('/blog/post/a')); // /blog/post/a/__data.json - * ``` - * @since 2.18.0 - */ - export function normalizeUrl(url: URL | string): { - url: URL; - wasNormalized: boolean; - denormalize: (url?: string | URL) => URL; - }; - export type LessThan = TNumber extends TArray["length"] ? TArray[number] : LessThan; - export type NumericRange = Exclude, LessThan>; - type ValidPageOption = (typeof valid_page_options_array)[number]; - type PageOptions = Partial>; - const valid_page_options_array: readonly ["ssr", "prerender", "csr", "trailingSlash", "config", "entries", "load"]; - export const VERSION: string; - class HttpError_1 { - - constructor(status: number, body: { - message: string; - } extends App.Error ? (App.Error | string | undefined) : App.Error); - status: number; - body: App.Error; - toString(): string; - } - class Redirect_1 { - - constructor(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308, location: string); - status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308; - location: string; - } - - export {}; -} - -declare module '@sveltejs/kit/hooks' { - import type { Handle } from '@sveltejs/kit'; - /** - * A helper function for sequencing multiple `handle` calls in a middleware-like manner. - * The behavior for the `handle` options is as follows: - * - `transformPageChunk` is applied in reverse order and merged - * - `preload` is applied in forward order, the first option "wins" and no `preload` options after it are called - * - `filterSerializedResponseHeaders` behaves the same as `preload` - * - * ```js - * /// file: src/hooks.server.js - * import { sequence } from '@sveltejs/kit/hooks'; - * - * /// type: import('@sveltejs/kit').Handle - * async function first({ event, resolve }) { - * console.log('first pre-processing'); - * const result = await resolve(event, { - * transformPageChunk: ({ html }) => { - * // transforms are applied in reverse order - * console.log('first transform'); - * return html; - * }, - * preload: () => { - * // this one wins as it's the first defined in the chain - * console.log('first preload'); - * return true; - * } - * }); - * console.log('first post-processing'); - * return result; - * } - * - * /// type: import('@sveltejs/kit').Handle - * async function second({ event, resolve }) { - * console.log('second pre-processing'); - * const result = await resolve(event, { - * transformPageChunk: ({ html }) => { - * console.log('second transform'); - * return html; - * }, - * preload: () => { - * console.log('second preload'); - * return true; - * }, - * filterSerializedResponseHeaders: () => { - * // this one wins as it's the first defined in the chain - * console.log('second filterSerializedResponseHeaders'); - * return true; - * } - * }); - * console.log('second post-processing'); - * return result; - * } - * - * export const handle = sequence(first, second); - * ``` - * - * The example above would print: - * - * ``` - * first pre-processing - * first preload - * second pre-processing - * second filterSerializedResponseHeaders - * second transform - * first transform - * second post-processing - * first post-processing - * ``` - * - * @param handlers The chain of `handle` functions - * */ - export function sequence(...handlers: Handle[]): Handle; - - export {}; -} - -declare module '@sveltejs/kit/node' { - export function getRequest({ request, base, bodySizeLimit }: { - request: import("http").IncomingMessage; - base: string; - bodySizeLimit?: number; - }): Promise; - - export function setResponse(res: import("http").ServerResponse, response: Response): Promise; - /** - * Converts a file on disk to a readable stream - * @since 2.4.0 - */ - export function createReadableStream(file: string): ReadableStream; - - export {}; -} - -declare module '@sveltejs/kit/node/polyfills' { - /** - * Make various web APIs available as globals: - * - `crypto` - * - `File` - */ - export function installPolyfills(): void; - - export {}; -} - -declare module '@sveltejs/kit/vite' { - /** - * Returns the SvelteKit Vite plugins. - * */ - export function sveltekit(): Promise; - - export {}; -} - -declare module '$app/environment' { - /** - * `true` if the app is running in the browser. - */ - export const browser: boolean; - - /** - * Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`. - */ - export const dev: boolean; - - /** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ - export const building: boolean; - - /** - * The value of `config.kit.version.name`. - */ - export const version: string; - - export {}; -} - -declare module '$app/forms' { - /** - * Use this function to deserialize the response from a form submission. - * Usage: - * - * ```js - * import { deserialize } from '$app/forms'; - * - * async function handleSubmit(event) { - * const response = await fetch('/form?/action', { - * method: 'POST', - * body: new FormData(event.target) - * }); - * - * const result = deserialize(await response.text()); - * // ... - * } - * ``` - * */ - export function deserialize | undefined, Failure extends Record | undefined>(result: string): import("@sveltejs/kit").ActionResult; - /** - * This action enhances a `
` element that otherwise would work without JavaScript. - * - * The `submit` function is called upon submission with the given FormData and the `action` that should be triggered. - * If `cancel` is called, the form will not be submitted. - * You can use the abort `controller` to cancel the submission in case another one starts. - * If a function is returned, that function is called with the response from the server. - * If nothing is returned, the fallback will be used. - * - * If this function or its return value isn't set, it - * - falls back to updating the `form` prop with the returned data if the action is on the same page as the form - * - updates `page.status` - * - resets the `` element and invalidates all data in case of successful submission with no redirect response - * - redirects in case of a redirect response - * - redirects to the nearest error page in case of an unexpected error - * - * If you provide a custom function with a callback and want to use the default behavior, invoke `update` in your callback. - * It accepts an options object - * - `reset: false` if you don't want the `` values to be reset after a successful submission - * - `invalidateAll: false` if you don't want the action to call `invalidateAll` after submission - * @param form_element The form element - * @param submit Submit callback - */ - export function enhance | undefined, Failure extends Record | undefined>(form_element: HTMLFormElement, submit?: import("@sveltejs/kit").SubmitFunction): { - destroy(): void; - }; - /** - * This action updates the `form` property of the current page with the given data and updates `page.status`. - * In case of an error, it redirects to the nearest error page. - * */ - export function applyAction | undefined, Failure extends Record | undefined>(result: import("@sveltejs/kit").ActionResult): Promise; - - export {}; -} - -declare module '$app/navigation' { - /** - * A lifecycle function that runs the supplied `callback` when the current component mounts, and also whenever we navigate to a URL. - * - * `afterNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * */ - export function afterNavigate(callback: (navigation: import("@sveltejs/kit").AfterNavigate) => void): void; - /** - * A navigation interceptor that triggers before we navigate to a URL, whether by clicking a link, calling `goto(...)`, or using the browser back/forward controls. - * - * Calling `cancel()` will prevent the navigation from completing. If `navigation.type === 'leave'` — meaning the user is navigating away from the app (or closing the tab) — calling `cancel` will trigger the native browser unload confirmation dialog. In this case, the navigation may or may not be cancelled depending on the user's response. - * - * When a navigation isn't to a SvelteKit-owned route (and therefore controlled by SvelteKit's client-side router), `navigation.to.route.id` will be `null`. - * - * If the navigation will (if not cancelled) cause the document to unload — in other words `'leave'` navigations and `'link'` navigations where `navigation.to.route === null` — `navigation.willUnload` is `true`. - * - * `beforeNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * */ - export function beforeNavigate(callback: (navigation: import("@sveltejs/kit").BeforeNavigate) => void): void; - /** - * A lifecycle function that runs the supplied `callback` immediately before we navigate to a new URL except during full-page navigations. - * - * If you return a `Promise`, SvelteKit will wait for it to resolve before completing the navigation. This allows you to — for example — use `document.startViewTransition`. Avoid promises that are slow to resolve, since navigation will appear stalled to the user. - * - * If a function (or a `Promise` that resolves to a function) is returned from the callback, it will be called once the DOM has updated. - * - * `onNavigate` must be called during a component initialization. It remains active as long as the component is mounted. - * */ - export function onNavigate(callback: (navigation: import("@sveltejs/kit").OnNavigate) => MaybePromise<(() => void) | void>): void; - /** - * If called when the page is being updated following a navigation (in `onMount` or `afterNavigate` or an action, for example), this disables SvelteKit's built-in scroll handling. - * This is generally discouraged, since it breaks user expectations. - * */ - export function disableScrollHandling(): void; - /** - * Allows you to navigate programmatically to a given route, with options such as keeping the current element focused. - * Returns a Promise that resolves when SvelteKit navigates (or fails to navigate, in which case the promise rejects) to the specified `url`. - * - * For external URLs, use `window.location = url` instead of calling `goto(url)`. - * - * @param url Where to navigate to. Note that if you've set [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths) and the URL is root-relative, you need to prepend the base path if you want to navigate within the app. - * @param {Object} opts Options related to the navigation - * */ - export function goto(url: string | URL, opts?: { - replaceState?: boolean | undefined; - noScroll?: boolean | undefined; - keepFocus?: boolean | undefined; - invalidateAll?: boolean | undefined; - invalidate?: (string | URL | ((url: URL) => boolean))[] | undefined; - state?: App.PageState | undefined; - }): Promise; - /** - * Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated. - * - * If the argument is given as a `string` or `URL`, it must resolve to the same URL that was passed to `fetch` or `depends` (including query parameters). - * To create a custom identifier, use a string beginning with `[a-z]+:` (e.g. `custom:state`) — this is a valid URL. - * - * The `function` argument can be used define a custom predicate. It receives the full `URL` and causes `load` to rerun if `true` is returned. - * This can be useful if you want to invalidate based on a pattern instead of a exact match. - * - * ```ts - * // Example: Match '/path' regardless of the query parameters - * import { invalidate } from '$app/navigation'; - * - * invalidate((url) => url.pathname === '/path'); - * ``` - * @param resource The invalidated URL - * */ - export function invalidate(resource: string | URL | ((url: URL) => boolean)): Promise; - /** - * Causes all `load` and `query` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated. - * */ - export function invalidateAll(): Promise; - /** - * Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run (unless disabled via the option argument). - * Returns a `Promise` that resolves when the page is subsequently updated. - * */ - export function refreshAll({ includeLoadFunctions }?: { - includeLoadFunctions?: boolean; - }): Promise; - /** - * Programmatically preloads the given page, which means - * 1. ensuring that the code for the page is loaded, and - * 2. calling the page's load function with the appropriate options. - * - * This is the same behaviour that SvelteKit triggers when the user taps or mouses over an `` element with `data-sveltekit-preload-data`. - * If the next navigation is to `href`, the values returned from load will be used, making navigation instantaneous. - * Returns a Promise that resolves with the result of running the new route's `load` functions once the preload is complete. - * - * @param href Page to preload - * */ - export function preloadData(href: string): Promise<{ - type: "loaded"; - status: number; - data: Record; - } | { - type: "redirect"; - location: string; - }>; - /** - * Programmatically imports the code for routes that haven't yet been fetched. - * Typically, you might call this to speed up subsequent navigation. - * - * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about/+page.svelte`) or `/blog/*` (to match `src/routes/blog/[slug]/+page.svelte`). - * - * Unlike `preloadData`, this won't call `load` functions. - * Returns a Promise that resolves when the modules have been imported. - * - * */ - export function preloadCode(pathname: string): Promise; - /** - * Programmatically create a new history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing). - * - * */ - export function pushState(url: string | URL, state: App.PageState): void; - /** - * Programmatically replace the current history entry with the given `page.state`. To use the current URL, you can pass `''` as the first argument. Used for [shallow routing](https://svelte.dev/docs/kit/shallow-routing). - * - * */ - export function replaceState(url: string | URL, state: App.PageState): void; - type MaybePromise = T | Promise; - - export {}; -} - -declare module '$app/paths' { - import type { RouteIdWithSearchOrHash, PathnameWithSearchOrHash, ResolvedPathname, RouteId, RouteParams, Asset, Pathname as Pathname_1 } from '$app/types'; - /** - * A string that matches [`config.kit.paths.base`](https://svelte.dev/docs/kit/configuration#paths). - * - * Example usage: `Link` - * - * @deprecated Use [`resolve(...)`](https://svelte.dev/docs/kit/$app-paths#resolve) instead - */ - export let base: '' | `/${string}`; - - /** - * An absolute path that matches [`config.kit.paths.assets`](https://svelte.dev/docs/kit/configuration#paths). - * - * > [!NOTE] If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - * - * @deprecated Use [`asset(...)`](https://svelte.dev/docs/kit/$app-paths#asset) instead - */ - export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; - - /** - * @deprecated Use [`resolve(...)`](https://svelte.dev/docs/kit/$app-paths#resolve) instead - */ - export function resolveRoute( - ...args: ResolveArgs - ): ResolvedPathname; - type StripSearchOrHash = T extends `${infer Pathname}?${string}` - ? Pathname - : T extends `${infer Pathname}#${string}` - ? Pathname - : T; - - type ResolveArgs = - T extends RouteId - ? RouteParams extends Record - ? [route: T] - : [route: T, params: RouteParams] - : StripSearchOrHash extends infer U extends RouteId - ? RouteParams extends Record - ? [route: T] - : [route: T, params: RouteParams] - : [route: T]; - /** - * Resolve the URL of an asset in your `static` directory, by prefixing it with [`config.kit.paths.assets`](https://svelte.dev/docs/kit/configuration#paths) if configured, or otherwise by prefixing it with the base path. - * - * During server rendering, the base path is relative and depends on the page currently being rendered. - * - * @example - * ```svelte - * - * - * a potato - * ``` - * @since 2.26 - * - * */ - export function asset(file: Asset): string; - /** - * Resolve a pathname by prefixing it with the base path, if any, or resolve a route ID by populating dynamic segments with parameters. - * - * During server rendering, the base path is relative and depends on the page currently being rendered. - * - * @example - * ```js - * import { resolve } from '$app/paths'; - * - * // using a pathname - * const resolved = resolve(`/blog/hello-world`); - * - * // using a route ID plus parameters - * const resolved = resolve('/blog/[slug]', { - * slug: 'hello-world' - * }); - * ``` - * @since 2.26 - * - * */ - export function resolve(...args: ResolveArgs): ResolvedPathname; - /** - * Match a path or URL to a route ID and extracts any parameters. - * - * @example - * ```js - * import { match } from '$app/paths'; - * - * const route = await match('/blog/hello-world'); - * - * if (route?.id === '/blog/[slug]') { - * const slug = route.params.slug; - * const response = await fetch(`/api/posts/${slug}`); - * const post = await response.json(); - * } - * ``` - * @since 2.52.0 - * - * */ - export function match(url: Pathname_1 | URL | (string & {})): Promise<{ - id: RouteId; - params: Record; - } | null>; - - export {}; -} - -declare module '$app/server' { - import type { RequestEvent, RemoteCommand, RemoteForm, RemoteFormInput, InvalidField, RemotePrerenderFunction, RemoteQueryFunction } from '@sveltejs/kit'; - import type { StandardSchemaV1 } from '@standard-schema/spec'; - /** - * Read the contents of an imported asset from the filesystem - * @example - * ```js - * import { read } from '$app/server'; - * import somefile from './somefile.txt'; - * - * const asset = read(somefile); - * const text = await asset.text(); - * ``` - * @since 2.4.0 - */ - export function read(asset: string): Response; - /** - * Returns the current `RequestEvent`. Can be used inside server hooks, server `load` functions, actions, and endpoints (and functions called by them). - * - * In environments without [`AsyncLocalStorage`](https://nodejs.org/api/async_context.html#class-asynclocalstorage), this must be called synchronously (i.e. not after an `await`). - * @since 2.20.0 - * - * */ - export function getRequestEvent(): RequestEvent; - /** - * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation. - * - * @since 2.27 - */ - export function command(fn: () => Output): RemoteCommand; - /** - * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation. - * - * @since 2.27 - */ - export function command(validate: "unchecked", fn: (arg: Input) => Output): RemoteCommand; - /** - * Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation. - * - * @since 2.27 - */ - export function command(validate: Schema, fn: (arg: StandardSchemaV1.InferOutput) => Output): RemoteCommand, Output>; - /** - * Creates a form object that can be spread onto a `` element. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation. - * - * @since 2.27 - */ - export function form(fn: () => MaybePromise): RemoteForm; - /** - * Creates a form object that can be spread onto a `` element. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation. - * - * @since 2.27 - */ - export function form(validate: "unchecked", fn: (data: Input, issue: InvalidField) => MaybePromise): RemoteForm; - /** - * Creates a form object that can be spread onto a `` element. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation. - * - * @since 2.27 - */ - export function form>, Output>(validate: Schema, fn: (data: StandardSchemaV1.InferOutput, issue: InvalidField>) => MaybePromise): RemoteForm, Output>; - /** - * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation. - * - * @since 2.27 - */ - export function prerender(fn: () => MaybePromise, options?: { - inputs?: RemotePrerenderInputsGenerator; - dynamic?: boolean; - } | undefined): RemotePrerenderFunction; - /** - * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation. - * - * @since 2.27 - */ - export function prerender(validate: "unchecked", fn: (arg: Input) => MaybePromise, options?: { - inputs?: RemotePrerenderInputsGenerator; - dynamic?: boolean; - } | undefined): RemotePrerenderFunction; - /** - * Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation. - * - * @since 2.27 - */ - export function prerender(schema: Schema, fn: (arg: StandardSchemaV1.InferOutput) => MaybePromise, options?: { - inputs?: RemotePrerenderInputsGenerator>; - dynamic?: boolean; - } | undefined): RemotePrerenderFunction, Output>; - /** - * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation. - * - * @since 2.27 - */ - export function query(fn: () => MaybePromise): RemoteQueryFunction; - /** - * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation. - * - * @since 2.27 - */ - export function query(validate: "unchecked", fn: (arg: Input) => MaybePromise): RemoteQueryFunction; - /** - * Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call. - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation. - * - * @since 2.27 - */ - export function query(schema: Schema, fn: (arg: StandardSchemaV1.InferOutput) => MaybePromise): RemoteQueryFunction, Output>; - export namespace query { - /** - * Creates a batch query function that collects multiple calls and executes them in a single request - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation. - * - * @since 2.35 - */ - function batch(validate: "unchecked", fn: (args: Input[]) => MaybePromise<(arg: Input, idx: number) => Output>): RemoteQueryFunction; - /** - * Creates a batch query function that collects multiple calls and executes them in a single request - * - * See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.batch) for full documentation. - * - * @since 2.35 - */ - function batch(schema: Schema, fn: (args: StandardSchemaV1.InferOutput[]) => MaybePromise<(arg: StandardSchemaV1.InferOutput, idx: number) => Output>): RemoteQueryFunction, Output>; - } - type RemotePrerenderInputsGenerator = () => MaybePromise; - type MaybePromise = T | Promise; - - export {}; -} - -declare module '$app/state' { - /** - * A read-only reactive object with information about the current page, serving several use cases: - * - retrieving the combined `data` of all pages/layouts anywhere in your component tree (also see [loading data](https://svelte.dev/docs/kit/load)) - * - retrieving the current value of the `form` prop anywhere in your component tree (also see [form actions](https://svelte.dev/docs/kit/form-actions)) - * - retrieving the page state that was set through `goto`, `pushState` or `replaceState` (also see [goto](https://svelte.dev/docs/kit/$app-navigation#goto) and [shallow routing](https://svelte.dev/docs/kit/shallow-routing)) - * - retrieving metadata such as the URL you're on, the current route and its parameters, and whether or not there was an error - * - * ```svelte - * - * - * - *

Currently at {page.url.pathname}

- * - * {#if page.error} - * Problem detected - * {:else} - * All systems operational - * {/if} - * ``` - * - * Changes to `page` are available exclusively with runes. (The legacy reactivity syntax will not reflect any changes) - * - * ```svelte - * - * - * ``` - * - * On the server, values can only be read during rendering (in other words _not_ in e.g. `load` functions). In the browser, the values can be read at any time. - * - * */ - export const page: import("@sveltejs/kit").Page; - /** - * A read-only object representing an in-progress navigation, with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. - * Values are `null` when no navigation is occurring, or during server rendering. - * */ - export const navigating: import("@sveltejs/kit").Navigation | { - from: null; - to: null; - type: null; - willUnload: null; - delta: null; - complete: null; - }; - /** - * A read-only reactive value that's initially `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update `current` to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. - * */ - export const updated: { - get current(): boolean; - check(): Promise; - }; - - export {}; -} - -declare module '$app/stores' { - export function getStores(): { - - page: typeof page; - - navigating: typeof navigating; - - updated: typeof updated; - }; - /** - * A readable store whose value contains page data. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `page` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * */ - export const page: import("svelte/store").Readable; - /** - * A readable store. - * When navigating starts, its value is a `Navigation` object with `from`, `to`, `type` and (if `type === 'popstate'`) `delta` properties. - * When navigating finishes, its value reverts to `null`. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `navigating` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * */ - export const navigating: import("svelte/store").Readable; - /** - * A readable store whose initial value is `false`. If [`version.pollInterval`](https://svelte.dev/docs/kit/configuration#version) is a non-zero value, SvelteKit will poll for new versions of the app and update the store value to `true` when it detects one. `updated.check()` will force an immediate check, regardless of polling. - * - * On the server, this store can only be subscribed to during component initialization. In the browser, it can be subscribed to at any time. - * - * @deprecated Use `updated` from `$app/state` instead (requires Svelte 5, [see docs for more info](https://svelte.dev/docs/kit/migrating-to-sveltekit-2#SvelteKit-2.12:-$app-stores-deprecated)) - * */ - export const updated: import("svelte/store").Readable & { - check(): Promise; - }; - - export {}; -}/** - * It's possible to tell SvelteKit how to type objects inside your app by declaring the `App` namespace. By default, a new project will have a file called `src/app.d.ts` containing the following: - * - * ```ts - * declare global { - * namespace App { - * // interface Error {} - * // interface Locals {} - * // interface PageData {} - * // interface PageState {} - * // interface Platform {} - * } - * } - * - * export {}; - * ``` - * - * The `export {}` line exists because without it, the file would be treated as an _ambient module_ which prevents you from adding `import` declarations. - * If you need to add ambient `declare module` declarations, do so in a separate file like `src/ambient.d.ts`. - * - * By populating these interfaces, you will gain type safety when using `event.locals`, `event.platform`, and `data` from `load` functions. - */ -declare namespace App { - /** - * Defines the common shape of expected and unexpected errors. Expected errors are thrown using the `error` function. Unexpected errors are handled by the `handleError` hooks which should return this shape. - */ - export interface Error { - message: string; - } - - /** - * The interface that defines `event.locals`, which can be accessed in server [hooks](https://svelte.dev/docs/kit/hooks) (`handle`, and `handleError`), server-only `load` functions, and `+server.js` files. - */ - export interface Locals {} - - /** - * Defines the common shape of the [page.data state](https://svelte.dev/docs/kit/$app-state#page) and [$page.data store](https://svelte.dev/docs/kit/$app-stores#page) - that is, the data that is shared between all pages. - * The `Load` and `ServerLoad` functions in `./$types` will be narrowed accordingly. - * Use optional properties for data that is only present on specific pages. Do not add an index signature (`[key: string]: any`). - */ - export interface PageData {} - - /** - * The shape of the `page.state` object, which can be manipulated using the [`pushState`](https://svelte.dev/docs/kit/$app-navigation#pushState) and [`replaceState`](https://svelte.dev/docs/kit/$app-navigation#replaceState) functions from `$app/navigation`. - */ - export interface PageState {} - - /** - * If your adapter provides [platform-specific context](https://svelte.dev/docs/kit/adapters#Platform-specific-context) via `event.platform`, you can specify it here. - */ - export interface Platform {} -} - -/** - * This module is only available to [service workers](https://svelte.dev/docs/kit/service-workers). - */ -declare module '$service-worker' { - /** - * The `base` path of the deployment. Typically this is equivalent to `config.kit.paths.base`, but it is calculated from `location.pathname` meaning that it will continue to work correctly if the site is deployed to a subdirectory. - * Note that there is a `base` but no `assets`, since service workers cannot be used if `config.kit.paths.assets` is specified. - */ - export const base: string; - /** - * An array of URL strings representing the files generated by Vite, suitable for caching with `cache.addAll(build)`. - * During development, this is an empty array. - */ - export const build: string[]; - /** - * An array of URL strings representing the files in your static directory, or whatever directory is specified by `config.kit.files.assets`. You can customize which files are included from `static` directory using [`config.kit.serviceWorker.files`](https://svelte.dev/docs/kit/configuration#serviceWorker) - */ - export const files: string[]; - /** - * An array of pathnames corresponding to prerendered pages and endpoints. - * During development, this is an empty array. - */ - export const prerendered: string[]; - /** - * See [`config.kit.version`](https://svelte.dev/docs/kit/configuration#version). It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches. - */ - export const version: string; -} - -/** - * This module contains generated types for the routes in your app. - */ -declare module '$app/types' { - /** - * Interface for all generated app types. This gets extended via declaration merging. DO NOT USE THIS INTERFACE DIRECTLY. - */ - export interface AppTypes { - // These are all functions so that we can leverage function overloads to get the correct type. - // Using the return types directly would error with a "not the same type" error. - // https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-interfaces - RouteId(): string; - RouteParams(): Record>; - LayoutParams(): Record>; - Pathname(): string; - ResolvedPathname(): string; - Asset(): string; - } - - /** - * A union of all the route IDs in your app. Used for `page.route.id` and `event.route.id`. - */ - export type RouteId = ReturnType; - - /** - * `RouteId`, but possibly suffixed with a search string and/or hash. - */ - export type RouteIdWithSearchOrHash = RouteId | `${RouteId}?${string}` | `${RouteId}#${string}`; - - /** - * A utility for getting the parameters associated with a given route. - */ - export type RouteParams = T extends keyof ReturnType - ? ReturnType[T] - : Record; - - /** - * A utility for getting the parameters associated with a given layout, which is similar to `RouteParams` but also includes optional parameters for any child route. - */ - export type LayoutParams = T extends keyof ReturnType - ? ReturnType[T] - : Record; - - /** - * A union of all valid pathnames in your app. - */ - export type Pathname = ReturnType; - - /** - * `Pathname`, but possibly suffixed with a search string and/or hash. - */ - export type PathnameWithSearchOrHash = - | Pathname - | `${Pathname}?${string}` - | `${Pathname}#${string}`; - - /** - * `Pathname`, but possibly prefixed with a base path. Used for `page.url.pathname`. - */ - export type ResolvedPathname = ReturnType; - - /** - * A union of all the filenames of assets contained in your `static` directory. - */ - export type Asset = ReturnType; -} - -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@sveltejs/kit/types/index.d.ts.map b/web/node_modules/@sveltejs/kit/types/index.d.ts.map deleted file mode 100644 index dab7982..0000000 --- a/web/node_modules/@sveltejs/kit/types/index.d.ts.map +++ /dev/null @@ -1,232 +0,0 @@ -{ - "version": 3, - "file": "index.d.ts", - "names": [ - "Span", - "Adapter", - "LoadProperties", - "AwaitedActions", - "OptionalUnion", - "uniqueSymbol", - "ActionFailure", - "UnpackValidationError", - "Builder", - "Config", - "Cookies", - "Emulator", - "KitConfig", - "Handle", - "HandleServerError", - "HandleValidationError", - "HandleClientError", - "HandleFetch", - "ServerInit", - "ClientInit", - "Reroute", - "Transport", - "Transporter", - "Load", - "LoadEvent", - "NavigationEvent", - "NavigationTarget", - "NavigationType", - "NavigationBase", - "NavigationEnter", - "NavigationExternal", - "NavigationGoto", - "NavigationLeave", - "NavigationFormSubmit", - "NavigationPopState", - "NavigationLink", - "Navigation", - "BeforeNavigate", - "OnNavigate", - "AfterNavigate", - "Page", - "ParamMatcher", - "RequestEvent", - "RequestHandler", - "ResolveOptions", - "RouteDefinition", - "Server", - "ServerInitOptions", - "SSRManifest", - "ServerLoad", - "ServerLoadEvent", - "Action", - "Actions", - "ActionResult", - "HttpError", - "Redirect", - "SubmitFunction", - "Snapshot", - "WillRecurseIndefinitely", - "InputTypeMap", - "RemoteFormFieldType", - "InputElementProps", - "RemoteFormFieldMethods", - "RemoteFormFieldValue", - "AsArgs", - "RemoteFormField", - "RemoteFormFieldContainer", - "UnknownField", - "RemoteFormFieldsRoot", - "RemoteFormFields", - "RecursiveFormFields", - "MaybeArray", - "RemoteFormInput", - "RemoteFormIssue", - "ExtractId", - "InvalidField", - "ValidationError", - "RemoteForm", - "RemoteCommand", - "RemoteResource", - "RemoteQuery", - "RemoteQueryOverride", - "RemotePrerenderFunction", - "RemoteQueryFunction", - "AdapterEntry", - "Csp", - "CspDirectives", - "HttpMethod", - "Logger", - "MaybePromise", - "Prerendered", - "PrerenderHttpErrorHandler", - "PrerenderMissingIdHandler", - "PrerenderEntryGeneratorMismatchHandler", - "PrerenderUnseenRoutesHandler", - "PrerenderHttpErrorHandlerValue", - "PrerenderMissingIdHandlerValue", - "PrerenderUnseenRoutesHandlerValue", - "PrerenderEntryGeneratorMismatchHandlerValue", - "PrerenderOption", - "RequestOptions", - "RouteSegment", - "TrailingSlash", - "DeepPartial", - "IsAny", - "Asset", - "BuildData", - "ManifestData", - "PageNode", - "RecursiveRequired", - "RouteParam", - "RouteData", - "SSRComponent", - "SSRComponentLoader", - "UniversalNode", - "ServerNode", - "SSRNode", - "SSRNodeLoader", - "PageNodeIndexes", - "PrerenderEntryGenerator", - "SSREndpoint", - "SSRRoute", - "SSRClientRoute", - "ValidatedConfig", - "ValidatedKitConfig", - "isHttpError", - "redirect", - "isRedirect", - "json", - "text", - "isActionFailure", - "invalid", - "isValidationError", - "normalizeUrl", - "ValidPageOption", - "PageOptions", - "valid_page_options_array", - "VERSION", - "sequence", - "getRequest", - "setResponse", - "createReadableStream", - "installPolyfills", - "sveltekit", - "browser", - "dev", - "building", - "version", - "deserialize", - "enhance", - "applyAction", - "afterNavigate", - "beforeNavigate", - "onNavigate", - "disableScrollHandling", - "goto", - "invalidate", - "invalidateAll", - "refreshAll", - "preloadData", - "preloadCode", - "pushState", - "replaceState", - "base", - "assets", - "resolveRoute", - "StripSearchOrHash", - "ResolveArgs", - "asset", - "resolve", - "match", - "read", - "getRequestEvent", - "RemotePrerenderInputsGenerator", - "page", - "navigating", - "updated", - "getStores" - ], - "sources": [ - "../src/exports/public.d.ts", - "../src/exports/internal/index.js", - "../src/types/private.d.ts", - "../src/types/internal.d.ts", - "../src/exports/index.js", - "../src/exports/vite/static_analysis/index.js", - "../src/version.js", - "../src/exports/hooks/sequence.js", - "../src/exports/node/index.js", - "../src/exports/node/polyfills.js", - "../src/exports/vite/index.js", - "../src/runtime/app/environment/types.d.ts", - "../src/runtime/app/forms.js", - "../src/runtime/client/client.js", - "../src/runtime/app/paths/public.d.ts", - "../src/runtime/app/paths/types.d.ts", - "../src/runtime/app/paths/client.js", - "../src/runtime/app/server/index.js", - "../src/exports/internal/event.js", - "../src/runtime/app/state/index.js", - "../src/runtime/app/stores.js" - ], - "sourcesContent": [ - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null, - null - ], - "mappings": "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", - "ignoreList": [] -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE deleted file mode 100644 index c1a5d8f..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 [these people](https://github.com/sveltejs/vite-plugin-svelte/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md deleted file mode 100644 index bbdf50c..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# @sveltejs/vite-plugin-svelte-inspector - -A [Svelte](https://svelte.dev) inspector plugin for [Vite](https://vitejs.dev). - -## Usage - -```js -// vite.config.js -import { defineConfig } from 'vite'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; -import { svelteInspector } from '@sveltejs/vite-plugin-svelte-inspector'; - -export default defineConfig({ - plugins: [ - // the svelte plugin is required to work - svelte(), - svelteInspector({ - /* plugin options */ - }) - ] -}); -``` - -## License - -[MIT](./LICENSE) diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json deleted file mode 100644 index 182bbee..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@sveltejs/vite-plugin-svelte-inspector", - "version": "4.0.1", - "license": "MIT", - "author": "dominikg", - "files": [ - "src", - "types" - ], - "type": "module", - "types": "types/index.d.ts", - "exports": { - ".": { - "import": { - "types": "./types/index.d.ts", - "default": "./src/index.js" - } - } - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/sveltejs/vite-plugin-svelte.git", - "directory": "packages/vite-plugin-svelte-inspector" - }, - "keywords": [ - "vite-plugin", - "vite plugin", - "vite", - "svelte" - ], - "bugs": { - "url": "https://github.com/sveltejs/vite-plugin-svelte/issues" - }, - "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme", - "dependencies": { - "debug": "^4.3.7" - }, - "peerDependencies": { - "@sveltejs/vite-plugin-svelte": "^5.0.0", - "svelte": "^5.0.0", - "vite": "^6.0.0" - }, - "devDependencies": { - "@types/debug": "^4.1.12", - "svelte": "^5.2.7", - "vite": "^6.0.0" - }, - "scripts": { - "check:publint": "publint --strict", - "check:types": "tsc --noEmit", - "generate:types": "dts-buddy -m \"@sveltejs/vite-plugin-svelte-inspector:src/public.d.ts\"" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js deleted file mode 100644 index 0575a83..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/debug.js +++ /dev/null @@ -1,3 +0,0 @@ -import _debug from 'debug'; - -export const debug = _debug('vite-plugin-svelte-inspector'); diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js deleted file mode 100644 index 3b69783..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/index.js +++ /dev/null @@ -1,112 +0,0 @@ -import { normalizePath } from 'vite'; -import fs from 'node:fs'; -import path from 'node:path'; -import { fileURLToPath } from 'node:url'; -import { debug } from './debug.js'; -import { defaultInspectorOptions, parseEnvironmentOptions } from './options.js'; -import { cleanUrl } from './utils.js'; - -function getInspectorPath() { - const pluginPath = normalizePath(path.dirname(fileURLToPath(import.meta.url))); - return pluginPath.replace( - /\/vite-plugin-svelte-inspector\/src$/, - '/vite-plugin-svelte-inspector/src/runtime/' - ); -} - -/** - * @param {Partial} [options] - * @returns {import('vite').Plugin} - */ -export function svelteInspector(options) { - const inspectorPath = getInspectorPath(); - debug(`svelte inspector path: ${inspectorPath}`); - - /** @type {import('vite').ResolvedConfig} */ - let viteConfig; - /** @type {import('./public.d.ts').Options} */ - let inspectorOptions; - let disabled = false; - - return { - name: 'vite-plugin-svelte-inspector', - apply: 'serve', - enforce: 'pre', - - configResolved(config) { - viteConfig = config; - const environmentOptions = parseEnvironmentOptions(config); - if (environmentOptions === false) { - debug('environment options set to false, inspector disabled'); - disabled = true; - return; - } - - // Handle config from svelte.config.js through vite-plugin-svelte - const vps = config.plugins.find((p) => p.name === 'vite-plugin-svelte'); - const configFileOptions = vps?.api?.options?.inspector; - - // vite-plugin-svelte can only pass options through it's `api` instead of `options`. - // that means this plugin could be created but should be disabled, so we check this case here. - if (vps && !options && !configFileOptions && !environmentOptions) { - debug("vite-plugin-svelte didn't pass options, inspector disabled"); - disabled = true; - return; - } - - if (environmentOptions === true) { - inspectorOptions = defaultInspectorOptions; - } else { - inspectorOptions = { - ...defaultInspectorOptions, - ...configFileOptions, - ...options, - ...(environmentOptions || {}) - }; - } - - inspectorOptions.__internal = { - base: config.base?.replace(/\/$/, '') || '' - }; - }, - - async resolveId(importee, _, options) { - if (options?.ssr || disabled) { - return; - } - if (importee.startsWith('virtual:svelte-inspector-options')) { - return importee; - } else if (importee.startsWith('virtual:svelte-inspector-path:')) { - return importee.replace('virtual:svelte-inspector-path:', inspectorPath); - } - }, - - async load(id, options) { - if (options?.ssr || disabled) { - return; - } - if (id === 'virtual:svelte-inspector-options') { - return `export default ${JSON.stringify(inspectorOptions ?? {})}`; - } else if (id.startsWith(inspectorPath)) { - // read file ourselves to avoid getting shut out by vites fs.allow check - const file = cleanUrl(id); - if (fs.existsSync(id)) { - return await fs.promises.readFile(file, 'utf-8'); - } else { - viteConfig.logger.error( - `[vite-plugin-svelte-inspector] failed to find svelte-inspector: ${id}` - ); - } - } - }, - - transform(code, id, options) { - if (options?.ssr || disabled) { - return; - } - if (id.includes('vite/dist/client/client.mjs')) { - return { code: `${code}\nimport('virtual:svelte-inspector-path:load-inspector.js')` }; - } - } - }; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js deleted file mode 100644 index 15a2456..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/options.js +++ /dev/null @@ -1,63 +0,0 @@ -import process from 'node:process'; -import { loadEnv } from 'vite'; -import { debug } from './debug.js'; - -/** @type {import('./public.d.ts').Options} */ -export const defaultInspectorOptions = { - toggleKeyCombo: 'alt-x', - navKeys: { parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' }, - escapeKeys: ['Backspace', 'Escape'], - openKey: 'Enter', - holdMode: true, - showToggleButton: 'active', - toggleButtonPos: 'top-right', - customStyles: true -}; - -/** - * @param {import('vite').ResolvedConfig} config - * @returns {Partial | boolean | void} - */ -export function parseEnvironmentOptions(config) { - const env = loadEnv(config.mode, config.envDir ?? process.cwd(), 'SVELTE_INSPECTOR'); - const options = env?.SVELTE_INSPECTOR_OPTIONS; - const toggle = env?.SVELTE_INSPECTOR_TOGGLE; - if (options) { - try { - const parsed = JSON.parse(options); - const parsedType = typeof parsed; - if (parsedType === 'boolean') { - return parsed; - } else if (parsedType === 'object') { - if (Array.isArray(parsed)) { - throw new Error('invalid type, expected object map but got array'); - } - const parsedKeys = Object.keys(parsed); - const defaultKeys = Object.keys(defaultInspectorOptions); - const unknownKeys = parsedKeys.filter((k) => !defaultKeys.includes(k)); - if (unknownKeys.length) { - config.logger.warn( - `[vite-plugin-svelte-inspector] ignoring unknown options in environment SVELTE_INSPECTOR_OPTIONS: ${unknownKeys.join( - ', ' - )}` - ); - for (const key of unknownKeys) { - delete parsed[key]; - } - } - debug('loaded environment config', parsed); - return parsed; - } - } catch (e) { - config.logger.error( - `[vite-plugin-svelte-inspector] failed to parse inspector options from environment SVELTE_INSPECTOR_OPTIONS="${options}"\n${e}` - ); - } - } else if (toggle) { - const keyConfig = { - toggleKeyCombo: toggle - }; - debug('loaded environment config', keyConfig); - return keyConfig; - } -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts deleted file mode 100644 index 6849623..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/public.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -export interface Options { - /** - * define a key combo to toggle inspector, - * @default 'meta-shift' on mac, 'control-shift' on other os - * - * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by - - * examples: control-shift, control-o, control-alt-s meta-x control-meta - * Some keys have native behavior (e.g. alt-s opens history menu on firefox). - * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended. - */ - toggleKeyCombo?: string; - - /** - * define keys to select elements with via keyboard - * @default {parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' } - * - * improves accessibility and also helps when you want to select elements that do not have a hoverable surface area - * due to tight wrapping - * - * A note for users of screen-readers: - * If you are using arrow keys to navigate the page itself, change the navKeys to avoid conflicts. - * e.g. navKeys: {parent: 'w', prev: 'a', child: 's', next: 'd'} - * - * - * parent: select closest parent - * child: select first child (or grandchild) - * next: next sibling (or parent if no next sibling exists) - * prev: previous sibling (or parent if no prev sibling exists) - */ - navKeys?: { parent: string; child: string; next: string; prev: string }; - - /** - * define key to open the editor for the currently selected dom node - * - * @default 'Enter' - */ - openKey?: string; - - /** - * define keys to close the inspector - * @default ['Backspace', 'Escape'] - */ - escapeKeys?: string[]; - - /** - * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress - * @default true - */ - holdMode?: boolean; - - /** - * when to show the toggle button - * @default 'active' - */ - showToggleButton?: 'always' | 'active' | 'never'; - - /** - * where to display the toggle button - * @default top-right - */ - toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; - - /** - * inject custom styles when inspector is active - */ - customStyles?: boolean; - - /** - * internal options that are automatically set, not to be set or used by users - * @internal - */ - __internal?: { - // vite base url - base: string; - }; -} -// eslint-disable-next-line n/no-missing-import -export * from './index.js'; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte deleted file mode 100644 index 9a03c49..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/Inspector.svelte +++ /dev/null @@ -1,411 +0,0 @@ - - - - -{#if show_toggle} - -{/if} -{#if enabled && active_el && file_loc} - {@const loc = active_el.__svelte_meta.loc} -
- <{active_el.tagName.toLowerCase()}> {file_loc} -
-
- {active_el.tagName.toLowerCase()} in file {loc.file} on line {loc.line} column {loc.column} -
-{/if} - - diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js deleted file mode 100644 index 5662f9f..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/runtime/load-inspector.js +++ /dev/null @@ -1,14 +0,0 @@ -// eslint-disable-next-line n/no-missing-import -import Inspector from 'virtual:svelte-inspector-path:Inspector.svelte'; -import { mount } from 'svelte'; -function create_inspector_host() { - const id = 'svelte-inspector-host'; - if (document.getElementById(id) != null) { - throw new Error('svelte-inspector-host element already exists'); - } - const el = document.createElement('div'); - el.setAttribute('id', id); - document.documentElement.appendChild(el); - return el; -} -mount(Inspector, { target: create_inspector_host() }); diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js deleted file mode 100644 index bcb43f9..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/src/utils.js +++ /dev/null @@ -1,8 +0,0 @@ -const postfixRE = /[?#].*$/s; - -/** - * @param {string} url - */ -export function cleanUrl(url) { - return url.replace(postfixRE, ''); -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts deleted file mode 100644 index 2ee6298..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts +++ /dev/null @@ -1,82 +0,0 @@ -declare module '@sveltejs/vite-plugin-svelte-inspector' { - export interface Options { - /** - * define a key combo to toggle inspector, - * @default 'meta-shift' on mac, 'control-shift' on other os - * - * any number of modifiers `control` `shift` `alt` `meta` followed by zero or one regular key, separated by - - * examples: control-shift, control-o, control-alt-s meta-x control-meta - * Some keys have native behavior (e.g. alt-s opens history menu on firefox). - * To avoid conflicts or accidentally typing into inputs, modifier only combinations are recommended. - */ - toggleKeyCombo?: string; - - /** - * define keys to select elements with via keyboard - * @default {parent: 'ArrowUp', child: 'ArrowDown', next: 'ArrowRight', prev: 'ArrowLeft' } - * - * improves accessibility and also helps when you want to select elements that do not have a hoverable surface area - * due to tight wrapping - * - * A note for users of screen-readers: - * If you are using arrow keys to navigate the page itself, change the navKeys to avoid conflicts. - * e.g. navKeys: {parent: 'w', prev: 'a', child: 's', next: 'd'} - * - * - * parent: select closest parent - * child: select first child (or grandchild) - * next: next sibling (or parent if no next sibling exists) - * prev: previous sibling (or parent if no prev sibling exists) - */ - navKeys?: { parent: string; child: string; next: string; prev: string }; - - /** - * define key to open the editor for the currently selected dom node - * - * @default 'Enter' - */ - openKey?: string; - - /** - * define keys to close the inspector - * @default ['Backspace', 'Escape'] - */ - escapeKeys?: string[]; - - /** - * inspector is automatically disabled when releasing toggleKeyCombo after holding it for a longpress - * @default true - */ - holdMode?: boolean; - - /** - * when to show the toggle button - * @default 'active' - */ - showToggleButton?: 'always' | 'active' | 'never'; - - /** - * where to display the toggle button - * @default top-right - */ - toggleButtonPos?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; - - /** - * inject custom styles when inspector is active - */ - customStyles?: boolean; - - /** - * internal options that are automatically set, not to be set or used by users - * */ - __internal?: { - // vite base url - base: string; - }; - } - export function svelteInspector(options?: Partial): import("vite").Plugin; - - export {}; -} - -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map b/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map deleted file mode 100644 index 08ac045..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte-inspector/types/index.d.ts.map +++ /dev/null @@ -1,17 +0,0 @@ -{ - "version": 3, - "file": "index.d.ts", - "names": [ - "Options", - "svelteInspector" - ], - "sources": [ - "../src/public.d.ts", - "../src/index.js" - ], - "sourcesContent": [ - null, - null - ], - "mappings": ";kBAAiBA,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCoBRC,eAAeA" -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/LICENSE b/web/node_modules/@sveltejs/vite-plugin-svelte/LICENSE deleted file mode 100644 index c1a5d8f..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021 [these people](https://github.com/sveltejs/vite-plugin-svelte/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/README.md b/web/node_modules/@sveltejs/vite-plugin-svelte/README.md deleted file mode 100644 index 48798bc..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# @sveltejs/vite-plugin-svelte - -The official [Svelte](https://svelte.dev) plugin for [Vite](https://vitejs.dev). - -## Usage - -```js -// vite.config.js -import { defineConfig } from 'vite'; -import { svelte } from '@sveltejs/vite-plugin-svelte'; - -export default defineConfig({ - plugins: [ - svelte({ - /* plugin options */ - }) - ] -}); -``` - -## Documentation - -- [Plugin options](../../docs/config.md) -- [FAQ](../../docs/faq.md) - -## License - -[MIT](./LICENSE) diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/package.json b/web/node_modules/@sveltejs/vite-plugin-svelte/package.json deleted file mode 100644 index 3f7c09e..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@sveltejs/vite-plugin-svelte", - "version": "5.1.1", - "license": "MIT", - "author": "dominikg", - "files": [ - "src", - "types" - ], - "type": "module", - "types": "types/index.d.ts", - "exports": { - ".": { - "import": { - "types": "./types/index.d.ts", - "default": "./src/index.js" - } - } - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/sveltejs/vite-plugin-svelte.git", - "directory": "packages/vite-plugin-svelte" - }, - "keywords": [ - "vite-plugin", - "vite plugin", - "vite", - "svelte" - ], - "bugs": { - "url": "https://github.com/sveltejs/vite-plugin-svelte/issues" - }, - "homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme", - "dependencies": { - "@sveltejs/vite-plugin-svelte-inspector": "^4.0.1", - "debug": "^4.4.1", - "deepmerge": "^4.3.1", - "kleur": "^4.1.5", - "magic-string": "^0.30.17", - "vitefu": "^1.0.6" - }, - "peerDependencies": { - "svelte": "^5.0.0", - "vite": "^6.0.0" - }, - "devDependencies": { - "@types/debug": "^4.1.12", - "sass": "^1.89.0", - "svelte": "^5.33.3", - "vite": "^6.3.5" - }, - "scripts": { - "check:publint": "publint --strict", - "check:types": "tsc --noEmit", - "generate:types": "dts-buddy -m \"@sveltejs/vite-plugin-svelte:src/public.d.ts\"" - } -} \ No newline at end of file diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/handle-hot-update.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/handle-hot-update.js deleted file mode 100644 index 82758e5..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/handle-hot-update.js +++ /dev/null @@ -1,145 +0,0 @@ -import { log, logCompilerWarnings } from './utils/log.js'; -import { toRollupError } from './utils/error.js'; - -/** - * Vite-specific HMR handling - * - * @param {Function} compileSvelte - * @param {import('vite').HmrContext} ctx - * @param {import('./types/id.d.ts').SvelteRequest} svelteRequest - * @param {import('./utils/vite-plugin-svelte-cache.js').VitePluginSvelteCache} cache - * @param {import('./types/options.d.ts').ResolvedOptions} options - * @returns {Promise} - */ -export async function handleHotUpdate(compileSvelte, ctx, svelteRequest, cache, options) { - if (!cache.has(svelteRequest)) { - // file hasn't been requested yet (e.g. async component) - log.debug( - `handleHotUpdate called before initial transform for ${svelteRequest.id}`, - undefined, - 'hmr' - ); - return; - } - const { read, server, modules } = ctx; - - const cachedJS = cache.getJS(svelteRequest); - const cachedCss = cache.getCSS(svelteRequest); - - const content = await read(); - /** @type {import('./types/compile.d.ts').CompileData} */ - let compileData; - try { - compileData = await compileSvelte(svelteRequest, content, options); - cache.update(compileData); - } catch (e) { - cache.setError(svelteRequest, e); - throw toRollupError(e, options); - } - - const affectedModules = [...modules]; - - const cssIdx = modules.findIndex((m) => m.id === svelteRequest.cssId); - if (cssIdx > -1) { - const cssUpdated = cssChanged(cachedCss, compileData.compiled.css); - if (!cssUpdated) { - log.debug(`skipping unchanged css for ${svelteRequest.cssId}`, undefined, 'hmr'); - affectedModules.splice(cssIdx, 1); - } - } - const jsIdx = modules.findIndex((m) => m.id === svelteRequest.id); - if (jsIdx > -1) { - const jsUpdated = jsChanged(cachedJS, compileData.compiled.js, svelteRequest.filename); - if (!jsUpdated) { - log.debug(`skipping unchanged js for ${svelteRequest.id}`, undefined, 'hmr'); - affectedModules.splice(jsIdx, 1); - // transform won't be called, log warnings here - logCompilerWarnings(svelteRequest, compileData.compiled.warnings, options); - } - } - - // TODO is this enough? see also: https://github.com/vitejs/vite/issues/2274 - const ssrModulesToInvalidate = affectedModules.filter((m) => !!m.ssrTransformResult); - if (ssrModulesToInvalidate.length > 0) { - log.debug( - `invalidating modules ${ssrModulesToInvalidate.map((m) => m.id).join(', ')}`, - undefined, - 'hmr' - ); - ssrModulesToInvalidate.forEach((moduleNode) => server.moduleGraph.invalidateModule(moduleNode)); - } - if (affectedModules.length > 0) { - log.debug( - `handleHotUpdate for ${svelteRequest.id} result: ${affectedModules - .map((m) => m.id) - .join(', ')}`, - undefined, - 'hmr' - ); - } - return affectedModules; -} - -/** - * @param {import('./types/compile.d.ts').Code | null} [prev] - * @param {import('./types/compile.d.ts').Code | null} [next] - * @returns {boolean} - */ -function cssChanged(prev, next) { - return !isCodeEqual(prev?.code, next?.code); -} - -/** - * @param {import('./types/compile.d.ts').Code | null} [prev] - * @param {import('./types/compile.d.ts').Code | null} [next] - * @param {string} [filename] - * @returns {boolean} - */ -function jsChanged(prev, next, filename) { - const prevJs = prev?.code; - const nextJs = next?.code; - const isStrictEqual = isCodeEqual(prevJs, nextJs); - if (isStrictEqual) { - return false; - } - const isLooseEqual = isCodeEqual(normalizeJsCode(prevJs), normalizeJsCode(nextJs)); - if (!isStrictEqual && isLooseEqual) { - log.debug( - `ignoring compiler output js change for ${filename} as it is equal to previous output after normalization`, - undefined, - 'hmr' - ); - } - return !isLooseEqual; -} - -/** - * @param {string} [prev] - * @param {string} [next] - * @returns {boolean} - */ -function isCodeEqual(prev, next) { - if (!prev && !next) { - return true; - } - if ((!prev && next) || (prev && !next)) { - return false; - } - return prev === next; -} - -/** - * remove code that only changes metadata and does not require a js update for the component to keep working - * - * 1) add_location() calls. These add location metadata to elements, only used by some dev tools - * 2) ... maybe more (or less) in the future - * - * @param {string} [code] - * @returns {string | undefined} - */ -function normalizeJsCode(code) { - if (!code) { - return code; - } - return code.replace(/\s*\badd_location\s*\([^)]*\)\s*;?/g, ''); -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/index.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/index.js deleted file mode 100644 index aed46b8..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/index.js +++ /dev/null @@ -1,243 +0,0 @@ -import fs from 'node:fs'; -import process from 'node:process'; -import { svelteInspector } from '@sveltejs/vite-plugin-svelte-inspector'; -import { handleHotUpdate } from './handle-hot-update.js'; -import { log, logCompilerWarnings } from './utils/log.js'; -import { createCompileSvelte } from './utils/compile.js'; -import { buildIdParser, buildModuleIdParser } from './utils/id.js'; -import { - buildExtraViteConfig, - validateInlineOptions, - resolveOptions, - patchResolvedViteConfig, - preResolveOptions, - ensureConfigEnvironmentMainFields, - ensureConfigEnvironmentConditions -} from './utils/options.js'; -import { ensureWatchedFile, setupWatchers } from './utils/watch.js'; -import { toRollupError } from './utils/error.js'; -import { saveSvelteMetadata } from './utils/optimizer.js'; -import { VitePluginSvelteCache } from './utils/vite-plugin-svelte-cache.js'; -import { loadRaw } from './utils/load-raw.js'; -import * as svelteCompiler from 'svelte/compiler'; - -/** - * @param {Partial} [inlineOptions] - * @returns {import('vite').Plugin[]} - */ -export function svelte(inlineOptions) { - if (process.env.DEBUG != null) { - log.setLevel('debug'); - } - validateInlineOptions(inlineOptions); - const cache = new VitePluginSvelteCache(); - // updated in configResolved hook - /** @type {import('./types/id.d.ts').IdParser} */ - let requestParser; - /** @type {import('./types/id.d.ts').ModuleIdParser} */ - let moduleRequestParser; - /** @type {import('./types/options.d.ts').ResolvedOptions} */ - let options; - /** @type {import('vite').ResolvedConfig} */ - let viteConfig; - /** @type {import('./types/compile.d.ts').CompileSvelte} */ - let compileSvelte; - /** @type {import('./types/plugin-api.d.ts').PluginAPI} */ - const api = {}; - /** @type {import('vite').Plugin[]} */ - const plugins = [ - { - name: 'vite-plugin-svelte', - // make sure our resolver runs before vite internal resolver to resolve svelte field correctly - enforce: 'pre', - api, - async config(config, configEnv) { - // setup logger - if (process.env.DEBUG) { - log.setLevel('debug'); - } else if (config.logLevel) { - log.setLevel(config.logLevel); - } - // @ts-expect-error temporarily lend the options variable until fixed in configResolved - options = await preResolveOptions(inlineOptions, config, configEnv); - // extra vite config - const extraViteConfig = await buildExtraViteConfig(options, config); - log.debug('additional vite config', extraViteConfig, 'config'); - return extraViteConfig; - }, - - configEnvironment(name, config, opts) { - ensureConfigEnvironmentMainFields(name, config, opts); - // @ts-expect-error the function above should make `resolve.mainFields` non-nullable - config.resolve.mainFields.unshift('svelte'); - - ensureConfigEnvironmentConditions(name, config, opts); - // @ts-expect-error the function above should make `resolve.conditions` non-nullable - config.resolve.conditions.push('svelte'); - }, - - async configResolved(config) { - options = resolveOptions(options, config, cache); - patchResolvedViteConfig(config, options); - requestParser = buildIdParser(options); - compileSvelte = createCompileSvelte(); - viteConfig = config; - // TODO deep clone to avoid mutability from outside? - api.options = options; - log.debug('resolved options', options, 'config'); - }, - - async buildStart() { - if (!options.prebundleSvelteLibraries) return; - const isSvelteMetadataChanged = await saveSvelteMetadata(viteConfig.cacheDir, options); - if (isSvelteMetadataChanged) { - // Force Vite to optimize again. Although we mutate the config here, it works because - // Vite's optimizer runs after `buildStart()`. - viteConfig.optimizeDeps.force = true; - } - }, - - configureServer(server) { - options.server = server; - setupWatchers(options, cache, requestParser); - }, - - async load(id, opts) { - const ssr = !!opts?.ssr; - const svelteRequest = requestParser(id, !!ssr); - if (svelteRequest) { - const { filename, query, raw } = svelteRequest; - if (raw) { - const code = await loadRaw(svelteRequest, compileSvelte, options); - // prevent vite from injecting sourcemaps in the results. - return { - code, - map: { - mappings: '' - } - }; - } else { - if (query.svelte && query.type === 'style') { - const cachedCss = cache.getCSS(svelteRequest); - if (cachedCss) { - const { hasGlobal, ...css } = cachedCss; - if (hasGlobal === false) { - // hasGlobal was added in svelte 5.26.0, so make sure it is boolean false - css.meta ??= {}; - css.meta.vite ??= {}; - css.meta.vite.cssScopeTo = [svelteRequest.filename, 'default']; - } - return css; - } - } - // prevent vite asset plugin from loading files as url that should be compiled in transform - if (viteConfig.assetsInclude(filename)) { - log.debug(`load returns raw content for ${filename}`, undefined, 'load'); - return fs.readFileSync(filename, 'utf-8'); - } - } - } - }, - - async resolveId(importee, importer, opts) { - const ssr = !!opts?.ssr; - const svelteRequest = requestParser(importee, ssr); - if (svelteRequest?.query.svelte) { - if ( - svelteRequest.query.type === 'style' && - !svelteRequest.raw && - !svelteRequest.query.inline - ) { - // return cssId with root prefix so postcss pipeline of vite finds the directory correctly - // see https://github.com/sveltejs/vite-plugin-svelte/issues/14 - log.debug( - `resolveId resolved virtual css module ${svelteRequest.cssId}`, - undefined, - 'resolve' - ); - return svelteRequest.cssId; - } - } - }, - - async transform(code, id, opts) { - const ssr = !!opts?.ssr; - const svelteRequest = requestParser(id, ssr); - if (!svelteRequest || svelteRequest.query.type === 'style' || svelteRequest.raw) { - return; - } - let compileData; - try { - compileData = await compileSvelte(svelteRequest, code, options); - } catch (e) { - cache.setError(svelteRequest, e); - throw toRollupError(e, options); - } - logCompilerWarnings(svelteRequest, compileData.compiled.warnings, options); - cache.update(compileData); - if (compileData.dependencies?.length) { - if (options.server) { - for (const dep of compileData.dependencies) { - ensureWatchedFile(options.server.watcher, dep, options.root); - } - } else if (options.isBuild && viteConfig.build.watch) { - for (const dep of compileData.dependencies) { - this.addWatchFile(dep); - } - } - } - return { - ...compileData.compiled.js, - meta: { - vite: { - lang: compileData.lang - } - } - }; - }, - - handleHotUpdate(ctx) { - if (!options.compilerOptions.hmr || !options.emitCss) { - return; - } - const svelteRequest = requestParser(ctx.file, false, ctx.timestamp); - if (svelteRequest) { - return handleHotUpdate(compileSvelte, ctx, svelteRequest, cache, options); - } - }, - async buildEnd() { - await options.stats?.finishAll(); - } - }, - { - name: 'vite-plugin-svelte-module', - enforce: 'post', - async configResolved() { - moduleRequestParser = buildModuleIdParser(options); - }, - async transform(code, id, opts) { - const ssr = !!opts?.ssr; - const moduleRequest = moduleRequestParser(id, ssr); - if (!moduleRequest) { - return; - } - try { - const compileResult = svelteCompiler.compileModule(code, { - dev: !viteConfig.isProduction, - generate: ssr ? 'server' : 'client', - filename: moduleRequest.filename - }); - logCompilerWarnings(moduleRequest, compileResult.warnings, options); - return compileResult.js; - } catch (e) { - throw toRollupError(e, options); - } - } - }, - svelteInspector() - ]; - return plugins; -} - -export { vitePreprocess } from './preprocess.js'; -export { loadSvelteConfig } from './utils/load-svelte-config.js'; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/preprocess.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/preprocess.js deleted file mode 100644 index d63ea23..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/preprocess.js +++ /dev/null @@ -1,124 +0,0 @@ -import process from 'node:process'; -import { isCSSRequest, preprocessCSS, resolveConfig, transformWithEsbuild } from 'vite'; -import { mapToRelative, removeLangSuffix } from './utils/sourcemaps.js'; - -/** - * @typedef {(code: string, filename: string) => Promise<{ code: string; map?: any; deps?: Set }>} CssTransform - */ - -const supportedScriptLangs = ['ts']; - -export const lang_sep = '.vite-preprocess'; - -/** - * @param {import('./public.d.ts').VitePreprocessOptions} [opts] - * @returns {import('svelte/compiler').PreprocessorGroup} - */ -export function vitePreprocess(opts) { - /** @type {import('svelte/compiler').PreprocessorGroup} */ - const preprocessor = { name: 'vite-preprocess' }; - if (opts?.script === true) { - preprocessor.script = viteScript().script; - } - if (opts?.style !== false) { - const styleOpts = typeof opts?.style == 'object' ? opts?.style : undefined; - preprocessor.style = viteStyle(styleOpts).style; - } - return preprocessor; -} - -/** - * @returns {{ script: import('svelte/compiler').Preprocessor }} - */ -function viteScript() { - return { - async script({ attributes, content, filename = '' }) { - const lang = /** @type {string} */ (attributes.lang); - if (!supportedScriptLangs.includes(lang)) return; - const { code, map } = await transformWithEsbuild(content, filename, { - loader: /** @type {import('vite').ESBuildOptions['loader']} */ (lang), - target: 'esnext', - tsconfigRaw: { - compilerOptions: { - // svelte typescript needs this flag to work with type imports - importsNotUsedAsValues: 'preserve', - preserveValueImports: true - } - } - }); - - mapToRelative(map, filename); - - return { - code, - map - }; - } - }; -} - -/** - * @param {import('vite').ResolvedConfig | import('vite').InlineConfig} config - * @returns {{ style: import('svelte/compiler').Preprocessor }} - */ -function viteStyle(config = {}) { - /** @type {Promise | CssTransform} */ - let cssTransform; - /** @type {import('svelte/compiler').Preprocessor} */ - const style = async ({ attributes, content, filename = '' }) => { - const ext = attributes.lang ? `.${attributes.lang}` : '.css'; - if (attributes.lang && !isCSSRequest(ext)) return; - if (!cssTransform) { - cssTransform = createCssTransform(style, config).then((t) => (cssTransform = t)); - } - const transform = await cssTransform; - const suffix = `${lang_sep}${ext}`; - const moduleId = `${filename}${suffix}`; - const { code, map, deps } = await transform(content, moduleId); - removeLangSuffix(map, suffix); - mapToRelative(map, filename); - const dependencies = deps ? Array.from(deps).filter((d) => !d.endsWith(suffix)) : undefined; - return { - code, - map: map ?? undefined, - dependencies - }; - }; - // @ts-expect-error tag so can be found by v-p-s - style.__resolvedConfig = null; - return { style }; -} - -/** - * @param {import('svelte/compiler').Preprocessor} style - * @param {import('vite').ResolvedConfig | import('vite').InlineConfig} config - * @returns {Promise} - */ -async function createCssTransform(style, config) { - /** @type {import('vite').ResolvedConfig} */ - let resolvedConfig; - // @ts-expect-error special prop added if running in v-p-s - if (style.__resolvedConfig) { - // @ts-expect-error not typed - resolvedConfig = style.__resolvedConfig; - } else if (isResolvedConfig(config)) { - resolvedConfig = config; - } else { - // default to "build" if no NODE_ENV is set to avoid running in dev mode for svelte-check etc. - const useBuild = !process.env.NODE_ENV || process.env.NODE_ENV === 'production'; - const command = useBuild ? 'build' : 'serve'; - const defaultMode = useBuild ? 'production' : 'development'; - resolvedConfig = await resolveConfig(config, command, defaultMode, defaultMode, false); - } - return async (code, filename) => { - return preprocessCSS(code, filename, resolvedConfig); - }; -} - -/** - * @param {any} config - * @returns {config is import('vite').ResolvedConfig} - */ -function isResolvedConfig(config) { - return !!config.inlineConfig; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/public.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/public.d.ts deleted file mode 100644 index 6335e1a..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/public.d.ts +++ /dev/null @@ -1,210 +0,0 @@ -import type { InlineConfig, ResolvedConfig } from 'vite'; -import type { CompileOptions, Warning, PreprocessorGroup } from 'svelte/compiler'; -import type { Options as InspectorOptions } from '@sveltejs/vite-plugin-svelte-inspector'; - -export type Options = Omit & PluginOptionsInline; - -interface PluginOptionsInline extends PluginOptions { - /** - * Path to a svelte config file, either absolute or relative to Vite root - * - * set to `false` to ignore the svelte config file - * - * @see https://vitejs.dev/config/#root - */ - configFile?: string | false; -} - -export interface PluginOptions { - /** - * A `picomatch` pattern, or array of patterns, which specifies the files the plugin should - * operate on. By default, all svelte files are included. - * - * @see https://github.com/micromatch/picomatch - */ - include?: Arrayable; - /** - * A `picomatch` pattern, or array of patterns, which specifies the files to be ignored by the - * plugin. By default, no files are ignored. - * - * @see https://github.com/micromatch/picomatch - */ - exclude?: Arrayable; - /** - * Emit Svelte styles as virtual CSS files for Vite and other plugins to process - * - * @default true - */ - emitCss?: boolean; - /** - * Enable or disable Hot Module Replacement. - * Deprecated, use compilerOptions.hmr instead! - * - * @deprecated - * @default true for development, always false for production - */ - hot?: boolean; - - /** - * Some Vite plugins can contribute additional preprocessors by defining `api.sveltePreprocess`. - * If you don't want to use them, set this to true to ignore them all or use an array of strings - * with plugin names to specify which. - * - * @default false - */ - ignorePluginPreprocessors?: boolean | string[]; - /** - * vite-plugin-svelte automatically handles excluding svelte libraries and reinclusion of their dependencies - * in vite.optimizeDeps. - * - * `disableDependencyReinclusion: true` disables all reinclusions - * `disableDependencyReinclusion: ['foo','bar']` disables reinclusions for dependencies of foo and bar - * - * This should be used for hybrid packages that contain both node and browser dependencies, eg Routify - * - * @default false - */ - disableDependencyReinclusion?: boolean | string[]; - /** - * Enable support for Vite's dependency optimization to prebundle Svelte libraries. - * - * To disable prebundling for a specific library, add it to `optimizeDeps.exclude`. - * - * @default true for dev, false for build - */ - prebundleSvelteLibraries?: boolean; - /** - * toggle/configure Svelte Inspector - * - * @default unset for dev, always false for build - */ - inspector?: InspectorOptions | boolean; - - /** - * A function to update `compilerOptions` before compilation - * - * `data.filename` - The file to be compiled - * `data.code` - The preprocessed Svelte code - * `data.compileOptions` - The current compiler options - * - * To change part of the compiler options, return an object with the changes you need. - * - * @example - * ``` - * ({ filename, compileOptions }) => { - * // Dynamically set runes mode per Svelte file - * if (forceRunesMode(filename) && !compileOptions.runes) { - * return { runes: true }; - * } - * } - * ``` - */ - dynamicCompileOptions?: (data: { - filename: string; - code: string; - compileOptions: Partial; - }) => Promise | void> | Partial | void; - - /** - * These options are considered experimental and breaking changes to them can occur in any release - */ - experimental?: ExperimentalOptions; -} - -export interface SvelteConfig { - /** - * A list of file extensions to be compiled by Svelte - * - * @default ['.svelte'] - */ - extensions?: string[]; - /** - * An array of preprocessors to transform the Svelte source code before compilation - * - * @see https://svelte.dev/docs#svelte_preprocess - */ - preprocess?: Arrayable; - /** - * The options to be passed to the Svelte compiler. A few options are set by default, - * including `dev` and `css`. However, some options are non-configurable, like - * `filename`, `format`, `generate`, and `cssHash` (in dev). - * - * @see https://svelte.dev/docs#svelte_compile - */ - compilerOptions?: Omit; - - /** - * Handles warning emitted from the Svelte compiler - * - * warnings emitted for files in node_modules are logged at the debug level, to see them run - * `DEBUG=vite-plugin-svelte:node-modules-onwarn pnpm build` - * - * @example - * ``` - * (warning, defaultHandler) => { - * // ignore some warnings - * if (!['foo','bar'].includes(warning.code)) { - * defaultHandler(warning); - * } - * } - * ``` - * - */ - onwarn?: (warning: Warning, defaultHandler: (warning: Warning) => void) => void; - /** - * Options for vite-plugin-svelte - */ - vitePlugin?: PluginOptions; -} - -/** - * These options are considered experimental and breaking changes to them can occur in any release - */ -interface ExperimentalOptions { - /** - * send a websocket message with svelte compiler warnings during dev - * - */ - sendWarningsToBrowser?: boolean; - /** - * disable svelte field resolve warnings - * - * @default false - */ - disableSvelteResolveWarnings?: boolean; - - compileModule?: CompileModuleOptions; -} - -interface CompileModuleOptions { - /** - * infix that must be present in filename - * @default ['.svelte.'] - */ - infixes?: string[]; - /** - * module extensions - * @default ['.ts','.js'] - */ - extensions?: string[]; - include?: Arrayable; - exclude?: Arrayable; -} - -type Arrayable = T | T[]; - -export interface VitePreprocessOptions { - /** - * preprocess script block with vite pipeline. - * Since svelte5 this is not needed for typescript anymore - * - * @default false - */ - script?: boolean; - /** - * preprocess style blocks with vite pipeline - */ - style?: boolean | InlineConfig | ResolvedConfig; -} -// eslint-disable-next-line n/no-missing-import -export * from './index.js'; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/compile.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/compile.d.ts deleted file mode 100644 index 1f28fcf..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/compile.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { Processed, CompileResult } from 'svelte/compiler'; -import type { SvelteRequest } from './id.d.ts'; -import type { ResolvedOptions } from './options.d.ts'; -import type { CustomPluginOptionsVite } from 'vite'; - -export type CompileSvelte = ( - svelteRequest: SvelteRequest, - code: string, - options: Partial -) => Promise; - -export interface Code { - code: string; - map?: any; - dependencies?: any[]; - hasGlobal?: boolean; - meta?: { - vite?: CustomPluginOptionsVite; - }; -} - -export interface CompileData { - filename: string; - normalizedFilename: string; - lang: string; - compiled: CompileResult; - ssr: boolean | undefined; - dependencies: string[]; - preprocessed: Processed; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/id.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/id.d.ts deleted file mode 100644 index bbd4dd4..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/id.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import type { CompileOptions } from 'svelte/compiler'; - -export type SvelteQueryTypes = 'style' | 'script' | 'preprocessed' | 'all'; - -export interface RequestQuery { - // our own - svelte?: boolean; - type?: SvelteQueryTypes; - sourcemap?: boolean; - compilerOptions?: Pick< - CompileOptions, - 'generate' | 'dev' | 'css' | 'customElement' | 'immutable' - >; - // vite specific - url?: boolean; - raw?: boolean; - direct?: boolean; - inline?: boolean; -} - -export interface SvelteRequest { - id: string; - cssId: string; - filename: string; - normalizedFilename: string; - query: RequestQuery; - timestamp: number; - ssr: boolean; - raw: boolean; -} - -export interface SvelteModuleRequest { - id: string; - filename: string; - normalizedFilename: string; - query: RequestQuery; - timestamp: number; - ssr: boolean; -} - -export type IdParser = (id: string, ssr: boolean, timestamp?: number) => SvelteRequest | undefined; -export type ModuleIdParser = ( - id: string, - ssr: boolean, - timestamp?: number -) => SvelteModuleRequest | undefined; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/log.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/log.d.ts deleted file mode 100644 index fd4f13e..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/log.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import type { Warning } from 'svelte/compiler'; - -export interface LogFn extends SimpleLogFn { - (message: string, payload?: unknown, namespace?: string): void; - - enabled: boolean; - once: SimpleLogFn; -} - -export interface SimpleLogFn { - (message: string, payload?: unknown, namespace?: string): void; -} - -export type SvelteWarningsMessage = { - id: string; - filename: string; - normalizedFilename: string; - timestamp: number; - warnings: Warning[]; // allWarnings filtered by warnings where onwarn did not call the default handler - allWarnings: Warning[]; // includes warnings filtered by onwarn and our extra vite plugin svelte warnings - rawWarnings: Warning[]; // raw compiler output -}; - -export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent'; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/options.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/options.d.ts deleted file mode 100644 index 5b4ca42..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/options.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { CompileOptions } from 'svelte/compiler'; -import type { ViteDevServer } from 'vite'; -// eslint-disable-next-line n/no-missing-import -import { VitePluginSvelteStats } from '../utils/vite-plugin-svelte-stats.js'; -import type { Options } from '../public.d.ts'; - -export interface PreResolvedOptions extends Options { - // these options are non-nullable after resolve - compilerOptions: CompileOptions; - // extra options - root: string; - isBuild: boolean; - isServe: boolean; - isDebug: boolean; -} - -export interface ResolvedOptions extends PreResolvedOptions { - isProduction: boolean; - server?: ViteDevServer; - stats?: VitePluginSvelteStats; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/plugin-api.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/plugin-api.d.ts deleted file mode 100644 index 36c42b6..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/plugin-api.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ResolvedOptions } from './options.d.ts'; - -export interface PluginAPI { - /** - * must not be modified, should not be used outside of vite-plugin-svelte repo - * @internal - * @experimental - */ - options?: ResolvedOptions; - // TODO expose compile cache here so other utility plugins can use it -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/vite-plugin-svelte-stats.d.ts b/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/vite-plugin-svelte-stats.d.ts deleted file mode 100644 index 1b69ebd..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/types/vite-plugin-svelte-stats.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -export interface Stat { - file: string; - pkg?: string; - start: number; - end: number; -} - -export interface StatCollection { - name: string; - options: CollectionOptions; - - start: (file: string) => () => void; - stats: Stat[]; - packageStats?: PackageStats[]; - collectionStart: number; - duration?: number; - finish: () => Promise | void; - finished: boolean; -} - -export interface PackageStats { - pkg: string; - files: number; - duration: number; -} - -export interface CollectionOptions { - logInProgress: (collection: StatCollection, now: number) => boolean; - logResult: (collection: StatCollection) => boolean; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/compile.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/compile.js deleted file mode 100644 index f7999fe..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/compile.js +++ /dev/null @@ -1,191 +0,0 @@ -import * as svelte from 'svelte/compiler'; -import { safeBase64Hash } from './hash.js'; -import { log } from './log.js'; - -import { - checkPreprocessDependencies, - createInjectScopeEverythingRulePreprocessorGroup -} from './preprocess.js'; -import { mapToRelative } from './sourcemaps.js'; -import { enhanceCompileError } from './error.js'; - -// TODO this is a patched version of https://github.com/sveltejs/vite-plugin-svelte/pull/796/files#diff-3bce0b33034aad4b35ca094893671f7e7ddf4d27254ae7b9b0f912027a001b15R10 -// which is closer to the other regexes in at least not falling into commented script -// but ideally would be shared exactly with svelte and other tools that use it -const scriptLangRE = - /|]*|(?:[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)\s+)*)lang=(["'])?([^"' >]+)\1[^>]*>/g; - -/** - * @returns {import('../types/compile.d.ts').CompileSvelte} - */ -export function createCompileSvelte() { - /** @type {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection | undefined} */ - let stats; - const devStylePreprocessor = createInjectScopeEverythingRulePreprocessorGroup(); - /** @type {import('../types/compile.d.ts').CompileSvelte} */ - return async function compileSvelte(svelteRequest, code, options) { - const { filename, normalizedFilename, cssId, ssr, raw } = svelteRequest; - const { emitCss = true } = options; - /** @type {string[]} */ - const dependencies = []; - /** @type {import('svelte/compiler').Warning[]} */ - const warnings = []; - - if (options.stats) { - if (options.isBuild) { - if (!stats) { - // build is either completely ssr or csr, create stats collector on first compile - // it is then finished in the buildEnd hook. - stats = options.stats.startCollection(`${ssr ? 'ssr' : 'dom'} compile`, { - logInProgress: () => false - }); - } - } else { - // dev time ssr, it's a ssr request and there are no stats, assume new page load and start collecting - if (ssr && !stats) { - stats = options.stats.startCollection('ssr compile'); - } - // stats are being collected but this isn't an ssr request, assume page loaded and stop collecting - if (!ssr && stats) { - stats.finish(); - stats = undefined; - } - // TODO find a way to trace dom compile during dev - // problem: we need to call finish at some point but have no way to tell if page load finished - // also they for hmr updates too - } - } - /** @type {import('svelte/compiler').CompileOptions} */ - const compileOptions = { - ...options.compilerOptions, - filename, - generate: ssr ? 'server' : 'client' - }; - - if (compileOptions.hmr && options.emitCss) { - const hash = `s-${safeBase64Hash(normalizedFilename)}`; - compileOptions.cssHash = () => hash; - } - - let preprocessed; - let preprocessors = options.preprocess; - if (!options.isBuild && options.emitCss && compileOptions.hmr) { - // inject preprocessor that ensures css hmr works better - if (!Array.isArray(preprocessors)) { - preprocessors = preprocessors - ? [preprocessors, devStylePreprocessor] - : [devStylePreprocessor]; - } else { - preprocessors = preprocessors.concat(devStylePreprocessor); - } - } - if (preprocessors) { - try { - preprocessed = await svelte.preprocess(code, preprocessors, { filename }); // full filename here so postcss works - } catch (e) { - e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`; - throw e; - } - - if (preprocessed.dependencies?.length) { - const checked = checkPreprocessDependencies(filename, preprocessed.dependencies); - if (checked.warnings.length) { - warnings.push(...checked.warnings); - } - if (checked.dependencies.length) { - dependencies.push(...checked.dependencies); - } - } - - if (preprocessed.map) compileOptions.sourcemap = preprocessed.map; - } - if (typeof preprocessed?.map === 'object') { - mapToRelative(preprocessed?.map, filename); - } - if (raw && svelteRequest.query.type === 'preprocessed') { - // @ts-expect-error shortcut - return /** @type {import('../types/compile.d.ts').CompileData} */ { - preprocessed: preprocessed ?? { code } - }; - } - const finalCode = preprocessed ? preprocessed.code : code; - const dynamicCompileOptions = await options?.dynamicCompileOptions?.({ - filename, - code: finalCode, - compileOptions - }); - if (dynamicCompileOptions && log.debug.enabled) { - log.debug( - `dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`, - undefined, - 'compile' - ); - } - const finalCompileOptions = dynamicCompileOptions - ? { - ...compileOptions, - ...dynamicCompileOptions - } - : compileOptions; - const endStat = stats?.start(filename); - /** @type {import('svelte/compiler').CompileResult} */ - let compiled; - try { - compiled = svelte.compile(finalCode, { ...finalCompileOptions, filename }); - - // patch output with partial accept until svelte does it - // TODO remove later - if ( - options.server?.config.experimental.hmrPartialAccept && - compiled.js.code.includes('import.meta.hot.accept(') - ) { - compiled.js.code = compiled.js.code.replaceAll( - 'import.meta.hot.accept(', - 'import.meta.hot.acceptExports(["default"],' - ); - } - } catch (e) { - enhanceCompileError(e, code, preprocessors); - throw e; - } - - if (endStat) { - endStat(); - } - mapToRelative(compiled.js?.map, filename); - mapToRelative(compiled.css?.map, filename); - if (warnings.length) { - if (!compiled.warnings) { - compiled.warnings = []; - } - compiled.warnings.push(...warnings); - } - if (!raw) { - // wire css import and code for hmr - const hasCss = compiled.css?.code?.trim()?.length ?? 0 > 0; - // compiler might not emit css with mode none or it may be empty - if (emitCss && hasCss) { - // TODO properly update sourcemap? - compiled.js.code += `\nimport ${JSON.stringify(cssId)};\n`; - } - } - - let lang = 'js'; - for (const match of code.matchAll(scriptLangRE)) { - if (match[2]) { - lang = match[2]; - break; - } - } - - return { - filename, - normalizedFilename, - lang, - compiled, - ssr, - dependencies, - preprocessed: preprocessed ?? { code } - }; - }; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/constants.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/constants.js deleted file mode 100644 index a69fe55..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/constants.js +++ /dev/null @@ -1,31 +0,0 @@ -import { createRequire } from 'node:module'; - -const sveltePkg = createRequire(import.meta.url)('svelte/package.json'); - -// list of svelte runtime dependencies to optimize together with svelte itself -export const SVELTE_RUNTIME_DEPENDENCIES = [ - 'clsx' // avoids dev server restart after page load with npm + vite6 (see #1067) -].filter((dep) => !!sveltePkg.dependencies?.[dep]); - -export const SVELTE_IMPORTS = Object.entries(sveltePkg.exports) - .map(([name, config]) => { - // ignore type only - if (typeof config === 'object' && Object.keys(config).length === 1 && config.types) { - return ''; - } - // ignore names - if (name === './package.json' || name === './compiler') { - return ''; - } - return name.replace(/^\./, 'svelte'); - }) - .filter((s) => s.length > 0); - -export const SVELTE_EXPORT_CONDITIONS = ['svelte']; - -export const FAQ_LINK_MISSING_EXPORTS_CONDITION = - 'https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#missing-exports-condition'; - -export const DEFAULT_SVELTE_EXT = ['.svelte']; -export const DEFAULT_SVELTE_MODULE_INFIX = ['.svelte.']; -export const DEFAULT_SVELTE_MODULE_EXT = ['.js', '.ts']; diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/dependencies.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/dependencies.js deleted file mode 100644 index 30caf59..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/dependencies.js +++ /dev/null @@ -1,89 +0,0 @@ -import path from 'node:path'; -import fs from 'node:fs/promises'; -import { findDepPkgJsonPath } from 'vitefu'; - -/** - * @typedef {{ - * dir: string; - * pkg: Record; - * }} DependencyData - */ - -/** - * @param {string} dep - * @param {string} parent - * @returns {Promise} - */ -export async function resolveDependencyData(dep, parent) { - const depDataPath = await findDepPkgJsonPath(dep, parent); - if (!depDataPath) return undefined; - try { - return { - dir: path.dirname(depDataPath), - pkg: JSON.parse(await fs.readFile(depDataPath, 'utf-8')) - }; - } catch { - return undefined; - } -} - -const COMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD = [ - '@lukeed/uuid', - '@playwright/test', - '@sveltejs/kit', - '@sveltejs/package', - '@sveltejs/vite-plugin-svelte', - 'autoprefixer', - 'cookie', - 'dotenv', - 'esbuild', - 'eslint', - 'jest', - 'mdsvex', - 'playwright', - 'postcss', - 'prettier', - 'svelte', - 'svelte2tsx', - 'svelte-check', - 'svelte-preprocess', - 'tslib', - 'typescript', - 'vite', - 'vitest', - '__vite-browser-external' // see https://github.com/sveltejs/vite-plugin-svelte/issues/362 -]; -const COMMON_PREFIXES_WITHOUT_SVELTE_FIELD = [ - '@fontsource/', - '@postcss-plugins/', - '@rollup/', - '@sveltejs/adapter-', - '@types/', - '@typescript-eslint/', - 'eslint-', - 'jest-', - 'postcss-plugin-', - 'prettier-plugin-', - 'rollup-plugin-', - 'vite-plugin-' -]; - -/** - * Test for common dependency names that tell us it is not a package including a svelte field, eg. eslint + plugins. - * - * This speeds up the find process as we don't have to try and require the package.json for all of them - * - * @param {string} dependency - * @returns {boolean} true if it is a dependency without a svelte field - */ -export function isCommonDepWithoutSvelteField(dependency) { - return ( - COMMON_DEPENDENCIES_WITHOUT_SVELTE_FIELD.includes(dependency) || - COMMON_PREFIXES_WITHOUT_SVELTE_FIELD.some( - (prefix) => - prefix.startsWith('@') - ? dependency.startsWith(prefix) - : dependency.substring(dependency.lastIndexOf('/') + 1).startsWith(prefix) // check prefix omitting @scope/ - ) - ); -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/error.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/error.js deleted file mode 100644 index d34d72f..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/error.js +++ /dev/null @@ -1,164 +0,0 @@ -import { buildExtendedLogMessage } from './log.js'; - -/** - * convert an error thrown by svelte.compile to a RollupError so that vite displays it in a user friendly way - * @param {import('svelte/compiler').Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {import('vite').Rollup.RollupError} the converted error - */ -export function toRollupError(error, options) { - const { filename, frame, start, code, name, stack } = error; - /** @type {import('vite').Rollup.RollupError} */ - const rollupError = { - name, // needed otherwise sveltekit coalesce_to_error turns it into a string - id: filename, - message: buildExtendedLogMessage(error), // include filename:line:column so that it's clickable - frame: formatFrameForVite(frame), - code, - stack: options.isBuild || options.isDebug || !frame ? stack : '' - }; - if (start) { - rollupError.loc = { - line: start.line, - column: start.column, - file: filename - }; - } - return rollupError; -} - -/** - * convert an error thrown by svelte.compile to an esbuild PartialMessage - * @param {import('svelte/compiler').Warning & Error & {frame?: string}} error a svelte compiler error, which is a mix of Warning and an error - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {any} the converted error as esbuild PartialMessage - * - * note: typed any to avoid esbuild devDependency for a single internal type import - */ -export function toESBuildError(error, options) { - const { filename, frame, start, stack } = error; - /** @type any */ - const partialMessage = { - text: buildExtendedLogMessage(error) - }; - if (start) { - partialMessage.location = { - line: start.line, - column: start.column, - file: filename, - lineText: lineFromFrame(start.line, frame) // needed to get a meaningful error message on cli - }; - } - if (options.isBuild || options.isDebug || !frame) { - partialMessage.detail = stack; - } - return partialMessage; -} - -/** - * extract line with number from codeframe - * - * @param {number} lineNo - * @param {string} [frame] - * @returns {string} - */ -function lineFromFrame(lineNo, frame) { - if (!frame) { - return ''; - } - const lines = frame.split('\n'); - const errorLine = lines.find((line) => line.trimStart().startsWith(`${lineNo}: `)); - return errorLine ? errorLine.substring(errorLine.indexOf(': ') + 3) : ''; -} - -/** - * vite error overlay expects a specific format to show frames - * this reformats svelte frame (colon separated, less whitespace) - * to one that vite displays on overlay ( pipe separated, more whitespace) - * e.g. - * ``` - * 1: foo - * 2: bar; - * ^ - * 3: baz - * ``` - * to - * ``` - * 1 | foo - * 2 | bar; - * ^ - * 3 | baz - * ``` - * @see https://github.com/vitejs/vite/blob/96591bf9989529de839ba89958755eafe4c445ae/packages/vite/src/client/overlay.ts#L116 - * @param {string} [frame] - * @returns {string} - */ -function formatFrameForVite(frame) { - if (!frame) { - return ''; - } - return frame - .split('\n') - .map((line) => (line.match(/^\s+\^/) ? ' ' + line : ' ' + line.replace(':', ' | '))) - .join('\n'); -} - -/** - * - * @param {string} code the svelte error code - * @see https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/compiler/errors.js - * @returns {boolean} - */ -function couldBeFixedByCssPreprocessor(code) { - return code === 'expected_token' || code === 'unexpected_eof' || code?.startsWith('css_'); -} - -/** - * @param {import('svelte/compiler').Warning & Error} err a svelte compiler error, which is a mix of Warning and an error - * @param {string} originalCode - * @param {import('../public.d.ts').Options['preprocess']} [preprocessors] - */ -export function enhanceCompileError(err, originalCode, preprocessors) { - preprocessors = arraify(preprocessors ?? []); - - /** @type {string[]} */ - const additionalMessages = []; - - // Handle incorrect CSS preprocessor usage - if (couldBeFixedByCssPreprocessor(err.code)) { - // Reference from Svelte: https://github.com/sveltejs/svelte/blob/9926347ad9dbdd0f3324d5538e25dcb7f5e442f8/packages/svelte/src/compiler/preprocess/index.js#L257 - const styleRe = - /|'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"/]+)*\s*)(?:\/>|>([\S\s]*?)<\/style>)/g; - - let m; - while ((m = styleRe.exec(originalCode))) { - // Warn missing lang attribute - if (!m[1]?.includes('lang=')) { - additionalMessages.push('Did you forget to add a lang attribute to your style tag?'); - } - // Warn missing style preprocessor - if ( - preprocessors.every((p) => p.style == null || p.name === 'inject-scope-everything-rule') - ) { - const preprocessorType = m[1]?.match(/lang="(.+?)"/)?.[1] ?? 'style'; - additionalMessages.push( - `Did you forget to add a ${preprocessorType} preprocessor? See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md for more information.` - ); - } - } - } - - if (additionalMessages.length) { - err.message += '\n\n- ' + additionalMessages.join('\n- '); - } - - return err; -} - -/** - * @param {T | T[]} value - * @template T - */ -function arraify(value) { - return Array.isArray(value) ? value : [value]; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/esbuild.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/esbuild.js deleted file mode 100644 index 5a1ca89..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/esbuild.js +++ /dev/null @@ -1,177 +0,0 @@ -import { readFileSync } from 'node:fs'; -import * as svelte from 'svelte/compiler'; -import { log } from './log.js'; -import { toESBuildError } from './error.js'; -import { safeBase64Hash } from './hash.js'; -import { normalize } from './id.js'; - -/** - * @typedef {NonNullable} EsbuildOptions - * @typedef {NonNullable[number]} EsbuildPlugin - */ - -export const facadeEsbuildSveltePluginName = 'vite-plugin-svelte:facade'; -export const facadeEsbuildSvelteModulePluginName = 'vite-plugin-svelte-module:facade'; - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {EsbuildPlugin} - */ -export function esbuildSveltePlugin(options) { - return { - name: 'vite-plugin-svelte:optimize-svelte', - setup(build) { - // Skip in scanning phase as Vite already handles scanning Svelte files. - // Otherwise this would heavily slow down the scanning phase. - if (build.initialOptions.plugins?.some((v) => v.name === 'vite:dep-scan')) return; - - const filter = /\.svelte(?:\?.*)?$/; - /** @type {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection | undefined} */ - let statsCollection; - build.onStart(() => { - statsCollection = options.stats?.startCollection('prebundle library components', { - logResult: (c) => c.stats.length > 1 - }); - }); - build.onLoad({ filter }, async ({ path: filename }) => { - const code = readFileSync(filename, 'utf8'); - try { - const contents = await compileSvelte(options, { filename, code }, statsCollection); - return { contents }; - } catch (e) { - return { errors: [toESBuildError(e, options)] }; - } - }); - build.onEnd(() => { - statsCollection?.finish(); - }); - } - }; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @param {{ filename: string, code: string }} input - * @param {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection} [statsCollection] - * @returns {Promise} - */ -async function compileSvelte(options, { filename, code }, statsCollection) { - let css = options.compilerOptions.css; - if (css !== 'injected') { - // TODO ideally we'd be able to externalize prebundled styles too, but for now always put them in the js - css = 'injected'; - } - /** @type {import('svelte/compiler').CompileOptions} */ - const compileOptions = { - dev: true, // default to dev: true because prebundling is only used in dev - ...options.compilerOptions, - css, - filename, - generate: 'client' - }; - - if (compileOptions.hmr && options.emitCss) { - const hash = `s-${safeBase64Hash(normalize(filename, options.root))}`; - compileOptions.cssHash = () => hash; - } - - let preprocessed; - - if (options.preprocess) { - try { - preprocessed = await svelte.preprocess(code, options.preprocess, { filename }); - } catch (e) { - e.message = `Error while preprocessing ${filename}${e.message ? ` - ${e.message}` : ''}`; - throw e; - } - if (preprocessed.map) compileOptions.sourcemap = preprocessed.map; - } - - const finalCode = preprocessed ? preprocessed.code : code; - - const dynamicCompileOptions = await options?.dynamicCompileOptions?.({ - filename, - code: finalCode, - compileOptions - }); - - if (dynamicCompileOptions && log.debug.enabled) { - log.debug( - `dynamic compile options for ${filename}: ${JSON.stringify(dynamicCompileOptions)}`, - undefined, - 'compile' - ); - } - - const finalCompileOptions = dynamicCompileOptions - ? { - ...compileOptions, - ...dynamicCompileOptions - } - : compileOptions; - const endStat = statsCollection?.start(filename); - const compiled = svelte.compile(finalCode, finalCompileOptions); - if (endStat) { - endStat(); - } - return compiled.js.map - ? compiled.js.code + '//# sourceMappingURL=' + compiled.js.map.toUrl() - : compiled.js.code; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {EsbuildPlugin} - */ -export function esbuildSvelteModulePlugin(options) { - return { - name: 'vite-plugin-svelte-module:optimize-svelte', - setup(build) { - // Skip in scanning phase as Vite already handles scanning Svelte files. - // Otherwise this would heavily slow down the scanning phase. - if (build.initialOptions.plugins?.some((v) => v.name === 'vite:dep-scan')) return; - - const filter = /\.svelte\.[jt]s(?:\?.*)?$/; - /** @type {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection | undefined} */ - let statsCollection; - build.onStart(() => { - statsCollection = options.stats?.startCollection('prebundle library modules', { - logResult: (c) => c.stats.length > 1 - }); - }); - build.onLoad({ filter }, async ({ path: filename }) => { - const code = readFileSync(filename, 'utf8'); - try { - const contents = await compileSvelteModule(options, { filename, code }, statsCollection); - return { contents }; - } catch (e) { - return { errors: [toESBuildError(e, options)] }; - } - }); - build.onEnd(() => { - statsCollection?.finish(); - }); - } - }; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @param {{ filename: string; code: string }} input - * @param {import('../types/vite-plugin-svelte-stats.d.ts').StatCollection} [statsCollection] - * @returns {Promise} - */ -async function compileSvelteModule(options, { filename, code }, statsCollection) { - const endStat = statsCollection?.start(filename); - const compiled = svelte.compileModule(code, { - dev: options.compilerOptions?.dev ?? true, // default to dev: true because prebundling is only used in dev - filename, - generate: 'client' - }); - if (endStat) { - endStat(); - } - return compiled.js.map - ? compiled.js.code + '//# sourceMappingURL=' + compiled.js.map.toUrl() - : compiled.js.code; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/hash.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/hash.js deleted file mode 100644 index 6d0dad2..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/hash.js +++ /dev/null @@ -1,43 +0,0 @@ -import crypto from 'node:crypto'; - -const hashes = Object.create(null); - -//TODO shorter? -const hash_length = 12; - -/** - * replaces +/= in base64 output so they don't interfere - * - * @param {string} input - * @returns {string} base64 hash safe to use in any context - */ -export function safeBase64Hash(input) { - if (hashes[input]) { - return hashes[input]; - } - //TODO if performance really matters, use a faster one like xx-hash etc. - // should be evenly distributed because short input length and similarities in paths could cause collisions otherwise - // OR DON'T USE A HASH AT ALL, what about a simple counter? - const md5 = crypto.createHash('md5'); - md5.update(input); - const hash = toSafe(md5.digest('base64')).slice(0, hash_length); - hashes[input] = hash; - return hash; -} - -/** @type {Record} */ -const replacements = { - '+': '-', - '/': '_', - '=': '' -}; - -const replaceRE = new RegExp(`[${Object.keys(replacements).join('')}]`, 'g'); - -/** - * @param {string} base64 - * @returns {string} - */ -function toSafe(base64) { - return base64.replace(replaceRE, (x) => replacements[x]); -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/id.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/id.js deleted file mode 100644 index cb420dd..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/id.js +++ /dev/null @@ -1,252 +0,0 @@ -import { createFilter, normalizePath } from 'vite'; -import fs from 'node:fs'; -import path from 'node:path'; -import process from 'node:process'; -import { log } from './log.js'; -import { DEFAULT_SVELTE_MODULE_EXT, DEFAULT_SVELTE_MODULE_INFIX } from './constants.js'; - -const VITE_FS_PREFIX = '/@fs/'; -const IS_WINDOWS = process.platform === 'win32'; - -const SUPPORTED_COMPILER_OPTIONS = ['generate', 'dev', 'css', 'customElement', 'immutable']; -const TYPES_WITH_COMPILER_OPTIONS = ['style', 'script', 'all']; - -/** - * @param {string} id - * @returns {{ filename: string, rawQuery: string }} - */ -function splitId(id) { - const parts = id.split('?', 2); - const filename = parts[0]; - const rawQuery = parts[1]; - return { filename, rawQuery }; -} - -/** - * @param {string} id - * @param {string} filename - * @param {string} rawQuery - * @param {string} root - * @param {number} timestamp - * @param {boolean} ssr - * @returns {import('../types/id.d.ts').SvelteRequest | undefined} - */ -function parseToSvelteRequest(id, filename, rawQuery, root, timestamp, ssr) { - const query = parseRequestQuery(rawQuery); - const rawOrDirect = !!(query.raw || query.direct); - if (query.url || (!query.svelte && rawOrDirect)) { - // skip requests with special vite tags - return; - } - const raw = rawOrDirect; - const normalizedFilename = normalize(filename, root); - const cssId = createVirtualImportId(filename, root, 'style'); - - return { - id, - filename, - normalizedFilename, - cssId, - query, - timestamp, - ssr, - raw - }; -} - -/** - * @param {string} filename - * @param {string} root - * @param {import('../types/id.d.ts').SvelteQueryTypes} type - * @returns {string} - */ -function createVirtualImportId(filename, root, type) { - const parts = ['svelte', `type=${type}`]; - if (type === 'style') { - parts.push('lang.css'); - } - if (existsInRoot(filename, root)) { - filename = root + filename; - } else if (filename.startsWith(VITE_FS_PREFIX)) { - filename = IS_WINDOWS - ? filename.slice(VITE_FS_PREFIX.length) // remove /@fs/ from /@fs/C:/... - : filename.slice(VITE_FS_PREFIX.length - 1); // remove /@fs from /@fs/home/user - } - // return same virtual id format as vite-plugin-vue eg ...App.svelte?svelte&type=style&lang.css - return `${filename}?${parts.join('&')}`; -} - -/** - * @param {string} rawQuery - * @returns {import('../types/id.d.ts').RequestQuery} - */ -function parseRequestQuery(rawQuery) { - const query = Object.fromEntries(new URLSearchParams(rawQuery)); - for (const key in query) { - if (query[key] === '') { - // @ts-expect-error not boolean - query[key] = true; - } - } - const compilerOptions = query.compilerOptions; - if (compilerOptions) { - if (!((query.raw || query.direct) && TYPES_WITH_COMPILER_OPTIONS.includes(query.type))) { - throw new Error( - `Invalid compilerOptions in query ${rawQuery}. CompilerOptions are only supported for raw or direct queries with type in "${TYPES_WITH_COMPILER_OPTIONS.join( - ', ' - )}" e.g. '?svelte&raw&type=script&compilerOptions={"generate":"server","dev":false}` - ); - } - try { - const parsed = JSON.parse(compilerOptions); - const invalid = Object.keys(parsed).filter( - (key) => !SUPPORTED_COMPILER_OPTIONS.includes(key) - ); - if (invalid.length) { - throw new Error( - `Invalid compilerOptions in query ${rawQuery}: ${invalid.join( - ', ' - )}. Supported: ${SUPPORTED_COMPILER_OPTIONS.join(', ')}` - ); - } - query.compilerOptions = parsed; - } catch (e) { - log.error('failed to parse request query compilerOptions', e); - throw e; - } - } - - return /** @type {import('../types/id.d.ts').RequestQuery}*/ query; -} - -/** - * posixify and remove root at start - * - * @param {string} filename - * @param {string} normalizedRoot - * @returns {string} - */ -export function normalize(filename, normalizedRoot) { - return stripRoot(normalizePath(filename), normalizedRoot); -} - -/** - * @param {string} filename - * @param {string} root - * @returns {boolean} - */ -function existsInRoot(filename, root) { - if (filename.startsWith(VITE_FS_PREFIX)) { - return false; // vite already tagged it as out of root - } - return fs.existsSync(root + filename); -} - -/** - * @param {string} normalizedFilename - * @param {string} normalizedRoot - * @returns {string} - */ -function stripRoot(normalizedFilename, normalizedRoot) { - return normalizedFilename.startsWith(normalizedRoot + '/') - ? normalizedFilename.slice(normalizedRoot.length) - : normalizedFilename; -} - -/** - * @param {import('../public.d.ts').Options['include'] | undefined} include - * @param {import('../public.d.ts').Options['exclude'] | undefined} exclude - * @param {string[]} extensions - * @returns {(filename: string) => boolean} - */ -function buildFilter(include, exclude, extensions) { - const rollupFilter = createFilter(include, exclude); - return (filename) => rollupFilter(filename) && extensions.some((ext) => filename.endsWith(ext)); -} - -/** - * @param {import('../public.d.ts').Options['include'] | undefined} include - * @param {import('../public.d.ts').Options['exclude'] | undefined} exclude - * @param {string[]} infixes - * @param {string[]} extensions - * @returns {(filename: string) => boolean} - */ -function buildModuleFilter(include, exclude, infixes, extensions) { - const rollupFilter = createFilter(include, exclude); - return (filename) => { - const basename = path.basename(filename); - - return ( - rollupFilter(filename) && - infixes.some((infix) => basename.includes(infix)) && - extensions.some((ext) => basename.endsWith(ext)) - ); - }; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {import('../types/id.d.ts').IdParser} - */ -export function buildIdParser(options) { - const { include, exclude, extensions, root } = options; - const normalizedRoot = normalizePath(root); - const filter = buildFilter(include, exclude, extensions ?? []); - return (id, ssr, timestamp = Date.now()) => { - const { filename, rawQuery } = splitId(id); - if (filter(filename)) { - return parseToSvelteRequest(id, filename, rawQuery, normalizedRoot, timestamp, ssr); - } - }; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {import('../types/id.d.ts').ModuleIdParser} - */ -export function buildModuleIdParser(options) { - const { - include, - exclude, - infixes = DEFAULT_SVELTE_MODULE_INFIX, - extensions = DEFAULT_SVELTE_MODULE_EXT - } = options?.experimental?.compileModule ?? {}; - const root = options.root; - const normalizedRoot = normalizePath(root); - const filter = buildModuleFilter(include, exclude, infixes, extensions); - return (id, ssr, timestamp = Date.now()) => { - const { filename, rawQuery } = splitId(id); - if (filter(filename)) { - return parseToSvelteModuleRequest(id, filename, rawQuery, normalizedRoot, timestamp, ssr); - } - }; -} - -/** - * @param {string} id - * @param {string} filename - * @param {string} rawQuery - * @param {string} root - * @param {number} timestamp - * @param {boolean} ssr - * @returns {import('../types/id.d.ts').SvelteModuleRequest | undefined} - */ -function parseToSvelteModuleRequest(id, filename, rawQuery, root, timestamp, ssr) { - const query = parseRequestQuery(rawQuery); - - if (query.url || query.raw || query.direct) { - // skip requests with special vite tags - return; - } - - const normalizedFilename = normalize(filename, root); - - return { - id, - filename, - normalizedFilename, - query, - timestamp, - ssr - }; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-raw.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-raw.js deleted file mode 100644 index f800f1b..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-raw.js +++ /dev/null @@ -1,125 +0,0 @@ -import fs from 'node:fs'; -import { toRollupError } from './error.js'; -import { log } from './log.js'; - -/** - * utility function to compile ?raw and ?direct requests in load hook - * - * @param {import('../types/id.d.ts').SvelteRequest} svelteRequest - * @param {import('../types/compile.d.ts').CompileSvelte} compileSvelte - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {Promise} - */ -export async function loadRaw(svelteRequest, compileSvelte, options) { - const { id, filename, query } = svelteRequest; - - // raw svelte subrequest, compile on the fly and return requested subpart - let compileData; - const source = fs.readFileSync(filename, 'utf-8'); - try { - //avoid compileSvelte doing extra ssr stuff unless requested - svelteRequest.ssr = query.compilerOptions?.generate === 'server'; - compileData = await compileSvelte(svelteRequest, source, { - ...options, - // don't use dynamic vite-plugin-svelte defaults here to ensure stable result between ssr,dev and build - compilerOptions: { - dev: false, - css: 'external', - hmr: false, - ...svelteRequest.query.compilerOptions - }, - emitCss: true - }); - } catch (e) { - throw toRollupError(e, options); - } - let result; - if (query.type === 'style') { - result = compileData.compiled.css ?? { code: '', map: null }; - } else if (query.type === 'script') { - result = compileData.compiled.js; - } else if (query.type === 'preprocessed') { - result = compileData.preprocessed; - } else if (query.type === 'all' && query.raw) { - return allToRawExports(compileData, source); - } else { - throw new Error( - `invalid "type=${query.type}" in ${id}. supported are script, style, preprocessed, all` - ); - } - if (query.direct) { - const supportedDirectTypes = ['script', 'style']; - if (!supportedDirectTypes.includes(query.type)) { - throw new Error( - `invalid "type=${ - query.type - }" combined with direct in ${id}. supported are: ${supportedDirectTypes.join(', ')}` - ); - } - log.debug(`load returns direct result for ${id}`, undefined, 'load'); - let directOutput = result.code; - // @ts-expect-error might not be SourceMap but toUrl check should suffice - if (query.sourcemap && result.map?.toUrl) { - // @ts-expect-error toUrl might not exist - const map = `sourceMappingURL=${result.map.toUrl()}`; - if (query.type === 'style') { - directOutput += `\n\n/*# ${map} */\n`; - } else if (query.type === 'script') { - directOutput += `\n\n//# ${map}\n`; - } - } - return directOutput; - } else if (query.raw) { - log.debug(`load returns raw result for ${id}`, undefined, 'load'); - return toRawExports(result); - } else { - throw new Error(`invalid raw mode in ${id}, supported are raw, direct`); - } -} - -/** - * turn compileData and source into a flat list of raw exports - * - * @param {import('../types/compile.d.ts').CompileData} compileData - * @param {string} source - */ -function allToRawExports(compileData, source) { - // flatten CompileData - /** @type {Partial} */ - const exports = { - ...compileData, - ...compileData.compiled, - source - }; - delete exports.compiled; - delete exports.filename; // absolute path, remove to avoid it in output - return toRawExports(exports); -} - -/** - * turn object into raw exports. - * - * every prop is returned as a const export, and if prop 'code' exists it is additionally added as default export - * - * eg {'foo':'bar','code':'baz'} results in - * - * ```js - * export const code='baz' - * export const foo='bar' - * export default code - * ``` - * @param {object} object - * @returns {string} - */ -function toRawExports(object) { - let exports = - Object.entries(object) - .filter(([_key, value]) => typeof value !== 'function') // preprocess output has a toString function that's enumerable - .sort(([a], [b]) => (a < b ? -1 : a === b ? 0 : 1)) - .map(([key, value]) => `export const ${key}=${JSON.stringify(value)}`) - .join('\n') + '\n'; - if (Object.prototype.hasOwnProperty.call(object, 'code')) { - exports += 'export default code\n'; - } - return exports; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-svelte-config.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-svelte-config.js deleted file mode 100644 index 1b32ba4..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/load-svelte-config.js +++ /dev/null @@ -1,122 +0,0 @@ -import { createRequire } from 'node:module'; -import path from 'node:path'; -import process from 'node:process'; -import fs from 'node:fs'; -import { pathToFileURL } from 'node:url'; -import { log } from './log.js'; - -// used to require cjs config in esm. -// NOTE dynamic import() cjs technically works, but timestamp query cache bust -// have no effect, likely because it has another internal cache? -/** @type {NodeRequire}*/ -let esmRequire; - -export const knownSvelteConfigNames = [ - 'svelte.config.js', - 'svelte.config.cjs', - 'svelte.config.mjs' -]; - -/** - * @param {string} filePath - * @param {number} timestamp - */ -async function dynamicImportDefault(filePath, timestamp) { - return await import(filePath + '?t=' + timestamp).then((m) => m.default); -} - -/** - * @param {import('vite').UserConfig} [viteConfig] - * @param {Partial} [inlineOptions] - * @returns {Promise | undefined>} - */ -export async function loadSvelteConfig(viteConfig, inlineOptions) { - if (inlineOptions?.configFile === false) { - return; - } - const configFile = findConfigToLoad(viteConfig, inlineOptions); - if (configFile) { - let err; - // try to use dynamic import for svelte.config.js first - if (configFile.endsWith('.js') || configFile.endsWith('.mjs')) { - try { - const result = await dynamicImportDefault( - pathToFileURL(configFile).href, - fs.statSync(configFile).mtimeMs - ); - if (result != null) { - return { - ...result, - configFile - }; - } else { - throw new Error(`invalid export in ${configFile}`); - } - } catch (e) { - log.error(`failed to import config ${configFile}`, e); - err = e; - } - } - // cjs or error with dynamic import - if (!configFile.endsWith('.mjs')) { - try { - // identify which require function to use (esm and cjs mode) - const _require = import.meta.url - ? (esmRequire ?? (esmRequire = createRequire(import.meta.url))) - : // eslint-disable-next-line no-undef - require; - - // avoid loading cached version on reload - delete _require.cache[_require.resolve(configFile)]; - const result = _require(configFile); - if (result != null) { - return { - ...result, - configFile - }; - } else { - throw new Error(`invalid export in ${configFile}`); - } - } catch (e) { - log.error(`failed to require config ${configFile}`, e); - if (!err) { - err = e; - } - } - } - // failed to load existing config file - throw err; - } -} - -/** - * @param {import('vite').UserConfig | undefined} viteConfig - * @param {Partial | undefined} inlineOptions - * @returns {string | undefined} - */ -function findConfigToLoad(viteConfig, inlineOptions) { - const root = viteConfig?.root || process.cwd(); - if (inlineOptions?.configFile) { - const abolutePath = path.isAbsolute(inlineOptions.configFile) - ? inlineOptions.configFile - : path.resolve(root, inlineOptions.configFile); - if (!fs.existsSync(abolutePath)) { - throw new Error(`failed to find svelte config file ${abolutePath}.`); - } - return abolutePath; - } else { - const existingKnownConfigFiles = knownSvelteConfigNames - .map((candidate) => path.resolve(root, candidate)) - .filter((file) => fs.existsSync(file)); - if (existingKnownConfigFiles.length === 0) { - log.debug(`no svelte config found at ${root}`, undefined, 'config'); - return; - } else if (existingKnownConfigFiles.length > 1) { - log.warn( - `found more than one svelte config file, using ${existingKnownConfigFiles[0]}. you should only have one!`, - existingKnownConfigFiles - ); - } - return existingKnownConfigFiles[0]; - } -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/log.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/log.js deleted file mode 100644 index 0b43cff..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/log.js +++ /dev/null @@ -1,277 +0,0 @@ -/* eslint-disable no-console */ -import { cyan, red, yellow } from 'kleur/colors'; -import debug from 'debug'; - -/** @type {import('../types/log.d.ts').LogLevel[]} */ -const levels = ['debug', 'info', 'warn', 'error', 'silent']; -const prefix = 'vite-plugin-svelte'; -/** @type {Record} */ -const loggers = { - debug: { - log: debug(`${prefix}`), - enabled: false, - isDebug: true - }, - info: { - color: cyan, - log: console.log, - enabled: true - }, - warn: { - color: yellow, - log: console.warn, - enabled: true - }, - error: { - color: red, - log: console.error, - enabled: true - }, - silent: { - enabled: false - } -}; - -/** @type {import('../types/log.d.ts').LogLevel} */ -let _level = 'info'; -/** - * @param {import('../types/log.d.ts').LogLevel} level - * @returns {void} - */ -function setLevel(level) { - if (level === _level) { - return; - } - const levelIndex = levels.indexOf(level); - if (levelIndex > -1) { - _level = level; - for (let i = 0; i < levels.length; i++) { - loggers[levels[i]].enabled = i >= levelIndex; - } - } else { - _log(loggers.error, `invalid log level: ${level} `); - } -} - -/** - * @param {any} logger - * @param {string} message - * @param {any} [payload] - * @param {string} [namespace] - * @returns - */ -function _log(logger, message, payload, namespace) { - if (!logger.enabled) { - return; - } - if (logger.isDebug) { - let log = logger.log; - if (namespace) { - if (!isDebugNamespaceEnabled(namespace)) { - return; - } - log = logger.log.extend(namespace); - } - if (payload !== undefined) { - log(message, payload); - } else { - log(message); - } - } else { - logger.log( - logger.color( - `${new Date().toLocaleTimeString()} [${prefix}${ - namespace ? `:${namespace}` : '' - }] ${message}` - ) - ); - if (payload) { - logger.log(payload); - } - } -} - -/** - * @param {import('../types/log.d.ts').LogLevel} level - * @returns {import('../types/log.d.ts').LogFn} - */ -function createLogger(level) { - const logger = loggers[level]; - const logFn = /** @type {import('../types/log.d.ts').LogFn} */ (_log.bind(null, logger)); - /** @type {Set} */ - const logged = new Set(); - /** @type {import('../types/log.d.ts').SimpleLogFn} */ - const once = function (message, payload, namespace) { - if (!logger.enabled || logged.has(message)) { - return; - } - logged.add(message); - logFn.apply(null, [message, payload, namespace]); - }; - Object.defineProperty(logFn, 'enabled', { - get() { - return logger.enabled; - } - }); - Object.defineProperty(logFn, 'once', { - get() { - return once; - } - }); - return logFn; -} - -export const log = { - debug: createLogger('debug'), - info: createLogger('info'), - warn: createLogger('warn'), - error: createLogger('error'), - setLevel -}; - -/** - * @param {import('../types/id.d.ts').SvelteRequest | import('../types/id.d.ts').SvelteModuleRequest} svelteRequest - * @param {import('svelte/compiler').Warning[]} warnings - * @param {import('../types/options.d.ts').ResolvedOptions} options - */ -export function logCompilerWarnings(svelteRequest, warnings, options) { - const { emitCss, onwarn, isBuild } = options; - const sendViaWS = !isBuild && options.experimental?.sendWarningsToBrowser; - let warn = isBuild ? warnBuild : warnDev; - /** @type {import('svelte/compiler').Warning[]} */ - const handledByDefaultWarn = []; - const notIgnored = warnings?.filter((w) => !ignoreCompilerWarning(w, isBuild, emitCss)); - const extra = buildExtraWarnings(warnings, isBuild); - const allWarnings = [...notIgnored, ...extra]; - if (sendViaWS) { - const _warn = warn; - /** @type {(w: import('svelte/compiler').Warning) => void} */ - warn = (w) => { - handledByDefaultWarn.push(w); - _warn(w); - }; - } - allWarnings.forEach((warning) => { - if (onwarn) { - onwarn(warning, warn); - } else { - warn(warning); - } - }); - if (sendViaWS) { - /** @type {import('../types/log.d.ts').SvelteWarningsMessage} */ - const message = { - id: svelteRequest.id, - filename: svelteRequest.filename, - normalizedFilename: svelteRequest.normalizedFilename, - timestamp: svelteRequest.timestamp, - warnings: handledByDefaultWarn, // allWarnings filtered by warnings where onwarn did not call the default handler - allWarnings, // includes warnings filtered by onwarn and our extra vite plugin svelte warnings - rawWarnings: warnings // raw compiler output - }; - log.debug(`sending svelte:warnings message for ${svelteRequest.normalizedFilename}`); - options.server?.ws?.send('svelte:warnings', message); - } -} - -/** - * @param {import('svelte/compiler').Warning} warning - * @param {boolean} isBuild - * @param {boolean} [emitCss] - * @returns {boolean} - */ -function ignoreCompilerWarning(warning, isBuild, emitCss) { - return ( - (!emitCss && warning.code === 'css_unused_selector') || // same as rollup-plugin-svelte - (!isBuild && isNoScopableElementWarning(warning)) - ); -} - -/** - * - * @param {import('svelte/compiler').Warning} warning - * @returns {boolean} - */ -function isNoScopableElementWarning(warning) { - // see https://github.com/sveltejs/vite-plugin-svelte/issues/153 - return warning.code === 'css_unused_selector' && warning.message.includes('"*"'); -} - -/** - * - * @param {import('svelte/compiler').Warning[]} warnings - * @param {boolean} isBuild - * @returns {import('svelte/compiler').Warning[]} - */ -function buildExtraWarnings(warnings, isBuild) { - const extraWarnings = []; - if (!isBuild) { - const noScopableElementWarnings = warnings.filter((w) => isNoScopableElementWarning(w)); - if (noScopableElementWarnings.length > 0) { - // in case there are multiple, use last one as that is the one caused by our *{} rule - const noScopableElementWarning = - noScopableElementWarnings[noScopableElementWarnings.length - 1]; - extraWarnings.push({ - ...noScopableElementWarning, - code: 'vite-plugin-svelte-css-no-scopable-elements', - message: - "No scopable elements found in template. If you're using global styles in the style tag, you should move it into an external stylesheet file and import it in JS. See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/faq.md#where-should-i-put-my-global-styles." - }); - } - } - return extraWarnings; -} - -/** - * @param {import('svelte/compiler').Warning} w - */ -function warnDev(w) { - if (w.filename?.includes('node_modules')) { - if (isDebugNamespaceEnabled('node-modules-onwarn')) { - log.debug(buildExtendedLogMessage(w), undefined, 'node-modules-onwarn'); - } - } else if (log.info.enabled) { - log.info(buildExtendedLogMessage(w)); - } -} - -/** - * @param {import('svelte/compiler').Warning & {frame?: string}} w - */ -function warnBuild(w) { - if (w.filename?.includes('node_modules')) { - if (isDebugNamespaceEnabled('node-modules-onwarn')) { - log.debug(buildExtendedLogMessage(w), w.frame, 'node-modules-onwarn'); - } - } else if (log.warn.enabled) { - log.warn(buildExtendedLogMessage(w), w.frame); - } -} - -/** - * @param {import('svelte/compiler').Warning} w - */ -export function buildExtendedLogMessage(w) { - const parts = []; - if (w.filename) { - parts.push(w.filename); - } - if (w.start) { - parts.push(':', w.start.line, ':', w.start.column); - } - if (w.message) { - if (parts.length > 0) { - parts.push(' '); - } - parts.push(w.message); - } - return parts.join(''); -} - -/** - * @param {string} namespace - * @returns {boolean} - */ -export function isDebugNamespaceEnabled(namespace) { - return debug.enabled(`${prefix}:${namespace}`); -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/optimizer.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/optimizer.js deleted file mode 100644 index 71aa571..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/optimizer.js +++ /dev/null @@ -1,53 +0,0 @@ -import { promises as fs } from 'node:fs'; -import path from 'node:path'; - -// List of options that changes the prebundling result -/** @type {(keyof import('../types/options.d.ts').ResolvedOptions)[]} */ -const PREBUNDLE_SENSITIVE_OPTIONS = [ - 'compilerOptions', - 'configFile', - 'experimental', - 'extensions', - 'ignorePluginPreprocessors', - 'preprocess' -]; - -/** - * @param {string} cacheDir - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {Promise} Whether the Svelte metadata has changed - */ -export async function saveSvelteMetadata(cacheDir, options) { - const svelteMetadata = generateSvelteMetadata(options); - const svelteMetadataPath = path.resolve(cacheDir, '_svelte_metadata.json'); - - const currentSvelteMetadata = JSON.stringify(svelteMetadata, (_, value) => { - // Handle preprocessors - return typeof value === 'function' ? value.toString() : value; - }); - - /** @type {string | undefined} */ - let existingSvelteMetadata; - try { - existingSvelteMetadata = await fs.readFile(svelteMetadataPath, 'utf8'); - } catch { - // ignore - } - - await fs.mkdir(cacheDir, { recursive: true }); - await fs.writeFile(svelteMetadataPath, currentSvelteMetadata); - return currentSvelteMetadata !== existingSvelteMetadata; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @returns {Partial} - */ -function generateSvelteMetadata(options) { - /** @type {Record} */ - const metadata = {}; - for (const key of PREBUNDLE_SENSITIVE_OPTIONS) { - metadata[key] = options[key]; - } - return metadata; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/options.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/options.js deleted file mode 100644 index 5115842..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/options.js +++ /dev/null @@ -1,655 +0,0 @@ -import process from 'node:process'; -import { - defaultClientMainFields, - defaultServerMainFields, - defaultClientConditions, - defaultServerConditions, - normalizePath -} from 'vite'; -import { isDebugNamespaceEnabled, log } from './log.js'; -import { loadSvelteConfig } from './load-svelte-config.js'; -import { - DEFAULT_SVELTE_EXT, - FAQ_LINK_MISSING_EXPORTS_CONDITION, - SVELTE_EXPORT_CONDITIONS, - SVELTE_IMPORTS, - SVELTE_RUNTIME_DEPENDENCIES -} from './constants.js'; - -import path from 'node:path'; -import { - esbuildSvelteModulePlugin, - esbuildSveltePlugin, - facadeEsbuildSvelteModulePluginName, - facadeEsbuildSveltePluginName -} from './esbuild.js'; -import { addExtraPreprocessors } from './preprocess.js'; -import deepmerge from 'deepmerge'; -import { - crawlFrameworkPkgs, - isDepExcluded, - isDepExternaled, - isDepIncluded, - isDepNoExternaled -} from 'vitefu'; - -import { isCommonDepWithoutSvelteField } from './dependencies.js'; -import { VitePluginSvelteStats } from './vite-plugin-svelte-stats.js'; - -const allowedPluginOptions = new Set([ - 'include', - 'exclude', - 'emitCss', - 'hot', - 'ignorePluginPreprocessors', - 'disableDependencyReinclusion', - 'prebundleSvelteLibraries', - 'inspector', - 'dynamicCompileOptions', - 'experimental' -]); - -const knownRootOptions = new Set(['extensions', 'compilerOptions', 'preprocess', 'onwarn']); - -const allowedInlineOptions = new Set(['configFile', ...allowedPluginOptions, ...knownRootOptions]); - -/** - * @param {Partial} [inlineOptions] - */ -export function validateInlineOptions(inlineOptions) { - const invalidKeys = Object.keys(inlineOptions || {}).filter( - (key) => !allowedInlineOptions.has(key) - ); - if (invalidKeys.length) { - log.warn(`invalid plugin options "${invalidKeys.join(', ')}" in inline config`, inlineOptions); - } -} - -/** - * @param {Partial} [config] - * @returns {Partial | undefined} - */ -function convertPluginOptions(config) { - if (!config) { - return; - } - const invalidRootOptions = Object.keys(config).filter((key) => allowedPluginOptions.has(key)); - if (invalidRootOptions.length > 0) { - throw new Error( - `Invalid options in svelte config. Move the following options into 'vitePlugin:{...}': ${invalidRootOptions.join( - ', ' - )}` - ); - } - if (!config.vitePlugin) { - return config; - } - const pluginOptions = config.vitePlugin; - const pluginOptionKeys = Object.keys(pluginOptions); - - const rootOptionsInPluginOptions = pluginOptionKeys.filter((key) => knownRootOptions.has(key)); - if (rootOptionsInPluginOptions.length > 0) { - throw new Error( - `Invalid options in svelte config under vitePlugin:{...}', move them to the config root : ${rootOptionsInPluginOptions.join( - ', ' - )}` - ); - } - const duplicateOptions = pluginOptionKeys.filter((key) => - Object.prototype.hasOwnProperty.call(config, key) - ); - if (duplicateOptions.length > 0) { - throw new Error( - `Invalid duplicate options in svelte config under vitePlugin:{...}', they are defined in root too and must only exist once: ${duplicateOptions.join( - ', ' - )}` - ); - } - const unknownPluginOptions = pluginOptionKeys.filter((key) => !allowedPluginOptions.has(key)); - if (unknownPluginOptions.length > 0) { - log.warn( - `ignoring unknown plugin options in svelte config under vitePlugin:{...}: ${unknownPluginOptions.join( - ', ' - )}` - ); - unknownPluginOptions.forEach((unkownOption) => { - // @ts-expect-error not typed - delete pluginOptions[unkownOption]; - }); - } - /** @type {import('../public.d.ts').Options} */ - const result = { - ...config, - ...pluginOptions - }; - // @ts-expect-error it exists - delete result.vitePlugin; - - return result; -} - -/** - * used in config phase, merges the default options, svelte config, and inline options - * @param {Partial | undefined} inlineOptions - * @param {import('vite').UserConfig} viteUserConfig - * @param {import('vite').ConfigEnv} viteEnv - * @returns {Promise} - */ -export async function preResolveOptions(inlineOptions, viteUserConfig, viteEnv) { - if (!inlineOptions) { - inlineOptions = {}; - } - /** @type {import('vite').UserConfig} */ - const viteConfigWithResolvedRoot = { - ...viteUserConfig, - root: resolveViteRoot(viteUserConfig) - }; - const isBuild = viteEnv.command === 'build'; - /** @type {Partial} */ - const defaultOptions = { - extensions: DEFAULT_SVELTE_EXT, - emitCss: true, - prebundleSvelteLibraries: !isBuild - }; - const svelteConfig = convertPluginOptions( - await loadSvelteConfig(viteConfigWithResolvedRoot, inlineOptions) - ); - /** @type {Partial} */ - const extraOptions = { - root: viteConfigWithResolvedRoot.root, - isBuild, - isServe: viteEnv.command === 'serve', - isDebug: process.env.DEBUG != null - }; - - const merged = /** @type {import('../types/options.d.ts').PreResolvedOptions} */ ( - mergeConfigs(defaultOptions, svelteConfig, inlineOptions, extraOptions) - ); - // configFile of svelteConfig contains the absolute path it was loaded from, - // prefer it over the possibly relative inline path - if (svelteConfig?.configFile) { - merged.configFile = svelteConfig.configFile; - } - return merged; -} - -/** - * @template T - * @param {(Partial | undefined)[]} configs - * @returns T - */ -function mergeConfigs(...configs) { - /** @type {Partial} */ - let result = {}; - for (const config of configs.filter((x) => x != null)) { - result = deepmerge(result, /** @type {Partial} */ (config), { - // replace arrays - arrayMerge: (target, source) => source ?? target - }); - } - return /** @type {T} */ result; -} - -/** - * used in configResolved phase, merges a contextual default config, pre-resolved options, and some preprocessors. also validates the final config. - * - * @param {import('../types/options.d.ts').PreResolvedOptions} preResolveOptions - * @param {import('vite').ResolvedConfig} viteConfig - * @param {import('./vite-plugin-svelte-cache.js').VitePluginSvelteCache} cache - * @returns {import('../types/options.d.ts').ResolvedOptions} - */ -export function resolveOptions(preResolveOptions, viteConfig, cache) { - const css = preResolveOptions.emitCss ? 'external' : 'injected'; - /** @type {Partial} */ - const defaultOptions = { - compilerOptions: { - css, - dev: !viteConfig.isProduction, - hmr: - !viteConfig.isProduction && - !preResolveOptions.isBuild && - viteConfig.server && - viteConfig.server.hmr !== false - } - }; - - /** @type {Partial} */ - const extraOptions = { - root: viteConfig.root, - isProduction: viteConfig.isProduction - }; - const merged = /** @type {import('../types/options.d.ts').ResolvedOptions}*/ ( - mergeConfigs(defaultOptions, preResolveOptions, extraOptions) - ); - - removeIgnoredOptions(merged); - handleDeprecatedOptions(merged); - addExtraPreprocessors(merged, viteConfig); - enforceOptionsForHmr(merged, viteConfig); - enforceOptionsForProduction(merged); - // mergeConfigs would mangle functions on the stats class, so do this afterwards - if (log.debug.enabled && isDebugNamespaceEnabled('stats')) { - merged.stats = new VitePluginSvelteStats(cache); - } - return merged; -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - * @param {import('vite').ResolvedConfig} viteConfig - */ -function enforceOptionsForHmr(options, viteConfig) { - if (options.hot) { - log.warn( - 'svelte 5 has hmr integrated in core. Please remove the vitePlugin.hot option and use compilerOptions.hmr instead' - ); - delete options.hot; - options.compilerOptions.hmr = true; - } - if (options.compilerOptions.hmr && viteConfig.server?.hmr === false) { - log.warn( - 'vite config server.hmr is false but compilerOptions.hmr is true. Forcing compilerOptions.hmr to false as it would not work.' - ); - options.compilerOptions.hmr = false; - } -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - */ -function enforceOptionsForProduction(options) { - if (options.isProduction) { - if (options.compilerOptions.hmr) { - log.warn( - 'you are building for production but compilerOptions.hmr is true, forcing it to false' - ); - options.compilerOptions.hmr = false; - } - if (options.compilerOptions.dev) { - log.warn( - 'you are building for production but compilerOptions.dev is true, forcing it to false' - ); - options.compilerOptions.dev = false; - } - } -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - */ -function removeIgnoredOptions(options) { - const ignoredCompilerOptions = ['generate', 'format', 'filename']; - if (options.compilerOptions.hmr && options.emitCss) { - ignoredCompilerOptions.push('cssHash'); - } - const passedCompilerOptions = Object.keys(options.compilerOptions || {}); - const passedIgnored = passedCompilerOptions.filter((o) => ignoredCompilerOptions.includes(o)); - if (passedIgnored.length) { - log.warn( - `The following Svelte compilerOptions are controlled by vite-plugin-svelte and essential to its functionality. User-specified values are ignored. Please remove them from your configuration: ${passedIgnored.join( - ', ' - )}` - ); - passedIgnored.forEach((ignored) => { - // @ts-expect-error string access - delete options.compilerOptions[ignored]; - }); - } -} - -/** - * @param {import('../types/options.d.ts').ResolvedOptions} options - */ -function handleDeprecatedOptions(options) { - const experimental = /** @type {Record} */ (options.experimental); - if (experimental) { - for (const promoted of ['prebundleSvelteLibraries', 'inspector', 'dynamicCompileOptions']) { - if (experimental[promoted]) { - //@ts-expect-error untyped assign - options[promoted] = experimental[promoted]; - delete experimental[promoted]; - log.warn( - `Option "experimental.${promoted}" is no longer experimental and has moved to "${promoted}". Please update your Svelte or Vite config.` - ); - } - } - if (experimental.generateMissingPreprocessorSourcemaps) { - log.warn('experimental.generateMissingPreprocessorSourcemaps has been removed.'); - } - } -} - -/** - * vite passes unresolved `root`option to config hook but we need the resolved value, so do it here - * - * @see https://github.com/sveltejs/vite-plugin-svelte/issues/113 - * @see https://github.com/vitejs/vite/blob/43c957de8a99bb326afd732c962f42127b0a4d1e/packages/vite/src/node/config.ts#L293 - * - * @param {import('vite').UserConfig} viteConfig - * @returns {string | undefined} - */ -function resolveViteRoot(viteConfig) { - return normalizePath(viteConfig.root ? path.resolve(viteConfig.root) : process.cwd()); -} - -/** - * @param {import('../types/options.d.ts').PreResolvedOptions} options - * @param {import('vite').UserConfig} config - * @returns {Promise>} - */ -export async function buildExtraViteConfig(options, config) { - /** @type {Partial} */ - const extraViteConfig = { - resolve: { - dedupe: [...SVELTE_IMPORTS] - } - // this option is still awaiting a PR in vite to be supported - // see https://github.com/sveltejs/vite-plugin-svelte/issues/60 - // knownJsSrcExtensions: options.extensions - }; - - const extraSvelteConfig = buildExtraConfigForSvelte(config); - const extraDepsConfig = await buildExtraConfigForDependencies(options, config); - // merge extra svelte and deps config, but make sure dep values are not contradicting svelte - extraViteConfig.optimizeDeps = { - include: [ - ...extraSvelteConfig.optimizeDeps.include, - ...extraDepsConfig.optimizeDeps.include.filter( - (dep) => !isDepExcluded(dep, extraSvelteConfig.optimizeDeps.exclude) - ) - ], - exclude: [ - ...extraSvelteConfig.optimizeDeps.exclude, - ...extraDepsConfig.optimizeDeps.exclude.filter( - (dep) => !isDepIncluded(dep, extraSvelteConfig.optimizeDeps.include) - ) - ] - }; - - extraViteConfig.ssr = { - external: [ - ...extraSvelteConfig.ssr.external, - ...extraDepsConfig.ssr.external.filter( - (dep) => !isDepNoExternaled(dep, extraSvelteConfig.ssr.noExternal) - ) - ], - noExternal: [ - ...extraSvelteConfig.ssr.noExternal, - ...extraDepsConfig.ssr.noExternal.filter( - (dep) => !isDepExternaled(dep, extraSvelteConfig.ssr.external) - ) - ] - }; - - // handle prebundling for svelte files - if (options.prebundleSvelteLibraries) { - extraViteConfig.optimizeDeps = { - ...extraViteConfig.optimizeDeps, - // Experimental Vite API to allow these extensions to be scanned and prebundled - extensions: options.extensions ? [...options.extensions] : ['.svelte'], - // Add esbuild plugin to prebundle Svelte files. - // Currently a placeholder as more information is needed after Vite config is resolved, - // the real Svelte plugin is added in `patchResolvedViteConfig()` - esbuildOptions: { - plugins: [ - { name: facadeEsbuildSveltePluginName, setup: () => {} }, - { name: facadeEsbuildSvelteModulePluginName, setup: () => {} } - ] - } - }; - } - - // enable hmrPartialAccept if not explicitly disabled - if (config.experimental?.hmrPartialAccept !== false) { - log.debug('enabling "experimental.hmrPartialAccept" in vite config', undefined, 'config'); - extraViteConfig.experimental = { hmrPartialAccept: true }; - } - validateViteConfig(extraViteConfig, config, options); - return extraViteConfig; -} - -/** - * @param {Partial} extraViteConfig - * @param {import('vite').UserConfig} config - * @param {import('../types/options.d.ts').PreResolvedOptions} options - */ -function validateViteConfig(extraViteConfig, config, options) { - const { prebundleSvelteLibraries, isBuild } = options; - if (prebundleSvelteLibraries) { - /** @type {(option: 'dev' | 'build' | boolean)=> boolean} */ - const isEnabled = (option) => option !== true && option !== (isBuild ? 'build' : 'dev'); - /** @type {(name: string, value: 'dev' | 'build' | boolean, recommendation: string)=> void} */ - const logWarning = (name, value, recommendation) => - log.warn.once( - `Incompatible options: \`prebundleSvelteLibraries: true\` and vite \`${name}: ${JSON.stringify( - value - )}\` ${isBuild ? 'during build.' : '.'} ${recommendation}` - ); - const viteOptimizeDepsDisabled = config.optimizeDeps?.disabled ?? 'build'; // fall back to vite default - const isOptimizeDepsEnabled = isEnabled(viteOptimizeDepsDisabled); - if (!isBuild && !isOptimizeDepsEnabled) { - logWarning( - 'optimizeDeps.disabled', - viteOptimizeDepsDisabled, - 'Forcing `optimizeDeps.disabled: "build"`. Disable prebundleSvelteLibraries or update your vite config to enable optimizeDeps during dev.' - ); - if (!extraViteConfig.optimizeDeps) { - extraViteConfig.optimizeDeps = {}; - } - extraViteConfig.optimizeDeps.disabled = 'build'; - } else if (isBuild && isOptimizeDepsEnabled) { - logWarning( - 'optimizeDeps.disabled', - viteOptimizeDepsDisabled, - 'Disable optimizeDeps or prebundleSvelteLibraries for build if you experience errors.' - ); - } - } -} - -/** - * @param {import('../types/options.d.ts').PreResolvedOptions} options - * @param {import('vite').UserConfig} config - * @returns {Promise} - */ -async function buildExtraConfigForDependencies(options, config) { - // extra handling for svelte dependencies in the project - const packagesWithoutSvelteExportsCondition = new Set(); - const depsConfig = await crawlFrameworkPkgs({ - root: options.root, - isBuild: options.isBuild, - viteUserConfig: config, - isFrameworkPkgByJson(pkgJson) { - let hasSvelteCondition = false; - if (typeof pkgJson.exports === 'object') { - // use replacer as a simple way to iterate over nested keys - JSON.stringify(pkgJson.exports, (key, value) => { - if (SVELTE_EXPORT_CONDITIONS.includes(key)) { - hasSvelteCondition = true; - } - return value; - }); - } - const hasSvelteField = !!pkgJson.svelte; - if (hasSvelteField && !hasSvelteCondition) { - packagesWithoutSvelteExportsCondition.add(`${pkgJson.name}@${pkgJson.version}`); - } - return hasSvelteCondition || hasSvelteField; - }, - isSemiFrameworkPkgByJson(pkgJson) { - return !!pkgJson.dependencies?.svelte || !!pkgJson.peerDependencies?.svelte; - }, - isFrameworkPkgByName(pkgName) { - const isNotSveltePackage = isCommonDepWithoutSvelteField(pkgName); - if (isNotSveltePackage) { - return false; - } else { - return undefined; - } - } - }); - if ( - !options.experimental?.disableSvelteResolveWarnings && - packagesWithoutSvelteExportsCondition?.size > 0 - ) { - log.warn( - `WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte.\n\n${[ - ...packagesWithoutSvelteExportsCondition - ].join('\n')}\n\nPlease see ${FAQ_LINK_MISSING_EXPORTS_CONDITION} for details.` - ); - } - log.debug('extra config for dependencies generated by vitefu', depsConfig, 'config'); - - if (options.prebundleSvelteLibraries) { - // prebundling enabled, so we don't need extra dependency excludes - depsConfig.optimizeDeps.exclude = []; - // but keep dependency reinclusions of explicit user excludes - const userExclude = config.optimizeDeps?.exclude; - depsConfig.optimizeDeps.include = !userExclude - ? [] - : depsConfig.optimizeDeps.include.filter((dep) => { - // reincludes look like this: foo > bar > baz - // in case foo or bar are excluded, we have to retain the reinclude even with prebundling - return ( - dep.includes('>') && - dep - .split('>') - .slice(0, -1) - .some((d) => isDepExcluded(d.trim(), userExclude)) - ); - }); - } - if (options.disableDependencyReinclusion === true) { - depsConfig.optimizeDeps.include = depsConfig.optimizeDeps.include.filter( - (dep) => !dep.includes('>') - ); - } else if (Array.isArray(options.disableDependencyReinclusion)) { - const disabledDeps = options.disableDependencyReinclusion; - depsConfig.optimizeDeps.include = depsConfig.optimizeDeps.include.filter((dep) => { - if (!dep.includes('>')) return true; - const trimDep = dep.replace(/\s+/g, ''); - return disabledDeps.some((disabled) => trimDep.includes(`${disabled}>`)); - }); - } - - log.debug('post-processed extra config for dependencies', depsConfig, 'config'); - - return depsConfig; -} - -/** - * @param {import('vite').UserConfig} config - * @returns {import('vite').UserConfig & { optimizeDeps: { include: string[], exclude:string[] }, ssr: { noExternal:(string|RegExp)[], external: string[] } } } - */ -function buildExtraConfigForSvelte(config) { - // include svelte imports for optimization unless explicitly excluded - /** @type {string[]} */ - const include = []; - /** @type {string[]} */ - const exclude = []; - if (!isDepExcluded('svelte', config.optimizeDeps?.exclude ?? [])) { - const svelteImportsToInclude = SVELTE_IMPORTS.filter( - (si) => !(si.endsWith('/server') || si.includes('/server/')) - ); - svelteImportsToInclude.push(...SVELTE_RUNTIME_DEPENDENCIES.map((dep) => `svelte > ${dep}`)); - log.debug( - `adding bare svelte packages and runtime dependencies to optimizeDeps.include: ${svelteImportsToInclude.join(', ')} `, - undefined, - 'config' - ); - include.push(...svelteImportsToInclude); - } else { - log.debug( - '"svelte" is excluded in optimizeDeps.exclude, skipped adding it to include.', - undefined, - 'config' - ); - } - /** @type {(string | RegExp)[]} */ - const noExternal = []; - /** @type {string[]} */ - const external = []; - // add svelte to ssr.noExternal unless it is present in ssr.external - // so it is correctly resolving according to the conditions in sveltes exports map - if (!isDepExternaled('svelte', config.ssr?.external ?? [])) { - noExternal.push('svelte', /^svelte\//); - } - // esm-env needs to be bundled by default for the development/production condition - // be properly used by svelte - if (!isDepExternaled('esm-env', config.ssr?.external ?? [])) { - noExternal.push('esm-env'); - } - return { optimizeDeps: { include, exclude }, ssr: { noExternal, external } }; -} - -/** - * @param {import('vite').ResolvedConfig} viteConfig - * @param {import('../types/options.d.ts').ResolvedOptions} options - */ -export function patchResolvedViteConfig(viteConfig, options) { - if (options.preprocess) { - for (const preprocessor of arraify(options.preprocess)) { - if (preprocessor.style && '__resolvedConfig' in preprocessor.style) { - preprocessor.style.__resolvedConfig = viteConfig; - } - } - } - - // replace facade esbuild plugin with a real one - const facadeEsbuildSveltePlugin = viteConfig.optimizeDeps.esbuildOptions?.plugins?.find( - (plugin) => plugin.name === facadeEsbuildSveltePluginName - ); - if (facadeEsbuildSveltePlugin) { - Object.assign(facadeEsbuildSveltePlugin, esbuildSveltePlugin(options)); - } - const facadeEsbuildSvelteModulePlugin = viteConfig.optimizeDeps.esbuildOptions?.plugins?.find( - (plugin) => plugin.name === facadeEsbuildSvelteModulePluginName - ); - if (facadeEsbuildSvelteModulePlugin) { - Object.assign(facadeEsbuildSvelteModulePlugin, esbuildSvelteModulePlugin(options)); - } -} - -/** - * Mutates `config` to ensure `resolve.mainFields` is set. If unset, it emulates Vite's default fallback. - * @param {string} name - * @param {import('vite').EnvironmentOptions} config - * @param {{ isSsrTargetWebworker?: boolean }} opts - */ -export function ensureConfigEnvironmentMainFields(name, config, opts) { - config.resolve ??= {}; - if (config.resolve.mainFields == null) { - if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) { - config.resolve.mainFields = [...defaultClientMainFields]; - } else { - config.resolve.mainFields = [...defaultServerMainFields]; - } - } - return true; -} - -/** - * Mutates `config` to ensure `resolve.conditions` is set. If unset, it emulates Vite's default fallback. - * @param {string} name - * @param {import('vite').EnvironmentOptions} config - * @param {{ isSsrTargetWebworker?: boolean }} opts - */ -export function ensureConfigEnvironmentConditions(name, config, opts) { - config.resolve ??= {}; - if (config.resolve.conditions == null) { - if (config.consumer === 'client' || name === 'client' || opts.isSsrTargetWebworker) { - config.resolve.conditions = [...defaultClientConditions]; - } else { - config.resolve.conditions = [...defaultServerConditions]; - } - } -} - -/** - * @template T - * @param {T | T[]} value - * @returns {T[]} - */ -function arraify(value) { - return Array.isArray(value) ? value : [value]; -} diff --git a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/preprocess.js b/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/preprocess.js deleted file mode 100644 index 602c649..0000000 --- a/web/node_modules/@sveltejs/vite-plugin-svelte/src/utils/preprocess.js +++ /dev/null @@ -1,173 +0,0 @@ -import MagicString from 'magic-string'; -import { log } from './log.js'; -import path from 'node:path'; -import { normalizePath } from 'vite'; - -/** - * this appends a *{} rule to component styles to force the svelte compiler to add style classes to all nodes - * That means adding/removing class rules from ' - * ) - * document.type //=> 'document' - * document.nodes.length //=> 2 - * ``` - */ -declare class Document_ extends Container { - nodes: Root[] - parent: undefined - type: 'document' - - constructor(defaults?: Document.DocumentProps) - - assign(overrides: Document.DocumentProps | object): this - clone(overrides?: Partial): this - cloneAfter(overrides?: Partial): this - cloneBefore(overrides?: Partial): this - - /** - * Returns a `Result` instance representing the document’s CSS roots. - * - * ```js - * const root1 = postcss.parse(css1, { from: 'a.css' }) - * const root2 = postcss.parse(css2, { from: 'b.css' }) - * const document = postcss.document() - * document.append(root1) - * document.append(root2) - * const result = document.toResult({ to: 'all.css', map: true }) - * ``` - * - * @param opts Options. - * @return Result with current document’s CSS. - */ - toResult(options?: ProcessOptions): Result -} - -declare class Document extends Document_ {} - -export = Document diff --git a/web/node_modules/postcss/lib/document.js b/web/node_modules/postcss/lib/document.js deleted file mode 100644 index 4468991..0000000 --- a/web/node_modules/postcss/lib/document.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -let Container = require('./container') - -let LazyResult, Processor - -class Document extends Container { - constructor(defaults) { - // type needs to be passed to super, otherwise child roots won't be normalized correctly - super({ type: 'document', ...defaults }) - - if (!this.nodes) { - this.nodes = [] - } - } - - toResult(opts = {}) { - let lazy = new LazyResult(new Processor(), this, opts) - - return lazy.stringify() - } -} - -Document.registerLazyResult = dependant => { - LazyResult = dependant -} - -Document.registerProcessor = dependant => { - Processor = dependant -} - -module.exports = Document -Document.default = Document diff --git a/web/node_modules/postcss/lib/fromJSON.d.ts b/web/node_modules/postcss/lib/fromJSON.d.ts deleted file mode 100644 index e1deedb..0000000 --- a/web/node_modules/postcss/lib/fromJSON.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { JSONHydrator } from './postcss.js' - -interface FromJSON extends JSONHydrator { - default: FromJSON -} - -declare const fromJSON: FromJSON - -export = fromJSON diff --git a/web/node_modules/postcss/lib/fromJSON.js b/web/node_modules/postcss/lib/fromJSON.js deleted file mode 100644 index c9ac1a8..0000000 --- a/web/node_modules/postcss/lib/fromJSON.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -let AtRule = require('./at-rule') -let Comment = require('./comment') -let Declaration = require('./declaration') -let Input = require('./input') -let PreviousMap = require('./previous-map') -let Root = require('./root') -let Rule = require('./rule') - -function fromJSON(json, inputs) { - if (Array.isArray(json)) return json.map(n => fromJSON(n)) - - let { inputs: ownInputs, ...defaults } = json - if (ownInputs) { - inputs = [] - for (let input of ownInputs) { - let inputHydrated = { ...input, __proto__: Input.prototype } - if (inputHydrated.map) { - inputHydrated.map = { - ...inputHydrated.map, - __proto__: PreviousMap.prototype - } - } - inputs.push(inputHydrated) - } - } - if (defaults.nodes) { - defaults.nodes = json.nodes.map(n => fromJSON(n, inputs)) - } - if (defaults.source) { - let { inputId, ...source } = defaults.source - defaults.source = source - if (inputId != null) { - defaults.source.input = inputs[inputId] - } - } - if (defaults.type === 'root') { - return new Root(defaults) - } else if (defaults.type === 'decl') { - return new Declaration(defaults) - } else if (defaults.type === 'rule') { - return new Rule(defaults) - } else if (defaults.type === 'comment') { - return new Comment(defaults) - } else if (defaults.type === 'atrule') { - return new AtRule(defaults) - } else { - throw new Error('Unknown node type: ' + json.type) - } -} - -module.exports = fromJSON -fromJSON.default = fromJSON diff --git a/web/node_modules/postcss/lib/input.d.ts b/web/node_modules/postcss/lib/input.d.ts deleted file mode 100644 index b788f55..0000000 --- a/web/node_modules/postcss/lib/input.d.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { CssSyntaxError, ProcessOptions } from './postcss.js' -import PreviousMap from './previous-map.js' - -declare namespace Input { - export interface FilePosition { - /** - * Column of inclusive start position in source file. - */ - column: number - - /** - * Column of exclusive end position in source file. - */ - endColumn?: number - - /** - * Line of exclusive end position in source file. - */ - endLine?: number - - /** - * Offset of exclusive end position in source file. - */ - endOffset?: number - - /** - * Absolute path to the source file. - */ - file?: string - - /** - * Line of inclusive start position in source file. - */ - line: number - - /** - * Offset of inclusive start position in source file. - */ - offset: number - - /** - * Source code. - */ - source?: string - - /** - * URL for the source file. - */ - url: string - } - - - export { Input_ as default } -} - -/** - * Represents the source CSS. - * - * ```js - * const root = postcss.parse(css, { from: file }) - * const input = root.source.input - * ``` - */ -declare class Input_ { - /** - * Input CSS source. - * - * ```js - * const input = postcss.parse('a{}', { from: file }).input - * input.css //=> "a{}" - * ``` - */ - css: string - - /** - * Input source with support for non-CSS documents. - * - * ```js - * const input = postcss.parse('a{}', { from: file, document: '' }).input - * input.document //=> "" - * input.css //=> "a{}" - * ``` - */ - document: string - - /** - * The absolute path to the CSS source file defined - * with the `from` option. - * - * ```js - * const root = postcss.parse(css, { from: 'a.css' }) - * root.source.input.file //=> '/home/ai/a.css' - * ``` - */ - file?: string - - /** - * The flag to indicate whether or not the source code has Unicode BOM. - */ - hasBOM: boolean - - /** - * The unique ID of the CSS source. It will be created if `from` option - * is not provided (because PostCSS does not know the file path). - * - * ```js - * const root = postcss.parse(css) - * root.source.input.file //=> undefined - * root.source.input.id //=> "" - * ``` - */ - id?: string - - /** - * The input source map passed from a compilation step before PostCSS - * (for example, from Sass compiler). - * - * ```js - * root.source.input.map.consumer().sources //=> ['a.sass'] - * ``` - */ - map: PreviousMap - - /** - * The CSS source identifier. Contains `Input#file` if the user - * set the `from` option, or `Input#id` if they did not. - * - * ```js - * const root = postcss.parse(css, { from: 'a.css' }) - * root.source.input.from //=> "/home/ai/a.css" - * - * const root = postcss.parse(css) - * root.source.input.from //=> "" - * ``` - */ - get from(): string - - /** - * @param css Input CSS source. - * @param opts Process options. - */ - constructor(css: string, opts?: ProcessOptions) - - /** - * Returns `CssSyntaxError` with information about the error and its position. - */ - error( - message: string, - start: - | { - column: number - line: number - } - | { - offset: number - }, - end: - | { - column: number - line: number - } - | { - offset: number - }, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - error( - message: string, - line: number, - column: number, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - error( - message: string, - offset: number, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - - /** - * Converts source line and column to offset. - * - * @param line Source line. - * @param column Source column. - * @return Source offset. - */ - fromLineAndColumn(line: number, column: number): number - - /** - * Converts source offset to line and column. - * - * @param offset Source offset. - */ - fromOffset(offset: number): { col: number; line: number } | null - - /** - * Reads the input source map and returns a symbol position - * in the input source (e.g., in a Sass file that was compiled - * to CSS before being passed to PostCSS). Optionally takes an - * end position, exclusive. - * - * ```js - * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } - * root.source.input.origin(1, 1, 1, 4) - * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } - * ``` - * - * @param line Line for inclusive start position in input CSS. - * @param column Column for inclusive start position in input CSS. - * @param endLine Line for exclusive end position in input CSS. - * @param endColumn Column for exclusive end position in input CSS. - * - * @return Position in input source. - */ - origin( - line: number, - column: number, - endLine?: number, - endColumn?: number - ): false | Input.FilePosition - - /** Converts this to a JSON-friendly object representation. */ - toJSON(): object -} - -declare class Input extends Input_ {} - -export = Input diff --git a/web/node_modules/postcss/lib/input.js b/web/node_modules/postcss/lib/input.js deleted file mode 100644 index bb0ccf5..0000000 --- a/web/node_modules/postcss/lib/input.js +++ /dev/null @@ -1,265 +0,0 @@ -'use strict' - -let { nanoid } = require('nanoid/non-secure') -let { isAbsolute, resolve } = require('path') -let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') -let { fileURLToPath, pathToFileURL } = require('url') - -let CssSyntaxError = require('./css-syntax-error') -let PreviousMap = require('./previous-map') -let terminalHighlight = require('./terminal-highlight') - -let lineToIndexCache = Symbol('lineToIndexCache') - -let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) -let pathAvailable = Boolean(resolve && isAbsolute) - -function getLineToIndex(input) { - if (input[lineToIndexCache]) return input[lineToIndexCache] - let lines = input.css.split('\n') - let lineToIndex = new Array(lines.length) - let prevIndex = 0 - - for (let i = 0, l = lines.length; i < l; i++) { - lineToIndex[i] = prevIndex - prevIndex += lines[i].length + 1 - } - - input[lineToIndexCache] = lineToIndex - return lineToIndex -} - -class Input { - get from() { - return this.file || this.id - } - - constructor(css, opts = {}) { - if ( - css === null || - typeof css === 'undefined' || - (typeof css === 'object' && !css.toString) - ) { - throw new Error(`PostCSS received ${css} instead of CSS string`) - } - - this.css = css.toString() - - if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { - this.hasBOM = true - this.css = this.css.slice(1) - } else { - this.hasBOM = false - } - - this.document = this.css - if (opts.document) this.document = opts.document.toString() - - if (opts.from) { - if ( - !pathAvailable || - /^\w+:\/\//.test(opts.from) || - isAbsolute(opts.from) - ) { - this.file = opts.from - } else { - this.file = resolve(opts.from) - } - } - - if (pathAvailable && sourceMapAvailable) { - let map = new PreviousMap(this.css, opts) - if (map.text) { - this.map = map - let file = map.consumer().file - if (!this.file && file) this.file = this.mapResolve(file) - } - } - - if (!this.file) { - this.id = '' - } - if (this.map) this.map.file = this.from - } - - error(message, line, column, opts = {}) { - let endColumn, endLine, endOffset, offset, result - - if (line && typeof line === 'object') { - let start = line - let end = column - if (typeof start.offset === 'number') { - offset = start.offset - let pos = this.fromOffset(offset) - line = pos.line - column = pos.col - } else { - line = start.line - column = start.column - offset = this.fromLineAndColumn(line, column) - } - if (typeof end.offset === 'number') { - endOffset = end.offset - let pos = this.fromOffset(endOffset) - endLine = pos.line - endColumn = pos.col - } else { - endLine = end.line - endColumn = end.column - endOffset = this.fromLineAndColumn(end.line, end.column) - } - } else if (!column) { - offset = line - let pos = this.fromOffset(offset) - line = pos.line - column = pos.col - } else { - offset = this.fromLineAndColumn(line, column) - } - - let origin = this.origin(line, column, endLine, endColumn) - if (origin) { - result = new CssSyntaxError( - message, - origin.endLine === undefined - ? origin.line - : { column: origin.column, line: origin.line }, - origin.endLine === undefined - ? origin.column - : { column: origin.endColumn, line: origin.endLine }, - origin.source, - origin.file, - opts.plugin - ) - } else { - result = new CssSyntaxError( - message, - endLine === undefined ? line : { column, line }, - endLine === undefined ? column : { column: endColumn, line: endLine }, - this.css, - this.file, - opts.plugin - ) - } - - result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css } - if (this.file) { - if (pathToFileURL) { - result.input.url = pathToFileURL(this.file).toString() - } - result.input.file = this.file - } - - return result - } - - fromLineAndColumn(line, column) { - let lineToIndex = getLineToIndex(this) - let index = lineToIndex[line - 1] - return index + column - 1 - } - - fromOffset(offset) { - let lineToIndex = getLineToIndex(this) - let lastLine = lineToIndex[lineToIndex.length - 1] - - let min = 0 - if (offset >= lastLine) { - min = lineToIndex.length - 1 - } else { - let max = lineToIndex.length - 2 - let mid - while (min < max) { - mid = min + ((max - min) >> 1) - if (offset < lineToIndex[mid]) { - max = mid - 1 - } else if (offset >= lineToIndex[mid + 1]) { - min = mid + 1 - } else { - min = mid - break - } - } - } - return { - col: offset - lineToIndex[min] + 1, - line: min + 1 - } - } - - mapResolve(file) { - if (/^\w+:\/\//.test(file)) { - return file - } - return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) - } - - origin(line, column, endLine, endColumn) { - if (!this.map) return false - let consumer = this.map.consumer() - - let from = consumer.originalPositionFor({ column, line }) - if (!from.source) return false - - let to - if (typeof endLine === 'number') { - to = consumer.originalPositionFor({ column: endColumn, line: endLine }) - } - - let fromUrl - - if (isAbsolute(from.source)) { - fromUrl = pathToFileURL(from.source) - } else { - fromUrl = new URL( - from.source, - this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) - ) - } - - let result = { - column: from.column, - endColumn: to && to.column, - endLine: to && to.line, - line: from.line, - url: fromUrl.toString() - } - - if (fromUrl.protocol === 'file:') { - if (fileURLToPath) { - result.file = fileURLToPath(fromUrl) - } else { - /* c8 ignore next 2 */ - throw new Error(`file: protocol is not available in this PostCSS build`) - } - } - - let source = consumer.sourceContentFor(from.source) - if (source) result.source = source - - return result - } - - toJSON() { - let json = {} - for (let name of ['hasBOM', 'css', 'file', 'id']) { - if (this[name] != null) { - json[name] = this[name] - } - } - if (this.map) { - json.map = { ...this.map } - if (json.map.consumerCache) { - json.map.consumerCache = undefined - } - } - return json - } -} - -module.exports = Input -Input.default = Input - -if (terminalHighlight && terminalHighlight.registerInput) { - terminalHighlight.registerInput(Input) -} diff --git a/web/node_modules/postcss/lib/lazy-result.d.ts b/web/node_modules/postcss/lib/lazy-result.d.ts deleted file mode 100644 index 393ab03..0000000 --- a/web/node_modules/postcss/lib/lazy-result.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -import Document from './document.js' -import { SourceMap } from './postcss.js' -import Processor from './processor.js' -import Result, { Message, ResultOptions } from './result.js' -import Root from './root.js' -import Warning from './warning.js' - -declare namespace LazyResult { - - export { LazyResult_ as default } -} - -/** - * A Promise proxy for the result of PostCSS transformations. - * - * A `LazyResult` instance is returned by `Processor#process`. - * - * ```js - * const lazy = postcss([autoprefixer]).process(css) - * ``` - */ -declare class LazyResult_ - implements PromiseLike> -{ - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls onRejected for each error thrown in any plugin. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css).then(result => { - * console.log(result.css) - * }).catch(error => { - * console.error(error) - * }) - * ``` - */ - catch: Promise>['catch'] - - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls onFinally on any error or when all plugins will finish work. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css).finally(() => { - * console.log('processing ended') - * }) - * ``` - */ - finally: Promise>['finally'] - - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls `onFulfilled` with a Result instance. If a plugin throws - * an error, the `onRejected` callback will be executed. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => { - * console.log(result.css) - * }) - * ``` - */ - then: Promise>['then'] - - /** - * An alias for the `css` property. Use it with syntaxes - * that generate non-CSS output. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get content(): string - - /** - * Processes input CSS through synchronous plugins, converts `Root` - * to a CSS string and returns `Result#css`. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get css(): string - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#map`. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get map(): SourceMap - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#messages`. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get messages(): Message[] - - /** - * Options from the `Processor#process` call. - */ - get opts(): ResultOptions - - /** - * Returns a `Processor` instance, which will be used - * for CSS transformations. - */ - get processor(): Processor - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#root`. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get root(): RootNode - - /** - * Returns the default string description of an object. - * Required to implement the Promise interface. - */ - get [Symbol.toStringTag](): string - - /** - * @param processor Processor used for this transformation. - * @param css CSS to parse and transform. - * @param opts Options from the `Processor#process` or `Root#toResult`. - */ - constructor(processor: Processor, css: string, opts: ResultOptions) - - /** - * Run plugin in async way and return `Result`. - * - * @return Result with output content. - */ - async(): Promise> - - /** - * Run plugin in sync way and return `Result`. - * - * @return Result with output content. - */ - sync(): Result - - /** - * Alias for the `LazyResult#css` property. - * - * ```js - * lazy + '' === lazy.css - * ``` - * - * @return Output CSS. - */ - toString(): string - - /** - * Processes input CSS through synchronous plugins - * and calls `Result#warnings`. - * - * @return Warnings from plugins. - */ - warnings(): Warning[] -} - -declare class LazyResult< - RootNode = Document | Root -> extends LazyResult_ {} - -export = LazyResult diff --git a/web/node_modules/postcss/lib/lazy-result.js b/web/node_modules/postcss/lib/lazy-result.js deleted file mode 100644 index 1ea52b8..0000000 --- a/web/node_modules/postcss/lib/lazy-result.js +++ /dev/null @@ -1,550 +0,0 @@ -'use strict' - -let Container = require('./container') -let Document = require('./document') -let MapGenerator = require('./map-generator') -let parse = require('./parse') -let Result = require('./result') -let Root = require('./root') -let stringify = require('./stringify') -let { isClean, my } = require('./symbols') -let warnOnce = require('./warn-once') - -const TYPE_TO_CLASS_NAME = { - atrule: 'AtRule', - comment: 'Comment', - decl: 'Declaration', - document: 'Document', - root: 'Root', - rule: 'Rule' -} - -const PLUGIN_PROPS = { - AtRule: true, - AtRuleExit: true, - Comment: true, - CommentExit: true, - Declaration: true, - DeclarationExit: true, - Document: true, - DocumentExit: true, - Once: true, - OnceExit: true, - postcssPlugin: true, - prepare: true, - Root: true, - RootExit: true, - Rule: true, - RuleExit: true -} - -const NOT_VISITORS = { - Once: true, - postcssPlugin: true, - prepare: true -} - -const CHILDREN = 0 - -function isPromise(obj) { - return typeof obj === 'object' && typeof obj.then === 'function' -} - -function getEvents(node) { - let key = false - let type = TYPE_TO_CLASS_NAME[node.type] - if (node.type === 'decl') { - key = node.prop.toLowerCase() - } else if (node.type === 'atrule') { - key = node.name.toLowerCase() - } - - if (key && node.append) { - return [ - type, - type + '-' + key, - CHILDREN, - type + 'Exit', - type + 'Exit-' + key - ] - } else if (key) { - return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] - } else if (node.append) { - return [type, CHILDREN, type + 'Exit'] - } else { - return [type, type + 'Exit'] - } -} - -function toStack(node) { - let events - if (node.type === 'document') { - events = ['Document', CHILDREN, 'DocumentExit'] - } else if (node.type === 'root') { - events = ['Root', CHILDREN, 'RootExit'] - } else { - events = getEvents(node) - } - - return { - eventIndex: 0, - events, - iterator: 0, - node, - visitorIndex: 0, - visitors: [] - } -} - -function cleanMarks(node) { - node[isClean] = false - if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) - return node -} - -let postcss = {} - -class LazyResult { - get content() { - return this.stringify().content - } - - get css() { - return this.stringify().css - } - - get map() { - return this.stringify().map - } - - get messages() { - return this.sync().messages - } - - get opts() { - return this.result.opts - } - - get processor() { - return this.result.processor - } - - get root() { - return this.sync().root - } - - get [Symbol.toStringTag]() { - return 'LazyResult' - } - - constructor(processor, css, opts) { - this.stringified = false - this.processed = false - - let root - if ( - typeof css === 'object' && - css !== null && - (css.type === 'root' || css.type === 'document') - ) { - root = cleanMarks(css) - } else if (css instanceof LazyResult || css instanceof Result) { - root = cleanMarks(css.root) - if (css.map) { - if (typeof opts.map === 'undefined') opts.map = {} - if (!opts.map.inline) opts.map.inline = false - opts.map.prev = css.map - } - } else { - let parser = parse - if (opts.syntax) parser = opts.syntax.parse - if (opts.parser) parser = opts.parser - if (parser.parse) parser = parser.parse - - try { - root = parser(css, opts) - } catch (error) { - this.processed = true - this.error = error - } - - if (root && !root[my]) { - /* c8 ignore next 2 */ - Container.rebuild(root) - } - } - - this.result = new Result(processor, root, opts) - this.helpers = { ...postcss, postcss, result: this.result } - this.plugins = this.processor.plugins.map(plugin => { - if (typeof plugin === 'object' && plugin.prepare) { - return { ...plugin, ...plugin.prepare(this.result) } - } else { - return plugin - } - }) - } - - async() { - if (this.error) return Promise.reject(this.error) - if (this.processed) return Promise.resolve(this.result) - if (!this.processing) { - this.processing = this.runAsync() - } - return this.processing - } - - catch(onRejected) { - return this.async().catch(onRejected) - } - - finally(onFinally) { - return this.async().then(onFinally, onFinally) - } - - getAsyncError() { - throw new Error('Use process(css).then(cb) to work with async plugins') - } - - handleError(error, node) { - let plugin = this.result.lastPlugin - try { - if (node) node.addToError(error) - this.error = error - if (error.name === 'CssSyntaxError' && !error.plugin) { - error.plugin = plugin.postcssPlugin - error.setMessage() - } else if (plugin.postcssVersion) { - if (process.env.NODE_ENV !== 'production') { - let pluginName = plugin.postcssPlugin - let pluginVer = plugin.postcssVersion - let runtimeVer = this.result.processor.version - let a = pluginVer.split('.') - let b = runtimeVer.split('.') - - if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { - // eslint-disable-next-line no-console - console.error( - 'Unknown error from PostCSS plugin. Your current PostCSS ' + - 'version is ' + - runtimeVer + - ', but ' + - pluginName + - ' uses ' + - pluginVer + - '. Perhaps this is the source of the error below.' - ) - } - } - } - } catch (err) { - /* c8 ignore next 3 */ - // eslint-disable-next-line no-console - if (console && console.error) console.error(err) - } - return error - } - - prepareVisitors() { - this.listeners = {} - let add = (plugin, type, cb) => { - if (!this.listeners[type]) this.listeners[type] = [] - this.listeners[type].push([plugin, cb]) - } - for (let plugin of this.plugins) { - if (typeof plugin === 'object') { - for (let event in plugin) { - if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { - throw new Error( - `Unknown event ${event} in ${plugin.postcssPlugin}. ` + - `Try to update PostCSS (${this.processor.version} now).` - ) - } - if (!NOT_VISITORS[event]) { - if (typeof plugin[event] === 'object') { - for (let filter in plugin[event]) { - if (filter === '*') { - add(plugin, event, plugin[event][filter]) - } else { - add( - plugin, - event + '-' + filter.toLowerCase(), - plugin[event][filter] - ) - } - } - } else if (typeof plugin[event] === 'function') { - add(plugin, event, plugin[event]) - } - } - } - } - } - this.hasListener = Object.keys(this.listeners).length > 0 - } - - async runAsync() { - this.plugin = 0 - for (let i = 0; i < this.plugins.length; i++) { - let plugin = this.plugins[i] - let promise = this.runOnRoot(plugin) - if (isPromise(promise)) { - try { - await promise - } catch (error) { - throw this.handleError(error) - } - } - } - - this.prepareVisitors() - if (this.hasListener) { - let root = this.result.root - while (!root[isClean]) { - root[isClean] = true - let stack = [toStack(root)] - while (stack.length > 0) { - let promise = this.visitTick(stack) - if (isPromise(promise)) { - try { - await promise - } catch (e) { - let node = stack[stack.length - 1].node - throw this.handleError(e, node) - } - } - } - } - - if (this.listeners.OnceExit) { - for (let [plugin, visitor] of this.listeners.OnceExit) { - this.result.lastPlugin = plugin - try { - if (root.type === 'document') { - let roots = root.nodes.map(subRoot => - visitor(subRoot, this.helpers) - ) - - await Promise.all(roots) - } else { - await visitor(root, this.helpers) - } - } catch (e) { - throw this.handleError(e) - } - } - } - } - - this.processed = true - return this.stringify() - } - - runOnRoot(plugin) { - this.result.lastPlugin = plugin - try { - if (typeof plugin === 'object' && plugin.Once) { - if (this.result.root.type === 'document') { - let roots = this.result.root.nodes.map(root => - plugin.Once(root, this.helpers) - ) - - if (isPromise(roots[0])) { - return Promise.all(roots) - } - - return roots - } - - return plugin.Once(this.result.root, this.helpers) - } else if (typeof plugin === 'function') { - return plugin(this.result.root, this.result) - } - } catch (error) { - throw this.handleError(error) - } - } - - stringify() { - if (this.error) throw this.error - if (this.stringified) return this.result - this.stringified = true - - this.sync() - - let opts = this.result.opts - let str = stringify - if (opts.syntax) str = opts.syntax.stringify - if (opts.stringifier) str = opts.stringifier - if (str.stringify) str = str.stringify - - let map = new MapGenerator(str, this.result.root, this.result.opts) - let data = map.generate() - this.result.css = data[0] - this.result.map = data[1] - - return this.result - } - - sync() { - if (this.error) throw this.error - if (this.processed) return this.result - this.processed = true - - if (this.processing) { - throw this.getAsyncError() - } - - for (let plugin of this.plugins) { - let promise = this.runOnRoot(plugin) - if (isPromise(promise)) { - throw this.getAsyncError() - } - } - - this.prepareVisitors() - if (this.hasListener) { - let root = this.result.root - while (!root[isClean]) { - root[isClean] = true - this.walkSync(root) - } - if (this.listeners.OnceExit) { - if (root.type === 'document') { - for (let subRoot of root.nodes) { - this.visitSync(this.listeners.OnceExit, subRoot) - } - } else { - this.visitSync(this.listeners.OnceExit, root) - } - } - } - - return this.result - } - - then(onFulfilled, onRejected) { - if (process.env.NODE_ENV !== 'production') { - if (!('from' in this.opts)) { - warnOnce( - 'Without `from` option PostCSS could generate wrong source map ' + - 'and will not find Browserslist config. Set it to CSS file path ' + - 'or to `undefined` to prevent this warning.' - ) - } - } - return this.async().then(onFulfilled, onRejected) - } - - toString() { - return this.css - } - - visitSync(visitors, node) { - for (let [plugin, visitor] of visitors) { - this.result.lastPlugin = plugin - let promise - try { - promise = visitor(node, this.helpers) - } catch (e) { - throw this.handleError(e, node.proxyOf) - } - if (node.type !== 'root' && node.type !== 'document' && !node.parent) { - return true - } - if (isPromise(promise)) { - throw this.getAsyncError() - } - } - } - - visitTick(stack) { - let visit = stack[stack.length - 1] - let { node, visitors } = visit - - if (node.type !== 'root' && node.type !== 'document' && !node.parent) { - stack.pop() - return - } - - if (visitors.length > 0 && visit.visitorIndex < visitors.length) { - let [plugin, visitor] = visitors[visit.visitorIndex] - visit.visitorIndex += 1 - if (visit.visitorIndex === visitors.length) { - visit.visitors = [] - visit.visitorIndex = 0 - } - this.result.lastPlugin = plugin - try { - return visitor(node.toProxy(), this.helpers) - } catch (e) { - throw this.handleError(e, node) - } - } - - if (visit.iterator !== 0) { - let iterator = visit.iterator - let child - while ((child = node.nodes[node.indexes[iterator]])) { - node.indexes[iterator] += 1 - if (!child[isClean]) { - child[isClean] = true - stack.push(toStack(child)) - return - } - } - visit.iterator = 0 - delete node.indexes[iterator] - } - - let events = visit.events - while (visit.eventIndex < events.length) { - let event = events[visit.eventIndex] - visit.eventIndex += 1 - if (event === CHILDREN) { - if (node.nodes && node.nodes.length) { - node[isClean] = true - visit.iterator = node.getIterator() - } - return - } else if (this.listeners[event]) { - visit.visitors = this.listeners[event] - return - } - } - stack.pop() - } - - walkSync(node) { - node[isClean] = true - let events = getEvents(node) - for (let event of events) { - if (event === CHILDREN) { - if (node.nodes) { - node.each(child => { - if (!child[isClean]) this.walkSync(child) - }) - } - } else { - let visitors = this.listeners[event] - if (visitors) { - if (this.visitSync(visitors, node.toProxy())) return - } - } - } - } - - warnings() { - return this.sync().warnings() - } -} - -LazyResult.registerPostcss = dependant => { - postcss = dependant -} - -module.exports = LazyResult -LazyResult.default = LazyResult - -Root.registerLazyResult(LazyResult) -Document.registerLazyResult(LazyResult) diff --git a/web/node_modules/postcss/lib/list.d.ts b/web/node_modules/postcss/lib/list.d.ts deleted file mode 100644 index e262ad3..0000000 --- a/web/node_modules/postcss/lib/list.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -declare namespace list { - type List = { - /** - * Safely splits comma-separated values (such as those for `transition-*` - * and `background` properties). - * - * ```js - * Once (root, { list }) { - * list.comma('black, linear-gradient(white, black)') - * //=> ['black', 'linear-gradient(white, black)'] - * } - * ``` - * - * @param str Comma-separated values. - * @return Split values. - */ - comma(str: string): string[] - - default: List - - /** - * Safely splits space-separated values (such as those for `background`, - * `border-radius`, and other shorthand properties). - * - * ```js - * Once (root, { list }) { - * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)'] - * } - * ``` - * - * @param str Space-separated values. - * @return Split values. - */ - space(str: string): string[] - - /** - * Safely splits values. - * - * ```js - * Once (root, { list }) { - * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)'] - * } - * ``` - * - * @param string separated values. - * @param separators array of separators. - * @param last boolean indicator. - * @return Split values. - */ - split( - string: string, - separators: readonly string[], - last: boolean - ): string[] - } -} - -declare const list: list.List - -export = list diff --git a/web/node_modules/postcss/lib/list.js b/web/node_modules/postcss/lib/list.js deleted file mode 100644 index 1b31f98..0000000 --- a/web/node_modules/postcss/lib/list.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict' - -let list = { - comma(string) { - return list.split(string, [','], true) - }, - - space(string) { - let spaces = [' ', '\n', '\t'] - return list.split(string, spaces) - }, - - split(string, separators, last) { - let array = [] - let current = '' - let split = false - - let func = 0 - let inQuote = false - let prevQuote = '' - let escape = false - - for (let letter of string) { - if (escape) { - escape = false - } else if (letter === '\\') { - escape = true - } else if (inQuote) { - if (letter === prevQuote) { - inQuote = false - } - } else if (letter === '"' || letter === "'") { - inQuote = true - prevQuote = letter - } else if (letter === '(') { - func += 1 - } else if (letter === ')') { - if (func > 0) func -= 1 - } else if (func === 0) { - if (separators.includes(letter)) split = true - } - - if (split) { - if (current !== '') array.push(current.trim()) - current = '' - split = false - } else { - current += letter - } - } - - if (last || current !== '') array.push(current.trim()) - return array - } -} - -module.exports = list -list.default = list diff --git a/web/node_modules/postcss/lib/map-generator.js b/web/node_modules/postcss/lib/map-generator.js deleted file mode 100644 index df880ac..0000000 --- a/web/node_modules/postcss/lib/map-generator.js +++ /dev/null @@ -1,376 +0,0 @@ -'use strict' - -let { dirname, relative, resolve, sep } = require('path') -let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') -let { pathToFileURL } = require('url') - -let Input = require('./input') - -let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) -let pathAvailable = Boolean(dirname && resolve && relative && sep) - -class MapGenerator { - constructor(stringify, root, opts, cssString) { - this.stringify = stringify - this.mapOpts = opts.map || {} - this.root = root - this.opts = opts - this.css = cssString - this.originalCSS = cssString - this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute - - this.memoizedFileURLs = new Map() - this.memoizedPaths = new Map() - this.memoizedURLs = new Map() - } - - addAnnotation() { - let content - - if (this.isInline()) { - content = - 'data:application/json;base64,' + this.toBase64(this.map.toString()) - } else if (typeof this.mapOpts.annotation === 'string') { - content = this.mapOpts.annotation - } else if (typeof this.mapOpts.annotation === 'function') { - content = this.mapOpts.annotation(this.opts.to, this.root) - } else { - content = this.outputFile() + '.map' - } - let eol = '\n' - if (this.css.includes('\r\n')) eol = '\r\n' - - this.css += eol + '/*# sourceMappingURL=' + content + ' */' - } - - applyPrevMaps() { - for (let prev of this.previous()) { - let from = this.toUrl(this.path(prev.file)) - let root = prev.root || dirname(prev.file) - let map - - if (this.mapOpts.sourcesContent === false) { - map = new SourceMapConsumer(prev.text) - if (map.sourcesContent) { - map.sourcesContent = null - } - } else { - map = prev.consumer() - } - - this.map.applySourceMap(map, from, this.toUrl(this.path(root))) - } - } - - clearAnnotation() { - if (this.mapOpts.annotation === false) return - - if (this.root) { - let node - for (let i = this.root.nodes.length - 1; i >= 0; i--) { - node = this.root.nodes[i] - if (node.type !== 'comment') continue - if (node.text.startsWith('# sourceMappingURL=')) { - this.root.removeChild(i) - } - } - } else if (this.css) { - let startIndex - while ((startIndex = this.css.lastIndexOf('/*#')) !== -1) { - let endIndex = this.css.indexOf('*/', startIndex + 3) - if (endIndex === -1) break - while (startIndex > 0 && this.css[startIndex - 1] === '\n') { - startIndex-- - } - this.css = this.css.slice(0, startIndex) + this.css.slice(endIndex + 2) - } - } - } - - generate() { - this.clearAnnotation() - if (pathAvailable && sourceMapAvailable && this.isMap()) { - return this.generateMap() - } else { - let result = '' - this.stringify(this.root, i => { - result += i - }) - return [result] - } - } - - generateMap() { - if (this.root) { - this.generateString() - } else if (this.previous().length === 1) { - let prev = this.previous()[0].consumer() - prev.file = this.outputFile() - this.map = SourceMapGenerator.fromSourceMap(prev, { - ignoreInvalidMapping: true - }) - } else { - this.map = new SourceMapGenerator({ - file: this.outputFile(), - ignoreInvalidMapping: true - }) - this.map.addMapping({ - generated: { column: 0, line: 1 }, - original: { column: 0, line: 1 }, - source: this.opts.from - ? this.toUrl(this.path(this.opts.from)) - : '' - }) - } - - if (this.isSourcesContent()) this.setSourcesContent() - if (this.root && this.previous().length > 0) this.applyPrevMaps() - if (this.isAnnotation()) this.addAnnotation() - - if (this.isInline()) { - return [this.css] - } else { - return [this.css, this.map] - } - } - - generateString() { - this.css = '' - this.map = new SourceMapGenerator({ - file: this.outputFile(), - ignoreInvalidMapping: true - }) - - let line = 1 - let column = 1 - - let noSource = '' - let mapping = { - generated: { column: 0, line: 0 }, - original: { column: 0, line: 0 }, - source: '' - } - - let last, lines - this.stringify(this.root, (str, node, type) => { - this.css += str - - if (node && type !== 'end') { - mapping.generated.line = line - mapping.generated.column = column - 1 - if (node.source && node.source.start) { - mapping.source = this.sourcePath(node) - mapping.original.line = node.source.start.line - mapping.original.column = node.source.start.column - 1 - this.map.addMapping(mapping) - } else { - mapping.source = noSource - mapping.original.line = 1 - mapping.original.column = 0 - this.map.addMapping(mapping) - } - } - - lines = str.match(/\n/g) - if (lines) { - line += lines.length - last = str.lastIndexOf('\n') - column = str.length - last - } else { - column += str.length - } - - if (node && type !== 'start') { - let p = node.parent || { raws: {} } - let childless = - node.type === 'decl' || (node.type === 'atrule' && !node.nodes) - if (!childless || node !== p.last || p.raws.semicolon) { - if (node.source && node.source.end) { - mapping.source = this.sourcePath(node) - mapping.original.line = node.source.end.line - mapping.original.column = node.source.end.column - 1 - mapping.generated.line = line - mapping.generated.column = column - 2 - this.map.addMapping(mapping) - } else { - mapping.source = noSource - mapping.original.line = 1 - mapping.original.column = 0 - mapping.generated.line = line - mapping.generated.column = column - 1 - this.map.addMapping(mapping) - } - } - } - }) - } - - isAnnotation() { - if (this.isInline()) { - return true - } - if (typeof this.mapOpts.annotation !== 'undefined') { - return this.mapOpts.annotation - } - if (this.previous().length) { - return this.previous().some(i => i.annotation) - } - return true - } - - isInline() { - if (typeof this.mapOpts.inline !== 'undefined') { - return this.mapOpts.inline - } - - let annotation = this.mapOpts.annotation - if (typeof annotation !== 'undefined' && annotation !== true) { - return false - } - - if (this.previous().length) { - return this.previous().some(i => i.inline) - } - return true - } - - isMap() { - if (typeof this.opts.map !== 'undefined') { - return !!this.opts.map - } - return this.previous().length > 0 - } - - isSourcesContent() { - if (typeof this.mapOpts.sourcesContent !== 'undefined') { - return this.mapOpts.sourcesContent - } - if (this.previous().length) { - return this.previous().some(i => i.withContent()) - } - return true - } - - outputFile() { - if (this.opts.to) { - return this.path(this.opts.to) - } else if (this.opts.from) { - return this.path(this.opts.from) - } else { - return 'to.css' - } - } - - path(file) { - if (this.mapOpts.absolute) return file - if (file.charCodeAt(0) === 60 /* `<` */) return file - if (/^\w+:\/\//.test(file)) return file - let cached = this.memoizedPaths.get(file) - if (cached) return cached - - let from = this.opts.to ? dirname(this.opts.to) : '.' - - if (typeof this.mapOpts.annotation === 'string') { - from = dirname(resolve(from, this.mapOpts.annotation)) - } - - let path = relative(from, file) - this.memoizedPaths.set(file, path) - - return path - } - - previous() { - if (!this.previousMaps) { - this.previousMaps = [] - if (this.root) { - this.root.walk(node => { - if (node.source && node.source.input.map) { - let map = node.source.input.map - if (!this.previousMaps.includes(map)) { - this.previousMaps.push(map) - } - } - }) - } else { - let input = new Input(this.originalCSS, this.opts) - if (input.map) this.previousMaps.push(input.map) - } - } - - return this.previousMaps - } - - setSourcesContent() { - let already = {} - if (this.root) { - this.root.walk(node => { - if (node.source) { - let from = node.source.input.from - if (from && !already[from]) { - already[from] = true - let fromUrl = this.usesFileUrls - ? this.toFileUrl(from) - : this.toUrl(this.path(from)) - this.map.setSourceContent(fromUrl, node.source.input.css) - } - } - }) - } else if (this.css) { - let from = this.opts.from - ? this.toUrl(this.path(this.opts.from)) - : '' - this.map.setSourceContent(from, this.css) - } - } - - sourcePath(node) { - if (this.mapOpts.from) { - return this.toUrl(this.mapOpts.from) - } else if (this.usesFileUrls) { - return this.toFileUrl(node.source.input.from) - } else { - return this.toUrl(this.path(node.source.input.from)) - } - } - - toBase64(str) { - if (Buffer) { - return Buffer.from(str).toString('base64') - } else { - return window.btoa(unescape(encodeURIComponent(str))) - } - } - - toFileUrl(path) { - let cached = this.memoizedFileURLs.get(path) - if (cached) return cached - - if (pathToFileURL) { - let fileURL = pathToFileURL(path).toString() - this.memoizedFileURLs.set(path, fileURL) - - return fileURL - } else { - throw new Error( - '`map.absolute` option is not available in this PostCSS build' - ) - } - } - - toUrl(path) { - let cached = this.memoizedURLs.get(path) - if (cached) return cached - - if (sep === '\\') { - path = path.replace(/\\/g, '/') - } - - let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) - this.memoizedURLs.set(path, url) - - return url - } -} - -module.exports = MapGenerator diff --git a/web/node_modules/postcss/lib/no-work-result.d.ts b/web/node_modules/postcss/lib/no-work-result.d.ts deleted file mode 100644 index 747d705..0000000 --- a/web/node_modules/postcss/lib/no-work-result.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import LazyResult from './lazy-result.js' -import { SourceMap } from './postcss.js' -import Processor from './processor.js' -import Result, { Message, ResultOptions } from './result.js' -import Root from './root.js' -import Warning from './warning.js' - -declare namespace NoWorkResult { - - export { NoWorkResult_ as default } -} - -/** - * A Promise proxy for the result of PostCSS transformations. - * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` - * are accessed. See the example below for details. - * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. - * - * ```js - * const noWorkResult = postcss().process(css) // No plugins are defined. - * // CSS is not parsed - * let root = noWorkResult.root // now css is parsed because we accessed the root - * ``` - */ -declare class NoWorkResult_ implements LazyResult { - catch: Promise>['catch'] - finally: Promise>['finally'] - then: Promise>['then'] - get content(): string - get css(): string - get map(): SourceMap - get messages(): Message[] - get opts(): ResultOptions - get processor(): Processor - get root(): Root - get [Symbol.toStringTag](): string - constructor(processor: Processor, css: string, opts: ResultOptions) - async(): Promise> - sync(): Result - toString(): string - warnings(): Warning[] -} - -declare class NoWorkResult extends NoWorkResult_ {} - -export = NoWorkResult diff --git a/web/node_modules/postcss/lib/no-work-result.js b/web/node_modules/postcss/lib/no-work-result.js deleted file mode 100644 index 092fdc3..0000000 --- a/web/node_modules/postcss/lib/no-work-result.js +++ /dev/null @@ -1,137 +0,0 @@ -'use strict' - -let MapGenerator = require('./map-generator') -let parse = require('./parse') -const Result = require('./result') -let stringify = require('./stringify') -let warnOnce = require('./warn-once') - -class NoWorkResult { - get content() { - return this.result.css - } - - get css() { - return this.result.css - } - - get map() { - return this.result.map - } - - get messages() { - return [] - } - - get opts() { - return this.result.opts - } - - get processor() { - return this.result.processor - } - - get root() { - if (this._root) { - return this._root - } - - let root - let parser = parse - - try { - root = parser(this._css, this._opts) - } catch (error) { - this.error = error - } - - if (this.error) { - throw this.error - } else { - this._root = root - return root - } - } - - get [Symbol.toStringTag]() { - return 'NoWorkResult' - } - - constructor(processor, css, opts) { - css = css.toString() - this.stringified = false - - this._processor = processor - this._css = css - this._opts = opts - this._map = undefined - - let str = stringify - this.result = new Result(this._processor, undefined, this._opts) - this.result.css = css - - let self = this - Object.defineProperty(this.result, 'root', { - get() { - return self.root - } - }) - - let map = new MapGenerator(str, undefined, this._opts, css) - if (map.isMap()) { - let [generatedCSS, generatedMap] = map.generate() - if (generatedCSS) { - this.result.css = generatedCSS - } - if (generatedMap) { - this.result.map = generatedMap - } - } else { - map.clearAnnotation() - this.result.css = map.css - } - } - - async() { - if (this.error) return Promise.reject(this.error) - return Promise.resolve(this.result) - } - - catch(onRejected) { - return this.async().catch(onRejected) - } - - finally(onFinally) { - return this.async().then(onFinally, onFinally) - } - - sync() { - if (this.error) throw this.error - return this.result - } - - then(onFulfilled, onRejected) { - if (process.env.NODE_ENV !== 'production') { - if (!('from' in this._opts)) { - warnOnce( - 'Without `from` option PostCSS could generate wrong source map ' + - 'and will not find Browserslist config. Set it to CSS file path ' + - 'or to `undefined` to prevent this warning.' - ) - } - } - - return this.async().then(onFulfilled, onRejected) - } - - toString() { - return this._css - } - - warnings() { - return [] - } -} - -module.exports = NoWorkResult -NoWorkResult.default = NoWorkResult diff --git a/web/node_modules/postcss/lib/node.d.ts b/web/node_modules/postcss/lib/node.d.ts deleted file mode 100644 index a48120e..0000000 --- a/web/node_modules/postcss/lib/node.d.ts +++ /dev/null @@ -1,556 +0,0 @@ -import AtRule = require('./at-rule.js') -import { AtRuleProps } from './at-rule.js' -import Comment, { CommentProps } from './comment.js' -import Container, { NewChild } from './container.js' -import CssSyntaxError from './css-syntax-error.js' -import Declaration, { DeclarationProps } from './declaration.js' -import Document from './document.js' -import Input from './input.js' -import { Stringifier, Syntax } from './postcss.js' -import Result from './result.js' -import Root from './root.js' -import Rule, { RuleProps } from './rule.js' -import Warning, { WarningOptions } from './warning.js' - -declare namespace Node { - export type ChildNode = AtRule.default | Comment | Declaration | Rule - - export type AnyNode = - | AtRule.default - | Comment - | Declaration - | Document - | Root - | Rule - - export type ChildProps = - | AtRuleProps - | CommentProps - | DeclarationProps - | RuleProps - - export interface Position { - /** - * Source line in file. In contrast to `offset` it starts from 1. - */ - column: number - - /** - * Source column in file. - */ - line: number - - /** - * Source offset in file. It starts from 0. - */ - offset: number - } - - export interface Range { - /** - * End position, exclusive. - */ - end: Position - - /** - * Start position, inclusive. - */ - start: Position - } - - /** - * Source represents an interface for the {@link Node.source} property. - */ - export interface Source { - /** - * The inclusive ending position for the source - * code of a node. - * - * However, `end.offset` of a non `Root` node is the exclusive position. - * See https://github.com/postcss/postcss/pull/1879 for details. - * - * ```js - * const root = postcss.parse('a { color: black }') - * const a = root.first - * const color = a.first - * - * // The offset of `Root` node is the inclusive position - * css.source.end // { line: 1, column: 19, offset: 18 } - * - * // The offset of non `Root` node is the exclusive position - * a.source.end // { line: 1, column: 18, offset: 18 } - * color.source.end // { line: 1, column: 16, offset: 16 } - * ``` - */ - end?: Position - - /** - * The source file from where a node has originated. - */ - input: Input - - /** - * The inclusive starting position for the source - * code of a node. - */ - start?: Position - } - - /** - * Interface represents an interface for an object received - * as parameter by Node class constructor. - */ - export interface NodeProps { - source?: Source - } - - export interface NodeErrorOptions { - /** - * An ending index inside a node's string that should be highlighted as - * source of error. - */ - endIndex?: number - /** - * An index inside a node's string that should be highlighted as source - * of error. - */ - index?: number - /** - * Plugin name that created this error. PostCSS will set it automatically. - */ - plugin?: string - /** - * A word inside a node's string, that should be highlighted as source - * of error. - */ - word?: string - } - - - class Node extends Node_ {} - export { Node as default } -} - -/** - * It represents an abstract class that handles common - * methods for other CSS abstract syntax tree nodes. - * - * Any node that represents CSS selector or value should - * not extend the `Node` class. - */ -declare abstract class Node_ { - /** - * It represents parent of the current node. - * - * ```js - * root.nodes[0].parent === root //=> true - * ``` - */ - parent: Container | Document | undefined - - /** - * It represents unnecessary whitespace and characters present - * in the css source code. - * - * Information to generate byte-to-byte equal node string as it was - * in the origin input. - * - * The properties of the raws object are decided by parser, - * the default parser uses the following properties: - * - * * `before`: the space symbols before the node. It also stores `*` - * and `_` symbols before the declaration (IE hack). - * * `after`: the space symbols after the last child of the node - * to the end of the node. - * * `between`: the symbols between the property and value - * for declarations, selector and `{` for rules, or last parameter - * and `{` for at-rules. - * * `semicolon`: contains true if the last child has - * an (optional) semicolon. - * * `afterName`: the space between the at-rule name and its parameters. - * * `left`: the space symbols between `/*` and the comment’s text. - * * `right`: the space symbols between the comment’s text - * and */. - * - `important`: the content of the important statement, - * if it is not just `!important`. - * - * PostCSS filters out the comments inside selectors, declaration values - * and at-rule parameters but it stores the origin content in raws. - * - * ```js - * const root = postcss.parse('a {\n color:black\n}') - * root.first.first.raws //=> { before: '\n ', between: ':' } - * ``` - */ - raws: any - - /** - * It represents information related to origin of a node and is required - * for generating source maps. - * - * The nodes that are created manually using the public APIs - * provided by PostCSS will have `source` undefined and - * will be absent in the source map. - * - * For this reason, the plugin developer should consider - * duplicating nodes as the duplicate node will have the - * same source as the original node by default or assign - * source to a node created manually. - * - * ```js - * decl.source.input.from //=> '/home/ai/source.css' - * decl.source.start //=> { line: 10, column: 2 } - * decl.source.end //=> { line: 10, column: 12 } - * ``` - * - * ```js - * // Incorrect method, source not specified! - * const prefixed = postcss.decl({ - * prop: '-moz-' + decl.prop, - * value: decl.value - * }) - * - * // Correct method, source is inherited when duplicating. - * const prefixed = decl.clone({ - * prop: '-moz-' + decl.prop - * }) - * ``` - * - * ```js - * if (atrule.name === 'add-link') { - * const rule = postcss.rule({ - * selector: 'a', - * source: atrule.source - * }) - * - * atrule.parent.insertBefore(atrule, rule) - * } - * ``` - */ - source?: Node.Source - - /** - * It represents type of a node in - * an abstract syntax tree. - * - * A type of node helps in identification of a node - * and perform operation based on it's type. - * - * ```js - * const declaration = new Declaration({ - * prop: 'color', - * value: 'black' - * }) - * - * declaration.type //=> 'decl' - * ``` - */ - type: string - - constructor(defaults?: object) - - /** - * Insert new node after current node to current node’s parent. - * - * Just alias for `node.parent.insertAfter(node, add)`. - * - * ```js - * decl.after('color: black') - * ``` - * - * @param newNode New node. - * @return This node for methods chain. - */ - after( - newNode: Node | Node.ChildProps | readonly Node[] | string | undefined - ): this - - /** - * It assigns properties to an existing node instance. - * - * ```js - * decl.assign({ prop: 'word-wrap', value: 'break-word' }) - * ``` - * - * @param overrides New properties to override the node. - * - * @return `this` for method chaining. - */ - assign(overrides: object): this - - /** - * Insert new node before current node to current node’s parent. - * - * Just alias for `node.parent.insertBefore(node, add)`. - * - * ```js - * decl.before('content: ""') - * ``` - * - * @param newNode New node. - * @return This node for methods chain. - */ - before( - newNode: Node | Node.ChildProps | readonly Node[] | string | undefined - ): this - - /** - * Clear the code style properties for the node and its children. - * - * ```js - * node.raws.before //=> ' ' - * node.cleanRaws() - * node.raws.before //=> undefined - * ``` - * - * @param keepBetween Keep the `raws.between` symbols. - */ - cleanRaws(keepBetween?: boolean): void - - /** - * It creates clone of an existing node, which includes all the properties - * and their values, that includes `raws` but not `type`. - * - * ```js - * decl.raws.before //=> "\n " - * const cloned = decl.clone({ prop: '-moz-' + decl.prop }) - * cloned.raws.before //=> "\n " - * cloned.toString() //=> -moz-transform: scale(0) - * ``` - * - * @param overrides New properties to override in the clone. - * - * @return Duplicate of the node instance. - */ - clone(overrides?: object): this - - /** - * Shortcut to clone the node and insert the resulting cloned node - * after the current node. - * - * @param overrides New properties to override in the clone. - * @return New node. - */ - cloneAfter(overrides?: object): this - - /** - * Shortcut to clone the node and insert the resulting cloned node - * before the current node. - * - * ```js - * decl.cloneBefore({ prop: '-moz-' + decl.prop }) - * ``` - * - * @param overrides Mew properties to override in the clone. - * - * @return New node - */ - cloneBefore(overrides?: object): this - - /** - * It creates an instance of the class `CssSyntaxError` and parameters passed - * to this method are assigned to the error instance. - * - * The error instance will have description for the - * error, original position of the node in the - * source, showing line and column number. - * - * If any previous map is present, it would be used - * to get original position of the source. - * - * The Previous Map here is referred to the source map - * generated by previous compilation, example: Less, - * Stylus and Sass. - * - * This method returns the error instance instead of - * throwing it. - * - * ```js - * if (!variables[name]) { - * throw decl.error(`Unknown variable ${name}`, { word: name }) - * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black - * // color: $black - * // a - * // ^ - * // background: white - * } - * ``` - * - * @param message Description for the error instance. - * @param options Options for the error instance. - * - * @return Error instance is returned. - */ - error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError - - /** - * Returns the next child of the node’s parent. - * Returns `undefined` if the current node is the last child. - * - * ```js - * if (comment.text === 'delete next') { - * const next = comment.next() - * if (next) { - * next.remove() - * } - * } - * ``` - * - * @return Next node. - */ - next(): Node.ChildNode | undefined - - /** - * Get the position for a word or an index inside the node. - * - * @param opts Options. - * @return Position. - */ - positionBy(opts?: Pick): Node.Position - - /** - * Convert string index to line/column. - * - * @param index The symbol number in the node’s string. - * @return Symbol position in file. - */ - positionInside(index: number): Node.Position - - /** - * Returns the previous child of the node’s parent. - * Returns `undefined` if the current node is the first child. - * - * ```js - * const annotation = decl.prev() - * if (annotation.type === 'comment') { - * readAnnotation(annotation.text) - * } - * ``` - * - * @return Previous node. - */ - prev(): Node.ChildNode | undefined - - /** - * Get the range for a word or start and end index inside the node. - * The start index is inclusive; the end index is exclusive. - * - * @param opts Options. - * @return Range. - */ - rangeBy( - opts?: Pick - ): Node.Range - - /** - * Returns a `raws` value. If the node is missing - * the code style property (because the node was manually built or cloned), - * PostCSS will try to autodetect the code style property by looking - * at other nodes in the tree. - * - * ```js - * const root = postcss.parse('a { background: white }') - * root.nodes[0].append({ prop: 'color', value: 'black' }) - * root.nodes[0].nodes[1].raws.before //=> undefined - * root.nodes[0].nodes[1].raw('before') //=> ' ' - * ``` - * - * @param prop Name of code style property. - * @param defaultType Name of default value, it can be missed - * if the value is the same as prop. - * @return {string} Code style value. - */ - raw(prop: string, defaultType?: string): string - - /** - * It removes the node from its parent and deletes its parent property. - * - * ```js - * if (decl.prop.match(/^-webkit-/)) { - * decl.remove() - * } - * ``` - * - * @return `this` for method chaining. - */ - remove(): this - - /** - * Inserts node(s) before the current node and removes the current node. - * - * ```js - * AtRule: { - * mixin: atrule => { - * atrule.replaceWith(mixinRules[atrule.params]) - * } - * } - * ``` - * - * @param nodes Mode(s) to replace current one. - * @return Current node to methods chain. - */ - replaceWith(...nodes: NewChild[]): this - - /** - * Finds the Root instance of the node’s tree. - * - * ```js - * root.nodes[0].nodes[0].root() === root - * ``` - * - * @return Root parent. - */ - root(): Root - - /** - * Fix circular links on `JSON.stringify()`. - * - * @return Cleaned object. - */ - toJSON(): object - - /** - * It compiles the node to browser readable cascading style sheets string - * depending on it's type. - * - * ```js - * new Rule({ selector: 'a' }).toString() //=> "a {}" - * ``` - * - * @param stringifier A syntax to use in string generation. - * @return CSS string of this node. - */ - toString(stringifier?: Stringifier | Syntax): string - - /** - * It is a wrapper for {@link Result#warn}, providing convenient - * way of generating warnings. - * - * ```js - * Declaration: { - * bad: (decl, { result }) => { - * decl.warn(result, 'Deprecated property: bad') - * } - * } - * ``` - * - * @param result The `Result` instance that will receive the warning. - * @param message Description for the warning. - * @param options Options for the warning. - * - * @return `Warning` instance is returned - */ - warn(result: Result, message: string, options?: WarningOptions): Warning - - /** - * If this node isn't already dirty, marks it and its ancestors as such. This - * indicates to the LazyResult processor that the {@link Root} has been - * modified by the current plugin and may need to be processed again by other - * plugins. - */ - protected markDirty(): void -} - -declare class Node extends Node_ {} - -export = Node diff --git a/web/node_modules/postcss/lib/node.js b/web/node_modules/postcss/lib/node.js deleted file mode 100644 index b403b71..0000000 --- a/web/node_modules/postcss/lib/node.js +++ /dev/null @@ -1,449 +0,0 @@ -'use strict' - -let CssSyntaxError = require('./css-syntax-error') -let Stringifier = require('./stringifier') -let stringify = require('./stringify') -let { isClean, my } = require('./symbols') - -function cloneNode(obj, parent) { - let cloned = new obj.constructor() - - for (let i in obj) { - if (!Object.prototype.hasOwnProperty.call(obj, i)) { - /* c8 ignore next 2 */ - continue - } - if (i === 'proxyCache') continue - let value = obj[i] - let type = typeof value - - if (i === 'parent' && type === 'object') { - if (parent) cloned[i] = parent - } else if (i === 'source') { - cloned[i] = value - } else if (Array.isArray(value)) { - cloned[i] = value.map(j => cloneNode(j, cloned)) - } else { - if (type === 'object' && value !== null) value = cloneNode(value) - cloned[i] = value - } - } - - return cloned -} - -function sourceOffset(inputCSS, position) { - // Not all custom syntaxes support `offset` in `source.start` and `source.end` - if (position && typeof position.offset !== 'undefined') { - return position.offset - } - - let column = 1 - let line = 1 - let offset = 0 - - for (let i = 0; i < inputCSS.length; i++) { - if (line === position.line && column === position.column) { - offset = i - break - } - - if (inputCSS[i] === '\n') { - column = 1 - line += 1 - } else { - column += 1 - } - } - - return offset -} - -class Node { - get proxyOf() { - return this - } - - constructor(defaults = {}) { - this.raws = {} - this[isClean] = false - this[my] = true - - for (let name in defaults) { - if (name === 'nodes') { - this.nodes = [] - for (let node of defaults[name]) { - if (typeof node.clone === 'function') { - this.append(node.clone()) - } else { - this.append(node) - } - } - } else { - this[name] = defaults[name] - } - } - } - - addToError(error) { - error.postcssNode = this - if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { - let s = this.source - error.stack = error.stack.replace( - /\n\s{4}at /, - `$&${s.input.from}:${s.start.line}:${s.start.column}$&` - ) - } - return error - } - - after(add) { - this.parent.insertAfter(this, add) - return this - } - - assign(overrides = {}) { - for (let name in overrides) { - this[name] = overrides[name] - } - return this - } - - before(add) { - this.parent.insertBefore(this, add) - return this - } - - cleanRaws(keepBetween) { - delete this.raws.before - delete this.raws.after - if (!keepBetween) delete this.raws.between - } - - clone(overrides = {}) { - let cloned = cloneNode(this) - for (let name in overrides) { - cloned[name] = overrides[name] - } - return cloned - } - - cloneAfter(overrides = {}) { - let cloned = this.clone(overrides) - this.parent.insertAfter(this, cloned) - return cloned - } - - cloneBefore(overrides = {}) { - let cloned = this.clone(overrides) - this.parent.insertBefore(this, cloned) - return cloned - } - - error(message, opts = {}) { - if (this.source) { - let { end, start } = this.rangeBy(opts) - return this.source.input.error( - message, - { column: start.column, line: start.line }, - { column: end.column, line: end.line }, - opts - ) - } - return new CssSyntaxError(message) - } - - getProxyProcessor() { - return { - get(node, prop) { - if (prop === 'proxyOf') { - return node - } else if (prop === 'root') { - return () => node.root().toProxy() - } else { - return node[prop] - } - }, - - set(node, prop, value) { - if (node[prop] === value) return true - node[prop] = value - if ( - prop === 'prop' || - prop === 'value' || - prop === 'name' || - prop === 'params' || - prop === 'important' || - /* c8 ignore next */ - prop === 'text' - ) { - node.markDirty() - } - return true - } - } - } - - /* c8 ignore next 3 */ - markClean() { - this[isClean] = true - } - - markDirty() { - if (this[isClean]) { - this[isClean] = false - let next = this - while ((next = next.parent)) { - next[isClean] = false - } - } - } - - next() { - if (!this.parent) return undefined - let index = this.parent.index(this) - return this.parent.nodes[index + 1] - } - - positionBy(opts = {}) { - let pos = this.source.start - if (opts.index) { - pos = this.positionInside(opts.index) - } else if (opts.word) { - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let stringRepresentation = inputString.slice( - sourceOffset(inputString, this.source.start), - sourceOffset(inputString, this.source.end) - ) - let index = stringRepresentation.indexOf(opts.word) - if (index !== -1) pos = this.positionInside(index) - } - return pos - } - - positionInside(index) { - let column = this.source.start.column - let line = this.source.start.line - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let offset = sourceOffset(inputString, this.source.start) - let end = offset + index - - for (let i = offset; i < end; i++) { - if (inputString[i] === '\n') { - column = 1 - line += 1 - } else { - column += 1 - } - } - - return { column, line, offset: end } - } - - prev() { - if (!this.parent) return undefined - let index = this.parent.index(this) - return this.parent.nodes[index - 1] - } - - rangeBy(opts = {}) { - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let start = { - column: this.source.start.column, - line: this.source.start.line, - offset: sourceOffset(inputString, this.source.start) - } - let end = this.source.end - ? { - column: this.source.end.column + 1, - line: this.source.end.line, - offset: - typeof this.source.end.offset === 'number' - ? // `source.end.offset` is exclusive, so we don't need to add 1 - this.source.end.offset - : // Since line/column in this.source.end is inclusive, - // the `sourceOffset(... , this.source.end)` returns an inclusive offset. - // So, we add 1 to convert it to exclusive. - sourceOffset(inputString, this.source.end) + 1 - } - : { - column: start.column + 1, - line: start.line, - offset: start.offset + 1 - } - - if (opts.word) { - let stringRepresentation = inputString.slice( - sourceOffset(inputString, this.source.start), - sourceOffset(inputString, this.source.end) - ) - let index = stringRepresentation.indexOf(opts.word) - if (index !== -1) { - start = this.positionInside(index) - end = this.positionInside(index + opts.word.length) - } - } else { - if (opts.start) { - start = { - column: opts.start.column, - line: opts.start.line, - offset: sourceOffset(inputString, opts.start) - } - } else if (opts.index) { - start = this.positionInside(opts.index) - } - - if (opts.end) { - end = { - column: opts.end.column, - line: opts.end.line, - offset: sourceOffset(inputString, opts.end) - } - } else if (typeof opts.endIndex === 'number') { - end = this.positionInside(opts.endIndex) - } else if (opts.index) { - end = this.positionInside(opts.index + 1) - } - } - - if ( - end.line < start.line || - (end.line === start.line && end.column <= start.column) - ) { - end = { - column: start.column + 1, - line: start.line, - offset: start.offset + 1 - } - } - - return { end, start } - } - - raw(prop, defaultType) { - let str = new Stringifier() - return str.raw(this, prop, defaultType) - } - - remove() { - if (this.parent) { - this.parent.removeChild(this) - } - this.parent = undefined - return this - } - - replaceWith(...nodes) { - if (this.parent) { - let bookmark = this - let foundSelf = false - for (let node of nodes) { - if (node === this) { - foundSelf = true - } else if (foundSelf) { - this.parent.insertAfter(bookmark, node) - bookmark = node - } else { - this.parent.insertBefore(bookmark, node) - } - } - - if (!foundSelf) { - this.remove() - } - } - - return this - } - - root() { - let result = this - while (result.parent && result.parent.type !== 'document') { - result = result.parent - } - return result - } - - toJSON(_, inputs) { - let fixed = {} - let emitInputs = inputs == null - inputs = inputs || new Map() - let inputsNextIndex = 0 - - for (let name in this) { - if (!Object.prototype.hasOwnProperty.call(this, name)) { - /* c8 ignore next 2 */ - continue - } - if (name === 'parent' || name === 'proxyCache') continue - let value = this[name] - - if (Array.isArray(value)) { - fixed[name] = value.map(i => { - if (typeof i === 'object' && i.toJSON) { - return i.toJSON(null, inputs) - } else { - return i - } - }) - } else if (typeof value === 'object' && value.toJSON) { - fixed[name] = value.toJSON(null, inputs) - } else if (name === 'source') { - if (value == null) continue - let inputId = inputs.get(value.input) - if (inputId == null) { - inputId = inputsNextIndex - inputs.set(value.input, inputsNextIndex) - inputsNextIndex++ - } - fixed[name] = { - end: value.end, - inputId, - start: value.start - } - } else { - fixed[name] = value - } - } - - if (emitInputs) { - fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) - } - - return fixed - } - - toProxy() { - if (!this.proxyCache) { - this.proxyCache = new Proxy(this, this.getProxyProcessor()) - } - return this.proxyCache - } - - toString(stringifier = stringify) { - if (stringifier.stringify) stringifier = stringifier.stringify - let result = '' - stringifier(this, i => { - result += i - }) - return result - } - - warn(result, text, opts = {}) { - let data = { node: this } - for (let i in opts) data[i] = opts[i] - return result.warn(text, data) - } -} - -module.exports = Node -Node.default = Node diff --git a/web/node_modules/postcss/lib/parse.d.ts b/web/node_modules/postcss/lib/parse.d.ts deleted file mode 100644 index 4c943a4..0000000 --- a/web/node_modules/postcss/lib/parse.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Parser } from './postcss.js' - -interface Parse extends Parser { - default: Parse -} - -declare const parse: Parse - -export = parse diff --git a/web/node_modules/postcss/lib/parse.js b/web/node_modules/postcss/lib/parse.js deleted file mode 100644 index 00a1037..0000000 --- a/web/node_modules/postcss/lib/parse.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -let Container = require('./container') -let Input = require('./input') -let Parser = require('./parser') - -function parse(css, opts) { - let input = new Input(css, opts) - let parser = new Parser(input) - try { - parser.parse() - } catch (e) { - if (process.env.NODE_ENV !== 'production') { - if (e.name === 'CssSyntaxError' && opts && opts.from) { - if (/\.scss$/i.test(opts.from)) { - e.message += - '\nYou tried to parse SCSS with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-scss parser' - } else if (/\.sass/i.test(opts.from)) { - e.message += - '\nYou tried to parse Sass with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-sass parser' - } else if (/\.less$/i.test(opts.from)) { - e.message += - '\nYou tried to parse Less with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-less parser' - } - } - } - throw e - } - - return parser.root -} - -module.exports = parse -parse.default = parse - -Container.registerParse(parse) diff --git a/web/node_modules/postcss/lib/parser.js b/web/node_modules/postcss/lib/parser.js deleted file mode 100644 index b29ff5b..0000000 --- a/web/node_modules/postcss/lib/parser.js +++ /dev/null @@ -1,611 +0,0 @@ -'use strict' - -let AtRule = require('./at-rule') -let Comment = require('./comment') -let Declaration = require('./declaration') -let Root = require('./root') -let Rule = require('./rule') -let tokenizer = require('./tokenize') - -const SAFE_COMMENT_NEIGHBOR = { - empty: true, - space: true -} - -function findLastWithPosition(tokens) { - for (let i = tokens.length - 1; i >= 0; i--) { - let token = tokens[i] - let pos = token[3] || token[2] - if (pos) return pos - } -} - -class Parser { - constructor(input) { - this.input = input - - this.root = new Root() - this.current = this.root - this.spaces = '' - this.semicolon = false - - this.createTokenizer() - this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } - } - - atrule(token) { - let node = new AtRule() - node.name = token[1].slice(1) - if (node.name === '') { - this.unnamedAtrule(node, token) - } - this.init(node, token[2]) - - let type - let prev - let shift - let last = false - let open = false - let params = [] - let brackets = [] - - while (!this.tokenizer.endOfFile()) { - token = this.tokenizer.nextToken() - type = token[0] - - if (type === '(' || type === '[') { - brackets.push(type === '(' ? ')' : ']') - } else if (type === '{' && brackets.length > 0) { - brackets.push('}') - } else if (type === brackets[brackets.length - 1]) { - brackets.pop() - } - - if (brackets.length === 0) { - if (type === ';') { - node.source.end = this.getPosition(token[2]) - node.source.end.offset++ - this.semicolon = true - break - } else if (type === '{') { - open = true - break - } else if (type === '}') { - if (params.length > 0) { - shift = params.length - 1 - prev = params[shift] - while (prev && prev[0] === 'space') { - prev = params[--shift] - } - if (prev) { - node.source.end = this.getPosition(prev[3] || prev[2]) - node.source.end.offset++ - } - } - this.end(token) - break - } else { - params.push(token) - } - } else { - params.push(token) - } - - if (this.tokenizer.endOfFile()) { - last = true - break - } - } - - node.raws.between = this.spacesAndCommentsFromEnd(params) - if (params.length) { - node.raws.afterName = this.spacesAndCommentsFromStart(params) - this.raw(node, 'params', params) - if (last) { - token = params[params.length - 1] - node.source.end = this.getPosition(token[3] || token[2]) - node.source.end.offset++ - this.spaces = node.raws.between - node.raws.between = '' - } - } else { - node.raws.afterName = '' - node.params = '' - } - - if (open) { - node.nodes = [] - this.current = node - } - } - - checkMissedSemicolon(tokens) { - let colon = this.colon(tokens) - if (colon === false) return - - let founded = 0 - let token - for (let j = colon - 1; j >= 0; j--) { - token = tokens[j] - if (token[0] !== 'space') { - founded += 1 - if (founded === 2) break - } - } - // If the token is a word, e.g. `!important`, `red` or any other valid property's value. - // Then we need to return the colon after that word token. [3] is the "end" colon of that word. - // And because we need it after that one we do +1 to get the next one. - throw this.input.error( - 'Missed semicolon', - token[0] === 'word' ? token[3] + 1 : token[2] - ) - } - - colon(tokens) { - let brackets = 0 - let prev, token, type - for (let [i, element] of tokens.entries()) { - token = element - type = token[0] - - if (type === '(') { - brackets += 1 - } - if (type === ')') { - brackets -= 1 - } - if (brackets === 0 && type === ':') { - if (!prev) { - this.doubleColon(token) - } else if (prev[0] === 'word' && prev[1] === 'progid') { - continue - } else { - return i - } - } - - prev = token - } - return false - } - - comment(token) { - let node = new Comment() - this.init(node, token[2]) - node.source.end = this.getPosition(token[3] || token[2]) - node.source.end.offset++ - - let text = token[1].slice(2, -2) - if (!text.trim()) { - node.text = '' - node.raws.left = text - node.raws.right = '' - } else { - let match = text.match(/^(\s*)([^]*\S)(\s*)$/) - node.text = match[2] - node.raws.left = match[1] - node.raws.right = match[3] - } - } - - createTokenizer() { - this.tokenizer = tokenizer(this.input) - } - - decl(tokens, customProperty) { - let node = new Declaration() - this.init(node, tokens[0][2]) - - let last = tokens[tokens.length - 1] - if (last[0] === ';') { - this.semicolon = true - tokens.pop() - } - - node.source.end = this.getPosition( - last[3] || last[2] || findLastWithPosition(tokens) - ) - node.source.end.offset++ - - while (tokens[0][0] !== 'word') { - if (tokens.length === 1) this.unknownWord(tokens) - node.raws.before += tokens.shift()[1] - } - node.source.start = this.getPosition(tokens[0][2]) - - node.prop = '' - while (tokens.length) { - let type = tokens[0][0] - if (type === ':' || type === 'space' || type === 'comment') { - break - } - node.prop += tokens.shift()[1] - } - - node.raws.between = '' - - let token - while (tokens.length) { - token = tokens.shift() - - if (token[0] === ':') { - node.raws.between += token[1] - break - } else { - if (token[0] === 'word' && /\w/.test(token[1])) { - this.unknownWord([token]) - } - node.raws.between += token[1] - } - } - - if (node.prop[0] === '_' || node.prop[0] === '*') { - node.raws.before += node.prop[0] - node.prop = node.prop.slice(1) - } - - let firstSpaces = [] - let next - while (tokens.length) { - next = tokens[0][0] - if (next !== 'space' && next !== 'comment') break - firstSpaces.push(tokens.shift()) - } - - this.precheckMissedSemicolon(tokens) - - for (let i = tokens.length - 1; i >= 0; i--) { - token = tokens[i] - if (token[1].toLowerCase() === '!important') { - node.important = true - let string = this.stringFrom(tokens, i) - string = this.spacesFromEnd(tokens) + string - if (string !== ' !important') node.raws.important = string - break - } else if (token[1].toLowerCase() === 'important') { - let cache = tokens.slice(0) - let str = '' - for (let j = i; j > 0; j--) { - let type = cache[j][0] - if (str.trim().startsWith('!') && type !== 'space') { - break - } - str = cache.pop()[1] + str - } - if (str.trim().startsWith('!')) { - node.important = true - node.raws.important = str - tokens = cache - } - } - - if (token[0] !== 'space' && token[0] !== 'comment') { - break - } - } - - let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') - - if (hasWord) { - node.raws.between += firstSpaces.map(i => i[1]).join('') - firstSpaces = [] - } - this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) - - if (node.value.includes(':') && !customProperty) { - this.checkMissedSemicolon(tokens) - } - } - - doubleColon(token) { - throw this.input.error( - 'Double colon', - { offset: token[2] }, - { offset: token[2] + token[1].length } - ) - } - - emptyRule(token) { - let node = new Rule() - this.init(node, token[2]) - node.selector = '' - node.raws.between = '' - this.current = node - } - - end(token) { - if (this.current.nodes && this.current.nodes.length) { - this.current.raws.semicolon = this.semicolon - } - this.semicolon = false - - this.current.raws.after = (this.current.raws.after || '') + this.spaces - this.spaces = '' - - if (this.current.parent) { - this.current.source.end = this.getPosition(token[2]) - this.current.source.end.offset++ - this.current = this.current.parent - } else { - this.unexpectedClose(token) - } - } - - endFile() { - if (this.current.parent) this.unclosedBlock() - if (this.current.nodes && this.current.nodes.length) { - this.current.raws.semicolon = this.semicolon - } - this.current.raws.after = (this.current.raws.after || '') + this.spaces - this.root.source.end = this.getPosition(this.tokenizer.position()) - } - - freeSemicolon(token) { - this.spaces += token[1] - if (this.current.nodes) { - let prev = this.current.nodes[this.current.nodes.length - 1] - if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { - prev.raws.ownSemicolon = this.spaces - this.spaces = '' - prev.source.end = this.getPosition(token[2]) - prev.source.end.offset += prev.raws.ownSemicolon.length - } - } - } - - // Helpers - - getPosition(offset) { - let pos = this.input.fromOffset(offset) - return { - column: pos.col, - line: pos.line, - offset - } - } - - init(node, offset) { - this.current.push(node) - node.source = { - input: this.input, - start: this.getPosition(offset) - } - node.raws.before = this.spaces - this.spaces = '' - if (node.type !== 'comment') this.semicolon = false - } - - other(start) { - let end = false - let type = null - let colon = false - let bracket = null - let brackets = [] - let customProperty = start[1].startsWith('--') - - let tokens = [] - let token = start - while (token) { - type = token[0] - tokens.push(token) - - if (type === '(' || type === '[') { - if (!bracket) bracket = token - brackets.push(type === '(' ? ')' : ']') - } else if (customProperty && colon && type === '{') { - if (!bracket) bracket = token - brackets.push('}') - } else if (brackets.length === 0) { - if (type === ';') { - if (colon) { - this.decl(tokens, customProperty) - return - } else { - break - } - } else if (type === '{') { - this.rule(tokens) - return - } else if (type === '}') { - this.tokenizer.back(tokens.pop()) - end = true - break - } else if (type === ':') { - colon = true - } - } else if (type === brackets[brackets.length - 1]) { - brackets.pop() - if (brackets.length === 0) bracket = null - } - - token = this.tokenizer.nextToken() - } - - if (this.tokenizer.endOfFile()) end = true - if (brackets.length > 0) this.unclosedBracket(bracket) - - if (end && colon) { - if (!customProperty) { - while (tokens.length) { - token = tokens[tokens.length - 1][0] - if (token !== 'space' && token !== 'comment') break - this.tokenizer.back(tokens.pop()) - } - } - this.decl(tokens, customProperty) - } else { - this.unknownWord(tokens) - } - } - - parse() { - let token - while (!this.tokenizer.endOfFile()) { - token = this.tokenizer.nextToken() - - switch (token[0]) { - case 'space': - this.spaces += token[1] - break - - case ';': - this.freeSemicolon(token) - break - - case '}': - this.end(token) - break - - case 'comment': - this.comment(token) - break - - case 'at-word': - this.atrule(token) - break - - case '{': - this.emptyRule(token) - break - - default: - this.other(token) - break - } - } - this.endFile() - } - - precheckMissedSemicolon(/* tokens */) { - // Hook for Safe Parser - } - - raw(node, prop, tokens, customProperty) { - let token, type - let length = tokens.length - let value = '' - let clean = true - let next, prev - - for (let i = 0; i < length; i += 1) { - token = tokens[i] - type = token[0] - if (type === 'space' && i === length - 1 && !customProperty) { - clean = false - } else if (type === 'comment') { - prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' - next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' - if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { - if (value.slice(-1) === ',') { - clean = false - } else { - value += token[1] - } - } else { - clean = false - } - } else { - value += token[1] - } - } - if (!clean) { - let raw = tokens.reduce((all, i) => all + i[1], '') - node.raws[prop] = { raw, value } - } - node[prop] = value - } - - rule(tokens) { - tokens.pop() - - let node = new Rule() - this.init(node, tokens[0][2]) - - node.raws.between = this.spacesAndCommentsFromEnd(tokens) - this.raw(node, 'selector', tokens) - this.current = node - } - - spacesAndCommentsFromEnd(tokens) { - let lastTokenType - let spaces = '' - while (tokens.length) { - lastTokenType = tokens[tokens.length - 1][0] - if (lastTokenType !== 'space' && lastTokenType !== 'comment') break - spaces = tokens.pop()[1] + spaces - } - return spaces - } - - // Errors - - spacesAndCommentsFromStart(tokens) { - let next - let spaces = '' - while (tokens.length) { - next = tokens[0][0] - if (next !== 'space' && next !== 'comment') break - spaces += tokens.shift()[1] - } - return spaces - } - - spacesFromEnd(tokens) { - let lastTokenType - let spaces = '' - while (tokens.length) { - lastTokenType = tokens[tokens.length - 1][0] - if (lastTokenType !== 'space') break - spaces = tokens.pop()[1] + spaces - } - return spaces - } - - stringFrom(tokens, from) { - let result = '' - for (let i = from; i < tokens.length; i++) { - result += tokens[i][1] - } - tokens.splice(from, tokens.length - from) - return result - } - - unclosedBlock() { - let pos = this.current.source.start - throw this.input.error('Unclosed block', pos.line, pos.column) - } - - unclosedBracket(bracket) { - throw this.input.error( - 'Unclosed bracket', - { offset: bracket[2] }, - { offset: bracket[2] + 1 } - ) - } - - unexpectedClose(token) { - throw this.input.error( - 'Unexpected }', - { offset: token[2] }, - { offset: token[2] + 1 } - ) - } - - unknownWord(tokens) { - throw this.input.error( - 'Unknown word ' + tokens[0][1], - { offset: tokens[0][2] }, - { offset: tokens[0][2] + tokens[0][1].length } - ) - } - - unnamedAtrule(node, token) { - throw this.input.error( - 'At-rule without name', - { offset: token[2] }, - { offset: token[2] + token[1].length } - ) - } -} - -module.exports = Parser diff --git a/web/node_modules/postcss/lib/postcss.d.mts b/web/node_modules/postcss/lib/postcss.d.mts deleted file mode 100644 index d343f3c..0000000 --- a/web/node_modules/postcss/lib/postcss.d.mts +++ /dev/null @@ -1,69 +0,0 @@ -export { - // Type-only exports - AcceptedPlugin, - - AnyNode, - atRule, - AtRule, - AtRuleProps, - Builder, - ChildNode, - ChildProps, - comment, - Comment, - CommentProps, - Container, - ContainerProps, - CssSyntaxError, - decl, - Declaration, - DeclarationProps, - // postcss function / namespace - default, - document, - Document, - DocumentProps, - FilePosition, - fromJSON, - Helpers, - Input, - - JSONHydrator, - // This is a class, but it’s not re-exported. That’s why it’s exported as type-only here. - type LazyResult, - list, - Message, - Node, - NodeErrorOptions, - NodeProps, - OldPlugin, - parse, - Parser, - // @ts-expect-error This value exists, but it’s untyped. - plugin, - Plugin, - PluginCreator, - Position, - Postcss, - ProcessOptions, - Processor, - Result, - root, - Root, - RootProps, - rule, - Rule, - RuleProps, - Source, - SourceMap, - SourceMapOptions, - Stringifier, - // Value exports from postcss.mjs - stringify, - Syntax, - TransformCallback, - Transformer, - Warning, - - WarningOptions -} from './postcss.js' diff --git a/web/node_modules/postcss/lib/postcss.d.ts b/web/node_modules/postcss/lib/postcss.d.ts deleted file mode 100644 index c5e3605..0000000 --- a/web/node_modules/postcss/lib/postcss.d.ts +++ /dev/null @@ -1,458 +0,0 @@ -import { RawSourceMap, SourceMapGenerator } from 'source-map-js' - -import AtRule, { AtRuleProps } from './at-rule.js' -import Comment, { CommentProps } from './comment.js' -import Container, { ContainerProps, NewChild } from './container.js' -import CssSyntaxError from './css-syntax-error.js' -import Declaration, { DeclarationProps } from './declaration.js' -import Document, { DocumentProps } from './document.js' -import Input, { FilePosition } from './input.js' -import LazyResult from './lazy-result.js' -import list from './list.js' -import Node, { - AnyNode, - ChildNode, - ChildProps, - NodeErrorOptions, - NodeProps, - Position, - Source -} from './node.js' -import Processor from './processor.js' -import Result, { Message } from './result.js' -import Root, { RootProps } from './root.js' -import Rule, { RuleProps } from './rule.js' -import Warning, { WarningOptions } from './warning.js' - -type DocumentProcessor = ( - document: Document, - helper: postcss.Helpers -) => Promise | void -type RootProcessor = ( - root: Root, - helper: postcss.Helpers -) => Promise | void -type DeclarationProcessor = ( - decl: Declaration, - helper: postcss.Helpers -) => Promise | void -type RuleProcessor = ( - rule: Rule, - helper: postcss.Helpers -) => Promise | void -type AtRuleProcessor = ( - atRule: AtRule, - helper: postcss.Helpers -) => Promise | void -type CommentProcessor = ( - comment: Comment, - helper: postcss.Helpers -) => Promise | void - -interface Processors { - /** - * Will be called on all`AtRule` nodes. - * - * Will be called again on node or children changes. - */ - AtRule?: { [name: string]: AtRuleProcessor } | AtRuleProcessor - - /** - * Will be called on all `AtRule` nodes, when all children will be processed. - * - * Will be called again on node or children changes. - */ - AtRuleExit?: { [name: string]: AtRuleProcessor } | AtRuleProcessor - - /** - * Will be called on all `Comment` nodes. - * - * Will be called again on node or children changes. - */ - Comment?: CommentProcessor - - /** - * Will be called on all `Comment` nodes after listeners - * for `Comment` event. - * - * Will be called again on node or children changes. - */ - CommentExit?: CommentProcessor - - /** - * Will be called on all `Declaration` nodes after listeners - * for `Declaration` event. - * - * Will be called again on node or children changes. - */ - Declaration?: { [prop: string]: DeclarationProcessor } | DeclarationProcessor - - /** - * Will be called on all `Declaration` nodes. - * - * Will be called again on node or children changes. - */ - DeclarationExit?: - | { [prop: string]: DeclarationProcessor } - | DeclarationProcessor - - /** - * Will be called on `Document` node. - * - * Will be called again on children changes. - */ - Document?: DocumentProcessor - - /** - * Will be called on `Document` node, when all children will be processed. - * - * Will be called again on children changes. - */ - DocumentExit?: DocumentProcessor - - /** - * Will be called on `Root` node once. - */ - Once?: RootProcessor - - /** - * Will be called on `Root` node once, when all children will be processed. - */ - OnceExit?: RootProcessor - - /** - * Will be called on `Root` node. - * - * Will be called again on children changes. - */ - Root?: RootProcessor - - /** - * Will be called on `Root` node, when all children will be processed. - * - * Will be called again on children changes. - */ - RootExit?: RootProcessor - - /** - * Will be called on all `Rule` nodes. - * - * Will be called again on node or children changes. - */ - Rule?: RuleProcessor - - /** - * Will be called on all `Rule` nodes, when all children will be processed. - * - * Will be called again on node or children changes. - */ - RuleExit?: RuleProcessor -} - -declare namespace postcss { - export { - AnyNode, - AtRule, - AtRuleProps, - ChildNode, - ChildProps, - Comment, - CommentProps, - Container, - ContainerProps, - CssSyntaxError, - Declaration, - DeclarationProps, - Document, - DocumentProps, - FilePosition, - Input, - LazyResult, - list, - Message, - NewChild, - Node, - NodeErrorOptions, - NodeProps, - Position, - Processor, - Result, - Root, - RootProps, - Rule, - RuleProps, - Source, - Warning, - WarningOptions - } - - export type SourceMap = { - toJSON(): RawSourceMap - } & SourceMapGenerator - - export type Helpers = { postcss: Postcss; result: Result } & Postcss - - export interface Plugin extends Processors { - postcssPlugin: string - prepare?: (result: Result) => Processors - } - - export interface PluginCreator { - (opts?: PluginOptions): Plugin | Processor - postcss: true - } - - export interface Transformer extends TransformCallback { - postcssPlugin: string - postcssVersion: string - } - - export interface TransformCallback { - (root: Root, result: Result): Promise | void - } - - export interface OldPlugin extends Transformer { - (opts?: T): Transformer - postcss: Transformer - } - - export type AcceptedPlugin = - | { - postcss: Processor | TransformCallback - } - | OldPlugin - | Plugin - | PluginCreator - | Processor - | TransformCallback - - export interface Parser { - ( - css: { toString(): string } | string, - opts?: Pick - ): RootNode - } - - export interface Builder { - (part: string, node?: AnyNode, type?: 'end' | 'start'): void - } - - export interface Stringifier { - (node: AnyNode, builder: Builder): void - } - - export interface JSONHydrator { - (data: object): Node - (data: object[]): Node[] - } - - export interface Syntax { - /** - * Function to generate AST by string. - */ - parse?: Parser - - /** - * Class to generate string by AST. - */ - stringify?: Stringifier - } - - export interface SourceMapOptions { - /** - * Use absolute path in generated source map. - */ - absolute?: boolean - - /** - * Indicates that PostCSS should add annotation comments to the CSS. - * By default, PostCSS will always add a comment with a path - * to the source map. PostCSS will not add annotations to CSS files - * that do not contain any comments. - * - * By default, PostCSS presumes that you want to save the source map as - * `opts.to + '.map'` and will use this path in the annotation comment. - * A different path can be set by providing a string value for annotation. - * - * If you have set `inline: true`, annotation cannot be disabled. - */ - annotation?: ((file: string, root: Root) => string) | boolean | string - - /** - * Override `from` in map’s sources. - */ - from?: string - - /** - * Indicates that the source map should be embedded in the output CSS - * as a Base64-encoded comment. By default, it is `true`. - * But if all previous maps are external, not inline, PostCSS will not embed - * the map even if you do not set this option. - * - * If you have an inline source map, the result.map property will be empty, - * as the source map will be contained within the text of `result.css`. - */ - inline?: boolean - - /** - * Source map content from a previous processing step (e.g., Sass). - * - * PostCSS will try to read the previous source map - * automatically (based on comments within the source CSS), but you can use - * this option to identify it manually. - * - * If desired, you can omit the previous map with prev: `false`. - */ - prev?: ((file: string) => string) | boolean | object | string - - /** - * Indicates that PostCSS should set the origin content (e.g., Sass source) - * of the source map. By default, it is true. But if all previous maps do not - * contain sources content, PostCSS will also leave it out even if you - * do not set this option. - */ - sourcesContent?: boolean - } - - export interface ProcessOptions { - /** - * Input file if it is not simple CSS file, but HTML with ")},SvelteBoundary(t,n){LP(t,n,e)},SvelteComponent(t,n){n.write("0?(n.write(">"),MP(n,t.fragment,!0),n.write("")):n.write(" />")},SvelteDocument(t,n){LP(t,n,e)},SvelteElement(t,n){n.write("0?(n.write(">"),MP(n,t.fragment),n.write("")):n.write(" />")},SvelteFragment(t,n){LP(t,n,e)},SvelteHead(t,n){LP(t,n,e)},SvelteSelf(t,n){LP(t,n,e)},SvelteWindow(t,n){LP(t,n,e)},Text(e,t){t.write(e.data)},TitleElement(t,n){LP(t,n,e)},TransitionDirective(e,t){const n=e.intro&&e.outro?"transition":e.intro?"in":"out";t.write(`${n}:${e.name}`);for(const n of e.modifiers)t.write(`|${n}`);null===e.expression||"Identifier"===e.expression.type&&e.expression.name===e.name||(t.write("={"),t.visit(e.expression),t.write("}"))},UseDirective(e,t){t.write(`use:${e.name}`),null===e.expression||"Identifier"===e.expression.type&&e.expression.name===e.name||(t.write("={"),t.visit(e.expression),t.write("}"))}}),DP=/(]+>)([\S\s]*?)(<\/style>)/g,jP="/*$$__STYLE_CONTENT__$$*/";let BP=!1;class FP extends Error{constructor(e){super(e)}}function VP(e,t){let n=1,s=e,r=t[s];for(;0!==n&&r;)"("===r&&n++,")"===r&&n--,s++,r=t[s];return s}const HP={_(e,{state:t,next:n}){const s=e.leadingComments;if(s)for(const e of s)if("Line"===e.type){const n=kt(e.value);n!==e.value&&t.str.overwrite(e.start+2,e.end,n)}n()},Identifier(e,{state:t,path:n}){YP(e,t,n)},ImportDeclaration(e,{state:t}){if(t.props_insertion_point=e.end??t.props_insertion_point,"svelte"===e.source.value){let n=[],s=0;for(let r of e.specifiers)if("ImportSpecifier"===r.type&&"Identifier"===r.imported.type&&["beforeUpdate","afterUpdate"].includes(r.imported.name)){if(!t.scope.references.get(r.local.name)){let e=-1!==t.str.original.indexOf(",",r.end)&&t.str.original.indexOf(",",r.end)0)throw new FP(`Can't migrate code with ${n.join(" and ")}. Please migrate by hand.`)}},ExportNamedDeclaration(e,{state:t,next:n}){if(e.declaration)return void n();let s=0;for(const n of e.specifiers){if("Identifier"!==n.local.type)continue;const e=t.scope.get(n.local.name);"bindable_prop"===e?.kind&&(t.str.remove(n.start,n.end),s++)}s===e.specifiers.length&&t.str.remove(e.start,e.end)},VariableDeclaration(e,{state:t,path:n,visit:s,next:r}){if(t.scope!==t.analysis.instance.scope)return;let a=0;for(let i=0;i"state"===e.kind)),p=l.some((e=>"bindable_prop"===e.kind));if(c||p)if(p){if(a++,"Identifier"!==o.id.type)throw new FP("Encountered an export declaration pattern that is not supported for automigration.");const h=o.id.name,m=t.scope.get(h);if(t.analysis.uses_props&&(o.init||m.updated))throw new FP("$$props is used together with named props in a way that cannot be automatically migrated.");const f=t.props.find((e=>e.exported===(m.prop_alias||h)));f?(r(),f.init=o.init?t.str.snip(o.init.start,o.init.end).toString():"",f.bindable=m.updated,f.exported=m.prop_alias||h,f.type_only=!1):(r(),t.props.push({local:h,exported:m.prop_alias?m.prop_alias:h,init:o.init?t.str.snip(o.init.start,o.init.end).toString():"",optional:!!o.init,bindable:m.updated,...GP(o,t,n)}));let y=o.start,v=o.end;e.declarations.length>1?(t.props_insertion_point=e.end,0!==i&&(y=t.str.original.indexOf(",",e.declarations[i-1].end)),i!==e.declarations.length-1&&(v=0===i?e.declarations[i+1].start:t.str.original.lastIndexOf(",",e.declarations[i+1].start))):t.props_insertion_point=o.end,t.str.update(y,v,"")}else if(o.init){let{start:g,end:b}=o.init;if("SequenceExpression"===o.init.type){for(;"("!==t.str.original[g];)g-=1;for(;")"!==t.str.original[b-1];)b+=1}u("state"),t.str.prependLeft(g,"$state("),t.str.appendRight(b,")")}else{let _,x;const w=l.every((e=>e.references.every((t=>{const n=t.path.find((e=>"VariableDeclaration"===e.type)),s=t.path.find((e=>"AssignmentExpression"===e.type)),r=t.path.find((e=>"UpdateExpression"===e.type)),a=t.path.find((e=>"LabeledStatement"===e.type&&"$"===e.label.name));if(s&&a&&("ExpressionStatement"!==a.body.type||a.body.expression!==s||"Identifier"===s.left.type&&s.left.name===e.node.name)){if(_)return!1;_=s,x=a}return!r&&(n&&e.initial||a&&s||!a&&!s)})))),k="BlockStatement"===x?.body.type&&1===x.body.body.length&&"ExpressionStatement"===x.body.body[0].type,C="ExpressionStatement"===x?.body.type&&"AssignmentExpression"===x.body.expression.type;let S=!1;if(C){const P=x?.body,E=P.expression,[,T]=ao(E.right);0===T.length&&(S=!0,t.derived_labeled_statements.add(x))}if(!S&&w&&_&&x&&(k||C)){const A=t.str.original.substring(t.str.original.lastIndexOf("\n",e.start)+1,e.start);if("BlockStatement"===x.body.type&&x.body.body[0].leadingComments)for(let $ of x.body.body[0].leadingComments)t.str.prependLeft(e.start,"Block"===$.type?`/*${$.value}*/\n${A}`:`// ${$.value}\n${A}`);if(u("derived"),t.str.appendRight(o.id.typeAnnotation?.end??o.id.end," = $derived("),s(_.right),t.str.appendRight(o.id.typeAnnotation?.end??o.id.end,t.str.snip(_.right.start,_.right.end).toString()),t.str.remove(x.start,x.end),t.str.appendRight(o.id.typeAnnotation?.end??o.id.end,")"),t.derived_labeled_statements.add(x),"BlockStatement"===x.body.type&&x.body.body[0].trailingComments)for(let R of x.body.body[0].trailingComments)t.str.appendRight(o.id.typeAnnotation?.end??o.id.end,"Block"===R.type?`\n${A}/*${R.value}*/`:`\n${A}// ${R.value}`)}else u("state"),t.str.prependLeft(o.id.typeAnnotation?.end??o.id.end," = $state("),S&&(t.str.appendRight(o.id.typeAnnotation?.end??o.id.end,t.str.snip(_.right.start,_.right.end).toString()),t.str.remove(x.start,x.end)),t.str.appendRight(o.id.typeAnnotation?.end??o.id.end,")")}else r();function u(n){if(!!t.scope.get(n))throw new FP(`can't migrate \`${t.str.original.substring(e.start,e.end)}\` to \`$${n}\` because there's a variable named ${n}.\n Rename the variable and try again or migrate by hand.`)}}if(a===e.declarations.length){let I=e.start,M=e.end;const q=n.at(-1);for("ExportNamedDeclaration"===q?.type&&(I=q.start,M=q.end);"\n"!==t.str.original[I];)I--;for(;"\n"!==t.str.original[M];)M++;t.str.update(I,M,"")}},BreakStatement(e,{state:t,path:n}){"LabeledStatement"===n[1].type&&"$"===e.label?.name&&t.str.update(e.start,e.end,"return;")},LabeledStatement(e,{path:t,state:n,next:s}){if(n.analysis.runes)return;if(t.length>1)return;if("$"!==e.label.name)return;if(n.derived_labeled_statements.has(e))return;function r(t){if(n.scope.get(t))throw new FP(`can't migrate \`$: ${n.str.original.substring(e.body.start,e.body.end)}\` to \`$${t}\` because there's a variable named ${t}.\n Rename the variable and try again or migrate by hand.`)}if(s(),"ExpressionStatement"===e.body.type&&"AssignmentExpression"===e.body.expression.type){const{left:t,right:s}=e.body.expression,a=ro(t),[,i]=ao(s),o=a.map((e=>n.scope.get(e.name)));if(o.every((e=>"legacy_reactive"===e.kind))){if("Literal"!==s.type&&o.every((e=>"store_sub"!==e.kind))&&"MemberExpression"!==t.type){let{start:t,end:a}=s;if(r("derived"),n.str.update(e.start,e.body.expression.start,"let "),"SequenceExpression"===s.type){for(;"("!==n.str.original[t];)t-=1;for(;")"!==n.str.original[a-1];)a+=1}return n.str.prependRight(t,"$derived("),void("("!==n.str.original[e.body.start]&&n.str.appendLeft(a,")"))}for(const t of o)if(t.reassigned&&(a.includes(t.node)||0===i.length)){r("state");const a="state"===t.kind?" = $state()":0===i.length?` = $state(${n.str.original.substring(s.start,s.end)})`:"";n.str.prependLeft(e.start,`let ${t.node.name}${a};\n${n.indent}`)}if(0===i.length&&o.every((e=>"store_sub"!==e.kind)))return void n.str.remove(e.start,e.end)}}n.legacy_imports.add("run");const a="BlockStatement"===e.body.type,i=e.body.start;if(a){n.str.update(e.start,i+1,`${n.names.run}(() => {`);const t=e.body.end;n.str.update(t-1,t,"});")}else n.str.update(e.start,i,`${n.names.run}(() => {\n${n.indent}`),n.str.indent(n.indent,{exclude:[[0,e.body.start],[e.body.end,n.end]]}),n.str.appendLeft(e.end,`\n${n.indent}});`)}};function UP(e,t,n){const s=e.str.snip(t,n).toString(),r=s.substring(1,s.length-1);r.trim().length!==r.length&&e.str.update(t+1,n-1,r.trim())}const zP={Identifier(e,{state:t,path:n}){YP(e,t,n)},RegularElement(e,{state:t,path:n,next:s}){const r=e.name.replace(/[a-zA-Z-]*:/g,"");if("/"===t.analysis.source[e.end-2]&&!z(r)&&!oe(r)){let n=e.end-2;for(;" "===t.str.original.charAt(n-1);)n--;t.str.remove(n,e.end-1),t.str.appendLeft(e.end,``)}WP(e,n,t),XP(e,t),s()},SvelteSelf(e,{state:t,next:n}){const s=t.str.original.substring(e.start,e.end);if(!t.filename){const r=JP(s);return BP=!0,t.str.prependRight(e.start,`\x3c!-- @migration-task: svelte:self is deprecated, import this Svelte file into itself instead --\x3e\n${r}`),void n()}t.str.overwrite(e.start+1,e.start+1+11,`${t.analysis.name}`),e.fragment.nodes.length>0?t.str.overwrite(t.str.original.lastIndexOf("<",e.end)+2,e.end-1,`${t.analysis.name}`):s.endsWith("/>")||t.str.overwrite(e.start+s.lastIndexOf("=0;i--){const o=s[i];if("EachBlock"===o.type||"AwaitBlock"===o.type||"IfBlock"===o.type||"SnippetBlock"===o.type||"Component"===o.type||"SvelteComponent"===o.type){let o=e.start;if(i!==s.length-1)for(let e=1;e("RegularElement"===e.type||"SvelteElement"===e.type||"Component"===e.type||"SvelteComponent"===e.type||"SvelteFragment"===e.type)&&e.attributes.some((e=>"Attribute"===e.type&&"slot"===e.name&&Ji(e)&&e.value[0].data===o))))||e.attributes.some((e=>"Attribute"===e.type&&"slot"===e.name&&Ji(e)&&e.value[0].data===o)))&&(a=`${o}_render`,t.derived_conflicting_slots.set(a,o));else{const e=!0===s.value||Array.isArray(s.value)?s.value:[s.value];let n="true";if(!0!==e){const s=e[0],a=e[e.length-1];for(const t of e)r(t);n=t.str.snip("Text"===s.type?s.start-1:s.expression.start,"Text"===a.type?a.end+1:a.expression.end).toString()}l+=n===s.name?`${n}, `:`${s.name}: ${n}, `}}l+="}","{ }"===l&&(l="");const c=t.props.find((e=>e.slot_name===o));if(c)i=c.local;else if("default"!==o&&(i=t.scope.generate(o),i!==o))throw new FP(`This migration would change the name of a slot (${o} to ${i}) making the component unusable`);c?c.needs_refine_type&&(c.type="import('svelte')."+(l?"Snippet<[any]>":"Snippet"),c.needs_refine_type=!1):t.props.push({local:i,exported:i,init:"",bindable:!1,optional:!0,slot_name:o,type:"import('svelte')."+(l?"Snippet<[any]>":"Snippet")}),"default"===o&&n.some((e=>("SvelteComponent"===e.type||"Component"===e.type||"RegularElement"===e.type||"SvelteElement"===e.type||"SvelteFragment"===e.type)&&e.attributes.some((e=>"LetDirective"===e.type))))&&(a=`${i}_render`,t.derived_conflicting_slots.set(a,i)),i=a??i,e.fragment.nodes.length>0?(s(),t.str.update(e.start,e.fragment.nodes[0].start,`{#if ${i}}{@render ${t.analysis.uses_props?`${t.names.props}.`:""}${i}(${l})}{:else}`),t.str.update(e.fragment.nodes[e.fragment.nodes.length-1].end,e.end,"{/if}")):t.str.update(e.start,e.end,`{@render ${t.analysis.uses_props?`${t.names.props}.`:""}${i}?.(${l})}`)},Comment(e,{state:t}){const n=kt(e.data);n!==e.data&&t.str.overwrite(e.start+4,e.end-3,n)},HtmlTag(e,{state:t,next:n}){UP(t,e.start,e.end),n()},ConstTag(e,{state:t,next:n}){UP(t,e.start,e.end),n()},IfBlock(e,{state:t,next:n}){const s=e.start,r=t.str.original.indexOf("}",e.test.end)+1;UP(t,s,r),n()},AwaitBlock(e,{state:t,next:n}){const s=e.start,r=t.str.original.indexOf("}",null!==e.pending?e.expression.end:e.value?.end)+1;if(UP(t,s,r),null!==e.pending){const n=t.str.original.lastIndexOf("{",e.value?.start),s=t.str.original.indexOf("}",e.value?.end)+1;UP(t,n,s)}if(null!==e.catch){const n=t.str.original.lastIndexOf("{",e.error?.start),s=t.str.original.indexOf("}",e.error?.end)+1;UP(t,n,s)}n()},KeyBlock(e,{state:t,next:n}){const s=e.start,r=t.str.original.indexOf("}",e.expression.end)+1;UP(t,s,r),n()}};function WP(e,t,n){const s=t.at(-2);if("Component"!==s?.type&&"SvelteComponent"!==s?.type&&"Component"!==e.type&&"SvelteComponent"!==e.type)return;let r="children",a=[],i=[];for(let t of e.attributes){if("Attribute"===t.type&&"slot"===t.name&&Ji(t)){if(r=t.value[0].data,"default"===r&&(r="children"),!m.test(r)||G(r))return BP=!0,void n.str.appendLeft(e.start,`\x3c!-- @migration-task: migrate this slot by hand, \`${r}\` is an invalid identifier --\x3e\n${n.indent}`);if("Component"===s?.type||"SvelteComponent"===s?.type)for(let t of s.attributes)if(("Attribute"===t.type||"BindDirective"===t.type)&&t.name===r)return void n.str.appendLeft(e.start,`\x3c!-- @migration-task: migrate this slot by hand, \`${r}\` would shadow a prop on the parent component --\x3e\n${n.indent}`);for(let e of i)e();n.str.remove(t.start,t.end)}"LetDirective"===t.type&&(a.push(t.name+(t.expression?`: ${n.str.original.substring(t.expression.start,t.expression.end)}`:"")),i.push((()=>n.str.remove(t.start,t.end))))}if(i.length>0)for(let e of i)e();"SvelteFragment"===e.type&&e.fragment.nodes.length>0&&(n.str.remove(e.start,e.fragment.nodes[0].start),n.str.remove(e.fragment.nodes[e.fragment.nodes.length-1].end,e.end));const o=a.length>0?`{ ${a.join(", ")} }`:"";if("children"===r&&"SvelteFragment"!==e.type){if(0===a.length)return;let s=0,i=0;for(let t=0;t"Attribute"===e.type&&"slot"===e.name))?s||a?i&&!a&&(n.str.update(i-1,i,""),n.str.prependLeft(i-1,n.str.original[i-1]),n.str.move(r.start,r.end,i-1)):s=r.start:s&&!i&&(i=r.start)}i||(i=e.fragment.nodes[e.fragment.nodes.length-1].end),n.str.appendLeft(s,`{#snippet ${r}(${o})}\n${n.indent.repeat(t.length)}`),n.str.indent(n.indent,{exclude:[[0,s],[i,n.str.original.length]]}),ie.trim().replace(/^\/\/\s*/g,"").replace(/^\/\*\*?\s*/g,"").replace(/\s*\*\/$/g,"").replace(/^\*\s*/g,""))).filter(Boolean);const m=h?.findIndex((e=>e.startsWith("@")));let f=h?.slice(0,-1!==m?m:h.length).join("\n"),y=d?.split("\n").map((e=>e.trim().replace(/^\/\/\s*/g,"").replace(/^\/\*\*?\s*/g,"").replace(/\s*\*\/$/g,"").replace(/^\*\s*/g,""))).filter(Boolean);const v=y?.findIndex((e=>e.startsWith("@")));let g=y?.slice(0,-1!==v?v:y.length).join("\n");if("ExportNamedDeclaration"===r?.type&&a){t.has_type_or_fallback=!0;const e=/@type {(.+)}/.exec(a.value);if(e){const t=/@type {.+} (?:\w+|\[.*?\]) - (.+)/.exec(a.value);return t&&(f+=t[1]?.trim()),{type:e[1],comment:f,trailing_comment:g}}}if("Literal"===e.init?.type){t.has_type_or_fallback=!0;const n=typeof e.init.value;if("string"===n||"number"===n||"boolean"===n)return{type:n,comment:t.uses_ts?l:f,trailing_comment:t.uses_ts?d:g}}return{type:"any",comment:t.uses_ts?l:f,trailing_comment:t.uses_ts?d:g}}const KP=["preventDefault","stopPropagation","stopImmediatePropagation","self","trusted","once"];function XP(e,t){const n=new Map;for(const t of e.attributes){if("OnDirective"!==t.type)continue;let e=`on${t.name}`;t.modifiers.includes("capture")&&(e+="capture");const s=n.get(e)||[];s.push(t),n.set(e,s)}for(const[e,s]of n){const n=[];let r=null;for(const e of s){let s;e.expression?s=t.str.original.substring(e.expression.start,e.expression.end):(s=`${t.names.bubble}('${e.name}')`,t.legacy_imports.add("createBubbler"),t.script_insertions.add(`const ${t.names.bubble} = ${t.names.createBubbler}();`));const a=e.modifiers.includes("passive"),i=e.modifiers.includes("nonpassive"),o=KP.filter((t=>e.modifiers.includes(t)));for(const e of o)t.legacy_imports.add(e),s=`${t.names[e]}(${s})`;if(a||i){const n=a?"passive":"nonpassive";t.legacy_imports.add(n),t.str.overwrite(e.start,e.end,`use:${t.names[n]}={['${e.name}', () => ${s}]}`)}else{if(r){let n=e.start,s=e.end;for(;/[\s\n]/.test(t.str.original[n-1]);)n-=1;t.str.remove(n,s)}else r=e;n.push(s)}}if(r){let s;if(n.length>1)t.legacy_imports.add("handlers"),s=`${e}={${t.names.handlers}(${n.join(", ")})}`;else{const t=n[0];s=t===e?`{${t}}`:`${e}={${t}}`}t.str.overwrite(r.start,r.end,s)}}}function QP(e,t){const n=t.leadingComments?.[0],s=t.trailingComments?.[t.trailingComments.length-1];let r=n?.start??t.start,a=s?.end??t.end,i=r;for(;"\n"!==e[i-1]&&"\r"!==e[i-1];)if(i--," "!==e[i]&&"\t"!==e[i]){i=r;break}return r=i,{start:r,end:a}}function YP(e,t,n){const s=n.at(-1);if("MemberExpression"!==s?.type||s.property!==e)if(t.analysis.uses_props&&"$$slots"!==e.name)if("$$props"===e.name||"$$restProps"===e.name)t.str.update(e.start,e.end,t.names.props);else{const n=t.scope.get(e.name);"bindable_prop"===n?.kind&&n.node!==e&&t.str.prependLeft(e.start,`${t.names.props}.`)}else if("$$restProps"===e.name&&t.analysis.uses_rest_props)t.str.update(e.start,e.end,t.names.rest);else if("$$slots"===e.name&&t.analysis.uses_slots){if("MemberExpression"===s?.type){if(t.analysis.custom_element)return;let n="Literal"===s.property.type?s.property.value:s.property.name,r=n;const a=t.props.find((e=>e.slot_name===n));if(a)n=a.local;else if("default"!==n){let e=t.scope.generate(n);if(e!==n)throw new FP(`This migration would change the name of a slot (${n} to ${e}) making the component unusable`)}n="default"===n?"children":n,a||t.props.push({local:n,exported:n,init:"",bindable:!1,optional:!0,slot_name:r,type:"import('svelte').Snippet<[any]>",needs_refine_type:!0}),t.str.update(e.start,s.property.start,t.analysis.uses_props?`${t.names.props}.`:""),t.str.update(s.property.start,s.end,n)}}else if("TSInterfaceDeclaration"===s?.type||"TSTypeAliasDeclaration"===s?.type){const n="TSInterfaceDeclaration"===s.type?s.body.body:s.typeAnnotation?.members;if(Array.isArray(n)&&"$$Props"===e.name){t.has_type_or_fallback=!0;for(const e of n){const n=t.props.find((t=>t.exported===e.key.name)),s=t.str.original.substring(e.typeAnnotation.typeAnnotation.start,e.typeAnnotation.typeAnnotation.end);let r;const a=e.leadingComments?.at(-1);"Block"===a?.type&&(r=t.str.original.substring(a.start,a.end));const i=e.trailingComments?.at(0)?.value;n?(n.type=s,n.optional=e.optional,n.comment=r??n.comment,n.trailing_comment=i??n.trailing_comment):t.props.push({local:e.key.name,exported:e.key.name,init:"",bindable:!1,optional:e.optional,type:s,comment:r,trailing_comment:i,type_only:!0})}t.str.remove(s.start,s.end)}}}function JP(e){const t=e.split("\n"),n=t.filter((e=>/^\t+/.test(e))),s=t.filter((e=>/^ {2,}/.test(e)));if(0===n.length&&0===s.length)return"\t";if(n.length>=s.length)return"\t";const r=s.reduce(((e,t)=>{const n=/^ +/.exec(t)?.[0].length??0;return Math.min(n,e)}),1/0);return" ".repeat(r)}function ZP(e,n,s){if(s){const e=e=>{delete e.metadata};return n.options?.attributes.forEach((t=>{e(t),e(t.value),Array.isArray(t.value)&&t.value.forEach(e)})),t(n,null,{_(t,{next:n}){e(t),n()}})}return function(e,n){return t(n,null,{_(e,{next:t}){delete e.metadata,t()},Root(t,{visit:s}){const{instance:r,module:a,options:i}=t;if(i?.__raw__){let e=t.fragment.nodes.findIndex((e=>i.end<=e.start));-1===e&&(e=t.fragment.nodes.length),t.fragment.nodes.splice(e,0,i.__raw__)}let o=null,l=null;if(t.fragment.nodes.length>0){const n=t.fragment.nodes.at(0),s=t.fragment.nodes.at(-1);for(o=n.start,l=s.end;/\s/.test(e[o]);)o+=1;for(;/\s/.test(e[l-1]);)l-=1}return r&&delete r.attributes,a&&delete a.attributes,{html:{type:"Fragment",start:o,end:l,children:t.fragment.nodes.map((e=>s(e)))},instance:r,module:a,css:n.css?s(n.css):void 0,_comments:n.comments?.length>0?n.comments:void 0}},AnimateDirective:e=>({...e,type:"Animation"}),AwaitBlock(t,{visit:n}){let s={type:"PendingBlock",start:null,end:null,children:t.pending?.nodes.map((e=>n(e)))??[],skip:!0},r={type:"ThenBlock",start:null,end:null,children:t.then?.nodes.map((e=>n(e)))??[],skip:!0},a={type:"CatchBlock",start:null,end:null,children:t.catch?.nodes.map((e=>n(e)))??[],skip:!0};if(t.pending){const n=t.pending.nodes.at(0),r=t.pending.nodes.at(-1);s.start=n?.start??e.indexOf("}",t.expression.end)+1,s.end=r?.end??s.start,s.skip=!1}if(t.then){const n=t.then.nodes.at(0),a=t.then.nodes.at(-1);r.start=s.end??n?.start??e.indexOf("}",t.expression.end)+1,r.end=a?.end??e.lastIndexOf("}",s.end??t.expression.end)+1,r.skip=!1}if(t.catch){const n=t.catch.nodes.at(0),i=t.catch.nodes.at(-1);a.start=r.end??s.end??n?.start??e.indexOf("}",t.expression.end)+1,a.end=i?.end??e.lastIndexOf("}",r.end??s.end??t.expression.end)+1,a.skip=!1}return{type:"AwaitBlock",start:t.start,end:t.end,expression:t.expression,value:t.value,error:t.error,pending:s,then:r,catch:a}},BindDirective:e=>({...e,type:"Binding"}),ClassDirective:e=>({...e,type:"Class"}),Comment:e=>({...e,ignores:wt(e.start,e.data,!1)}),ComplexSelector(e,{next:t}){t();const n=[];for(const t of e.children)t.combinator&&n.push(t.combinator),n.push(...t.selectors);return{type:"Selector",start:e.start,end:e.end,children:n}},Component:(e,{visit:t})=>({type:"InlineComponent",start:e.start,end:e.end,name:e.name,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),ConstTag(e){if(void 0!==e.expression)return e;const t=e,{id:n}={...t.declaration.declarations[0]};return delete n.typeAnnotation,{type:"ConstTag",start:t.start,end:e.end,expression:{type:"AssignmentExpression",start:(t.declaration.start??0)+6,end:t.declaration.end??0,operator:"=",left:n,right:t.declaration.declarations[0].init}}},KeyBlock:(e,{visit:t})=>(Ct(e.fragment.nodes),{type:"KeyBlock",start:e.start,end:e.end,expression:e.expression,children:e.fragment.nodes.map((e=>t(e)))}),EachBlock(t,{visit:n}){let s;if(t.fallback){const r=t.fallback.nodes.at(0),a=e.lastIndexOf("{",t.end-1),i=r?.start??a;Ct(t.fallback.nodes),s={type:"ElseBlock",start:i,end:a,children:t.fallback.nodes.map((e=>n(e)))}}return Ct(t.body.nodes),{type:"EachBlock",start:t.start,end:t.end,children:t.body.nodes.map((e=>n(e))),context:t.context,expression:t.expression,index:t.index,key:t.key,else:s}},ExpressionTag(t,{path:n}){const s=n.at(-1);return"Attribute"===s?.type&&"{"===e[s.start]?{type:"AttributeShorthand",start:t.start,end:t.end,expression:t.expression}:{type:"MustacheTag",start:t.start,end:t.end,expression:t.expression}},HtmlTag:e=>({...e,type:"RawMustacheTag"}),IfBlock(t,{visit:n}){let s;if(t.alternate){let r=t.alternate.nodes;1===r.length&&"IfBlock"===r[0].type&&r[0].elseif&&(r=r[0].consequent.nodes);const a=e.lastIndexOf("{",t.end-1),i=r.at(0)?.start??a;Ct(t.alternate.nodes),s={type:"ElseBlock",start:i,end:a,children:t.alternate.nodes.map((e=>n(e)))}}const r=t.elseif?t.consequent.nodes[0]?.start??e.lastIndexOf("{",t.end-1):t.start;return Ct(t.consequent.nodes),{type:"IfBlock",start:r,end:t.end,expression:t.test,children:t.consequent.nodes.map((e=>n(e))),else:s,elseif:!!t.elseif||void 0}},OnDirective:e=>({...e,type:"EventHandler"}),SnippetBlock:(e,{visit:t})=>(Ct(e.body.nodes),{type:"SnippetBlock",start:e.start,end:e.end,expression:e.expression,parameters:e.parameters,children:e.body.nodes.map((e=>t(e))),typeParams:e.typeParams}),SvelteBoundary:(e,{visit:t})=>(Ct(e.fragment.nodes),{type:"SvelteBoundary",name:"svelte:boundary",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),RegularElement:(e,{visit:t})=>({type:"Element",start:e.start,end:e.end,name:e.name,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SlotElement:(e,{visit:t})=>({type:"Slot",start:e.start,end:e.end,name:e.name,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),Attribute(e,{visit:t,next:n,path:s}){if(!0===e.value||Array.isArray(e.value))return n();{s.push(e);const n=[t(e.value)];return s.pop(),{...e,value:n}}},StyleDirective(e,{visit:t,next:n,path:s}){if(!0===e.value||Array.isArray(e.value))return n();{s.push(e);const n=[t(e.value)];return s.pop(),{...e,value:n}}},SpreadAttribute:e=>({...e,type:"Spread"}),StyleSheet:(e,t)=>({...e,...t.next(),type:"Style"}),SvelteBody:(e,{visit:t})=>({type:"Body",name:"svelte:body",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteComponent:(e,{visit:t})=>({type:"InlineComponent",name:"svelte:component",start:e.start,end:e.end,expression:e.expression,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteDocument:(e,{visit:t})=>({type:"Document",name:"svelte:document",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteElement(t,{visit:n}){let s=t.tag;return"Literal"===s.type&&"string"==typeof s.value&&"{"!==e[t.tag.start-1]&&(s=s.value),{type:"Element",name:"svelte:element",start:t.start,end:t.end,tag:s,attributes:t.attributes.map((e=>n(e))),children:t.fragment.nodes.map((e=>n(e)))}},SvelteFragment:(e,{visit:t})=>({type:"SlotTemplate",name:"svelte:fragment",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteHead:(e,{visit:t})=>({type:"Head",name:"svelte:head",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteOptions:(e,{visit:t})=>({type:"Options",name:"svelte:options",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e)))}),SvelteSelf:(e,{visit:t})=>({type:"InlineComponent",name:"svelte:self",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),SvelteWindow:(e,{visit:t})=>({type:"Window",name:"svelte:window",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),Text(e,{path:t}){const n=t.at(-1);if("RegularElement"===n?.type&&"style"===n.name)return{type:"Text",start:e.start,end:e.end,data:e.data}},TitleElement:(e,{visit:t})=>({type:"Title",name:"title",start:e.start,end:e.end,attributes:e.attributes.map((e=>t(e))),children:e.fragment.nodes.map((e=>t(e)))}),TransitionDirective:e=>({...e,type:"Transition"}),UseDirective:e=>({...e,type:"Action"}),LetDirective:e=>({...e,type:"Let"})})}(e,n)}function eE(e){return 65279===e.charCodeAt(0)?e.slice(1):e}e.VERSION=sk,e.compile=function(e,t){e=eE(e),$e({warning:t.warningFilter,filename:t.filename});const n=oP(t,"");let s=Yl(e);const{customElement:r,...a}=s.options||{},i={...n,...a,customElementOptions:r,css:"css"in a?()=>a.css??"external":n.css,runes:"runes"in a?()=>a.runes:n.runes};s.metadata.ts&&(s={...s,fragment:s.fragment&&ec(s.fragment),instance:s.instance&&ec(s.instance),module:s.module&&ec(s.module)},i.customElementOptions?.extend&&(i.customElementOptions.extend=ec(i.customElementOptions?.extend)));const o=nP(kw(s,e,i),e,i);return o.ast=ZP(e,s,t.modernAst),o},e.compileModule=function(e,n){e=eE(e),$e({warning:n.warningFilter,filename:n.filename});const s=iP(n,""),r=function(e,n){const s=[];Ce(e);const r=Hs(e,s,!1,!1),{scope:a,scopes:i,has_await:o}=Sc(r,new Cc,!1,null);for(const[e,t]of a.references)"$"!==e[0]||ww.includes(e)||("$"!==e&&"$"!==e[1]||er(t[0].node,e),null===a.get(e.slice(1))||de(e)||Gs(t[0].node,"store_invalid_subscription_module","Cannot reference store value outside a `.svelte` file\nhttps://svelte.dev/e/store_invalid_subscription_module"));const l={module:{ast:r,scope:a,scopes:i,has_await:o},name:n.filename,accessors:!1,runes:!0,immutable:!0,tracing:!1,async_deriveds:new Set,comments:s,classes:new Map,pickled_awaits:new Set};return Re({dev:n.dev,rootDir:n.rootDir,runes:!0}),t(r,{scope:a,scopes:i,analysis:l,state_fields:new Map,ast_type:null,component_slots:new Set,expression:null,function_depth:0,has_props_rune:!1,options:n,fragment:null,parent_element:null,reactive_statement:null,derived_function_depth:-1},_w),l}(e,s);return sP(r,e,s)},e.migrate=function(e,{filename:n,use_ts:s}={}){let r=e;try{BP=!1;const a=[];e=e.replace(DP,((e,t,n,s,r)=>(a.push([r+t.length,n]),t+jP+s))),$e({warning:()=>!1,filename:n});let i=Yl(e);const{customElement:o,...l}=i.options||{},c={...oP({},""),...l,customElementOptions:o,filename:n??ye,css:"css"in l?()=>l.css??"external":()=>"external",runes:"runes"in l?()=>l.runes:()=>{},experimental:{async:!0}},p=new yk(e),u=kw(i,e,c),d=JP(e);p.replaceAll(/(t));for(const _ of a)p.overwrite(_[0],_[0]+25,_[1]);let h={scope:u.instance.scope,analysis:u,filename:n,str:p,indent:d,props:[],props_insertion_point:i.instance?.content.start??0,has_props_rune:!1,has_type_or_fallback:!1,end:e.length,names:{props:u.root.unique("props").name,rest:u.root.unique("rest").name,run:u.root.unique("run").name,handlers:u.root.unique("handlers").name,stopImmediatePropagation:u.root.unique("stopImmediatePropagation").name,preventDefault:u.root.unique("preventDefault").name,stopPropagation:u.root.unique("stopPropagation").name,once:u.root.unique("once").name,self:u.root.unique("self").name,trusted:u.root.unique("trusted").name,createBubbler:u.root.unique("createBubbler").name,bubble:u.root.unique("bubble").name,passive:u.root.unique("passive").name,nonpassive:u.root.unique("nonpassive").name},legacy_imports:new Set,script_insertions:new Set,derived_components:new Map,derived_conflicting_slots:new Map,derived_labeled_statements:new Set,has_svelte_self:!1,uses_ts:s&&!e.includes("@type {")||!!i.instance?.attributes.some((e=>"lang"===e.name&&"ts"===e.value[0].data))};if(i.module){const x=i.module.attributes.find((e=>"context"===e.name));x&&h.str.update(x.start,x.end,"module")}i.instance&&t(i.instance.content,h,HP),h={...h,scope:u.template.scope},t(i.fragment,h,zP);let m=i.instance?i.instance.content.start:0;const f=h.legacy_imports.size>0||h.derived_components.size>0||h.derived_conflicting_slots.size>0||h.script_insertions.size>0||h.props.length>0||u.uses_rest_props||u.uses_props||h.has_svelte_self,y=h.uses_ts&&(!i.instance||!i.instance.attributes.some((e=>"lang"===e.name)));if(!i.instance&&f&&p.appendRight(0,y?' - * - * - * ``` - * @since 5.29 - */ -export function createAttachmentKey() { - return Symbol(ATTACHMENT_KEY); -} - -/** - * Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior. - * It's useful if you want to start using attachments on components but you have actions provided by a library. - * - * Note that the second argument, if provided, must be a function that _returns_ the argument to the - * action function, not the argument itself. - * - * ```svelte - * - *
...
- * - * - *
bar)}>...
- * ``` - * @template {EventTarget} E - * @template {unknown} T - * @overload - * @param {Action | ((element: E, arg: T) => void | ActionReturn)} action The action function - * @param {() => T} fn A function that returns the argument for the action - * @returns {Attachment} - */ -/** - * Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior. - * It's useful if you want to start using attachments on components but you have actions provided by a library. - * - * Note that the second argument, if provided, must be a function that _returns_ the argument to the - * action function, not the argument itself. - * - * ```svelte - * - *
...
- * - * - *
bar)}>...
- * ``` - * @template {EventTarget} E - * @overload - * @param {Action | ((element: E) => void | ActionReturn)} action The action function - * @returns {Attachment} - */ -/** - * Converts an [action](https://svelte.dev/docs/svelte/use) into an [attachment](https://svelte.dev/docs/svelte/@attach) keeping the same behavior. - * It's useful if you want to start using attachments on components but you have actions provided by a library. - * - * Note that the second argument, if provided, must be a function that _returns_ the argument to the - * action function, not the argument itself. - * - * ```svelte - * - *
...
- * - * - *
bar)}>...
- * ``` - * - * @template {EventTarget} E - * @template {unknown} T - * @param {Action | ((element: E, arg: T) => void | ActionReturn)} action The action function - * @param {() => T} fn A function that returns the argument for the action - * @returns {Attachment} - * @since 5.32 - */ -export function fromAction(action, fn = /** @type {() => T} */ (noop)) { - return (element) => { - const { update, destroy } = untrack(() => action(element, fn()) ?? {}); - - if (update) { - var ran = false; - render_effect(() => { - const arg = fn(); - if (ran) update(arg); - }); - ran = true; - } - - if (destroy) { - teardown(destroy); - } - }; -} diff --git a/web/node_modules/svelte/src/compiler/errors.js b/web/node_modules/svelte/src/compiler/errors.js deleted file mode 100644 index c28c737..0000000 --- a/web/node_modules/svelte/src/compiler/errors.js +++ /dev/null @@ -1,1719 +0,0 @@ -/* This file is generated by scripts/process-messages/index.js. Do not edit! */ - -import { CompileDiagnostic } from './utils/compile_diagnostic.js'; - -/** @typedef {{ start?: number, end?: number }} NodeLike */ -class InternalCompileError extends Error { - message = ''; // ensure this property is enumerable - #diagnostic; - - /** - * @param {string} code - * @param {string} message - * @param {[number, number] | undefined} position - */ - constructor(code, message, position) { - super(message); - this.stack = ''; // avoid unnecessary noise; don't set it as a class property or it becomes enumerable - - // We want to extend from Error so that various bundler plugins properly handle it. - // But we also want to share the same object shape with that of warnings, therefore - // we create an instance of the shared class an copy over its properties. - this.#diagnostic = new CompileDiagnostic(code, message, position); - - Object.assign(this, this.#diagnostic); - this.name = 'CompileError'; - } - - toString() { - return this.#diagnostic.toString(); - } - - toJSON() { - return this.#diagnostic.toJSON(); - } -} - -/** - * @param {null | number | NodeLike} node - * @param {string} code - * @param {string} message - * @returns {never} - */ -function e(node, code, message) { - const start = typeof node === 'number' ? node : node?.start; - const end = typeof node === 'number' ? node : node?.end; - - throw new InternalCompileError(code, message, start !== undefined ? [start, end ?? start] : undefined); -} - -/** - * Invalid compiler option: %details% - * @param {null | number | NodeLike} node - * @param {string} details - * @returns {never} - */ -export function options_invalid_value(node, details) { - e(node, 'options_invalid_value', `Invalid compiler option: ${details}\nhttps://svelte.dev/e/options_invalid_value`); -} - -/** - * Invalid compiler option: %details% - * @param {null | number | NodeLike} node - * @param {string} details - * @returns {never} - */ -export function options_removed(node, details) { - e(node, 'options_removed', `Invalid compiler option: ${details}\nhttps://svelte.dev/e/options_removed`); -} - -/** - * Unrecognised compiler option %keypath% - * @param {null | number | NodeLike} node - * @param {string} keypath - * @returns {never} - */ -export function options_unrecognised(node, keypath) { - e(node, 'options_unrecognised', `Unrecognised compiler option ${keypath}\nhttps://svelte.dev/e/options_unrecognised`); -} - -/** - * `$bindable()` can only be used inside a `$props()` declaration - * @param {null | number | NodeLike} node - * @returns {never} - */ -export function bindable_invalid_location(node) { - e(node, 'bindable_invalid_location', `\`$bindable()\` can only be used inside a \`$props()\` declaration\nhttps://svelte.dev/e/bindable_invalid_location`); -} - -/** - * Cannot assign to %thing% - * @param {null | number | NodeLike} node - * @param {string} thing - * @returns {never} - */ -export function constant_assignment(node, thing) { - e(node, 'constant_assignment', `Cannot assign to ${thing}\nhttps://svelte.dev/e/constant_assignment`); -} - -/** - * Cannot bind to %thing% - * @param {null | number | NodeLike} node - * @param {string} thing - * @returns {never} - */ -export function constant_binding(node, thing) { - e(node, 'constant_binding', `Cannot bind to ${thing}\nhttps://svelte.dev/e/constant_binding`); -} - -/** - * `%name%` has already been declared - * @param {null | number | NodeLike} node - * @param {string} name - * @returns {never} - */ -export function declaration_duplicate(node, name) { - e(node, 'declaration_duplicate', `\`${name}\` has already been declared\nhttps://svelte.dev/e/declaration_duplicate`); -} - -/** - * Cannot declare a variable with the same name as an import inside `\n\n'); - } - migrate_css(state); - return { - code: str.toString() - }; - } catch (e) { - if (!(e instanceof MigrationError)) { - // eslint-disable-next-line no-console - console.error('Error while migrating Svelte code', e); - } - has_migration_task = true; - return { - code: `\n${og_source}` - }; - } finally { - if (has_migration_task) { - // eslint-disable-next-line no-console - console.log( - `One or more \`@migration-task\` comments were added to ${filename ? `\`${filename}\`` : "a file (unfortunately we don't know the name)"}, please check them and complete the migration manually.` - ); - } - } -} - -/** - * @typedef {{ - * scope: Scope; - * str: MagicString; - * analysis: ComponentAnalysis; - * filename?: string; - * indent: string; - * props: Array<{ local: string; exported: string; init: string; bindable: boolean; slot_name?: string; optional: boolean; type: string; comment?: string; trailing_comment?: string; type_only?: boolean; needs_refine_type?: boolean; }>; - * props_insertion_point: number; - * has_props_rune: boolean; - * has_type_or_fallback: boolean; - * end: number; - * names: Record; - * legacy_imports: Set; - * script_insertions: Set; - * derived_components: Map; - * derived_conflicting_slots: Map; - * derived_labeled_statements: Set; - * has_svelte_self: boolean; - * uses_ts: boolean; - * }} State - */ - -/** @type {Visitors} */ -const instance_script = { - _(node, { state, next }) { - // @ts-expect-error - const comments = node.leadingComments; - if (comments) { - for (const comment of comments) { - if (comment.type === 'Line') { - const migrated = migrate_svelte_ignore(comment.value); - if (migrated !== comment.value) { - state.str.overwrite(comment.start + '//'.length, comment.end, migrated); - } - } - } - } - next(); - }, - Identifier(node, { state, path }) { - handle_identifier(node, state, path); - }, - ImportDeclaration(node, { state }) { - state.props_insertion_point = node.end ?? state.props_insertion_point; - if (node.source.value === 'svelte') { - let illegal_specifiers = []; - let removed_specifiers = 0; - for (let specifier of node.specifiers) { - if ( - specifier.type === 'ImportSpecifier' && - specifier.imported.type === 'Identifier' && - ['beforeUpdate', 'afterUpdate'].includes(specifier.imported.name) - ) { - const references = state.scope.references.get(specifier.local.name); - if (!references) { - let end = /** @type {number} */ ( - state.str.original.indexOf(',', specifier.end) !== -1 && - state.str.original.indexOf(',', specifier.end) < - state.str.original.indexOf('}', specifier.end) - ? state.str.original.indexOf(',', specifier.end) + 1 - : specifier.end - ); - while (state.str.original[end].trim() === '') end++; - state.str.remove(/** @type {number} */ (specifier.start), end); - removed_specifiers++; - continue; - } - illegal_specifiers.push(specifier.imported.name); - } - } - if (removed_specifiers === node.specifiers.length) { - state.str.remove(/** @type {number} */ (node.start), /** @type {number} */ (node.end)); - } - if (illegal_specifiers.length > 0) { - throw new MigrationError( - `Can't migrate code with ${illegal_specifiers.join(' and ')}. Please migrate by hand.` - ); - } - } - }, - ExportNamedDeclaration(node, { state, next }) { - if (node.declaration) { - next(); - return; - } - - let count_removed = 0; - for (const specifier of node.specifiers) { - if (specifier.local.type !== 'Identifier') continue; - - const binding = state.scope.get(specifier.local.name); - if (binding?.kind === 'bindable_prop') { - state.str.remove( - /** @type {number} */ (specifier.start), - /** @type {number} */ (specifier.end) - ); - count_removed++; - } - } - if (count_removed === node.specifiers.length) { - state.str.remove(/** @type {number} */ (node.start), /** @type {number} */ (node.end)); - } - }, - VariableDeclaration(node, { state, path, visit, next }) { - if (state.scope !== state.analysis.instance.scope) { - return; - } - - let nr_of_props = 0; - - for (let i = 0; i < node.declarations.length; i++) { - const declarator = node.declarations[i]; - if (state.analysis.runes) { - if (get_rune(declarator.init, state.scope) === '$props') { - state.props_insertion_point = /** @type {number} */ (declarator.id.start) + 1; - state.has_props_rune = true; - } - continue; - } - - let bindings; - try { - bindings = state.scope.get_bindings(declarator); - } catch (e) { - // no bindings, so we can skip this - next(); - continue; - } - const has_state = bindings.some((binding) => binding.kind === 'state'); - const has_props = bindings.some((binding) => binding.kind === 'bindable_prop'); - - if (!has_state && !has_props) { - next(); - continue; - } - - if (has_props) { - nr_of_props++; - - if (declarator.id.type !== 'Identifier') { - // TODO invest time in this? - throw new MigrationError( - 'Encountered an export declaration pattern that is not supported for automigration.' - ); - // Turn export let into props. It's really really weird because export let { x: foo, z: [bar]} = .. - // means that foo and bar are the props (i.e. the leaves are the prop names), not x and z. - // const tmp = b.id(state.scope.generate('tmp')); - // const paths = extract_paths(declarator.id, tmp); - // state.props_pre.push( - // b.declaration('const', tmp, visit(declarator.init!) as Expression) - // ); - // for (const path of paths) { - // const name = (path.node as Identifier).name; - // const binding = state.scope.get(name)!; - // const value = path.expression; - // if (binding.kind === 'bindable_prop' || binding.kind === 'rest_prop') { - // state.props.push({ - // local: name, - // exported: binding.prop_alias ? binding.prop_alias : name, - // init: value - // }); - // state.props_insertion_point = /** @type {number} */(declarator.end); - // } else { - // declarations.push(b.declarator(path.node, value)); - // } - // } - } - - const name = declarator.id.name; - const binding = /** @type {Binding} */ (state.scope.get(name)); - - if (state.analysis.uses_props && (declarator.init || binding.updated)) { - throw new MigrationError( - '$$props is used together with named props in a way that cannot be automatically migrated.' - ); - } - - const prop = state.props.find((prop) => prop.exported === (binding.prop_alias || name)); - if (prop) { - next(); - // $$Props type was used - prop.init = declarator.init - ? state.str - .snip( - /** @type {number} */ (declarator.init.start), - /** @type {number} */ (declarator.init.end) - ) - .toString() - : ''; - prop.bindable = binding.updated; - prop.exported = binding.prop_alias || name; - prop.type_only = false; - } else { - next(); - state.props.push({ - local: name, - exported: binding.prop_alias ? binding.prop_alias : name, - init: declarator.init - ? state.str - .snip( - /** @type {number} */ (declarator.init.start), - /** @type {number} */ (declarator.init.end) - ) - .toString() - : '', - optional: !!declarator.init, - bindable: binding.updated, - ...extract_type_and_comment(declarator, state, path) - }); - } - - let start = /** @type {number} */ (declarator.start); - let end = /** @type {number} */ (declarator.end); - - // handle cases like let a,b,c; where only some are exported - if (node.declarations.length > 1) { - // move the insertion point after the node itself; - state.props_insertion_point = /** @type {number} */ (node.end); - // if it's not the first declaration remove from the , of the previous declaration - if (i !== 0) { - start = state.str.original.indexOf( - ',', - /** @type {number} */ (node.declarations[i - 1].end) - ); - } - // if it's not the last declaration remove either from up until the - // start of the next declaration (if it's the first declaration) or - // up until the last index of , from the next declaration - if (i !== node.declarations.length - 1) { - if (i === 0) { - end = /** @type {number} */ (node.declarations[i + 1].start); - } else { - end = state.str.original.lastIndexOf( - ',', - /** @type {number} */ (node.declarations[i + 1].start) - ); - } - } - } else { - state.props_insertion_point = /** @type {number} */ (declarator.end); - } - - state.str.update(start, end, ''); - - continue; - } - - /** - * @param {"state"|"derived"} rune - */ - function check_rune_binding(rune) { - const has_rune_binding = !!state.scope.get(rune); - if (has_rune_binding) { - throw new MigrationError( - `can't migrate \`${state.str.original.substring(/** @type {number} */ (node.start), node.end)}\` to \`$${rune}\` because there's a variable named ${rune}.\n Rename the variable and try again or migrate by hand.` - ); - } - } - - // state - if (declarator.init) { - let { start, end } = /** @type {{ start: number, end: number }} */ (declarator.init); - - if (declarator.init.type === 'SequenceExpression') { - while (state.str.original[start] !== '(') start -= 1; - while (state.str.original[end - 1] !== ')') end += 1; - } - - check_rune_binding('state'); - - state.str.prependLeft(start, '$state('); - state.str.appendRight(end, ')'); - } else { - /** - * @type {AssignmentExpression | undefined} - */ - let assignment_in_labeled; - /** - * @type {LabeledStatement | undefined} - */ - let labeled_statement; - - // Analyze declaration bindings to see if they're exclusively updated within a single reactive statement - const possible_derived = bindings.every((binding) => - binding.references.every((reference) => { - const declaration = reference.path.find((el) => el.type === 'VariableDeclaration'); - const assignment = reference.path.find((el) => el.type === 'AssignmentExpression'); - const update = reference.path.find((el) => el.type === 'UpdateExpression'); - const labeled = /** @type {LabeledStatement | undefined} */ ( - reference.path.find((el) => el.type === 'LabeledStatement' && el.label.name === '$') - ); - - if ( - assignment && - labeled && - // ensure that $: foo = bar * 2 is not counted as a reassignment of bar - (labeled.body.type !== 'ExpressionStatement' || - labeled.body.expression !== assignment || - (assignment.left.type === 'Identifier' && - assignment.left.name === binding.node.name)) - ) { - if (assignment_in_labeled) return false; - assignment_in_labeled = /** @type {AssignmentExpression} */ (assignment); - labeled_statement = labeled; - } - - return ( - !update && - ((declaration && binding.initial) || - (labeled && assignment) || - (!labeled && !assignment)) - ); - }) - ); - - const labeled_has_single_assignment = - labeled_statement?.body.type === 'BlockStatement' && - labeled_statement.body.body.length === 1 && - labeled_statement.body.body[0].type === 'ExpressionStatement'; - - const is_expression_assignment = - labeled_statement?.body.type === 'ExpressionStatement' && - labeled_statement.body.expression.type === 'AssignmentExpression'; - - let should_be_state = false; - - if (is_expression_assignment) { - const body = /**@type {ExpressionStatement}*/ (labeled_statement?.body); - const expression = /**@type {AssignmentExpression}*/ (body.expression); - const [, ids] = extract_all_identifiers_from_expression(expression.right); - if (ids.length === 0) { - should_be_state = true; - state.derived_labeled_statements.add( - /** @type {LabeledStatement} */ (labeled_statement) - ); - } - } - - if ( - !should_be_state && - possible_derived && - assignment_in_labeled && - labeled_statement && - (labeled_has_single_assignment || is_expression_assignment) - ) { - const indent = state.str.original.substring( - state.str.original.lastIndexOf('\n', /** @type {number} */ (node.start)) + 1, - /** @type {number} */ (node.start) - ); - // transfer all the leading comments - if ( - labeled_statement.body.type === 'BlockStatement' && - labeled_statement.body.body[0].leadingComments - ) { - for (let comment of labeled_statement.body.body[0].leadingComments) { - state.str.prependLeft( - /** @type {number} */ (node.start), - comment.type === 'Block' - ? `/*${comment.value}*/\n${indent}` - : `// ${comment.value}\n${indent}` - ); - } - } - - check_rune_binding('derived'); - - // Someone wrote a `$: { ... }` statement which we can turn into a `$derived` - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - ' = $derived(' - ); - visit(assignment_in_labeled.right); - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - state.str - .snip( - /** @type {number} */ (assignment_in_labeled.right.start), - /** @type {number} */ (assignment_in_labeled.right.end) - ) - .toString() - ); - state.str.remove( - /** @type {number} */ (labeled_statement.start), - /** @type {number} */ (labeled_statement.end) - ); - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - ')' - ); - state.derived_labeled_statements.add(labeled_statement); - - // transfer all the trailing comments - if ( - labeled_statement.body.type === 'BlockStatement' && - labeled_statement.body.body[0].trailingComments - ) { - for (let comment of labeled_statement.body.body[0].trailingComments) { - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - comment.type === 'Block' - ? `\n${indent}/*${comment.value}*/` - : `\n${indent}// ${comment.value}` - ); - } - } - } else { - check_rune_binding('state'); - - state.str.prependLeft( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - ' = $state(' - ); - if (should_be_state) { - // someone wrote a `$: foo = ...` statement which we can turn into `let foo = $state(...)` - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - state.str - .snip( - /** @type {number} */ ( - /** @type {AssignmentExpression} */ (assignment_in_labeled).right.start - ), - /** @type {number} */ ( - /** @type {AssignmentExpression} */ (assignment_in_labeled).right.end - ) - ) - .toString() - ); - state.str.remove( - /** @type {number} */ (/** @type {LabeledStatement} */ (labeled_statement).start), - /** @type {number} */ (/** @type {LabeledStatement} */ (labeled_statement).end) - ); - } - state.str.appendRight( - /** @type {number} */ (declarator.id.typeAnnotation?.end ?? declarator.id.end), - ')' - ); - } - } - } - - if (nr_of_props === node.declarations.length) { - let start = /** @type {number} */ (node.start); - let end = /** @type {number} */ (node.end); - - const parent = path.at(-1); - if (parent?.type === 'ExportNamedDeclaration') { - start = /** @type {number} */ (parent.start); - end = /** @type {number} */ (parent.end); - } - while (state.str.original[start] !== '\n') start--; - while (state.str.original[end] !== '\n') end++; - state.str.update(start, end, ''); - } - }, - BreakStatement(node, { state, path }) { - if (path[1].type !== 'LabeledStatement') return; - if (node.label?.name !== '$') return; - state.str.update( - /** @type {number} */ (node.start), - /** @type {number} */ (node.end), - 'return;' - ); - }, - LabeledStatement(node, { path, state, next }) { - if (state.analysis.runes) return; - if (path.length > 1) return; - if (node.label.name !== '$') return; - if (state.derived_labeled_statements.has(node)) return; - - next(); - - /** - * @param {"state"|"derived"} rune - */ - function check_rune_binding(rune) { - const has_rune_binding = state.scope.get(rune); - if (has_rune_binding) { - throw new MigrationError( - `can't migrate \`$: ${state.str.original.substring(/** @type {number} */ (node.body.start), node.body.end)}\` to \`$${rune}\` because there's a variable named ${rune}.\n Rename the variable and try again or migrate by hand.` - ); - } - } - - if ( - node.body.type === 'ExpressionStatement' && - node.body.expression.type === 'AssignmentExpression' - ) { - const { left, right } = node.body.expression; - - const ids = extract_identifiers(left); - const [, expression_ids] = extract_all_identifiers_from_expression(right); - const bindings = ids.map((id) => /** @type {Binding} */ (state.scope.get(id.name))); - - if (bindings.every((b) => b.kind === 'legacy_reactive')) { - if ( - right.type !== 'Literal' && - bindings.every((b) => b.kind !== 'store_sub') && - left.type !== 'MemberExpression' - ) { - let { start, end } = /** @type {{ start: number, end: number }} */ (right); - - check_rune_binding('derived'); - - // $derived - state.str.update( - /** @type {number} */ (node.start), - /** @type {number} */ (node.body.expression.start), - 'let ' - ); - - if (right.type === 'SequenceExpression') { - while (state.str.original[start] !== '(') start -= 1; - while (state.str.original[end - 1] !== ')') end += 1; - } - - state.str.prependRight(start, `$derived(`); - - // in a case like `$: ({ a } = b())`, there's already a trailing parenthesis. - // otherwise, we need to add one - if (state.str.original[/** @type {number} */ (node.body.start)] !== '(') { - state.str.appendLeft(end, `)`); - } - - return; - } - - for (const binding of bindings) { - if (binding.reassigned && (ids.includes(binding.node) || expression_ids.length === 0)) { - check_rune_binding('state'); - const init = - binding.kind === 'state' - ? ' = $state()' - : expression_ids.length === 0 - ? ` = $state(${state.str.original.substring(/** @type {number} */ (right.start), right.end)})` - : ''; - // implicitly-declared variable which we need to make explicit - state.str.prependLeft( - /** @type {number} */ (node.start), - `let ${binding.node.name}${init};\n${state.indent}` - ); - } - } - - if (expression_ids.length === 0 && bindings.every((b) => b.kind !== 'store_sub')) { - state.str.remove(/** @type {number} */ (node.start), /** @type {number} */ (node.end)); - return; - } - } - } - - state.legacy_imports.add('run'); - const is_block_stmt = node.body.type === 'BlockStatement'; - const start_end = /** @type {number} */ (node.body.start); - // TODO try to find out if we can use $derived.by instead? - if (is_block_stmt) { - state.str.update( - /** @type {number} */ (node.start), - start_end + 1, - `${state.names.run}(() => {` - ); - const end = /** @type {number} */ (node.body.end); - state.str.update(end - 1, end, '});'); - } else { - state.str.update( - /** @type {number} */ (node.start), - start_end, - `${state.names.run}(() => {\n${state.indent}` - ); - state.str.indent(state.indent, { - exclude: [ - [0, /** @type {number} */ (node.body.start)], - [/** @type {number} */ (node.body.end), state.end] - ] - }); - state.str.appendLeft(/** @type {number} */ (node.end), `\n${state.indent}});`); - } - } -}; - -/** - * - * @param {State} state - * @param {number} start - * @param {number} end - */ -function trim_block(state, start, end) { - const original = state.str.snip(start, end).toString(); - const without_parens = original.substring(1, original.length - 1); - if (without_parens.trim().length !== without_parens.length) { - state.str.update(start + 1, end - 1, without_parens.trim()); - } -} - -/** @type {Visitors} */ -const template = { - Identifier(node, { state, path }) { - handle_identifier(node, state, path); - }, - RegularElement(node, { state, path, next }) { - // Strip off any namespace from the beginning of the node name. - const node_name = node.name.replace(/[a-zA-Z-]*:/g, ''); - - if (state.analysis.source[node.end - 2] === '/' && !is_void(node_name) && !is_svg(node_name)) { - let trimmed_position = node.end - 2; - while (state.str.original.charAt(trimmed_position - 1) === ' ') trimmed_position--; - state.str.remove(trimmed_position, node.end - 1); - state.str.appendLeft(node.end, ``); - } - - migrate_slot_usage(node, path, state); - handle_events(node, state); - - next(); - }, - SvelteSelf(node, { state, next }) { - const source = state.str.original.substring(node.start, node.end); - if (!state.filename) { - const indent = guess_indent(source); - has_migration_task = true; - state.str.prependRight( - node.start, - `\n${indent}` - ); - next(); - return; - } - // overwrite the open tag - state.str.overwrite( - node.start + 1, - node.start + 1 + 'svelte:self'.length, - `${state.analysis.name}` - ); - // if it has a fragment we need to overwrite the closing tag too - if (node.fragment.nodes.length > 0) { - state.str.overwrite( - state.str.original.lastIndexOf('<', node.end) + 2, - node.end - 1, - `${state.analysis.name}` - ); - } else if (!source.endsWith('/>')) { - // special case for case `` it has no fragment but - // we still need to overwrite the end tag - state.str.overwrite( - node.start + source.lastIndexOf('= 0; i--) { - const part = path[i]; - if ( - part.type === 'EachBlock' || - part.type === 'AwaitBlock' || - part.type === 'IfBlock' || - part.type === 'SnippetBlock' || - part.type === 'Component' || - part.type === 'SvelteComponent' - ) { - let position = node.start; - if (i !== path.length - 1) { - for (let modifier = 1; modifier < path.length - i; modifier++) { - const path_part = path[i + modifier]; - if ('start' in path_part) { - position = /** @type {number} */ (path_part.start); - break; - } - } - } - const indent = state.str.original.substring( - state.str.original.lastIndexOf('\n', position) + 1, - position - ); - state.str.appendRight( - position, - `{@const ${expression} = ${current_expression}}\n${indent}` - ); - needs_derived = false; - break; - } - } - if (needs_derived) { - if (state.derived_components.has(current_expression)) { - expression = /** @type {string} */ (state.derived_components.get(current_expression)); - } else { - state.derived_components.set(current_expression, expression); - } - } - } - - state.str.overwrite(node.start + 1, node.start + node.name.length + 1, expression); - - if (state.str.original.substring(node.end - node.name.length - 1, node.end - 1) === node.name) { - state.str.overwrite(node.end - node.name.length - 1, node.end - 1, expression); - } - let this_pos = state.str.original.lastIndexOf('this', node.expression.start); - while (!state.str.original.charAt(this_pos - 1).trim()) this_pos--; - const end_pos = state.str.original.indexOf('}', node.expression.end) + 1; - state.str.remove(this_pos, end_pos); - }, - SvelteFragment(node, { state, path, next }) { - migrate_slot_usage(node, path, state); - next(); - }, - SvelteWindow(node, { state, next }) { - handle_events(node, state); - next(); - }, - SvelteBody(node, { state, next }) { - handle_events(node, state); - next(); - }, - SvelteDocument(node, { state, next }) { - handle_events(node, state); - next(); - }, - SlotElement(node, { state, path, next, visit }) { - migrate_slot_usage(node, path, state); - - if (state.analysis.custom_element) return; - let name = 'children'; - let slot_name = 'default'; - let slot_props = '{ '; - let aliased_slot_name; - - for (const attr of node.attributes) { - if (attr.type === 'SpreadAttribute') { - slot_props += `...${state.str.original.substring(/** @type {number} */ (attr.expression.start), attr.expression.end)}, `; - } else if (attr.type === 'Attribute') { - if (attr.name === 'slot') { - continue; - } - - if (attr.name === 'name') { - slot_name = /** @type {any} */ (attr.value)[0].data; - // if some of the parents or this node itself har a slot - // attribute with the sane name of this slot - // we want to create a derived or the migrated snippet - // will shadow the slot prop - if ( - path.some( - (parent) => - (parent.type === 'RegularElement' || - parent.type === 'SvelteElement' || - parent.type === 'Component' || - parent.type === 'SvelteComponent' || - parent.type === 'SvelteFragment') && - parent.attributes.some( - (attribute) => - attribute.type === 'Attribute' && - attribute.name === 'slot' && - is_text_attribute(attribute) && - attribute.value[0].data === slot_name - ) - ) || - node.attributes.some( - (attribute) => - attribute.type === 'Attribute' && - attribute.name === 'slot' && - is_text_attribute(attribute) && - attribute.value[0].data === slot_name - ) - ) { - aliased_slot_name = `${slot_name}_render`; - state.derived_conflicting_slots.set(aliased_slot_name, slot_name); - } - } else { - const attr_value = - attr.value === true || Array.isArray(attr.value) ? attr.value : [attr.value]; - let value = 'true'; - if (attr_value !== true) { - const first = attr_value[0]; - const last = attr_value[attr_value.length - 1]; - for (const attr of attr_value) { - visit(attr); - } - value = state.str - .snip( - first.type === 'Text' - ? first.start - 1 - : /** @type {number} */ (first.expression.start), - last.type === 'Text' ? last.end + 1 : /** @type {number} */ (last.expression.end) - ) - .toString(); - } - slot_props += value === attr.name ? `${value}, ` : `${attr.name}: ${value}, `; - } - } - } - - slot_props += '}'; - if (slot_props === '{ }') { - slot_props = ''; - } - - const existing_prop = state.props.find((prop) => prop.slot_name === slot_name); - if (existing_prop) { - name = existing_prop.local; - } else if (slot_name !== 'default') { - name = state.scope.generate(slot_name); - if (name !== slot_name) { - throw new MigrationError( - `This migration would change the name of a slot (${slot_name} to ${name}) making the component unusable` - ); - } - } - - if (!existing_prop) { - state.props.push({ - local: name, - exported: name, - init: '', - bindable: false, - optional: true, - slot_name, - type: `import('svelte').${slot_props ? 'Snippet<[any]>' : 'Snippet'}` - }); - } else if (existing_prop.needs_refine_type) { - existing_prop.type = `import('svelte').${slot_props ? 'Snippet<[any]>' : 'Snippet'}`; - existing_prop.needs_refine_type = false; - } - - if ( - slot_name === 'default' && - path.some( - (parent) => - (parent.type === 'SvelteComponent' || - parent.type === 'Component' || - parent.type === 'RegularElement' || - parent.type === 'SvelteElement' || - parent.type === 'SvelteFragment') && - parent.attributes.some((attr) => attr.type === 'LetDirective') - ) - ) { - aliased_slot_name = `${name}_render`; - state.derived_conflicting_slots.set(aliased_slot_name, name); - } - name = aliased_slot_name ?? name; - - if (node.fragment.nodes.length > 0) { - next(); - state.str.update( - node.start, - node.fragment.nodes[0].start, - `{#if ${name}}{@render ${state.analysis.uses_props ? `${state.names.props}.` : ''}${name}(${slot_props})}{:else}` - ); - state.str.update(node.fragment.nodes[node.fragment.nodes.length - 1].end, node.end, '{/if}'); - } else { - state.str.update( - node.start, - node.end, - `{@render ${state.analysis.uses_props ? `${state.names.props}.` : ''}${name}?.(${slot_props})}` - ); - } - }, - Comment(node, { state }) { - const migrated = migrate_svelte_ignore(node.data); - if (migrated !== node.data) { - state.str.overwrite(node.start + ''.length, migrated); - } - }, - HtmlTag(node, { state, next }) { - trim_block(state, node.start, node.end); - next(); - }, - ConstTag(node, { state, next }) { - trim_block(state, node.start, node.end); - next(); - }, - IfBlock(node, { state, next }) { - const start = node.start; - const end = state.str.original.indexOf('}', node.test.end) + 1; - trim_block(state, start, end); - next(); - }, - AwaitBlock(node, { state, next }) { - const start = node.start; - const end = - state.str.original.indexOf( - '}', - node.pending !== null ? node.expression.end : node.value?.end - ) + 1; - trim_block(state, start, end); - if (node.pending !== null) { - const start = state.str.original.lastIndexOf('{', node.value?.start); - const end = state.str.original.indexOf('}', node.value?.end) + 1; - trim_block(state, start, end); - } - if (node.catch !== null) { - const start = state.str.original.lastIndexOf('{', node.error?.start); - const end = state.str.original.indexOf('}', node.error?.end) + 1; - trim_block(state, start, end); - } - next(); - }, - KeyBlock(node, { state, next }) { - const start = node.start; - const end = state.str.original.indexOf('}', node.expression.end) + 1; - trim_block(state, start, end); - next(); - } -}; - -/** - * @param {AST.RegularElement | AST.SvelteElement | AST.SvelteComponent | AST.Component | AST.SlotElement | AST.SvelteFragment} node - * @param {AST.SvelteNode[]} path - * @param {State} state - */ -function migrate_slot_usage(node, path, state) { - const parent = path.at(-2); - // Bail on custom element slot usage - if ( - parent?.type !== 'Component' && - parent?.type !== 'SvelteComponent' && - node.type !== 'Component' && - node.type !== 'SvelteComponent' - ) { - return; - } - - let snippet_name = 'children'; - let snippet_props = []; - - // if we stop the transform because the name is not correct we don't want to - // remove the let directive and they could come before the name - let removal_queue = []; - - for (let attribute of node.attributes) { - if ( - attribute.type === 'Attribute' && - attribute.name === 'slot' && - is_text_attribute(attribute) - ) { - snippet_name = attribute.value[0].data; - // the default slot in svelte 4 if what the children slot is for svelte 5 - if (snippet_name === 'default') { - snippet_name = 'children'; - } - if (!regex_is_valid_identifier.test(snippet_name) || is_reserved(snippet_name)) { - has_migration_task = true; - state.str.appendLeft( - node.start, - `\n${state.indent}` - ); - return; - } - if (parent?.type === 'Component' || parent?.type === 'SvelteComponent') { - for (let attribute of parent.attributes) { - if (attribute.type === 'Attribute' || attribute.type === 'BindDirective') { - if (attribute.name === snippet_name) { - state.str.appendLeft( - node.start, - `\n${state.indent}` - ); - return; - } - } - } - } - // flush the queue after we found the name - for (let remove_let of removal_queue) { - remove_let(); - } - state.str.remove(attribute.start, attribute.end); - } - if (attribute.type === 'LetDirective') { - snippet_props.push( - attribute.name + - (attribute.expression - ? `: ${state.str.original.substring(/** @type {number} */ (attribute.expression.start), /** @type {number} */ (attribute.expression.end))}` - : '') - ); - // we just add to the queue to remove them after we found if we need to migrate or we bail - removal_queue.push(() => state.str.remove(attribute.start, attribute.end)); - } - } - - if (removal_queue.length > 0) { - for (let remove_let of removal_queue) { - remove_let(); - } - } - - if (node.type === 'SvelteFragment' && node.fragment.nodes.length > 0) { - // remove node itself, keep content - state.str.remove(node.start, node.fragment.nodes[0].start); - state.str.remove(node.fragment.nodes[node.fragment.nodes.length - 1].end, node.end); - } - - const props = snippet_props.length > 0 ? `{ ${snippet_props.join(', ')} }` : ''; - - if (snippet_name === 'children' && node.type !== 'SvelteFragment') { - if (snippet_props.length === 0) return; // nothing to do - - let inner_start = 0; - let inner_end = 0; - for (let i = 0; i < node.fragment.nodes.length; i++) { - const inner = node.fragment.nodes[i]; - const is_empty_text = inner.type === 'Text' && !inner.data.trim(); - - if ( - (inner.type === 'RegularElement' || - inner.type === 'SvelteElement' || - inner.type === 'Component' || - inner.type === 'SvelteComponent' || - inner.type === 'SlotElement' || - inner.type === 'SvelteFragment') && - inner.attributes.some((attr) => attr.type === 'Attribute' && attr.name === 'slot') - ) { - if (inner_start && !inner_end) { - // End of default slot content - inner_end = inner.start; - } - } else if (!inner_start && !is_empty_text) { - // Start of default slot content - inner_start = inner.start; - } else if (inner_end && !is_empty_text) { - // There was default slot content before, then some named slot content, now some default slot content again. - // We're moving the last character back by one to avoid the closing {/snippet} tag inserted afterwards - // to come before the opening {#snippet} tag of the named slot. - state.str.update(inner_end - 1, inner_end, ''); - state.str.prependLeft(inner_end - 1, state.str.original[inner_end - 1]); - state.str.move(inner.start, inner.end, inner_end - 1); - } - } - - if (!inner_end) { - inner_end = node.fragment.nodes[node.fragment.nodes.length - 1].end; - } - - state.str.appendLeft( - inner_start, - `{#snippet ${snippet_name}(${props})}\n${state.indent.repeat(path.length)}` - ); - state.str.indent(state.indent, { - exclude: [ - [0, inner_start], - [inner_end, state.str.original.length] - ] - }); - if (inner_end < node.fragment.nodes[node.fragment.nodes.length - 1].end) { - // Named slots coming afterwards - state.str.prependLeft(inner_end, `{/snippet}\n${state.indent.repeat(path.length)}`); - } else { - // No named slots coming afterwards - state.str.prependLeft( - inner_end, - `${state.indent.repeat(path.length)}{/snippet}\n${state.indent.repeat(path.length - 1)}` - ); - } - } else { - // Named slot or `svelte:fragment`: wrap element itself in a snippet - state.str.prependLeft( - node.start, - `{#snippet ${snippet_name}(${props})}\n${state.indent.repeat(path.length - 2)}` - ); - state.str.indent(state.indent, { - exclude: [ - [0, node.start], - [node.end, state.str.original.length] - ] - }); - const str = `\n${state.indent.repeat(path.length - 2)}{/snippet}`; - - if (node.type === 'SlotElement') { - state.str.appendRight(node.end, str); - } else { - state.str.appendLeft(node.end, str); - } - } -} - -/** - * @param {VariableDeclarator} declarator - * @param {State} state - * @param {AST.SvelteNode[]} path - */ -function extract_type_and_comment(declarator, state, path) { - const str = state.str; - const parent = path.at(-1); - - // Try to find jsdoc above the declaration - let comment_node = /** @type {Node} */ (parent)?.leadingComments?.at(-1); - - const comment_start = /** @type {any} */ (comment_node)?.start; - const comment_end = /** @type {any} */ (comment_node)?.end; - let comment = comment_node && str.original.substring(comment_start, comment_end); - if (comment_node) { - str.update(comment_start, comment_end, ''); - } - - // Find trailing comments - const trailing_comment_node = /** @type {Node} */ (parent)?.trailingComments?.at(0); - const trailing_comment_start = /** @type {any} */ (trailing_comment_node)?.start; - const trailing_comment_end = /** @type {any} */ (trailing_comment_node)?.end; - let trailing_comment = - trailing_comment_node && str.original.substring(trailing_comment_start, trailing_comment_end); - - if (trailing_comment_node) { - str.update(trailing_comment_start, trailing_comment_end, ''); - } - - if (declarator.id.typeAnnotation) { - state.has_type_or_fallback = true; - let start = declarator.id.typeAnnotation.start + 1; // skip the colon - while (str.original[start] === ' ') { - start++; - } - return { - type: str.original.substring(start, declarator.id.typeAnnotation.end), - comment, - trailing_comment - }; - } - - let cleaned_comment_arr = comment - ?.split('\n') - .map((line) => - line - .trim() - // replace `// ` for one liners - .replace(/^\/\/\s*/g, '') - // replace `\**` for the initial JSDoc - .replace(/^\/\*\*?\s*/g, '') - // migrate `*/` for the end of JSDoc - .replace(/\s*\*\/$/g, '') - // remove any initial `* ` to clean the comment - .replace(/^\*\s*/g, '') - ) - .filter(Boolean); - const first_at_comment = cleaned_comment_arr?.findIndex((line) => line.startsWith('@')); - let cleaned_comment = cleaned_comment_arr - ?.slice(0, first_at_comment !== -1 ? first_at_comment : cleaned_comment_arr.length) - .join('\n'); - - let cleaned_comment_arr_trailing = trailing_comment - ?.split('\n') - .map((line) => - line - .trim() - // replace `// ` for one liners - .replace(/^\/\/\s*/g, '') - // replace `\**` for the initial JSDoc - .replace(/^\/\*\*?\s*/g, '') - // migrate `*/` for the end of JSDoc - .replace(/\s*\*\/$/g, '') - // remove any initial `* ` to clean the comment - .replace(/^\*\s*/g, '') - ) - .filter(Boolean); - const first_at_comment_trailing = cleaned_comment_arr_trailing?.findIndex((line) => - line.startsWith('@') - ); - let cleaned_comment_trailing = cleaned_comment_arr_trailing - ?.slice( - 0, - first_at_comment_trailing !== -1 - ? first_at_comment_trailing - : cleaned_comment_arr_trailing.length - ) - .join('\n'); - - // try to find a comment with a type annotation, hinting at jsdoc - if (parent?.type === 'ExportNamedDeclaration' && comment_node) { - state.has_type_or_fallback = true; - const match = /@type {(.+)}/.exec(comment_node.value); - if (match) { - // try to find JSDoc comments after a hyphen `-` - const jsdoc_comment = /@type {.+} (?:\w+|\[.*?\]) - (.+)/.exec(comment_node.value); - if (jsdoc_comment) { - cleaned_comment += jsdoc_comment[1]?.trim(); - } - return { - type: match[1], - comment: cleaned_comment, - trailing_comment: cleaned_comment_trailing - }; - } - } - - // try to infer it from the init - if (declarator.init?.type === 'Literal') { - state.has_type_or_fallback = true; // only assume type if it's trivial to infer - else someone would've added a type annotation - const type = typeof declarator.init.value; - if (type === 'string' || type === 'number' || type === 'boolean') { - return { - type, - comment: state.uses_ts ? comment : cleaned_comment, - trailing_comment: state.uses_ts ? trailing_comment : cleaned_comment_trailing - }; - } - } - return { - type: 'any', - comment: state.uses_ts ? comment : cleaned_comment, - trailing_comment: state.uses_ts ? trailing_comment : cleaned_comment_trailing - }; -} - -// Ensure modifiers are applied in the same order as Svelte 4 -const modifier_order = /** @type {const} */ ([ - 'preventDefault', - 'stopPropagation', - 'stopImmediatePropagation', - 'self', - 'trusted', - 'once' -]); - -/** - * @param {AST.RegularElement | AST.SvelteElement | AST.SvelteWindow | AST.SvelteDocument | AST.SvelteBody} element - * @param {State} state - */ -function handle_events(element, state) { - /** @type {Map} */ - const handlers = new Map(); - for (const attribute of element.attributes) { - if (attribute.type !== 'OnDirective') continue; - - let name = `on${attribute.name}`; - if (attribute.modifiers.includes('capture')) { - name += 'capture'; - } - - const nodes = handlers.get(name) || []; - nodes.push(attribute); - handlers.set(name, nodes); - } - - for (const [name, nodes] of handlers) { - const handlers = []; - - let first = null; - - for (const node of nodes) { - /** @type {string} */ - let body; - - if (node.expression) { - body = state.str.original.substring( - /** @type {number} */ (node.expression.start), - /** @type {number} */ (node.expression.end) - ); - } else { - body = `${state.names.bubble}('${node.name}')`; - state.legacy_imports.add('createBubbler'); - state.script_insertions.add( - `const ${state.names.bubble} = ${state.names.createBubbler}();` - ); - } - - const has_passive = node.modifiers.includes('passive'); - const has_nonpassive = node.modifiers.includes('nonpassive'); - - const modifiers = modifier_order.filter((modifier) => node.modifiers.includes(modifier)); - - for (const modifier of modifiers) { - state.legacy_imports.add(modifier); - body = `${state.names[modifier]}(${body})`; - } - - if (has_passive || has_nonpassive) { - const action = has_passive ? 'passive' : 'nonpassive'; - state.legacy_imports.add(action); - - state.str.overwrite( - node.start, - node.end, - `use:${state.names[action]}={['${node.name}', () => ${body}]}` - ); - } else { - if (first) { - let start = node.start; - let end = node.end; - - while (/[\s\n]/.test(state.str.original[start - 1])) start -= 1; - state.str.remove(start, end); - } else { - first = node; - } - - handlers.push(body); - } - } - - if (first) { - /** @type {string} */ - let replacement; - - if (handlers.length > 1) { - state.legacy_imports.add('handlers'); - replacement = `${name}={${state.names.handlers}(${handlers.join(', ')})}`; - } else { - const handler = handlers[0]; - replacement = handler === name ? `{${handler}}` : `${name}={${handler}}`; - } - - state.str.overwrite(first.start, first.end, replacement); - } - } -} - -/** - * Returns start and end of the node. If the start is preceded with white-space-only before a line break, - * the start will be the start of the line. - * @param {string} source - * @param {LabeledStatement} node - */ -function get_node_range(source, node) { - const first_leading_comment = node.leadingComments?.[0]; - const last_trailing_comment = node.trailingComments?.[node.trailingComments.length - 1]; - - // @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains - // start and end but the type seems to only contain a `range` (which doesn't actually exists) - let start = /** @type {number} */ (first_leading_comment?.start ?? node.start); - // @ts-expect-error the type of `Comment` seems to be wrong...the node actually contains - // start and end but the type seems to only contain a `range` (which doesn't actually exists) - let end = /** @type {number} */ (last_trailing_comment?.end ?? node.end); - - let idx = start; - while (source[idx - 1] !== '\n' && source[idx - 1] !== '\r') { - idx--; - if (source[idx] !== ' ' && source[idx] !== '\t') { - idx = start; - break; - } - } - - start = idx; - - return { start, end }; -} - -/** - * @param {Identifier} node - * @param {State} state - * @param {any[]} path - */ -function handle_identifier(node, state, path) { - const parent = path.at(-1); - if (parent?.type === 'MemberExpression' && parent.property === node) return; - - if (state.analysis.uses_props && node.name !== '$$slots') { - if (node.name === '$$props' || node.name === '$$restProps') { - // not 100% correct for $$restProps but it'll do - state.str.update( - /** @type {number} */ (node.start), - /** @type {number} */ (node.end), - state.names.props - ); - } else { - const binding = state.scope.get(node.name); - if (binding?.kind === 'bindable_prop' && binding.node !== node) { - state.str.prependLeft(/** @type {number} */ (node.start), `${state.names.props}.`); - } - } - } else if (node.name === '$$restProps' && state.analysis.uses_rest_props) { - state.str.update( - /** @type {number} */ (node.start), - /** @type {number} */ (node.end), - state.names.rest - ); - } else if (node.name === '$$slots' && state.analysis.uses_slots) { - if (parent?.type === 'MemberExpression') { - if (state.analysis.custom_element) return; - - let name = parent.property.type === 'Literal' ? parent.property.value : parent.property.name; - let slot_name = name; - const existing_prop = state.props.find((prop) => prop.slot_name === name); - if (existing_prop) { - name = existing_prop.local; - } else if (name !== 'default') { - let new_name = state.scope.generate(name); - if (new_name !== name) { - throw new MigrationError( - `This migration would change the name of a slot (${name} to ${new_name}) making the component unusable` - ); - } - } - - name = name === 'default' ? 'children' : name; - - if (!existing_prop) { - state.props.push({ - local: name, - exported: name, - init: '', - bindable: false, - optional: true, - slot_name, - // if it's the first time we encounter this slot - // we start with any and delegate to when the slot - // is actually rendered (it might not happen in that case) - // any is still a safe bet - type: `import('svelte').Snippet<[any]>`, - needs_refine_type: true - }); - } - - state.str.update( - /** @type {number} */ (node.start), - parent.property.start, - state.analysis.uses_props ? `${state.names.props}.` : '' - ); - state.str.update(parent.property.start, parent.end, name); - } - // else passed as identifier, we don't know what to do here, so let it error - } else if ( - parent?.type === 'TSInterfaceDeclaration' || - parent?.type === 'TSTypeAliasDeclaration' - ) { - const members = - parent.type === 'TSInterfaceDeclaration' ? parent.body.body : parent.typeAnnotation?.members; - if (Array.isArray(members)) { - if (node.name === '$$Props') { - state.has_type_or_fallback = true; - - for (const member of members) { - const prop = state.props.find((prop) => prop.exported === member.key.name); - - const type = state.str.original.substring( - member.typeAnnotation.typeAnnotation.start, - member.typeAnnotation.typeAnnotation.end - ); - - let comment; - const comment_node = member.leadingComments?.at(-1); - if (comment_node?.type === 'Block') { - comment = state.str.original.substring(comment_node.start, comment_node.end); - } - - const trailing_comment = member.trailingComments?.at(0)?.value; - - if (prop) { - prop.type = type; - prop.optional = member.optional; - prop.comment = comment ?? prop.comment; - prop.trailing_comment = trailing_comment ?? prop.trailing_comment; - } else { - state.props.push({ - local: member.key.name, - exported: member.key.name, - init: '', - bindable: false, - optional: member.optional, - type, - comment, - trailing_comment, - type_only: true - }); - } - } - - state.str.remove(parent.start, parent.end); - } - } - } -} - -/** @param {string} content */ -function guess_indent(content) { - const lines = content.split('\n'); - - const tabbed = lines.filter((line) => /^\t+/.test(line)); - const spaced = lines.filter((line) => /^ {2,}/.test(line)); - - if (tabbed.length === 0 && spaced.length === 0) { - return '\t'; - } - - // More lines tabbed than spaced? Assume tabs, and - // default to tabs in the case of a tie (or nothing - // to go on) - if (tabbed.length >= spaced.length) { - return '\t'; - } - - // Otherwise, we need to guess the multiple - const min = spaced.reduce((previous, current) => { - const count = /^ +/.exec(current)?.[0].length ?? 0; - return Math.min(count, previous); - }, Infinity); - - return ' '.repeat(min); -} diff --git a/web/node_modules/svelte/src/compiler/phases/1-parse/acorn.js b/web/node_modules/svelte/src/compiler/phases/1-parse/acorn.js deleted file mode 100644 index 77ce4a4..0000000 --- a/web/node_modules/svelte/src/compiler/phases/1-parse/acorn.js +++ /dev/null @@ -1,198 +0,0 @@ -/** @import { Comment, Program } from 'estree' */ -/** @import { AST } from '#compiler' */ -import * as acorn from 'acorn'; -import { walk } from 'zimmerframe'; -import { tsPlugin } from '@sveltejs/acorn-typescript'; - -const ParserWithTS = acorn.Parser.extend(tsPlugin()); - -/** - * @typedef {Comment & { - * start: number; - * end: number; - * }} CommentWithLocation - */ - -/** - * @param {string} source - * @param {AST.JSComment[]} comments - * @param {boolean} typescript - * @param {boolean} [is_script] - */ -export function parse(source, comments, typescript, is_script) { - const parser = typescript ? ParserWithTS : acorn.Parser; - - const { onComment, add_comments } = get_comment_handlers( - source, - /** @type {CommentWithLocation[]} */ (comments) - ); - - // @ts-ignore - const parse_statement = parser.prototype.parseStatement; - - // If we're dealing with a '); - }, - - Fragment(node, context) { - /** @type {AST.SvelteNode[][]} */ - const items = []; - - /** @type {AST.SvelteNode[]} */ - let sequence = []; - - const flush = () => { - items.push(sequence); - sequence = []; - }; - - for (let i = 0; i < node.nodes.length; i += 1) { - let child_node = node.nodes[i]; - - const prev = node.nodes[i - 1]; - const next = node.nodes[i + 1]; - - if (child_node.type === 'Text') { - child_node = { ...child_node }; // always clone, so we can safely mutate - - child_node.data = child_node.data.replace(/[^\S]+/g, ' '); - - // trim fragment - if (i === 0) { - child_node.data = child_node.data.trimStart(); - } - - if (i === node.nodes.length - 1) { - child_node.data = child_node.data.trimEnd(); - } - - if (child_node.data === '') { - continue; - } - - if (child_node.data.startsWith(' ') && prev && prev.type !== 'ExpressionTag') { - flush(); - child_node.data = child_node.data.trimStart(); - } - - if (child_node.data !== '') { - sequence.push({ ...child_node, data: child_node.data }); - - if (child_node.data.endsWith(' ') && next && next.type !== 'ExpressionTag') { - flush(); - child_node.data = child_node.data.trimStart(); - } - } - } else { - const is_block_element = - child_node.type === 'RegularElement' || - child_node.type === 'Component' || - child_node.type === 'SvelteHead' || - child_node.type === 'SvelteFragment' || - child_node.type === 'SvelteBoundary' || - child_node.type === 'SvelteDocument' || - child_node.type === 'SvelteSelf' || - child_node.type === 'SvelteWindow' || - child_node.type === 'SvelteComponent' || - child_node.type === 'SvelteElement' || - child_node.type === 'SlotElement' || - child_node.type === 'TitleElement'; - - if (is_block_element && sequence.length > 0) flush(); - sequence.push(child_node); - if (is_block_element) flush(); - } - } - - flush(); - - let multiline = false; - let width = 0; - - const child_contexts = items - .filter((x) => x.length > 0) - .map((sequence) => { - const child_context = context.new(); - - for (const node of sequence) { - child_context.visit(node); - multiline ||= child_context.multiline; - } - - width += child_context.measure(); - - return child_context; - }); - - multiline ||= width > LINE_BREAK_THRESHOLD; - - for (let i = 0; i < child_contexts.length; i += 1) { - const prev = child_contexts[i]; - const next = child_contexts[i + 1]; - - context.append(prev); - - if (next) { - if (prev.multiline || next.multiline) { - context.margin(); - context.newline(); - } else if (multiline) { - context.newline(); - } - } - } - }, - - AnimateDirective(node, context) { - context.write(`animate:${node.name}`); - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - }, - - AttachTag(node, context) { - context.write('{@attach '); - context.visit(node.expression); - context.write('}'); - }, - - Attribute(node, context) { - context.write(node.name); - - if (node.value === true) return; - - context.write('='); - - if (Array.isArray(node.value)) { - if (node.value.length > 1 || node.value[0].type === 'Text') { - context.write('"'); - } - - for (const chunk of node.value) { - context.visit(chunk); - } - - if (node.value.length > 1 || node.value[0].type === 'Text') { - context.write('"'); - } - } else { - context.visit(node.value); - } - }, - - AwaitBlock(node, context) { - context.write(`{#await `); - context.visit(node.expression); - - if (node.pending) { - context.write('}'); - block(context, node.pending); - context.write('{:'); - } else { - context.write(' '); - } - - if (node.then) { - context.write(node.value ? 'then ' : 'then'); - if (node.value) context.visit(node.value); - context.write('}'); - - block(context, node.then); - - if (node.catch) { - context.write('{:'); - } - } - - if (node.catch) { - context.write(node.value ? 'catch ' : 'catch'); - if (node.error) context.visit(node.error); - context.write('}'); - - block(context, node.catch); - } - - context.write('{/await}'); - }, - - BindDirective(node, context) { - context.write(`bind:${node.name}`); - - if (node.expression.type === 'Identifier' && node.expression.name === node.name) { - // shorthand - return; - } - - context.write('={'); - - if (node.expression.type === 'SequenceExpression') { - context.visit(node.expression.expressions[0]); - context.write(', '); - context.visit(node.expression.expressions[1]); - } else { - context.visit(node.expression); - } - - context.write('}'); - }, - - ClassDirective(node, context) { - context.write(`class:${node.name}`); - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - }, - - Comment(node, context) { - context.write(''); - }, - - Component(node, context) { - base_element(node, context, comments); - }, - - ConstTag(node, context) { - context.write('{@const '); - const declarators = node.declaration.declarations; - for (let i = 0; i < declarators.length; i++) { - if (i > 0) context.write(', '); - context.visit(declarators[i]); - } - - context.write('}'); - }, - - DebugTag(node, context) { - context.write('{@debug '); - let started = false; - for (const identifier of node.identifiers) { - if (started) { - context.write(', '); - } - context.visit(identifier); - started = true; - } - context.write('}'); - }, - - EachBlock(node, context) { - context.write('{#each '); - context.visit(node.expression); - - if (node.context) { - context.write(' as '); - context.visit(node.context); - } - - if (node.index) { - context.write(`, ${node.index}`); - } - - if (node.key) { - context.write(' ('); - context.visit(node.key); - context.write(')'); - } - - context.write('}'); - - block(context, node.body); - - if (node.fallback) { - context.write('{:else}'); - block(context, node.fallback); - } - - context.write('{/each}'); - }, - - ExpressionTag(node, context) { - context.write('{'); - context.visit(node.expression); - context.write('}'); - }, - - HtmlTag(node, context) { - context.write('{@html '); - context.visit(node.expression); - context.write('}'); - }, - - IfBlock(node, context) { - if (node.elseif) { - context.write('{:else if '); - context.visit(node.test); - context.write('}'); - - block(context, node.consequent); - } else { - context.write('{#if '); - context.visit(node.test); - context.write('}'); - - block(context, node.consequent); - } - - if (node.alternate !== null) { - if ( - !( - node.alternate.nodes.length === 1 && - node.alternate.nodes[0].type === 'IfBlock' && - node.alternate.nodes[0].elseif - ) - ) { - context.write('{:else}'); - block(context, node.alternate); - } else { - context.visit(node.alternate); - } - } - - if (!node.elseif) { - context.write('{/if}'); - } - }, - - KeyBlock(node, context) { - context.write('{#key '); - context.visit(node.expression); - context.write('}'); - block(context, node.fragment); - context.write('{/key}'); - }, - - LetDirective(node, context) { - context.write(`let:${node.name}`); - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - }, - - OnDirective(node, context) { - context.write(`on:${node.name}`); - for (const modifier of node.modifiers) { - context.write(`|${modifier}`); - } - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - }, - - RegularElement(node, context) { - base_element(node, context, comments); - }, - - RenderTag(node, context) { - context.write('{@render '); - context.visit(node.expression); - context.write('}'); - }, - - SlotElement(node, context) { - base_element(node, context, comments); - }, - - SnippetBlock(node, context) { - context.write('{#snippet '); - context.visit(node.expression); - - if (node.typeParams) { - context.write(`<${node.typeParams}>`); - } - - context.write('('); - - for (let i = 0; i < node.parameters.length; i += 1) { - if (i > 0) context.write(', '); - context.visit(node.parameters[i]); - } - - context.write(')}'); - block(context, node.body); - context.write('{/snippet}'); - }, - - SpreadAttribute(node, context) { - context.write('{...'); - context.visit(node.expression); - context.write('}'); - }, - - StyleDirective(node, context) { - context.write(`style:${node.name}`); - for (const modifier of node.modifiers) { - context.write(`|${modifier}`); - } - - if (node.value === true) { - return; - } - - context.write('='); - - if (Array.isArray(node.value)) { - context.write('"'); - - for (const tag of node.value) { - context.visit(tag); - } - - context.write('"'); - } else { - context.visit(node.value); - } - }, - - StyleSheet(node, context) { - context.write(''); - - if (node.children.length > 0) { - context.indent(); - context.newline(); - - let started = false; - - for (const child of node.children) { - if (started) { - context.margin(); - context.newline(); - } - - context.visit(child); - started = true; - } - - context.dedent(); - context.newline(); - } - - context.write(''); - }, - - SvelteBoundary(node, context) { - base_element(node, context, comments); - }, - - SvelteComponent(node, context) { - context.write(' 0) { - context.write('>'); - block(context, node.fragment, true); - context.write(``); - } else { - context.write(' />'); - } - }, - - SvelteDocument(node, context) { - base_element(node, context, comments); - }, - - SvelteElement(node, context) { - context.write(' 0) { - context.write('>'); - block(context, node.fragment); - context.write(``); - } else { - context.write(' />'); - } - }, - - SvelteFragment(node, context) { - base_element(node, context, comments); - }, - - SvelteHead(node, context) { - base_element(node, context, comments); - }, - - SvelteSelf(node, context) { - base_element(node, context, comments); - }, - - SvelteWindow(node, context) { - base_element(node, context, comments); - }, - - Text(node, context) { - context.write(node.data); - }, - - TitleElement(node, context) { - base_element(node, context, comments); - }, - - TransitionDirective(node, context) { - const directive = node.intro && node.outro ? 'transition' : node.intro ? 'in' : 'out'; - context.write(`${directive}:${node.name}`); - for (const modifier of node.modifiers) { - context.write(`|${modifier}`); - } - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - }, - - UseDirective(node, context) { - context.write(`use:${node.name}`); - if ( - node.expression !== null && - !(node.expression.type === 'Identifier' && node.expression.name === node.name) - ) { - context.write('={'); - context.visit(node.expression); - context.write('}'); - } - } -}); diff --git a/web/node_modules/svelte/src/compiler/state.js b/web/node_modules/svelte/src/compiler/state.js deleted file mode 100644 index 5ae001e..0000000 --- a/web/node_modules/svelte/src/compiler/state.js +++ /dev/null @@ -1,175 +0,0 @@ -/** @import { Location } from 'locate-character' */ -/** @import { CompileOptions } from './types' */ -/** @import { AST, Warning } from '#compiler' */ -import { getLocator } from 'locate-character'; -import { sanitize_location } from '../utils.js'; - -/** @typedef {{ start?: number, end?: number }} NodeLike */ - -/** @type {Warning[]} */ -export let warnings = []; - -/** - * The filename relative to the rootDir (if specified). - * This should not be used in the compiler output except in dev mode - * @type {string} - */ -export let filename; - -/** - * This is the fallback used when no filename is specified. - */ -export const UNKNOWN_FILENAME = '(unknown)'; - -/** - * The name of the component that is used in the `export default function ...` statement. - */ -export let component_name = ''; - -/** - * The original source code - * @type {string} - */ -export let source; - -/** - * The source code split into lines (set by `set_source`) - * @type {string[]} - */ -export let source_lines = []; - -/** - * True if compiling with `dev: true` - * @type {boolean} - */ -export let dev; - -export let runes = false; - -/** @type {(index: number) => Location} */ -export let locator; - -/** @param {string} value */ -export function set_source(value) { - source = value; - source_lines = source.split('\n'); - - const l = getLocator(source, { offsetLine: 1 }); - - locator = (i) => { - const loc = l(i); - if (!loc) throw new Error('An impossible situation occurred'); - - return loc; - }; -} - -/** - * @param {AST.SvelteNode & { start?: number | undefined }} node - */ -export function locate_node(node) { - const loc = locator(/** @type {number} */ (node.start)); - return `${sanitize_location(filename)}:${loc?.line}:${loc.column}`; -} - -/** @type {NonNullable} */ -export let warning_filter; - -/** - * The current stack of ignored warnings - * @type {Set[]} - */ -export let ignore_stack = []; - -/** - * For each node the list of warnings that should be ignored for that node. - * Exists in addition to `ignore_stack` because not all warnings are emitted - * while the stack is being built. - * @type {Map[]>} - */ -export let ignore_map = new Map(); - -/** - * Cached snapshot of the ignore_stack. Only re-created when the stack changes - * (i.e. when push_ignore or pop_ignore is called), avoiding a structuredClone - * on every node visit during analysis. - * @type {Set[] | null} - */ -let cached_ignore_snapshot = null; - -/** - * Returns a snapshot of the current ignore_stack, reusing a cached copy - * when the stack hasn't changed since the last call. - * @returns {Set[]} - */ -export function get_ignore_snapshot() { - if (cached_ignore_snapshot === null) { - cached_ignore_snapshot = ignore_stack.map((s) => new Set(s)); - } - return cached_ignore_snapshot; -} - -/** - * @param {string[]} ignores - */ -export function push_ignore(ignores) { - const next = new Set([...(ignore_stack.at(-1) || []), ...ignores]); - ignore_stack.push(next); - cached_ignore_snapshot = null; -} - -export function pop_ignore() { - ignore_stack.pop(); - cached_ignore_snapshot = null; -} - -/** - * @param {AST.SvelteNode | NodeLike} node - * @param {typeof import('../constants.js').IGNORABLE_RUNTIME_WARNINGS[number]} code - * @returns - */ -export function is_ignored(node, code) { - return dev && !!ignore_map.get(node)?.some((codes) => codes.has(code)); -} - -/** - * Call this to reset the compiler state. Should be called before each compilation. - * @param {{ warning?: (warning: Warning) => boolean; filename: string | undefined }} state - */ -export function reset(state) { - dev = false; - runes = false; - component_name = UNKNOWN_FILENAME; - source = ''; - source_lines = []; - filename = (state.filename ?? UNKNOWN_FILENAME).replace(/\\/g, '/'); - warning_filter = state.warning ?? (() => true); - warnings = []; -} - -/** - * Adjust the compiler state based on the provided state object. - * Call this after parsing and basic analysis happened. - * @param {{ - * dev: boolean; - * component_name?: string; - * rootDir?: string; - * runes: boolean; - * }} state - */ -export function adjust(state) { - const root_dir = state.rootDir?.replace(/\\/g, '/'); - - dev = state.dev; - runes = state.runes; - component_name = state.component_name ?? UNKNOWN_FILENAME; - - if (typeof root_dir === 'string' && filename.startsWith(root_dir)) { - // make filename relative to rootDir - filename = filename.replace(root_dir, '').replace(/^[/\\]/, ''); - } - - ignore_stack = []; - ignore_map.clear(); - cached_ignore_snapshot = null; -} diff --git a/web/node_modules/svelte/src/compiler/utils/assert.js b/web/node_modules/svelte/src/compiler/utils/assert.js deleted file mode 100644 index 6434e4d..0000000 --- a/web/node_modules/svelte/src/compiler/utils/assert.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @template T - * @param {any} actual - * @param {T} expected - * @returns {asserts actual is T} - */ -export function equal(actual, expected) { - if (actual !== expected) throw new Error('Assertion failed'); -} diff --git a/web/node_modules/svelte/src/compiler/utils/ast.js b/web/node_modules/svelte/src/compiler/utils/ast.js deleted file mode 100644 index 75aadd9..0000000 --- a/web/node_modules/svelte/src/compiler/utils/ast.js +++ /dev/null @@ -1,639 +0,0 @@ -/** @import { AST, Scope } from '#compiler' */ -/** @import * as ESTree from 'estree' */ -import { walk } from 'zimmerframe'; -import * as b from '#compiler/builders'; - -/** - * Gets the left-most identifier of a member expression or identifier. - * @param {ESTree.MemberExpression | ESTree.Identifier} expression - * @returns {ESTree.Identifier | null} - */ -export function object(expression) { - while (expression.type === 'MemberExpression') { - expression = /** @type {ESTree.MemberExpression | ESTree.Identifier} */ (expression.object); - } - - if (expression.type !== 'Identifier') { - return null; - } - - return expression; -} - -/** - * Returns true if the attribute contains a single static text node. - * @param {AST.Attribute} attribute - * @returns {attribute is AST.Attribute & { value: [AST.Text] }} - */ -export function is_text_attribute(attribute) { - return ( - Array.isArray(attribute.value) && - attribute.value.length === 1 && - attribute.value[0].type === 'Text' - ); -} - -/** - * Returns true if the attribute contains a single expression node. - * In Svelte 5, this also includes a single expression node wrapped in an array. - * TODO change that in a future version - * @param {AST.Attribute} attribute - * @returns {attribute is AST.Attribute & { value: [AST.ExpressionTag] | AST.ExpressionTag }} - */ -export function is_expression_attribute(attribute) { - return ( - (attribute.value !== true && !Array.isArray(attribute.value)) || - (Array.isArray(attribute.value) && - attribute.value.length === 1 && - attribute.value[0].type === 'ExpressionTag') - ); -} - -/** - * Returns the single attribute expression node. - * In Svelte 5, this also includes a single expression node wrapped in an array. - * TODO change that in a future version - * @param { AST.Attribute & { value: [AST.ExpressionTag] | AST.ExpressionTag }} attribute - * @returns {ESTree.Expression} - */ -export function get_attribute_expression(attribute) { - return Array.isArray(attribute.value) - ? /** @type {AST.ExpressionTag} */ (attribute.value[0]).expression - : attribute.value.expression; -} - -/** - * Returns the expression chunks of an attribute value - * @param {AST.Attribute['value']} value - * @returns {Array} - */ -export function get_attribute_chunks(value) { - return Array.isArray(value) ? value : typeof value === 'boolean' ? [] : [value]; -} - -/** - * Returns true if the attribute starts with `on` and contains a single expression node. - * @param {AST.Attribute} attribute - * @returns {attribute is AST.Attribute & { value: [AST.ExpressionTag] | AST.ExpressionTag }} - */ -export function is_event_attribute(attribute) { - return is_expression_attribute(attribute) && attribute.name.startsWith('on'); -} - -/** - * Extracts all identifiers and member expressions from a pattern. - * @param {ESTree.Pattern} pattern - * @param {Array} [nodes] - * @returns {Array} - */ -export function unwrap_pattern(pattern, nodes = []) { - switch (pattern.type) { - case 'Identifier': - nodes.push(pattern); - break; - - case 'MemberExpression': - // member expressions can be part of an assignment pattern, but not a binding pattern - // see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment#binding_and_assignment - nodes.push(pattern); - break; - - case 'ObjectPattern': - for (const prop of pattern.properties) { - if (prop.type === 'RestElement') { - unwrap_pattern(prop.argument, nodes); - } else { - unwrap_pattern(prop.value, nodes); - } - } - - break; - - case 'ArrayPattern': - for (const element of pattern.elements) { - if (element) unwrap_pattern(element, nodes); - } - - break; - - case 'RestElement': - unwrap_pattern(pattern.argument, nodes); - break; - - case 'AssignmentPattern': - unwrap_pattern(pattern.left, nodes); - break; - } - - return nodes; -} - -/** - * Extracts all identifiers from a pattern. - * @param {ESTree.Pattern} pattern - * @returns {ESTree.Identifier[]} - */ -export function extract_identifiers(pattern) { - return unwrap_pattern(pattern, []).filter((node) => node.type === 'Identifier'); -} - -/** - * Extracts all identifiers and a stringified keypath from an expression. - * TODO replace this with `expression.dependencies` - * @param {ESTree.Expression} expr - * @returns {[keypath: string, ids: ESTree.Identifier[]]} - */ -export function extract_all_identifiers_from_expression(expr) { - /** @type {ESTree.Identifier[]} */ - let nodes = []; - /** @type {string[]} */ - let keypath = []; - - walk( - expr, - {}, - { - Identifier(node, { path }) { - const parent = path.at(-1); - if (parent?.type !== 'MemberExpression' || parent.property !== node || parent.computed) { - nodes.push(node); - } - - if (parent?.type === 'MemberExpression' && parent.computed && parent.property === node) { - keypath.push(`[${node.name}]`); - } else { - keypath.push(node.name); - } - }, - Literal(node, { path }) { - const value = typeof node.value === 'string' ? `"${node.value}"` : String(node.value); - const parent = path.at(-1); - if (parent?.type === 'MemberExpression' && parent.computed && parent.property === node) { - keypath.push(`[${value}]`); - } else { - keypath.push(value); - } - }, - ThisExpression(_, { next }) { - keypath.push('this'); - next(); - } - } - ); - - return [keypath.join('.'), nodes]; -} - -/** - * Extracts all leaf identifiers from a destructuring expression. - * @param {ESTree.Identifier | ESTree.ObjectExpression | ESTree.ArrayExpression} node - * @param {ESTree.Identifier[]} [nodes] - * @returns - */ -export function extract_identifiers_from_destructuring(node, nodes = []) { - // TODO This isn't complete, but it should be enough for our purposes - switch (node.type) { - case 'Identifier': - nodes.push(node); - break; - - case 'ObjectExpression': - for (const prop of node.properties) { - if (prop.type === 'Property') { - extract_identifiers_from_destructuring(/** @type {any} */ (prop.value), nodes); - } else { - extract_identifiers_from_destructuring(/** @type {any} */ (prop.argument), nodes); - } - } - - break; - - case 'ArrayExpression': - for (const element of node.elements) { - if (element) extract_identifiers_from_destructuring(/** @type {any} */ (element), nodes); - } - - break; - } - - return nodes; -} - -/** - * Represents the path of a destructured assignment from either a declaration - * or assignment expression. For example, given `const { foo: { bar: baz } } = quux`, - * the path of `baz` is `foo.bar` - * @typedef {Object} DestructuredAssignment - * @property {ESTree.Identifier | ESTree.MemberExpression} node The node the destructuring path end in. Can be a member expression only for assignment expressions - * @property {boolean} is_rest `true` if this is a `...rest` destructuring - * @property {boolean} has_default_value `true` if this has a fallback value like `const { foo = 'bar } = ..` - * @property {ESTree.Expression} expression The value of the current path - * This will be a call expression if a rest element or default is involved — e.g. `const { foo: { bar: baz = 42 }, ...rest } = quux` — since we can't represent `baz` or `rest` purely as a path - * Will be an await expression in case of an async default value (`const { foo = await bar } = ...`) - * @property {ESTree.Expression} update_expression Like `expression` but without default values. - */ - -/** - * Extracts all destructured assignments from a pattern. - * For each `id` in the returned `inserts`, make sure to adjust the `name`. - * @param {ESTree.Node} param - * @param {ESTree.Expression} initial - * @returns {{ inserts: Array<{ id: ESTree.Identifier, value: ESTree.Expression }>, paths: DestructuredAssignment[] }} - */ -export function extract_paths(param, initial) { - /** - * When dealing with array destructuring patterns (`let [a, b, c] = $derived(blah())`) - * we need an intermediate declaration that creates an array, since `blah()` could - * return a non-array-like iterator - * @type {Array<{ id: ESTree.Identifier, value: ESTree.Expression }>} - */ - const inserts = []; - - /** @type {DestructuredAssignment[]} */ - const paths = []; - - _extract_paths(paths, inserts, param, initial, initial, false); - - return { inserts, paths }; -} - -/** - * @param {DestructuredAssignment[]} paths - * @param {Array<{ id: ESTree.Identifier, value: ESTree.Expression }>} inserts - * @param {ESTree.Node} param - * @param {ESTree.Expression} expression - * @param {ESTree.Expression} update_expression - * @param {boolean} has_default_value - * @returns {DestructuredAssignment[]} - */ -function _extract_paths(paths, inserts, param, expression, update_expression, has_default_value) { - switch (param.type) { - case 'Identifier': - case 'MemberExpression': - paths.push({ - node: param, - is_rest: false, - has_default_value, - expression, - update_expression - }); - break; - - case 'ObjectPattern': - for (const prop of param.properties) { - if (prop.type === 'RestElement') { - /** @type {ESTree.Expression[]} */ - const props = []; - - for (const p of param.properties) { - if (p.type === 'Property' && p.key.type !== 'PrivateIdentifier') { - if (p.key.type === 'Identifier' && !p.computed) { - props.push(b.literal(p.key.name)); - } else if (p.key.type === 'Literal') { - props.push(b.literal(String(p.key.value))); - } else { - props.push(b.call('String', p.key)); - } - } - } - - const rest_expression = b.call('$.exclude_from_object', expression, b.array(props)); - - if (prop.argument.type === 'Identifier') { - paths.push({ - node: prop.argument, - is_rest: true, - has_default_value, - expression: rest_expression, - update_expression: rest_expression - }); - } else { - _extract_paths( - paths, - inserts, - prop.argument, - rest_expression, - rest_expression, - has_default_value - ); - } - } else { - const object_expression = b.member( - expression, - prop.key, - prop.computed || prop.key.type !== 'Identifier' - ); - - _extract_paths( - paths, - inserts, - prop.value, - object_expression, - object_expression, - has_default_value - ); - } - } - - break; - - case 'ArrayPattern': { - // we create an intermediate declaration to convert iterables to arrays if necessary. - // the consumer is responsible for setting the name of the identifier - const id = b.id('#'); - - const value = b.call( - '$.to_array', - expression, - param.elements.at(-1)?.type === 'RestElement' ? undefined : b.literal(param.elements.length) - ); - - inserts.push({ id, value }); - - for (let i = 0; i < param.elements.length; i += 1) { - const element = param.elements[i]; - if (element) { - if (element.type === 'RestElement') { - const rest_expression = b.call(b.member(id, 'slice'), b.literal(i)); - - if (element.argument.type === 'Identifier') { - paths.push({ - node: element.argument, - is_rest: true, - has_default_value, - expression: rest_expression, - update_expression: rest_expression - }); - } else { - _extract_paths( - paths, - inserts, - element.argument, - rest_expression, - rest_expression, - has_default_value - ); - } - } else { - const array_expression = b.member(id, b.literal(i), true); - - _extract_paths( - paths, - inserts, - element, - array_expression, - array_expression, - has_default_value - ); - } - } - } - - break; - } - - case 'AssignmentPattern': { - const fallback_expression = build_fallback(expression, param.right); - - if (param.left.type === 'Identifier') { - paths.push({ - node: param.left, - is_rest: false, - has_default_value: true, - expression: fallback_expression, - update_expression - }); - } else { - _extract_paths(paths, inserts, param.left, fallback_expression, update_expression, true); - } - - break; - } - } - - return paths; -} - -/** - * Like `path.at(x)`, but skips over `TSNonNullExpression` and `TSAsExpression` nodes and eases assertions a bit - * by removing the `| undefined` from the resulting type. - * - * @template {AST.SvelteNode} T - * @param {T[]} path - * @param {number} at - */ -export function get_parent(path, at) { - let node = path.at(at); - // @ts-expect-error - if (node.type === 'TSNonNullExpression' || node.type === 'TSAsExpression') { - return /** @type {T} */ (path.at(at < 0 ? at - 1 : at + 1)); - } - return /** @type {T} */ (node); -} - -/** - * Returns `true` if the expression is an identifier, a literal, a function expression, - * or a logical expression that only contains simple expressions. Used to determine whether - * something needs to be treated as though accessing it could have side-effects (i.e. - * reading signals prematurely) - * @param {ESTree.Expression} node - * @returns {boolean} - */ -export function is_simple_expression(node) { - if ( - node.type === 'Literal' || - node.type === 'Identifier' || - node.type === 'ArrowFunctionExpression' || - node.type === 'FunctionExpression' - ) { - return true; - } - - if (node.type === 'ConditionalExpression') { - return ( - is_simple_expression(node.test) && - is_simple_expression(node.consequent) && - is_simple_expression(node.alternate) - ); - } - - if (node.type === 'BinaryExpression' || node.type === 'LogicalExpression') { - return ( - node.left.type !== 'PrivateIdentifier' && - is_simple_expression(node.left) && - is_simple_expression(node.right) - ); - } - - return false; -} - -/** - * @template {ESTree.SimpleCallExpression | ESTree.MemberExpression} T - * @param {ESTree.ChainExpression & { expression : T } | T} node - * @returns {T} - */ -export function unwrap_optional(node) { - return node.type === 'ChainExpression' ? node.expression : node; -} - -/** - * @param {ESTree.Expression | ESTree.Pattern} expression - * @returns {boolean} - */ -export function is_expression_async(expression) { - switch (expression.type) { - case 'AwaitExpression': { - return true; - } - case 'ArrayPattern': { - return expression.elements.some((element) => element && is_expression_async(element)); - } - case 'ArrayExpression': { - return expression.elements.some((element) => { - if (!element) { - return false; - } else if (element.type === 'SpreadElement') { - return is_expression_async(element.argument); - } else { - return is_expression_async(element); - } - }); - } - case 'AssignmentPattern': - case 'AssignmentExpression': - case 'BinaryExpression': - case 'LogicalExpression': { - return ( - (expression.left.type !== 'PrivateIdentifier' && is_expression_async(expression.left)) || - is_expression_async(expression.right) - ); - } - case 'CallExpression': - case 'NewExpression': { - return ( - (expression.callee.type !== 'Super' && is_expression_async(expression.callee)) || - expression.arguments.some((element) => { - if (element.type === 'SpreadElement') { - return is_expression_async(element.argument); - } else { - return is_expression_async(element); - } - }) - ); - } - case 'ChainExpression': { - return is_expression_async(expression.expression); - } - case 'ConditionalExpression': { - return ( - is_expression_async(expression.test) || - is_expression_async(expression.alternate) || - is_expression_async(expression.consequent) - ); - } - case 'ImportExpression': { - return is_expression_async(expression.source); - } - case 'MemberExpression': { - return ( - (expression.object.type !== 'Super' && is_expression_async(expression.object)) || - (expression.property.type !== 'PrivateIdentifier' && - is_expression_async(expression.property)) - ); - } - case 'ObjectPattern': - case 'ObjectExpression': { - return expression.properties.some((property) => { - if (property.type === 'SpreadElement') { - return is_expression_async(property.argument); - } else if (property.type === 'Property') { - return ( - (property.key.type !== 'PrivateIdentifier' && is_expression_async(property.key)) || - is_expression_async(property.value) - ); - } - }); - } - case 'RestElement': { - return is_expression_async(expression.argument); - } - case 'SequenceExpression': - case 'TemplateLiteral': { - return expression.expressions.some((subexpression) => is_expression_async(subexpression)); - } - case 'TaggedTemplateExpression': { - return is_expression_async(expression.tag) || is_expression_async(expression.quasi); - } - case 'UnaryExpression': - case 'UpdateExpression': { - return is_expression_async(expression.argument); - } - case 'YieldExpression': { - return expression.argument ? is_expression_async(expression.argument) : false; - } - default: - return false; - } -} - -/** - * - * @param {ESTree.Expression} expression - * @param {ESTree.Expression} fallback - */ -export function build_fallback(expression, fallback) { - if (is_simple_expression(fallback)) { - return b.call('$.fallback', expression, fallback); - } - - if (fallback.type === 'AwaitExpression' && is_simple_expression(fallback.argument)) { - return b.await(b.call('$.fallback', expression, fallback.argument)); - } - - return is_expression_async(fallback) - ? b.await(b.call('$.fallback', expression, b.thunk(fallback, true), b.true)) - : b.call('$.fallback', expression, b.thunk(fallback), b.true); -} - -/** - * @param {ESTree.AssignmentOperator} operator - * @param {ESTree.Identifier | ESTree.MemberExpression} left - * @param {ESTree.Expression} right - */ -export function build_assignment_value(operator, left, right) { - return operator === '=' - ? right - : // turn something like x += 1 into x = x + 1 - ['||=', '&&=', '??='].includes(operator) - ? b.logical(/** @type {ESTree.LogicalOperator} */ (operator.slice(0, -1)), left, right) - : b.binary(/** @type {ESTree.BinaryOperator} */ (operator.slice(0, -1)), left, right); -} - -/** - * @param {ESTree.Node} node - */ -export function has_await_expression(node) { - let has_await = false; - - walk(node, null, { - AwaitExpression(_node, context) { - has_await = true; - context.stop(); - }, - // don't traverse into these - FunctionDeclaration() {}, - FunctionExpression() {}, - ArrowFunctionExpression() {} - }); - - return has_await; -} - -/** - * Turns `await ...` to `(await $.save(...))()` - * @param {ESTree.Expression} expression - */ -export function save(expression) { - return b.call(b.await(b.call('$.save', expression))); -} diff --git a/web/node_modules/svelte/src/compiler/utils/builders.js b/web/node_modules/svelte/src/compiler/utils/builders.js deleted file mode 100644 index 7508caf..0000000 --- a/web/node_modules/svelte/src/compiler/utils/builders.js +++ /dev/null @@ -1,698 +0,0 @@ -/** @import * as ESTree from 'estree' */ -import { walk } from 'zimmerframe'; -import { regex_is_valid_identifier } from '../phases/patterns.js'; -import { sanitize_template_string } from './sanitize_template_string.js'; -import { has_await_expression } from './ast.js'; - -/** - * @param {Array} elements - * @returns {ESTree.ArrayExpression} - */ -export function array(elements = []) { - return { type: 'ArrayExpression', elements }; -} - -/** - * @param {Array} elements - * @returns {ESTree.ArrayPattern} - */ -export function array_pattern(elements) { - return { type: 'ArrayPattern', elements }; -} - -/** - * @param {ESTree.Pattern} left - * @param {ESTree.Expression} right - * @returns {ESTree.AssignmentPattern} - */ -export function assignment_pattern(left, right) { - return { type: 'AssignmentPattern', left, right }; -} - -/** - * @param {Array} params - * @param {ESTree.BlockStatement | ESTree.Expression} body - * @param {boolean} async - * @returns {ESTree.ArrowFunctionExpression} - */ -export function arrow(params, body, async = false) { - // optimize `async () => await x()`, but not `async () => await x(await y)` - if (async && body.type === 'AwaitExpression') { - if (!has_await_expression(body.argument)) { - return arrow(params, body.argument); - } - } - - return { - type: 'ArrowFunctionExpression', - params, - body, - expression: body.type !== 'BlockStatement', - generator: false, - async - }; -} - -/** - * @param {ESTree.AssignmentOperator} operator - * @param {ESTree.Pattern} left - * @param {ESTree.Expression} right - * @returns {ESTree.AssignmentExpression} - */ -export function assignment(operator, left, right) { - return { type: 'AssignmentExpression', operator, left, right }; -} - -/** - * @param {ESTree.Expression} argument - * @returns {ESTree.AwaitExpression} - */ -function await_builder(argument) { - return { type: 'AwaitExpression', argument }; -} - -/** - * @param {ESTree.BinaryOperator} operator - * @param {ESTree.Expression} left - * @param {ESTree.Expression} right - * @returns {ESTree.BinaryExpression} - */ -export function binary(operator, left, right) { - return { type: 'BinaryExpression', operator, left, right }; -} - -/** - * @param {ESTree.Statement[]} body - * @returns {ESTree.BlockStatement} - */ -export function block(body) { - return { type: 'BlockStatement', body }; -} - -/** - * @param {ESTree.Identifier | null} id - * @param {ESTree.ClassBody} body - * @param {ESTree.Expression | null} [superClass] - * @param {ESTree.Decorator[]} [decorators] - * @returns {ESTree.ClassExpression} - */ -export function class_expression(id, body, superClass, decorators = []) { - return { type: 'ClassExpression', body, superClass, decorators }; -} - -/** - * @param {string} name - * @param {ESTree.Statement} body - * @returns {ESTree.LabeledStatement} - */ -export function labeled(name, body) { - return { type: 'LabeledStatement', label: id(name), body }; -} - -/** - * @param {string | ESTree.Expression} callee - * @param {...(ESTree.Expression | ESTree.SpreadElement | false | undefined | null)} args - * @returns {ESTree.CallExpression} - */ -export function call(callee, ...args) { - if (typeof callee === 'string') callee = id(callee); - args = args.slice(); - - // replacing missing arguments with `void(0)`, unless they're at the end in which case remove them - let i = args.length; - let popping = true; - while (i--) { - if (!args[i]) { - if (popping) { - args.pop(); - } else { - args[i] = void0; - } - } else { - popping = false; - } - } - - return { - type: 'CallExpression', - callee, - arguments: /** @type {Array} */ (args), - optional: false - }; -} - -/** - * @param {string | ESTree.Expression} callee - * @param {...ESTree.Expression} args - * @returns {ESTree.ChainExpression} - */ -export function maybe_call(callee, ...args) { - const expression = /** @type {ESTree.SimpleCallExpression} */ (call(callee, ...args)); - expression.optional = true; - - return { - type: 'ChainExpression', - expression - }; -} - -/** - * @param {ESTree.UnaryOperator} operator - * @param {ESTree.Expression} argument - * @returns {ESTree.UnaryExpression} - */ -export function unary(operator, argument) { - return { type: 'UnaryExpression', argument, operator, prefix: true }; -} - -export const void0 = unary('void', literal(0)); - -/** - * @param {ESTree.Expression} test - * @param {ESTree.Expression} consequent - * @param {ESTree.Expression} alternate - * @returns {ESTree.ConditionalExpression} - */ -export function conditional(test, consequent, alternate) { - return { type: 'ConditionalExpression', test, consequent, alternate }; -} - -/** - * @param {ESTree.LogicalOperator} operator - * @param {ESTree.Expression} left - * @param {ESTree.Expression} right - * @returns {ESTree.LogicalExpression} - */ -export function logical(operator, left, right) { - return { type: 'LogicalExpression', operator, left, right }; -} - -/** - * @param {ESTree.VariableDeclaration['kind']} kind - * @param {ESTree.VariableDeclarator[]} declarations - * @returns {ESTree.VariableDeclaration} - */ -export function declaration(kind, declarations) { - return { - type: 'VariableDeclaration', - kind, - declarations - }; -} - -/** - * @param {ESTree.Pattern | string} pattern - * @param {ESTree.Expression | null} [init] - * @returns {ESTree.VariableDeclarator} - */ -export function declarator(pattern, init) { - if (typeof pattern === 'string') pattern = id(pattern); - return { type: 'VariableDeclarator', id: pattern, init }; -} - -/** @type {ESTree.EmptyStatement} */ -export const empty = { - type: 'EmptyStatement' -}; - -/** - * @param {ESTree.Expression | ESTree.MaybeNamedClassDeclaration | ESTree.MaybeNamedFunctionDeclaration} declaration - * @returns {ESTree.ExportDefaultDeclaration} - */ -export function export_default(declaration) { - return { type: 'ExportDefaultDeclaration', declaration }; -} - -/** - * @param {ESTree.VariableDeclaration | ESTree.Pattern} left - * @param {ESTree.Expression} right - * @param {ESTree.Statement} body - * @param {boolean} [_await] - * @returns {ESTree.ForOfStatement} - */ -export function for_of(left, right, body, _await = false) { - return { - type: 'ForOfStatement', - left, - right, - body, - await: _await - }; -} - -/** - * @param {ESTree.Identifier} id - * @param {ESTree.Pattern[]} params - * @param {ESTree.BlockStatement} body - * @param {boolean} async - * @returns {ESTree.FunctionDeclaration} - */ -export function function_declaration(id, params, body, async = false) { - return { - type: 'FunctionDeclaration', - id, - params, - body, - generator: false, - async - }; -} - -/** - * @param {string} name - * @param {ESTree.Statement[]} body - * @returns {ESTree.Property & { value: ESTree.FunctionExpression}}} - */ -export function get(name, body) { - return prop('get', key(name), function_builder(null, [], block(body))); -} - -/** - * @param {string} name - * @param {ESTree.SourceLocation | null} [loc] - * @returns {ESTree.Identifier} - */ -export function id(name, loc) { - const node = /** @type {ESTree.Identifier} */ ({ type: 'Identifier', name }); - if (loc) node.loc = loc; - - return node; -} - -/** - * @param {string} name - * @returns {ESTree.PrivateIdentifier} - */ -export function private_id(name) { - return { type: 'PrivateIdentifier', name }; -} - -/** - * @param {string} local - * @returns {ESTree.ImportNamespaceSpecifier} - */ -function import_namespace(local) { - return { - type: 'ImportNamespaceSpecifier', - local: id(local) - }; -} - -/** - * @param {string} name - * @param {ESTree.Expression} value - * @returns {ESTree.Property} - */ -export function init(name, value) { - return prop('init', key(name), value); -} - -/** - * @param {string | boolean | null | number | RegExp} value - * @returns {ESTree.Literal} - */ -export function literal(value) { - // @ts-expect-error we don't want to muck around with bigint here - return { type: 'Literal', value }; -} - -/** - * @param {ESTree.Expression | ESTree.Super} object - * @param {string | ESTree.Expression | ESTree.PrivateIdentifier} property - * @param {boolean} computed - * @param {boolean} optional - * @returns {ESTree.MemberExpression} - */ -export function member(object, property, computed = false, optional = false) { - if (typeof property === 'string') { - property = id(property); - } - - return { type: 'MemberExpression', object, property, computed, optional }; -} - -/** - * @param {string} path - * @returns {ESTree.Identifier | ESTree.MemberExpression} - */ -export function member_id(path) { - const parts = path.split('.'); - - /** @type {ESTree.Identifier | ESTree.MemberExpression} */ - let expression = id(parts[0]); - - for (let i = 1; i < parts.length; i += 1) { - expression = member(expression, id(parts[i])); - } - return expression; -} - -/** - * @param {Array} properties - * @returns {ESTree.ObjectExpression} - */ -export function object(properties) { - return { type: 'ObjectExpression', properties }; -} - -/** - * @param {Array} properties - * @returns {ESTree.ObjectPattern} - */ -export function object_pattern(properties) { - // @ts-expect-error the types appear to be wrong - return { type: 'ObjectPattern', properties }; -} - -/** - * @template {ESTree.Expression} Value - * @param {'init' | 'get' | 'set'} kind - * @param {ESTree.Expression} key - * @param {Value} value - * @param {boolean} computed - * @returns {ESTree.Property & { value: Value }} - */ -export function prop(kind, key, value, computed = false) { - return { type: 'Property', kind, key, value, method: false, shorthand: false, computed }; -} - -/** - * @param {ESTree.Expression | ESTree.PrivateIdentifier} key - * @param {ESTree.Expression | null | undefined} value - * @param {boolean} computed - * @param {boolean} is_static - * @returns {ESTree.PropertyDefinition} - */ -export function prop_def(key, value, computed = false, is_static = false) { - return { - type: 'PropertyDefinition', - decorators: [], - key, - value, - computed, - static: is_static - }; -} - -/** - * @param {string} cooked - * @param {boolean} tail - * @returns {ESTree.TemplateElement} - */ -export function quasi(cooked, tail = false) { - const raw = sanitize_template_string(cooked); - return { type: 'TemplateElement', value: { raw, cooked }, tail }; -} - -/** - * @param {ESTree.Pattern} argument - * @returns {ESTree.RestElement} - */ -export function rest(argument) { - return { type: 'RestElement', argument }; -} - -/** - * @param {ESTree.Expression[]} expressions - * @returns {ESTree.SequenceExpression} - */ -export function sequence(expressions) { - return { type: 'SequenceExpression', expressions }; -} - -/** - * @param {string} name - * @param {ESTree.Statement[]} body - * @returns {ESTree.Property & { value: ESTree.FunctionExpression}} - */ -export function set(name, body) { - return prop('set', key(name), function_builder(null, [id('$$value')], block(body))); -} - -/** - * @param {ESTree.Expression} argument - * @returns {ESTree.SpreadElement} - */ -export function spread(argument) { - return { type: 'SpreadElement', argument }; -} - -/** - * @param {ESTree.Expression} expression - * @returns {ESTree.ExpressionStatement} - */ -export function stmt(expression) { - return { type: 'ExpressionStatement', expression }; -} - -/** - * @param {ESTree.TemplateElement[]} elements - * @param {ESTree.Expression[]} expressions - * @returns {ESTree.TemplateLiteral} - */ -export function template(elements, expressions) { - return { type: 'TemplateLiteral', quasis: elements, expressions }; -} - -/** - * @param {ESTree.Expression | ESTree.BlockStatement} expression - * @param {boolean} [async] - * @returns {ESTree.Expression} - */ -export function thunk(expression, async = false) { - return unthunk(arrow([], expression, async)); -} - -/** - * Replace "(arg) => func(arg)" to "func" - * @param {ESTree.ArrowFunctionExpression} expression - * @returns {ESTree.Expression} - */ -export function unthunk(expression) { - if ( - expression.async === false && - expression.body.type === 'CallExpression' && - expression.body.callee.type === 'Identifier' && - expression.params.length === expression.body.arguments.length && - expression.params.every((param, index) => { - const arg = /** @type {ESTree.SimpleCallExpression} */ (expression.body).arguments[index]; - return param.type === 'Identifier' && arg.type === 'Identifier' && param.name === arg.name; - }) - ) { - return expression.body.callee; - } - return expression; -} - -/** - * - * @param {string | ESTree.Expression} expression - * @param {...ESTree.Expression} args - * @returns {ESTree.NewExpression} - */ -function new_builder(expression, ...args) { - if (typeof expression === 'string') expression = id(expression); - - return { - callee: expression, - arguments: args, - type: 'NewExpression' - }; -} - -/** - * @param {ESTree.UpdateOperator} operator - * @param {ESTree.Expression} argument - * @param {boolean} prefix - * @returns {ESTree.UpdateExpression} - */ -export function update(operator, argument, prefix = false) { - return { type: 'UpdateExpression', operator, argument, prefix }; -} - -/** - * @param {ESTree.Expression} test - * @param {ESTree.Statement} body - * @returns {ESTree.DoWhileStatement} - */ -export function do_while(test, body) { - return { type: 'DoWhileStatement', test, body }; -} - -const true_instance = literal(true); -const false_instance = literal(false); -const null_instance = literal(null); - -/** @type {ESTree.DebuggerStatement} */ -const debugger_builder = { - type: 'DebuggerStatement' -}; - -/** @type {ESTree.ThisExpression} */ -const this_instance = { - type: 'ThisExpression' -}; - -/** - * @param {string | ESTree.Pattern} pattern - * @param {ESTree.Expression | null} [init] - * @returns {ESTree.VariableDeclaration} - */ -function let_builder(pattern, init) { - return declaration('let', [declarator(pattern, init)]); -} - -/** - * @param {string | ESTree.Pattern} pattern - * @param {ESTree.Expression | null} init - * @returns {ESTree.VariableDeclaration} - */ -function const_builder(pattern, init) { - return declaration('const', [declarator(pattern, init)]); -} - -/** - * @param {string | ESTree.Pattern} pattern - * @param {ESTree.Expression | null} [init] - * @returns {ESTree.VariableDeclaration} - */ -function var_builder(pattern, init) { - return declaration('var', [declarator(pattern, init)]); -} - -/** - * - * @param {ESTree.VariableDeclaration | ESTree.Expression | null} init - * @param {ESTree.Expression} test - * @param {ESTree.Expression} update - * @param {ESTree.Statement} body - * @returns {ESTree.ForStatement} - */ -function for_builder(init, test, update, body) { - return { type: 'ForStatement', init, test, update, body }; -} - -/** - * - * @param {'constructor' | 'method' | 'get' | 'set'} kind - * @param {ESTree.Expression | ESTree.PrivateIdentifier} key - * @param {ESTree.Pattern[]} params - * @param {ESTree.Statement[]} body - * @param {boolean} computed - * @param {boolean} is_static - * @returns {ESTree.MethodDefinition} - */ -export function method(kind, key, params, body, computed = false, is_static = false) { - return { - type: 'MethodDefinition', - decorators: [], - key, - kind, - value: function_builder(null, params, block(body)), - computed, - static: is_static - }; -} - -/** - * - * @param {ESTree.Identifier | null} id - * @param {ESTree.Pattern[]} params - * @param {ESTree.BlockStatement} body - * @returns {ESTree.FunctionExpression} - */ -function function_builder(id, params, body, async = false) { - return { - type: 'FunctionExpression', - id, - params, - body, - generator: false, - async - }; -} - -/** - * @param {ESTree.Expression} test - * @param {ESTree.Statement} consequent - * @param {ESTree.Statement} [alternate] - * @returns {ESTree.IfStatement} - */ -function if_builder(test, consequent, alternate) { - return { type: 'IfStatement', test, consequent, alternate }; -} - -/** - * @param {string} as - * @param {string} source - * @returns {ESTree.ImportDeclaration} - */ -export function import_all(as, source) { - return { - type: 'ImportDeclaration', - attributes: [], - source: literal(source), - specifiers: [import_namespace(as)] - }; -} - -/** - * @param {Array<[string, string]>} parts - * @param {string} source - * @returns {ESTree.ImportDeclaration} - */ -export function imports(parts, source) { - return { - type: 'ImportDeclaration', - attributes: [], - source: literal(source), - specifiers: parts.map((p) => ({ - type: 'ImportSpecifier', - imported: id(p[0]), - local: id(p[1]) - })) - }; -} - -/** - * @param {ESTree.Expression | null} argument - * @returns {ESTree.ReturnStatement} - */ -function return_builder(argument = null) { - return { type: 'ReturnStatement', argument }; -} - -/** - * @param {string} str - * @returns {ESTree.ThrowStatement} - */ -export function throw_error(str) { - return { - type: 'ThrowStatement', - argument: new_builder('Error', literal(str)) - }; -} - -export { - await_builder as await, - let_builder as let, - const_builder as const, - var_builder as var, - true_instance as true, - false_instance as false, - for_builder as for, - function_builder as function, - return_builder as return, - if_builder as if, - this_instance as this, - null_instance as null, - debugger_builder as debugger -}; - -/** - * @param {string} name - * @returns {ESTree.Expression} - */ -export function key(name) { - return regex_is_valid_identifier.test(name) ? id(name) : literal(name); -} diff --git a/web/node_modules/svelte/src/compiler/utils/compile_diagnostic.js b/web/node_modules/svelte/src/compiler/utils/compile_diagnostic.js deleted file mode 100644 index 95d028e..0000000 --- a/web/node_modules/svelte/src/compiler/utils/compile_diagnostic.js +++ /dev/null @@ -1,106 +0,0 @@ -/** @import { Location } from 'locate-character' */ -import * as state from '../state.js'; - -const regex_tabs = /^\t+/; - -/** - * @param {string} str - */ -function tabs_to_spaces(str) { - return str.replace(regex_tabs, (match) => match.split('\t').join(' ')); -} - -/** - * @param {number} line - * @param {number} column - */ -function get_code_frame(line, column) { - const lines = state.source_lines; - const frame_start = Math.max(0, line - 2); - const frame_end = Math.min(line + 3, lines.length); - const digits = String(frame_end + 1).length; - return lines - .slice(frame_start, frame_end) - .map((str, i) => { - const is_error_line = frame_start + i === line; - const line_num = String(i + frame_start + 1).padStart(digits, ' '); - if (is_error_line) { - const indicator = - ' '.repeat(digits + 2 + tabs_to_spaces(str.slice(0, column)).length) + '^'; - return `${line_num}: ${tabs_to_spaces(str)}\n${indicator}`; - } - return `${line_num}: ${tabs_to_spaces(str)}`; - }) - .join('\n'); -} - -/** - * @typedef {{ - * code: string; - * message: string; - * stack?: string; - * filename?: string; - * start?: Location; - * end?: Location; - * position?: [number, number]; - * frame?: string; - * }} ICompileDiagnostic - */ - -/** @implements {ICompileDiagnostic} */ -export class CompileDiagnostic { - name = 'CompileDiagnostic'; - - /** - * @param {string} code - * @param {string} message - * @param {[number, number] | undefined} position - */ - constructor(code, message, position) { - this.code = code; - this.message = message; - - if (state.filename !== state.UNKNOWN_FILENAME) { - this.filename = state.filename; - } - - if (position) { - this.position = position; - this.start = state.locator(position[0]); - this.end = state.locator(position[1]); - if (this.start && this.end) { - this.frame = get_code_frame(this.start.line - 1, this.end.column); - } - } - } - - toString() { - let out = `${this.code}: ${this.message}`; - - if (this.filename) { - out += `\n${this.filename}`; - - if (this.start) { - out += `:${this.start.line}:${this.start.column}`; - } - } - - if (this.frame) { - out += `\n${this.frame}`; - } - - return out; - } - - toJSON() { - return { - code: this.code, - message: this.message, - filename: this.filename, - start: this.start, - end: this.end, - position: this.position, - frame: this.frame - }; - } -} diff --git a/web/node_modules/svelte/src/compiler/utils/extract_svelte_ignore.js b/web/node_modules/svelte/src/compiler/utils/extract_svelte_ignore.js deleted file mode 100644 index 2f0d387..0000000 --- a/web/node_modules/svelte/src/compiler/utils/extract_svelte_ignore.js +++ /dev/null @@ -1,104 +0,0 @@ -import { IGNORABLE_RUNTIME_WARNINGS } from '../../constants.js'; -import fuzzymatch from '../phases/1-parse/utils/fuzzymatch.js'; -import * as w from '../warnings.js'; - -const regex_svelte_ignore = /^\s*svelte-ignore\s/; - -/** @type {Record} Map of legacy code -> new code */ -const replacements = { - 'non-top-level-reactive-declaration': 'reactive_declaration_invalid_placement', - 'module-script-reactive-declaration': 'reactive_declaration_module_script', - 'empty-block': 'block_empty', - 'avoid-is': 'attribute_avoid_is', - 'invalid-html-attribute': 'attribute_invalid_property_name', - 'a11y-structure': 'a11y_figcaption_parent', - 'illegal-attribute-character': 'attribute_illegal_colon', - 'invalid-rest-eachblock-binding': 'bind_invalid_each_rest', - 'unused-export-let': 'export_let_unused' -}; - -const codes = w.codes.concat(IGNORABLE_RUNTIME_WARNINGS); - -/** - * @param {number} offset - * @param {string} text - * @param {boolean} runes - * @returns {string[]} - */ -export function extract_svelte_ignore(offset, text, runes) { - const match = regex_svelte_ignore.exec(text); - if (!match) return []; - - let length = match[0].length; - offset += length; - - /** @type {string[]} */ - const ignores = []; - - if (runes) { - // Warnings have to be separated by commas, everything after is interpreted as prose - for (const match of text.slice(length).matchAll(/([\w$-]+)(,)?/gm)) { - const code = match[1]; - - if (codes.includes(code)) { - ignores.push(code); - } else { - const replacement = replacements[code] ?? code.replace(/-/g, '_'); - - // The type cast is for some reason necessary to pass the type check in CI - const start = offset + /** @type {number} */ (match.index); - const end = start + code.length; - - if (codes.includes(replacement)) { - w.legacy_code({ start, end }, code, replacement); - } else { - const suggestion = fuzzymatch(code, codes); - w.unknown_code({ start, end }, code, suggestion); - } - } - - if (!match[2]) { - break; - } - } - } else { - // Non-runes mode: lax parsing, backwards compat with old codes - for (const match of text.slice(length).matchAll(/[\w$-]+/gm)) { - const code = match[0]; - - ignores.push(code); - - if (!codes.includes(code)) { - const replacement = replacements[code] ?? code.replace(/-/g, '_'); - - if (codes.includes(replacement)) { - ignores.push(replacement); - } - } - } - } - - return ignores; -} - -/** - * Replaces legacy svelte-ignore codes with new codes. - * @param {string} text - * @returns {string} - */ -export function migrate_svelte_ignore(text) { - const match = regex_svelte_ignore.exec(text); - if (!match) return text; - - const length = match[0].length; - return ( - text.substring(0, length) + - text.substring(length).replace(/\w+-\w+(-\w+)*/g, (code, _, idx) => { - let replacement = replacements[code] ?? code.replace(/-/g, '_'); - if (/\w+-\w+/.test(text.substring(length + idx + code.length))) { - replacement += ','; - } - return replacement; - }) - ); -} diff --git a/web/node_modules/svelte/src/compiler/utils/mapped_code.js b/web/node_modules/svelte/src/compiler/utils/mapped_code.js deleted file mode 100644 index 7686ba5..0000000 --- a/web/node_modules/svelte/src/compiler/utils/mapped_code.js +++ /dev/null @@ -1,454 +0,0 @@ -/** @import { ValidatedCompileOptions } from '#compiler' */ -/** @import { Processed } from '../preprocess/public.js' */ -/** @import { SourceMap } from 'magic-string' */ -/** @import { Source } from '../preprocess/private.js' */ -/** @import { DecodedSourceMap, SourceMapSegment, RawSourceMap } from '@jridgewell/remapping' */ -import remapping from '@jridgewell/remapping'; -import { push_array } from './push_array.js'; - -/** - * @param {string} s - */ -function last_line_length(s) { - return s.length - s.lastIndexOf('\n') - 1; -} -// mutate map in-place - -/** - * @param {DecodedSourceMap} map - * @param {{ line: number; column: number; }} offset - * @param {number} source_index - */ -export function sourcemap_add_offset(map, offset, source_index) { - if (map.mappings.length == 0) return; - for (let line = 0; line < map.mappings.length; line++) { - const segment_list = map.mappings[line]; - for (let segment = 0; segment < segment_list.length; segment++) { - const seg = segment_list[segment]; - // shift only segments that belong to component source file - if (seg[1] === source_index) { - // also ensures that seg.length >= 4 - // shift column if it points at the first line - if (seg[2] === 0) { - /** @type {any} */ (seg[3]) += offset.column; - } - // shift line - /** @type {any} */ (seg[2]) += offset.line; - } - } - } -} - -/** - * @template T - * @param {T[]} this_table - * @param {T[]} other_table - * @returns {[T[], number[], boolean, boolean]} - */ -function merge_tables(this_table, other_table) { - const new_table = this_table.slice(); - const idx_map = []; - other_table = other_table || []; - let val_changed = false; - for (const [other_idx, other_val] of other_table.entries()) { - const this_idx = this_table.indexOf(other_val); - if (this_idx >= 0) { - idx_map[other_idx] = this_idx; - } else { - const new_idx = new_table.length; - new_table[new_idx] = other_val; - idx_map[other_idx] = new_idx; - val_changed = true; - } - } - let idx_changed = val_changed; - if (val_changed) { - if (idx_map.find((val, idx) => val != idx) === undefined) { - // idx_map is identity map [0, 1, 2, 3, 4, ....] - idx_changed = false; - } - } - return [new_table, idx_map, val_changed, idx_changed]; -} -const regex_line_token = /([^\w\s]|\s+)/g; -/** */ -export class MappedCode { - /** - * @type {string} - */ - string = /** @type {any} */ (undefined); - - /** - * @type {DecodedSourceMap} - */ - map = /** @type {any} */ (undefined); - - /** - * @param {string} string - * @param {DecodedSourceMap | null} map - */ - constructor(string = '', map = null) { - this.string = string; - if (map) { - this.map = map; - } else { - this.map = { - version: 3, - mappings: [], - sources: [], - names: [] - }; - } - } - /** - * concat in-place (mutable), return this (chainable) - * will also mutate the `other` object - * @param {MappedCode} other - * @returns {MappedCode} - */ - concat(other) { - // noop: if one is empty, return the other - if (other.string == '') return this; - if (this.string == '') { - this.string = other.string; - this.map = other.map; - return this; - } - // compute last line length before mutating - const column_offset = last_line_length(this.string); - this.string += other.string; - const m1 = this.map; - const m2 = other.map; - if (m2.mappings.length == 0) return this; - // combine sources and names - const [sources, new_source_idx, sources_changed, sources_idx_changed] = merge_tables( - m1.sources, - m2.sources - ); - const [names, new_name_idx, names_changed, names_idx_changed] = merge_tables( - m1.names, - m2.names - ); - if (sources_changed) m1.sources = sources; - if (names_changed) m1.names = names; - // unswitched loops are faster - if (sources_idx_changed && names_idx_changed) { - for (let line = 0; line < m2.mappings.length; line++) { - const segment_list = m2.mappings[line]; - for (let segment = 0; segment < segment_list.length; segment++) { - const seg = segment_list[segment]; - // @ts-ignore - if (seg[1] >= 0) seg[1] = new_source_idx[seg[1]]; - // @ts-ignore - if (seg[4] >= 0) seg[4] = new_name_idx[seg[4]]; - } - } - } else if (sources_idx_changed) { - for (let line = 0; line < m2.mappings.length; line++) { - const segment_list = m2.mappings[line]; - for (let segment = 0; segment < segment_list.length; segment++) { - const seg = segment_list[segment]; - // @ts-ignore - if (seg[1] >= 0) seg[1] = new_source_idx[seg[1]]; - } - } - } else if (names_idx_changed) { - for (let line = 0; line < m2.mappings.length; line++) { - const segment_list = m2.mappings[line]; - for (let segment = 0; segment < segment_list.length; segment++) { - const seg = segment_list[segment]; - // @ts-ignore - if (seg[4] >= 0) seg[4] = new_name_idx[seg[4]]; - } - } - } - // combine the mappings - // combine - // 1. last line of first map - // 2. first line of second map - // columns of 2 must be shifted - if (m2.mappings.length > 0 && column_offset > 0) { - const first_line = m2.mappings[0]; - for (let i = 0; i < first_line.length; i++) { - first_line[i][0] += column_offset; - } - } - // combine last line + first line - push_array( - m1.mappings[m1.mappings.length - 1], - /** @type {SourceMapSegment[]} */ (m2.mappings.shift()) - ); - // append other lines - push_array(m1.mappings, m2.mappings); - return this; - } - - /** - * @static - * @param {string} string - * @param {DecodedSourceMap} [map] - * @returns {MappedCode} - */ - static from_processed(string, map) { - const line_count = string.split('\n').length; - if (map) { - // ensure that count of source map mappings lines - // is equal to count of generated code lines - // (some tools may produce less) - const missing_lines = line_count - map.mappings.length; - for (let i = 0; i < missing_lines; i++) { - map.mappings.push([]); - } - return new MappedCode(string, map); - } - if (string == '') return new MappedCode(); - map = { version: 3, names: [], sources: [], mappings: [] }; - // add empty SourceMapSegment[] for every line - for (let i = 0; i < line_count; i++) map.mappings.push([]); - return new MappedCode(string, map); - } - - /** - * @static - * @param {Source} opts - * @returns {MappedCode} - */ - static from_source({ source, file_basename, get_location }) { - /** - * @type {{ line: number; column: number; }} - */ - let offset = get_location(0); - if (!offset) offset = { line: 0, column: 0 }; - - /** - * @type {DecodedSourceMap} - */ - const map = { version: 3, names: [], sources: [file_basename], mappings: [] }; - if (source == '') return new MappedCode(source, map); - // we create a high resolution identity map here, - // we know that it will eventually be merged with svelte's map, - // at which stage the resolution will decrease. - const line_list = source.split('\n'); - for (let line = 0; line < line_list.length; line++) { - map.mappings.push([]); - const token_list = line_list[line].split(regex_line_token); - for (let token = 0, column = 0; token < token_list.length; token++) { - if (token_list[token] == '') continue; - map.mappings[line].push([column, 0, offset.line + line, column]); - column += token_list[token].length; - } - } - // shift columns in first line - const segment_list = map.mappings[0]; - for (let segment = 0; segment < segment_list.length; segment++) { - // @ts-ignore - segment_list[segment][3] += offset.column; - } - return new MappedCode(source, map); - } -} - -// browser vs node.js -const b64enc = - typeof window !== 'undefined' && typeof btoa === 'function' - ? /** @param {string} str */ (str) => btoa(unescape(encodeURIComponent(str))) - : /** @param {string} str */ (str) => Buffer.from(str).toString('base64'); -const b64dec = - typeof window !== 'undefined' && typeof atob === 'function' - ? atob - : /** @param {any} a */ (a) => Buffer.from(a, 'base64').toString(); - -/** - * @param {string} filename Basename of the input file - * @param {Array} sourcemap_list - */ -export function combine_sourcemaps(filename, sourcemap_list) { - if (sourcemap_list.length == 0) return null; - let map_idx = 1; - const map = - sourcemap_list.slice(0, -1).find((m) => m.sources.length !== 1) === undefined - ? remapping( - // use array interface - // only the oldest sourcemap can have multiple sources - sourcemap_list, - () => null, - true // skip optional field `sourcesContent` - ) - : remapping( - // use loader interface - sourcemap_list[0], // last map - (sourcefile) => { - // TODO the equality check assumes that the preprocessor map has the input file as a relative path in sources, - // e.g. when the input file is `src/foo/bar.svelte`, then sources is expected to contain just `bar.svelte`. - // Therefore filename also needs to be the basename of the path. This feels brittle, investigate how we can - // harden this (without breaking other tooling that assumes this behavior). - if (sourcefile === filename && sourcemap_list[map_idx]) { - return sourcemap_list[map_idx++]; // idx 1, 2, ... - // bundle file = branch node - } else { - return null; // source file = leaf node - } - }, - true - ); - if (!map.file) delete map.file; // skip optional field `file` - // When source maps are combined and the leading map is empty, sources is not set. - // Add the filename to the empty array in this case. - // Further improvements to remapping may help address this as well https://github.com/ampproject/remapping/issues/116 - if (!map.sources.length) map.sources = [filename]; - return map; -} - -/** - * @param {string} filename - * @param {SourceMap} svelte_map - * @param {string | DecodedSourceMap | RawSourceMap} preprocessor_map_input - * @returns {SourceMap} - */ -function apply_preprocessor_sourcemap(filename, svelte_map, preprocessor_map_input) { - if (!svelte_map || !preprocessor_map_input) return svelte_map; - const preprocessor_map = - typeof preprocessor_map_input === 'string' - ? JSON.parse(preprocessor_map_input) - : preprocessor_map_input; - const result_map = combine_sourcemaps(filename, [svelte_map, preprocessor_map]); - // Svelte expects a SourceMap which includes toUrl and toString. Instead of wrapping our output in a class, - // we just tack on the extra properties. - Object.defineProperties(result_map, { - toString: { - enumerable: false, - value: function toString() { - return JSON.stringify(this); - } - }, - toUrl: { - enumerable: false, - value: function toUrl() { - return 'data:application/json;charset=utf-8;base64,' + b64enc(this.toString()); - } - } - }); - return /** @type {any} */ (result_map); -} -const regex_data_uri = /data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(\S*)/; -// parse attached sourcemap in processed.code - -/** - * @param {Processed} processed - * @param {'script' | 'style'} tag_name - * @returns {void} - */ -export function parse_attached_sourcemap(processed, tag_name) { - const r_in = '[#@]\\s*sourceMappingURL\\s*=\\s*(\\S*)'; - const regex = - tag_name == 'script' - ? new RegExp('(?://' + r_in + ')|(?:/\\*' + r_in + '\\s*\\*/)$') - : new RegExp('/\\*' + r_in + '\\s*\\*/$'); - - /** - * @param {any} message - */ - function log_warning(message) { - // code_start: help to find preprocessor - const code_start = - processed.code.length < 100 ? processed.code : processed.code.slice(0, 100) + ' [...]'; - // eslint-disable-next-line no-console - console.warn(`warning: ${message}. processed.code = ${JSON.stringify(code_start)}`); - } - processed.code = processed.code.replace(regex, (_, match1, match2) => { - const map_url = tag_name == 'script' ? match1 || match2 : match1; - const map_data = (map_url.match(regex_data_uri) || [])[1]; - if (map_data) { - // sourceMappingURL is data URL - if (processed.map) { - log_warning( - 'Not implemented. ' + - 'Found sourcemap in both processed.code and processed.map. ' + - 'Please update your preprocessor to return only one sourcemap.' - ); - // ignore attached sourcemap - return ''; - } - processed.map = b64dec(map_data); // use attached sourcemap - return ''; // remove from processed.code - } - // sourceMappingURL is path or URL - if (!processed.map) { - log_warning( - `Found sourcemap path ${JSON.stringify( - map_url - )} in processed.code, but no sourcemap data. ` + - 'Please update your preprocessor to return sourcemap data directly.' - ); - } - // ignore sourcemap path - return ''; // remove from processed.code - }); -} - -/** - * @param {{ code: string, map: SourceMap}} result - * @param {ValidatedCompileOptions} options - * @param {string} source_name - */ -export function merge_with_preprocessor_map(result, options, source_name) { - if (options.sourcemap) { - const file_basename = get_basename(options.filename); - // The preprocessor map is expected to contain `sources: [basename_of_filename]`, but our own - // map may contain a different file name. Patch our map beforehand to align sources so merging - // with the preprocessor map works correctly. - result.map.sources = [file_basename]; - Object.assign( - result.map, - apply_preprocessor_sourcemap( - file_basename, - result.map, - /** @type {any} */ (options.sourcemap) - ) - ); - // After applying the preprocessor map, we need to do the inverse and make the sources - // relative to the input file again in case the output code is in a different directory. - if (file_basename !== source_name) { - result.map.sources = result.map.sources.map( - /** @param {string} source */ (source) => get_relative_path(source_name, source) - ); - } - } -} - -/** - * @param {string} from - * @param {string} to - */ -function get_relative_path(from, to) { - // Don't use node's utils here to ensure the compiler is usable in a browser environment - const from_parts = from.split(/[/\\]/); - const to_parts = to.split(/[/\\]/); - from_parts.pop(); // get dirname - while (from_parts[0] === to_parts[0]) { - from_parts.shift(); - to_parts.shift(); - } - if (from_parts.length) { - let i = from_parts.length; - while (i--) from_parts[i] = '..'; - } - return from_parts.concat(to_parts).join('/'); -} - -/** - * Like node's `basename`, but doesn't use it to ensure the compiler is usable in a browser environment - * @param {string} filename - */ -export function get_basename(filename) { - return /** @type {string} */ (filename.split(/[/\\]/).pop()); -} - -/** - * @param {string} filename - * @param {string | undefined} output_filename - * @param {string} fallback - */ -export function get_source_name(filename, output_filename, fallback) { - return output_filename ? get_relative_path(output_filename, filename) : get_basename(filename); -} diff --git a/web/node_modules/svelte/src/compiler/utils/push_array.js b/web/node_modules/svelte/src/compiler/utils/push_array.js deleted file mode 100644 index ee6a9f7..0000000 --- a/web/node_modules/svelte/src/compiler/utils/push_array.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Pushes all `items` into `array` using `push`, therefore mutating the array. - * We do this for memory and perf reasons, and because `array.push(...items)` would - * run into a "max call stack size exceeded" error with too many items (~65k). - * @template T - * @param {T[]} array - * @param {T[]} items - */ -export function push_array(array, items) { - for (let i = 0; i < items.length; i++) { - array.push(items[i]); - } -} diff --git a/web/node_modules/svelte/src/compiler/utils/sanitize_template_string.js b/web/node_modules/svelte/src/compiler/utils/sanitize_template_string.js deleted file mode 100644 index 80357d9..0000000 --- a/web/node_modules/svelte/src/compiler/utils/sanitize_template_string.js +++ /dev/null @@ -1,7 +0,0 @@ -/** - * @param {string} str - * @returns {string} - */ -export function sanitize_template_string(str) { - return str.replace(/(`|\${|\\)/g, '\\$1'); -} diff --git a/web/node_modules/svelte/src/compiler/utils/slot.js b/web/node_modules/svelte/src/compiler/utils/slot.js deleted file mode 100644 index 078bf58..0000000 --- a/web/node_modules/svelte/src/compiler/utils/slot.js +++ /dev/null @@ -1,20 +0,0 @@ -/** @import { AST } from '#compiler' */ -import { is_element_node } from '../phases/nodes.js'; -import { is_text_attribute } from './ast.js'; - -/** - * @param {AST.SvelteNode} node - */ -export function determine_slot(node) { - if (!is_element_node(node)) return null; - - for (const attribute of node.attributes) { - if (attribute.type !== 'Attribute') continue; - if (attribute.name !== 'slot') continue; - if (!is_text_attribute(attribute)) continue; - - return /** @type {string} */ (attribute.value[0].data); - } - - return null; -} diff --git a/web/node_modules/svelte/src/compiler/utils/string.js b/web/node_modules/svelte/src/compiler/utils/string.js deleted file mode 100644 index 42eefa9..0000000 --- a/web/node_modules/svelte/src/compiler/utils/string.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @param {string[]} strings - * @param {string} conjunction - */ -export function list(strings, conjunction = 'or') { - if (strings.length === 1) return strings[0]; - if (strings.length === 2) return `${strings[0]} ${conjunction} ${strings[1]}`; - return `${strings.slice(0, -1).join(', ')} ${conjunction} ${strings[strings.length - 1]}`; -} diff --git a/web/node_modules/svelte/src/compiler/validate-options.js b/web/node_modules/svelte/src/compiler/validate-options.js deleted file mode 100644 index f7c56aa..0000000 --- a/web/node_modules/svelte/src/compiler/validate-options.js +++ /dev/null @@ -1,361 +0,0 @@ -/** @import { ModuleCompileOptions, ValidatedModuleCompileOptions, CompileOptions, ValidatedCompileOptions } from '#compiler' */ -import * as e from './errors.js'; -import * as w from './warnings.js'; - -/** - * @template [Input=any] - * @template [Output=Input] - * @typedef {(input: Input, keypath: string) => Required} Validator - */ - -const common_options = { - filename: string('(unknown)'), - - // default to process.cwd() where it exists to replicate svelte4 behavior (and make Deno work with this as well) - // see https://github.com/sveltejs/svelte/blob/b62fc8c8fd2640c9b99168f01b9d958cb2f7574f/packages/svelte/src/compiler/compile/Component.js#L211 - /* eslint-disable */ - rootDir: string( - typeof process !== 'undefined' - ? process.cwd?.() - : // @ts-expect-error - typeof Deno !== 'undefined' - ? // @ts-expect-error - Deno.cwd() - : undefined - ), - /* eslint-enable */ - - dev: boolean(false), - - generate: validator('client', (input, keypath) => { - if (input === 'dom' || input === 'ssr') { - warn_once(w.options_renamed_ssr_dom); - return input === 'dom' ? 'client' : 'server'; - } - - // TODO deprecate `false` in favour of `analyze`/`analyzeModule` https://github.com/sveltejs/svelte-octane/issues/655 - if (input !== 'client' && input !== 'server' && input !== false) { - throw_error(`${keypath} must be "client", "server" or false`); - } - - return input; - }), - - warningFilter: fun(() => true), - - experimental: object({ - async: boolean(false) - }) -}; - -const component_options = { - accessors: deprecate(w.options_deprecated_accessors, boolean(false)), - - /** @type {Validator<'injected' | 'external' | ((options: { filename: string }) => 'injected' | 'external'), (options: { filename: string }) => 'injected' | 'external'>} */ - css: parametric( - /** @type {(options: { filename: string }) => 'injected' | 'external'} */ (() => 'external'), - (input) => { - if (input === true || input === false) { - throw_error( - 'The boolean options have been removed from the css option. Use "external" instead of false and "injected" instead of true' - ); - } - if (input === 'none') { - throw_error( - 'css: "none" is no longer a valid option. If this was crucial for you, please open an issue on GitHub with your use case.' - ); - } - - if (input !== 'external' && input !== 'injected') { - throw_error(`css should be either "external" (default, recommended) or "injected"`); - } - - return /** @type {'external' | 'injected'} */ (input); - } - ), - - cssHash: fun(({ css, filename, hash }) => { - return `svelte-${hash(filename === '(unknown)' ? css : filename ?? css)}`; - }), - - // TODO this is a sourcemap option, would be good to put under a sourcemap namespace - cssOutputFilename: string(undefined), - - /** @type {Validator boolean), (options: { filename: string }) => boolean>} */ - customElement: parametric( - /** @type {(options: { filename: string }) => boolean} */ (() => false), - (input, keypath) => { - if (typeof input !== 'boolean') { - throw_error(`${keypath} should be true or false`); - } - - return /** @type {boolean} */ (input); - } - ), - - discloseVersion: boolean(true), - - immutable: deprecate(w.options_deprecated_immutable, boolean(false)), - - legacy: removed( - 'The legacy option has been removed. If you are using this because of legacy.componentApi, use compatibility.componentApi instead' - ), - - compatibility: object({ - componentApi: list([4, 5], 5) - }), - - loopGuardTimeout: warn_removed(w.options_removed_loop_guard_timeout), - - name: string(undefined), - - namespace: list(['html', 'mathml', 'svg']), - - modernAst: boolean(false), - - outputFilename: string(undefined), - - preserveComments: boolean(false), - - fragments: list(['html', 'tree']), - - preserveWhitespace: boolean(false), - - /** @type {Validator boolean | undefined), () => boolean | undefined>} */ - runes: parametric(() => /** @type {boolean | undefined} */ (undefined)), - - hmr: boolean(false), - - sourcemap: validator(undefined, (input) => { - // Source maps can take on a variety of values, including string, JSON, map objects from magic-string and source-map, - // so there's no good way to check type validity here - return input; - }), - - enableSourcemap: warn_removed(w.options_removed_enable_sourcemap), - - hydratable: warn_removed(w.options_removed_hydratable), - - format: removed( - 'The format option has been removed in Svelte 4, the compiler only outputs ESM now. Remove "format" from your compiler options. ' + - 'If you did not set this yourself, bump the version of your bundler plugin (vite-plugin-svelte/rollup-plugin-svelte/svelte-loader)' - ), - - tag: removed( - 'The tag option has been removed in Svelte 5. Use `` inside the component instead. ' + - 'If that does not solve your use case, please open an issue on GitHub with details.' - ), - - sveltePath: removed( - 'The sveltePath option has been removed in Svelte 5. ' + - 'If this option was crucial for you, please open an issue on GitHub with your use case.' - ), - - // These two were primarily created for svelte-preprocess (https://github.com/sveltejs/svelte/pull/6194), - // but with new TypeScript compilation modes strictly separating types it's not necessary anymore - errorMode: removed( - 'The errorMode option has been removed. If you are using this through svelte-preprocess with TypeScript, ' + - 'use the https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax setting instead' - ), - - varsReport: removed( - 'The vars option has been removed. If you are using this through svelte-preprocess with TypeScript, ' + - 'use the https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax setting instead' - ) -}; - -export const validate_module_options = - /** @type {Validator} */ ( - object({ - ...common_options, - ...Object.fromEntries(Object.keys(component_options).map((key) => [key, () => {}])) - }) - ); - -export const validate_component_options = - /** @type {Validator} */ ( - object({ - ...common_options, - ...component_options - }) - ); - -/** - * @param {string} msg - * @returns {Validator} - */ -function removed(msg) { - return (input) => { - if (input !== undefined) { - e.options_removed(null, msg); - } - return /** @type {any} */ (undefined); - }; -} - -const warned = new Set(); - -/** @param {(node: null) => void} fn */ -function warn_once(fn) { - if (!warned.has(fn)) { - warned.add(fn); - fn(null); - } -} - -/** - * @param {(node: null) => void} fn - * @returns {Validator} - */ -function warn_removed(fn) { - return (input) => { - if (input !== undefined) warn_once(fn); - return /** @type {any} */ (undefined); - }; -} - -/** - * @param {(node: null) => void} fn - * @param {Validator} validator - * @returns {Validator} - */ -function deprecate(fn, validator) { - return (input, keypath) => { - if (input !== undefined) warn_once(fn); - return validator(input, keypath); - }; -} - -/** - * @param {Record} children - * @param {boolean} [allow_unknown] - * @returns {Validator} - */ -function object(children, allow_unknown = false) { - return (input, keypath) => { - /** @type {Record} */ - const output = {}; - - if ((input && typeof input !== 'object') || Array.isArray(input)) { - throw_error(`${keypath} should be an object`); - } - - for (const key in input) { - if (!(key in children)) { - if (allow_unknown) { - output[key] = input[key]; - } else { - e.options_unrecognised(null, `${keypath ? `${keypath}.${key}` : key}`); - } - } - } - - for (const key in children) { - const validator = children[key]; - output[key] = validator(input && input[key], keypath ? `${keypath}.${key}` : key); - } - - return output; - }; -} - -/** - * @param {any} fallback - * @param {(value: any, keypath: string) => any} fn - * @returns {Validator} - */ -function validator(fallback, fn) { - return (input, keypath) => { - return input === undefined ? fallback : fn(input, keypath); - }; -} - -/** - * @param {string | undefined} fallback - * @param {boolean} allow_empty - * @returns {Validator} - */ -function string(fallback, allow_empty = true) { - return validator(fallback, (input, keypath) => { - if (typeof input !== 'string') { - throw_error(`${keypath} should be a string, if specified`); - } - - if (!allow_empty && input === '') { - throw_error(`${keypath} cannot be empty`); - } - - return input; - }); -} - -/** - * @param {boolean | undefined} fallback - * @returns {Validator} - */ -function boolean(fallback) { - return validator(fallback, (input, keypath) => { - if (typeof input !== 'boolean') { - throw_error(`${keypath} should be true or false, if specified`); - } - return input; - }); -} - -/** - * @param {Array} options - * @returns {Validator} - */ -function list(options, fallback = options[0]) { - return validator(fallback, (input, keypath) => { - if (!options.includes(input)) { - // prettier-ignore - const msg = options.length > 2 - ? `${keypath} should be one of ${options.slice(0, -1).map(input => `"${input}"`).join(', ')} or "${options[options.length - 1]}"` - : `${keypath} should be either "${options[0]}" or "${options[1]}"`; - - throw_error(msg); - } - return input; - }); -} - -/** - * @param {(...args: any) => any} fallback - * @returns {Validator} - */ -function fun(fallback) { - return validator(fallback, (input, keypath) => { - if (typeof input !== 'function') { - throw_error(`${keypath} should be a function, if specified`); - } - return input; - }); -} - -/** - * @template {(...args: any[]) => any} F - * @param {F} fallback - * @param {(value: unknown, keypath: string) => ReturnType} [normalize] - * @returns {Validator} - */ -function parametric(fallback, normalize = (value) => /** @type {ReturnType} */ (value)) { - return validator(fallback, (input, keypath) => { - if (typeof input === 'function') { - /** @type {(...args: Parameters) => ReturnType} */ - const normalized = (...args) => normalize(input(...args), keypath); - - return /** @type {F} */ (/** @type {unknown} */ (normalized)); - } - - /** @type {(...args: Parameters) => ReturnType} */ - const normalized = (..._args) => normalize(input, keypath); - - return /** @type {F} */ (/** @type {unknown} */ (normalized)); - }); -} - -/** @param {string} msg */ -function throw_error(msg) { - e.options_invalid_value(null, msg); -} diff --git a/web/node_modules/svelte/src/compiler/warnings.js b/web/node_modules/svelte/src/compiler/warnings.js deleted file mode 100644 index 089cb1e..0000000 --- a/web/node_modules/svelte/src/compiler/warnings.js +++ /dev/null @@ -1,845 +0,0 @@ -/* This file is generated by scripts/process-messages/index.js. Do not edit! */ - -import { warnings, ignore_stack, ignore_map, warning_filter } from './state.js'; -import { CompileDiagnostic } from './utils/compile_diagnostic.js'; - -/** @typedef {{ start?: number, end?: number }} NodeLike */ -class InternalCompileWarning extends CompileDiagnostic { - name = 'CompileWarning'; - - /** - * @param {string} code - * @param {string} message - * @param {[number, number] | undefined} position - */ - constructor(code, message, position) { - super(code, message, position); - } -} - -/** - * @param {null | NodeLike} node - * @param {string} code - * @param {string} message - */ -function w(node, code, message) { - let stack = ignore_stack; - - if (node) { - stack = ignore_map.get(node) ?? ignore_stack; - } - - if (stack && stack.at(-1)?.has(code)) return; - - const warning = new InternalCompileWarning(code, message, node && node.start !== undefined ? [node.start, node.end ?? node.start] : undefined); - - if (!warning_filter(warning)) return; - - warnings.push(warning); -} - -export const codes = [ - 'a11y_accesskey', - 'a11y_aria_activedescendant_has_tabindex', - 'a11y_aria_attributes', - 'a11y_autocomplete_valid', - 'a11y_autofocus', - 'a11y_click_events_have_key_events', - 'a11y_consider_explicit_label', - 'a11y_distracting_elements', - 'a11y_figcaption_index', - 'a11y_figcaption_parent', - 'a11y_hidden', - 'a11y_img_redundant_alt', - 'a11y_incorrect_aria_attribute_type', - 'a11y_incorrect_aria_attribute_type_boolean', - 'a11y_incorrect_aria_attribute_type_id', - 'a11y_incorrect_aria_attribute_type_idlist', - 'a11y_incorrect_aria_attribute_type_integer', - 'a11y_incorrect_aria_attribute_type_token', - 'a11y_incorrect_aria_attribute_type_tokenlist', - 'a11y_incorrect_aria_attribute_type_tristate', - 'a11y_interactive_supports_focus', - 'a11y_invalid_attribute', - 'a11y_label_has_associated_control', - 'a11y_media_has_caption', - 'a11y_misplaced_role', - 'a11y_misplaced_scope', - 'a11y_missing_attribute', - 'a11y_missing_content', - 'a11y_mouse_events_have_key_events', - 'a11y_no_abstract_role', - 'a11y_no_interactive_element_to_noninteractive_role', - 'a11y_no_noninteractive_element_interactions', - 'a11y_no_noninteractive_element_to_interactive_role', - 'a11y_no_noninteractive_tabindex', - 'a11y_no_redundant_roles', - 'a11y_no_static_element_interactions', - 'a11y_positive_tabindex', - 'a11y_role_has_required_aria_props', - 'a11y_role_supports_aria_props', - 'a11y_role_supports_aria_props_implicit', - 'a11y_unknown_aria_attribute', - 'a11y_unknown_role', - 'bidirectional_control_characters', - 'legacy_code', - 'unknown_code', - 'options_deprecated_accessors', - 'options_deprecated_immutable', - 'options_missing_custom_element', - 'options_removed_enable_sourcemap', - 'options_removed_hydratable', - 'options_removed_loop_guard_timeout', - 'options_renamed_ssr_dom', - 'custom_element_props_identifier', - 'export_let_unused', - 'legacy_component_creation', - 'non_reactive_update', - 'perf_avoid_inline_class', - 'perf_avoid_nested_class', - 'reactive_declaration_invalid_placement', - 'reactive_declaration_module_script_dependency', - 'state_referenced_locally', - 'store_rune_conflict', - 'css_unused_selector', - 'attribute_avoid_is', - 'attribute_global_event_reference', - 'attribute_illegal_colon', - 'attribute_invalid_property_name', - 'attribute_quoted', - 'bind_invalid_each_rest', - 'block_empty', - 'component_name_lowercase', - 'element_implicitly_closed', - 'element_invalid_self_closing_tag', - 'event_directive_deprecated', - 'node_invalid_placement_ssr', - 'script_context_deprecated', - 'script_unknown_attribute', - 'slot_element_deprecated', - 'svelte_component_deprecated', - 'svelte_element_invalid_this', - 'svelte_self_deprecated' -]; - -/** - * Avoid using accesskey - * @param {null | NodeLike} node - */ -export function a11y_accesskey(node) { - w(node, 'a11y_accesskey', `Avoid using accesskey\nhttps://svelte.dev/e/a11y_accesskey`); -} - -/** - * An element with an aria-activedescendant attribute should have a tabindex value - * @param {null | NodeLike} node - */ -export function a11y_aria_activedescendant_has_tabindex(node) { - w(node, 'a11y_aria_activedescendant_has_tabindex', `An element with an aria-activedescendant attribute should have a tabindex value\nhttps://svelte.dev/e/a11y_aria_activedescendant_has_tabindex`); -} - -/** - * `<%name%>` should not have aria-* attributes - * @param {null | NodeLike} node - * @param {string} name - */ -export function a11y_aria_attributes(node, name) { - w(node, 'a11y_aria_attributes', `\`<${name}>\` should not have aria-* attributes\nhttps://svelte.dev/e/a11y_aria_attributes`); -} - -/** - * '%value%' is an invalid value for 'autocomplete' on `` - * @param {null | NodeLike} node - * @param {string} value - * @param {string} type - */ -export function a11y_autocomplete_valid(node, value, type) { - w(node, 'a11y_autocomplete_valid', `'${value}' is an invalid value for 'autocomplete' on \`\`\nhttps://svelte.dev/e/a11y_autocomplete_valid`); -} - -/** - * Avoid using autofocus - * @param {null | NodeLike} node - */ -export function a11y_autofocus(node) { - w(node, 'a11y_autofocus', `Avoid using autofocus\nhttps://svelte.dev/e/a11y_autofocus`); -} - -/** - * Visible, non-interactive elements with a click event must be accompanied by a keyboard event handler. Consider whether an interactive element such as `