houdini-svelte 0.17.9 → 0.17.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -0
- package/build/plugin-cjs/index.js +36 -16
- package/build/plugin-esm/index.js +36 -16
- package/build/runtime/adapter.d.ts +1 -7
- package/build/runtime-cjs/adapter.d.ts +1 -7
- package/build/runtime-cjs/adapter.js +2 -6
- package/build/runtime-esm/adapter.d.ts +1 -7
- package/build/runtime-esm/adapter.js +2 -5
- package/build/test-cjs/index.js +36 -16
- package/build/test-esm/index.js +36 -16
- package/package.json +19 -2
- package/.turbo/turbo-compile.log +0 -5
- package/.turbo/turbo-typedefs.log +0 -5
- package/CHANGELOG.md +0 -75
- package/src/plugin/codegen/components/index.ts +0 -149
- package/src/plugin/codegen/index.ts +0 -26
- package/src/plugin/codegen/routes/index.ts +0 -324
- package/src/plugin/codegen/routes/kit.test.ts +0 -534
- package/src/plugin/codegen/stores/custom.ts +0 -22
- package/src/plugin/codegen/stores/fragment.test.ts +0 -62
- package/src/plugin/codegen/stores/fragment.ts +0 -86
- package/src/plugin/codegen/stores/index.ts +0 -55
- package/src/plugin/codegen/stores/mutation.test.ts +0 -56
- package/src/plugin/codegen/stores/mutation.ts +0 -58
- package/src/plugin/codegen/stores/query.test.ts +0 -504
- package/src/plugin/codegen/stores/query.ts +0 -98
- package/src/plugin/codegen/stores/subscription.test.ts +0 -60
- package/src/plugin/codegen/stores/subscription.ts +0 -61
- package/src/plugin/extract.test.ts +0 -290
- package/src/plugin/extract.ts +0 -127
- package/src/plugin/extractLoadFunction.test.ts +0 -247
- package/src/plugin/extractLoadFunction.ts +0 -249
- package/src/plugin/fsPatch.ts +0 -246
- package/src/plugin/index.ts +0 -210
- package/src/plugin/kit.ts +0 -408
- package/src/plugin/transforms/index.ts +0 -90
- package/src/plugin/transforms/kit/index.ts +0 -20
- package/src/plugin/transforms/kit/init.test.ts +0 -28
- package/src/plugin/transforms/kit/init.ts +0 -75
- package/src/plugin/transforms/kit/load.test.ts +0 -1279
- package/src/plugin/transforms/kit/load.ts +0 -516
- package/src/plugin/transforms/kit/session.test.ts +0 -268
- package/src/plugin/transforms/kit/session.ts +0 -161
- package/src/plugin/transforms/query.test.ts +0 -99
- package/src/plugin/transforms/query.ts +0 -263
- package/src/plugin/transforms/reactive.ts +0 -126
- package/src/plugin/transforms/tags.ts +0 -20
- package/src/plugin/transforms/types.ts +0 -9
- package/src/plugin/validate.test.ts +0 -95
- package/src/plugin/validate.ts +0 -50
- package/src/preprocess/index.ts +0 -33
- package/src/runtime/adapter.ts +0 -21
- package/src/runtime/fragments.ts +0 -86
- package/src/runtime/index.ts +0 -95
- package/src/runtime/network.ts +0 -6
- package/src/runtime/session.ts +0 -187
- package/src/runtime/stores/fragment.ts +0 -48
- package/src/runtime/stores/index.ts +0 -5
- package/src/runtime/stores/mutation.ts +0 -190
- package/src/runtime/stores/pagination/cursor.ts +0 -260
- package/src/runtime/stores/pagination/fetch.ts +0 -7
- package/src/runtime/stores/pagination/fragment.ts +0 -236
- package/src/runtime/stores/pagination/index.ts +0 -7
- package/src/runtime/stores/pagination/offset.ts +0 -157
- package/src/runtime/stores/pagination/pageInfo.test.ts +0 -39
- package/src/runtime/stores/pagination/pageInfo.ts +0 -67
- package/src/runtime/stores/pagination/query.ts +0 -132
- package/src/runtime/stores/query.ts +0 -521
- package/src/runtime/stores/store.ts +0 -13
- package/src/runtime/stores/subscription.ts +0 -107
- package/src/runtime/types.ts +0 -40
- package/src/test/index.ts +0 -208
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img alt="houdini" height="200" src="https://raw.githubusercontent.com/HoudiniGraphql/houdini/main/.github/assets/houdini-v5.png" />
|
|
3
|
+
<br />
|
|
4
|
+
<br />
|
|
5
|
+
<strong>
|
|
6
|
+
The disappearing GraphQL clients.
|
|
7
|
+
</strong>
|
|
8
|
+
<br />
|
|
9
|
+
<br />
|
|
10
|
+
<a href="https://npmjs.org/package/houdini">
|
|
11
|
+
<img src="https://img.shields.io/npm/v/houdini.svg" alt="version" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://github.com/HoudiniGraphql/houdini/actions">
|
|
14
|
+
<img src="https://github.com/HoudiniGraphql/houdini/actions/workflows/tests.yml/badge.svg" alt="CI Tests" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://github.com/HoudiniGraphql/houdini">
|
|
17
|
+
<img src="https://img.shields.io/github/stars/HoudiniGraphql/houdini.svg?label=stars" alt="github stars" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://npmjs.org/package/houdini">
|
|
20
|
+
<img src="https://img.shields.io/npm/dm/houdini.svg" alt="downloads" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://github.com/HoudiniGraphql/houdini/blob/main/LICENSE">
|
|
23
|
+
<img src="https://img.shields.io/github/license/HoudiniGraphql/houdini.svg?maxAge=2592000" alt="license" />
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
----
|
|
28
|
+
|
|
29
|
+
At its core, houdini seeks to enable a high quality developer experience
|
|
30
|
+
without compromising bundle size. Like Svelte, houdini shifts what is
|
|
31
|
+
traditionally handled by a bloated runtime into a compile step that allows
|
|
32
|
+
for the generation of an incredibly lean GraphQL abstraction for your application.
|
|
33
|
+
See more at <a href="https://www.houdinigraphql.com">HoudiniGraphQL.com</a> 🚀
|
|
@@ -179521,6 +179521,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179521
179521
|
let layoutExports = [];
|
|
179522
179522
|
let pageQueries = [];
|
|
179523
179523
|
let layoutQueries = [];
|
|
179524
|
+
let validRoute = false;
|
|
179524
179525
|
for (const child of await fs_exports.readdir(dirpath)) {
|
|
179525
179526
|
const childPath = path_exports.join(dirpath, child);
|
|
179526
179527
|
if ((await fs_exports.stat(childPath)).isDirectory()) {
|
|
@@ -179528,18 +179529,21 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179528
179529
|
continue;
|
|
179529
179530
|
}
|
|
179530
179531
|
if (is_layout_script(framework2, childPath)) {
|
|
179532
|
+
validRoute = true;
|
|
179531
179533
|
const { houdini_load, exports } = await extract_load_function(config2, childPath);
|
|
179532
179534
|
await visitor.layoutQueries?.(houdini_load ?? [], childPath);
|
|
179533
179535
|
layoutQueries.push(...houdini_load ?? []);
|
|
179534
179536
|
await visitor.layoutExports?.(exports, childPath);
|
|
179535
179537
|
layoutExports.push(...exports);
|
|
179536
179538
|
} else if (is_page_script(framework2, childPath)) {
|
|
179539
|
+
validRoute = true;
|
|
179537
179540
|
const { houdini_load, exports } = await extract_load_function(config2, childPath);
|
|
179538
179541
|
await visitor.pageQueries?.(houdini_load ?? [], childPath);
|
|
179539
179542
|
pageQueries.push(...houdini_load ?? []);
|
|
179540
179543
|
await visitor.pageExports?.(exports, childPath);
|
|
179541
179544
|
pageExports.push(...exports);
|
|
179542
179545
|
} else if (is_layout_component(framework2, childPath)) {
|
|
179546
|
+
validRoute = true;
|
|
179543
179547
|
const contents = await fs_exports.readFile(childPath);
|
|
179544
179548
|
if (!contents) {
|
|
179545
179549
|
continue;
|
|
@@ -179563,6 +179567,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179563
179567
|
}
|
|
179564
179568
|
});
|
|
179565
179569
|
} else if (is_component(config2, framework2, child)) {
|
|
179570
|
+
validRoute = true;
|
|
179566
179571
|
const contents = await fs_exports.readFile(childPath);
|
|
179567
179572
|
if (!contents) {
|
|
179568
179573
|
continue;
|
|
@@ -179586,6 +179591,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179586
179591
|
}
|
|
179587
179592
|
});
|
|
179588
179593
|
} else if (child === plugin_config(config2).layoutQueryFilename) {
|
|
179594
|
+
validRoute = true;
|
|
179589
179595
|
const contents = await fs_exports.readFile(childPath);
|
|
179590
179596
|
if (!contents) {
|
|
179591
179597
|
continue;
|
|
@@ -179598,6 +179604,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179598
179604
|
throw routeQueryError(childPath);
|
|
179599
179605
|
}
|
|
179600
179606
|
} else if (child === plugin_config(config2).pageQueryFilename) {
|
|
179607
|
+
validRoute = true;
|
|
179601
179608
|
const contents = await fs_exports.readFile(childPath);
|
|
179602
179609
|
if (!contents) {
|
|
179603
179610
|
continue;
|
|
@@ -179613,7 +179620,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179613
179620
|
continue;
|
|
179614
179621
|
}
|
|
179615
179622
|
}
|
|
179616
|
-
if (visitor.route &&
|
|
179623
|
+
if (visitor.route && validRoute) {
|
|
179617
179624
|
const relative_path_regex = /src(.*)/;
|
|
179618
179625
|
const svelteTypeFilePath = path_exports.join(
|
|
179619
179626
|
config2.projectRoot,
|
|
@@ -179829,14 +179836,34 @@ async function svelteKitGenerator(framework2, { config: config2 }) {
|
|
|
179829
179836
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
179830
179837
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
179831
179838
|
const onLayoutError = layoutExports.includes("onError");
|
|
179832
|
-
const
|
|
179833
|
-
|
|
179839
|
+
const layout_append_VariablesFunction = append_VariablesFunction(
|
|
179840
|
+
"Layout",
|
|
179841
|
+
config2,
|
|
179842
|
+
uniqueLayoutQueries
|
|
179843
|
+
);
|
|
179844
|
+
const page_append_VariablesFunction = append_VariablesFunction(
|
|
179845
|
+
"Page",
|
|
179846
|
+
config2,
|
|
179847
|
+
uniquePageQueries
|
|
179848
|
+
);
|
|
179834
179849
|
const splitString = skTypeString.split("\n\n");
|
|
179835
179850
|
let typeImports = splitString[0];
|
|
179836
179851
|
let utilityTypes = splitString[1];
|
|
179837
179852
|
let typeExports = splitString[2];
|
|
179838
|
-
const
|
|
179839
|
-
|
|
179853
|
+
const functionImportsToBring = [];
|
|
179854
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
179855
|
+
functionImportsToBring.push("VariableFunction");
|
|
179856
|
+
}
|
|
179857
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
179858
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
179859
|
+
}
|
|
179860
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
179861
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
179862
|
+
}
|
|
179863
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
179864
|
+
import type { ${functionImportsToBring.join(
|
|
179865
|
+
", "
|
|
179866
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
179840
179867
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
179841
179868
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
179842
179869
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
@@ -179851,7 +179878,7 @@ import type { ${layoutVariableLoad || pageVariableLoad ? "VariableFunction, " :
|
|
|
179851
179878
|
onLayoutError,
|
|
179852
179879
|
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179853
179880
|
)
|
|
179854
|
-
).concat(
|
|
179881
|
+
).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
179855
179882
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
179856
179883
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
179857
179884
|
const name2 = query.name.value;
|
|
@@ -180336,10 +180363,10 @@ import_fs.default.readdirSync = function(filepath, options) {
|
|
|
180336
180363
|
function contains2(...names2) {
|
|
180337
180364
|
return names2.some((name2) => file_names.includes(name2));
|
|
180338
180365
|
}
|
|
180339
|
-
if (contains2("+page.svelte") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
180366
|
+
if (contains2("+page.svelte", "+page.gql") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
180340
180367
|
result.push(virtual_file("+page.js", options));
|
|
180341
180368
|
}
|
|
180342
|
-
if (contains2("+layout.svelte") && !contains2("+layout.ts", "+layout.js")) {
|
|
180369
|
+
if (contains2("+layout.svelte", "+layout.gql") && !contains2("+layout.ts", "+layout.js")) {
|
|
180343
180370
|
result.push(virtual_file("+layout.js", options));
|
|
180344
180371
|
}
|
|
180345
180372
|
const posix_filepath = path_exports.posixify(filepath.toString());
|
|
@@ -181393,16 +181420,9 @@ var HoudiniSveltePlugin = async () => ({
|
|
|
181393
181420
|
return content.replace("HOUDINI_CLIENT_PATH", relativePath);
|
|
181394
181421
|
},
|
|
181395
181422
|
"adapter.js": ({ content }) => {
|
|
181396
|
-
const sveltekit_adapter = `import {
|
|
181397
|
-
import { get } from 'svelte/store';
|
|
181398
|
-
import { browser, prerendering } from '$app/environment'
|
|
181399
|
-
import { page } from '$app/stores'
|
|
181423
|
+
const sveltekit_adapter = `import { browser, prerendering } from '$app/environment'
|
|
181400
181424
|
import { error as svelteKitError } from '@sveltejs/kit'
|
|
181401
181425
|
|
|
181402
|
-
export function goTo(location, options) {
|
|
181403
|
-
go(location, options)
|
|
181404
|
-
}
|
|
181405
|
-
|
|
181406
181426
|
export const isBrowser = browser
|
|
181407
181427
|
|
|
181408
181428
|
export let clientStarted = false;
|
|
@@ -179517,6 +179517,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179517
179517
|
let layoutExports = [];
|
|
179518
179518
|
let pageQueries = [];
|
|
179519
179519
|
let layoutQueries = [];
|
|
179520
|
+
let validRoute = false;
|
|
179520
179521
|
for (const child of await fs_exports.readdir(dirpath)) {
|
|
179521
179522
|
const childPath = path_exports.join(dirpath, child);
|
|
179522
179523
|
if ((await fs_exports.stat(childPath)).isDirectory()) {
|
|
@@ -179524,18 +179525,21 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179524
179525
|
continue;
|
|
179525
179526
|
}
|
|
179526
179527
|
if (is_layout_script(framework2, childPath)) {
|
|
179528
|
+
validRoute = true;
|
|
179527
179529
|
const { houdini_load, exports } = await extract_load_function(config2, childPath);
|
|
179528
179530
|
await visitor.layoutQueries?.(houdini_load ?? [], childPath);
|
|
179529
179531
|
layoutQueries.push(...houdini_load ?? []);
|
|
179530
179532
|
await visitor.layoutExports?.(exports, childPath);
|
|
179531
179533
|
layoutExports.push(...exports);
|
|
179532
179534
|
} else if (is_page_script(framework2, childPath)) {
|
|
179535
|
+
validRoute = true;
|
|
179533
179536
|
const { houdini_load, exports } = await extract_load_function(config2, childPath);
|
|
179534
179537
|
await visitor.pageQueries?.(houdini_load ?? [], childPath);
|
|
179535
179538
|
pageQueries.push(...houdini_load ?? []);
|
|
179536
179539
|
await visitor.pageExports?.(exports, childPath);
|
|
179537
179540
|
pageExports.push(...exports);
|
|
179538
179541
|
} else if (is_layout_component(framework2, childPath)) {
|
|
179542
|
+
validRoute = true;
|
|
179539
179543
|
const contents = await fs_exports.readFile(childPath);
|
|
179540
179544
|
if (!contents) {
|
|
179541
179545
|
continue;
|
|
@@ -179559,6 +179563,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179559
179563
|
}
|
|
179560
179564
|
});
|
|
179561
179565
|
} else if (is_component(config2, framework2, child)) {
|
|
179566
|
+
validRoute = true;
|
|
179562
179567
|
const contents = await fs_exports.readFile(childPath);
|
|
179563
179568
|
if (!contents) {
|
|
179564
179569
|
continue;
|
|
@@ -179582,6 +179587,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179582
179587
|
}
|
|
179583
179588
|
});
|
|
179584
179589
|
} else if (child === plugin_config(config2).layoutQueryFilename) {
|
|
179590
|
+
validRoute = true;
|
|
179585
179591
|
const contents = await fs_exports.readFile(childPath);
|
|
179586
179592
|
if (!contents) {
|
|
179587
179593
|
continue;
|
|
@@ -179594,6 +179600,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179594
179600
|
throw routeQueryError(childPath);
|
|
179595
179601
|
}
|
|
179596
179602
|
} else if (child === plugin_config(config2).pageQueryFilename) {
|
|
179603
|
+
validRoute = true;
|
|
179597
179604
|
const contents = await fs_exports.readFile(childPath);
|
|
179598
179605
|
if (!contents) {
|
|
179599
179606
|
continue;
|
|
@@ -179609,7 +179616,7 @@ async function walk_routes(config2, framework2, visitor, dirpath = config2.route
|
|
|
179609
179616
|
continue;
|
|
179610
179617
|
}
|
|
179611
179618
|
}
|
|
179612
|
-
if (visitor.route &&
|
|
179619
|
+
if (visitor.route && validRoute) {
|
|
179613
179620
|
const relative_path_regex = /src(.*)/;
|
|
179614
179621
|
const svelteTypeFilePath = path_exports.join(
|
|
179615
179622
|
config2.projectRoot,
|
|
@@ -179825,14 +179832,34 @@ async function svelteKitGenerator(framework2, { config: config2 }) {
|
|
|
179825
179832
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
179826
179833
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
179827
179834
|
const onLayoutError = layoutExports.includes("onError");
|
|
179828
|
-
const
|
|
179829
|
-
|
|
179835
|
+
const layout_append_VariablesFunction = append_VariablesFunction(
|
|
179836
|
+
"Layout",
|
|
179837
|
+
config2,
|
|
179838
|
+
uniqueLayoutQueries
|
|
179839
|
+
);
|
|
179840
|
+
const page_append_VariablesFunction = append_VariablesFunction(
|
|
179841
|
+
"Page",
|
|
179842
|
+
config2,
|
|
179843
|
+
uniquePageQueries
|
|
179844
|
+
);
|
|
179830
179845
|
const splitString = skTypeString.split("\n\n");
|
|
179831
179846
|
let typeImports = splitString[0];
|
|
179832
179847
|
let utilityTypes = splitString[1];
|
|
179833
179848
|
let typeExports = splitString[2];
|
|
179834
|
-
const
|
|
179835
|
-
|
|
179849
|
+
const functionImportsToBring = [];
|
|
179850
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
179851
|
+
functionImportsToBring.push("VariableFunction");
|
|
179852
|
+
}
|
|
179853
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
179854
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
179855
|
+
}
|
|
179856
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
179857
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
179858
|
+
}
|
|
179859
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
179860
|
+
import type { ${functionImportsToBring.join(
|
|
179861
|
+
", "
|
|
179862
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
179836
179863
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
179837
179864
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
179838
179865
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
@@ -179847,7 +179874,7 @@ import type { ${layoutVariableLoad || pageVariableLoad ? "VariableFunction, " :
|
|
|
179847
179874
|
onLayoutError,
|
|
179848
179875
|
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179849
179876
|
)
|
|
179850
|
-
).concat(
|
|
179877
|
+
).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
179851
179878
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
179852
179879
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
179853
179880
|
const name2 = query.name.value;
|
|
@@ -180332,10 +180359,10 @@ filesystem.readdirSync = function(filepath, options) {
|
|
|
180332
180359
|
function contains2(...names2) {
|
|
180333
180360
|
return names2.some((name2) => file_names.includes(name2));
|
|
180334
180361
|
}
|
|
180335
|
-
if (contains2("+page.svelte") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
180362
|
+
if (contains2("+page.svelte", "+page.gql") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
180336
180363
|
result.push(virtual_file("+page.js", options));
|
|
180337
180364
|
}
|
|
180338
|
-
if (contains2("+layout.svelte") && !contains2("+layout.ts", "+layout.js")) {
|
|
180365
|
+
if (contains2("+layout.svelte", "+layout.gql") && !contains2("+layout.ts", "+layout.js")) {
|
|
180339
180366
|
result.push(virtual_file("+layout.js", options));
|
|
180340
180367
|
}
|
|
180341
180368
|
const posix_filepath = path_exports.posixify(filepath.toString());
|
|
@@ -181389,16 +181416,9 @@ var HoudiniSveltePlugin = async () => ({
|
|
|
181389
181416
|
return content.replace("HOUDINI_CLIENT_PATH", relativePath);
|
|
181390
181417
|
},
|
|
181391
181418
|
"adapter.js": ({ content }) => {
|
|
181392
|
-
const sveltekit_adapter = `import {
|
|
181393
|
-
import { get } from 'svelte/store';
|
|
181394
|
-
import { browser, prerendering } from '$app/environment'
|
|
181395
|
-
import { page } from '$app/stores'
|
|
181419
|
+
const sveltekit_adapter = `import { browser, prerendering } from '$app/environment'
|
|
181396
181420
|
import { error as svelteKitError } from '@sveltejs/kit'
|
|
181397
181421
|
|
|
181398
|
-
export function goTo(location, options) {
|
|
181399
|
-
go(location, options)
|
|
181400
|
-
}
|
|
181401
|
-
|
|
181402
181422
|
export const isBrowser = browser
|
|
181403
181423
|
|
|
181404
181424
|
export let clientStarted = false;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
replaceState?: boolean;
|
|
3
|
-
noscroll?: boolean;
|
|
4
|
-
keepfocus?: boolean;
|
|
5
|
-
state?: any;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
export declare const isBrowser = false;
|
|
1
|
+
export declare const isBrowser = true;
|
|
8
2
|
/**
|
|
9
3
|
* After `clientStarted = true`, only client side navigation will happen.
|
|
10
4
|
*/
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
replaceState?: boolean;
|
|
3
|
-
noscroll?: boolean;
|
|
4
|
-
keepfocus?: boolean;
|
|
5
|
-
state?: any;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
export declare const isBrowser = false;
|
|
1
|
+
export declare const isBrowser = true;
|
|
8
2
|
/**
|
|
9
3
|
* After `clientStarted = true`, only client side navigation will happen.
|
|
10
4
|
*/
|
|
@@ -20,16 +20,13 @@ var adapter_exports = {};
|
|
|
20
20
|
__export(adapter_exports, {
|
|
21
21
|
clientStarted: () => clientStarted,
|
|
22
22
|
error: () => error,
|
|
23
|
-
goTo: () => goTo,
|
|
24
23
|
isBrowser: () => isBrowser,
|
|
25
24
|
isPrerender: () => isPrerender,
|
|
26
25
|
setClientStarted: () => setClientStarted
|
|
27
26
|
});
|
|
28
27
|
module.exports = __toCommonJS(adapter_exports);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const isBrowser = false;
|
|
32
|
-
let clientStarted = false;
|
|
28
|
+
const isBrowser = true;
|
|
29
|
+
let clientStarted = true;
|
|
33
30
|
let isPrerender = false;
|
|
34
31
|
const error = (code, message) => message;
|
|
35
32
|
function setClientStarted() {
|
|
@@ -39,7 +36,6 @@ function setClientStarted() {
|
|
|
39
36
|
0 && (module.exports = {
|
|
40
37
|
clientStarted,
|
|
41
38
|
error,
|
|
42
|
-
goTo,
|
|
43
39
|
isBrowser,
|
|
44
40
|
isPrerender,
|
|
45
41
|
setClientStarted
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
replaceState?: boolean;
|
|
3
|
-
noscroll?: boolean;
|
|
4
|
-
keepfocus?: boolean;
|
|
5
|
-
state?: any;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
-
export declare const isBrowser = false;
|
|
1
|
+
export declare const isBrowser = true;
|
|
8
2
|
/**
|
|
9
3
|
* After `clientStarted = true`, only client side navigation will happen.
|
|
10
4
|
*/
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const isBrowser = false;
|
|
4
|
-
let clientStarted = false;
|
|
1
|
+
const isBrowser = true;
|
|
2
|
+
let clientStarted = true;
|
|
5
3
|
let isPrerender = false;
|
|
6
4
|
const error = (code, message) => message;
|
|
7
5
|
function setClientStarted() {
|
|
@@ -10,7 +8,6 @@ function setClientStarted() {
|
|
|
10
8
|
export {
|
|
11
9
|
clientStarted,
|
|
12
10
|
error,
|
|
13
|
-
goTo,
|
|
14
11
|
isBrowser,
|
|
15
12
|
isPrerender,
|
|
16
13
|
setClientStarted
|
package/build/test-cjs/index.js
CHANGED
|
@@ -294176,6 +294176,7 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294176
294176
|
let layoutExports = [];
|
|
294177
294177
|
let pageQueries = [];
|
|
294178
294178
|
let layoutQueries = [];
|
|
294179
|
+
let validRoute = false;
|
|
294179
294180
|
for (const child of await fs_exports.readdir(dirpath)) {
|
|
294180
294181
|
const childPath = path_exports.join(dirpath, child);
|
|
294181
294182
|
if ((await fs_exports.stat(childPath)).isDirectory()) {
|
|
@@ -294183,18 +294184,21 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294183
294184
|
continue;
|
|
294184
294185
|
}
|
|
294185
294186
|
if (is_layout_script(framework2, childPath)) {
|
|
294187
|
+
validRoute = true;
|
|
294186
294188
|
const { houdini_load, exports } = await extract_load_function(config3, childPath);
|
|
294187
294189
|
await visitor.layoutQueries?.(houdini_load ?? [], childPath);
|
|
294188
294190
|
layoutQueries.push(...houdini_load ?? []);
|
|
294189
294191
|
await visitor.layoutExports?.(exports, childPath);
|
|
294190
294192
|
layoutExports.push(...exports);
|
|
294191
294193
|
} else if (is_page_script(framework2, childPath)) {
|
|
294194
|
+
validRoute = true;
|
|
294192
294195
|
const { houdini_load, exports } = await extract_load_function(config3, childPath);
|
|
294193
294196
|
await visitor.pageQueries?.(houdini_load ?? [], childPath);
|
|
294194
294197
|
pageQueries.push(...houdini_load ?? []);
|
|
294195
294198
|
await visitor.pageExports?.(exports, childPath);
|
|
294196
294199
|
pageExports.push(...exports);
|
|
294197
294200
|
} else if (is_layout_component(framework2, childPath)) {
|
|
294201
|
+
validRoute = true;
|
|
294198
294202
|
const contents = await fs_exports.readFile(childPath);
|
|
294199
294203
|
if (!contents) {
|
|
294200
294204
|
continue;
|
|
@@ -294218,6 +294222,7 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294218
294222
|
}
|
|
294219
294223
|
});
|
|
294220
294224
|
} else if (is_component(config3, framework2, child)) {
|
|
294225
|
+
validRoute = true;
|
|
294221
294226
|
const contents = await fs_exports.readFile(childPath);
|
|
294222
294227
|
if (!contents) {
|
|
294223
294228
|
continue;
|
|
@@ -294241,6 +294246,7 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294241
294246
|
}
|
|
294242
294247
|
});
|
|
294243
294248
|
} else if (child === plugin_config(config3).layoutQueryFilename) {
|
|
294249
|
+
validRoute = true;
|
|
294244
294250
|
const contents = await fs_exports.readFile(childPath);
|
|
294245
294251
|
if (!contents) {
|
|
294246
294252
|
continue;
|
|
@@ -294253,6 +294259,7 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294253
294259
|
throw routeQueryError(childPath);
|
|
294254
294260
|
}
|
|
294255
294261
|
} else if (child === plugin_config(config3).pageQueryFilename) {
|
|
294262
|
+
validRoute = true;
|
|
294256
294263
|
const contents = await fs_exports.readFile(childPath);
|
|
294257
294264
|
if (!contents) {
|
|
294258
294265
|
continue;
|
|
@@ -294268,7 +294275,7 @@ async function walk_routes(config3, framework2, visitor, dirpath = config3.route
|
|
|
294268
294275
|
continue;
|
|
294269
294276
|
}
|
|
294270
294277
|
}
|
|
294271
|
-
if (visitor.route &&
|
|
294278
|
+
if (visitor.route && validRoute) {
|
|
294272
294279
|
const relative_path_regex = /src(.*)/;
|
|
294273
294280
|
const svelteTypeFilePath = path_exports.join(
|
|
294274
294281
|
config3.projectRoot,
|
|
@@ -294484,14 +294491,34 @@ async function svelteKitGenerator(framework2, { config: config3 }) {
|
|
|
294484
294491
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
294485
294492
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
294486
294493
|
const onLayoutError = layoutExports.includes("onError");
|
|
294487
|
-
const
|
|
294488
|
-
|
|
294494
|
+
const layout_append_VariablesFunction = append_VariablesFunction(
|
|
294495
|
+
"Layout",
|
|
294496
|
+
config3,
|
|
294497
|
+
uniqueLayoutQueries
|
|
294498
|
+
);
|
|
294499
|
+
const page_append_VariablesFunction = append_VariablesFunction(
|
|
294500
|
+
"Page",
|
|
294501
|
+
config3,
|
|
294502
|
+
uniquePageQueries
|
|
294503
|
+
);
|
|
294489
294504
|
const splitString = skTypeString.split("\n\n");
|
|
294490
294505
|
let typeImports = splitString[0];
|
|
294491
294506
|
let utilityTypes = splitString[1];
|
|
294492
294507
|
let typeExports = splitString[2];
|
|
294493
|
-
const
|
|
294494
|
-
|
|
294508
|
+
const functionImportsToBring = [];
|
|
294509
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
294510
|
+
functionImportsToBring.push("VariableFunction");
|
|
294511
|
+
}
|
|
294512
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
294513
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
294514
|
+
}
|
|
294515
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
294516
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
294517
|
+
}
|
|
294518
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
294519
|
+
import type { ${functionImportsToBring.join(
|
|
294520
|
+
", "
|
|
294521
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
294495
294522
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
294496
294523
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
294497
294524
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
@@ -294506,7 +294533,7 @@ import type { ${layoutVariableLoad || pageVariableLoad ? "VariableFunction, " :
|
|
|
294506
294533
|
onLayoutError,
|
|
294507
294534
|
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294508
294535
|
)
|
|
294509
|
-
).concat(
|
|
294536
|
+
).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
294510
294537
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
294511
294538
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
294512
294539
|
const name2 = query.name.value;
|
|
@@ -294991,10 +295018,10 @@ import_fs.default.readdirSync = function(filepath, options) {
|
|
|
294991
295018
|
function contains2(...names2) {
|
|
294992
295019
|
return names2.some((name2) => file_names.includes(name2));
|
|
294993
295020
|
}
|
|
294994
|
-
if (contains2("+page.svelte") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
295021
|
+
if (contains2("+page.svelte", "+page.gql") && !contains2("+page.js", "+page.ts", "+page.server.js", "+page.server.ts")) {
|
|
294995
295022
|
result.push(virtual_file("+page.js", options));
|
|
294996
295023
|
}
|
|
294997
|
-
if (contains2("+layout.svelte") && !contains2("+layout.ts", "+layout.js")) {
|
|
295024
|
+
if (contains2("+layout.svelte", "+layout.gql") && !contains2("+layout.ts", "+layout.js")) {
|
|
294998
295025
|
result.push(virtual_file("+layout.js", options));
|
|
294999
295026
|
}
|
|
295000
295027
|
const posix_filepath = path_exports.posixify(filepath.toString());
|
|
@@ -296048,16 +296075,9 @@ var HoudiniSveltePlugin = async () => ({
|
|
|
296048
296075
|
return content.replace("HOUDINI_CLIENT_PATH", relativePath);
|
|
296049
296076
|
},
|
|
296050
296077
|
"adapter.js": ({ content }) => {
|
|
296051
|
-
const sveltekit_adapter = `import {
|
|
296052
|
-
import { get } from 'svelte/store';
|
|
296053
|
-
import { browser, prerendering } from '$app/environment'
|
|
296054
|
-
import { page } from '$app/stores'
|
|
296078
|
+
const sveltekit_adapter = `import { browser, prerendering } from '$app/environment'
|
|
296055
296079
|
import { error as svelteKitError } from '@sveltejs/kit'
|
|
296056
296080
|
|
|
296057
|
-
export function goTo(location, options) {
|
|
296058
|
-
go(location, options)
|
|
296059
|
-
}
|
|
296060
|
-
|
|
296061
296081
|
export const isBrowser = browser
|
|
296062
296082
|
|
|
296063
296083
|
export let clientStarted = false;
|