houdini-svelte 2.2.0-next.0 → 2.2.0-next.2
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 +35 -12
- package/build/plugin-esm/index.js +35 -12
- package/build/preprocess-cjs/index.js +74 -21
- package/build/preprocess-esm/index.js +74 -21
- package/build/test-cjs/index.js +63 -15
- package/build/test-esm/index.js +63 -15
- package/package.json +2 -2
|
@@ -161741,22 +161741,45 @@ async function QueryProcessor(config, page) {
|
|
|
161741
161741
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
161742
161742
|
propsStatement.id.properties.forEach((property) => {
|
|
161743
161743
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
161744
|
-
|
|
161744
|
+
const key = property.key.name;
|
|
161745
|
+
let value = property.key.name;
|
|
161746
|
+
switch (property.value.type) {
|
|
161747
|
+
// `prop: renamed` - key is an Identifier
|
|
161748
|
+
case "Identifier":
|
|
161749
|
+
value = property.value.name;
|
|
161750
|
+
break;
|
|
161751
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
161752
|
+
case "AssignmentPattern":
|
|
161753
|
+
if (property.value.left.type === "Identifier") {
|
|
161754
|
+
value = property.value.left.name;
|
|
161755
|
+
}
|
|
161756
|
+
break;
|
|
161757
|
+
default:
|
|
161758
|
+
break;
|
|
161759
|
+
}
|
|
161760
|
+
props.push({ key, value });
|
|
161745
161761
|
}
|
|
161746
161762
|
});
|
|
161747
161763
|
}
|
|
161748
161764
|
}
|
|
161749
161765
|
} else {
|
|
161750
161766
|
props = page.script.body.filter(
|
|
161751
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
161752
|
-
).flatMap(
|
|
161753
|
-
(
|
|
161754
|
-
|
|
161755
|
-
|
|
161756
|
-
|
|
161757
|
-
|
|
161758
|
-
|
|
161759
|
-
|
|
161767
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
161768
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
161769
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
161770
|
+
return declaration.declarations.map((dec) => {
|
|
161771
|
+
if (dec.type === "VariableDeclarator") {
|
|
161772
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
161773
|
+
return { key: name, value: name };
|
|
161774
|
+
}
|
|
161775
|
+
return { key: dec.name, value: dec.name };
|
|
161776
|
+
});
|
|
161777
|
+
}
|
|
161778
|
+
return specifiers?.flatMap((spec) => ({
|
|
161779
|
+
key: spec.exported.name,
|
|
161780
|
+
value: spec.local?.name ?? ""
|
|
161781
|
+
})) ?? [];
|
|
161782
|
+
});
|
|
161760
161783
|
}
|
|
161761
161784
|
ensure_imports({
|
|
161762
161785
|
config: page.config,
|
|
@@ -161849,10 +161872,10 @@ async function QueryProcessor(config, page) {
|
|
|
161849
161872
|
props.map(
|
|
161850
161873
|
(prop) => AST17.objectProperty(
|
|
161851
161874
|
AST17.identifier(
|
|
161852
|
-
prop
|
|
161875
|
+
prop.key
|
|
161853
161876
|
),
|
|
161854
161877
|
AST17.identifier(
|
|
161855
|
-
prop
|
|
161878
|
+
prop.value
|
|
161856
161879
|
)
|
|
161857
161880
|
)
|
|
161858
161881
|
)
|
|
@@ -161736,22 +161736,45 @@ async function QueryProcessor(config, page) {
|
|
|
161736
161736
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
161737
161737
|
propsStatement.id.properties.forEach((property) => {
|
|
161738
161738
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
161739
|
-
|
|
161739
|
+
const key = property.key.name;
|
|
161740
|
+
let value = property.key.name;
|
|
161741
|
+
switch (property.value.type) {
|
|
161742
|
+
// `prop: renamed` - key is an Identifier
|
|
161743
|
+
case "Identifier":
|
|
161744
|
+
value = property.value.name;
|
|
161745
|
+
break;
|
|
161746
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
161747
|
+
case "AssignmentPattern":
|
|
161748
|
+
if (property.value.left.type === "Identifier") {
|
|
161749
|
+
value = property.value.left.name;
|
|
161750
|
+
}
|
|
161751
|
+
break;
|
|
161752
|
+
default:
|
|
161753
|
+
break;
|
|
161754
|
+
}
|
|
161755
|
+
props.push({ key, value });
|
|
161740
161756
|
}
|
|
161741
161757
|
});
|
|
161742
161758
|
}
|
|
161743
161759
|
}
|
|
161744
161760
|
} else {
|
|
161745
161761
|
props = page.script.body.filter(
|
|
161746
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
161747
|
-
).flatMap(
|
|
161748
|
-
(
|
|
161749
|
-
|
|
161750
|
-
|
|
161751
|
-
|
|
161752
|
-
|
|
161753
|
-
|
|
161754
|
-
|
|
161762
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
161763
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
161764
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
161765
|
+
return declaration.declarations.map((dec) => {
|
|
161766
|
+
if (dec.type === "VariableDeclarator") {
|
|
161767
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
161768
|
+
return { key: name, value: name };
|
|
161769
|
+
}
|
|
161770
|
+
return { key: dec.name, value: dec.name };
|
|
161771
|
+
});
|
|
161772
|
+
}
|
|
161773
|
+
return specifiers?.flatMap((spec) => ({
|
|
161774
|
+
key: spec.exported.name,
|
|
161775
|
+
value: spec.local?.name ?? ""
|
|
161776
|
+
})) ?? [];
|
|
161777
|
+
});
|
|
161755
161778
|
}
|
|
161756
161779
|
ensure_imports({
|
|
161757
161780
|
config: page.config,
|
|
@@ -161844,10 +161867,10 @@ async function QueryProcessor(config, page) {
|
|
|
161844
161867
|
props.map(
|
|
161845
161868
|
(prop) => AST17.objectProperty(
|
|
161846
161869
|
AST17.identifier(
|
|
161847
|
-
prop
|
|
161870
|
+
prop.key
|
|
161848
161871
|
),
|
|
161849
161872
|
AST17.identifier(
|
|
161850
|
-
prop
|
|
161873
|
+
prop.value
|
|
161851
161874
|
)
|
|
161852
161875
|
)
|
|
161853
161876
|
)
|
|
@@ -88458,7 +88458,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
88458
88458
|
});
|
|
88459
88459
|
});
|
|
88460
88460
|
}
|
|
88461
|
-
async function pullSchema(url, fetchTimeout, schemaPath, headers,
|
|
88461
|
+
async function pullSchema(url, fetchTimeout, schemaPath, headers, writeToDisk = true) {
|
|
88462
88462
|
let content = "";
|
|
88463
88463
|
try {
|
|
88464
88464
|
const fetchWithTimeout = (url2, timeoutMs, options) => {
|
|
@@ -88496,8 +88496,15 @@ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
|
|
|
88496
88496
|
} else {
|
|
88497
88497
|
fileData = JSON.stringify(jsonSchema);
|
|
88498
88498
|
}
|
|
88499
|
-
if (
|
|
88500
|
-
|
|
88499
|
+
if (writeToDisk) {
|
|
88500
|
+
try {
|
|
88501
|
+
await writeFile(schemaPath, fileData);
|
|
88502
|
+
} catch (e22) {
|
|
88503
|
+
console.warn(
|
|
88504
|
+
`\u26A0\uFE0F Couldn't write your pulled schema to disk: ${e22.message}
|
|
88505
|
+
If this is expected, please set watchSchema.writePolledSchema to false in your config file.`
|
|
88506
|
+
);
|
|
88507
|
+
}
|
|
88501
88508
|
}
|
|
88502
88509
|
return fileData;
|
|
88503
88510
|
} catch (e22) {
|
|
@@ -91220,6 +91227,7 @@ var Config = class {
|
|
|
91220
91227
|
routesDir;
|
|
91221
91228
|
schemaPollInterval;
|
|
91222
91229
|
schemaPollTimeout;
|
|
91230
|
+
schemaPollWriteToDisk = false;
|
|
91223
91231
|
schemaPollHeaders;
|
|
91224
91232
|
pluginMode = false;
|
|
91225
91233
|
plugins = [];
|
|
@@ -91296,6 +91304,7 @@ var Config = class {
|
|
|
91296
91304
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
91297
91305
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
91298
91306
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
91307
|
+
this.schemaPollWriteToDisk = watchSchema?.writePolledSchema ?? true;
|
|
91299
91308
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
91300
91309
|
this.rootDir = join2(this.projectRoot, this.runtimeDir);
|
|
91301
91310
|
this.persistedQueriesPath = persistedQueriesPath ?? join2(this.rootDir, "persisted_queries.json");
|
|
@@ -91328,11 +91337,17 @@ var Config = class {
|
|
|
91328
91337
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
91329
91338
|
for (const plugin2 of this.plugins) {
|
|
91330
91339
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
91331
|
-
|
|
91340
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
91341
|
+
if (!runtimeDir && !staticDir) {
|
|
91332
91342
|
continue;
|
|
91333
91343
|
}
|
|
91334
|
-
const
|
|
91335
|
-
|
|
91344
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
91345
|
+
if (!dir) {
|
|
91346
|
+
continue;
|
|
91347
|
+
}
|
|
91348
|
+
const includePath = relative(this.projectRoot, dir);
|
|
91349
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
91350
|
+
}
|
|
91336
91351
|
}
|
|
91337
91352
|
return include;
|
|
91338
91353
|
}
|
|
@@ -91386,6 +91401,15 @@ var Config = class {
|
|
|
91386
91401
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
91387
91402
|
);
|
|
91388
91403
|
}
|
|
91404
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
91405
|
+
if (!plugin2.staticRuntime) {
|
|
91406
|
+
return null;
|
|
91407
|
+
}
|
|
91408
|
+
return join2(
|
|
91409
|
+
dirname(plugin2.filepath),
|
|
91410
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
91411
|
+
);
|
|
91412
|
+
}
|
|
91389
91413
|
async sourceFiles() {
|
|
91390
91414
|
return [
|
|
91391
91415
|
...new Set(
|
|
@@ -91582,6 +91606,9 @@ var Config = class {
|
|
|
91582
91606
|
pluginRuntimeDirectory(name) {
|
|
91583
91607
|
return join2(this.pluginDirectory(name), "runtime");
|
|
91584
91608
|
}
|
|
91609
|
+
pluginStaticRuntimeDirectory(name) {
|
|
91610
|
+
return join2(this.pluginDirectory(name), "static");
|
|
91611
|
+
}
|
|
91585
91612
|
get pluginRootDirectory() {
|
|
91586
91613
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
91587
91614
|
}
|
|
@@ -91959,17 +91986,20 @@ async function getConfig({
|
|
|
91959
91986
|
if (!_config.localSchema && _config.schemaPath && !_config.schema) {
|
|
91960
91987
|
let schemaOk = true;
|
|
91961
91988
|
if (apiURL) {
|
|
91962
|
-
if (glob2.hasMagic(_config.schemaPath)) {
|
|
91989
|
+
if (glob2.hasMagic(_config.schemaPath) && _config.schemaPollWriteToDisk) {
|
|
91963
91990
|
console.log(
|
|
91964
91991
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
91965
|
-
This will prevent your schema from being
|
|
91992
|
+
This will prevent your schema from being written to disk. If this is expected, please set the writePolledSchema value to false.`
|
|
91966
91993
|
);
|
|
91994
|
+
_config.schemaPollWriteToDisk = false;
|
|
91967
91995
|
} else if (!await readFile(_config.schemaPath)) {
|
|
91968
91996
|
console.log("\u231B Pulling schema from api");
|
|
91969
91997
|
schemaOk = await pullSchema(
|
|
91970
91998
|
apiURL,
|
|
91971
91999
|
_config.schemaPollTimeout,
|
|
91972
|
-
_config.schemaPath
|
|
92000
|
+
_config.schemaPath,
|
|
92001
|
+
{},
|
|
92002
|
+
_config.schemaPollWriteToDisk
|
|
91973
92003
|
) !== null;
|
|
91974
92004
|
}
|
|
91975
92005
|
}
|
|
@@ -164685,22 +164715,45 @@ async function QueryProcessor(config, page) {
|
|
|
164685
164715
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
164686
164716
|
propsStatement.id.properties.forEach((property) => {
|
|
164687
164717
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
164688
|
-
|
|
164718
|
+
const key = property.key.name;
|
|
164719
|
+
let value = property.key.name;
|
|
164720
|
+
switch (property.value.type) {
|
|
164721
|
+
// `prop: renamed` - key is an Identifier
|
|
164722
|
+
case "Identifier":
|
|
164723
|
+
value = property.value.name;
|
|
164724
|
+
break;
|
|
164725
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
164726
|
+
case "AssignmentPattern":
|
|
164727
|
+
if (property.value.left.type === "Identifier") {
|
|
164728
|
+
value = property.value.left.name;
|
|
164729
|
+
}
|
|
164730
|
+
break;
|
|
164731
|
+
default:
|
|
164732
|
+
break;
|
|
164733
|
+
}
|
|
164734
|
+
props.push({ key, value });
|
|
164689
164735
|
}
|
|
164690
164736
|
});
|
|
164691
164737
|
}
|
|
164692
164738
|
}
|
|
164693
164739
|
} else {
|
|
164694
164740
|
props = page.script.body.filter(
|
|
164695
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
164696
|
-
).flatMap(
|
|
164697
|
-
(
|
|
164698
|
-
|
|
164699
|
-
|
|
164700
|
-
|
|
164701
|
-
|
|
164702
|
-
|
|
164703
|
-
|
|
164741
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
164742
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
164743
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
164744
|
+
return declaration.declarations.map((dec) => {
|
|
164745
|
+
if (dec.type === "VariableDeclarator") {
|
|
164746
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
164747
|
+
return { key: name, value: name };
|
|
164748
|
+
}
|
|
164749
|
+
return { key: dec.name, value: dec.name };
|
|
164750
|
+
});
|
|
164751
|
+
}
|
|
164752
|
+
return specifiers?.flatMap((spec) => ({
|
|
164753
|
+
key: spec.exported.name,
|
|
164754
|
+
value: spec.local?.name ?? ""
|
|
164755
|
+
})) ?? [];
|
|
164756
|
+
});
|
|
164704
164757
|
}
|
|
164705
164758
|
ensure_imports({
|
|
164706
164759
|
config: page.config,
|
|
@@ -164793,10 +164846,10 @@ async function QueryProcessor(config, page) {
|
|
|
164793
164846
|
props.map(
|
|
164794
164847
|
(prop) => AST17.objectProperty(
|
|
164795
164848
|
AST17.identifier(
|
|
164796
|
-
prop
|
|
164849
|
+
prop.key
|
|
164797
164850
|
),
|
|
164798
164851
|
AST17.identifier(
|
|
164799
|
-
prop
|
|
164852
|
+
prop.value
|
|
164800
164853
|
)
|
|
164801
164854
|
)
|
|
164802
164855
|
)
|
|
@@ -88455,7 +88455,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
88455
88455
|
});
|
|
88456
88456
|
});
|
|
88457
88457
|
}
|
|
88458
|
-
async function pullSchema(url, fetchTimeout, schemaPath, headers,
|
|
88458
|
+
async function pullSchema(url, fetchTimeout, schemaPath, headers, writeToDisk = true) {
|
|
88459
88459
|
let content = "";
|
|
88460
88460
|
try {
|
|
88461
88461
|
const fetchWithTimeout = (url2, timeoutMs, options) => {
|
|
@@ -88493,8 +88493,15 @@ async function pullSchema(url, fetchTimeout, schemaPath, headers, skipWriting) {
|
|
|
88493
88493
|
} else {
|
|
88494
88494
|
fileData = JSON.stringify(jsonSchema);
|
|
88495
88495
|
}
|
|
88496
|
-
if (
|
|
88497
|
-
|
|
88496
|
+
if (writeToDisk) {
|
|
88497
|
+
try {
|
|
88498
|
+
await writeFile(schemaPath, fileData);
|
|
88499
|
+
} catch (e22) {
|
|
88500
|
+
console.warn(
|
|
88501
|
+
`\u26A0\uFE0F Couldn't write your pulled schema to disk: ${e22.message}
|
|
88502
|
+
If this is expected, please set watchSchema.writePolledSchema to false in your config file.`
|
|
88503
|
+
);
|
|
88504
|
+
}
|
|
88498
88505
|
}
|
|
88499
88506
|
return fileData;
|
|
88500
88507
|
} catch (e22) {
|
|
@@ -91217,6 +91224,7 @@ var Config = class {
|
|
|
91217
91224
|
routesDir;
|
|
91218
91225
|
schemaPollInterval;
|
|
91219
91226
|
schemaPollTimeout;
|
|
91227
|
+
schemaPollWriteToDisk = false;
|
|
91220
91228
|
schemaPollHeaders;
|
|
91221
91229
|
pluginMode = false;
|
|
91222
91230
|
plugins = [];
|
|
@@ -91293,6 +91301,7 @@ var Config = class {
|
|
|
91293
91301
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
91294
91302
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
91295
91303
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
91304
|
+
this.schemaPollWriteToDisk = watchSchema?.writePolledSchema ?? true;
|
|
91296
91305
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
91297
91306
|
this.rootDir = join2(this.projectRoot, this.runtimeDir);
|
|
91298
91307
|
this.persistedQueriesPath = persistedQueriesPath ?? join2(this.rootDir, "persisted_queries.json");
|
|
@@ -91325,11 +91334,17 @@ var Config = class {
|
|
|
91325
91334
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
91326
91335
|
for (const plugin2 of this.plugins) {
|
|
91327
91336
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
91328
|
-
|
|
91337
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
91338
|
+
if (!runtimeDir && !staticDir) {
|
|
91329
91339
|
continue;
|
|
91330
91340
|
}
|
|
91331
|
-
const
|
|
91332
|
-
|
|
91341
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
91342
|
+
if (!dir) {
|
|
91343
|
+
continue;
|
|
91344
|
+
}
|
|
91345
|
+
const includePath = relative(this.projectRoot, dir);
|
|
91346
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
91347
|
+
}
|
|
91333
91348
|
}
|
|
91334
91349
|
return include;
|
|
91335
91350
|
}
|
|
@@ -91383,6 +91398,15 @@ var Config = class {
|
|
|
91383
91398
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
91384
91399
|
);
|
|
91385
91400
|
}
|
|
91401
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
91402
|
+
if (!plugin2.staticRuntime) {
|
|
91403
|
+
return null;
|
|
91404
|
+
}
|
|
91405
|
+
return join2(
|
|
91406
|
+
dirname(plugin2.filepath),
|
|
91407
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
91408
|
+
);
|
|
91409
|
+
}
|
|
91386
91410
|
async sourceFiles() {
|
|
91387
91411
|
return [
|
|
91388
91412
|
...new Set(
|
|
@@ -91579,6 +91603,9 @@ var Config = class {
|
|
|
91579
91603
|
pluginRuntimeDirectory(name) {
|
|
91580
91604
|
return join2(this.pluginDirectory(name), "runtime");
|
|
91581
91605
|
}
|
|
91606
|
+
pluginStaticRuntimeDirectory(name) {
|
|
91607
|
+
return join2(this.pluginDirectory(name), "static");
|
|
91608
|
+
}
|
|
91582
91609
|
get pluginRootDirectory() {
|
|
91583
91610
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
91584
91611
|
}
|
|
@@ -91956,17 +91983,20 @@ async function getConfig({
|
|
|
91956
91983
|
if (!_config.localSchema && _config.schemaPath && !_config.schema) {
|
|
91957
91984
|
let schemaOk = true;
|
|
91958
91985
|
if (apiURL) {
|
|
91959
|
-
if (glob2.hasMagic(_config.schemaPath)) {
|
|
91986
|
+
if (glob2.hasMagic(_config.schemaPath) && _config.schemaPollWriteToDisk) {
|
|
91960
91987
|
console.log(
|
|
91961
91988
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
91962
|
-
This will prevent your schema from being
|
|
91989
|
+
This will prevent your schema from being written to disk. If this is expected, please set the writePolledSchema value to false.`
|
|
91963
91990
|
);
|
|
91991
|
+
_config.schemaPollWriteToDisk = false;
|
|
91964
91992
|
} else if (!await readFile(_config.schemaPath)) {
|
|
91965
91993
|
console.log("\u231B Pulling schema from api");
|
|
91966
91994
|
schemaOk = await pullSchema(
|
|
91967
91995
|
apiURL,
|
|
91968
91996
|
_config.schemaPollTimeout,
|
|
91969
|
-
_config.schemaPath
|
|
91997
|
+
_config.schemaPath,
|
|
91998
|
+
{},
|
|
91999
|
+
_config.schemaPollWriteToDisk
|
|
91970
92000
|
) !== null;
|
|
91971
92001
|
}
|
|
91972
92002
|
}
|
|
@@ -164681,22 +164711,45 @@ async function QueryProcessor(config, page) {
|
|
|
164681
164711
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
164682
164712
|
propsStatement.id.properties.forEach((property) => {
|
|
164683
164713
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
164684
|
-
|
|
164714
|
+
const key = property.key.name;
|
|
164715
|
+
let value = property.key.name;
|
|
164716
|
+
switch (property.value.type) {
|
|
164717
|
+
// `prop: renamed` - key is an Identifier
|
|
164718
|
+
case "Identifier":
|
|
164719
|
+
value = property.value.name;
|
|
164720
|
+
break;
|
|
164721
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
164722
|
+
case "AssignmentPattern":
|
|
164723
|
+
if (property.value.left.type === "Identifier") {
|
|
164724
|
+
value = property.value.left.name;
|
|
164725
|
+
}
|
|
164726
|
+
break;
|
|
164727
|
+
default:
|
|
164728
|
+
break;
|
|
164729
|
+
}
|
|
164730
|
+
props.push({ key, value });
|
|
164685
164731
|
}
|
|
164686
164732
|
});
|
|
164687
164733
|
}
|
|
164688
164734
|
}
|
|
164689
164735
|
} else {
|
|
164690
164736
|
props = page.script.body.filter(
|
|
164691
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
164692
|
-
).flatMap(
|
|
164693
|
-
(
|
|
164694
|
-
|
|
164695
|
-
|
|
164696
|
-
|
|
164697
|
-
|
|
164698
|
-
|
|
164699
|
-
|
|
164737
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
164738
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
164739
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
164740
|
+
return declaration.declarations.map((dec) => {
|
|
164741
|
+
if (dec.type === "VariableDeclarator") {
|
|
164742
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
164743
|
+
return { key: name, value: name };
|
|
164744
|
+
}
|
|
164745
|
+
return { key: dec.name, value: dec.name };
|
|
164746
|
+
});
|
|
164747
|
+
}
|
|
164748
|
+
return specifiers?.flatMap((spec) => ({
|
|
164749
|
+
key: spec.exported.name,
|
|
164750
|
+
value: spec.local?.name ?? ""
|
|
164751
|
+
})) ?? [];
|
|
164752
|
+
});
|
|
164700
164753
|
}
|
|
164701
164754
|
ensure_imports({
|
|
164702
164755
|
config: page.config,
|
|
@@ -164789,10 +164842,10 @@ async function QueryProcessor(config, page) {
|
|
|
164789
164842
|
props.map(
|
|
164790
164843
|
(prop) => AST17.objectProperty(
|
|
164791
164844
|
AST17.identifier(
|
|
164792
|
-
prop
|
|
164845
|
+
prop.key
|
|
164793
164846
|
),
|
|
164794
164847
|
AST17.identifier(
|
|
164795
|
-
prop
|
|
164848
|
+
prop.value
|
|
164796
164849
|
)
|
|
164797
164850
|
)
|
|
164798
164851
|
)
|
package/build/test-cjs/index.js
CHANGED
|
@@ -157605,6 +157605,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
157605
157605
|
module: relative22(config.pluginRuntimeDirectory(plugin2.name))
|
|
157606
157606
|
});
|
|
157607
157607
|
}
|
|
157608
|
+
if (plugin2.staticRuntime) {
|
|
157609
|
+
body += exportStar({
|
|
157610
|
+
module: relative22(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
157611
|
+
});
|
|
157612
|
+
}
|
|
157608
157613
|
}
|
|
157609
157614
|
await fs_exports2.writeFile(path_exports2.join(config.rootDir, "index.js"), body);
|
|
157610
157615
|
}
|
|
@@ -226462,6 +226467,7 @@ var Config = class {
|
|
|
226462
226467
|
routesDir;
|
|
226463
226468
|
schemaPollInterval;
|
|
226464
226469
|
schemaPollTimeout;
|
|
226470
|
+
schemaPollWriteToDisk = false;
|
|
226465
226471
|
schemaPollHeaders;
|
|
226466
226472
|
pluginMode = false;
|
|
226467
226473
|
plugins = [];
|
|
@@ -226538,6 +226544,7 @@ var Config = class {
|
|
|
226538
226544
|
this.routesDir = join4(this.projectRoot, "src", "routes");
|
|
226539
226545
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
226540
226546
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
226547
|
+
this.schemaPollWriteToDisk = watchSchema?.writePolledSchema ?? true;
|
|
226541
226548
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
226542
226549
|
this.rootDir = join4(this.projectRoot, this.runtimeDir);
|
|
226543
226550
|
this.persistedQueriesPath = persistedQueriesPath ?? join4(this.rootDir, "persisted_queries.json");
|
|
@@ -226570,11 +226577,17 @@ var Config = class {
|
|
|
226570
226577
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
226571
226578
|
for (const plugin2 of this.plugins) {
|
|
226572
226579
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
226573
|
-
|
|
226580
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
226581
|
+
if (!runtimeDir && !staticDir) {
|
|
226574
226582
|
continue;
|
|
226575
226583
|
}
|
|
226576
|
-
const
|
|
226577
|
-
|
|
226584
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
226585
|
+
if (!dir) {
|
|
226586
|
+
continue;
|
|
226587
|
+
}
|
|
226588
|
+
const includePath = relative3(this.projectRoot, dir);
|
|
226589
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
226590
|
+
}
|
|
226578
226591
|
}
|
|
226579
226592
|
return include;
|
|
226580
226593
|
}
|
|
@@ -226628,6 +226641,15 @@ var Config = class {
|
|
|
226628
226641
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
226629
226642
|
);
|
|
226630
226643
|
}
|
|
226644
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
226645
|
+
if (!plugin2.staticRuntime) {
|
|
226646
|
+
return null;
|
|
226647
|
+
}
|
|
226648
|
+
return join4(
|
|
226649
|
+
dirname3(plugin2.filepath),
|
|
226650
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
226651
|
+
);
|
|
226652
|
+
}
|
|
226631
226653
|
async sourceFiles() {
|
|
226632
226654
|
return [
|
|
226633
226655
|
...new Set(
|
|
@@ -226824,6 +226846,9 @@ var Config = class {
|
|
|
226824
226846
|
pluginRuntimeDirectory(name) {
|
|
226825
226847
|
return join4(this.pluginDirectory(name), "runtime");
|
|
226826
226848
|
}
|
|
226849
|
+
pluginStaticRuntimeDirectory(name) {
|
|
226850
|
+
return join4(this.pluginDirectory(name), "static");
|
|
226851
|
+
}
|
|
226827
226852
|
get pluginRootDirectory() {
|
|
226828
226853
|
return houdini_mode3.is_testing ? "../../../" : join4(this.rootDir, "plugins");
|
|
226829
226854
|
}
|
|
@@ -301383,22 +301408,45 @@ async function QueryProcessor(config, page) {
|
|
|
301383
301408
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
301384
301409
|
propsStatement.id.properties.forEach((property) => {
|
|
301385
301410
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
301386
|
-
|
|
301411
|
+
const key = property.key.name;
|
|
301412
|
+
let value = property.key.name;
|
|
301413
|
+
switch (property.value.type) {
|
|
301414
|
+
// `prop: renamed` - key is an Identifier
|
|
301415
|
+
case "Identifier":
|
|
301416
|
+
value = property.value.name;
|
|
301417
|
+
break;
|
|
301418
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
301419
|
+
case "AssignmentPattern":
|
|
301420
|
+
if (property.value.left.type === "Identifier") {
|
|
301421
|
+
value = property.value.left.name;
|
|
301422
|
+
}
|
|
301423
|
+
break;
|
|
301424
|
+
default:
|
|
301425
|
+
break;
|
|
301426
|
+
}
|
|
301427
|
+
props.push({ key, value });
|
|
301387
301428
|
}
|
|
301388
301429
|
});
|
|
301389
301430
|
}
|
|
301390
301431
|
}
|
|
301391
301432
|
} else {
|
|
301392
301433
|
props = page.script.body.filter(
|
|
301393
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
301394
|
-
).flatMap(
|
|
301395
|
-
(
|
|
301396
|
-
|
|
301397
|
-
|
|
301398
|
-
|
|
301399
|
-
|
|
301400
|
-
|
|
301401
|
-
|
|
301434
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
301435
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
301436
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
301437
|
+
return declaration.declarations.map((dec) => {
|
|
301438
|
+
if (dec.type === "VariableDeclarator") {
|
|
301439
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
301440
|
+
return { key: name, value: name };
|
|
301441
|
+
}
|
|
301442
|
+
return { key: dec.name, value: dec.name };
|
|
301443
|
+
});
|
|
301444
|
+
}
|
|
301445
|
+
return specifiers?.flatMap((spec) => ({
|
|
301446
|
+
key: spec.exported.name,
|
|
301447
|
+
value: spec.local?.name ?? ""
|
|
301448
|
+
})) ?? [];
|
|
301449
|
+
});
|
|
301402
301450
|
}
|
|
301403
301451
|
ensure_imports({
|
|
301404
301452
|
config: page.config,
|
|
@@ -301491,10 +301539,10 @@ async function QueryProcessor(config, page) {
|
|
|
301491
301539
|
props.map(
|
|
301492
301540
|
(prop) => AST18.objectProperty(
|
|
301493
301541
|
AST18.identifier(
|
|
301494
|
-
prop
|
|
301542
|
+
prop.key
|
|
301495
301543
|
),
|
|
301496
301544
|
AST18.identifier(
|
|
301497
|
-
prop
|
|
301545
|
+
prop.value
|
|
301498
301546
|
)
|
|
301499
301547
|
)
|
|
301500
301548
|
)
|
package/build/test-esm/index.js
CHANGED
|
@@ -157596,6 +157596,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
157596
157596
|
module: relative22(config.pluginRuntimeDirectory(plugin2.name))
|
|
157597
157597
|
});
|
|
157598
157598
|
}
|
|
157599
|
+
if (plugin2.staticRuntime) {
|
|
157600
|
+
body += exportStar({
|
|
157601
|
+
module: relative22(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
157602
|
+
});
|
|
157603
|
+
}
|
|
157599
157604
|
}
|
|
157600
157605
|
await fs_exports2.writeFile(path_exports2.join(config.rootDir, "index.js"), body);
|
|
157601
157606
|
}
|
|
@@ -226452,6 +226457,7 @@ var Config = class {
|
|
|
226452
226457
|
routesDir;
|
|
226453
226458
|
schemaPollInterval;
|
|
226454
226459
|
schemaPollTimeout;
|
|
226460
|
+
schemaPollWriteToDisk = false;
|
|
226455
226461
|
schemaPollHeaders;
|
|
226456
226462
|
pluginMode = false;
|
|
226457
226463
|
plugins = [];
|
|
@@ -226528,6 +226534,7 @@ var Config = class {
|
|
|
226528
226534
|
this.routesDir = join4(this.projectRoot, "src", "routes");
|
|
226529
226535
|
this.schemaPollInterval = watchSchema?.interval === void 0 ? 2e3 : watchSchema.interval;
|
|
226530
226536
|
this.schemaPollTimeout = watchSchema?.timeout ?? 3e4;
|
|
226537
|
+
this.schemaPollWriteToDisk = watchSchema?.writePolledSchema ?? true;
|
|
226531
226538
|
this.schemaPollHeaders = watchSchema?.headers ?? {};
|
|
226532
226539
|
this.rootDir = join4(this.projectRoot, this.runtimeDir);
|
|
226533
226540
|
this.persistedQueriesPath = persistedQueriesPath ?? join4(this.rootDir, "persisted_queries.json");
|
|
@@ -226560,11 +226567,17 @@ var Config = class {
|
|
|
226560
226567
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
226561
226568
|
for (const plugin2 of this.plugins) {
|
|
226562
226569
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
226563
|
-
|
|
226570
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
226571
|
+
if (!runtimeDir && !staticDir) {
|
|
226564
226572
|
continue;
|
|
226565
226573
|
}
|
|
226566
|
-
const
|
|
226567
|
-
|
|
226574
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
226575
|
+
if (!dir) {
|
|
226576
|
+
continue;
|
|
226577
|
+
}
|
|
226578
|
+
const includePath = relative3(this.projectRoot, dir);
|
|
226579
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
226580
|
+
}
|
|
226568
226581
|
}
|
|
226569
226582
|
return include;
|
|
226570
226583
|
}
|
|
@@ -226618,6 +226631,15 @@ var Config = class {
|
|
|
226618
226631
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
226619
226632
|
);
|
|
226620
226633
|
}
|
|
226634
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
226635
|
+
if (!plugin2.staticRuntime) {
|
|
226636
|
+
return null;
|
|
226637
|
+
}
|
|
226638
|
+
return join4(
|
|
226639
|
+
dirname3(plugin2.filepath),
|
|
226640
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
226641
|
+
);
|
|
226642
|
+
}
|
|
226621
226643
|
async sourceFiles() {
|
|
226622
226644
|
return [
|
|
226623
226645
|
...new Set(
|
|
@@ -226814,6 +226836,9 @@ var Config = class {
|
|
|
226814
226836
|
pluginRuntimeDirectory(name) {
|
|
226815
226837
|
return join4(this.pluginDirectory(name), "runtime");
|
|
226816
226838
|
}
|
|
226839
|
+
pluginStaticRuntimeDirectory(name) {
|
|
226840
|
+
return join4(this.pluginDirectory(name), "static");
|
|
226841
|
+
}
|
|
226817
226842
|
get pluginRootDirectory() {
|
|
226818
226843
|
return houdini_mode3.is_testing ? "../../../" : join4(this.rootDir, "plugins");
|
|
226819
226844
|
}
|
|
@@ -301372,22 +301397,45 @@ async function QueryProcessor(config, page) {
|
|
|
301372
301397
|
if (propsStatement && propsStatement.id.type === "ObjectPattern") {
|
|
301373
301398
|
propsStatement.id.properties.forEach((property) => {
|
|
301374
301399
|
if (property.type === "ObjectProperty" && property.key.type === "Identifier") {
|
|
301375
|
-
|
|
301400
|
+
const key = property.key.name;
|
|
301401
|
+
let value = property.key.name;
|
|
301402
|
+
switch (property.value.type) {
|
|
301403
|
+
// `prop: renamed` - key is an Identifier
|
|
301404
|
+
case "Identifier":
|
|
301405
|
+
value = property.value.name;
|
|
301406
|
+
break;
|
|
301407
|
+
// `prop: renamed = "default"` - key is an AssignmentPattern
|
|
301408
|
+
case "AssignmentPattern":
|
|
301409
|
+
if (property.value.left.type === "Identifier") {
|
|
301410
|
+
value = property.value.left.name;
|
|
301411
|
+
}
|
|
301412
|
+
break;
|
|
301413
|
+
default:
|
|
301414
|
+
break;
|
|
301415
|
+
}
|
|
301416
|
+
props.push({ key, value });
|
|
301376
301417
|
}
|
|
301377
301418
|
});
|
|
301378
301419
|
}
|
|
301379
301420
|
}
|
|
301380
301421
|
} else {
|
|
301381
301422
|
props = page.script.body.filter(
|
|
301382
|
-
(statement) => statement.type === "ExportNamedDeclaration" && statement.declaration
|
|
301383
|
-
).flatMap(
|
|
301384
|
-
(
|
|
301385
|
-
|
|
301386
|
-
|
|
301387
|
-
|
|
301388
|
-
|
|
301389
|
-
|
|
301390
|
-
|
|
301423
|
+
(statement) => statement.type === "ExportNamedDeclaration" && (!statement.declaration || statement.declaration.type === "VariableDeclaration")
|
|
301424
|
+
).flatMap(({ declaration, specifiers }) => {
|
|
301425
|
+
if (declaration?.type === "VariableDeclaration") {
|
|
301426
|
+
return declaration.declarations.map((dec) => {
|
|
301427
|
+
if (dec.type === "VariableDeclarator") {
|
|
301428
|
+
const name = dec.id.type === "Identifier" ? dec.id.name : "";
|
|
301429
|
+
return { key: name, value: name };
|
|
301430
|
+
}
|
|
301431
|
+
return { key: dec.name, value: dec.name };
|
|
301432
|
+
});
|
|
301433
|
+
}
|
|
301434
|
+
return specifiers?.flatMap((spec) => ({
|
|
301435
|
+
key: spec.exported.name,
|
|
301436
|
+
value: spec.local?.name ?? ""
|
|
301437
|
+
})) ?? [];
|
|
301438
|
+
});
|
|
301391
301439
|
}
|
|
301392
301440
|
ensure_imports({
|
|
301393
301441
|
config: page.config,
|
|
@@ -301480,10 +301528,10 @@ async function QueryProcessor(config, page) {
|
|
|
301480
301528
|
props.map(
|
|
301481
301529
|
(prop) => AST18.objectProperty(
|
|
301482
301530
|
AST18.identifier(
|
|
301483
|
-
prop
|
|
301531
|
+
prop.key
|
|
301484
301532
|
),
|
|
301485
301533
|
AST18.identifier(
|
|
301486
|
-
prop
|
|
301534
|
+
prop.value
|
|
301487
301535
|
)
|
|
301488
301536
|
)
|
|
301489
301537
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "houdini-svelte",
|
|
3
|
-
"version": "2.2.0-next.
|
|
3
|
+
"version": "2.2.0-next.2",
|
|
4
4
|
"description": "The svelte plugin for houdini",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"graphql": "^16.10.0",
|
|
31
31
|
"recast": "^0.23.1",
|
|
32
32
|
"rollup": "^4.39.0",
|
|
33
|
-
"houdini": "^2.0.0-next.
|
|
33
|
+
"houdini": "^2.0.0-next.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@sveltejs/kit": "^2.9.0",
|