Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from sveltejs:master #8

Merged
merged 23 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a81106b
feat: Add a speedier script tag for prerendered redirects (#9911)
elliott-with-the-longest-name-on-github May 16, 2023
50acb22
fix: avoid inlining raw/url CSS imports (#9925)
gtm-nayan May 16, 2023
2e6da94
feat: prerender & analyse in worker rather than subprocess to support…
fernandolguevara May 16, 2023
ef69b7d
avoid using isMainThread, since it interacts poorly with vitest (#9941)
Rich-Harris May 16, 2023
223b46a
chore: bump vite and devalue (#9933)
gtm-nayan May 16, 2023
7042766
chore: uvu -> vitest for create-svelte tests (#9910)
gtm-nayan May 16, 2023
4a85b7f
feat: unshadow `form` and `data` in `enhance` (#9902)
elliott-with-the-longest-name-on-github May 16, 2023
bbf3101
fix: Set loader: { '.wasm': 'copy' } in esbuild config in `adapter-cl…
ConProgramming May 16, 2023
245edc9
fix: Flaky test (#9947)
elliott-with-the-longest-name-on-github May 17, 2023
8cf8ddb
remove envVarsInUse (#9942)
Rich-Harris May 17, 2023
a6338a0
fix: type `vitePlugin` in config (#9946)
elliott-with-the-longest-name-on-github May 17, 2023
348029b
fix: Set `loader: { '.wasm': 'copy' }` in esbuild config in `adapter-…
elliott-with-the-longest-name-on-github May 17, 2023
ab9f577
feat: crawl URLs in `<meta>` tags (#9900)
LorisSigrist May 17, 2023
4622f1a
Version Packages (#9893)
github-actions[bot] May 17, 2023
702f49b
feat: support AWS via SST in adapter-auto (#9874)
fwang May 17, 2023
b3539c5
Version Packages (#9953)
github-actions[bot] May 17, 2023
a309d1c
only cache response if response has cache-control header (#9885)
psytrx May 17, 2023
43b6786
Version Packages (#9955)
github-actions[bot] May 17, 2023
a2f23ca
fix: ensure styles are loaded in dev mode for routes containing speci…
whataboutpereira May 17, 2023
0fd2d55
feat: Warn users when submitting forms with files but no `enctype="mu…
elliott-with-the-longest-name-on-github May 17, 2023
8572651
Version Packages (#9957)
github-actions[bot] May 17, 2023
535905c
security: Stop automatically adding URLs from server-side `load` `fet…
elliott-with-the-longest-name-on-github May 17, 2023
377d5a9
Version Packages (#9963)
github-actions[bot] May 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/[email protected]

## 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/[email protected]

## 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/[email protected]

## 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