Skip to content

Commit

Permalink
[pull] master from sveltejs:master (#8)
Browse files Browse the repository at this point in the history
* feat: Add a speedier script tag for prerendered redirects (sveltejs#9911)

* feat: Add a script redirect to prerendered pages

* changeset

* Update .changeset/hungry-rocks-hunt.md

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>

* fix test

* feat: Update string escaping

* Update .changeset/hungry-rocks-hunt.md

Co-authored-by: Conduitry <git@chor.date>

---------

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Conduitry <git@chor.date>

* fix: avoid inlining raw/url CSS imports (sveltejs#9925)

* fix: use transformRequest for CSS modules

* just avoid raw or url

* test and changeset

* use parsed query

* remove only

* Update packages/kit/test/apps/basics/test/cross-platform/test.js

* drive by test speed up

* feat: prerender & analyse in worker rather than subprocess to support Deno (sveltejs#9919)

* feat(fork): use workers

* Create hot-actors-hope.md

* Update packages/kit/src/utils/fork.js

Co-authored-by: Rich Harris <hello@rich-harris.dev>

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>

* avoid using isMainThread, since it interacts poorly with vitest (sveltejs#9941)

Co-authored-by: Rich Harris <git@rich-harris.dev>

* chore: bump vite and devalue (sveltejs#9933)

* bump vite and devalue

* update templates

* merge master

* fix test

---------

Co-authored-by: Rich Harris <git@rich-harris.dev>

* chore: uvu -> vitest for create-svelte tests (sveltejs#9910)

* chore: uvu -> vitest for create-svelte tests

* format

* concurrency (sveltejs#9921)

* realised we werent typechecking this file, found some errors. fixed

* Wait for beforeAll hook to complete

* simplify

* exclude create-svelte/template files from prettier, so that we can emit correctly formatted templates

* remove unused file

* Revert "exclude create-svelte/template files from prettier, so that we can emit correctly formatted templates"

This reverts commit aa188d4.

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>

* feat: unshadow `form` and `data` in `enhance` (sveltejs#9902)

* feat: Un-shadow `data` and `form` in `enhance`, warn about future deprecation in dev

* changeset

* snek

* Update .changeset/odd-crews-own.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* Update packages/kit/test/apps/dev-only/package.json

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* am not smart

* still not smart

* oops

* oof

* add deprecation notice

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>

* fix: Set loader: { '.wasm': 'copy' } in esbuild config in `adapter-cloudflare-workers` (sveltejs#9940)

* fix: Set loader: { '.wasm': 'copy' } in esbuild config in `adapter-cloudflare-workers`

Copies WASM files in Cloudflare instead of trying to load them.

Related to sveltejs#9909

* Create brave-peaches-buy.md

* Update packages/adapter-cloudflare-workers/index.js

* format

---------

Co-authored-by: Rich Harris <git@rich-harris.dev>
Co-authored-by: Rich Harris <hello@rich-harris.dev>

* fix: Flaky test (sveltejs#9947)

* fix: Flaky test

* reuse locator

* add semi

* drive by test speed up

* another classic

* oh my god brain, y u so bad

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
Co-authored-by: gtmnayan <gtmnayan@gmail.com>

* remove envVarsInUse (sveltejs#9942)

Co-authored-by: Rich Harris <git@rich-harris.dev>

* fix: type `vitePlugin` in config (sveltejs#9946)

* fix: type `vitePlugin` in config

* changeset

* fix: Set `loader: { '.wasm': 'copy' }` in esbuild config in `adapter-vercel` (sveltejs#9944)

* fix: Enable wasm copy in adapter-vercel

* Create olive-rings-eat.md

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* feat: crawl URLs in `<meta>` tags (sveltejs#9900)

* Crawl social-image urls during prerender

* Formatting & Linting

* Format changeset & added exhaustive list of crawlable urls

* Changed severity to minor as described in sveltejs#5228

* Added support for `property` attribute & limited valid names to just social tags

* More tests

* Better changeset message - I'm indecisive

* Update .changeset/thirty-garlics-tan.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* simplify

* simplify

* Removed redundant data-sanitation

* DRY out

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>

* Version Packages (sveltejs#9893)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* feat: support AWS via SST in adapter-auto (sveltejs#9874)

* [feat] support AWS via SST in adapter-auto

* Sync

* Delete 95-adapter-aws-sst.md

* Update .changeset/rotten-ducks-tan.md

---------

Co-authored-by: Rich Harris <hello@rich-harris.dev>

* Version Packages (sveltejs#9953)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* only cache response if response has cache-control header (sveltejs#9885)

* only cache response if response has cache-control header

* add changeset

* Version Packages (sveltejs#9955)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* fix: ensure styles are loaded in dev mode for routes containing special characters (sveltejs#9894)

* Fix loading styles for routes containing special characters in dev mode.

SvelteKit doesn't decode special characters in pathnames when loading CSS modules in dev mode, resulting in an error:

Internal server error: Failed to load url /src/routes/(special)/hinnap%C3%A4ring/+page.svelte?svelte=&type=style&lang.css=&inline= (resolved id: /src/routes/(special)/hinnap%C3%A4ring/+page.svelte?svelte&type=style&lang.css). Does the file exist?

Actual path:

/src/routes/(special)/hinnapäring/

Fix by using decodeURI on the url.pathname when loading CSS modules.

* Create stale-houses-yell.md

* decodeURL inside if

* add test

---------

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>

* feat: Warn users when submitting forms with files but no `enctype="multipart/form-data"` (sveltejs#9888)

* fix: Package name keeps me from filtering with pnpm

* feat: Warn users when submitting a form containing a file without the correct enctype

* changeset

* Update packages/kit/src/runtime/app/forms.js

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>

* style

* moar style tweaks

* better test skip

* Update .changeset/tasty-llamas-relate.md

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>

* DRY out

* only warn once per submit

* Update .changeset/tasty-llamas-relate.md

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

---------

Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>

* Version Packages (sveltejs#9957)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* security: Stop automatically adding URLs from server-side `load` `fetch` calls to dependencies (sveltejs#9945)

* feat: Add `dangerZone` config

* breaking: Don't implicitly track deps in server-side fetch

* changeset

* bein dumb

* fix: Server load invalidation

* fix: Write config for server

* fix: test

* unsurprisingly i am dumb

* docs: Clarify difference between server `fetch` and universal `fetch`

* tests

* rename to trackServerFetches

---------

Co-authored-by: Rich Harris <git@rich-harris.dev>

* Version Packages (sveltejs#9963)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: S. Elliott Johnson <sejohnson@torchcloudconsulting.com>
Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
Co-authored-by: Conduitry <git@chor.date>
Co-authored-by: gtmnayan <50981692+gtm-nayan@users.noreply.github.com>
Co-authored-by: Fernando López Guevara <fernando.lguevara@gmail.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Co-authored-by: Rich Harris <git@rich-harris.dev>
Co-authored-by: Conner <conner@semicognitive.com>
Co-authored-by: gtmnayan <gtmnayan@gmail.com>
Co-authored-by: Loris Sigrist <43482866+LorisSigrist@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Frank <frank@sst.dev>
Co-authored-by: Frank Dumont <fj.dumont@gmail.com>
Co-authored-by: Reio Remma <reio@mrstuudio.ee>
  • Loading branch information
18 people authored May 17, 2023
1 parent b061166 commit 140dd7d
Show file tree
Hide file tree
Showing 97 changed files with 874 additions and 366 deletions.
5 changes: 0 additions & 5 deletions .changeset/honest-news-hunt.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/olive-dogs-bathe.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shy-pears-invent.md

This file was deleted.

4 changes: 2 additions & 2 deletions documentation/docs/20-core-concepts/20-load.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ Dependency tracking does not apply _after_ the `load` function has returned —

### Manual invalidation

You can also re-run `load` functions that apply to the current page using [`invalidate(url)`](modules#$app-navigation-invalidate), which re-runs all `load` functions that depend on `url`, and [`invalidateAll()`](modules#$app-navigation-invalidateall), which re-runs every `load` function.
You can also re-run `load` functions that apply to the current page using [`invalidate(url)`](modules#$app-navigation-invalidate), which re-runs all `load` functions that depend on `url`, and [`invalidateAll()`](modules#$app-navigation-invalidateall), which re-runs every `load` function. Server load functions will never automatically depend on a fetched `url` to avoid leaking secrets to the client.

A `load` function depends on `url` if it calls `fetch(url)` or `depends(url)`. Note that `url` can be a custom identifier that starts with `[a-z]:`:

Expand Down Expand Up @@ -585,7 +585,7 @@ To summarize, a `load` function will re-run in the following situations:
- It references a property of `params` whose value has changed
- It references a property of `url` (such as `url.pathname` or `url.search`) whose value has changed. Properties in `request.url` are _not_ tracked
- It calls `await parent()` and a parent `load` function re-ran
- It declared a dependency on a specific URL via [`fetch`](#making-fetch-requests) or [`depends`](types#public-types-loadevent), and that URL was marked invalid with [`invalidate(url)`](modules#$app-navigation-invalidate)
- It declared a dependency on a specific URL via [`fetch`](#making-fetch-requests) (universal load only) or [`depends`](types#public-types-loadevent), and that URL was marked invalid with [`invalidate(url)`](modules#$app-navigation-invalidate)
- All active `load` functions were forcibly re-run with [`invalidateAll()`](modules#$app-navigation-invalidateall)

`params` and `url` can change in response to a `<a href="..">` link click, a [`<form>` interaction](form-actions#get-vs-post), a [`goto`](modules#$app-navigation-goto) invocation, or a [`redirect`](modules#sveltejs-kit-redirect).
Expand Down
1 change: 1 addition & 0 deletions documentation/docs/25-build-and-deploy/30-adapter-auto.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ When you create a new SvelteKit project with `npm create svelte@latest`, it inst
- [`@sveltejs/adapter-netlify`](adapter-netlify) for [Netlify](https://netlify.com/)
- [`@sveltejs/adapter-vercel`](adapter-vercel) for [Vercel](https://vercel.com/)
- [`svelte-adapter-azure-swa`](https://github.com/geoffrich/svelte-adapter-azure-swa) for [Azure Static Web Apps](https://docs.microsoft.com/en-us/azure/static-web-apps/)
- [`svelte-kit-sst`](https://github.com/serverless-stack/sst/tree/master/packages/svelte-kit-sst) for [AWS via SST](https://docs.sst.dev/start/svelte)

It's recommended to install the appropriate adapter to your `devDependencies` once you've settled on a target environment, since this will add the adapter to your lockfile and slightly improve install times on CI.

Expand Down
5 changes: 2 additions & 3 deletions documentation/docs/25-build-and-deploy/90-adapter-vercel.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ The following options apply to all functions:
- `regions`: an array of [edge network regions](https://vercel.com/docs/concepts/edge-network/regions) (defaulting to `["iad1"]` for serverless functions) or `'all'` if `runtime` is `edge` (its default). Note that multiple regions for serverless functions are only supported on Enterprise plans
- `split`: if `true`, causes a route to be deployed as an individual function. If `split` is set to `true` at the adapter level, all routes will be deployed as individual functions

Additionally, the following options apply to edge functions:
- `envVarsInUse`: an array of environment variables that should be accessible inside the edge function
Additionally, the following option applies to edge functions:
- `external`: an array of dependencies that esbuild should treat as external when bundling functions. This should only be used to exclude optional dependencies that will not run outside Node

And the following option apply to serverless functions:
Expand Down Expand Up @@ -130,7 +129,7 @@ export function load() {
<p>This staging environment was deployed from {data.deploymentGitBranch}.</p>
```

Since all of these variables are unchanged between build time and run time when building on Vercel, we recommend using `$env/static/private` — which will statically replace the variables, enabling optimisations like dead code elimination — rather than `$env/dynamic/private`. If you're deploying with `edge: true` you must either use `$env/static/private` or populate the `envVarsInUse` configuration.
Since all of these variables are unchanged between build time and run time when building on Vercel, we recommend using `$env/static/private` — which will statically replace the variables, enabling optimisations like dead code elimination — rather than `$env/dynamic/private`.

## Notes

Expand Down
6 changes: 6 additions & 0 deletions packages/adapter-auto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @sveltejs/adapter-auto

## 2.1.0

### Minor Changes

- [feat] support AWS via SST ([#9874](https://github.com/sveltejs/kit/pull/9874))

## 2.0.1

### Patch Changes
Expand Down
6 changes: 6 additions & 0 deletions packages/adapter-auto/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@ export const adapters = [
test: () => process.env.GITHUB_ACTION_REPOSITORY === 'Azure/static-web-apps-deploy',
module: 'svelte-adapter-azure-swa',
version: '0.13'
},
{
name: 'AWS via SST',
test: () => !!process.env.SST,
module: 'svelte-kit-sst',
version: '2'
}
];
2 changes: 1 addition & 1 deletion packages/adapter-auto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-auto",
"version": "2.0.1",
"version": "2.1.0",
"description": "Automatically chooses the SvelteKit adapter for your current environment, if possible.",
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions packages/adapter-cloudflare-workers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @sveltejs/adapter-cloudflare-workers

## 1.1.2

### Patch Changes

- fix: Copy .wasm files during build ([#9940](https://github.com/sveltejs/kit/pull/9940))

- Updated dependencies [[`50acb22ca`](https://github.com/sveltejs/kit/commit/50acb22caf2901283e044cdfda36db6f07b3e0ae), [`2e6da9496`](https://github.com/sveltejs/kit/commit/2e6da9496bdace2c65040b9d1845c44801ca868c), [`a81106b3a`](https://github.com/sveltejs/kit/commit/a81106b3a817829c41e048207d6253e63988c58c), [`a6338a0b1`](https://github.com/sveltejs/kit/commit/a6338a0b124f54bda7ba3fe64be1d6173e118d00), [`4a85b7f08`](https://github.com/sveltejs/kit/commit/4a85b7f0820d35c7830c00afe1df3c94fcbf8c3d), [`26d2b7f8f`](https://github.com/sveltejs/kit/commit/26d2b7f8f5ca29c60ef61b936ff86deaeb1636ce), [`bc70b4e63`](https://github.com/sveltejs/kit/commit/bc70b4e636fcbd9593356996bf737e014ff8c238), [`ab9f57721`](https://github.com/sveltejs/kit/commit/ab9f57721fca146af7c4eb41f4875fafa5dfc0d2)]:
- @sveltejs/kit@1.17.0

## 1.1.1

### Patch Changes
Expand Down
5 changes: 4 additions & 1 deletion packages/adapter-cloudflare-workers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ export default function ({ config = 'wrangler.toml' } = {}) {
outfile: main,
bundle: true,
external: ['__STATIC_CONTENT_MANIFEST'],
format: 'esm'
format: 'esm',
loader: {
'.wasm': 'copy'
}
});

builder.log.minor('Copying assets...');
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare-workers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-cloudflare-workers",
"version": "1.1.1",
"version": "1.1.2",
"description": "SvelteKit adapter that creates a Cloudflare Workers site using a function for dynamic server rendering",
"repository": {
"type": "git",
Expand Down
15 changes: 15 additions & 0 deletions packages/adapter-cloudflare/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @sveltejs/adapter-cloudflare

## 2.2.4

### Patch Changes

- fix: require explicit cache-control header for caching ([#9885](https://github.com/sveltejs/kit/pull/9885))

## 2.2.3

### Patch Changes

- fix: Copy .wasm files during build ([#9909](https://github.com/sveltejs/kit/pull/9909))

- Updated dependencies [[`50acb22ca`](https://github.com/sveltejs/kit/commit/50acb22caf2901283e044cdfda36db6f07b3e0ae), [`2e6da9496`](https://github.com/sveltejs/kit/commit/2e6da9496bdace2c65040b9d1845c44801ca868c), [`a81106b3a`](https://github.com/sveltejs/kit/commit/a81106b3a817829c41e048207d6253e63988c58c), [`a6338a0b1`](https://github.com/sveltejs/kit/commit/a6338a0b124f54bda7ba3fe64be1d6173e118d00), [`4a85b7f08`](https://github.com/sveltejs/kit/commit/4a85b7f0820d35c7830c00afe1df3c94fcbf8c3d), [`26d2b7f8f`](https://github.com/sveltejs/kit/commit/26d2b7f8f5ca29c60ef61b936ff86deaeb1636ce), [`bc70b4e63`](https://github.com/sveltejs/kit/commit/bc70b4e636fcbd9593356996bf737e014ff8c238), [`ab9f57721`](https://github.com/sveltejs/kit/commit/ab9f57721fca146af7c4eb41f4875fafa5dfc0d2)]:
- @sveltejs/kit@1.17.0

## 2.2.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-cloudflare/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-cloudflare",
"version": "2.2.2",
"version": "2.2.4",
"description": "Adapter for building SvelteKit applications on Cloudflare Pages with Workers integration",
"repository": {
"type": "git",
Expand Down
3 changes: 2 additions & 1 deletion packages/adapter-cloudflare/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ const worker = {

// write to `Cache` only if response is not an error,
// let `Cache.save` handle the Cache-Control and Vary headers
return res.status >= 400 ? res : Cache.save(req, res, context);
pragma = res.headers.get('cache-control') || '';
return pragma && res.status < 400 ? Cache.save(req, res, context) : res;
}
};

Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"sirv": "^2.0.3",
"svelte": "^3.56.0",
"typescript": "^4.9.4",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"peerDependencies": {
"@sveltejs/kit": "^1.5.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/prerendered/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@sveltejs/kit": "workspace:^",
"sirv-cli": "^2.0.2",
"svelte": "^3.56.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion packages/adapter-static/test/apps/spa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sveltejs/kit": "workspace:^",
"sirv-cli": "^2.0.2",
"svelte": "^3.56.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"type": "module"
}
13 changes: 13 additions & 0 deletions packages/adapter-vercel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# @sveltejs/adapter-vercel

## 3.0.0

### Major Changes

- breaking: remove obsolete `envVarsInUse` option ([#9942](https://github.com/sveltejs/kit/pull/9942))

### Patch Changes

- fix: Copy .wasm files during build ([#9944](https://github.com/sveltejs/kit/pull/9944))

- Updated dependencies [[`50acb22ca`](https://github.com/sveltejs/kit/commit/50acb22caf2901283e044cdfda36db6f07b3e0ae), [`2e6da9496`](https://github.com/sveltejs/kit/commit/2e6da9496bdace2c65040b9d1845c44801ca868c), [`a81106b3a`](https://github.com/sveltejs/kit/commit/a81106b3a817829c41e048207d6253e63988c58c), [`a6338a0b1`](https://github.com/sveltejs/kit/commit/a6338a0b124f54bda7ba3fe64be1d6173e118d00), [`4a85b7f08`](https://github.com/sveltejs/kit/commit/4a85b7f0820d35c7830c00afe1df3c94fcbf8c3d), [`26d2b7f8f`](https://github.com/sveltejs/kit/commit/26d2b7f8f5ca29c60ef61b936ff86deaeb1636ce), [`bc70b4e63`](https://github.com/sveltejs/kit/commit/bc70b4e636fcbd9593356996bf737e014ff8c238), [`ab9f57721`](https://github.com/sveltejs/kit/commit/ab9f57721fca146af7c4eb41f4875fafa5dfc0d2)]:
- @sveltejs/kit@1.17.0

## 2.4.3

### Patch Changes
Expand Down
5 changes: 0 additions & 5 deletions packages/adapter-vercel/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ export interface EdgeConfig {
* More info: https://vercel.com/docs/concepts/edge-network/regions
*/
regions?: string[] | 'all';
/**
* List of environment variable names that will be available for the Edge Function to utilize.
* Edge only.
*/
envVarsInUse?: string[];
/**
* List of packages that should not be bundled into the Edge Function.
* Edge only.
Expand Down
13 changes: 4 additions & 9 deletions packages/adapter-vercel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ const plugin = function (defaults = {}) {
const tmp = builder.getBuildDirectory(`vercel-tmp/${name}`);
const relativePath = path.posix.relative(tmp, builder.getServerDirectory());

const envVarsInUse = new Set();
routes.forEach((route) => {
route.config?.envVarsInUse?.forEach((x) => {
envVarsInUse.add(x);
});
});

builder.copy(`${files}/edge.js`, `${tmp}/edge.js`, {
replace: {
SERVER: `${relativePath}/index.js`,
Expand All @@ -124,7 +117,10 @@ const plugin = function (defaults = {}) {
format: 'esm',
external: config.external,
sourcemap: 'linked',
banner: { js: 'globalThis.global = globalThis;' }
banner: { js: 'globalThis.global = globalThis;' },
loader: {
'.wasm': 'copy'
}
});

write(
Expand All @@ -133,7 +129,6 @@ const plugin = function (defaults = {}) {
{
runtime: config.runtime,
regions: config.regions,
envVarsInUse: [...envVarsInUse],
entrypoint: 'index.js'
},
null,
Expand Down
2 changes: 1 addition & 1 deletion packages/adapter-vercel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sveltejs/adapter-vercel",
"version": "2.4.3",
"version": "3.0.0",
"description": "A SvelteKit adapter that creates a Vercel app",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"sucrase": "^3.29.0",
"svelte": "^3.56.0",
"tiny-glob": "^0.2.9",
"uvu": "^0.5.6"
"vitest": "^0.31.0"
},
"scripts": {
"build": "node scripts/build-templates",
"test": "pnpm build && uvu test",
"test": "pnpm build && vitest run",
"check": "tsc",
"lint": "prettier --check . --config ../../.prettierrc --ignore-path ../../.gitignore --ignore-path .gitignore --plugin prettier-plugin-svelte --plugin-search-dir=.",
"format": "pnpm lint --write",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-svelte/templates/default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@sveltejs/kit": "workspace:*",
"svelte": "^3.56.0",
"typescript": "^5.0.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"type": "module",
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.5.0",
"svelte": "^3.54.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@sveltejs/adapter-auto": "^2.0.0",
"@sveltejs/kit": "^1.5.0",
"svelte": "^3.54.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"type": "module"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"svelte": "^3.54.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^4.3.0"
"vite": "^4.3.6"
},
"svelte": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
Loading

0 comments on commit 140dd7d

Please sign in to comment.