Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/cyan-zoos-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': major
---

breaking: remove `@sveltejs/kit/node/polyfills`
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ Within the `adapt` method, there are a number of things that an adapter should d
- Instantiates the app with a manifest generated with `builder.generateManifest({ relativePath })`
- Listens for requests from the platform, converts them to a standard [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) if necessary, calls the `server.respond(request, { getClientAddress })` function to generate a [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response) and responds with it
- expose any platform-specific information to SvelteKit via the `platform` option passed to `server.respond`
- Globally shims `fetch` to work on the target platform, if necessary. SvelteKit provides a `@sveltejs/kit/node/polyfills` helper for platforms that can use `undici`
- Bundle the output to avoid needing to install dependencies on the target platform, if necessary
- Put the user's static files and the generated JS/CSS in the correct location for the target platform

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion packages/adapter-netlify/rolldown.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function clearOutput(filepath) {
const config = {
input: {
serverless: 'src/serverless.js',
shims: 'src/shims.js',
edge: 'src/edge.js'
},
output: {
Expand Down
1 change: 0 additions & 1 deletion packages/adapter-netlify/src/serverless.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import './shims';
import { Server } from '0SERVER';
import { createReadableStream } from '@sveltejs/kit/node';
import process from 'node:process';
Expand Down
2 changes: 0 additions & 2 deletions packages/adapter-netlify/src/shims.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/adapter-node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ export default function (opts = {}) {
HANDLER: './handler.js',
MANIFEST: './server/manifest.js',
SERVER: './server/index.js',
SHIMS: './shims.js',
ENV_PREFIX: JSON.stringify(envPrefix),
PRECOMPRESS: JSON.stringify(precompress)
}
Expand Down
11 changes: 1 addition & 10 deletions packages/adapter-node/rolldown.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,7 @@ export default [
codeSplitting: false
},
plugins: [clearOutput('files/handler.js'), prefixBuiltinModules()],
external: ['ENV', 'MANIFEST', 'SERVER', 'SHIMS'],
platform: 'node'
},
{
input: 'src/shims.js',
output: {
file: 'files/shims.js',
format: 'esm'
},
plugins: [clearOutput('files/shims.js'), prefixBuiltinModules()],
external: ['ENV', 'MANIFEST', 'SERVER'],
platform: 'node'
}
];
1 change: 0 additions & 1 deletion packages/adapter-node/src/handler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'SHIMS';
import fs from 'node:fs';
import path from 'node:path';
import process from 'node:process';
Expand Down
2 changes: 0 additions & 2 deletions packages/adapter-node/src/shims.js

This file was deleted.

4 changes: 0 additions & 4 deletions packages/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@
"types": "./types/index.d.ts",
"import": "./src/exports/node/index.js"
},
"./node/polyfills": {
"types": "./types/index.d.ts",
"import": "./src/exports/node/polyfills.js"
},
"./hooks": {
"types": "./types/index.d.ts",
"import": "./src/exports/hooks/index.js"
Expand Down
1 change: 0 additions & 1 deletion packages/kit/scripts/generate-dts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ await createBundle({
'@sveltejs/kit': 'src/exports/public.d.ts',
'@sveltejs/kit/hooks': 'src/exports/hooks/index.js',
'@sveltejs/kit/node': 'src/exports/node/index.js',
'@sveltejs/kit/node/polyfills': 'src/exports/node/polyfills.js',
'@sveltejs/kit/vite': 'src/exports/vite/index.js',
'$app/environment': 'src/runtime/app/environment/types.d.ts',
'$app/forms': 'src/runtime/app/forms.js',
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/core/postbuild/analyse.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { pathToFileURL } from 'node:url';
import { validate_server_exports } from '../../utils/exports.js';
import { load_config } from '../config/index.js';
import { forked } from '../../utils/fork.js';
import { installPolyfills } from '../../exports/node/polyfills.js';
import { ENDPOINT_METHODS } from '../../constants.js';
import { filter_env } from '../../utils/env.js';
import { has_server_load, resolve_route } from '../../utils/routing.js';
Expand Down Expand Up @@ -50,8 +49,6 @@ async function analyse({
/** @type {import('types').ServerInternalModule} */
const internal = await import(pathToFileURL(`${server_root}/server/internal.js`).href);

installPolyfills();

// configure `import { building } from '$app/environment'` —
// essential we do this before analysing the code
internal.set_building();
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/core/postbuild/fallback.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { readFileSync } from 'node:fs';
import { join } from 'node:path';
import { pathToFileURL } from 'node:url';
import { installPolyfills } from '../../exports/node/polyfills.js';
import { load_config } from '../config/index.js';
import { forked } from '../../utils/fork.js';

Expand All @@ -17,8 +16,6 @@ async function generate_fallback({ manifest_path, env }) {
/** @type {import('types').ValidatedKitConfig} */
const config = (await load_config()).kit;

installPolyfills();

const server_root = join(config.outDir, 'output');

/** @type {import('types').ServerInternalModule} */
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/core/postbuild/prerender.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { existsSync, readFileSync, statSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { pathToFileURL } from 'node:url';
import { installPolyfills } from '../../exports/node/polyfills.js';
import { mkdirp, posixify, walk } from '../../utils/filesystem.js';
import { decode_uri, is_root_relative, resolve } from '../../utils/url.js';
import { escape_html } from '../../utils/escape.js';
Expand Down Expand Up @@ -124,8 +123,6 @@ async function prerender({ hash, out, manifest_path, metadata, verbose, env }) {
/** @type {import('types').Logger} */
const log = logger({ verbose });

installPolyfills();

/** @type {Map<string, string>} */
const saved = new Map();

Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/exports/hooks/sequence.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/** @import { RequestState } from 'types' */
import { assert, expect, test, vi } from 'vitest';
import { sequence } from './sequence.js';
import { installPolyfills } from '../node/polyfills.js';
import { noop_span } from '../../runtime/telemetry/noop.js';

const dummy_event = vi.hoisted(
Expand All @@ -29,8 +28,6 @@ vi.mock(import('@sveltejs/kit/internal/server'), async (actualPromise) => {
};
});

installPolyfills();

test('applies handlers in sequence', async () => {
/** @type {string[]} */
const order = [];
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/exports/vite/dev/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { styleText } from 'node:util';
import sirv from 'sirv';
import { isCSSRequest, loadEnv, buildErrorMessage } from 'vite';
import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js';
import { installPolyfills } from '../../../exports/node/polyfills.js';
import { coalesce_to_error } from '../../../utils/error.js';
import { from_fs, posixify, resolve_entry, to_fs } from '../../../utils/filesystem.js';
import { load_error_page } from '../../../core/config/index.js';
Expand All @@ -32,8 +31,6 @@ const vite_css_query_regex = /(?:\?|&)(?:raw|url|inline)(?:&|$)/;
* @return {Promise<Promise<() => void>>}
*/
export async function dev(vite, vite_config, svelte_config, get_remotes) {
installPolyfills();

const async_local_storage = new AsyncLocalStorage();

globalThis.__SVELTEKIT_TRACK__ = (label) => {
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/exports/vite/preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { lookup } from 'mrmime';
import sirv from 'sirv';
import { loadEnv, normalizePath } from 'vite';
import { createReadableStream, getRequest, setResponse } from '../../../exports/node/index.js';
import { installPolyfills } from '../../../exports/node/polyfills.js';
import { SVELTE_KIT_ASSETS } from '../../../constants.js';
import { not_found } from '../utils.js';

Expand All @@ -19,8 +18,6 @@ import { not_found } from '../utils.js';
* @param {import('types').ValidatedConfig} svelte_config
*/
export async function preview(vite, vite_config, svelte_config) {
installPolyfills();

const { paths } = svelte_config.kit;
const base = paths.base;
const assets = paths.assets ? SVELTE_KIT_ASSETS : paths.base;
Expand Down
3 changes: 0 additions & 3 deletions packages/kit/src/runtime/server/cookie.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import process from 'node:process';
import { assert, expect, test, describe } from 'vitest';
import { domain_matches, path_matches, get_cookies } from './cookie.js';
import { installPolyfills } from '@sveltejs/kit/node/polyfills';

installPolyfills();

const domains = {
positive: [
Expand Down
1 change: 0 additions & 1 deletion packages/kit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"paths": {
"@sveltejs/kit": ["./src/exports/public.d.ts"],
"@sveltejs/kit/node": ["./src/exports/node/index.js"],
"@sveltejs/kit/node/polyfills": ["./src/exports/node/polyfills.js"],
"@sveltejs/kit/internal": ["./src/exports/internal/index.js"],
"@sveltejs/kit/internal/server": ["./src/exports/internal/server.js"],
"$app/paths": ["./src/runtime/app/paths/public.d.ts"],
Expand Down
11 changes: 0 additions & 11 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2878,17 +2878,6 @@ declare module '@sveltejs/kit/node' {
export {};
}

declare module '@sveltejs/kit/node/polyfills' {
/**
* Make various web APIs available as globals:
* - `crypto`
* - `File`
*/
export function installPolyfills(): void;

export {};
}

declare module '@sveltejs/kit/vite' {
/**
* Returns the SvelteKit Vite plugins.
Expand Down
Loading