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
26 changes: 25 additions & 1 deletion .github/workflows/platform-tests-vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ jobs:
timeout-minutes: 15
environment: '@sveltejs/adapter-vercel platform tests'
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha || github.sha }}
persist-credentials: false

- uses: ./.github/actions/vercel-deploy
id: deploy
Expand All @@ -43,3 +44,26 @@ jobs:
with:
test-app-dir: packages/adapter-vercel/test/apps/basic
deployment-url: ${{ steps.deploy.outputs.deployment-url }}

test-split:
if: github.repository == 'sveltejs/kit'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: '@sveltejs/adapter-vercel platform tests'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ inputs.sha || github.sha }}
persist-credentials: false

- uses: ./.github/actions/vercel-deploy
id: deploy
with:
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_SPLIT }}
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}

- uses: ./.github/actions/platform-test
with:
test-app-dir: packages/adapter-vercel/test/apps/split
deployment-url: ${{ steps.deploy.outputs.deployment-url }}
20 changes: 20 additions & 0 deletions packages/adapter-vercel/test/apps/split/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "test-vercel-split",
"version": "0.0.1",
"private": true,
"scripts": {
"dev": "vite dev",
"preview": "vite preview",
"build": "vite build",
"prepare": "svelte-kit sync || echo ''",
"test:platform": "playwright test"
},
"devDependencies": {
"@sveltejs/kit": "workspace:*",
"@sveltejs/vite-plugin-svelte": "catalog:",
"svelte": "catalog:",
"typescript": "catalog:",
"vite": "catalog:"
},
"type": "module"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { config as default } from '../../utils.js';
13 changes: 13 additions & 0 deletions packages/adapter-vercel/test/apps/split/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// See https://svelte.dev/docs/kit/types#app.d.ts
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
// interface Locals {}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
}

export {};
11 changes: 11 additions & 0 deletions packages/adapter-vercel/test/apps/split/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
let { children } = $props();
</script>

{@render children()}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1>Hello from SvelteKit on Vercel</h1>

<nav>
<a href="/a">go to route a</a>
</nav>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>This route will be served by a different function because we use the split config</p>
8 changes: 8 additions & 0 deletions packages/adapter-vercel/test/apps/split/test/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { expect, test } from '@playwright/test';

test('split functions work', async ({ page }) => {
await page.goto('/');
await expect(page.locator('h1')).toContainText('Hello from SvelteKit on Vercel');
await page.goto('/a');
await expect(page.locator('p')).toContainText(/split config/);
});
15 changes: 15 additions & 0 deletions packages/adapter-vercel/test/apps/split/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"extends": "$app/tsconfig",
"compilerOptions": {
"rewriteRelativeImportExtensions": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"moduleResolution": "bundler"
},
"include": ["src", "test", "playwright.config.js", "vite.config.ts"]
}
13 changes: 13 additions & 0 deletions packages/adapter-vercel/test/apps/split/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import adapter from '../../../index.js';

export default defineConfig({
plugins: [
sveltekit({
adapter: adapter({
split: true
})
})
]
});
4 changes: 1 addition & 3 deletions packages/kit/src/exports/env/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/** @import { EnvVarConfig } from '@sveltejs/kit' */

/**
* Utility for defining [environment variables](https://svelte.dev/docs/kit/environment-variables),
* which are made available via `$app/env/public` and `$app/env/private`.
* @template {Record<string, EnvVarConfig<any>>} T
* @template {Record<string, import('@sveltejs/kit').EnvVarConfig<any>>} T
* @param {T} variables
* @returns {T}
*/
Expand Down
19 changes: 9 additions & 10 deletions packages/kit/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3026,7 +3026,7 @@ declare module '@sveltejs/kit' {
}>;
export const VERSION: string;
class HttpError_1 {

constructor(status: number, body: {
message: string;
} extends App.Error ? (App.Error | string | undefined) : App.Error);
Expand All @@ -3035,7 +3035,7 @@ declare module '@sveltejs/kit' {
toString(): string;
}
class Redirect_1 {

constructor(status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308, location: string);
status: 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308;
location: string;
Expand All @@ -3046,12 +3046,11 @@ declare module '@sveltejs/kit' {
}

declare module '@sveltejs/kit/env' {
import type { EnvVarConfig } from '@sveltejs/kit';
/**
* Utility for defining [environment variables](https://svelte.dev/docs/kit/environment-variables),
* which are made available via `$app/env/public` and `$app/env/private`.
* */
export function defineEnvVars<T extends Record<string, EnvVarConfig<any>>>(variables: T): T;
export function defineEnvVars<T extends Record<string, import("@sveltejs/kit").EnvVarConfig<any>>>(variables: T): T;

export {};
}
Expand Down Expand Up @@ -3668,9 +3667,9 @@ declare module '$app/server' {
*
* */
function live<Output>(fn: (arg: void) => RemoteLiveQueryUserFunctionReturnType<Output>): RemoteLiveQueryFunction<void, Output>;

function live<Input, Output>(validate: "unchecked", fn: (arg: Input) => RemoteLiveQueryUserFunctionReturnType<Output>): RemoteLiveQueryFunction<Input, Output>;

function live<Schema extends StandardSchemaV1, Output>(schema: Schema, fn: (arg: StandardSchemaV1.InferOutput<Schema>) => RemoteLiveQueryUserFunctionReturnType<Output>): RemoteLiveQueryFunction<StandardSchemaV1.InferInput<Schema>, Output, StandardSchemaV1.InferOutput<Schema>>;
}
/**
Expand Down Expand Up @@ -3837,11 +3836,11 @@ declare module '$app/state' {

declare module '$app/stores' {
export function getStores(): {

page: typeof page;

navigating: typeof navigating;

updated: typeof updated;
};
/**
Expand Down Expand Up @@ -4025,4 +4024,4 @@ declare module '$app/types' {
export type Asset = ReturnType<AppTypes['Asset']>;
}

//# sourceMappingURL=index.d.ts.map
//# sourceMappingURL=index.d.ts.map
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading