houdini-svelte 0.17.10 → 0.17.12
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/build/plugin-cjs/index.js +49 -21
- package/build/plugin-esm/index.js +49 -21
- package/build/test-cjs/index.js +49 -21
- package/build/test-esm/index.js +49 -21
- package/package.json +2 -2
|
@@ -179836,29 +179836,57 @@ async function svelteKitGenerator(framework2, { config: config2 }) {
|
|
|
179836
179836
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
179837
179837
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
179838
179838
|
const onLayoutError = layoutExports.includes("onError");
|
|
179839
|
-
const
|
|
179840
|
-
|
|
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
|
+
);
|
|
179849
|
+
const layout_append_beforeLoad = append_beforeLoad(beforeLayoutLoad, "Layout");
|
|
179850
|
+
const page_append_beforeLoad = append_beforeLoad(beforePageLoad, "Page");
|
|
179851
|
+
const layout_append_afterLoad = append_afterLoad(
|
|
179852
|
+
afterLayoutLoad,
|
|
179853
|
+
"Layout",
|
|
179854
|
+
layoutQueries
|
|
179855
|
+
);
|
|
179856
|
+
const page_append_afterLoad = append_afterLoad(afterPageLoad, "Page", pageQueries);
|
|
179857
|
+
const layout_append_onError = append_onError(
|
|
179858
|
+
onLayoutError,
|
|
179859
|
+
"Layout",
|
|
179860
|
+
layoutQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179861
|
+
);
|
|
179862
|
+
const page_append_onError = append_onError(
|
|
179863
|
+
onPageError,
|
|
179864
|
+
"Page",
|
|
179865
|
+
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179866
|
+
);
|
|
179841
179867
|
const splitString = skTypeString.split("\n\n");
|
|
179842
179868
|
let typeImports = splitString[0];
|
|
179843
179869
|
let utilityTypes = splitString[1];
|
|
179844
179870
|
let typeExports = splitString[2];
|
|
179845
|
-
const
|
|
179846
|
-
|
|
179871
|
+
const functionImportsToBring = [];
|
|
179872
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
179873
|
+
functionImportsToBring.push("VariableFunction");
|
|
179874
|
+
}
|
|
179875
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
179876
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
179877
|
+
}
|
|
179878
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
179879
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
179880
|
+
}
|
|
179881
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
179882
|
+
import type { ${functionImportsToBring.join(
|
|
179883
|
+
", "
|
|
179884
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
179847
179885
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
179848
179886
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
179849
179887
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
179850
179888
|
utilityTypes = utilityTypes.concat(layoutParams).concat(pageParams).replaceAll(/\$types\.js/gm, "$houdini");
|
|
179851
|
-
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(
|
|
179852
|
-
append_onError(
|
|
179853
|
-
onPageError,
|
|
179854
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179855
|
-
)
|
|
179856
|
-
).concat(
|
|
179857
|
-
append_onError(
|
|
179858
|
-
onLayoutError,
|
|
179859
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179860
|
-
)
|
|
179861
|
-
).concat(append_VariablesFunction("Layout", config2, uniqueLayoutQueries)).concat(append_VariablesFunction("Page", config2, uniquePageQueries)).replace(
|
|
179889
|
+
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(layout_append_beforeLoad).concat(page_append_beforeLoad).concat(layout_append_afterLoad).concat(page_append_afterLoad).concat(layout_append_onError).concat(page_append_onError).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
179862
179890
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
179863
179891
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
179864
179892
|
const name2 = query.name.value;
|
|
@@ -179922,9 +179950,9 @@ type LoadInput = { ${queries.filter((query) => query.variableDefinitions?.length
|
|
|
179922
179950
|
return [name2, name2 + "$input"].join(": ");
|
|
179923
179951
|
}).join("; ")} };` : ""}`;
|
|
179924
179952
|
}
|
|
179925
|
-
function append_afterLoad(
|
|
179953
|
+
function append_afterLoad(afterLoad, type, queries) {
|
|
179926
179954
|
return afterLoad ? `
|
|
179927
|
-
type AfterLoadReturn = ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad
|
|
179955
|
+
type AfterLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad>>;
|
|
179928
179956
|
type AfterLoadData = {
|
|
179929
179957
|
${internal_append_afterLoad(queries)}
|
|
179930
179958
|
};
|
|
@@ -179942,15 +179970,15 @@ function internal_append_afterLoad(queries) {
|
|
|
179942
179970
|
return [name2, name2 + "$result"].join(": ");
|
|
179943
179971
|
}).join(";\n ")}`;
|
|
179944
179972
|
}
|
|
179945
|
-
function append_beforeLoad(beforeLoad) {
|
|
179973
|
+
function append_beforeLoad(beforeLoad, type) {
|
|
179946
179974
|
return beforeLoad ? `
|
|
179947
179975
|
export type BeforeLoadEvent = PageLoadEvent;
|
|
179948
|
-
type BeforeLoadReturn = ReturnType<typeof import('
|
|
179976
|
+
type BeforeLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').beforeLoad>>;
|
|
179949
179977
|
` : "";
|
|
179950
179978
|
}
|
|
179951
|
-
function append_onError(onError, hasLoadInput) {
|
|
179979
|
+
function append_onError(onError, type, hasLoadInput) {
|
|
179952
179980
|
return onError ? `
|
|
179953
|
-
type OnErrorReturn = ReturnType<typeof import('
|
|
179981
|
+
type OnErrorReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').onError>>;
|
|
179954
179982
|
export type OnErrorEvent = { event: Kit.LoadEvent, input: ${hasLoadInput ? "LoadInput" : "{}"}, error: Error | Error[] };
|
|
179955
179983
|
` : "";
|
|
179956
179984
|
}
|
|
@@ -179832,29 +179832,57 @@ async function svelteKitGenerator(framework2, { config: config2 }) {
|
|
|
179832
179832
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
179833
179833
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
179834
179834
|
const onLayoutError = layoutExports.includes("onError");
|
|
179835
|
-
const
|
|
179836
|
-
|
|
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
|
+
);
|
|
179845
|
+
const layout_append_beforeLoad = append_beforeLoad(beforeLayoutLoad, "Layout");
|
|
179846
|
+
const page_append_beforeLoad = append_beforeLoad(beforePageLoad, "Page");
|
|
179847
|
+
const layout_append_afterLoad = append_afterLoad(
|
|
179848
|
+
afterLayoutLoad,
|
|
179849
|
+
"Layout",
|
|
179850
|
+
layoutQueries
|
|
179851
|
+
);
|
|
179852
|
+
const page_append_afterLoad = append_afterLoad(afterPageLoad, "Page", pageQueries);
|
|
179853
|
+
const layout_append_onError = append_onError(
|
|
179854
|
+
onLayoutError,
|
|
179855
|
+
"Layout",
|
|
179856
|
+
layoutQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179857
|
+
);
|
|
179858
|
+
const page_append_onError = append_onError(
|
|
179859
|
+
onPageError,
|
|
179860
|
+
"Page",
|
|
179861
|
+
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179862
|
+
);
|
|
179837
179863
|
const splitString = skTypeString.split("\n\n");
|
|
179838
179864
|
let typeImports = splitString[0];
|
|
179839
179865
|
let utilityTypes = splitString[1];
|
|
179840
179866
|
let typeExports = splitString[2];
|
|
179841
|
-
const
|
|
179842
|
-
|
|
179867
|
+
const functionImportsToBring = [];
|
|
179868
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
179869
|
+
functionImportsToBring.push("VariableFunction");
|
|
179870
|
+
}
|
|
179871
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
179872
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
179873
|
+
}
|
|
179874
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
179875
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
179876
|
+
}
|
|
179877
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
179878
|
+
import type { ${functionImportsToBring.join(
|
|
179879
|
+
", "
|
|
179880
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
179843
179881
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
179844
179882
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
179845
179883
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
179846
179884
|
utilityTypes = utilityTypes.concat(layoutParams).concat(pageParams).replaceAll(/\$types\.js/gm, "$houdini");
|
|
179847
|
-
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(
|
|
179848
|
-
append_onError(
|
|
179849
|
-
onPageError,
|
|
179850
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179851
|
-
)
|
|
179852
|
-
).concat(
|
|
179853
|
-
append_onError(
|
|
179854
|
-
onLayoutError,
|
|
179855
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
179856
|
-
)
|
|
179857
|
-
).concat(append_VariablesFunction("Layout", config2, uniqueLayoutQueries)).concat(append_VariablesFunction("Page", config2, uniquePageQueries)).replace(
|
|
179885
|
+
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(layout_append_beforeLoad).concat(page_append_beforeLoad).concat(layout_append_afterLoad).concat(page_append_afterLoad).concat(layout_append_onError).concat(page_append_onError).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
179858
179886
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
179859
179887
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
179860
179888
|
const name2 = query.name.value;
|
|
@@ -179918,9 +179946,9 @@ type LoadInput = { ${queries.filter((query) => query.variableDefinitions?.length
|
|
|
179918
179946
|
return [name2, name2 + "$input"].join(": ");
|
|
179919
179947
|
}).join("; ")} };` : ""}`;
|
|
179920
179948
|
}
|
|
179921
|
-
function append_afterLoad(
|
|
179949
|
+
function append_afterLoad(afterLoad, type, queries) {
|
|
179922
179950
|
return afterLoad ? `
|
|
179923
|
-
type AfterLoadReturn = ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad
|
|
179951
|
+
type AfterLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad>>;
|
|
179924
179952
|
type AfterLoadData = {
|
|
179925
179953
|
${internal_append_afterLoad(queries)}
|
|
179926
179954
|
};
|
|
@@ -179938,15 +179966,15 @@ function internal_append_afterLoad(queries) {
|
|
|
179938
179966
|
return [name2, name2 + "$result"].join(": ");
|
|
179939
179967
|
}).join(";\n ")}`;
|
|
179940
179968
|
}
|
|
179941
|
-
function append_beforeLoad(beforeLoad) {
|
|
179969
|
+
function append_beforeLoad(beforeLoad, type) {
|
|
179942
179970
|
return beforeLoad ? `
|
|
179943
179971
|
export type BeforeLoadEvent = PageLoadEvent;
|
|
179944
|
-
type BeforeLoadReturn = ReturnType<typeof import('
|
|
179972
|
+
type BeforeLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').beforeLoad>>;
|
|
179945
179973
|
` : "";
|
|
179946
179974
|
}
|
|
179947
|
-
function append_onError(onError, hasLoadInput) {
|
|
179975
|
+
function append_onError(onError, type, hasLoadInput) {
|
|
179948
179976
|
return onError ? `
|
|
179949
|
-
type OnErrorReturn = ReturnType<typeof import('
|
|
179977
|
+
type OnErrorReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').onError>>;
|
|
179950
179978
|
export type OnErrorEvent = { event: Kit.LoadEvent, input: ${hasLoadInput ? "LoadInput" : "{}"}, error: Error | Error[] };
|
|
179951
179979
|
` : "";
|
|
179952
179980
|
}
|
package/build/test-cjs/index.js
CHANGED
|
@@ -294491,29 +294491,57 @@ async function svelteKitGenerator(framework2, { config: config3 }) {
|
|
|
294491
294491
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
294492
294492
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
294493
294493
|
const onLayoutError = layoutExports.includes("onError");
|
|
294494
|
-
const
|
|
294495
|
-
|
|
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
|
+
);
|
|
294504
|
+
const layout_append_beforeLoad = append_beforeLoad(beforeLayoutLoad, "Layout");
|
|
294505
|
+
const page_append_beforeLoad = append_beforeLoad(beforePageLoad, "Page");
|
|
294506
|
+
const layout_append_afterLoad = append_afterLoad(
|
|
294507
|
+
afterLayoutLoad,
|
|
294508
|
+
"Layout",
|
|
294509
|
+
layoutQueries
|
|
294510
|
+
);
|
|
294511
|
+
const page_append_afterLoad = append_afterLoad(afterPageLoad, "Page", pageQueries);
|
|
294512
|
+
const layout_append_onError = append_onError(
|
|
294513
|
+
onLayoutError,
|
|
294514
|
+
"Layout",
|
|
294515
|
+
layoutQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294516
|
+
);
|
|
294517
|
+
const page_append_onError = append_onError(
|
|
294518
|
+
onPageError,
|
|
294519
|
+
"Page",
|
|
294520
|
+
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294521
|
+
);
|
|
294496
294522
|
const splitString = skTypeString.split("\n\n");
|
|
294497
294523
|
let typeImports = splitString[0];
|
|
294498
294524
|
let utilityTypes = splitString[1];
|
|
294499
294525
|
let typeExports = splitString[2];
|
|
294500
|
-
const
|
|
294501
|
-
|
|
294526
|
+
const functionImportsToBring = [];
|
|
294527
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
294528
|
+
functionImportsToBring.push("VariableFunction");
|
|
294529
|
+
}
|
|
294530
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
294531
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
294532
|
+
}
|
|
294533
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
294534
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
294535
|
+
}
|
|
294536
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
294537
|
+
import type { ${functionImportsToBring.join(
|
|
294538
|
+
", "
|
|
294539
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
294502
294540
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
294503
294541
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
294504
294542
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
294505
294543
|
utilityTypes = utilityTypes.concat(layoutParams).concat(pageParams).replaceAll(/\$types\.js/gm, "$houdini");
|
|
294506
|
-
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(
|
|
294507
|
-
append_onError(
|
|
294508
|
-
onPageError,
|
|
294509
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294510
|
-
)
|
|
294511
|
-
).concat(
|
|
294512
|
-
append_onError(
|
|
294513
|
-
onLayoutError,
|
|
294514
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294515
|
-
)
|
|
294516
|
-
).concat(append_VariablesFunction("Layout", config3, uniqueLayoutQueries)).concat(append_VariablesFunction("Page", config3, uniquePageQueries)).replace(
|
|
294544
|
+
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(layout_append_beforeLoad).concat(page_append_beforeLoad).concat(layout_append_afterLoad).concat(page_append_afterLoad).concat(layout_append_onError).concat(page_append_onError).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
294517
294545
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
294518
294546
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
294519
294547
|
const name2 = query.name.value;
|
|
@@ -294577,9 +294605,9 @@ type LoadInput = { ${queries.filter((query) => query.variableDefinitions?.length
|
|
|
294577
294605
|
return [name2, name2 + "$input"].join(": ");
|
|
294578
294606
|
}).join("; ")} };` : ""}`;
|
|
294579
294607
|
}
|
|
294580
|
-
function append_afterLoad(
|
|
294608
|
+
function append_afterLoad(afterLoad, type, queries) {
|
|
294581
294609
|
return afterLoad ? `
|
|
294582
|
-
type AfterLoadReturn = ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad
|
|
294610
|
+
type AfterLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad>>;
|
|
294583
294611
|
type AfterLoadData = {
|
|
294584
294612
|
${internal_append_afterLoad(queries)}
|
|
294585
294613
|
};
|
|
@@ -294597,15 +294625,15 @@ function internal_append_afterLoad(queries) {
|
|
|
294597
294625
|
return [name2, name2 + "$result"].join(": ");
|
|
294598
294626
|
}).join(";\n ")}`;
|
|
294599
294627
|
}
|
|
294600
|
-
function append_beforeLoad(beforeLoad) {
|
|
294628
|
+
function append_beforeLoad(beforeLoad, type) {
|
|
294601
294629
|
return beforeLoad ? `
|
|
294602
294630
|
export type BeforeLoadEvent = PageLoadEvent;
|
|
294603
|
-
type BeforeLoadReturn = ReturnType<typeof import('
|
|
294631
|
+
type BeforeLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').beforeLoad>>;
|
|
294604
294632
|
` : "";
|
|
294605
294633
|
}
|
|
294606
|
-
function append_onError(onError, hasLoadInput) {
|
|
294634
|
+
function append_onError(onError, type, hasLoadInput) {
|
|
294607
294635
|
return onError ? `
|
|
294608
|
-
type OnErrorReturn = ReturnType<typeof import('
|
|
294636
|
+
type OnErrorReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').onError>>;
|
|
294609
294637
|
export type OnErrorEvent = { event: Kit.LoadEvent, input: ${hasLoadInput ? "LoadInput" : "{}"}, error: Error | Error[] };
|
|
294610
294638
|
` : "";
|
|
294611
294639
|
}
|
package/build/test-esm/index.js
CHANGED
|
@@ -294480,29 +294480,57 @@ async function svelteKitGenerator(framework2, { config: config3 }) {
|
|
|
294480
294480
|
const afterLayoutLoad = layoutExports.includes("afterLoad");
|
|
294481
294481
|
const beforeLayoutLoad = layoutExports.includes("beforeLoad");
|
|
294482
294482
|
const onLayoutError = layoutExports.includes("onError");
|
|
294483
|
-
const
|
|
294484
|
-
|
|
294483
|
+
const layout_append_VariablesFunction = append_VariablesFunction(
|
|
294484
|
+
"Layout",
|
|
294485
|
+
config3,
|
|
294486
|
+
uniqueLayoutQueries
|
|
294487
|
+
);
|
|
294488
|
+
const page_append_VariablesFunction = append_VariablesFunction(
|
|
294489
|
+
"Page",
|
|
294490
|
+
config3,
|
|
294491
|
+
uniquePageQueries
|
|
294492
|
+
);
|
|
294493
|
+
const layout_append_beforeLoad = append_beforeLoad(beforeLayoutLoad, "Layout");
|
|
294494
|
+
const page_append_beforeLoad = append_beforeLoad(beforePageLoad, "Page");
|
|
294495
|
+
const layout_append_afterLoad = append_afterLoad(
|
|
294496
|
+
afterLayoutLoad,
|
|
294497
|
+
"Layout",
|
|
294498
|
+
layoutQueries
|
|
294499
|
+
);
|
|
294500
|
+
const page_append_afterLoad = append_afterLoad(afterPageLoad, "Page", pageQueries);
|
|
294501
|
+
const layout_append_onError = append_onError(
|
|
294502
|
+
onLayoutError,
|
|
294503
|
+
"Layout",
|
|
294504
|
+
layoutQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294505
|
+
);
|
|
294506
|
+
const page_append_onError = append_onError(
|
|
294507
|
+
onPageError,
|
|
294508
|
+
"Page",
|
|
294509
|
+
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294510
|
+
);
|
|
294485
294511
|
const splitString = skTypeString.split("\n\n");
|
|
294486
294512
|
let typeImports = splitString[0];
|
|
294487
294513
|
let utilityTypes = splitString[1];
|
|
294488
294514
|
let typeExports = splitString[2];
|
|
294489
|
-
const
|
|
294490
|
-
|
|
294515
|
+
const functionImportsToBring = [];
|
|
294516
|
+
if (layout_append_VariablesFunction !== "" || page_append_VariablesFunction !== "") {
|
|
294517
|
+
functionImportsToBring.push("VariableFunction");
|
|
294518
|
+
}
|
|
294519
|
+
if (afterLayoutLoad || afterPageLoad) {
|
|
294520
|
+
functionImportsToBring.push("AfterLoadFunction");
|
|
294521
|
+
}
|
|
294522
|
+
if (beforeLayoutLoad || beforePageLoad) {
|
|
294523
|
+
functionImportsToBring.push("BeforeLoadFunction");
|
|
294524
|
+
}
|
|
294525
|
+
const functionImports = functionImportsToBring.length > 0 ? `
|
|
294526
|
+
import type { ${functionImportsToBring.join(
|
|
294527
|
+
", "
|
|
294528
|
+
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
294491
294529
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports);
|
|
294492
294530
|
const layoutParams = `${layoutQueries.length > 0 && !utilityTypes.includes("LayoutParams") ? "\ntype LayoutParams = LayoutLoadEvent['params'];" : ""}`;
|
|
294493
294531
|
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
294494
294532
|
utilityTypes = utilityTypes.concat(layoutParams).concat(pageParams).replaceAll(/\$types\.js/gm, "$houdini");
|
|
294495
|
-
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(
|
|
294496
|
-
append_onError(
|
|
294497
|
-
onPageError,
|
|
294498
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294499
|
-
)
|
|
294500
|
-
).concat(
|
|
294501
|
-
append_onError(
|
|
294502
|
-
onLayoutError,
|
|
294503
|
-
pageQueries.filter((x4) => x4.variableDefinitions?.length).length > 0
|
|
294504
|
-
)
|
|
294505
|
-
).concat(append_VariablesFunction("Layout", config3, uniqueLayoutQueries)).concat(append_VariablesFunction("Page", config3, uniquePageQueries)).replace(
|
|
294533
|
+
typeExports = typeExports.concat(append_loadInput(layoutQueries)).concat(append_loadInput(pageQueries)).concat(layout_append_beforeLoad).concat(page_append_beforeLoad).concat(layout_append_afterLoad).concat(page_append_afterLoad).concat(layout_append_onError).concat(page_append_onError).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).replace(
|
|
294506
294534
|
/(?<=LayoutData = )([\s\S]*?)(?=;)/,
|
|
294507
294535
|
`Expand<$1 & { ${layoutQueries.map((query) => {
|
|
294508
294536
|
const name2 = query.name.value;
|
|
@@ -294566,9 +294594,9 @@ type LoadInput = { ${queries.filter((query) => query.variableDefinitions?.length
|
|
|
294566
294594
|
return [name2, name2 + "$input"].join(": ");
|
|
294567
294595
|
}).join("; ")} };` : ""}`;
|
|
294568
294596
|
}
|
|
294569
|
-
function append_afterLoad(
|
|
294597
|
+
function append_afterLoad(afterLoad, type, queries) {
|
|
294570
294598
|
return afterLoad ? `
|
|
294571
|
-
type AfterLoadReturn = ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad
|
|
294599
|
+
type AfterLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').afterLoad>>;
|
|
294572
294600
|
type AfterLoadData = {
|
|
294573
294601
|
${internal_append_afterLoad(queries)}
|
|
294574
294602
|
};
|
|
@@ -294586,15 +294614,15 @@ function internal_append_afterLoad(queries) {
|
|
|
294586
294614
|
return [name2, name2 + "$result"].join(": ");
|
|
294587
294615
|
}).join(";\n ")}`;
|
|
294588
294616
|
}
|
|
294589
|
-
function append_beforeLoad(beforeLoad) {
|
|
294617
|
+
function append_beforeLoad(beforeLoad, type) {
|
|
294590
294618
|
return beforeLoad ? `
|
|
294591
294619
|
export type BeforeLoadEvent = PageLoadEvent;
|
|
294592
|
-
type BeforeLoadReturn = ReturnType<typeof import('
|
|
294620
|
+
type BeforeLoadReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').beforeLoad>>;
|
|
294593
294621
|
` : "";
|
|
294594
294622
|
}
|
|
294595
|
-
function append_onError(onError, hasLoadInput) {
|
|
294623
|
+
function append_onError(onError, type, hasLoadInput) {
|
|
294596
294624
|
return onError ? `
|
|
294597
|
-
type OnErrorReturn = ReturnType<typeof import('
|
|
294625
|
+
type OnErrorReturn = Awaited<ReturnType<typeof import('./+${type.toLowerCase()}').onError>>;
|
|
294598
294626
|
export type OnErrorEvent = { event: Kit.LoadEvent, input: ${hasLoadInput ? "LoadInput" : "{}"}, error: Error | Error[] };
|
|
294599
294627
|
` : "";
|
|
294600
294628
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.12",
|
|
4
4
|
"description": "The svelte plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ast-types": "^0.15.1",
|
|
24
24
|
"estree-walker": "^3.0.1",
|
|
25
25
|
"graphql": "^15.8.0",
|
|
26
|
-
"houdini": "^0.17.
|
|
26
|
+
"houdini": "^0.17.12",
|
|
27
27
|
"minimatch": "^5.1.0",
|
|
28
28
|
"recast": "^0.21.5",
|
|
29
29
|
"svelte": "^3.52.0"
|