From 4fdea3bd1adc420ddca25b8df4b82b43635ec205 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Fri, 12 Jan 2024 12:36:45 +0100 Subject: [PATCH 1/6] fix: remove internal `__sveltekit/` module declarations from types Takes advantage of the fact that dts-buddy doesn't detect the ambient-private.d.ts module declarations (which arguably is a bit weird and could result in buggy behavior, but we can use it to our advantage here). fixes #11607 --- .changeset/brave-cats-tan.md | 5 ++ packages/kit/scripts/generate-dts.js | 12 ++++- packages/kit/src/runtime/app/environment.js | 12 ++++- packages/kit/src/runtime/app/paths.js | 19 ++++++- packages/kit/src/types/ambient-private.d.ts | 44 +++++++++++---- packages/kit/src/types/ambient.d.ts | 38 ------------- packages/kit/src/types/global-private.d.ts | 11 ++++ packages/kit/types/index.d.ts | 60 +++++++-------------- 8 files changed, 110 insertions(+), 91 deletions(-) create mode 100644 .changeset/brave-cats-tan.md create mode 100644 packages/kit/src/types/global-private.d.ts diff --git a/.changeset/brave-cats-tan.md b/.changeset/brave-cats-tan.md new file mode 100644 index 000000000000..5ca5c1527151 --- /dev/null +++ b/.changeset/brave-cats-tan.md @@ -0,0 +1,5 @@ +--- +"@sveltejs/kit": patch +--- + +fix: remove internal `__sveltekit/` module declarations from types diff --git a/packages/kit/scripts/generate-dts.js b/packages/kit/scripts/generate-dts.js index 8eeffb5b2f82..b6d7bd23d5b2 100644 --- a/packages/kit/scripts/generate-dts.js +++ b/packages/kit/scripts/generate-dts.js @@ -1,6 +1,7 @@ import { createBundle } from 'dts-buddy'; +import { readFileSync } from 'fs'; -createBundle({ +await createBundle({ output: 'types/index.d.ts', modules: { '@sveltejs/kit': 'src/exports/public.d.ts', @@ -16,3 +17,12 @@ createBundle({ }, include: ['src'] }); + +// dts-buddy doesn't inline imports of module declaration in ambient-private.d.ts but also doesn't include them, resulting in broken types - guard against that +const types = readFileSync('./types/index.d.ts', 'utf-8'); +if (types.includes('__sveltekit/')) { + throw new Error( + 'Found __sveltekit/ in types/index.d.ts - make sure to hide internal modules by not just reexporting them. Contents:\n\n' + + types + ); +} diff --git a/packages/kit/src/runtime/app/environment.js b/packages/kit/src/runtime/app/environment.js index 8393ee6dbda6..9705116dc51e 100644 --- a/packages/kit/src/runtime/app/environment.js +++ b/packages/kit/src/runtime/app/environment.js @@ -1,5 +1,15 @@ import { BROWSER, DEV } from 'esm-env'; -export { building, version } from '__sveltekit/environment'; +import { building as _building, version as _version } from '__sveltekit/environment'; + +/** + * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. + */ +export const building = _building; + +/** + * The value of `config.kit.version.name`. + */ +export const version = _version; /** * `true` if the app is running in the browser. diff --git a/packages/kit/src/runtime/app/paths.js b/packages/kit/src/runtime/app/paths.js index 32df2e1b3eda..35abd73f6768 100644 --- a/packages/kit/src/runtime/app/paths.js +++ b/packages/kit/src/runtime/app/paths.js @@ -1,7 +1,22 @@ -export { base, assets } from '__sveltekit/paths'; -import { base } from '__sveltekit/paths'; +import { base as _base, assets as _assets } from '__sveltekit/paths'; import { resolve_route } from '../../utils/routing.js'; +/** + * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). + * + * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. + * @type {'' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'} + */ +export const assets = _assets; + +/** + * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). + * + * Example usage: `Link` + * @type {'' | `/${string}`} + */ +export const base = _base; + /** * Populate a route ID with params to resolve a pathname. * @example diff --git a/packages/kit/src/types/ambient-private.d.ts b/packages/kit/src/types/ambient-private.d.ts index 843cc94d342b..8c56f2901359 100644 --- a/packages/kit/src/types/ambient-private.d.ts +++ b/packages/kit/src/types/ambient-private.d.ts @@ -1,11 +1,37 @@ -declare global { - const __SVELTEKIT_ADAPTER_NAME__: string; - const __SVELTEKIT_APP_VERSION_FILE__: string; - const __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: number; - const __SVELTEKIT_DEV__: boolean; - const __SVELTEKIT_EMBEDDED__: boolean; - var Bun: object; - var Deno: object; +/** Internal version of $app/environment */ +declare module '__sveltekit/environment' { + /** + * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. + */ + export const building: boolean; + /** + * True during prerendering, false otherwise. + */ + export const prerendering: boolean; + /** + * The value of `config.kit.version.name`. + */ + export const version: string; + export function set_building(): void; + export function set_prerendering(): void; } -export {}; +/** Internal version of $app/paths */ +declare module '__sveltekit/paths' { + /** + * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). + * + * Example usage: `Link` + */ + export let base: '' | `/${string}`; + /** + * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). + * + * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. + */ + export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; + export let relative: boolean; + export function reset(): void; + export function override(paths: { base: string; assets: string }): void; + export function set_assets(path: string): void; +} diff --git a/packages/kit/src/types/ambient.d.ts b/packages/kit/src/types/ambient.d.ts index 2c8b7427f763..00730946b980 100644 --- a/packages/kit/src/types/ambient.d.ts +++ b/packages/kit/src/types/ambient.d.ts @@ -79,41 +79,3 @@ declare module '$service-worker' { */ export const version: string; } - -/** Internal version of $app/environment */ -declare module '__sveltekit/environment' { - /** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ - export const building: boolean; - /** - * True during prerendering, false otherwise. - */ - export const prerendering: boolean; - /** - * The value of `config.kit.version.name`. - */ - export const version: string; - export function set_building(): void; - export function set_prerendering(): void; -} - -/** Internal version of $app/paths */ -declare module '__sveltekit/paths' { - /** - * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). - * - * Example usage: `Link` - */ - export let base: '' | `/${string}`; - /** - * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). - * - * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - */ - export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; - export let relative: boolean; - export function reset(): void; - export function override(paths: { base: string; assets: string }): void; - export function set_assets(path: string): void; -} diff --git a/packages/kit/src/types/global-private.d.ts b/packages/kit/src/types/global-private.d.ts new file mode 100644 index 000000000000..843cc94d342b --- /dev/null +++ b/packages/kit/src/types/global-private.d.ts @@ -0,0 +1,11 @@ +declare global { + const __SVELTEKIT_ADAPTER_NAME__: string; + const __SVELTEKIT_APP_VERSION_FILE__: string; + const __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: number; + const __SVELTEKIT_DEV__: boolean; + const __SVELTEKIT_EMBEDDED__: boolean; + var Bun: object; + var Deno: object; +} + +export {}; diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index a983b4433561..0dd1b2f1ca9a 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -1892,7 +1892,14 @@ declare module '@sveltejs/kit/vite' { } declare module '$app/environment' { - export { building, version } from '__sveltekit/environment'; + /** + * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. + */ + export const building: boolean; + /** + * The value of `config.kit.version.name`. + */ + export const version: string; /** * `true` if the app is running in the browser. */ @@ -2067,7 +2074,6 @@ declare module '$app/navigation' { } declare module '$app/paths' { - export { base, assets } from '__sveltekit/paths'; /** * Populate a route ID with params to resolve a pathname. * @example @@ -2082,6 +2088,18 @@ declare module '$app/paths' { * ``` * */ export function resolveRoute(id: string, params: Record): string; + /** + * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). + * + * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. + * */ + export const assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; + /** + * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). + * + * Example usage: `Link` + * */ + export const base: '' | `/${string}`; } declare module '$app/stores' { @@ -2198,42 +2216,4 @@ declare module '$service-worker' { export const version: string; } -/** Internal version of $app/environment */ -declare module '__sveltekit/environment' { - /** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ - export const building: boolean; - /** - * True during prerendering, false otherwise. - */ - export const prerendering: boolean; - /** - * The value of `config.kit.version.name`. - */ - export const version: string; - export function set_building(): void; - export function set_prerendering(): void; -} - -/** Internal version of $app/paths */ -declare module '__sveltekit/paths' { - /** - * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). - * - * Example usage: `Link` - */ - export let base: '' | `/${string}`; - /** - * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). - * - * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - */ - export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; - export let relative: boolean; - export function reset(): void; - export function override(paths: { base: string; assets: string }): void; - export function set_assets(path: string): void; -} - //# sourceMappingURL=index.d.ts.map \ No newline at end of file From a938eb42ec3bf9bf2f8e7195b3f3dcfa08febe8a Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 12 Jan 2024 08:29:45 -0500 Subject: [PATCH 2/6] lint --- packages/kit/scripts/generate-dts.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kit/scripts/generate-dts.js b/packages/kit/scripts/generate-dts.js index b6d7bd23d5b2..d6b46e024e3a 100644 --- a/packages/kit/scripts/generate-dts.js +++ b/packages/kit/scripts/generate-dts.js @@ -1,5 +1,5 @@ import { createBundle } from 'dts-buddy'; -import { readFileSync } from 'fs'; +import { readFileSync } from 'node:fs'; await createBundle({ output: 'types/index.d.ts', From 28ce2910459e0bd4e54a41dbf8c2df2096b19ed6 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 12 Jan 2024 16:14:54 -0500 Subject: [PATCH 3/6] re-export values from internal modules --- packages/kit/src/runtime/app/environment.js | 12 +----------- packages/kit/src/runtime/app/paths.js | 18 +----------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/packages/kit/src/runtime/app/environment.js b/packages/kit/src/runtime/app/environment.js index 9705116dc51e..8393ee6dbda6 100644 --- a/packages/kit/src/runtime/app/environment.js +++ b/packages/kit/src/runtime/app/environment.js @@ -1,15 +1,5 @@ import { BROWSER, DEV } from 'esm-env'; -import { building as _building, version as _version } from '__sveltekit/environment'; - -/** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ -export const building = _building; - -/** - * The value of `config.kit.version.name`. - */ -export const version = _version; +export { building, version } from '__sveltekit/environment'; /** * `true` if the app is running in the browser. diff --git a/packages/kit/src/runtime/app/paths.js b/packages/kit/src/runtime/app/paths.js index 35abd73f6768..40e3c3254c1b 100644 --- a/packages/kit/src/runtime/app/paths.js +++ b/packages/kit/src/runtime/app/paths.js @@ -1,22 +1,6 @@ -import { base as _base, assets as _assets } from '__sveltekit/paths'; +import { base } from '__sveltekit/paths'; import { resolve_route } from '../../utils/routing.js'; -/** - * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). - * - * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - * @type {'' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'} - */ -export const assets = _assets; - -/** - * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). - * - * Example usage: `Link` - * @type {'' | `/${string}`} - */ -export const base = _base; - /** * Populate a route ID with params to resolve a pathname. * @example From 1b3eb25dd7704a6f468d3bab481099f268990c71 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 12 Jan 2024 16:16:45 -0500 Subject: [PATCH 4/6] move files --- .../kit/src/runtime/app/{environment.js => environment/index.js} | 0 packages/kit/src/runtime/app/{paths.js => paths/index.js} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename packages/kit/src/runtime/app/{environment.js => environment/index.js} (100%) rename packages/kit/src/runtime/app/{paths.js => paths/index.js} (100%) diff --git a/packages/kit/src/runtime/app/environment.js b/packages/kit/src/runtime/app/environment/index.js similarity index 100% rename from packages/kit/src/runtime/app/environment.js rename to packages/kit/src/runtime/app/environment/index.js diff --git a/packages/kit/src/runtime/app/paths.js b/packages/kit/src/runtime/app/paths/index.js similarity index 100% rename from packages/kit/src/runtime/app/paths.js rename to packages/kit/src/runtime/app/paths/index.js From 3508425414f4b1711a38cb6d6ddea32513651acb Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 12 Jan 2024 16:30:22 -0500 Subject: [PATCH 5/6] point dts-buddy at facade .d.ts files --- packages/kit/scripts/generate-dts.js | 4 +- .../kit/src/runtime/app/environment/index.js | 6 --- .../src/runtime/app/environment/types.d.ts | 19 ++++++++ packages/kit/src/runtime/app/paths/index.js | 20 ++------ packages/kit/src/runtime/app/paths/types.d.ts | 28 +++++++++++ packages/kit/src/types/ambient-private.d.ts | 19 -------- packages/kit/types/index.d.ts | 47 ++++++++++--------- 7 files changed, 78 insertions(+), 65 deletions(-) create mode 100644 packages/kit/src/runtime/app/environment/types.d.ts create mode 100644 packages/kit/src/runtime/app/paths/types.d.ts diff --git a/packages/kit/scripts/generate-dts.js b/packages/kit/scripts/generate-dts.js index d6b46e024e3a..5d23c06d23f8 100644 --- a/packages/kit/scripts/generate-dts.js +++ b/packages/kit/scripts/generate-dts.js @@ -9,10 +9,10 @@ await createBundle({ '@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.js', + '$app/environment': 'src/runtime/app/environment/types.d.ts', '$app/forms': 'src/runtime/app/forms.js', '$app/navigation': 'src/runtime/app/navigation.js', - '$app/paths': 'src/runtime/app/paths.js', + '$app/paths': 'src/runtime/app/paths/types.d.ts', '$app/stores': 'src/runtime/app/stores.js' }, include: ['src'] diff --git a/packages/kit/src/runtime/app/environment/index.js b/packages/kit/src/runtime/app/environment/index.js index 8393ee6dbda6..2b5461940c12 100644 --- a/packages/kit/src/runtime/app/environment/index.js +++ b/packages/kit/src/runtime/app/environment/index.js @@ -1,12 +1,6 @@ import { BROWSER, DEV } from 'esm-env'; export { building, version } from '__sveltekit/environment'; -/** - * `true` if the app is running in the browser. - */ export const browser = BROWSER; -/** - * Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`. - */ export const dev = DEV; diff --git a/packages/kit/src/runtime/app/environment/types.d.ts b/packages/kit/src/runtime/app/environment/types.d.ts new file mode 100644 index 000000000000..da76eae46502 --- /dev/null +++ b/packages/kit/src/runtime/app/environment/types.d.ts @@ -0,0 +1,19 @@ +/** + * `true` if the app is running in the browser. + */ +export const browser: boolean; + +/** + * Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`. + */ +export const dev: boolean; + +/** + * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. + */ +export const building: boolean; + +/** + * The value of `config.kit.version.name`. + */ +export const version: string; diff --git a/packages/kit/src/runtime/app/paths/index.js b/packages/kit/src/runtime/app/paths/index.js index 40e3c3254c1b..5a150fbfaa0f 100644 --- a/packages/kit/src/runtime/app/paths/index.js +++ b/packages/kit/src/runtime/app/paths/index.js @@ -1,22 +1,8 @@ +export { base, assets } from '__sveltekit/paths'; import { base } from '__sveltekit/paths'; -import { resolve_route } from '../../utils/routing.js'; +import { resolve_route } from '../../../utils/routing.js'; -/** - * Populate a route ID with params to resolve a pathname. - * @example - * ```js - * resolveRoute( - * `/blog/[slug]/[...somethingElse]`, - * { - * slug: 'hello-world', - * somethingElse: 'something/else' - * } - * ); // `/blog/hello-world/something/else` - * ``` - * @param {string} id - * @param {Record} params - * @returns {string} - */ +/** @type {import('./types.d.ts').resolveRoute} */ export function resolveRoute(id, params) { return base + resolve_route(id, params); } diff --git a/packages/kit/src/runtime/app/paths/types.d.ts b/packages/kit/src/runtime/app/paths/types.d.ts new file mode 100644 index 000000000000..0bc521a9fdb8 --- /dev/null +++ b/packages/kit/src/runtime/app/paths/types.d.ts @@ -0,0 +1,28 @@ +/** + * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). + * + * Example usage: `Link` + */ +export let base: '' | `/${string}`; + +/** + * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). + * + * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. + */ +export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; + +/** + * Populate a route ID with params to resolve a pathname. + * @example + * ```js + * resolveRoute( + * `/blog/[slug]/[...somethingElse]`, + * { + * slug: 'hello-world', + * somethingElse: 'something/else' + * } + * ); // `/blog/hello-world/something/else` + * ``` + */ +export function resolveRoute(id: string, params: Record): string; diff --git a/packages/kit/src/types/ambient-private.d.ts b/packages/kit/src/types/ambient-private.d.ts index 8c56f2901359..544c9a73b78a 100644 --- a/packages/kit/src/types/ambient-private.d.ts +++ b/packages/kit/src/types/ambient-private.d.ts @@ -1,16 +1,7 @@ /** Internal version of $app/environment */ declare module '__sveltekit/environment' { - /** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ export const building: boolean; - /** - * True during prerendering, false otherwise. - */ export const prerendering: boolean; - /** - * The value of `config.kit.version.name`. - */ export const version: string; export function set_building(): void; export function set_prerendering(): void; @@ -18,17 +9,7 @@ declare module '__sveltekit/environment' { /** Internal version of $app/paths */ declare module '__sveltekit/paths' { - /** - * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). - * - * Example usage: `Link` - */ export let base: '' | `/${string}`; - /** - * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). - * - * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - */ export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; export let relative: boolean; export function reset(): void; diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts index 0dd1b2f1ca9a..acb9442b783d 100644 --- a/packages/kit/types/index.d.ts +++ b/packages/kit/types/index.d.ts @@ -1892,22 +1892,25 @@ declare module '@sveltejs/kit/vite' { } declare module '$app/environment' { - /** - * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. - */ - export const building: boolean; - /** - * The value of `config.kit.version.name`. - */ - export const version: string; /** * `true` if the app is running in the browser. */ export const browser: boolean; + /** * Whether the dev server is running. This is not guaranteed to correspond to `NODE_ENV` or `MODE`. */ export const dev: boolean; + + /** + * SvelteKit analyses your app during the `build` step by running it. During this process, `building` is `true`. This also applies during prerendering. + */ + export const building: boolean; + + /** + * The value of `config.kit.version.name`. + */ + export const version: string; } declare module '$app/forms' { @@ -2074,6 +2077,20 @@ declare module '$app/navigation' { } declare module '$app/paths' { + /** + * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). + * + * Example usage: `Link` + */ + export let base: '' | `/${string}`; + + /** + * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). + * + * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. + */ + export let assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; + /** * Populate a route ID with params to resolve a pathname. * @example @@ -2086,20 +2103,8 @@ declare module '$app/paths' { * } * ); // `/blog/hello-world/something/else` * ``` - * */ + */ export function resolveRoute(id: string, params: Record): string; - /** - * An absolute path that matches [`config.kit.paths.assets`](https://kit.svelte.dev/docs/configuration#paths). - * - * > If a value for `config.kit.paths.assets` is specified, it will be replaced with `'/_svelte_kit_assets'` during `vite dev` or `vite preview`, since the assets don't yet live at their eventual URL. - * */ - export const assets: '' | `https://${string}` | `http://${string}` | '/_svelte_kit_assets'; - /** - * A string that matches [`config.kit.paths.base`](https://kit.svelte.dev/docs/configuration#paths). - * - * Example usage: `Link` - * */ - export const base: '' | `/${string}`; } declare module '$app/stores' { From 124adbf5bbe6e6c02ff1908128844b286f7dadf9 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 12 Jan 2024 16:36:07 -0500 Subject: [PATCH 6/6] remove some junk we no longer need --- sites/kit.svelte.dev/scripts/types/index.js | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/sites/kit.svelte.dev/scripts/types/index.js b/sites/kit.svelte.dev/scripts/types/index.js index 838360d66e44..85f100bf202d 100644 --- a/sites/kit.svelte.dev/scripts/types/index.js +++ b/sites/kit.svelte.dev/scripts/types/index.js @@ -310,22 +310,6 @@ for (const file of await readdir(dir)) { } } -// need to do some unfortunate finagling here, hopefully we can remove this one day -const app_paths = modules.find((module) => module.name === '$app/paths'); -const app_environment = modules.find((module) => module.name === '$app/environment'); -const __sveltekit_paths = modules.find((module) => module.name === '__sveltekit/paths'); -const __sveltekit_environment = modules.find((module) => module.name === '__sveltekit/environment'); - -app_paths?.exports.push( - __sveltekit_paths.exports.find((e) => e.name === 'assets'), - __sveltekit_paths.exports.find((e) => e.name === 'base') -); - -app_environment?.exports.push( - __sveltekit_environment.exports.find((e) => e.name === 'building'), - __sveltekit_environment.exports.find((e) => e.name === 'version') -); - modules.sort((a, b) => (a.name < b.name ? -1 : 1)); mkdirp('src/lib/generated');