diff --git a/.changeset/proud-hairs-trade.md b/.changeset/proud-hairs-trade.md new file mode 100644 index 000000000..86461d535 --- /dev/null +++ b/.changeset/proud-hairs-trade.md @@ -0,0 +1,5 @@ +--- +'houdini-svelte': patch +--- + +Adding layout.gql special file diff --git a/.changeset/wild-coats-hang.md b/.changeset/wild-coats-hang.md new file mode 100644 index 000000000..3ebaae50b --- /dev/null +++ b/.changeset/wild-coats-hang.md @@ -0,0 +1,6 @@ +--- +'houdini': minor +'houdini-svelte': minor +--- + +Split houdini into two packages: `houdini` and `houdini-svelte` diff --git a/.eslintrc.cjs b/.eslintrc.cjs index 30de90737..9671b107e 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -2,6 +2,9 @@ module.exports = { root: true, extends: '@theguild', rules: { + '@typescript-eslint/triple-slash-reference': 'off', + '@typescript-eslint/no-empty-interface': 'off', + '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-non-null-assertion': 'off', @@ -28,7 +31,7 @@ module.exports = { 'object-shorthand': 'off', // 'no-console': ['error', { allow: ['info', 'warn', 'error', 'time', 'timeEnd'] }], }, - ignorePatterns: ['integration', 'example', 'site'], + ignorePatterns: ['e2e', 'example', 'site'], parserOptions: { sourceType: 'module', ecmaVersion: 2020, diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ef1833b65..c9b4a69b6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -81,13 +81,13 @@ jobs: run: pnpm install - name: Build packages - run: pnpm run build + run: pnpm run compile - name: Tests run: pnpm run tests - integration: - name: Integration Tests + e2e_sveltekit: + name: End-to-End Tests runs-on: ubuntu-latest steps: @@ -132,17 +132,14 @@ jobs: key: cache-playwright-linux-1.25.0 - name: Build packages - run: pnpm run build + run: pnpm run compile - name: Install Playwright if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps - - name: SvelteKit Sync - run: cd integration && npx svelte-kit sync - - - name: Integration Tests - run: pnpm --filter integration tests + - name: End-to-End Tests sveltekit + run: pnpm run --filter sveltekit build && pnpm --filter sveltekit tests env: RECORD_REPLAY_TEST_RUN_ID: ${{ env.GITHUB_SHA }} @@ -153,8 +150,8 @@ jobs: api-key: ${{ secrets.RECORD_REPLAY_API_KEY }} filter: ${{ 'function($v) { $v.metadata.test.result = "failed" and $v.status = "onDisk" }' }} - integration_linter: - name: Integration Linter + e2e_sveltekit_linter: + name: End-to-End Linter runs-on: ubuntu-latest steps: @@ -193,15 +190,12 @@ jobs: - name: Build Package run: pnpm run build - - name: SvelteKit Sync - run: cd integration && npx svelte-kit sync - - name: Build kit assets - run: pnpm --filter integration run build + run: pnpm --filter sveltekit run build # needs to run after build & houdini generate - - name: Integration lint - run: pnpm --filter integration run lint + - name: End-to-End lint + run: pnpm --filter sveltekit run lint - - name: Integration check - run: pnpm --filter integration run check + - name: End-to-End check + run: pnpm --filter sveltekit run check diff --git a/.gitignore b/.gitignore index 88bc500c0..eae3e0968 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,9 @@ node_modules + .DS_Store .vscode -build +packages/*/build bin .pnp.* @@ -12,4 +13,9 @@ example/.svelte-kit example/functions example/$houdini -/playground.js \ No newline at end of file +/playground.js + +.turbo +build/** +dist/** +.next/** diff --git a/.graphqlrc.yaml b/.graphqlrc.yaml index b4154f47f..0a92465f7 100644 --- a/.graphqlrc.yaml +++ b/.graphqlrc.yaml @@ -2,8 +2,8 @@ projects: default: # 👇 For vscode-graphql and intellisense schema: - - integration/api/*.graphql - - integration/$houdini/graphql/schema.graphql + - e2e/api/*.graphql + - e2e/$houdini/graphql/schema.graphql documents: - - integration/src/**/*.gql - - integration/$houdini/graphql/documents.gql + - e2e/src/**/*.gql + - e2e/$houdini/graphql/documents.gql diff --git a/.npmignore b/.npmignore deleted file mode 100644 index e8a4a845d..000000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -integration/ -example/ -.changeset/ -.github/ -*.test.ts \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..3bfab73a9 --- /dev/null +++ b/.npmrc @@ -0,0 +1,3 @@ +auto-install-peers=true +strict-peer-dependencies=false + diff --git a/.prettierignore b/.prettierignore index 279463882..d37871f4f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ **/build/** README.md -.github/** \ No newline at end of file +.github/** +packages/*/package.json \ No newline at end of file diff --git a/integration/.eslintrc.cjs b/e2e/sveltekit/.eslintrc.cjs similarity index 100% rename from integration/.eslintrc.cjs rename to e2e/sveltekit/.eslintrc.cjs diff --git a/integration/.gitignore b/e2e/sveltekit/.gitignore similarity index 100% rename from integration/.gitignore rename to e2e/sveltekit/.gitignore diff --git a/integration/.prettierrc b/e2e/sveltekit/.prettierrc similarity index 100% rename from integration/.prettierrc rename to e2e/sveltekit/.prettierrc diff --git a/e2e/sveltekit/README.md b/e2e/sveltekit/README.md new file mode 100644 index 000000000..ae938034f --- /dev/null +++ b/e2e/sveltekit/README.md @@ -0,0 +1 @@ +# Houdini End-to-End diff --git a/integration/api/graphql.mjs b/e2e/sveltekit/api/graphql.mjs similarity index 100% rename from integration/api/graphql.mjs rename to e2e/sveltekit/api/graphql.mjs diff --git a/integration/api/schema-hello.graphql b/e2e/sveltekit/api/schema-hello.graphql similarity index 100% rename from integration/api/schema-hello.graphql rename to e2e/sveltekit/api/schema-hello.graphql diff --git a/integration/api/schema.graphql b/e2e/sveltekit/api/schema.graphql similarity index 100% rename from integration/api/schema.graphql rename to e2e/sveltekit/api/schema.graphql diff --git a/integration/api/server.mjs b/e2e/sveltekit/api/server.mjs similarity index 100% rename from integration/api/server.mjs rename to e2e/sveltekit/api/server.mjs diff --git a/integration/houdini.config.js b/e2e/sveltekit/houdini.config.js similarity index 77% rename from integration/houdini.config.js rename to e2e/sveltekit/houdini.config.js index 59042bcda..3f9225341 100644 --- a/integration/houdini.config.js +++ b/e2e/sveltekit/houdini.config.js @@ -1,6 +1,7 @@ +/// + /** @type {import('houdini').ConfigFile} */ const config = { - client: './src/lib/graphql/houdiniClient', schemaPath: './api/*.graphql', defaultCachePolicy: 'CacheOrNetwork', defaultPartial: true, @@ -16,6 +17,11 @@ const config = { return val.getTime(); } } + }, + plugins: { + 'houdini-svelte': { + client: './src/lib/graphql/houdiniClient' + } } }; diff --git a/integration/package.json b/e2e/sveltekit/package.json similarity index 82% rename from integration/package.json rename to e2e/sveltekit/package.json index 339c83336..28866cd88 100644 --- a/integration/package.json +++ b/e2e/sveltekit/package.json @@ -1,9 +1,10 @@ { - "name": "integration", + "name": "sveltekit", "version": "0.0.1", "private": true, + "type": "module", "scripts": { - "web": "cross-env TZ=utc vite dev", + "web": "cross-env TZ=utc vite dev --host 0.0.0.0", "api": "cross-env TZ=utc node api/server.mjs", "dev": "concurrently \"pnpm run web\" \"pnpm run api\" -n \"web,api\" -c \"green,magenta\"", "build": "vite build", @@ -11,8 +12,9 @@ "previewWeb": "cross-env TZ=utc vite preview --port 3007", "preview": "concurrently \"pnpm run previewWeb\" \"pnpm run api\" -n \"web,api\" -c \"green,magenta\"", "tests": "playwright test ", + "test": "npm run tests", "check": "svelte-check --tsconfig ./tsconfig.json", - "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch", + "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=. ." }, @@ -20,7 +22,7 @@ "@playwright/test": "1.25.0", "@replayio/playwright": "0.2.23", "@sveltejs/adapter-auto": "1.0.0-next.66", - "@sveltejs/kit": "1.0.0-next.481", + "@sveltejs/kit": "1.0.0-next.510", "@typescript-eslint/eslint-plugin": "^5.10.1", "@typescript-eslint/parser": "^5.10.1", "concurrently": "7.1.0", @@ -30,6 +32,7 @@ "eslint-plugin-svelte3": "^4.0.0", "graphql": "^15.5.0", "houdini": "workspace:^", + "houdini-svelte": "workspace:^", "prettier": "^2.5.1", "prettier-plugin-svelte": "^2.5.0", "svelte": "^3.47.0", @@ -40,12 +43,12 @@ "vite": "^3.1.0" }, "dependencies": { - "@graphql-yoga/node": "^2.8.0", + "@graphql-yoga/node": "^2.13.13", + "@kitql/helper": "^0.5.0", "graphql-relay": "^0.10.0", "graphql-tag": "^2.12.6", "graphql-ws": "^5.8.2", "mdsvex": "^0.10.5", "ws": "^8.8.1" - }, - "type": "module" + } } diff --git a/integration/playwright.config.ts b/e2e/sveltekit/playwright.config.ts similarity index 86% rename from integration/playwright.config.ts rename to e2e/sveltekit/playwright.config.ts index 8c221d77a..8b9f7b428 100644 --- a/integration/playwright.config.ts +++ b/e2e/sveltekit/playwright.config.ts @@ -7,13 +7,13 @@ const with_replayio = false; const use = with_replayio ? { // eslint-disable-next-line @typescript-eslint/no-explicit-any - ...(replayDevices['Replay Chromium'] as any), + ...replayDevices['Replay Chromium'], screenshot: 'only-on-failure' } : { screenshot: 'only-on-failure' }; // eslint-disable-next-line @typescript-eslint/no-explicit-any -const reporter: any[] = [['list']]; +const reporter = [['list']]; if (process.env.CI) { reporter.push(['html', { open: 'never' }]); reporter.push(['github']); @@ -22,7 +22,7 @@ if (with_replayio) { reporter.push(['@replayio/playwright/reporter']); } -const config: PlaywrightTestConfig = { +const config = { // retries: 2, workers: 5, reporter, diff --git a/integration/src/app.d.ts b/e2e/sveltekit/src/app.d.ts similarity index 100% rename from integration/src/app.d.ts rename to e2e/sveltekit/src/app.d.ts diff --git a/integration/src/app.html b/e2e/sveltekit/src/app.html similarity index 100% rename from integration/src/app.html rename to e2e/sveltekit/src/app.html diff --git a/integration/src/hooks.server.ts b/e2e/sveltekit/src/hooks.server.ts similarity index 64% rename from integration/src/hooks.server.ts rename to e2e/sveltekit/src/hooks.server.ts index 77f97f14d..cd3199ba3 100644 --- a/integration/src/hooks.server.ts +++ b/e2e/sveltekit/src/hooks.server.ts @@ -1,9 +1,9 @@ -import houdini from './lib/graphql/houdiniClient'; +import { setSession } from '$houdini'; import type { Handle } from '@sveltejs/kit'; export const handle: Handle = async ({ event, resolve }) => { // set the session information for this event - houdini.setSession(event, { user: { token: '1234-Houdini-Token-5678' } }); + setSession(event, { user: { token: '1234-Houdini-Token-5678' } }); // pass the event onto the default handle return await resolve(event); diff --git a/integration/src/lib/QueryComponent.svelte b/e2e/sveltekit/src/lib/QueryComponent.svelte similarity index 100% rename from integration/src/lib/QueryComponent.svelte rename to e2e/sveltekit/src/lib/QueryComponent.svelte diff --git a/integration/src/lib/QueryExt.svelte b/e2e/sveltekit/src/lib/QueryExt.svelte similarity index 100% rename from integration/src/lib/QueryExt.svelte rename to e2e/sveltekit/src/lib/QueryExt.svelte diff --git a/integration/src/lib/graphql/houdiniClient.ts b/e2e/sveltekit/src/lib/graphql/houdiniClient.ts similarity index 100% rename from integration/src/lib/graphql/houdiniClient.ts rename to e2e/sveltekit/src/lib/graphql/houdiniClient.ts diff --git a/integration/src/lib/graphql/operations/FRAG.UserInfo.gql b/e2e/sveltekit/src/lib/graphql/operations/FRAG.UserInfo.gql similarity index 100% rename from integration/src/lib/graphql/operations/FRAG.UserInfo.gql rename to e2e/sveltekit/src/lib/graphql/operations/FRAG.UserInfo.gql diff --git a/integration/src/lib/graphql/operations/MUTATION.AddUser.gql b/e2e/sveltekit/src/lib/graphql/operations/MUTATION.AddUser.gql similarity index 100% rename from integration/src/lib/graphql/operations/MUTATION.AddUser.gql rename to e2e/sveltekit/src/lib/graphql/operations/MUTATION.AddUser.gql diff --git a/integration/src/lib/graphql/operations/MUTATION.EnumMutation.gql b/e2e/sveltekit/src/lib/graphql/operations/MUTATION.EnumMutation.gql similarity index 100% rename from integration/src/lib/graphql/operations/MUTATION.EnumMutation.gql rename to e2e/sveltekit/src/lib/graphql/operations/MUTATION.EnumMutation.gql diff --git a/integration/src/lib/graphql/operations/MUTATION.UpdateUser.gql b/e2e/sveltekit/src/lib/graphql/operations/MUTATION.UpdateUser.gql similarity index 100% rename from integration/src/lib/graphql/operations/MUTATION.UpdateUser.gql rename to e2e/sveltekit/src/lib/graphql/operations/MUTATION.UpdateUser.gql diff --git a/integration/src/lib/graphql/operations/MUTATION.UpdateUserSubUnsub.gql b/e2e/sveltekit/src/lib/graphql/operations/MUTATION.UpdateUserSubUnsub.gql similarity index 100% rename from integration/src/lib/graphql/operations/MUTATION.UpdateUserSubUnsub.gql rename to e2e/sveltekit/src/lib/graphql/operations/MUTATION.UpdateUserSubUnsub.gql diff --git a/integration/src/lib/graphql/operations/QUERY.Hello.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.Hello.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.Hello.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.Hello.gql diff --git a/integration/src/lib/graphql/operations/QUERY.MultiUser.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.MultiUser.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.MultiUser.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.MultiUser.gql diff --git a/integration/src/lib/graphql/operations/QUERY.User.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.User.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.User.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.User.gql diff --git a/integration/src/lib/graphql/operations/QUERY.UsersList.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.UsersList.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.UsersList.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.UsersList.gql diff --git a/integration/src/lib/graphql/operations/QUERY.UsersListSubUnsub.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.UsersListSubUnsub.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.UsersListSubUnsub.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.UsersListSubUnsub.gql diff --git a/integration/src/lib/graphql/operations/QUERY.usersListComp.gql b/e2e/sveltekit/src/lib/graphql/operations/QUERY.usersListComp.gql similarity index 100% rename from integration/src/lib/graphql/operations/QUERY.usersListComp.gql rename to e2e/sveltekit/src/lib/graphql/operations/QUERY.usersListComp.gql diff --git a/integration/src/lib/utils/routes.ts b/e2e/sveltekit/src/lib/utils/routes.ts similarity index 98% rename from integration/src/lib/utils/routes.ts rename to e2e/sveltekit/src/lib/utils/routes.ts index 87ebf5eba..518698bfe 100644 --- a/integration/src/lib/utils/routes.ts +++ b/e2e/sveltekit/src/lib/utils/routes.ts @@ -2,6 +2,9 @@ export const routes = { Home: '/', GraphQL: 'http://localhost:4000/graphql', + // features + Query_param: '/query-param', + Stores_SSR: '/stores/ssr', Stores_Network: '/stores/network', Stores_SSR_UserId_2: '/stores/ssr-2', diff --git a/integration/src/lib/utils/testsHelper.ts b/e2e/sveltekit/src/lib/utils/testsHelper.ts similarity index 100% rename from integration/src/lib/utils/testsHelper.ts rename to e2e/sveltekit/src/lib/utils/testsHelper.ts diff --git a/integration/src/routes/+error.svelte b/e2e/sveltekit/src/routes/+error.svelte similarity index 100% rename from integration/src/routes/+error.svelte rename to e2e/sveltekit/src/routes/+error.svelte diff --git a/integration/src/routes/+layout.svelte b/e2e/sveltekit/src/routes/+layout.svelte similarity index 89% rename from integration/src/routes/+layout.svelte rename to e2e/sveltekit/src/routes/+layout.svelte index 63ebe6a81..1911b7a97 100644 --- a/integration/src/routes/+layout.svelte +++ b/e2e/sveltekit/src/routes/+layout.svelte @@ -2,7 +2,7 @@ import { browser } from '$app/environment'; import { graphql } from '$houdini'; import cache from '$houdini/runtime/cache'; - import { routes } from '$lib/utils/routes'; + import { routes } from '$lib/utils/routes.js'; if (browser) { // @ts-ignore @@ -33,5 +33,5 @@
- {$info.data.session} + {$info.data?.session}
diff --git a/integration/src/routes/+page.svelte b/e2e/sveltekit/src/routes/+page.svelte similarity index 100% rename from integration/src/routes/+page.svelte rename to e2e/sveltekit/src/routes/+page.svelte diff --git a/integration/src/routes/index/spec.ts b/e2e/sveltekit/src/routes/index/spec.ts similarity index 100% rename from integration/src/routes/index/spec.ts rename to e2e/sveltekit/src/routes/index/spec.ts diff --git a/integration/src/routes/layouts/+layout.svelte b/e2e/sveltekit/src/routes/layouts/+layout.svelte similarity index 100% rename from integration/src/routes/layouts/+layout.svelte rename to e2e/sveltekit/src/routes/layouts/+layout.svelte diff --git a/integration/src/routes/layouts/+page.svelte b/e2e/sveltekit/src/routes/layouts/+page.svelte similarity index 100% rename from integration/src/routes/layouts/+page.svelte rename to e2e/sveltekit/src/routes/layouts/+page.svelte diff --git a/integration/src/routes/layouts/layout/spec.ts b/e2e/sveltekit/src/routes/layouts/layout/spec.ts similarity index 100% rename from integration/src/routes/layouts/layout/spec.ts rename to e2e/sveltekit/src/routes/layouts/layout/spec.ts diff --git a/integration/src/routes/layouts/page2/+page.svelte b/e2e/sveltekit/src/routes/layouts/page2/+page.svelte similarity index 100% rename from integration/src/routes/layouts/page2/+page.svelte rename to e2e/sveltekit/src/routes/layouts/page2/+page.svelte diff --git a/integration/src/routes/pagination/fragment/backwards-cursor/+page.svelte b/e2e/sveltekit/src/routes/pagination/fragment/backwards-cursor/+page.svelte similarity index 100% rename from integration/src/routes/pagination/fragment/backwards-cursor/+page.svelte rename to e2e/sveltekit/src/routes/pagination/fragment/backwards-cursor/+page.svelte diff --git a/integration/src/routes/pagination/fragment/backwards-cursor/spec.ts b/e2e/sveltekit/src/routes/pagination/fragment/backwards-cursor/spec.ts similarity index 100% rename from integration/src/routes/pagination/fragment/backwards-cursor/spec.ts rename to e2e/sveltekit/src/routes/pagination/fragment/backwards-cursor/spec.ts diff --git a/integration/src/routes/pagination/fragment/forward-cursor/+page.svelte b/e2e/sveltekit/src/routes/pagination/fragment/forward-cursor/+page.svelte similarity index 100% rename from integration/src/routes/pagination/fragment/forward-cursor/+page.svelte rename to e2e/sveltekit/src/routes/pagination/fragment/forward-cursor/+page.svelte diff --git a/integration/src/routes/pagination/fragment/forward-cursor/spec.ts b/e2e/sveltekit/src/routes/pagination/fragment/forward-cursor/spec.ts similarity index 100% rename from integration/src/routes/pagination/fragment/forward-cursor/spec.ts rename to e2e/sveltekit/src/routes/pagination/fragment/forward-cursor/spec.ts diff --git a/integration/src/routes/pagination/fragment/offset/+page.svelte b/e2e/sveltekit/src/routes/pagination/fragment/offset/+page.svelte similarity index 100% rename from integration/src/routes/pagination/fragment/offset/+page.svelte rename to e2e/sveltekit/src/routes/pagination/fragment/offset/+page.svelte diff --git a/integration/src/routes/pagination/fragment/offset/spec.ts b/e2e/sveltekit/src/routes/pagination/fragment/offset/spec.ts similarity index 100% rename from integration/src/routes/pagination/fragment/offset/spec.ts rename to e2e/sveltekit/src/routes/pagination/fragment/offset/spec.ts diff --git a/integration/src/routes/pagination/query/backwards-cursor/+page.svelte b/e2e/sveltekit/src/routes/pagination/query/backwards-cursor/+page.svelte similarity index 100% rename from integration/src/routes/pagination/query/backwards-cursor/+page.svelte rename to e2e/sveltekit/src/routes/pagination/query/backwards-cursor/+page.svelte diff --git a/integration/src/routes/pagination/query/backwards-cursor/spec.ts b/e2e/sveltekit/src/routes/pagination/query/backwards-cursor/spec.ts similarity index 100% rename from integration/src/routes/pagination/query/backwards-cursor/spec.ts rename to e2e/sveltekit/src/routes/pagination/query/backwards-cursor/spec.ts diff --git a/integration/src/routes/pagination/query/forward-cursor/+page.svelte b/e2e/sveltekit/src/routes/pagination/query/forward-cursor/+page.svelte similarity index 100% rename from integration/src/routes/pagination/query/forward-cursor/+page.svelte rename to e2e/sveltekit/src/routes/pagination/query/forward-cursor/+page.svelte diff --git a/integration/src/routes/pagination/query/forward-cursor/spec.ts b/e2e/sveltekit/src/routes/pagination/query/forward-cursor/spec.ts similarity index 100% rename from integration/src/routes/pagination/query/forward-cursor/spec.ts rename to e2e/sveltekit/src/routes/pagination/query/forward-cursor/spec.ts diff --git a/integration/src/routes/pagination/query/offset-variable/+page.svelte b/e2e/sveltekit/src/routes/pagination/query/offset-variable/+page.svelte similarity index 100% rename from integration/src/routes/pagination/query/offset-variable/+page.svelte rename to e2e/sveltekit/src/routes/pagination/query/offset-variable/+page.svelte diff --git a/integration/src/routes/pagination/query/offset-variable/+page.ts b/e2e/sveltekit/src/routes/pagination/query/offset-variable/+page.ts similarity index 100% rename from integration/src/routes/pagination/query/offset-variable/+page.ts rename to e2e/sveltekit/src/routes/pagination/query/offset-variable/+page.ts diff --git a/integration/src/routes/pagination/query/offset-variable/spec.ts b/e2e/sveltekit/src/routes/pagination/query/offset-variable/spec.ts similarity index 100% rename from integration/src/routes/pagination/query/offset-variable/spec.ts rename to e2e/sveltekit/src/routes/pagination/query/offset-variable/spec.ts diff --git a/integration/src/routes/pagination/query/offset/+page.svelte b/e2e/sveltekit/src/routes/pagination/query/offset/+page.svelte similarity index 100% rename from integration/src/routes/pagination/query/offset/+page.svelte rename to e2e/sveltekit/src/routes/pagination/query/offset/+page.svelte diff --git a/integration/src/routes/pagination/query/offset/spec.ts b/e2e/sveltekit/src/routes/pagination/query/offset/spec.ts similarity index 100% rename from integration/src/routes/pagination/query/offset/spec.ts rename to e2e/sveltekit/src/routes/pagination/query/offset/spec.ts diff --git a/integration/src/routes/plugin/+layout.svelte b/e2e/sveltekit/src/routes/plugin/+layout.svelte similarity index 100% rename from integration/src/routes/plugin/+layout.svelte rename to e2e/sveltekit/src/routes/plugin/+layout.svelte diff --git a/integration/src/routes/plugin/+layout.ts b/e2e/sveltekit/src/routes/plugin/+layout.ts similarity index 100% rename from integration/src/routes/plugin/+layout.ts rename to e2e/sveltekit/src/routes/plugin/+layout.ts diff --git a/integration/src/routes/plugin/fragment/update/+page.js b/e2e/sveltekit/src/routes/plugin/fragment/update/+page.js similarity index 100% rename from integration/src/routes/plugin/fragment/update/+page.js rename to e2e/sveltekit/src/routes/plugin/fragment/update/+page.js diff --git a/integration/src/routes/plugin/fragment/update/+page.svelte b/e2e/sveltekit/src/routes/plugin/fragment/update/+page.svelte similarity index 100% rename from integration/src/routes/plugin/fragment/update/+page.svelte rename to e2e/sveltekit/src/routes/plugin/fragment/update/+page.svelte diff --git a/integration/src/routes/plugin/fragment/update/spec.ts b/e2e/sveltekit/src/routes/plugin/fragment/update/spec.ts similarity index 100% rename from integration/src/routes/plugin/fragment/update/spec.ts rename to e2e/sveltekit/src/routes/plugin/fragment/update/spec.ts diff --git a/integration/src/routes/plugin/load/inlineAndGlobal/+page.js b/e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/+page.js similarity index 100% rename from integration/src/routes/plugin/load/inlineAndGlobal/+page.js rename to e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/+page.js diff --git a/integration/src/routes/plugin/load/inlineAndGlobal/+page.svelte b/e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/+page.svelte similarity index 100% rename from integration/src/routes/plugin/load/inlineAndGlobal/+page.svelte rename to e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/+page.svelte diff --git a/integration/src/routes/plugin/load/inlineAndGlobal/spec.ts b/e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/spec.ts similarity index 100% rename from integration/src/routes/plugin/load/inlineAndGlobal/spec.ts rename to e2e/sveltekit/src/routes/plugin/load/inlineAndGlobal/spec.ts diff --git a/integration/src/routes/plugin/load/list/+page.js b/e2e/sveltekit/src/routes/plugin/load/list/+page.js similarity index 100% rename from integration/src/routes/plugin/load/list/+page.js rename to e2e/sveltekit/src/routes/plugin/load/list/+page.js diff --git a/integration/src/routes/plugin/load/list/+page.svelte b/e2e/sveltekit/src/routes/plugin/load/list/+page.svelte similarity index 100% rename from integration/src/routes/plugin/load/list/+page.svelte rename to e2e/sveltekit/src/routes/plugin/load/list/+page.svelte diff --git a/integration/src/routes/plugin/load/list/spec.ts b/e2e/sveltekit/src/routes/plugin/load/list/spec.ts similarity index 100% rename from integration/src/routes/plugin/load/list/spec.ts rename to e2e/sveltekit/src/routes/plugin/load/list/spec.ts diff --git a/integration/src/routes/plugin/load/pageQuery-session/+page.gql b/e2e/sveltekit/src/routes/plugin/load/pageQuery-session/+page.gql similarity index 100% rename from integration/src/routes/plugin/load/pageQuery-session/+page.gql rename to e2e/sveltekit/src/routes/plugin/load/pageQuery-session/+page.gql diff --git a/integration/src/routes/plugin/load/pageQuery-session/+page.svelte b/e2e/sveltekit/src/routes/plugin/load/pageQuery-session/+page.svelte similarity index 100% rename from integration/src/routes/plugin/load/pageQuery-session/+page.svelte rename to e2e/sveltekit/src/routes/plugin/load/pageQuery-session/+page.svelte diff --git a/integration/src/routes/plugin/load/pageQuery-session/spec.ts b/e2e/sveltekit/src/routes/plugin/load/pageQuery-session/spec.ts similarity index 100% rename from integration/src/routes/plugin/load/pageQuery-session/spec.ts rename to e2e/sveltekit/src/routes/plugin/load/pageQuery-session/spec.ts diff --git a/integration/src/routes/plugin/load/pageQuery/+page.gql b/e2e/sveltekit/src/routes/plugin/load/pageQuery/+page.gql similarity index 100% rename from integration/src/routes/plugin/load/pageQuery/+page.gql rename to e2e/sveltekit/src/routes/plugin/load/pageQuery/+page.gql diff --git a/integration/src/routes/plugin/load/pageQuery/+page.svelte b/e2e/sveltekit/src/routes/plugin/load/pageQuery/+page.svelte similarity index 100% rename from integration/src/routes/plugin/load/pageQuery/+page.svelte rename to e2e/sveltekit/src/routes/plugin/load/pageQuery/+page.svelte diff --git a/integration/src/routes/plugin/load/pageQuery/spec.ts b/e2e/sveltekit/src/routes/plugin/load/pageQuery/spec.ts similarity index 100% rename from integration/src/routes/plugin/load/pageQuery/spec.ts rename to e2e/sveltekit/src/routes/plugin/load/pageQuery/spec.ts diff --git a/integration/src/routes/plugin/load/single/+page.js b/e2e/sveltekit/src/routes/plugin/load/single/+page.js similarity index 100% rename from integration/src/routes/plugin/load/single/+page.js rename to e2e/sveltekit/src/routes/plugin/load/single/+page.js diff --git a/integration/src/routes/plugin/load/single/+page.svelte b/e2e/sveltekit/src/routes/plugin/load/single/+page.svelte similarity index 100% rename from integration/src/routes/plugin/load/single/+page.svelte rename to e2e/sveltekit/src/routes/plugin/load/single/+page.svelte diff --git a/integration/src/routes/plugin/load/single/spec.ts b/e2e/sveltekit/src/routes/plugin/load/single/spec.ts similarity index 100% rename from integration/src/routes/plugin/load/single/spec.ts rename to e2e/sveltekit/src/routes/plugin/load/single/spec.ts diff --git a/integration/src/routes/plugin/query/afterLoad/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/afterLoad/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/afterLoad/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/afterLoad/+page.svelte diff --git a/integration/src/routes/plugin/query/afterLoad/+page.ts b/e2e/sveltekit/src/routes/plugin/query/afterLoad/+page.ts similarity index 100% rename from integration/src/routes/plugin/query/afterLoad/+page.ts rename to e2e/sveltekit/src/routes/plugin/query/afterLoad/+page.ts diff --git a/integration/src/routes/plugin/query/afterLoad/spec.ts b/e2e/sveltekit/src/routes/plugin/query/afterLoad/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/afterLoad/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/afterLoad/spec.ts diff --git a/integration/src/routes/plugin/query/beforeLoad/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/beforeLoad/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/beforeLoad/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/beforeLoad/+page.svelte diff --git a/integration/src/routes/plugin/query/beforeLoad/+page.ts b/e2e/sveltekit/src/routes/plugin/query/beforeLoad/+page.ts similarity index 100% rename from integration/src/routes/plugin/query/beforeLoad/+page.ts rename to e2e/sveltekit/src/routes/plugin/query/beforeLoad/+page.ts diff --git a/integration/src/routes/plugin/query/beforeLoad/spec.ts b/e2e/sveltekit/src/routes/plugin/query/beforeLoad/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/beforeLoad/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/beforeLoad/spec.ts diff --git a/integration/src/routes/plugin/query/component/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/component/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/component/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/component/+page.svelte diff --git a/integration/src/routes/plugin/query/component/spec.ts b/e2e/sveltekit/src/routes/plugin/query/component/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/component/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/component/spec.ts diff --git a/integration/src/routes/plugin/query/layout/+layout.svelte b/e2e/sveltekit/src/routes/plugin/query/layout/+layout.svelte similarity index 100% rename from integration/src/routes/plugin/query/layout/+layout.svelte rename to e2e/sveltekit/src/routes/plugin/query/layout/+layout.svelte diff --git a/integration/src/routes/plugin/query/layout/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/layout/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/layout/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/layout/+page.svelte diff --git a/integration/src/routes/plugin/query/layout/layout/spec.ts b/e2e/sveltekit/src/routes/plugin/query/layout/layout/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/layout/layout/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/layout/layout/spec.ts diff --git a/integration/src/routes/plugin/query/multiple/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/multiple/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/multiple/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/multiple/+page.svelte diff --git a/integration/src/routes/plugin/query/multiple/spec.ts b/e2e/sveltekit/src/routes/plugin/query/multiple/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/multiple/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/multiple/spec.ts diff --git a/integration/src/routes/plugin/query/onError/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/onError/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/onError/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/onError/+page.svelte diff --git a/integration/src/routes/plugin/query/onError/+page.ts b/e2e/sveltekit/src/routes/plugin/query/onError/+page.ts similarity index 100% rename from integration/src/routes/plugin/query/onError/+page.ts rename to e2e/sveltekit/src/routes/plugin/query/onError/+page.ts diff --git a/integration/src/routes/plugin/query/onError/spec.ts b/e2e/sveltekit/src/routes/plugin/query/onError/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/onError/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/onError/spec.ts diff --git a/integration/src/routes/plugin/query/scalars/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/scalars/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/scalars/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/scalars/+page.svelte diff --git a/integration/src/routes/plugin/query/scalars/spec.ts b/e2e/sveltekit/src/routes/plugin/query/scalars/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/scalars/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/scalars/spec.ts diff --git a/integration/src/routes/plugin/query/simple/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/simple/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/simple/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/simple/+page.svelte diff --git a/integration/src/routes/plugin/query/simple/spec.ts b/e2e/sveltekit/src/routes/plugin/query/simple/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/simple/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/simple/spec.ts diff --git a/integration/src/routes/plugin/query/variable-[id]/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/variable-[id]/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/variable-[id]/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/variable-[id]/+page.svelte diff --git a/integration/src/routes/plugin/query/variable-[id]/+page.ts b/e2e/sveltekit/src/routes/plugin/query/variable-[id]/+page.ts similarity index 100% rename from integration/src/routes/plugin/query/variable-[id]/+page.ts rename to e2e/sveltekit/src/routes/plugin/query/variable-[id]/+page.ts diff --git a/integration/src/routes/plugin/query/variable-[id]/spec.ts b/e2e/sveltekit/src/routes/plugin/query/variable-[id]/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/variable-[id]/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/variable-[id]/spec.ts diff --git a/integration/src/routes/plugin/query/variables-error/+page.js b/e2e/sveltekit/src/routes/plugin/query/variables-error/+page.js similarity index 100% rename from integration/src/routes/plugin/query/variables-error/+page.js rename to e2e/sveltekit/src/routes/plugin/query/variables-error/+page.js diff --git a/integration/src/routes/plugin/query/variables-error/+page.svelte b/e2e/sveltekit/src/routes/plugin/query/variables-error/+page.svelte similarity index 100% rename from integration/src/routes/plugin/query/variables-error/+page.svelte rename to e2e/sveltekit/src/routes/plugin/query/variables-error/+page.svelte diff --git a/integration/src/routes/plugin/query/variables-error/spec.ts b/e2e/sveltekit/src/routes/plugin/query/variables-error/spec.ts similarity index 100% rename from integration/src/routes/plugin/query/variables-error/spec.ts rename to e2e/sveltekit/src/routes/plugin/query/variables-error/spec.ts diff --git a/e2e/sveltekit/src/routes/query-param/+error.svelte b/e2e/sveltekit/src/routes/query-param/+error.svelte new file mode 100644 index 000000000..a4c4765d8 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/+error.svelte @@ -0,0 +1,12 @@ + + + + +User Not found... diff --git a/e2e/sveltekit/src/routes/query-param/+page.server.ts b/e2e/sveltekit/src/routes/query-param/+page.server.ts new file mode 100644 index 000000000..4227aeb33 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/+page.server.ts @@ -0,0 +1,10 @@ +import { redirect } from '@sveltejs/kit'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async (event) => { + if (event.url.pathname.endsWith('query-param')) { + // fallback to user 2... because why not? + throw redirect(307, event.url.pathname + '/user-2'); + } + return {}; +}; diff --git a/e2e/sveltekit/src/routes/query-param/Loading.svelte b/e2e/sveltekit/src/routes/query-param/Loading.svelte new file mode 100644 index 000000000..acd270659 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/Loading.svelte @@ -0,0 +1,32 @@ + + +One eternity later... + + diff --git a/e2e/sveltekit/src/routes/query-param/UserName.svelte b/e2e/sveltekit/src/routes/query-param/UserName.svelte new file mode 100644 index 000000000..c88a6429c --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/UserName.svelte @@ -0,0 +1,25 @@ + + +{#if $data} + {$data.name} +{:else} + +{/if} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.gql b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.gql new file mode 100644 index 000000000..0fe20746c --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.gql @@ -0,0 +1,6 @@ +query Layout_User($userId: ID!) { + user(id: $userId, snapshot: "Page_User", delay: 750) { + id + ...UserName + } +} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.svelte b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.svelte new file mode 100644 index 000000000..8555377fd --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.svelte @@ -0,0 +1,59 @@ + + +user-1 +user-2 +user-3 + +

Page:

+ + + + diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.ts b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.ts new file mode 100644 index 000000000..595ff0aa5 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/+layout.ts @@ -0,0 +1,5 @@ +import type { Layout_UserVariables as variables } from './$houdini'; + +export const Layout_UserVariables: variables = ({ params }) => { + return { userId: params.userId }; +}; diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/+page.server.ts b/e2e/sveltekit/src/routes/query-param/user-[userId]/+page.server.ts new file mode 100644 index 000000000..061b3269e --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/+page.server.ts @@ -0,0 +1,11 @@ +import { redirect } from '@sveltejs/kit'; +import type { PageServerLoad } from './$types'; + +export const load: PageServerLoad = async (event) => { + if (event.url.pathname.endsWith('birth') || event.url.pathname.endsWith('friend')) { + return {}; + } + + // fallback to a default TAB if not set + throw redirect(307, event.url.pathname + '/birth'); +}; diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.gql b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.gql new file mode 100644 index 000000000..64df9e38d --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.gql @@ -0,0 +1,6 @@ +query Page_User_Birth($userId: ID!) { + user(id: $userId, snapshot: "Page_User", delay: 1000) { + id + birthDate + } +} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.svelte b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.svelte new file mode 100644 index 000000000..509edd10e --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.svelte @@ -0,0 +1,31 @@ + + +

Tab: Birth

+ +{#if $Page_User_Birth.data?.user?.birthDate !== undefined} + {$Page_User_Birth.data?.user.birthDate?.toISOString().split('T')[0]} +{:else} + +{/if} + + +{#if $Page_User_Birth.isFetching} +
+
+
+
+ {console.log('isFetching in the console... when everything is cached, it should not be logged!')} +{/if} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.ts b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.ts new file mode 100644 index 000000000..717420c76 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/birth/+page.ts @@ -0,0 +1,6 @@ +import type { Page_User_BirthVariables as variables } from './$houdini'; + +// should be gone with https://github.com/HoudiniGraphql/houdini/issues/372 +export const Page_User_BirthVariables: variables = ({ params }) => { + return { userId: params.userId }; +}; diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.gql b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.gql new file mode 100644 index 000000000..8956a9826 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.gql @@ -0,0 +1,12 @@ +query Page_User_Firends($userId: ID!, $size: Int) { + user(id: $userId, snapshot: "Page_User", delay: 1200) { + id + friendsConnection(first: $size) { + edges { + node { + id + } + } + } + } +} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.svelte b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.svelte new file mode 100644 index 000000000..29acbf6ec --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.svelte @@ -0,0 +1,16 @@ + + +

Tab: Number of Fiends

+ +{#if $Page_User_Firends.data?.user?.friendsConnection.edges} + {$Page_User_Firends.data?.user.friendsConnection.edges.length} +{:else} + +{/if} diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.ts b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.ts new file mode 100644 index 000000000..87b54196d --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/friends/+page.ts @@ -0,0 +1,12 @@ +import type { Page_User_FirendsVariables as Variables } from './$houdini'; + +// should be gone with https://github.com/HoudiniGraphql/houdini/issues/372 +export const Page_User_FirendsVariables: Variables = ({ params, url }) => { + // 1 we know that Page_User can take a "size" and it's an Int + // 2 check if size is in searchParams + // 3 cast string to... primitives, or marchal (or the other one, I never know! the type... not the serialized one) + const rawSize = url.searchParams.get('size'); + const size: number | undefined = rawSize ? parseInt(rawSize, 10) : undefined; + + return { userId: params.userId, size }; +}; diff --git a/e2e/sveltekit/src/routes/query-param/user-[userId]/spec.ts b/e2e/sveltekit/src/routes/query-param/user-[userId]/spec.ts new file mode 100644 index 000000000..b6d46c1e0 --- /dev/null +++ b/e2e/sveltekit/src/routes/query-param/user-[userId]/spec.ts @@ -0,0 +1,20 @@ +import { expect, test } from '@playwright/test'; +import { routes } from '../../../lib/utils/routes.js'; +import { expectToBe, expect_n_gql, goto, navSelector } from '../../../lib/utils/testsHelper.js'; + +test.describe('+Layout.gql', () => { + test('No GraphQL request & response happen (SSR)', async ({ page }) => { + await goto(page, routes.Query_param); + await expectToBe(page, 'Page: Samuel Jackson', 'h3'); + }); + + test('From HOME, navigate to page (only 1 graphql queries should happen, not more!)', async ({ + page + }) => { + await goto(page, routes.Home); + + const listStr = await expect_n_gql(page, navSelector(routes.Query_param), 1); + const expected = [`{"data":{"user":{"id":"Page_User:2","name":"Samuel Jackson"}}}`]; + expect(listStr).toStrictEqual(expected); + }); +}); diff --git a/integration/src/routes/spec.ts b/e2e/sveltekit/src/routes/spec.ts similarity index 100% rename from integration/src/routes/spec.ts rename to e2e/sveltekit/src/routes/spec.ts diff --git a/integration/src/routes/stores/endpoint-query/+page.server.ts b/e2e/sveltekit/src/routes/stores/endpoint-query/+page.server.ts similarity index 100% rename from integration/src/routes/stores/endpoint-query/+page.server.ts rename to e2e/sveltekit/src/routes/stores/endpoint-query/+page.server.ts diff --git a/integration/src/routes/stores/endpoint-query/+page.svelte b/e2e/sveltekit/src/routes/stores/endpoint-query/+page.svelte similarity index 100% rename from integration/src/routes/stores/endpoint-query/+page.svelte rename to e2e/sveltekit/src/routes/stores/endpoint-query/+page.svelte diff --git a/integration/src/routes/stores/endpoint-query/spec.ts b/e2e/sveltekit/src/routes/stores/endpoint-query/spec.ts similarity index 100% rename from integration/src/routes/stores/endpoint-query/spec.ts rename to e2e/sveltekit/src/routes/stores/endpoint-query/spec.ts diff --git a/integration/src/routes/stores/fragment-null/+page.svelte b/e2e/sveltekit/src/routes/stores/fragment-null/+page.svelte similarity index 100% rename from integration/src/routes/stores/fragment-null/+page.svelte rename to e2e/sveltekit/src/routes/stores/fragment-null/+page.svelte diff --git a/integration/src/routes/stores/fragment-null/spec.ts b/e2e/sveltekit/src/routes/stores/fragment-null/spec.ts similarity index 100% rename from integration/src/routes/stores/fragment-null/spec.ts rename to e2e/sveltekit/src/routes/stores/fragment-null/spec.ts diff --git a/integration/src/routes/stores/metadata/+page.svelte b/e2e/sveltekit/src/routes/stores/metadata/+page.svelte similarity index 88% rename from integration/src/routes/stores/metadata/+page.svelte rename to e2e/sveltekit/src/routes/stores/metadata/+page.svelte index 5fd53c055..c97e4f0a1 100644 --- a/integration/src/routes/stores/metadata/+page.svelte +++ b/e2e/sveltekit/src/routes/stores/metadata/+page.svelte @@ -14,6 +14,8 @@ ); } + // there's nothing passing the session there to this fetch so the result is undefined + $: browser && GQL_Session.fetch({ metadata: { logResult: true }, diff --git a/integration/src/routes/stores/metadata/spec.ts b/e2e/sveltekit/src/routes/stores/metadata/spec.ts similarity index 89% rename from integration/src/routes/stores/metadata/spec.ts rename to e2e/sveltekit/src/routes/stores/metadata/spec.ts index ceeb89a7b..edffc8653 100644 --- a/integration/src/routes/stores/metadata/spec.ts +++ b/e2e/sveltekit/src/routes/stores/metadata/spec.ts @@ -3,7 +3,7 @@ import { routes } from '../../../lib/utils/routes.js'; import { expect_1_gql, goto_expect_n_gql } from '../../../lib/utils/testsHelper.js'; test.describe('Metadata Page', () => { - test('Mutation => Should display the raw result in the console as info', async ({ page }) => { + test('Mutation => Should pass metadata', async ({ page }) => { // Listen to the console let displayed = ''; page.on('console', (msg) => { diff --git a/integration/src/routes/stores/mutation-enums/+page.svelte b/e2e/sveltekit/src/routes/stores/mutation-enums/+page.svelte similarity index 100% rename from integration/src/routes/stores/mutation-enums/+page.svelte rename to e2e/sveltekit/src/routes/stores/mutation-enums/+page.svelte diff --git a/integration/src/routes/stores/mutation-enums/spec.ts b/e2e/sveltekit/src/routes/stores/mutation-enums/spec.ts similarity index 100% rename from integration/src/routes/stores/mutation-enums/spec.ts rename to e2e/sveltekit/src/routes/stores/mutation-enums/spec.ts diff --git a/integration/src/routes/stores/mutation-scalars/+page.svelte b/e2e/sveltekit/src/routes/stores/mutation-scalars/+page.svelte similarity index 100% rename from integration/src/routes/stores/mutation-scalars/+page.svelte rename to e2e/sveltekit/src/routes/stores/mutation-scalars/+page.svelte diff --git a/integration/src/routes/stores/mutation-scalars/spec.ts b/e2e/sveltekit/src/routes/stores/mutation-scalars/spec.ts similarity index 100% rename from integration/src/routes/stores/mutation-scalars/spec.ts rename to e2e/sveltekit/src/routes/stores/mutation-scalars/spec.ts diff --git a/integration/src/routes/stores/mutation-update/+page.svelte b/e2e/sveltekit/src/routes/stores/mutation-update/+page.svelte similarity index 94% rename from integration/src/routes/stores/mutation-update/+page.svelte rename to e2e/sveltekit/src/routes/stores/mutation-update/+page.svelte index d71a870f2..0fb53e1b9 100644 --- a/integration/src/routes/stores/mutation-update/+page.svelte +++ b/e2e/sveltekit/src/routes/stores/mutation-update/+page.svelte @@ -1,5 +1,5 @@ diff --git a/e2e/sveltekit/src/routes/stores/ssr/+page.ts b/e2e/sveltekit/src/routes/stores/ssr/+page.ts new file mode 100644 index 000000000..c79e56221 --- /dev/null +++ b/e2e/sveltekit/src/routes/stores/ssr/+page.ts @@ -0,0 +1,15 @@ +import { usersListStore, HelloStore } from '$houdini'; +import type { LoadEvent } from '@sveltejs/kit'; + +export async function load(event: LoadEvent) { + const usersList = new usersListStore(); + const Hello = new HelloStore(); + + await Promise.all([usersList.fetch({ event }), Hello.fetch({ event })]); + + return { + test: 'hello', + usersList, + Hello + }; +} diff --git a/integration/src/routes/stores/ssr/spec.ts b/e2e/sveltekit/src/routes/stores/ssr/spec.ts similarity index 100% rename from integration/src/routes/stores/ssr/spec.ts rename to e2e/sveltekit/src/routes/stores/ssr/spec.ts diff --git a/integration/src/routes/stores/subunsub-list/+page.svelte b/e2e/sveltekit/src/routes/stores/subunsub-list/+page.svelte similarity index 100% rename from integration/src/routes/stores/subunsub-list/+page.svelte rename to e2e/sveltekit/src/routes/stores/subunsub-list/+page.svelte diff --git a/integration/src/routes/stores/subunsub-list/spec.ts b/e2e/sveltekit/src/routes/stores/subunsub-list/spec.ts similarity index 100% rename from integration/src/routes/stores/subunsub-list/spec.ts rename to e2e/sveltekit/src/routes/stores/subunsub-list/spec.ts diff --git a/integration/src/routes/stores/subunsub-mutation/+page.svelte b/e2e/sveltekit/src/routes/stores/subunsub-mutation/+page.svelte similarity index 100% rename from integration/src/routes/stores/subunsub-mutation/+page.svelte rename to e2e/sveltekit/src/routes/stores/subunsub-mutation/+page.svelte diff --git a/integration/src/routes/stores/withComp/+page.svelte b/e2e/sveltekit/src/routes/stores/withComp/+page.svelte similarity index 100% rename from integration/src/routes/stores/withComp/+page.svelte rename to e2e/sveltekit/src/routes/stores/withComp/+page.svelte diff --git a/integration/static/favicon.png b/e2e/sveltekit/static/favicon.png similarity index 100% rename from integration/static/favicon.png rename to e2e/sveltekit/static/favicon.png diff --git a/integration/svelte.config.js b/e2e/sveltekit/svelte.config.js similarity index 100% rename from integration/svelte.config.js rename to e2e/sveltekit/svelte.config.js diff --git a/integration/tsconfig.json b/e2e/sveltekit/tsconfig.json similarity index 100% rename from integration/tsconfig.json rename to e2e/sveltekit/tsconfig.json diff --git a/integration/vite.config.js b/e2e/sveltekit/vite.config.js similarity index 100% rename from integration/vite.config.js rename to e2e/sveltekit/vite.config.js diff --git a/example/houdini.config.js b/example/houdini.config.js index 8e7887719..44663169e 100644 --- a/example/houdini.config.js +++ b/example/houdini.config.js @@ -1,6 +1,5 @@ /** @type {import('houdini').ConfigFile} */ const config = { - client: './src/client.ts', apiUrl: 'http://localhost:4000/graphql', scalars: { DateTime: { @@ -13,6 +12,11 @@ const config = { }, }, }, + plugins: { + 'houdini-svelte': { + client: './src/client.ts', + }, + }, } export default config diff --git a/example/package.json b/example/package.json index 118e82d15..acfa80ce3 100644 --- a/example/package.json +++ b/example/package.json @@ -11,23 +11,24 @@ "start": "vite preview" }, "devDependencies": { - "@graphql-yoga/node": "2.8.0", + "@graphql-yoga/node": "^2.8.0", "@kitql/vite-plugin-watch-and-run": "^0.4.0", - "@sveltejs/kit": "1.0.0-next.445", + "@sveltejs/kit": "1.0.0-next.510", "concurrently": "^6.2.1", "graphql": "15.5.0", "houdini": "workspace:^", - "svelte": "^3.38.2", - "svelte-preprocess": "^4.0.0", - "tslib": "^2.2.0", - "typescript": "^4.0.0", - "vite": "^3.0.0", + "houdini-svelte": "workspace:^", + "svelte": "^3.50.0", + "svelte-preprocess": "^4.10.1", + "tslib": "^2.3.1", + "typescript": "^4.8.4", + "vite": "^3.1.0", "ws": "^8.8.1" }, "dependencies": { - "graphql-relay": "0.8.0", + "graphql-relay": "0.10.0", "graphql-tag": "2.12.6", - "graphql-ws": "5.8.2" + "graphql-ws": "^5.11.2" }, "type": "module" } diff --git a/example/src/lib/ItemEntry.svelte b/example/src/lib/ItemEntry.svelte index 50ef3f3d2..1eb93b709 100755 --- a/example/src/lib/ItemEntry.svelte +++ b/example/src/lib/ItemEntry.svelte @@ -6,6 +6,7 @@ // get the information we need about the item const data = fragment( + item, graphql` fragment ItemEntry_item on TodoItem { id @@ -13,8 +14,7 @@ completed createdAt } - `, - item + ` ) // create the functions we'll invoke to check, uncheck, and delete the item diff --git a/example/src/routes/+layout.js b/example/src/routes/+layout.js deleted file mode 100644 index 3644d5bcd..000000000 --- a/example/src/routes/+layout.js +++ /dev/null @@ -1,5 +0,0 @@ -import { browser } from '$app/environment' - -import houdiniClient from '../client' - -houdiniClient.init() diff --git a/example/src/routes/[filter]/+page.svelte b/example/src/routes/[filter]/+page.svelte index b12289472..600eaa9b2 100644 --- a/example/src/routes/[filter]/+page.svelte +++ b/example/src/routes/[filter]/+page.svelte @@ -1,32 +1,15 @@ -s

todos

- {#if $pageInfo.hasNextPage} + {#if $AllItems.pageInfo.hasNextPage} {/if}
    - {#each $data?.filteredItems.edges ?? [] as edge (edge.node?.id)} + {#each $AllItems.data?.filteredItems.edges ?? [] as edge (edge.node?.id)} {/each}
diff --git a/example/src/routes/[filter]/+page.ts b/example/src/routes/[filter]/+page.ts index 3810699b7..5e058df73 100644 --- a/example/src/routes/[filter]/+page.ts +++ b/example/src/routes/[filter]/+page.ts @@ -1,3 +1,27 @@ +import { graphql } from '$houdini' + +export const houdini_load = graphql` + query AllItems($completed: Boolean) @cache(policy: CacheOrNetwork) { + filteredItems: items(completed: $completed, first: 2) @paginate(name: "Filtered_Items") { + edges { + node { + id + completed + ...ItemEntry_item + } + } + } + allItems: items @list(name: "All_Items") { + edges { + node { + id + completed + } + } + } + } +` + export function AllItemsVariables({ params }) { // if there is no filter assigned, dont enforce one in the query if (!params.filter || params.filter === 'all') { diff --git a/example/src/routes/addItem/+page.svelte b/example/src/routes/addItem/+page.svelte deleted file mode 100644 index 1f49e0348..000000000 --- a/example/src/routes/addItem/+page.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - -