Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Svelte 5 Runes support #1300

Merged
merged 33 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
af0c812
Upgrade e2e/kit to Svelte 4
SeppahBaws Mar 12, 2024
fb80ff0
Upgrade e2e/kit to SvelteKit 2
SeppahBaws Mar 12, 2024
c3624ad
Upgrade Vite to v5
SeppahBaws Mar 12, 2024
9dfd640
Upgrade Svelte to v5
SeppahBaws Mar 12, 2024
e342339
Upgrade playwright, add sample Svelte 5 runes demo
SeppahBaws Mar 12, 2024
1476260
Add support for component queries
SeppahBaws Mar 18, 2024
f5321a5
Fix component queries
SeppahBaws Apr 3, 2024
663da1e
Detect Runes by instead manually checking the script AST
SeppahBaws Apr 4, 2024
493fc3b
Add $host rune, bump svelte version
SeppahBaws Apr 11, 2024
8e0996d
Misc fixes
SeppahBaws Apr 29, 2024
a57a14e
Add changeset, fix formatting
SeppahBaws Apr 29, 2024
6a3d7a2
Bump svelte version, fix lint, fix broken tests
SeppahBaws May 15, 2024
fc4b27a
Fix broken test, add section in docs with examples
SeppahBaws May 15, 2024
eeada58
Remove unnecessary if (isBrowser) check - effect only runs in browser
SeppahBaws May 16, 2024
cc50897
Remove unused $derive, add mutation e2e test
SeppahBaws May 18, 2024
0cf197e
Bump node and pnpm versions in actions
SeppahBaws May 19, 2024
1a6816e
Fix formatting
SeppahBaws May 19, 2024
ec4c225
Bump Svelte version, add support for $state.is rune
SeppahBaws May 22, 2024
a4abf18
Fix eslint problems
SeppahBaws May 23, 2024
06df1e9
Hopefully fix lint errors for good now
SeppahBaws May 31, 2024
d196cab
Write Props typing as separate type for improved clarity
SeppahBaws Jun 6, 2024
a10300b
Bump svelte version, add support for updated Runes
SeppahBaws Jun 25, 2024
bc9c670
Bump vite and svelte versions
SeppahBaws Jul 5, 2024
3d55ad8
Update changeset and config
SeppahBaws Jul 7, 2024
3596843
Bump svelte versions
SeppahBaws Aug 4, 2024
9aa1de7
Merge latest changes from main branch
SeppahBaws Aug 19, 2024
309ceb8
Bump eslint in e2e/kit, update erroring old svelte syntax
SeppahBaws Aug 19, 2024
30d0563
undo broken eslint update
SeppahBaws Sep 4, 2024
0735cc1
Bump svelte version
SeppahBaws Sep 4, 2024
655acc3
Fix tests, update Runes, bump Svelte version
SeppahBaws Sep 30, 2024
a491f01
Force enable Runes mode in the plugin config
SeppahBaws Sep 30, 2024
b01a6f4
Bump playwright version
SeppahBaws Oct 11, 2024
d1f5060
Update global config description
SeppahBaws Oct 14, 2024
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
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "HoudiniGraphQL/houdini" }],
"commit": false,
"fixed": [["houdini*", "create-*"]],
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"updateInternalDependencies": "minor",
"ignore": ["e2e-api", "e2e-react", "e2e-kit", "e2e-svelte", "site"]
}
7 changes: 7 additions & 0 deletions .changeset/new-comics-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'houdini-plugin-svelte-global-stores': minor
'houdini-svelte': major
'houdini': minor
---

Add support for Svelte 5 and Svelte Runes
6 changes: 3 additions & 3 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches:
- next
- error-memory-leak
- svelte-5

env:
CI: true
Expand Down Expand Up @@ -35,13 +35,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 21.7.3
node-version: 20.13.1

# pnpm

Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.PLAYWRIGHT_VERSION }}
path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }}

- run: pnpm playwright install
- run: pnpm playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

# Run tests
Expand Down Expand Up @@ -230,7 +230,7 @@ jobs:
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16.17.0
node-version: 20.13.1

- uses: pnpm/action-setup@v2.0.1
name: Install pnpm
Expand Down
33 changes: 24 additions & 9 deletions e2e/kit/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
plugins: ['svelte3', '@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }],
settings: {
'svelte3/typescript': () => require('typescript')
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:svelte/recommended'
],
plugins: ['@typescript-eslint'],
ignorePatterns: ['*.cjs', '$houdini/**'],
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020
ecmaVersion: 2020,
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
Expand All @@ -21,6 +32,10 @@ module.exports = {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/ban-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-non-null-assertion': 'off'
'@typescript-eslint/no-non-null-assertion': 'off',
// Disable svelte-check, as we already have that as a separate step
'svelte/valid-compile': 'off',
// With component queries, it is valid to have e.g. props that are only used through the _QueryVariables function.
'@typescript-eslint/no-unused-vars': 'off'
}
};
41 changes: 21 additions & 20 deletions e2e/kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,42 @@
"build:generate": "pnpm build: && npx houdini generate",
"build:test": "pnpm build: && pnpm test",
"build:build": "pnpm build: && pnpm build",
"package": "svelte-kit package",
"previewWeb": "vite preview --port 3007",
"preview": "concurrently \"pnpm run previewWeb\" \"pnpm run api\" -n \"web,api\" -c \"green,magenta\"",
"tests": "playwright test ",
"tests": "playwright test",
"test": "npm run tests",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "pnpm run check -- --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
"lint": "prettier --ignore-path .gitignore --check . && eslint .",
"format": "prettier --ignore-path .gitignore --write ."
},
"devDependencies": {
"@kitql/helpers": "^0.8.2",
"@playwright/test": "1.30.0",
"@sveltejs/adapter-auto": "2.0.0",
"@sveltejs/kit": "1.9.3",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"@playwright/test": "1.48.0",
"@sveltejs/adapter-auto": "^3.2.1",
"@sveltejs/kit": "^2.5.10",
"@sveltejs/vite-plugin-svelte": "^3.1.1",
"@typescript-eslint/eslint-plugin": "^7.11.0",
"@typescript-eslint/parser": "^7.11.0",
"concurrently": "7.1.0",
"cross-env": "^7.0.3",
"e2e-api": "workspace:^",
"eslint": "^8.3.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-svelte3": "^4.0.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.39.0",
"houdini": "workspace:^",
"houdini-plugin-svelte-global-stores": "workspace:^",
"houdini-svelte": "workspace:^",
"prettier": "^2.8.3",
"prettier-plugin-svelte": "^2.9.0",
"svelte": "^3.57.0",
"svelte-check": "^3.0.1",
"svelte-preprocess": "^5.0.0",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.3",
"svelte": "5.0.0-next.260",
"svelte-check": "^3.8.0",
"svelte-eslint-parser": "^0.41.1",
"svelte-preprocess": "^5.1.4",
"tslib": "^2.3.1",
"typescript": "^4.9",
"vite": "^4.1.4",
"vite-plugin-lib-reporter": "^0.0.7"
"typescript": "^5.0.0",
"vite": "^5.2.12",
"vite-plugin-lib-reporter": "^0.1.0"
},
"dependencies": {
"@sveltejs/adapter-node": "^5.0.1",
Expand Down
32 changes: 12 additions & 20 deletions e2e/kit/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
// manual switch for now until replayio is fixed (currently breaking our tests)
const with_replayio = false;
import { ReporterDescription, defineConfig } from '@playwright/test';

const use = with_replayio
? {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...replayDevices['Replay Chromium'],
screenshot: 'only-on-failure'
}
: { screenshot: 'only-on-failure' };

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reporter = [['list']];
const reporters: ReporterDescription[] = [['list'], ['html', { open: 'never' }]];
if (process.env.CI) {
reporter.push(['html', { open: 'never' }]);
reporter.push(['github']);
reporters.push(['github']);
}

const config = {
export default defineConfig({
testMatch: 'spec.ts',
use: {
headless: true,
trace: 'on-first-retry',
screenshot: 'only-on-failure'
},
retries: process.env.CI ? 3 : 0,
workers: 5,
reporter,
use,
reporter: reporters,
webServer: {
command: 'npm run build && npm run preview',
port: 3007,
timeout: 120 * 1000
}
};

export default config;
});
2 changes: 1 addition & 1 deletion e2e/kit/src/app.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
1 change: 0 additions & 1 deletion e2e/kit/src/lib/QueryComponent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
};
};
// svelte-ignore unused-export-let
export let id = '';
$: result = graphql(`
Expand Down
6 changes: 4 additions & 2 deletions e2e/kit/src/lib/QueryExt.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<script lang="ts">
import { browser } from '$app/environment';
import { GQL_usersListComp } from '$houdini';
import { onMount } from 'svelte';
$: browser && GQL_usersListComp.fetch();
onMount(() => {
GQL_usersListComp.fetch();
});
</script>

<p id="QueryExt-result">
Expand Down
8 changes: 7 additions & 1 deletion e2e/kit/src/lib/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,11 @@ export const routes = {
Stores_subunsub_mutation: '/stores/subunsub-mutation',

Stores_Layouts: '/layouts',
Stores_Layouts_page2: '/layouts/page2'
Stores_Layouts_page2: '/layouts/page2',

Svelte5_Runes_Simple_SSR: '/svelte5-runes/simple-ssr',
Svelte5_Runes_Pagination: '/svelte5-runes/pagination',
Svelte5_Runes_Fragment: '/svelte5-runes/fragment',
Svelte5_Runes_Component: '/svelte5-runes/component',
Svelte5_Runes_Mutation: '/svelte5-runes/mutation'
};
1 change: 1 addition & 0 deletions e2e/kit/src/params/integer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MyEnum } from '$houdini';
// this is here to silence the warning that MyEnum isn't being used :facepalm:
// eslint-disable-next-line
MyEnum;

/** @type {import('@sveltejs/kit').ParamMatcher} */
Expand Down
2 changes: 1 addition & 1 deletion e2e/kit/src/routes/blocking/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('blocking', () => {
expect(h2).toBe('query_with_blocking_disable');

// we should have no data
await expect_to_be(page, 'undefined-undefined');
await expect_to_be(page, '-');

// the delay is 1000, let's wait a bit more
await sleep(1500);
Expand Down
4 changes: 2 additions & 2 deletions e2e/kit/src/routes/customIDs/spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test.describe('customIDs', () => {
// expect to have the righ data
await expect_to_be(
page,
'User: 1 - Book: 0 - Rate: 10 User: 5 - Book: 5 - Rate: 8 User: 1 - Book: 1 - Rate: 9'
'User: 1 - Book: 0 - Rate: 10User: 5 - Book: 5 - Rate: 8User: 1 - Book: 1 - Rate: 9'
);

const ret = await expect_1_gql(page, 'button[id=u77]');
Expand All @@ -20,7 +20,7 @@ test.describe('customIDs', () => {
// displayed result with the updated value to 77
await expect_to_be(
page,
'User: 1 - Book: 0 - Rate: 10 User: 5 - Book: 5 - Rate: 8 User: 1 - Book: 1 - Rate: 77'
'User: 1 - Book: 0 - Rate: 10User: 5 - Book: 5 - Rate: 8User: 1 - Book: 1 - Rate: 77'
);
});
});
4 changes: 2 additions & 2 deletions e2e/kit/src/routes/lists/all/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
$: browser && limit && updateQS();

async function updateQS() {
$page.url.searchParams.set('limit', limit.toString());
const newUrl = $page.url.href;
const newUrl = new URL($page.url);
newUrl.searchParams.set('limit', limit.toString());
await invalidate(newUrl);
await goto(newUrl, { replaceState: true, keepFocus: true });
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';
import { routes } from '../../lib/utils/routes.js';
import { expect_1_gql, expect_to_be, goto } from '../../lib/utils/testsHelper.js';
import { goto } from '../../lib/utils/testsHelper.js';
import { sleep } from '@kitql/helpers';

test('Nested fragment argument masking', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/kit/src/routes/nested-routes/+page.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async (event) => {
if (event.url.pathname.endsWith('nested-routes')) {
// fallback to user 2... because why not?
throw redirect(307, event.url.pathname + '/user-2');
redirect(307, event.url.pathname + '/user-2');
}
return {};
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const load: PageServerLoad = async (event) => {
}

// fallback to a default TAB if not set
throw redirect(307, event.url.pathname + '/birth');
redirect(307, event.url.pathname + '/birth');
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from '@playwright/test';
import { test } from '@playwright/test';
import { routes } from '../../../../lib/utils/routes.js';
import { expect_1_gql, expect_to_be, goto } from '../../../../lib/utils/testsHelper.js';

Expand Down
2 changes: 1 addition & 1 deletion e2e/kit/src/routes/plugin/query/variables-error/+page.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { error } from '@sveltejs/kit';

export function _PreprocessorTestQueryErrorVariables() {
throw error(403, 'test');
error(403, 'test');
}
Loading
Loading