message: Fix spread routes on server side

diff:
-import { URLSearchParams } from 'url';
-import { existsSync, createReadStream } from 'fs';
-import { readable, writable } from 'svelte/store';
-import { parse, resolve } from 'url';
import devalue from 'devalue';
-import fetch, { Response } from 'node-fetch';
+import { createReadStream, existsSync } from 'fs';
import * as mime from 'mime';
+import fetch, { Response } from 'node-fetch';
+import { readable, writable } from 'svelte/store';
+import { parse, resolve, URLSearchParams } from 'url';
+import {
+ EndpointResponse,
+ Headers,
+ IncomingRequest,
+ PageManifest,
+ PageManifestPart,
+ PageResponse,
+ RenderOptions,
+ RouteParams
+} from '../../types';
import { render } from './index';
-import { IncomingRequest, RenderOptions, PageManifest, EndpointResponse, PageResponse, Headers } from '../../types';
const noop = () => {};
@@ -136,11 +144,8 @@ export default async function render_page(
const match = page.pattern.exec(request.path)!;
- // TODO this logic is duplicated in several places
- const params: Record<string, string> = {};
- page.parts[page.parts.length - 1].params.forEach((name, i) => {
- params[name] = match[i + 1];
- });
+ // the last part has all parameters from any segment in the URL
+ const params = parts_to_params(match, page.parts[page.parts.length - 1] as PageManifestPart)
const preloaded: any[] = [];
let can_prerender = true;
@@ -155,10 +160,8 @@ export default async function render_page(
return;
}
- const params: Record<string, string> = {};
- part.params.forEach((name, i) => {
- params[name] = match[i + 1];
- });
+ // these are only the parameters up to the current URL segment
+ const params = parts_to_params(match, part)
const props = mod.preload
? await mod.preload.call(preload_context, {
@@ -242,7 +245,7 @@ export default async function render_page(
const js_deps = new Set(options.client.deps.__entry__ ? [...options.client.deps.__entry__.js] : []);
const css_deps = new Set(options.client.deps.__entry__ ? [...options.client.deps.__entry__.css] : []);
- page.parts.filter(Boolean).forEach(part => {
+ (page.parts.filter(Boolean) as PageManifestPart[]).forEach(part => {
const deps = options.client.deps[part.component.name];
if (!deps) return; // we don't have this info during dev
@@ -304,6 +307,22 @@ export default async function render_page(
}
}
+function parts_to_params(match: RegExpMatchArray, part: PageManifestPart): RouteParams {
+ const params: RouteParams = {};
+
+ part.params.forEach((name, i) => {
+ const is_spread = /^\.{3}.+$/.test(name)
+
+ if (is_spread) {
+ params[name.slice(3)] = match[i + 1].split('/');
+ } else {
+ params[name] = match[i + 1];
+ }
+ });
+
+ return params;
+}
+
function try_serialize(data: any, fail?: (err: Error) => void) {
try {
return devalue(data);

diff:
@@ -53,6 +53,8 @@ export interface RenderOptions {
dev: boolean; // TODO this is awkward
}
+export type RouteParams = Record<string, string | string[]>;
+
export interface PageComponentManifest {
default?: boolean;
type?: string;
@@ -61,13 +63,20 @@ export interface PageComponentManifest {
file: string;
}
+export interface PageManifestPart {
+ component: PageComponentManifest;
+ params: string[];
+}
+
export interface PageManifest {
pattern: RegExp;
path: string;
- parts: Array<{
- component: PageComponentManifest;
- params: string[];
- }>;
+ /**
+ * Each part contains the parameters for the page (last part) or layout (earlier parts)
+ * corresponding to a URL segment any part except the last may be null
+ * if there is no layout for that segment.
+ */
+ parts: Array<PageManifestPart | null>;
}
export interface EndpointManifest {

diff:
declare module "MANIFEST" {
- export const components: any[];
- export const routes: any[];
- export const layout: any;
- export const ErrorComponent: any;
+ import { SvelteComponent } from "svelte";
+
+ export type Route = {
+ pattern: RegExp;
+ parts: {
+ params: (match: RegExpExecArray) => Record<string, string>,
+ i: number
+ }[];
+ };
+
+ export const components: (() => SvelteComponent)[];
+ export const routes: Route[];
+ export const layout: SvelteComponent;
+ export const ErrorComponent: SvelteComponent;
}
declare module "ROOT" {
- const root: any;
+ import { SvelteComponent } from "svelte";
+
+ type Constructor<T> = {
+ new (...args: any[]): T;
+ }
+
+ const root: Constructor<SvelteComponent>;
export default root;
}

diff:
@@ -296,7 +296,7 @@ function get_parts(part: string): Part[] {
return {
content,
dynamic,
- spread: /^\.{3}.+$/.test(content),
+ spread: dynamic && /^\.{3}.+$/.test(content),
qualifier
};
})

diff:
@@ -25,9 +25,19 @@ export interface ScrollPosition {
y: number;
}
+export type RouteParams = Record<string, string | string[]>;
+
+export interface Route {
+ pattern: RegExp;
+ parts: {
+ params: (match: RegExpExecArray) => RouteParams,
+ i: number
+ }[];
+}
+
export interface Target {
href: string;
- route: any; // TODO Route;
+ route: Route;
match: RegExpExecArray;
page: Page;
}
@@ -40,7 +50,7 @@ export interface Redirect {
export interface Page {
host: string;
path: string;
- params: Record<string, string>;
+ params: RouteParams;
query: Record<string, string | string[]>;
}

original_message: Fix spread routes on server side (#115)


message: handle initialization errors in CLI

change_type: MODIFY

diff:
@@ -19,8 +19,8 @@ import { DevConfig, Loader } from './types';
import { copy_assets } from '../utils';
import { readFileSync } from 'fs';
-export function dev(opts: DevConfig) {
- return new Watcher(opts);
+export function dev(opts: DevConfig): Promise<Watcher> {
+ return new Watcher(opts).init();
}
class Watcher extends EventEmitter {
@@ -47,8 +47,6 @@ class Watcher extends EventEmitter {
process.on('exit', () => {
this.close();
});
-
- this.init();
}
async init() {
@@ -61,6 +59,8 @@ class Watcher extends EventEmitter {
this.emit('ready', {
port: this.opts.port
} as ReadyEvent);
+
+ return this;
}
async init_filewatcher() {

diff:
@@ -31,7 +31,7 @@ prog.command('dev')
const { dev } = await import('./api/dev');
try {
- const watcher = dev({
+ const watcher = await dev({
port: opts.port
});

license: MIT License

repo: sveltejs/kit

original_message: handle initialization errors in CLI (#145)


diff:
@@ -7,5 +7,7 @@ export {
Page,
PageContext,
Query,
- Method
+ Method,
+ Route,
+ RouteParams
} from './src/types';

diff:
@@ -56,6 +56,14 @@ export interface RenderOptions {
dev: boolean; // TODO this is awkward
}
+export interface Route {
+ pattern: RegExp;
+ parts: Array<{
+ params: (match: RegExpExecArray) => RouteParams,
+ i: number
+ }>;
+}
+
export type RouteParams = Record<string, string | string[]>;
export interface PageComponentManifest {

diff:
-declare module "MANIFEST" {
- import { SvelteComponent } from "svelte";
+declare module 'MANIFEST' {
+ import { SvelteComponent } from 'svelte';
+ import { Route } from '@sveltejs/app-utils';
- export type Route = {
- pattern: RegExp;
- parts: {
- params: (match: RegExpExecArray) => Record<string, string>,
- i: number
- }[];
- };
-
- export const components: (() => SvelteComponent)[];
+ export const components: Array<() => SvelteComponent>;
export const routes: Route[];
export const layout: SvelteComponent;
export const ErrorComponent: SvelteComponent;
}
-declare module "ROOT" {
- import { SvelteComponent } from "svelte";
+declare module 'ROOT' {
+ import { SvelteComponent } from 'svelte';
type Constructor<T> = {
new (...args: any[]): T;
- }
+ };
const root: Constructor<SvelteComponent>;
export default root;

diff:
@@ -4,19 +4,6 @@ export interface SvelteAppConfig {
adapter: string;
}
-export interface Route {
- id: string;
- handlers: Array<{
- type: 'page' | 'route';
- file: string;
- }>;
- pattern: RegExp;
- test: (url: string) => boolean;
- exec: (url: string) => Record<string, string>;
- parts: string[];
- params: string[];
-};
-
export interface Template {
render: (data: Record<string, string>) => string;
stream: (req, res, data: Record<string, string | Promise<string>>) => void;

diff:
import { Page } from '@sveltejs/app-utils';
-export { Page, Query, PageContext } from '@sveltejs/app-utils';
+export { Page, Query, PageContext, Route, RouteParams } from '@sveltejs/app-utils';
export interface HydratedTarget {
redirect?: Redirect;
@@ -28,16 +28,6 @@ export interface ScrollPosition {
y: number;
}
-export type RouteParams = Record<string, string | string[]>;
-
-export interface Route {
- pattern: RegExp;
- parts: Array<{
- params: (match: RegExpExecArray) => RouteParams,
- i: number
- }>;
-}
-
export interface Target {
href: string;
route: Route;

original_message: Moving Route and RouteParams types to app-utils (#146)


diff:
@@ -14,10 +14,11 @@ const mutable = (dir) =>
maxAge: 0
});
-const static_handler = mutable(app.paths.static);
+const noop_handler = (_req, _res, next) => next();
+const static_handler = fs.existsSync(app.paths.static) ? mutable(app.paths.static) : noop_handler;
const prerendered_handler = fs.existsSync('build/prerendered')
? mutable('build/prerendered')
- : (_req, _res, next) => next();
+ : noop_handler;
const assets_handler = sirv('build/assets', {
maxAge: 31536000,

original_message:
Making static directory optional (to make e2e tests work) (#188)

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


message: re-enable the CI matrix

diff:
@@ -14,13 +14,8 @@ jobs:
timeout-minutes: 6
strategy:
matrix:
- # Run only on Node 12 while repo is private to save minutes
- # node-version: [12, 14]
- node-version: [12]
- # don't include macOS-latest while repo is private because it is charged at 10x rate
- # same with windows-latest charged at 2x rate
- # os: [ubuntu-latest, windows-latest, macOS-latest]
- os: [ubuntu-latest, windows-latest]
+ node-version: [12, 14, 15]
+ os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v2
@@ -49,13 +44,8 @@ jobs:
timeout-minutes: 6
strategy:
matrix:
- # Run only on Node 12 while repo is private to save minutes
- # node-version: [12, 14]
- node-version: [12]
- # don't include macOS-latest while repo is private because it is charged at 10x rate
- # same with windows-latest charged at 2x rate
- # os: [ubuntu-latest, windows-latest, macOS-latest]
- os: [ubuntu-latest, windows-latest]
+ node-version: [12, 14, 15]
+ os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v2

original_message: re-enable the CI matrix (#499)


message: fix "Visit the svelte.dev"

diff:
the answer is {answer}

<Counter />
-
Visit the svelte.dev to learn how to build Svelte apps.

+
Visit svelte.dev to learn how to build Svelte apps.

<form on:submit={handle_submit} action="/doubler" method="post">
- <input type="number" name="num" value="1">
+ <input type="number" name="num" value="1" />
<button>double it</button>
</form>

diff:
Hello world!

<Counter />
-
Visit the svelte.dev to learn how to build Svelte apps.

+
Visit svelte.dev to learn how to build Svelte apps.

original_message: fix "Visit the svelte.dev" (#512)


change_type: ADD

diff:
+---
+'create-svelte': patch
+---
+
+Fix build so that the package can be automatically published

diff:
declare module 'prompts/lib/index';
declare module '*.json';
-
-// TODO make this depend on the real types from the kit package
-declare module '@sveltejs/kit/filesystem';

diff:
//eslint-disable-next-line import/no-unresolved
import fs from 'fs';
import path from 'path';
-import { mkdirp } from '@sveltejs/kit/filesystem'; // eslint-disable-line
import { bold, cyan, gray, green, red } from 'kleur/colors';
import prompts from 'prompts/lib/index';
import { fileURLToPath } from 'url';
@@ -219,4 +218,14 @@ function sort_keys(obj) {
return sorted;
}
+/** @param {string} dir */
+function mkdirp(dir) {
+ try {
+ fs.mkdirSync(dir, { recursive: true });
+ } catch (e) {
+ if (e.code === 'EEXIST') return;
+ throw e;
+ }
+}
+
main();

original_message: remove dependence of create-svelte build on kit build (#1001)


message: fix build command in main readme

diff:
@@ -23,7 +23,7 @@ pnpm i
...then build SvelteKit and the other packages:
```bash
-pnpm -r build
+pnpm build
```
You should now be able to run the [examples](examples) by navigating to one of the directories and doing `pnpm dev`.

original_message: fix build command in main readme (#1106)


message: adjust .prettierrc

old_path: .prettierrc

new_path: .prettierrc

diff:
"printWidth": 100,
"overrides": [
{
- "files": ["*.svelte"],
+ "files": [
+ "*.svelte"
+ ],
"options": {
- "svelteSortOrder": "scripts-markup-styles-options",
"svelteBracketNewLine": true
}
}

original_message: adjust .prettierrc (#1184)


message: miscellaneous documentation adjustments

diff:
@@ -8,7 +8,7 @@ An optional `src/hooks.js` (or `src/hooks.ts`, or `src/hooks/index.js`) file exp
### getContext
-This function runs on every incoming request. It generates the `context` object that is available to [endpoint handlers](#routing-endpoints) as `request.context`, and used to derive the [`session`](#hooks-getsession) object available in the browser.
+This function runs on every incoming request. It generates the `context` object that is available to [endpoint handlers](#routing-endpoints) as `request.context` and that is used to derive the [`session`](#hooks-getsession) object available in the browser.
If unimplemented, context is `{}`.
@@ -43,7 +43,7 @@ export async function getContext({ headers }) {
### getSession
-This function takes the [`context`](#hooks-getcontext) object and returns a `session` object that is safe to expose to the browser. It runs whenever SvelteKit renders a page.
+This function takes the [`context`](#hooks-getcontext) object and returns a `session` object that is safe to expose to the browser. It runs whenever SvelteKit server-renders a page.
If unimplemented, session is `{}`.

diff:
@@ -4,6 +4,6 @@ title: AMP
An unfortunate reality of modern web development is that it is sometimes necessary to create an [AMP](https://amp.dev/) version of your site. In SvelteKit this can be done by setting the [`amp`](#configuration-amp) config option, which has the following effects:
-* Client-side JavaScript, including the router, is disabled
-* Styles are concatenated into `<style amp-custom>`, and the [AMP boilerplate](https://amp.dev/boilerplate/) is injected
-* In development, requests are checked against the [AMP validator](https://validator.ampproject.org/) so you get early warning of any errors
\ No newline at end of file
+- Client-side JavaScript, including the router, is disabled
+- Styles are concatenated into `<style amp-custom>`, and the [AMP boilerplate](https://amp.dev/boilerplate/) is injected
+- In development, requests are checked against the [AMP validator](https://validator.ampproject.org/) so you get early warning of any errors

diff:
@@ -8,4 +8,4 @@ Please see the [FAQ](/faq) for solutions to common issues and helpful tips and t
### Support
-You can ask for help on [Discord](https://svelte.dev/chat) and [StackOverlow](https://stackoverflow.com/questions/tagged/svelte). Please first search for information related to your issue in the FAQ, Google or another search engine, issue tracker, and Discord chat history in order to be respectful of others' time. There are many more people asking questions than answering them, so this will help in allowing the community to grow in a scalable fashion.
+You can ask for help on [Discord](https://svelte.dev/chat) and [StackOverflow](https://stackoverflow.com/questions/tagged/svelte). Please first search for information related to your issue in the FAQ, Google or another search engine, issue tracker, and Discord chat history in order to be respectful of others' time. There are many more people asking questions than answering them, so this will help in allowing the community to grow in a scalable fashion.

diff:
question: How do I use HMR with SvelteKit?
---
-SvelteKit has HMR enabled by default powered by [svelte-hmr](https://github.com/rixo/svelte-hmr). If you saw, [Rich's presentation at the 2020 Svelte Summit](https://svelte.dev/blog/whats-the-deal-with-sveltekit) you may have seen a more powerful-looking version of HMR presented. This demo had `svelte-hmr`'s `preserveLocalState` flag on. This flag is now off by default because it may lead to unexpected behavior and edge cases. But don't worry, you are still getting HMR with SvelteKit! If you'd like to preserve local state you can use the `@hmr:keep` or `@hmr:keep-all` directives as documented on the [svelte-hmr](https://github.com/rixo/svelte-hmr) page.
+SvelteKit has HMR enabled by default powered by [svelte-hmr](https://github.com/rixo/svelte-hmr). If you saw [Rich's presentation at the 2020 Svelte Summit](https://svelte.dev/blog/whats-the-deal-with-sveltekit), you may have seen a more powerful-looking version of HMR presented. This demo had `svelte-hmr`'s `preserveLocalState` flag on. This flag is now off by default because it may lead to unexpected behaviour and edge cases. But don't worry, you are still getting HMR with SvelteKit! If you'd like to preserve local state you can use the `@hmr:keep` or `@hmr:keep-all` directives as documented on the [svelte-hmr](https://github.com/rixo/svelte-hmr) page.

diff:
question: Why am I getting a 404?
---
-Please make sure you're returning something from your page's `load` function. See the section about [fallthrough routes](../docs#routing-advanced-fallthrough-routes) for more details.
+Please make sure you're returning something from your page's `load` function. See the section about [fallthrough routes](/docs#routing-advanced-fallthrough-routes) for more details.

diff:
@@ -10,7 +10,7 @@ Please see [sveltejs/integrations](https://github.com/sveltejs/integrations#svel
Adding [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) to your [`svelte.config.cjs`](#configuration) is the first step. For many of the tools listed above, you only need to install the corresponding library such as `npm install -D sass`or `npm install -D less`. See the svelte-preprocess docs for full details.
-Also see [the examples above](/faq#how-do-i-use-x-with-sveltekit-how-do-i-setup-library-x) of setting up these and similar libraries.
+Also see [the examples above](#how-do-i-use-x-with-sveltekit-how-do-i-setup-library-x) of setting up these and similar libraries.
### How do I use a client-side only library that depends on `document` or `window`?
@@ -31,22 +31,19 @@ You can also run code in `onMount` if you'd like to run it after the component h
```html
<script>
import { onMount } from 'svelte';
- import { browser } from '$app/env';
let awkward;
onMount(async () => {
- if (browser) {
const module = await import('some-browser-only-library');
awkward = module.default;
- }
});
</script>
```
### How do I setup a database?
-Put the code to query your database in [endpoints](../docs#routing-endpoints) - don't query the database in .svelte files. You can create a `db.js` or similar that sets up a connection immediately and makes the client accessible throughout the app as a singleton. You can execute any one-time setup code in `hooks.js` and import your database helpers into any endpoint that needs them.
+Put the code to query your database in [endpoints](/docs#routing-endpoints) - don't query the database in .svelte files. You can create a `db.js` or similar that sets up a connection immediately and makes the client accessible throughout the app as a singleton. You can execute any one-time setup code in `hooks.js` and import your database helpers into any endpoint that needs them.
### How do I use Axios?

diff:
@@ -5,4 +5,3 @@ title: Migrating from Sapper
SvelteKit is the successor to Sapper and shares many elements of its design.
If you have an existing Sapper app that you plan to migrate to SvelteKit, however, there are a number of changes you will need to make. You may find it helpful to view the [examples](https://github.com/sveltejs/kit/tree/master/examples) while migrating.
-

diff:
@@ -18,7 +18,7 @@ Remove `sapper` from your `devDependencies` and replace it with `@sveltejs/kit`,
Any scripts that reference `sapper` should be updated:
-* `sapper build` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the Node [adapter](/docs#adapters)
-* `sapper export` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the static [adapter](/docs#adapters)
-* `sapper dev` should become [`svelte-kit dev`](/docs#command-line-interface-svelte-kit-dev)
-* `node __sapper__/build` should become `node build`
+- `sapper build` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the Node [adapter](/docs#adapters)
+- `sapper export` should become [`svelte-kit build`](/docs#command-line-interface-svelte-kit-build) using the static [adapter](/docs#adapters)
+- `sapper dev` should become [`svelte-kit dev`](/docs#command-line-interface-svelte-kit-dev)
+- `node __sapper__/build` should become `node build`

original_message: miscellaneous documentation adjustments (#1204)


message:
Fix adapter-node build in presence of tsconfig.json
* target Node 12 in app output
Without an explicit target value, esbuild will pick up the version from
tsconfig.json, if present. This breaks the build if that specifies a
target of es2019, which does not support import.meta.
* add changeset

diff:
+---
+'@sveltejs/adapter-node': patch
+---
+
+Fix build when using TypeScript and there is a `tsconfig.json` with `target: 'es2019'` or earlier

diff:
@@ -28,7 +28,8 @@ export default function ({ out = 'build' } = {}) {
bundle: true,
external: Object.keys(JSON.parse(readFileSync('package.json', 'utf8')).dependencies || {}),
format: 'esm',
- platform: 'node'
+ platform: 'node',
+ target: 'node12'
});
utils.log.minor('Prerendering static pages');

original_message:
Fix adapter-node build in presence of tsconfig.json (#1675)

* target Node 12 in app output

Without an explicit target value, esbuild will pick up the version from
tsconfig.json, if present. This breaks the build if that specifies a
target of es2019, which does not support import.meta.

* add changeset


diff:
+---
+'@sveltejs/adapter-node': patch
+---
+
+Allow the environment variables containing the host and port to serve on to be customised

diff:
declare function plugin(options?: {
out?: string;
precompress?: boolean;
+ env?: {
+ host?: string;
+ port?: string;
+ };
}): import('@sveltejs/kit').Adapter;
export = plugin;

diff:
-import { readFileSync, statSync, createReadStream, createWriteStream } from 'fs';
+import { readFileSync, statSync, createReadStream, createWriteStream, writeFileSync } from 'fs';
import { join } from 'path';
import { fileURLToPath } from 'url';
import { pipeline } from 'stream';
@@ -12,10 +12,18 @@ const pipe = promisify(pipeline);
/**
* @param {{
* out?: string;
- * precompress?: boolean
+ * precompress?: boolean;
+ * env?: {
+ * host?: string;
+ * port?: string;
+ * };
* }} options
*/
-export default function ({ out = 'build', precompress } = {}) {
+export default function ({
+ out = 'build',
+ precompress,
+ env: { host: host_env = 'HOST', port: port_env = 'PORT' } = {}
+} = {}) {
/** @type {import('@sveltejs/kit').Adapter} */
const adapter = {
name: '@sveltejs/adapter-node',
@@ -34,6 +42,12 @@ export default function ({ out = 'build', precompress } = {}) {
utils.log.minor('Building server');
const files = fileURLToPath(new URL('./files', import.meta.url));
utils.copy(files, '.svelte-kit/node');
+ writeFileSync(
+ join(files, 'env.js'),
+ `export const host = process.env[${JSON.stringify(
+ host_env
+ )}] || '0.0.0.0';\nexport const port = process.env[${JSON.stringify(port_env)}] || 3000;`
+ );
await esbuild.build({
entryPoints: ['.svelte-kit/node/index.js'],
outfile: join(out, 'index.js'),

diff:
@@ -10,5 +10,5 @@ export default {
sourcemap: true
},
plugins: [nodeResolve(), commonjs(), json()],
- external: ['../output/server/app.js', ...require('module').builtinModules]
+ external: ['../output/server/app.js', './env.js', ...require('module').builtinModules]
};

diff:
@@ -2,11 +2,10 @@ import './require_shim';
import { createServer } from './server';
// TODO hardcoding the relative location makes this brittle
import { render } from '../output/server/app.js'; // eslint-disable-line import/no-unresolved
+import { host, port } from './env.js'; // eslint-disable-line import/no-unresolved
-const { HOST = '0.0.0.0', PORT = 3000 } = process.env;
-
-const instance = createServer({ render }).listen(PORT, HOST, () => {
- console.log(`Listening on port ${PORT}`);
+const instance = createServer({ render }).listen(port, host, () => {
+ console.log(`Listening on port ${port}`);
});
export { instance };

original_message: allow customisation of HOST and PORT env vars in adapter-node (#1754)


message: Fix adapter-node regression

diff:
+---
+'@sveltejs/adapter-node': patch
+---
+
+Fix regression caused by writing `env.js` to the wrong path

diff:
@@ -43,7 +43,7 @@ export default function ({
const files = fileURLToPath(new URL('./files', import.meta.url));
utils.copy(files, '.svelte-kit/node');
writeFileSync(
- join(files, 'env.js'),
+ '.svelte-kit/node/env.js',
`export const host = process.env[${JSON.stringify(
host_env
)}] || '0.0.0.0';\nexport const port = process.env[${JSON.stringify(port_env)}] || 3000;`

original_message: Fix adapter-node regression (#1756)


message:
[fix] `ReadOnlyFormData` types
Fix type errors inside ReadOnlyFormData that didn't allow it to be used inside for..of loops

diff:
+---
+'@sveltejs/kit': patch
+---
+
+Fix type errors inside ReadOnlyFormData that didn't allow it to be used inside for..of loops

diff:
-interface ReadOnlyFormData extends Iterator<[string, string]> {
+interface ReadOnlyFormData {
get: (key: string) => string;
getAll: (key: string) => string[];
has: (key: string) => boolean;
- entries: () => Iterator<[string, string]>;
- keys: () => Iterator<string>;
- values: () => Iterator<string>;
+ entries: () => Generator<[string, string], void>;
+ keys: () => Generator<string, void>;
+ values: () => Generator<string, void>;
+ [Symbol.iterator]: () => Generator<[string, string], void>;
}
type BaseBody = string | Buffer | ReadOnlyFormData;

original_message:
[fix] `ReadOnlyFormData` types (#1830)

Fix type errors inside ReadOnlyFormData that didn't allow it to be used inside for..of loops


diff:
+---
+'@sveltejs/adapter-cloudflare-workers': patch
+'@sveltejs/adapter-netlify': patch
+'@sveltejs/kit': patch
+---
+
+Update and consolidate checks for binary body types

diff:
// TODO hardcoding the relative location makes this brittle
import { init, render } from '../output/server/app.js'; // eslint-disable-line import/no-unresolved
import { getAssetFromKV, NotFoundError } from '@cloudflare/kv-asset-handler'; // eslint-disable-line import/no-unresolved
+import { isContentTypeBinary } from '@sveltejs/kit/adapter-utils'; // eslint-disable-line import/no-unresolved
init();
@@ -57,7 +58,7 @@ async function handle(event) {
/** @param {Request} request */
async function read(request) {
const type = request.headers.get('content-type') || '';
- if (type.includes('application/octet-stream')) {
+ if (isContentTypeBinary(type)) {
return new Uint8Array(await request.arrayBuffer());
}

diff:
// TODO hardcoding the relative location makes this brittle
import { init, render } from '../output/server/app.js'; // eslint-disable-line import/no-unresolved
+import { isContentTypeBinary } from '@sveltejs/kit/adapter-utils'; // eslint-disable-line import/no-unresolved
init();
@@ -8,8 +9,9 @@ export async function handler(event) {
const query = new URLSearchParams(rawQuery);
+ const type = headers['content-type'];
const rawBody =
- headers['content-type'] === 'application/octet-stream'
+ type && isContentTypeBinary(type)
? new TextEncoder('base64').encode(body)
: isBase64Encoded
? Buffer.from(body, 'base64').toString()

diff:
"./install-fetch": {
"import": "./dist/install-fetch.js"
},
+ "./adapter-utils": {
+ "import": "./dist/adapter-utils.js"
+ },
"./types": "./types/index.d.ts"
},
"types": "types/index.d.ts",

diff:
@@ -48,7 +48,8 @@ export default [
cli: 'src/cli.js',
ssr: 'src/runtime/server/index.js',
node: 'src/core/node/index.js',
- 'install-fetch': 'src/install-fetch.js'
+ 'install-fetch': 'src/install-fetch.js',
+ 'adapter-utils': 'src/core/adapter-utils.js'
},
output: {
dir: 'dist',

diff:
+/**
+ * Decides how the body should be parsed based on its mime type.
+ *
+ * This is intended to be used with both requests and responses, to have a consistent body parsing across adapters.
+ *
+ * @param {string} content_type The `content-type` header of a request/response.
+ * @returns {boolean}
+ */
+export function isContentTypeBinary(content_type) {
+ return (
+ content_type.startsWith('image/') ||
+ content_type.startsWith('audio/') ||
+ content_type.startsWith('video/') ||
+ content_type.startsWith('application/octet-stream')
+ );
+}

diff:
+import { isContentTypeBinary } from '../adapter-utils.js';
+
/**
* @param {import('http').IncomingMessage} req
* @returns {Promise<import('types/hooks').StrictBody>}
@@ -48,7 +50,7 @@ export function getRawBody(req) {
req.on('end', () => {
const [type] = h['content-type'].split(/;\s*/);
- if (type === 'application/octet-stream') {
+ if (isContentTypeBinary(type)) {
return fulfil(data);
}

diff:
+import { isContentTypeBinary } from '../../core/adapter-utils.js';
import { lowercase_keys } from './utils.js';
/** @param {string} body */
@@ -37,24 +38,28 @@ export default async function render_route(request, route) {
headers = lowercase_keys(headers);
const type = headers['content-type'];
+ const is_type_binary = type && isContentTypeBinary(type);
+
// validation
- if (type === 'application/octet-stream' && !(body instanceof Uint8Array)) {
+ if (is_type_binary && !(body instanceof Uint8Array)) {
return error(
- `${preface}: body must be an instance of Uint8Array if content type is application/octet-stream`
+ `${preface}: body must be an instance of Uint8Array if content type is image/*, audio/*, video/* or application/octet-stream`
);
}
- if (body instanceof Uint8Array && type !== 'application/octet-stream') {
+ if (body instanceof Uint8Array && !is_type_binary) {
return error(
- `${preface}: Uint8Array body must be accompanied by content-type: application/octet-stream header`
+ `${preface}: Uint8Array body must have content-type header of image/*, audio/*, video/* or application/octet-stream`
);
}
/** @type {import('types/hooks').StrictBody} */
let normalized_body;
+ // ensure the body is an object
if (
(typeof body === 'object' || typeof body === 'undefined') &&
+ !(body instanceof Uint8Array) &&
(!type || type.startsWith('application/json'))
) {
headers = { ...headers, 'content-type': 'application/json; charset=utf-8' };

original_message: [fix] Expand list of allowed mime types for binary bodies  (#1687)


diff:
+---
+'@sveltejs/adapter-netlify': patch
+---
+
+Use multivalue headers to set multiple cookies

diff:
@@ -29,7 +29,7 @@ export async function handler(event) {
return {
isBase64Encoded: false,
statusCode: rendered.status,
- headers: rendered.headers,
+ ...splitHeaders(headers),
body: rendered.body
};
}
@@ -39,3 +39,25 @@ export async function handler(event) {
body: 'Not found'
};
}
+
+/**
+ * Splits headers into two categories: single value and multi value
+ * @param {Record<string, string | string[]>} headers
+ * @returns {{
+ * headers: Record<string, string>,
+ * multiValueHeaders: Record<string, string[]>
+ * }}
+ */
+function splitHeaders(headers) {
+ const h = {};
+ const m = {};
+ for (const key in headers) {
+ const value = headers[key];
+ const target = Array.isArray(value) ? m : h;
+ target[key] = value;
+ }
+ return {
+ headers: h,
+ multiValueHeaders: m
+ };
+}

original_message: [fix] adapter-netlify: support for multivalue headers (#1906)


diff:
+---
+"@sveltejs/adapter-netlify": patch
+---
+
+return the correct headers

diff:
@@ -29,7 +29,7 @@ export async function handler(event) {
return {
isBase64Encoded: false,
statusCode: rendered.status,
- ...splitHeaders(headers),
+ ...splitHeaders(rendered.headers),
body: rendered.body
};
}

original_message: [fix] adapter-netlify: return the correct headers (#1913)


message: [feat] Ignore adapter build files

diff:
+---
+'@sveltejs/kit': patch
+---
+
+Add public API to let adapters update .gitignore

diff:
@@ -26,6 +26,7 @@ The types for `Adapter` and its parameters are available in [types/config.d.ts](
Within the `adapt` method, there are a number of things that an adapter should do:
- Clear out the build directory
+- Call `utils.update_ignores` to ignore build output in existing `.gitignore` files at the location of `svelte.config.js`
- Output code that:
- Calls `init`
- Converts from the platform's request to a [SvelteKit request](#hooks-handle), calls `render`, and converts from a [SvelteKit response](#hooks-handle) to the platform's

diff:
@@ -25,6 +25,8 @@ export default function (options) {
const files = fileURLToPath(new URL('./files', import.meta.url));
+ utils.update_ignores({ patterns: [bucket, entrypoint] });
+
utils.rimraf(bucket);
utils.rimraf(entrypoint);

diff:
@@ -26,6 +26,8 @@ export default function (options) {
const files = fileURLToPath(new URL('./files', import.meta.url));
+ utils.update_ignores({ patterns: [publish, functions] });
+
utils.log.minor('Generating serverless function...');
utils.copy(join(files, 'entry.js'), '.svelte-kit/netlify/entry.js');

diff:
@@ -42,6 +42,7 @@ export default function ({
name: '@sveltejs/adapter-node',
async adapt({ utils, config }) {
+ utils.update_ignores({ patterns: [out] });
utils.log.minor('Copying assets');
const static_directory = join(out, 'assets');
utils.copy_client_files(static_directory);

diff:
@@ -11,6 +11,7 @@ export default function ({ pages = 'build', assets = pages, fallback } = {}) {
name: '@sveltejs/adapter-static',
async adapt({ utils }) {
+ utils.update_ignores({ patterns: [pages, assets] });
utils.copy_static_files(assets);
utils.copy_client_files(assets);

diff:
@@ -3,3 +3,5 @@ node_modules
/.svelte-kit
/build
/functions
+
+build

diff:
@@ -19,6 +19,8 @@ export default function (options) {
async adapt({ utils }) {
const dir = '.vercel_build_output';
+
+ utils.update_ignores({ patterns: [dir] });
utils.rimraf(dir);
const files = fileURLToPath(new URL('./files', import.meta.url));

diff:
"eslint-config-prettier": "^8.1.0"
},
"scripts": {
- "lint": "prettier --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
- "format": "prettier --write --plugin-search-dir=. ."
+ "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
+ "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
}
}

change_type: DELETE

diff:
-.svelte-kit/**
-static/**
-build/**
-node_modules/**

diff:
{
"scripts": {
- "lint": "prettier --check --plugin-search-dir=. .",
- "format": "prettier --write --plugin-search-dir=. ."
+ "lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. .",
+ "format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
}
}

diff:
import { SVELTE_KIT } from '../constants.js';
import { copy, rimraf, mkdirp } from '../filesystem/index.js';
import { prerender } from './prerender.js';
+import fs from 'fs';
/**
* @param {{
@@ -42,6 +43,25 @@ export function get_utils({ cwd, config, build_data, log }) {
log
});
}
+ },
+
+ /** @param {{patterns: string[], log?: boolean}} options */
+ update_ignores({ patterns, log = true }) {
+ const target = '.gitignore';
+ if (!fs.existsSync(target)) return;
+
+ const file = fs.readFileSync(target, { encoding: 'utf-8' });
+ const eol = file.includes('\r\n') ? '\r\n' : '\n';
+ const lines = file.split(eol);
+ const new_lines = new Set(patterns);
+ // remove repeated lines
+ for (const line of lines) {
+ // this will prevent commented ignores to be reinserted
+ new_lines.delete(line.replace(/#\s*/, ''));
+ }
+ if (new_lines.size === 0) return;
+ fs.writeFileSync(target, [...lines, ...new_lines].join(eol));
+ if (log) this.log.success(`Updated ${target}`);
}
};
}

diff:
@@ -10,6 +10,7 @@ export interface AdapterUtils {
copy_server_files: (dest: string) => void;
copy_static_files: (dest: string) => void;
copy: (from: string, to: string, filter?: (basename: string) => boolean) => void;
+ update_ignores: ({ patterns, log }: { patterns: string[]; log?: boolean }) => void;
prerender: ({
all,
dest,

original_message: [feat] Ignore adapter build files (#1924)


diff:
@@ -5,9 +5,8 @@ import { read_only_form_data } from './read_only_form_data.js';
* @param {import('types/helper').Headers} headers
*/
export function parse_body(raw, headers) {
- if (!raw) return raw;
+ if (!raw || typeof raw !== 'string') return raw;
- if (typeof raw === 'string') {
const [type, ...directives] = headers['content-type'].split(/;\s*/);
switch (type) {
@@ -30,9 +29,6 @@ export function parse_body(raw, headers) {
}
}
- return raw;
-}
-
/** @param {string} text */
function get_urlencoded(text) {
const { data, append } = read_only_form_data();

original_message: [chore] minor simplification of `parse_body` (#2043)


diff:
+---
+'@sveltejs/kit': patch
+---
+
+Replace function properties by methods on type declarations

diff:
@@ -2,7 +2,7 @@ export type ConfigDefinition =
| {
type: 'leaf';
default: any;
- validate: (value: any, keypath: string) => any;
+ validate(value: any, keypath: string): any;
}
| {
type: 'branch';

diff:
@@ -15,25 +15,25 @@ export interface TestContext {
nojs: Page;
};
response: PlaywrightResponse;
- clicknav: (selector: string) => Promise<void>;
- back: () => Promise<void>;
- fetch: (url: RequestInfo, opts?: RequestInit) => Promise<NodeFetchResponse>;
- capture_requests: (fn: () => Promise<void>) => Promise<string[]>;
- errors: () => string;
+ clicknav(selector: string): Promise<void>;
+ back(): Promise<void>;
+ fetch(url: RequestInfo, opts?: RequestInit): Promise<NodeFetchResponse>;
+ capture_requests(fn: () => Promise<void>): Promise<string[]>;
+ errors(): string;
js: boolean;
// these are assumed to have been put in the global scope by the layout
app: {
- goto: (url: string) => Promise<void>;
- invalidate: (url: string) => Promise<void>;
- prefetch: (url: string) => Promise<void>;
- prefetchRoutes: (urls?: string[]) => Promise<void>;
+ goto(url: string): Promise<void>;
+ invalidate(url: string): Promise<void>;
+ prefetch(url: string): Promise<void>;
+ prefetchRoutes(urls?: string[]): Promise<void>;
};
watcher: any; // watcher type is not exposed
server: import('net').Server;
- reset: () => Promise<void>;
- unpatch: () => void;
+ reset(): Promise<void>;
+ unpatch(): void;
}
interface TestOptions {

diff:
@@ -4,18 +4,18 @@ import { Logger, TrailingSlash } from './internal';
export interface AdapterUtils {
log: Logger;
- rimraf: (dir: string) => void;
- mkdirp: (dir: string) => void;
- copy_client_files: (dest: string) => void;
- copy_server_files: (dest: string) => void;
- copy_static_files: (dest: string) => void;
- copy: (from: string, to: string, filter?: (basename: string) => boolean) => void;
- prerender: (options: { all?: boolean; dest: string; fallback?: string }) => Promise<void>;
+ rimraf(dir: string): void;
+ mkdirp(dir: string): void;
+ copy_client_files(dest: string): void;
+ copy_server_files(dest: string): void;
+ copy_static_files(dest: string): void;
+ copy(from: string, to: string, filter?: (basename: string) => boolean): void;
+ prerender(options: { all?: boolean; dest: string; fallback?: string }): Promise<void>;
}
export interface Adapter {
name: string;
- adapt: (context: { utils: AdapterUtils; config: ValidatedConfig }) => Promise<void>;
+ adapt(context: { utils: AdapterUtils; config: ValidatedConfig }): Promise<void>;
}
export interface PrerenderErrorHandler {

diff:
interface ReadOnlyFormData {
- get: (key: string) => string;
- getAll: (key: string) => string[];
- has: (key: string) => boolean;
- entries: () => Generator<[string, string], void>;
- keys: () => Generator<string, void>;
- values: () => Generator<string, void>;
- [Symbol.iterator]: () => Generator<[string, string], void>;
+ get(key: string): string;
+ getAll(key: string): string[];
+ has(key: string): boolean;
+ entries(): Generator<[string, string], void>;
+ keys(): Generator<string, void>;
+ values(): Generator<string, void>;
+ [Symbol.iterator](): Generator<[string, string], void>;
}
type BaseBody = string | Uint8Array | ReadOnlyFormData;

diff:
@@ -23,7 +23,7 @@ export interface GetSession<Locals = Record<string, any>, Session = any> {
export interface Handle<Locals = Record<string, any>> {
(input: {
request: ServerRequest<Locals>;
- resolve: (request: ServerRequest<Locals>) => MaybePromise<ServerResponse>;
+ resolve(request: ServerRequest<Locals>): MaybePromise<ServerResponse>;
}): MaybePromise<ServerResponse>;
}

diff:
@@ -14,15 +14,15 @@ export interface Incoming extends Omit<Location, 'params'> {
export 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;
+ success(msg: string): void;
+ error(msg: string): void;
+ warn(msg: string): void;
+ minor(msg: string): void;
+ info(msg: string): void;
}
export interface App {
- init: ({
+ init({
paths,
prerendering,
read
@@ -32,9 +32,9 @@ export interface App {
assets: string;
};
prerendering: boolean;
- read: (file: string) => Buffer;
- }) => void;
- render: (
+ read(file: string): Buffer;
+ }): void;
+ render(
incoming: Incoming,
options?: {
prerender: {
@@ -43,7 +43,7 @@ export interface App {
dependencies?: Map<string, ServerResponse>;
};
}
- ) => Promise<ServerResponse>;
+ ): Promise<ServerResponse>;
}
export interface SSRComponent {
@@ -54,9 +54,9 @@ export interface SSRComponent {
preload?: any; // TODO remove for 1.0
load: Load;
default: {
- render: (
+ render(
props: Record<string, any>
- ) => {
+ ): {
html: string;
head: string;
css: {
@@ -99,7 +99,7 @@ export interface SSREndpoint {
type: 'endpoint';
pattern: RegExp;
params: GetParams;
- load: () => Promise<{
+ load(): Promise<{
[method: string]: RequestHandler;
}>;
}
@@ -142,24 +142,24 @@ export interface SSRRenderOptions {
js: string[];
};
floc: boolean;
- get_stack: (error: Error) => string | undefined;
- handle_error: (error: Error) => void;
+ get_stack(error: Error): string | undefined;
+ handle_error(error: Error): void;
hooks: Hooks;
hydrate: boolean;
- load_component: (id: PageId) => Promise<SSRNode>;
+ load_component(id: PageId): Promise<SSRNode>;
manifest: SSRManifest;
paths: {
base: string;
assets: string;
};
prerender: boolean;
- read: (file: string) => Buffer;
+ read(file: string): Buffer;
root: SSRComponent['default'];
router: boolean;
service_worker?: string;
ssr: boolean;
target: string;
- template: ({ head, body }: { head: string; body: string }) => string;
+ template({ head, body }: { head: string; body: string }): string;
trailing_slash: TrailingSlash;
}

diff:
@@ -6,7 +6,7 @@ export interface LoadInput<
Session = any
> {
page: Page<PageParams>;
- fetch: (info: RequestInfo, init?: RequestInit) => Promise<Response>;
+ fetch(info: RequestInfo, init?: RequestInit): Promise<Response>;
session: Session;
context: Context;
}

original_message: [chore] type functions as methods for semantics (#2158)


message:
[chore] allow `EndpointOutput` response objects with `toJSON` property
allows users to return objects with a custom toJSON property

diff:
+---
+'@sveltejs/kit': patch
+---
+
+Allow `EndpointOutput` response body objects to have a `toJSON` property

diff:
import { ServerRequest } from './hooks';
import { Headers, MaybePromise } from './helper';
-type JSONValue = string | number | boolean | null | JSONValue[] | { [key: string]: JSONValue };
+type ToJSON = { toJSON(...args: any[]): JSONValue };
+type JSONValue = Exclude<JSONResponse, ToJSON>;
+type JSONResponse =
+ | string
+ | number
+ | boolean
+ | null
+ | JSONResponse[]
+ | ToJSON
+ | { [key: string]: JSONResponse };
-type DefaultBody = JSONValue | Uint8Array;
+type DefaultBody = JSONResponse | Uint8Array;
export interface EndpointOutput<Body extends DefaultBody = DefaultBody> {
status?: number;

original_message:
[chore] allow `EndpointOutput` response objects with `toJSON` property (#2170)

allows users to return objects with a custom toJSON property

Co-authored-by: Ignatius Bagus <ignatius.mbs@gmail.com>


diff:
+---
+'@sveltejs/kit': patch
+---
+
+avoid setting rawBody/body to an empty Uint8Array when a load's fetch function is called with no body during SSR

diff:
@@ -151,7 +151,7 @@ export async function load_node({
method: opts.method || 'GET',
headers,
path: relative,
- rawBody: new TextEncoder().encode(/** @type {string} */ (opts.body)),
+ rawBody: opts.body == null ? null : new TextEncoder().encode(opts.body),
query: new URLSearchParams(search)
},
options,

original_message: [fix] set rawBody to null when body is nullish in simulated load fetch (#2295)


diff:
+---
+'@sveltejs/adapter-cloudflare-workers': patch
+---
+
+Support assigning multiple values to a header

diff:
@@ -41,7 +41,7 @@ async function handle(event) {
if (rendered) {
return new Response(rendered.body, {
status: rendered.status,
- headers: rendered.headers
+ headers: makeHeaders(rendered.headers)
});
}
} catch (e) {
@@ -58,3 +58,22 @@ async function handle(event) {
async function read(request) {
return new Uint8Array(await request.arrayBuffer());
}
+
+/**
+ * @param {Record<string, string | string[]>} headers
+ * @returns {Request}
+ */
+function makeHeaders(headers) {
+ const result = new Headers();
+ for (const header in headers) {
+ const value = headers[header];
+ if (typeof value === 'string') {
+ result.set(header, value);
+ continue;
+ }
+ for (const sub of value) {
+ result.append(header, sub);
+ }
+ }
+ return result;
+}

original_message: [fix] adapter-cloudflare-workers: support setting multiple values to a header (#2313)


diff:
+---
+'@sveltejs/kit': patch
+---
+
+Allow service workers to access files using the $lib alias

diff:
@@ -606,7 +606,8 @@ async function build_service_worker(
},
resolve: {
alias: {
- '$service-worker': path.resolve(`${build_dir}/runtime/service-worker`)
+ '$service-worker': path.resolve(`${build_dir}/runtime/service-worker`),
+ $lib: config.kit.files.lib
}
}
});

original_message: [fix] Allow service workers to use the $lib alias (#2326)


diff:
+---
+'@sveltejs/adapter-node': patch
+---
+
+[fix] Correctly treat `middlewares.js` as external when using `entryPoint` option

diff:
@@ -7,7 +7,7 @@ import {
statSync,
writeFileSync
} from 'fs';
-import { join } from 'path';
+import { join, resolve } from 'path';
import { pipeline } from 'stream';
import glob from 'tiny-glob';
import { fileURLToPath } from 'url';
@@ -81,7 +81,6 @@ export default function ({
entryPoints: [entryPoint],
outfile: join(out, 'index.js'),
bundle: true,
- external: ['./middlewares.js'], // does not work, eslint does not exclude middlewares from target
format: 'esm',
platform: 'node',
target: 'node12',
@@ -90,8 +89,12 @@ export default function ({
{
name: 'fix-middlewares-exclude',
setup(build) {
- // Match an import called "./middlewares.js" and mark it as external
- build.onResolve({ filter: /^\.\/middlewares\.js$/ }, () => ({ external: true }));
+ // Match an import of "middlewares.js" and mark it as external
+ build.onResolve({ filter: /\/middlewares\.js$/ }, ({ path, resolveDir }) => {
+ if (resolve(resolveDir, path) === resolve(out, 'middlewares.js')) {
+ return { path: './middlewares.js', external: true };
+ }
+ });
}
}
]

original_message: [fix] externalize middlewares.js when using adapter-node's entryPoint (#2482)


diff:
+---
+'@sveltejs/adapter-node': patch
+---
+
+[fix] regression where builds not using `entryPoint` stopped having `middlewares.js` external

diff:
@@ -90,8 +90,11 @@ export default function ({
name: 'fix-middlewares-exclude',
setup(build) {
// Match an import of "middlewares.js" and mark it as external
+ const internal_middlewares_path = resolve('.svelte-kit/node/middlewares.js');
+ const build_middlewares_path = resolve(out, 'middlewares.js');
build.onResolve({ filter: /\/middlewares\.js$/ }, ({ path, resolveDir }) => {
- if (resolve(resolveDir, path) === resolve(out, 'middlewares.js')) {
+ const resolved = resolve(resolveDir, path);
+ if (resolved === internal_middlewares_path || resolved === build_middlewares_path) {
return { path: './middlewares.js', external: true };
}
});

original_message: [fix] externalize middlewares.js when not using entryPoint (#2484)


diff:
+---
+'create-svelte': patch
+---
+
+include missing .npmrc in templates

diff:
@@ -134,7 +134,7 @@ async function main() {
*/
function write_template_files(template, typescript, name, cwd) {
const dir = dist(`templates/${template}`);
- copy(`${dir}/assets`, cwd, (name) => name.replace('gitignore', '.gitignore'));
+ copy(`${dir}/assets`, cwd, (name) => name.replace('DOT-', '.'));
copy(`${dir}/package.json`, `${cwd}/package.json`);
const manifest = `${dir}/files.${typescript ? 'ts' : 'js'}.json`;

diff:
@@ -56,7 +56,7 @@ async function generate_templates(shared) {
contents
});
} else {
- const dest = path.join(assets, name).replace('.gitignore', 'gitignore'); // npm does wacky stuff to gitignores
+ const dest = path.join(assets, name.replace(/^\./, 'DOT-'));
mkdirp(path.dirname(dest));
fs.copyFileSync(path.join(cwd, name), dest);
}

original_message: [fix] rename dotfiles to avoid template problems (#2990)


diff:
+---
+"@fake-scope/fake-pkg": patch
+---
+
+[fix] rename `BASE` to `ORIGIN` and fix config handling

diff:
@@ -20,10 +20,10 @@ export default {
path: 'SOCKET_PATH',
host: 'HOST',
port: 'PORT',
- base: undefined,
+ origin: 'ORIGIN',
headers: {
- protocol: undefined,
- host: 'host'
+ protocol: 'PROTOCOL_HEADER',
+ host: 'HOST_HEADER'
}
}
})
@@ -49,13 +49,13 @@ By default, the server will accept connections on `0.0.0.0` using port 3000. The
HOST=127.0.0.1 PORT=4000 node build
```
-HTTP doesn't give SvelteKit a reliable way to know the URL that is currently being requested. The simplest way to tell SvelteKit where the app is being served is to set the `BASE` environment variable:
+HTTP doesn't give SvelteKit a reliable way to know the URL that is currently being requested. The simplest way to tell SvelteKit where the app is being served is to set the `ORIGIN` environment variable:
```
-BASE=https://my.site node build
+ORIGIN=https://my.site node build
```
-With this, a request for the `/stuff` pathname will correctly resolve to `https://my.site/stuff`. Alternatively, you can specify headers that tell SvelteKit about the request protocol and host, from which it can construct the base URL:
+With this, a request for the `/stuff` pathname will correctly resolve to `https://my.site/stuff`. Alternatively, you can specify headers that tell SvelteKit about the request protocol and host, from which it can construct the origin URL:
```
PROTOCOL_HEADER=x-forwarded-proto HOST_HEADER=x-forwarded-host node build
@@ -69,7 +69,7 @@ All of these environment variables can be changed, if necessary, using the `env`
env: {
host: 'MY_HOST_VARIABLE',
port: 'MY_PORT_VARIABLE',
- base: 'MY_BASEURL',
+ origin: 'MY_ORIGINURL',
headers: {
protocol: 'MY_PROTOCOL_HEADER',
host: 'MY_HOST_HEADER'
@@ -80,7 +80,7 @@ env: {
```
MY_HOST_VARIABLE=127.0.0.1 \
MY_PORT_VARIABLE=4000 \
-MY_BASEURL=https://my.site \
+MY_ORIGINURL=https://my.site \
node build
```

diff:
@@ -7,7 +7,7 @@ interface AdapterOptions {
path?: string;
host?: string;
port?: string;
- base?: string;
+ origin?: string;
headers?: {
protocol?: string;
host?: string;

diff:
@@ -17,11 +17,11 @@ export default function ({
path: path_env = 'SOCKET_PATH',
host: host_env = 'HOST',
port: port_env = 'PORT',
- base: base_env,
+ origin: origin_env = 'ORIGIN',
headers: {
protocol: protocol_header_env = 'PROTOCOL_HEADER',
host: host_header_env = 'HOST_HEADER'
- }
+ } = {}
} = {}
} = {}) {
return {
@@ -54,7 +54,7 @@ export default function ({
PATH_ENV: JSON.stringify(path_env),
HOST_ENV: JSON.stringify(host_env),
PORT_ENV: JSON.stringify(port_env),
- BASE: base_env ? `process.env[${JSON.stringify(base_env)}]` : 'undefined',
+ ORIGIN_ENV: origin_env ? `process.env[${JSON.stringify(origin_env)}]` : 'undefined',
PROTOCOL_HEADER: JSON.stringify(protocol_header_env),
HOST_HEADER: JSON.stringify(host_header_env)
}

diff:
@@ -7,10 +7,10 @@ import { getRequest, setResponse } from '@sveltejs/kit/node';
import { App } from 'APP';
import { manifest } from 'MANIFEST';
-/* global BASE_ENV, PROTOCOL_HEADER, HOST_HEADER */
+/* global ORIGIN_ENV, PROTOCOL_HEADER, HOST_HEADER */
const app = new App(manifest);
-const base = BASE_ENV && process.env[BASE_ENV];
+const origin = ORIGIN_ENV && process.env[ORIGIN_ENV];
const protocol_header = PROTOCOL_HEADER && process.env[PROTOCOL_HEADER];
const host_header = (HOST_HEADER && process.env[HOST_HEADER]) || 'host';
@@ -39,7 +39,7 @@ const ssr = async (req, res) => {
let request;
try {
- request = await getRequest(base || get_base(req.headers), req);
+ request = await getRequest(origin || get_origin(req.headers), req);
} catch (err) {
res.statusCode = err.status || 400;
return res.end(err.reason || 'Invalid request body');
@@ -68,7 +68,7 @@ function sequence(handlers) {
* @param {import('http').IncomingHttpHeaders} headers
* @returns
*/
-function get_base(headers) {
+function get_origin(headers) {
const protocol = (protocol_header && headers[protocol_header]) || 'https';
const host = headers[host_header];
return `${protocol}://${host}`;

diff:
@@ -2,7 +2,7 @@ declare global {
const PATH_ENV: string;
const HOST_ENV: string;
const PORT_ENV: string;
- const BASE_ENV: string;
+ const ORIGIN_ENV: string;
const PROTOCOL_HEADER: string;
const HOST_HEADER: string;

original_message: [fix] rename `BASE` to `ORIGIN` and fix config handling (#3423)


message:
[fix] force Vite dev mode to use HTTP/1 for TLS
* [fix] force Vite dev mode to use HTTP/1 for TLS
This avoids issues with node-fetch and HTTP/2 Request headers, which was
breaking our `dev --https`.
* add changeset
* only set server.proxy when server.https is present

diff:
+---
+'@sveltejs/kit': patch
+---
+
+Force Vite to use HTTP/1 in dev mode, so `dev --https` works again

diff:
@@ -85,6 +85,14 @@ export async function dev({ cwd, port, host, https, config }) {
merged_config.server.https = https;
}
+ // by default, when enabling HTTPS in Vite, it also enables HTTP/2
+ // however, node-fetch's Request implementation does not like the HTTP/2 headers
+ // we set a no-op proxy config to force Vite to downgrade to TLS-only
+ // see https://vitejs.dev/config/#server-https
+ if (merged_config.server.https && !merged_config.server.proxy) {
+ merged_config.server.proxy = {};
+ }
+
if (port) {
merged_config.server.port = port;
}

original_message:
[fix] force Vite dev mode to use HTTP/1 for TLS (#3553)

* [fix] force Vite dev mode to use HTTP/1 for TLS

This avoids issues with node-fetch and HTTP/2 Request headers, which was
breaking our `dev --https`.

* add changeset

* only set server.proxy when server.https is present


message: Exclude keys common for T and U

diff:
@@ -13,7 +13,7 @@ export type JSONString =
export type ResponseHeaders = Record<string, string | string[]>;
// <-- Utility Types -->
-type Only<T, U> = { [P in keyof T]: T[P] } & { [P in keyof U]?: never };
+type Only<T, U> = { [P in keyof T]: T[P] } & { [P in Exclude<keyof U, keyof T>]?: never };
export type Either<T, U> = Only<T, U> | Only<U, T>;
export type InferValue<T, Key extends keyof T, Default> = T extends Record<Key, infer Val>

original_message: Exclude keys common for T and U (#3465)


diff:
@@ -30,8 +30,6 @@ As with [endpoints](/docs/routing#endpoints), pages can import [generated types]
`load` is similar to `getStaticProps` or `getServerSideProps` in Next.js, except that `load` runs on both the server and the client. In the example above, if a user clicks on a link to this page the data will be fetched from `cms.example.com` without going via our server.
-If `load` returns `{fallthrough: true}`, SvelteKit will [fall through](/docs/routing#advanced-routing-fallthrough-routes) to other routes until something responds, or will respond with a generic 404.
-
SvelteKit's `load` receives an implementation of `fetch`, which has the following special properties:
- it has access to cookies on the server

diff:
@@ -113,7 +113,7 @@ You access them differently in SvelteKit. `stores` is now `getStores`, but in mo
#### Routing
-Regex routes are no longer supported. Instead, use [fallthrough routes](/docs/routing#advanced-routing-fallthrough-routes).
+Regex routes are no longer supported. Instead, use [advanced route matching](/docs/routing#advanced-routing-matching).
#### URLs

diff:
----
-title: Why am I getting a 404?
----
-
-Please make sure you're returning something from your page's `load` function. See the section about [fallthrough routes](/docs/routing#advanced-routing-fallthrough-routes) for more details.

original_message: [docs] remove references to route fallthrough (#4377)


diff:
+---
+'@sveltejs/kit': patch
+---
+
+[fix] don't use client-side navigation when clicking on a link to the same path on a different origin

diff:
@@ -202,7 +202,11 @@ export function create_client({ target, session, base, trailing_slash }) {
const current_token = (token = {});
let navigation_result = intent && (await load_route(intent, no_cache));
- if (!navigation_result && url.pathname === location.pathname) {
+ if (
+ !navigation_result &&
+ url.origin === location.origin &&
+ url.pathname === location.pathname
+ ) {
// this could happen in SPA fallback mode if the user navigated to
// `/non-existent-page`. if we fall back to reloading the page, it
// will create an infinite loop. so whereas we normally handle

original_message: [fix] don't use client-side router for same path on different origin (#4433)


message: [docs] remove references to tag

diff:
@@ -23,7 +23,7 @@ You can now run SvelteKit by linking it into your project with [pnpm `overrides`
Entry points to be aware of are:
-- [`packages/create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) - code that's run when you create a new project with `npm init svelte@next`
+- [`packages/create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) - code that's run when you create a new project with `npm init svelte`
- [`packages/kit/src/packaging`](https://github.com/sveltejs/kit/tree/master/packages/kit/src/packaging) - for the `svelte-kit package` command
- [`packages/kit/src/core/dev/index.js`](https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/dev/index.js) - for the dev-mode server
- [`packages/kit/src/core/build/index.js`](https://github.com/sveltejs/kit/blob/master/packages/kit/src/core/build/index.js) - for the production server

diff:
@@ -23,7 +23,7 @@ You don't need to know Svelte to understand the rest of this guide, but it will
The easiest way to start building a SvelteKit app is to run `npm init`:
```bash
-npm init svelte@next my-app
+npm init svelte my-app
cd my-app
npm install
npm run dev

diff:
@@ -20,7 +20,7 @@ You can deploy to the following platforms with the default adapter, `adapter-aut
#### Node.js
-To create a simple Node server, install the [`@sveltejs/adapter-node@next`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) package and update your `svelte.config.js`:
+To create a simple Node server, install the [`@sveltejs/adapter-node`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) package and update your `svelte.config.js`:
```diff
/// file: svelte.config.js
@@ -44,7 +44,7 @@ export default {
#### Static sites
-Most adapters will generate static HTML for any [prerenderable](/docs/page-options#prerender) pages of your site. In some cases, your entire app might be prerenderable, in which case you can use [`@sveltejs/adapter-static@next`](https://github.com/sveltejs/kit/tree/master/packages/adapter-static) to generate static HTML for _all_ your pages. A fully static site can be hosted on a wide variety of platforms, including static hosts like [GitHub Pages](https://pages.github.com/).
+Most adapters will generate static HTML for any [prerenderable](/docs/page-options#prerender) pages of your site. In some cases, your entire app might be prerenderable, in which case you can use [`@sveltejs/adapter-static`](https://github.com/sveltejs/kit/tree/master/packages/adapter-static) to generate static HTML for _all_ your pages. A fully static site can be hosted on a wide variety of platforms, including static hosts like [GitHub Pages](https://pages.github.com/).
```diff
/// file: svelte.config.js

diff:
@@ -17,7 +17,7 @@ _**Comparisons**_
## Usage
-Install with `npm i -D @sveltejs/adapter-cloudflare-workers@next`, then add the adapter to your `svelte.config.js`:
+Install with `npm i -D @sveltejs/adapter-cloudflare-workers`, then add the adapter to your `svelte.config.js`:
```js
import adapter from '@sveltejs/adapter-cloudflare-workers';

diff:
@@ -20,7 +20,7 @@ _**Comparisons**_
## Installation
```sh
-$ npm i --save-dev @sveltejs/adapter-cloudflare@next
+$ npm i --save-dev @sveltejs/adapter-cloudflare
```
## Usage

diff:
## Usage
-Install with `npm i -D @sveltejs/adapter-node@next`, then add the adapter to your `svelte.config.js`:
+Install with `npm i -D @sveltejs/adapter-node`, then add the adapter to your `svelte.config.js`:
```js
// svelte.config.js

diff:
## Usage
-Install with `npm i -D @sveltejs/adapter-static@next`, then add the adapter to your `svelte.config.js`:
+Install with `npm i -D @sveltejs/adapter-static`, then add the adapter to your `svelte.config.js`:
```js
// svelte.config.js

diff:
@@ -8,14 +8,12 @@ If you're seeing this, you've probably already done this step. Congrats!
```bash
# create a new project in the current directory
-npm init svelte@next
+npm init svelte
# create a new project in my-app
-npm init svelte@next my-app
+npm init svelte my-app
```
-> Note: the `@next` is temporary
-
## Developing
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

diff:
following into your command line and following the prompts:

-
-
npm init svelte@next

+
npm init svelte

The page you're looking at is purely static HTML, with no client-side interactivity needed.

diff:
@@ -5,7 +5,7 @@ This is the [SvelteKit](https://kit.svelte.dev) framework and CLI.
The quickest way to get started is via the [create-svelte](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) package:
```bash
-npm init svelte@next my-app
+npm init svelte my-app
cd my-app
npm install
npm run dev

diff:
-npm init svelte@next my-app
+npm init svelte my-app
cd my-app
npm install
npm run dev -- --open

original_message: [docs] remove references to @next tag (#4577)


diff:
@@ -16,7 +16,6 @@ importers:
eslint: ^8.3.0
eslint-plugin-import: ^2.25.3
eslint-plugin-svelte3: ^3.2.1
- playwright-chromium: ^1.21.0
prettier: ^2.5.0
rollup: ^2.60.2
turbo: ^1.2.3
@@ -34,7 +33,6 @@ importers:
eslint: 8.3.0
eslint-plugin-import: 2.25.3_eslint@8.3.0
eslint-plugin-svelte3: 3.2.1_eslint@8.3.0
- playwright-chromium: 1.21.0
prettier: 2.5.0
rollup: 2.60.2
turbo: 1.2.3

original_message: [chore] clean up playwright-chromium root dependency (#4517)


diff:
-name: 'Environment'
-
-description: 'Set variables based on the environment'
-
-outputs:
- pnpm_cache_path:
- description: 'the pnpm cache path'
- browser_cache_path:
- description: 'The browser cache path'
-
-runs:
- using: 'node12'
- main: 'action/main.js'

diff:
-'use strict';
-
-var require$$0 = require('os');
-var require$$0$1 = require('fs');
-var require$$1 = require('path');
-
-function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
-
-var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
-var require$$0__default$1 = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
-var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
-
-var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
-
-function getDefaultExportFromCjs (x) {
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
-}
-
-function createCommonjsModule(fn) {
- var module = { exports: {} };
- return fn(module, module.exports), module.exports;
-}
-
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
-
-/**
- * Sanitizes an input into a string so it can be passed into issueCommand safely
- * @param input input to sanitize into a string
- */
-function toCommandValue(input) {
- if (input === null || input === undefined) {
- return '';
- }
- else if (typeof input === 'string' || input instanceof String) {
- return input;
- }
- return JSON.stringify(input);
-}
-var toCommandValue_1 = toCommandValue;
-
-
-var utils = /*#__PURE__*/Object.defineProperty({
- toCommandValue: toCommandValue_1
-}, '__esModule', {value: true});
-
-var __importStar$1 = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
-
-const os$1 = __importStar$1(require$$0__default['default']);
-
-/**
- * Commands
- *
- * Command Format:
- * ::name key=value,key=value::message
- *
- * Examples:
- * ::warning::This is the message
- * ::set-env name=MY_VAR::some value
- */
-function issueCommand$1(command, properties, message) {
- const cmd = new Command(command, properties, message);
- process.stdout.write(cmd.toString() + os$1.EOL);
-}
-var issueCommand_1$1 = issueCommand$1;
-function issue(name, message = '') {
- issueCommand$1(name, {}, message);
-}
-var issue_1 = issue;
-const CMD_STRING = '::';
-class Command {
- constructor(command, properties, message) {
- if (!command) {
- command = 'missing.command';
- }
- this.command = command;
- this.properties = properties;
- this.message = message;
- }
- toString() {
- let cmdStr = CMD_STRING + this.command;
- if (this.properties && Object.keys(this.properties).length > 0) {
- cmdStr += ' ';
- let first = true;
- for (const key in this.properties) {
- if (this.properties.hasOwnProperty(key)) {
- const val = this.properties[key];
- if (val) {
- if (first) {
- first = false;
- }
- else {
- cmdStr += ',';
- }
- cmdStr += `${key}=${escapeProperty(val)}`;
- }
- }
- }
- }
- cmdStr += `${CMD_STRING}${escapeData(this.message)}`;
- return cmdStr;
- }
-}
-function escapeData(s) {
- return utils.toCommandValue(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A');
-}
-function escapeProperty(s) {
- return utils.toCommandValue(s)
- .replace(/%/g, '%25')
- .replace(/\r/g, '%0D')
- .replace(/\n/g, '%0A')
- .replace(/:/g, '%3A')
- .replace(/,/g, '%2C');
-}
-
-
-var command = /*#__PURE__*/Object.defineProperty({
- issueCommand: issueCommand_1$1,
- issue: issue_1
-}, '__esModule', {value: true});
-
-// For internal use, subject to change.
-var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
-
-// We use any as a valid input type
-/* eslint-disable @typescript-eslint/no-explicit-any */
-const fs = __importStar(require$$0__default$1['default']);
-const os = __importStar(require$$0__default['default']);
-
-function issueCommand(command, message) {
- const filePath = process.env[`GITHUB_${command}`];
- if (!filePath) {
- throw new Error(`Unable to find environment variable for file command ${command}`);
- }
- if (!fs.existsSync(filePath)) {
- throw new Error(`Missing file at path: ${filePath}`);
- }
- fs.appendFileSync(filePath, `${utils.toCommandValue(message)}${os.EOL}`, {
- encoding: 'utf8'
- });
-}
-var issueCommand_1 = issueCommand;
-
-
-var fileCommand = /*#__PURE__*/Object.defineProperty({
- issueCommand: issueCommand_1
-}, '__esModule', {value: true});
-
-var core = createCommonjsModule(function (module, exports) {
-var __awaiter = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
-};
-var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
- result["default"] = mod;
- return result;
-};
-Object.defineProperty(exports, "__esModule", { value: true });
-
-
-
-const os = __importStar(require$$0__default['default']);
-const path = __importStar(require$$1__default['default']);
-/**
- * The code to exit an action
- */
-var ExitCode;
-(function (ExitCode) {
- /**
- * A code indicating that the action was successful
- */
- ExitCode[ExitCode["Success"] = 0] = "Success";
- /**
- * A code indicating that the action was a failure
- */
- ExitCode[ExitCode["Failure"] = 1] = "Failure";
-})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
-//-----------------------------------------------------------------------
-// Variables
-//-----------------------------------------------------------------------
-/**
- * Sets env variable for this action and future actions in the job
- * @param name the name of the variable to set
- * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function exportVariable(name, val) {
- const convertedVal = utils.toCommandValue(val);
- process.env[name] = convertedVal;
- const filePath = process.env['GITHUB_ENV'] || '';
- if (filePath) {
- const delimiter = '_GitHubActionsFileCommandDelimeter_';
- const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
- fileCommand.issueCommand('ENV', commandValue);
- }
- else {
- command.issueCommand('set-env', { name }, convertedVal);
- }
-}
-exports.exportVariable = exportVariable;
-/**
- * Registers a secret which will get masked from logs
- * @param secret value of the secret
- */
-function setSecret(secret) {
- command.issueCommand('add-mask', {}, secret);
-}
-exports.setSecret = setSecret;
-/**
- * Prepends inputPath to the PATH (for this action and future actions)
- * @param inputPath
- */
-function addPath(inputPath) {
- const filePath = process.env['GITHUB_PATH'] || '';
- if (filePath) {
- fileCommand.issueCommand('PATH', inputPath);
- }
- else {
- command.issueCommand('add-path', {}, inputPath);
- }
- process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
-}
-exports.addPath = addPath;
-/**
- * Gets the value of an input. The value is also trimmed.
- *
- * @param name name of the input to get
- * @param options optional. See InputOptions.
- * @returns string
- */
-function getInput(name, options) {
- const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
- if (options && options.required && !val) {
- throw new Error(`Input required and not supplied: ${name}`);
- }
- return val.trim();
-}
-exports.getInput = getInput;
-/**
- * Sets the value of an output.
- *
- * @param name name of the output to set
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function setOutput(name, value) {
- command.issueCommand('set-output', { name }, value);
-}
-exports.setOutput = setOutput;
-/**
- * Enables or disables the echoing of commands into stdout for the rest of the step.
- * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
- *
- */
-function setCommandEcho(enabled) {
- command.issue('echo', enabled ? 'on' : 'off');
-}
-exports.setCommandEcho = setCommandEcho;
-//-----------------------------------------------------------------------
-// Results
-//-----------------------------------------------------------------------
-/**
- * Sets the action status to failed.
- * When the action exits it will be with an exit code of 1
- * @param message add error issue message
- */
-function setFailed(message) {
- process.exitCode = ExitCode.Failure;
- error(message);
-}
-exports.setFailed = setFailed;
-//-----------------------------------------------------------------------
-// Logging Commands
-//-----------------------------------------------------------------------
-/**
- * Gets whether Actions Step Debug is on or not
- */
-function isDebug() {
- return process.env['RUNNER_DEBUG'] === '1';
-}
-exports.isDebug = isDebug;
-/**
- * Writes debug message to user log
- * @param message debug message
- */
-function debug(message) {
- command.issueCommand('debug', {}, message);
-}
-exports.debug = debug;
-/**
- * Adds an error issue
- * @param message error issue message. Errors will be converted to string via toString()
- */
-function error(message) {
- command.issue('error', message instanceof Error ? message.toString() : message);
-}
-exports.error = error;
-/**
- * Adds an warning issue
- * @param message warning issue message. Errors will be converted to string via toString()
- */
-function warning(message) {
- command.issue('warning', message instanceof Error ? message.toString() : message);
-}
-exports.warning = warning;
-/**
- * Writes info to log with console.log.
- * @param message info message
- */
-function info(message) {
- process.stdout.write(message + os.EOL);
-}
-exports.info = info;
-/**
- * Begin an output group.
- *
- * Output until the next `groupEnd` will be foldable in this group
- *
- * @param name The name of the output group
- */
-function startGroup(name) {
- command.issue('group', name);
-}
-exports.startGroup = startGroup;
-/**
- * End an output group.
- */
-function endGroup() {
- command.issue('endgroup');
-}
-exports.endGroup = endGroup;
-/**
- * Wrap an asynchronous function call in a group.
- *
- * Returns the same type as the function itself.
- *
- * @param name The name of the group
- * @param fn The function to wrap in the group
- */
-function group(name, fn) {
- return __awaiter(this, void 0, void 0, function* () {
- startGroup(name);
- let result;
- try {
- result = yield fn();
- }
- finally {
- endGroup();
- }
- return result;
- });
-}
-exports.group = group;
-//-----------------------------------------------------------------------
-// Wrapper action state
-//-----------------------------------------------------------------------
-/**
- * Saves state for current action, the state can only be retrieved by this action's post job execution.
- *
- * @param name name of the state to store
- * @param value value to store. Non-string values will be converted to a string via JSON.stringify
- */
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-function saveState(name, value) {
- command.issueCommand('save-state', { name }, value);
-}
-exports.saveState = saveState;
-/**
- * Gets the value of an state set by this action's main execution.
- *
- * @param name name of the state to get
- * @returns string
- */
-function getState(name) {
- return process.env[`STATE_${name}`] || '';
-}
-exports.getState = getState;
-//# sourceMappingURL=core.js.map
-});
-
-var core$1 = /*@__PURE__*/getDefaultExportFromCjs(core);
-
-const WINDOWS_CACHE_PATH = 'D:\\.pnpm-store\\v3';
-const NIX_CACHE_PATH = '~/.pnpm-store/v3';
-const WINDOWS_BROWSER_PATH = require$$1.join(require$$0.homedir(), 'AppData', 'Local', 'ms-playwright');
-const LINUX_BROWSER_PATH = '~/.cache/ms-playwright';
-const MACOS_BROWSER_PATH = '~/Library/Caches/ms-playwright';
-
-const paths = {
- win32: {
- browser: WINDOWS_BROWSER_PATH,
- cache: WINDOWS_CACHE_PATH
- },
- linux: {
- browser: LINUX_BROWSER_PATH,
- cache: NIX_CACHE_PATH
- },
- darwin: {
- browser: MACOS_BROWSER_PATH,
- cache: NIX_CACHE_PATH
- }
-};
-
-function run() {
- const os = require$$0.platform();
-
- core$1.setOutput('pnpm_cache_path', paths[os].cache);
- core$1.setOutput('browser_cache_path', paths[os].browser);
-}
-
-run();

diff:
-import core from '@actions/core';
-import { homedir, platform } from 'os';
-import { join } from 'path';
-
-const WINDOWS_CACHE_PATH = 'D:\\.pnpm-store\\v3';
-const NIX_CACHE_PATH = '~/.pnpm-store/v3';
-const WINDOWS_BROWSER_PATH = join(homedir(), 'AppData', 'Local', 'ms-playwright');
-const LINUX_BROWSER_PATH = '~/.cache/ms-playwright';
-const MACOS_BROWSER_PATH = '~/Library/Caches/ms-playwright';
-
-const paths = {
- win32: {
- browser: WINDOWS_BROWSER_PATH,
- cache: WINDOWS_CACHE_PATH
- },
- linux: {
- browser: LINUX_BROWSER_PATH,
- cache: NIX_CACHE_PATH
- },
- darwin: {
- browser: MACOS_BROWSER_PATH,
- cache: NIX_CACHE_PATH
- }
-};
-
-function run() {
- const os = platform();
-
- core.setOutput('pnpm_cache_path', paths[os].cache);
- core.setOutput('browser_cache_path', paths[os].browser);
-}
-
-run();

diff:
-{
- "name": "set-env-action",
- "version": "1.0.0",
- "description": "Action to set environment",
- "main": "action/main.js",
- "private": true,
- "scripts": {
- "build": "rollup -c"
- },
- "repository": {
- "type": "git",
- "url": "git+https://github.com/sveltejs/kit.git"
- },
- "license": "MIT",
- "devDependencies": {
- "@actions/core": "^1.6.0"
- }
-}

diff:
-import resolve from '@rollup/plugin-node-resolve';
-import cjs from '@rollup/plugin-commonjs';
-
-export default [
- {
- plugins: [cjs(), resolve()],
- input: 'main.js',
- output: [
- {
- file: 'action/main.js',
- format: 'cjs',
- sourcemap: false
- }
- ]
- }
-];

diff:
@@ -7,7 +7,6 @@ on:
pull_request:
env:
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: svelte
@@ -50,18 +49,7 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- - name: Get paths for OS
- uses: ./.github/actions/env
- id: paths
- - name: Cache browsers
- id: browser_cache
- uses: actions/cache@main
- with:
- path: ${{ steps.paths.outputs.browser_cache_path }}
- key: chromium-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
- run: pnpm install --frozen-lockfile
- env:
- PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: ${{ steps.browser_cache.outputs.cache-hit == 'true' }}
- run: pnpm turbo run test
- name: archive test results
if: failure()

diff:
@@ -36,12 +36,6 @@ importers:
turbo: 1.2.3
typescript: 4.6.2
- .github/actions/env:
- specifiers:
- '@actions/core': ^1.6.0
- devDependencies:
- '@actions/core': 1.6.0
-
packages/adapter-auto:
specifiers:
'@sveltejs/adapter-cloudflare': workspace:*
@@ -444,18 +438,6 @@ importers:
packages:
- /@actions/core/1.6.0:
- resolution: {integrity: sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==}
- dependencies:
- '@actions/http-client': 1.0.11
- dev: true
-
- /@actions/http-client/1.0.11:
- resolution: {integrity: sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==}
- dependencies:
- tunnel: 0.0.6
- dev: true
-
/@babel/code-frame/7.16.0:
resolution: {integrity: sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==}
engines: {node: '>=6.9.0'}
@@ -5654,11 +5636,6 @@ packages:
safe-buffer: 5.1.2
dev: true
- /tunnel/0.0.6:
- resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
- engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
- dev: true
-
/turbo-darwin-64/1.2.3:
resolution: {integrity: sha512-lJRPC9SJtWzEkqbjYROJ7MD/kki+y1hAGoEujC9gb6zoAAxY7qBN+N30EkfyFIfAiZUQ6RRydETIdeUTnvZ0jw==}
cpu: [x64]

diff:
@@ -4,4 +4,3 @@ packages:
- 'packages/kit/test/apps/*'
- 'packages/kit/test/prerendering/*'
- 'packages/create-svelte/templates/*'
- - '.github/actions/*'

original_message: [chore] remove env GH action and browser caching (#4728)


diff:
"description": "monorepo for @sveltejs/kit and friends",
"private": true,
"scripts": {
- "build": "turbo run build",
+ "build": "turbo run build --filter=./packages/*",
"test": "turbo run test --filter=./packages/*",
"check": "turbo run check",
"lint": "turbo run lint",

original_message: filter top-level 'pnpm build' to just packages (#5388)


message:
[fix] omit Content-Length header from requests made by load fetch
* [fix] exclude Content-Length when forwarding headers for SSR
Fixes
* add changeset

diff:
+---
+'@sveltejs/kit': patch
+---
+
+[fix] prevent `Content-Length` header from being incorrectly inherited by requests made from `load`'s `fetch` during SSR

diff:
@@ -52,6 +52,7 @@ export function create_fetch({ event, options, state, route }) {
if (
key !== 'authorization' &&
key !== 'connection' &&
+ key !== 'content-length' &&
key !== 'cookie' &&
key !== 'host' &&
key !== 'if-none-match' &&

original_message:
[fix] omit Content-Length header from requests made by load fetch (#5922)

* [fix] exclude Content-Length when forwarding headers for SSR

Fixes #5870

* add changeset


diff:
"name": "skeleton-template",
"version": "0.0.1-next.0",
"devDependencies": {
- "@sveltejs/adapter-auto": "workspace:1.0.0-next.64"
+ "@sveltejs/adapter-auto": "workspace:*"
},
"type": "module"
}

diff:
@@ -262,7 +262,7 @@ importers:
packages/create-svelte/templates/skeleton:
specifiers:
- '@sveltejs/adapter-auto': workspace:1.0.0-next.64
+ '@sveltejs/adapter-auto': workspace:*
devDependencies:
'@sveltejs/adapter-auto': link:../../../adapter-auto

original_message: use workspace:* for adapter-auto in create-svelte skeleton template (#6125)


message: [breaking] require Node 16.14

diff:
+---
+'@sveltejs/kit': patch
+'@sveltejs/package': patch
+---
+
+[breaking] require Node 16.14

diff:
@@ -49,7 +49,7 @@ When configuring your project settings, you must use the following settings:
- **Environment variables**
- `NODE_VERSION`: `16`
-> **Important:** You need to add a `NODE_VERSION` environment variable to both the "production" and "preview" environments. You can add this during project setup or later in the Pages project settings. SvelteKit requires Node `16.9` or later, so you should use `16` as the `NODE_VERSION` value.
+> **Important:** You need to add a `NODE_VERSION` environment variable to both the "production" and "preview" environments. You can add this during project setup or later in the Pages project settings. SvelteKit requires Node `16.14` or later, so you should use `16` as the `NODE_VERSION` value.
## Environment variables

original_message: [breaking] require Node 16.14 (#6388)


diff:
@@ -327,8 +327,6 @@ If an _unexpected_ error is thrown, SvelteKit will invoke [`handleError`](/docs/
To redirect users, use the `redirect` helper from `@sveltejs/kit` to specify the location to which they should be redirected alongside a `3xx` status code.
-> There is a known bug with `redirect`: it will currently fail during client-side navigation, due to [#5952](https://github.com/sveltejs/kit/issues/5952)
-
```diff
/// file: src/routes/admin/+layout.server.js
-import { error } from '@sveltejs/kit';

original_message: [docs] remove warning about `redirect` bug (#6403)


diff:
@@ -29,7 +29,7 @@ npm install
npm run dev
```
-The first command will scaffold a new project in the `my-app` directory asking you if you'd like to set up some basic tooling such as TypeScript. See the FAQ for [pointers on setting up additional tooling](https://kit.svelte.dev/faq#integrations). The subsequent commands will then install its dependencies and start a server on [localhost:5173](http://localhost:5173).
+The first command will scaffold a new project in the `my-app` directory asking you if you'd like to set up some basic tooling such as TypeScript. See the FAQ for [pointers on setting up additional tooling](/faq#integrations). The subsequent commands will then install its dependencies and start a server on [localhost:5173](http://localhost:5173).
There are two basic concepts:

original_message: [docs] remove absolute host from some internal docs links (#6742)


message: [docs] fix Markdown lint

diff:
@@ -92,7 +92,7 @@ export default {
};
```
-> How to configure this behaviour does however depend on your hosting solution and is not part of SvelteKit, it is recommended to search the host's documentation on how to redirect requests.
+> How to configure this behaviour does however depend on your hosting solution and is not part of SvelteKit. It is recommended to search the host's documentation on how to redirect requests.
When operating in SPA mode, you can omit the [`prerender`](https://kit.svelte.dev/docs/page-options#prerender) option from your root layout (or set it to `false`, its default value), and only pages that have the `prerender` option set will be prerendered at build time.

original_message: [docs] fix Markdown lint


message: [fix] revert incorrect change to changeset

diff:
'@sveltejs/adapter-netlify': patch
'@sveltejs/adapter-node': patch
'@sveltejs/adapter-vercel': patch
-'create-svelte': patch
---
-Update to esbuild 0.15 / Vite ^3.1
+Update to esbuild 0.15


message:
[chore] bump undici for multipart form data support
* bump undici in kit, remove node-fetch
* remove node-fetch from adapter-node
It's used in the tests, but those aren't running currently anyway, so
let's revisit this later.
* update lockfile
* update polyfill to use pure undici
* add changeset

diff:
+---
+'@sveltejs/kit': patch
+---
+
+[chore] Upgrade undici so that we can use its multipart form data parsing instead of node-fetch's

diff:
import { fetch, Response, Request, Headers, FormData } from 'undici';
import { ReadableStream, TransformStream, WritableStream } from 'stream/web';
-import { Readable } from 'stream';
-import { Request as NodeFetchRequest } from 'node-fetch';
import { webcrypto as crypto } from 'crypto';
/** @type {Record<string, any>} */
@@ -9,24 +7,7 @@ const globals = {
crypto,
fetch,
Response,
- // TODO remove the superclass as soon as Undici supports formData
- // https://github.com/nodejs/undici/issues/974
- Request: class extends Request {
- // @ts-expect-error
- async formData() {
- const nodeFetchFormData = await new NodeFetchRequest(this.url, {
- method: this.method,
- headers: this.headers,
- body: this.body && Readable.from(this.body)
- }).formData();
-
- const formData = new FormData();
- for (const [name, value] of nodeFetchFormData.entries()) {
- formData.append(name, value);
- }
- return formData;
- }
- },
+ Request,
Headers,
ReadableStream,
TransformStream,

diff:
@@ -120,7 +120,6 @@ importers:
'@sveltejs/kit': workspace:*
'@types/node': ^16.11.36
c8: ^7.11.3
- node-fetch: ^3.2.4
polka: ^1.0.0-next.22
rimraf: ^3.0.2
rollup: ^2.78.1
@@ -136,7 +135,6 @@ importers:
'@sveltejs/kit': link:../kit
'@types/node': 16.11.42
c8: 7.11.3
- node-fetch: 3.2.6
polka: 1.0.0-next.22
rimraf: 3.0.2
sirv: 2.0.2
@@ -282,7 +280,6 @@ importers:
magic-string: ^0.26.2
marked: ^4.0.16
mime: ^3.0.0
- node-fetch: ^3.2.4
rollup: ^2.78.1
sade: ^1.8.1
set-cookie-parser: ^2.4.8
@@ -291,7 +288,7 @@ importers:
svelte-preprocess: ^4.10.6
tiny-glob: ^0.2.9
typescript: ^4.8.2
- undici: ^5.8.1
+ undici: ^5.11.0
uvu: ^0.5.3
vite: ^3.1.1
dependencies:
@@ -302,12 +299,11 @@ importers:
kleur: 4.1.5
magic-string: 0.26.2
mime: 3.0.0
- node-fetch: 3.2.6
sade: 1.8.1
set-cookie-parser: 2.5.0
sirv: 2.0.2
tiny-glob: 0.2.9
- undici: 5.8.1
+ undici: 5.11.0
devDependencies:
'@playwright/test': 1.25.0
'@types/connect': 3.4.35
@@ -1505,6 +1501,13 @@ packages:
resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==}
engines: {node: '>=6'}
+ /busboy/1.6.0:
+ resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==}
+ engines: {node: '>=10.16.0'}
+ dependencies:
+ streamsearch: 1.1.0
+ dev: false
+
/c8/7.11.3:
resolution: {integrity: sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==}
engines: {node: '>=10.12.0'}
@@ -1776,10 +1779,6 @@ packages:
stream-transform: 2.1.3
dev: true
- /data-uri-to-buffer/4.0.0:
- resolution: {integrity: sha512-Vr3mLBA8qWmcuschSLAOogKgQ/Jwxulv3RNE4FXnYWRGujzrRWQI4m12fQqRkwX06C0KanhLr4hK+GydchZsaA==}
- engines: {node: '>= 12'}
-
/dataloader/1.4.0:
resolution: {integrity: sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==}
dev: true
@@ -2218,13 +2217,6 @@ packages:
reusify: 1.0.4
dev: true
- /fetch-blob/3.1.5:
- resolution: {integrity: sha512-N64ZpKqoLejlrwkIAnb9iLSA3Vx/kjgzpcDhygcqJ2KKjky8nCgUQ+dzXtbrLaWZGZNmNfQTsiQ0weZ1svglHg==}
- engines: {node: ^12.20 || >= 14.13}
- dependencies:
- node-domexception: 1.0.0
- web-streams-polyfill: 3.2.1
-
/file-uri-to-path/1.0.0:
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
dev: false
@@ -2277,12 +2269,6 @@ packages:
signal-exit: 3.0.7
dev: true
- /formdata-polyfill/4.0.10:
- resolution: {integrity: sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==}
- engines: {node: '>=12.20.0'}
- dependencies:
- fetch-blob: 3.1.5
-
/fs-constants/1.0.0:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
dev: true
@@ -3103,10 +3089,6 @@ packages:
resolution: {integrity: sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==}
dev: true
- /node-domexception/1.0.0:
- resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
- engines: {node: '>=10.5.0'}
-
/node-fetch/2.6.7:
resolution: {integrity: sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==}
engines: {node: 4.x || >=6.0.0}
@@ -3118,14 +3100,6 @@ packages:
dependencies:
whatwg-url: 5.0.0
- /node-fetch/3.2.6:
- resolution: {integrity: sha512-LAy/HZnLADOVkVPubaxHDft29booGglPFDr2Hw0J1AercRh01UiVFm++KMDnJeH9sHgNB4hsXPii7Sgym/sTbw==}
- engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
- dependencies:
- data-uri-to-buffer: 4.0.0
- fetch-blob: 3.1.5
- formdata-polyfill: 4.0.10
-
/node-gyp-build/4.5.0:
resolution: {integrity: sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==}
hasBin: true
@@ -3960,6 +3934,11 @@ packages:
mixme: 0.5.4
dev: true
+ /streamsearch/1.1.0:
+ resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
+ engines: {node: '>=10.0.0'}
+ dev: false
+
/string-width/1.0.2:
resolution: {integrity: sha512-0XsVpQLnVCXHJfyEs8tC0zpTVIr5PKKsQtkT29IwupnPTjtPmQ3xT/4yCREF9hYkV/3M3kzcUTSAZT6a6h81tw==}
engines: {node: '>=0.10.0'}
@@ -4531,9 +4510,11 @@ packages:
which-boxed-primitive: 1.0.2
dev: true
- /undici/5.8.1:
- resolution: {integrity: sha512-iDRmWX4Zar/4A/t+1LrKQRm102zw2l9Wgat3LtTlTn8ykvMZmAmpq9tjyHEigx18FsY7IfATvyN3xSw9BDz0eA==}
+ /undici/5.11.0:
+ resolution: {integrity: sha512-oWjWJHzFet0Ow4YZBkyiJwiK5vWqEYoH7BINzJAJOLedZ++JpAlCbUktW2GQ2DS2FpKmxD/JMtWUUWl1BtghGw==}
engines: {node: '>=12.18'}
+ dependencies:
+ busboy: 1.6.0
dev: false
/universalify/0.1.2:
@@ -4636,10 +4617,6 @@ packages:
defaults: 1.0.3
dev: true
- /web-streams-polyfill/3.2.1:
- resolution: {integrity: sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==}
- engines: {node: '>= 8'}
-
/webidl-conversions/3.0.1:
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}

original_message:
[chore] bump undici for multipart form data support (#7131)

* bump undici in kit, remove node-fetch

* remove node-fetch from adapter-node

It's used in the tests, but those aren't running currently anyway, so
let's revisit this later.

* update lockfile

* update polyfill to use pure undici

* add changeset


message:
remove build url setting from teletraan
remove pinterest specific string in teletraan worker

diff:
@@ -215,7 +215,7 @@ DISPLAY_STOPPING_HOSTS = os.getenv("DISPLAY_STOPPING_HOSTS", "true")
# Pinterest specific settings
IS_PINTEREST = True if os.getenv("IS_PINTEREST", "false") == "true" else False
-BUILD_URL = "https://jenkins.pinadmin.com/job/"
+BUILD_URL = os.getenv("BUILD_URL", None)
TELETRAAN_DISABLE_CREATE_ENV_PAGE = True if os.getenv("TELETRAAN_DISABLE_CREATE_ENV_PAGE", "false") == "true" else False
TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL = os.getenv("TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL", None)

diff:
@@ -152,7 +152,7 @@ public class HotfixStateTransitioner implements Runnable {
// Jenkins job has returned a failure status
if (status.equals("FAILURE")) {
hotBean.setState(HotfixState.FAILED);
- hotBean.setError_message("Failed to create hotfix, see https://jenkins.pinadmin.com/job/" +
+ hotBean.setError_message("Failed to create hotfix, see " + jenkinsUrl +
hotBean.getJob_name() + "/" + hotBean.getJob_num() + "/console for more details");
hotfixDAO.update(hotfixId, hotBean);
LOG.warn("Jenkins returned a FAILURE status during state PUSHING for hotfix id " + hotfixId);
@@ -178,7 +178,7 @@ public class HotfixStateTransitioner implements Runnable {
// Jenkins job has returned a failure status
if (status.equals("FAILURE")) {
hotBean.setState(HotfixState.FAILED);
- hotBean.setError_message("Failed to build hotfix, see https://jenkins.pinadmin.com/job/" +
+ hotBean.setError_message("Failed to build hotfix, see " + jenkinsUrl +
hotBean.getJob_name() + "/" + hotBean.getJob_num() + "/console for more details");
hotfixDAO.update(hotfixId, hotBean);
LOG.warn("Jenkins returned a FAILURE status during state BUILDING for hotfix id " + hotfixId);

license: Apache License 2.0

repo: pinterest/teletraan

original_message:
remove build url setting from teletraan (#632)

remove pinterest specific string in teletraan worker


message:
Modify python import and settings for updating Django version
remove unused options in context_processors
correct doc links

diff:
Django settings for deploy_board project.
For more information on this file, see
-https://docs.djangoproject.com/en/1.6/topics/settings/
+https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
-https://docs.djangoproject.com/en/1.6/ref/settings/
+https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@@ -32,9 +32,18 @@ BASE_DIR = os.path.dirname(__file__)
PROJECT_PATH = BASE_DIR
-TEMPLATE_DIRS = (
- os.path.join(BASE_DIR, 'templates'),
-)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS' : [os.path.join(BASE_DIR, 'templates')],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ ],
+ },
+ },
+]
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv("SECRET_KEY", None)
@@ -195,7 +204,7 @@ USE_TZ = True
OLD_BUILD_WARNING_THRESHOLD_DAYS = 10
# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.6/howto/static-files/
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'
STATICFILES_DIRS = (
os.path.join(PROJECT_PATH, "static"),

diff:
# See the License for the specific language governing permissions and
# limitations under the License.
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
@@ -23,16 +23,14 @@ admin.autodiscover()
from settings import IS_PINTEREST
if IS_PINTEREST:
- urlpatterns = patterns(
- '',
+ urlpatterns = [
url(r'^', include('deploy_board.webapp.urls')),
url(r'^', include('deploy_board.webapp.mix_urls')),
url(r'^', include('deploy_board.webapp.arcee_urls')),
url(r'^', include('deploy_board.webapp.ngapp2_urls')),
url(r'^', include('deploy_board.webapp.cluster_urls')),
- ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
+ ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
else:
- urlpatterns = patterns(
- '',
+ urlpatterns = [
url(r'^', include('deploy_board.webapp.urls')),
- )
+ ]

diff:
@@ -18,7 +18,7 @@ WSGI config for deploy_board project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
-https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os

diff:
Django settings for mysite project.
For more information on this file, see
-https://docs.djangoproject.com/en/1.6/topics/settings/
+https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
-https://docs.djangoproject.com/en/1.6/ref/settings/
+https://docs.djangoproject.com/en/1.11/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
@@ -28,7 +28,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
-# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
+# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '5_y&4p=teg@cc8dn==sxvj$!ol&b9gmp=$k#(!i%zg%feu%95g'
@@ -67,7 +67,7 @@ WSGI_APPLICATION = 'mysite.wsgi.application'
# Database
-# https://docs.djangoproject.com/en/1.6/ref/settings/#databases
+# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
DATABASES = {
'default': {
@@ -77,7 +77,7 @@ DATABASES = {
}
# Internationalization
-# https://docs.djangoproject.com/en/1.6/topics/i18n/
+# https://docs.djangoproject.com/en/1.11/topics/i18n/
LANGUAGE_CODE = 'en-us'
@@ -91,6 +91,6 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
-# https://docs.djangoproject.com/en/1.6/howto/static-files/
+# https://docs.djangoproject.com/en/1.11/howto/static-files/
STATIC_URL = '/static/'

diff:
# See the License for the specific language governing permissions and
# limitations under the License.
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
from django.contrib import admin
admin.autodiscover()
-urlpatterns = patterns('',
+urlpatterns = [
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
-)
+]

diff:
@@ -18,7 +18,7 @@ WSGI config for mysite project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
-https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
+https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os

original_message:
Modify python import and settings for updating Django version (#634)

remove unused options in context_processors

correct doc links