houdini 1.5.4 → 1.5.6
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/cmd-cjs/index.js +76 -8
- package/build/cmd-esm/index.js +76 -8
- package/build/codegen/generators/runtime/pluginRuntime.d.ts +3 -0
- package/build/codegen-cjs/index.js +50 -0
- package/build/codegen-esm/index.js +50 -0
- package/build/lib/config.d.ts +2 -0
- package/build/lib-cjs/index.js +22 -4
- package/build/lib-esm/index.js +22 -4
- package/build/test-cjs/index.js +26 -3
- package/build/test-esm/index.js +26 -3
- package/build/vite/imports.d.ts +2 -2
- package/build/vite-cjs/index.js +76 -9
- package/build/vite-esm/index.js +76 -9
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -71655,11 +71655,17 @@ var Config = class {
|
|
|
71655
71655
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
71656
71656
|
for (const plugin2 of this.plugins) {
|
|
71657
71657
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
71658
|
-
|
|
71658
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
71659
|
+
if (!runtimeDir && !staticDir) {
|
|
71659
71660
|
continue;
|
|
71660
71661
|
}
|
|
71661
|
-
const
|
|
71662
|
-
|
|
71662
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
71663
|
+
if (!dir) {
|
|
71664
|
+
continue;
|
|
71665
|
+
}
|
|
71666
|
+
const includePath = relative(this.projectRoot, dir);
|
|
71667
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
71668
|
+
}
|
|
71663
71669
|
}
|
|
71664
71670
|
return include;
|
|
71665
71671
|
}
|
|
@@ -71713,6 +71719,15 @@ var Config = class {
|
|
|
71713
71719
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
71714
71720
|
);
|
|
71715
71721
|
}
|
|
71722
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
71723
|
+
if (!plugin2.staticRuntime) {
|
|
71724
|
+
return null;
|
|
71725
|
+
}
|
|
71726
|
+
return join2(
|
|
71727
|
+
dirname(plugin2.filepath),
|
|
71728
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
71729
|
+
);
|
|
71730
|
+
}
|
|
71716
71731
|
async sourceFiles() {
|
|
71717
71732
|
return [
|
|
71718
71733
|
...new Set(
|
|
@@ -71897,6 +71912,9 @@ var Config = class {
|
|
|
71897
71912
|
pluginRuntimeDirectory(name) {
|
|
71898
71913
|
return join2(this.pluginDirectory(name), "runtime");
|
|
71899
71914
|
}
|
|
71915
|
+
pluginStaticRuntimeDirectory(name) {
|
|
71916
|
+
return join2(this.pluginDirectory(name), "static");
|
|
71917
|
+
}
|
|
71900
71918
|
get pluginRootDirectory() {
|
|
71901
71919
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
71902
71920
|
}
|
|
@@ -72266,7 +72284,7 @@ async function getConfig({
|
|
|
72266
72284
|
if (apiURL) {
|
|
72267
72285
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
72268
72286
|
console.log(
|
|
72269
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
72287
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
72270
72288
|
This will prevent your schema from being pulled.`
|
|
72271
72289
|
);
|
|
72272
72290
|
} else if (!await readFile(_config.schemaPath)) {
|
|
@@ -75544,6 +75562,50 @@ function moduleStatments(config) {
|
|
|
75544
75562
|
exportStarStatement
|
|
75545
75563
|
};
|
|
75546
75564
|
}
|
|
75565
|
+
async function generateStaticRuntimes({ config }) {
|
|
75566
|
+
if (houdini_mode.is_testing) {
|
|
75567
|
+
return;
|
|
75568
|
+
}
|
|
75569
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
75570
|
+
await Promise.all(
|
|
75571
|
+
config.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
75572
|
+
const runtime_path = config.pluginStaticRuntimeSource(plugin2);
|
|
75573
|
+
if (!runtime_path) {
|
|
75574
|
+
return;
|
|
75575
|
+
}
|
|
75576
|
+
try {
|
|
75577
|
+
await stat(runtime_path);
|
|
75578
|
+
} catch {
|
|
75579
|
+
throw new HoudiniError({
|
|
75580
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
75581
|
+
description: "Maybe it was bundled?"
|
|
75582
|
+
});
|
|
75583
|
+
}
|
|
75584
|
+
const pluginDir = config.pluginStaticRuntimeDirectory(plugin2.name);
|
|
75585
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
75586
|
+
if (transformMap && typeof transformMap === "function") {
|
|
75587
|
+
transformMap = transformMap([], { config });
|
|
75588
|
+
}
|
|
75589
|
+
await mkdirp(pluginDir);
|
|
75590
|
+
await recursiveCopy(
|
|
75591
|
+
runtime_path,
|
|
75592
|
+
pluginDir,
|
|
75593
|
+
Object.fromEntries(
|
|
75594
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
75595
|
+
join2(runtime_path, key),
|
|
75596
|
+
(content) => value({
|
|
75597
|
+
config,
|
|
75598
|
+
content,
|
|
75599
|
+
importStatement,
|
|
75600
|
+
exportDefaultStatement,
|
|
75601
|
+
exportStarStatement
|
|
75602
|
+
})
|
|
75603
|
+
])
|
|
75604
|
+
)
|
|
75605
|
+
);
|
|
75606
|
+
})
|
|
75607
|
+
);
|
|
75608
|
+
}
|
|
75547
75609
|
async function generatePluginRuntimes({
|
|
75548
75610
|
config,
|
|
75549
75611
|
docs
|
|
@@ -77125,6 +77187,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
77125
77187
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
77126
77188
|
});
|
|
77127
77189
|
}
|
|
77190
|
+
if (plugin2.staticRuntime) {
|
|
77191
|
+
body += exportStar({
|
|
77192
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
77193
|
+
});
|
|
77194
|
+
}
|
|
77128
77195
|
}
|
|
77129
77196
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
77130
77197
|
}
|
|
@@ -80880,6 +80947,7 @@ async function componentFields2(config, docs) {
|
|
|
80880
80947
|
|
|
80881
80948
|
// src/codegen/index.ts
|
|
80882
80949
|
async function compile(config) {
|
|
80950
|
+
await generateStaticRuntimes({ config });
|
|
80883
80951
|
const documents = await collectDocuments(config);
|
|
80884
80952
|
await runPipeline2(config, documents);
|
|
80885
80953
|
}
|
|
@@ -81165,7 +81233,7 @@ async function pullSchema_default(args) {
|
|
|
81165
81233
|
const apiURL = await config.apiURL();
|
|
81166
81234
|
if (!apiURL) {
|
|
81167
81235
|
console.log(
|
|
81168
|
-
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `
|
|
81236
|
+
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `watchSchema.url` value in your houdini.config.js file."
|
|
81169
81237
|
);
|
|
81170
81238
|
process.exit(1);
|
|
81171
81239
|
return;
|
|
@@ -82045,7 +82113,7 @@ export default new HoudiniClient({
|
|
|
82045
82113
|
// fetchParams({ session }) {
|
|
82046
82114
|
// return {
|
|
82047
82115
|
// headers: {
|
|
82048
|
-
//
|
|
82116
|
+
// Authorization: \`Bearer \${session.token}\`,
|
|
82049
82117
|
// }
|
|
82050
82118
|
// }
|
|
82051
82119
|
// }
|
|
@@ -82287,12 +82355,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
82287
82355
|
}
|
|
82288
82356
|
packageJSON2.devDependencies = {
|
|
82289
82357
|
...packageJSON2.devDependencies,
|
|
82290
|
-
houdini: "^1.5.
|
|
82358
|
+
houdini: "^1.5.6"
|
|
82291
82359
|
};
|
|
82292
82360
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
82293
82361
|
packageJSON2.devDependencies = {
|
|
82294
82362
|
...packageJSON2.devDependencies,
|
|
82295
|
-
"houdini-svelte": "^2.1.
|
|
82363
|
+
"houdini-svelte": "^2.1.16"
|
|
82296
82364
|
};
|
|
82297
82365
|
} else {
|
|
82298
82366
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -71660,11 +71660,17 @@ var Config = class {
|
|
|
71660
71660
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
71661
71661
|
for (const plugin2 of this.plugins) {
|
|
71662
71662
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
71663
|
-
|
|
71663
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
71664
|
+
if (!runtimeDir && !staticDir) {
|
|
71664
71665
|
continue;
|
|
71665
71666
|
}
|
|
71666
|
-
const
|
|
71667
|
-
|
|
71667
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
71668
|
+
if (!dir) {
|
|
71669
|
+
continue;
|
|
71670
|
+
}
|
|
71671
|
+
const includePath = relative(this.projectRoot, dir);
|
|
71672
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
71673
|
+
}
|
|
71668
71674
|
}
|
|
71669
71675
|
return include;
|
|
71670
71676
|
}
|
|
@@ -71718,6 +71724,15 @@ var Config = class {
|
|
|
71718
71724
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
71719
71725
|
);
|
|
71720
71726
|
}
|
|
71727
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
71728
|
+
if (!plugin2.staticRuntime) {
|
|
71729
|
+
return null;
|
|
71730
|
+
}
|
|
71731
|
+
return join2(
|
|
71732
|
+
dirname(plugin2.filepath),
|
|
71733
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
71734
|
+
);
|
|
71735
|
+
}
|
|
71721
71736
|
async sourceFiles() {
|
|
71722
71737
|
return [
|
|
71723
71738
|
...new Set(
|
|
@@ -71902,6 +71917,9 @@ var Config = class {
|
|
|
71902
71917
|
pluginRuntimeDirectory(name) {
|
|
71903
71918
|
return join2(this.pluginDirectory(name), "runtime");
|
|
71904
71919
|
}
|
|
71920
|
+
pluginStaticRuntimeDirectory(name) {
|
|
71921
|
+
return join2(this.pluginDirectory(name), "static");
|
|
71922
|
+
}
|
|
71905
71923
|
get pluginRootDirectory() {
|
|
71906
71924
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
71907
71925
|
}
|
|
@@ -72271,7 +72289,7 @@ async function getConfig({
|
|
|
72271
72289
|
if (apiURL) {
|
|
72272
72290
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
72273
72291
|
console.log(
|
|
72274
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
72292
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
72275
72293
|
This will prevent your schema from being pulled.`
|
|
72276
72294
|
);
|
|
72277
72295
|
} else if (!await readFile(_config.schemaPath)) {
|
|
@@ -75549,6 +75567,50 @@ function moduleStatments(config) {
|
|
|
75549
75567
|
exportStarStatement
|
|
75550
75568
|
};
|
|
75551
75569
|
}
|
|
75570
|
+
async function generateStaticRuntimes({ config }) {
|
|
75571
|
+
if (houdini_mode.is_testing) {
|
|
75572
|
+
return;
|
|
75573
|
+
}
|
|
75574
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
75575
|
+
await Promise.all(
|
|
75576
|
+
config.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
75577
|
+
const runtime_path = config.pluginStaticRuntimeSource(plugin2);
|
|
75578
|
+
if (!runtime_path) {
|
|
75579
|
+
return;
|
|
75580
|
+
}
|
|
75581
|
+
try {
|
|
75582
|
+
await stat(runtime_path);
|
|
75583
|
+
} catch {
|
|
75584
|
+
throw new HoudiniError({
|
|
75585
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
75586
|
+
description: "Maybe it was bundled?"
|
|
75587
|
+
});
|
|
75588
|
+
}
|
|
75589
|
+
const pluginDir = config.pluginStaticRuntimeDirectory(plugin2.name);
|
|
75590
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
75591
|
+
if (transformMap && typeof transformMap === "function") {
|
|
75592
|
+
transformMap = transformMap([], { config });
|
|
75593
|
+
}
|
|
75594
|
+
await mkdirp(pluginDir);
|
|
75595
|
+
await recursiveCopy(
|
|
75596
|
+
runtime_path,
|
|
75597
|
+
pluginDir,
|
|
75598
|
+
Object.fromEntries(
|
|
75599
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
75600
|
+
join2(runtime_path, key),
|
|
75601
|
+
(content) => value({
|
|
75602
|
+
config,
|
|
75603
|
+
content,
|
|
75604
|
+
importStatement,
|
|
75605
|
+
exportDefaultStatement,
|
|
75606
|
+
exportStarStatement
|
|
75607
|
+
})
|
|
75608
|
+
])
|
|
75609
|
+
)
|
|
75610
|
+
);
|
|
75611
|
+
})
|
|
75612
|
+
);
|
|
75613
|
+
}
|
|
75552
75614
|
async function generatePluginRuntimes({
|
|
75553
75615
|
config,
|
|
75554
75616
|
docs
|
|
@@ -77130,6 +77192,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
77130
77192
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
77131
77193
|
});
|
|
77132
77194
|
}
|
|
77195
|
+
if (plugin2.staticRuntime) {
|
|
77196
|
+
body += exportStar({
|
|
77197
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
77198
|
+
});
|
|
77199
|
+
}
|
|
77133
77200
|
}
|
|
77134
77201
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
77135
77202
|
}
|
|
@@ -80885,6 +80952,7 @@ async function componentFields2(config, docs) {
|
|
|
80885
80952
|
|
|
80886
80953
|
// src/codegen/index.ts
|
|
80887
80954
|
async function compile(config) {
|
|
80955
|
+
await generateStaticRuntimes({ config });
|
|
80888
80956
|
const documents = await collectDocuments(config);
|
|
80889
80957
|
await runPipeline2(config, documents);
|
|
80890
80958
|
}
|
|
@@ -81170,7 +81238,7 @@ async function pullSchema_default(args) {
|
|
|
81170
81238
|
const apiURL = await config.apiURL();
|
|
81171
81239
|
if (!apiURL) {
|
|
81172
81240
|
console.log(
|
|
81173
|
-
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `
|
|
81241
|
+
"\u274C Your project does not have a remote endpoint configured. Please provide one with the `watchSchema.url` value in your houdini.config.js file."
|
|
81174
81242
|
);
|
|
81175
81243
|
process.exit(1);
|
|
81176
81244
|
return;
|
|
@@ -82050,7 +82118,7 @@ export default new HoudiniClient({
|
|
|
82050
82118
|
// fetchParams({ session }) {
|
|
82051
82119
|
// return {
|
|
82052
82120
|
// headers: {
|
|
82053
|
-
//
|
|
82121
|
+
// Authorization: \`Bearer \${session.token}\`,
|
|
82054
82122
|
// }
|
|
82055
82123
|
// }
|
|
82056
82124
|
// }
|
|
@@ -82292,12 +82360,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
82292
82360
|
}
|
|
82293
82361
|
packageJSON2.devDependencies = {
|
|
82294
82362
|
...packageJSON2.devDependencies,
|
|
82295
|
-
houdini: "^1.5.
|
|
82363
|
+
houdini: "^1.5.6"
|
|
82296
82364
|
};
|
|
82297
82365
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
82298
82366
|
packageJSON2.devDependencies = {
|
|
82299
82367
|
...packageJSON2.devDependencies,
|
|
82300
|
-
"houdini-svelte": "^2.1.
|
|
82368
|
+
"houdini-svelte": "^2.1.16"
|
|
82301
82369
|
};
|
|
82302
82370
|
} else {
|
|
82303
82371
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -6,6 +6,9 @@ export declare function moduleStatments(config: Config): {
|
|
|
6
6
|
exportDefaultStatement: typeof exportDefault;
|
|
7
7
|
exportStarStatement: typeof exportStarFrom;
|
|
8
8
|
};
|
|
9
|
+
export declare function generateStaticRuntimes({ config }: {
|
|
10
|
+
config: Config;
|
|
11
|
+
}): Promise<void>;
|
|
9
12
|
export declare function generatePluginRuntimes({ config, docs, }: {
|
|
10
13
|
config: Config;
|
|
11
14
|
docs: Document[];
|
|
@@ -63859,6 +63859,50 @@ function moduleStatments(config) {
|
|
|
63859
63859
|
exportStarStatement
|
|
63860
63860
|
};
|
|
63861
63861
|
}
|
|
63862
|
+
async function generateStaticRuntimes({ config }) {
|
|
63863
|
+
if (houdini_mode.is_testing) {
|
|
63864
|
+
return;
|
|
63865
|
+
}
|
|
63866
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
63867
|
+
await Promise.all(
|
|
63868
|
+
config.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
63869
|
+
const runtime_path = config.pluginStaticRuntimeSource(plugin2);
|
|
63870
|
+
if (!runtime_path) {
|
|
63871
|
+
return;
|
|
63872
|
+
}
|
|
63873
|
+
try {
|
|
63874
|
+
await stat(runtime_path);
|
|
63875
|
+
} catch {
|
|
63876
|
+
throw new HoudiniError({
|
|
63877
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
63878
|
+
description: "Maybe it was bundled?"
|
|
63879
|
+
});
|
|
63880
|
+
}
|
|
63881
|
+
const pluginDir = config.pluginStaticRuntimeDirectory(plugin2.name);
|
|
63882
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
63883
|
+
if (transformMap && typeof transformMap === "function") {
|
|
63884
|
+
transformMap = transformMap([], { config });
|
|
63885
|
+
}
|
|
63886
|
+
await mkdirp(pluginDir);
|
|
63887
|
+
await recursiveCopy(
|
|
63888
|
+
runtime_path,
|
|
63889
|
+
pluginDir,
|
|
63890
|
+
Object.fromEntries(
|
|
63891
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
63892
|
+
join(runtime_path, key),
|
|
63893
|
+
(content) => value({
|
|
63894
|
+
config,
|
|
63895
|
+
content,
|
|
63896
|
+
importStatement,
|
|
63897
|
+
exportDefaultStatement,
|
|
63898
|
+
exportStarStatement
|
|
63899
|
+
})
|
|
63900
|
+
])
|
|
63901
|
+
)
|
|
63902
|
+
);
|
|
63903
|
+
})
|
|
63904
|
+
);
|
|
63905
|
+
}
|
|
63862
63906
|
async function generatePluginRuntimes({
|
|
63863
63907
|
config,
|
|
63864
63908
|
docs
|
|
@@ -65440,6 +65484,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
65440
65484
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
65441
65485
|
});
|
|
65442
65486
|
}
|
|
65487
|
+
if (plugin2.staticRuntime) {
|
|
65488
|
+
body += exportStar({
|
|
65489
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
65490
|
+
});
|
|
65491
|
+
}
|
|
65443
65492
|
}
|
|
65444
65493
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
65445
65494
|
}
|
|
@@ -69195,6 +69244,7 @@ async function componentFields2(config, docs) {
|
|
|
69195
69244
|
|
|
69196
69245
|
// src/codegen/index.ts
|
|
69197
69246
|
async function compile(config) {
|
|
69247
|
+
await generateStaticRuntimes({ config });
|
|
69198
69248
|
const documents = await collectDocuments(config);
|
|
69199
69249
|
await runPipeline2(config, documents);
|
|
69200
69250
|
}
|
|
@@ -63858,6 +63858,50 @@ function moduleStatments(config) {
|
|
|
63858
63858
|
exportStarStatement
|
|
63859
63859
|
};
|
|
63860
63860
|
}
|
|
63861
|
+
async function generateStaticRuntimes({ config }) {
|
|
63862
|
+
if (houdini_mode.is_testing) {
|
|
63863
|
+
return;
|
|
63864
|
+
}
|
|
63865
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
63866
|
+
await Promise.all(
|
|
63867
|
+
config.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
63868
|
+
const runtime_path = config.pluginStaticRuntimeSource(plugin2);
|
|
63869
|
+
if (!runtime_path) {
|
|
63870
|
+
return;
|
|
63871
|
+
}
|
|
63872
|
+
try {
|
|
63873
|
+
await stat(runtime_path);
|
|
63874
|
+
} catch {
|
|
63875
|
+
throw new HoudiniError({
|
|
63876
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
63877
|
+
description: "Maybe it was bundled?"
|
|
63878
|
+
});
|
|
63879
|
+
}
|
|
63880
|
+
const pluginDir = config.pluginStaticRuntimeDirectory(plugin2.name);
|
|
63881
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
63882
|
+
if (transformMap && typeof transformMap === "function") {
|
|
63883
|
+
transformMap = transformMap([], { config });
|
|
63884
|
+
}
|
|
63885
|
+
await mkdirp(pluginDir);
|
|
63886
|
+
await recursiveCopy(
|
|
63887
|
+
runtime_path,
|
|
63888
|
+
pluginDir,
|
|
63889
|
+
Object.fromEntries(
|
|
63890
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
63891
|
+
join(runtime_path, key),
|
|
63892
|
+
(content) => value({
|
|
63893
|
+
config,
|
|
63894
|
+
content,
|
|
63895
|
+
importStatement,
|
|
63896
|
+
exportDefaultStatement,
|
|
63897
|
+
exportStarStatement
|
|
63898
|
+
})
|
|
63899
|
+
])
|
|
63900
|
+
)
|
|
63901
|
+
);
|
|
63902
|
+
})
|
|
63903
|
+
);
|
|
63904
|
+
}
|
|
63861
63905
|
async function generatePluginRuntimes({
|
|
63862
63906
|
config,
|
|
63863
63907
|
docs
|
|
@@ -65439,6 +65483,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
65439
65483
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
65440
65484
|
});
|
|
65441
65485
|
}
|
|
65486
|
+
if (plugin2.staticRuntime) {
|
|
65487
|
+
body += exportStar({
|
|
65488
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
65489
|
+
});
|
|
65490
|
+
}
|
|
65442
65491
|
}
|
|
65443
65492
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
65444
65493
|
}
|
|
@@ -69194,6 +69243,7 @@ async function componentFields2(config, docs) {
|
|
|
69194
69243
|
|
|
69195
69244
|
// src/codegen/index.ts
|
|
69196
69245
|
async function compile(config) {
|
|
69246
|
+
await generateStaticRuntimes({ config });
|
|
69197
69247
|
const documents = await collectDocuments(config);
|
|
69198
69248
|
await runPipeline2(config, documents);
|
|
69199
69249
|
}
|
package/build/lib/config.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ export declare class Config {
|
|
|
58
58
|
processEnvValues(env: Record<string, string | undefined>, value: string | ((env: any) => string)): string | undefined;
|
|
59
59
|
pullHeaders(): Promise<any>;
|
|
60
60
|
pluginRuntimeSource(plugin: PluginMeta): string | null;
|
|
61
|
+
pluginStaticRuntimeSource(plugin: PluginMeta): string | null;
|
|
61
62
|
sourceFiles(): Promise<string[]>;
|
|
62
63
|
get componentScalar(): string;
|
|
63
64
|
schemaString: string;
|
|
@@ -99,6 +100,7 @@ export declare class Config {
|
|
|
99
100
|
ignore_plugins?: boolean;
|
|
100
101
|
}): boolean;
|
|
101
102
|
pluginRuntimeDirectory(name: string): string;
|
|
103
|
+
pluginStaticRuntimeDirectory(name: string): string;
|
|
102
104
|
get pluginRootDirectory(): string;
|
|
103
105
|
pluginDirectory(name: string): string;
|
|
104
106
|
get loadDirective(): string;
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -72274,11 +72274,17 @@ var Config = class {
|
|
|
72274
72274
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
72275
72275
|
for (const plugin2 of this.plugins) {
|
|
72276
72276
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
72277
|
-
|
|
72277
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
72278
|
+
if (!runtimeDir && !staticDir) {
|
|
72278
72279
|
continue;
|
|
72279
72280
|
}
|
|
72280
|
-
const
|
|
72281
|
-
|
|
72281
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
72282
|
+
if (!dir) {
|
|
72283
|
+
continue;
|
|
72284
|
+
}
|
|
72285
|
+
const includePath = relative(this.projectRoot, dir);
|
|
72286
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
72287
|
+
}
|
|
72282
72288
|
}
|
|
72283
72289
|
return include;
|
|
72284
72290
|
}
|
|
@@ -72332,6 +72338,15 @@ var Config = class {
|
|
|
72332
72338
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
72333
72339
|
);
|
|
72334
72340
|
}
|
|
72341
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
72342
|
+
if (!plugin2.staticRuntime) {
|
|
72343
|
+
return null;
|
|
72344
|
+
}
|
|
72345
|
+
return join2(
|
|
72346
|
+
dirname(plugin2.filepath),
|
|
72347
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
72348
|
+
);
|
|
72349
|
+
}
|
|
72335
72350
|
async sourceFiles() {
|
|
72336
72351
|
return [
|
|
72337
72352
|
...new Set(
|
|
@@ -72516,6 +72531,9 @@ var Config = class {
|
|
|
72516
72531
|
pluginRuntimeDirectory(name) {
|
|
72517
72532
|
return join2(this.pluginDirectory(name), "runtime");
|
|
72518
72533
|
}
|
|
72534
|
+
pluginStaticRuntimeDirectory(name) {
|
|
72535
|
+
return join2(this.pluginDirectory(name), "static");
|
|
72536
|
+
}
|
|
72519
72537
|
get pluginRootDirectory() {
|
|
72520
72538
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
72521
72539
|
}
|
|
@@ -72885,7 +72903,7 @@ async function getConfig({
|
|
|
72885
72903
|
if (apiURL) {
|
|
72886
72904
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
72887
72905
|
console.log(
|
|
72888
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
72906
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
72889
72907
|
This will prevent your schema from being pulled.`
|
|
72890
72908
|
);
|
|
72891
72909
|
} else if (!await readFile(_config.schemaPath)) {
|
package/build/lib-esm/index.js
CHANGED
|
@@ -72187,11 +72187,17 @@ var Config = class {
|
|
|
72187
72187
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
72188
72188
|
for (const plugin2 of this.plugins) {
|
|
72189
72189
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
72190
|
-
|
|
72190
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
72191
|
+
if (!runtimeDir && !staticDir) {
|
|
72191
72192
|
continue;
|
|
72192
72193
|
}
|
|
72193
|
-
const
|
|
72194
|
-
|
|
72194
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
72195
|
+
if (!dir) {
|
|
72196
|
+
continue;
|
|
72197
|
+
}
|
|
72198
|
+
const includePath = relative(this.projectRoot, dir);
|
|
72199
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
72200
|
+
}
|
|
72195
72201
|
}
|
|
72196
72202
|
return include;
|
|
72197
72203
|
}
|
|
@@ -72245,6 +72251,15 @@ var Config = class {
|
|
|
72245
72251
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
72246
72252
|
);
|
|
72247
72253
|
}
|
|
72254
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
72255
|
+
if (!plugin2.staticRuntime) {
|
|
72256
|
+
return null;
|
|
72257
|
+
}
|
|
72258
|
+
return join2(
|
|
72259
|
+
dirname(plugin2.filepath),
|
|
72260
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
72261
|
+
);
|
|
72262
|
+
}
|
|
72248
72263
|
async sourceFiles() {
|
|
72249
72264
|
return [
|
|
72250
72265
|
...new Set(
|
|
@@ -72429,6 +72444,9 @@ var Config = class {
|
|
|
72429
72444
|
pluginRuntimeDirectory(name) {
|
|
72430
72445
|
return join2(this.pluginDirectory(name), "runtime");
|
|
72431
72446
|
}
|
|
72447
|
+
pluginStaticRuntimeDirectory(name) {
|
|
72448
|
+
return join2(this.pluginDirectory(name), "static");
|
|
72449
|
+
}
|
|
72432
72450
|
get pluginRootDirectory() {
|
|
72433
72451
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
72434
72452
|
}
|
|
@@ -72798,7 +72816,7 @@ async function getConfig({
|
|
|
72798
72816
|
if (apiURL) {
|
|
72799
72817
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
72800
72818
|
console.log(
|
|
72801
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
72819
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
72802
72820
|
This will prevent your schema from being pulled.`
|
|
72803
72821
|
);
|
|
72804
72822
|
} else if (!await readFile(_config.schemaPath)) {
|
package/build/test-cjs/index.js
CHANGED
|
@@ -60935,11 +60935,17 @@ var Config = class {
|
|
|
60935
60935
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
60936
60936
|
for (const plugin2 of this.plugins) {
|
|
60937
60937
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
60938
|
-
|
|
60938
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
60939
|
+
if (!runtimeDir && !staticDir) {
|
|
60939
60940
|
continue;
|
|
60940
60941
|
}
|
|
60941
|
-
const
|
|
60942
|
-
|
|
60942
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
60943
|
+
if (!dir) {
|
|
60944
|
+
continue;
|
|
60945
|
+
}
|
|
60946
|
+
const includePath = relative(this.projectRoot, dir);
|
|
60947
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
60948
|
+
}
|
|
60943
60949
|
}
|
|
60944
60950
|
return include;
|
|
60945
60951
|
}
|
|
@@ -60993,6 +60999,15 @@ var Config = class {
|
|
|
60993
60999
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
60994
61000
|
);
|
|
60995
61001
|
}
|
|
61002
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
61003
|
+
if (!plugin2.staticRuntime) {
|
|
61004
|
+
return null;
|
|
61005
|
+
}
|
|
61006
|
+
return join(
|
|
61007
|
+
dirname(plugin2.filepath),
|
|
61008
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
61009
|
+
);
|
|
61010
|
+
}
|
|
60996
61011
|
async sourceFiles() {
|
|
60997
61012
|
return [
|
|
60998
61013
|
...new Set(
|
|
@@ -61177,6 +61192,9 @@ var Config = class {
|
|
|
61177
61192
|
pluginRuntimeDirectory(name) {
|
|
61178
61193
|
return join(this.pluginDirectory(name), "runtime");
|
|
61179
61194
|
}
|
|
61195
|
+
pluginStaticRuntimeDirectory(name) {
|
|
61196
|
+
return join(this.pluginDirectory(name), "static");
|
|
61197
|
+
}
|
|
61180
61198
|
get pluginRootDirectory() {
|
|
61181
61199
|
return houdini_mode.is_testing ? "../../../" : join(this.rootDir, "plugins");
|
|
61182
61200
|
}
|
|
@@ -65810,6 +65828,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
65810
65828
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
65811
65829
|
});
|
|
65812
65830
|
}
|
|
65831
|
+
if (plugin2.staticRuntime) {
|
|
65832
|
+
body += exportStar({
|
|
65833
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
65834
|
+
});
|
|
65835
|
+
}
|
|
65813
65836
|
}
|
|
65814
65837
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
65815
65838
|
}
|
package/build/test-esm/index.js
CHANGED
|
@@ -60931,11 +60931,17 @@ var Config = class {
|
|
|
60931
60931
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
60932
60932
|
for (const plugin2 of this.plugins) {
|
|
60933
60933
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
60934
|
-
|
|
60934
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
60935
|
+
if (!runtimeDir && !staticDir) {
|
|
60935
60936
|
continue;
|
|
60936
60937
|
}
|
|
60937
|
-
const
|
|
60938
|
-
|
|
60938
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
60939
|
+
if (!dir) {
|
|
60940
|
+
continue;
|
|
60941
|
+
}
|
|
60942
|
+
const includePath = relative(this.projectRoot, dir);
|
|
60943
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
60944
|
+
}
|
|
60939
60945
|
}
|
|
60940
60946
|
return include;
|
|
60941
60947
|
}
|
|
@@ -60989,6 +60995,15 @@ var Config = class {
|
|
|
60989
60995
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
60990
60996
|
);
|
|
60991
60997
|
}
|
|
60998
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
60999
|
+
if (!plugin2.staticRuntime) {
|
|
61000
|
+
return null;
|
|
61001
|
+
}
|
|
61002
|
+
return join(
|
|
61003
|
+
dirname(plugin2.filepath),
|
|
61004
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
61005
|
+
);
|
|
61006
|
+
}
|
|
60992
61007
|
async sourceFiles() {
|
|
60993
61008
|
return [
|
|
60994
61009
|
...new Set(
|
|
@@ -61173,6 +61188,9 @@ var Config = class {
|
|
|
61173
61188
|
pluginRuntimeDirectory(name) {
|
|
61174
61189
|
return join(this.pluginDirectory(name), "runtime");
|
|
61175
61190
|
}
|
|
61191
|
+
pluginStaticRuntimeDirectory(name) {
|
|
61192
|
+
return join(this.pluginDirectory(name), "static");
|
|
61193
|
+
}
|
|
61176
61194
|
get pluginRootDirectory() {
|
|
61177
61195
|
return houdini_mode.is_testing ? "../../../" : join(this.rootDir, "plugins");
|
|
61178
61196
|
}
|
|
@@ -65806,6 +65824,11 @@ async function writeIndexFile2(config, docs) {
|
|
|
65806
65824
|
module: relative2(config.pluginRuntimeDirectory(plugin2.name))
|
|
65807
65825
|
});
|
|
65808
65826
|
}
|
|
65827
|
+
if (plugin2.staticRuntime) {
|
|
65828
|
+
body += exportStar({
|
|
65829
|
+
module: relative2(config.pluginStaticRuntimeDirectory(plugin2.name))
|
|
65830
|
+
});
|
|
65831
|
+
}
|
|
65809
65832
|
}
|
|
65810
65833
|
await fs_exports.writeFile(path_exports.join(config.rootDir, "index.js"), body);
|
|
65811
65834
|
}
|
package/build/vite/imports.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function ensure_imports(args: {
|
|
|
9
9
|
import?: string;
|
|
10
10
|
as?: never;
|
|
11
11
|
sourceModule: string;
|
|
12
|
-
importKind?: 'value' | 'type';
|
|
12
|
+
importKind?: 'value' | 'type' | 'module';
|
|
13
13
|
}): {
|
|
14
14
|
ids: Identifier;
|
|
15
15
|
added: number;
|
|
@@ -20,7 +20,7 @@ export declare function ensure_imports(args: {
|
|
|
20
20
|
import?: string[];
|
|
21
21
|
as?: string[];
|
|
22
22
|
sourceModule: string;
|
|
23
|
-
importKind?: 'value' | 'type';
|
|
23
|
+
importKind?: 'value' | 'type' | 'module';
|
|
24
24
|
}): {
|
|
25
25
|
ids: Identifier[];
|
|
26
26
|
added: number;
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -73411,11 +73411,17 @@ var Config = class {
|
|
|
73411
73411
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
73412
73412
|
for (const plugin2 of this.plugins) {
|
|
73413
73413
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
73414
|
-
|
|
73414
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
73415
|
+
if (!runtimeDir && !staticDir) {
|
|
73415
73416
|
continue;
|
|
73416
73417
|
}
|
|
73417
|
-
const
|
|
73418
|
-
|
|
73418
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
73419
|
+
if (!dir) {
|
|
73420
|
+
continue;
|
|
73421
|
+
}
|
|
73422
|
+
const includePath = relative(this.projectRoot, dir);
|
|
73423
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
73424
|
+
}
|
|
73419
73425
|
}
|
|
73420
73426
|
return include;
|
|
73421
73427
|
}
|
|
@@ -73469,6 +73475,15 @@ var Config = class {
|
|
|
73469
73475
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
73470
73476
|
);
|
|
73471
73477
|
}
|
|
73478
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
73479
|
+
if (!plugin2.staticRuntime) {
|
|
73480
|
+
return null;
|
|
73481
|
+
}
|
|
73482
|
+
return join2(
|
|
73483
|
+
dirname(plugin2.filepath),
|
|
73484
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
73485
|
+
);
|
|
73486
|
+
}
|
|
73472
73487
|
async sourceFiles() {
|
|
73473
73488
|
return [
|
|
73474
73489
|
...new Set(
|
|
@@ -73653,6 +73668,9 @@ var Config = class {
|
|
|
73653
73668
|
pluginRuntimeDirectory(name) {
|
|
73654
73669
|
return join2(this.pluginDirectory(name), "runtime");
|
|
73655
73670
|
}
|
|
73671
|
+
pluginStaticRuntimeDirectory(name) {
|
|
73672
|
+
return join2(this.pluginDirectory(name), "static");
|
|
73673
|
+
}
|
|
73656
73674
|
get pluginRootDirectory() {
|
|
73657
73675
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
73658
73676
|
}
|
|
@@ -74022,7 +74040,7 @@ async function getConfig({
|
|
|
74022
74040
|
if (apiURL) {
|
|
74023
74041
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
74024
74042
|
console.log(
|
|
74025
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
74043
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
74026
74044
|
This will prevent your schema from being pulled.`
|
|
74027
74045
|
);
|
|
74028
74046
|
} else if (!await readFile(_config.schemaPath)) {
|
|
@@ -77294,6 +77312,50 @@ function moduleStatments(config2) {
|
|
|
77294
77312
|
exportStarStatement
|
|
77295
77313
|
};
|
|
77296
77314
|
}
|
|
77315
|
+
async function generateStaticRuntimes({ config: config2 }) {
|
|
77316
|
+
if (houdini_mode.is_testing) {
|
|
77317
|
+
return;
|
|
77318
|
+
}
|
|
77319
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
77320
|
+
await Promise.all(
|
|
77321
|
+
config2.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
77322
|
+
const runtime_path = config2.pluginStaticRuntimeSource(plugin2);
|
|
77323
|
+
if (!runtime_path) {
|
|
77324
|
+
return;
|
|
77325
|
+
}
|
|
77326
|
+
try {
|
|
77327
|
+
await stat(runtime_path);
|
|
77328
|
+
} catch {
|
|
77329
|
+
throw new HoudiniError({
|
|
77330
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
77331
|
+
description: "Maybe it was bundled?"
|
|
77332
|
+
});
|
|
77333
|
+
}
|
|
77334
|
+
const pluginDir = config2.pluginStaticRuntimeDirectory(plugin2.name);
|
|
77335
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
77336
|
+
if (transformMap && typeof transformMap === "function") {
|
|
77337
|
+
transformMap = transformMap([], { config: config2 });
|
|
77338
|
+
}
|
|
77339
|
+
await mkdirp(pluginDir);
|
|
77340
|
+
await recursiveCopy(
|
|
77341
|
+
runtime_path,
|
|
77342
|
+
pluginDir,
|
|
77343
|
+
Object.fromEntries(
|
|
77344
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
77345
|
+
join2(runtime_path, key),
|
|
77346
|
+
(content) => value({
|
|
77347
|
+
config: config2,
|
|
77348
|
+
content,
|
|
77349
|
+
importStatement,
|
|
77350
|
+
exportDefaultStatement,
|
|
77351
|
+
exportStarStatement
|
|
77352
|
+
})
|
|
77353
|
+
])
|
|
77354
|
+
)
|
|
77355
|
+
);
|
|
77356
|
+
})
|
|
77357
|
+
);
|
|
77358
|
+
}
|
|
77297
77359
|
async function generatePluginRuntimes({
|
|
77298
77360
|
config: config2,
|
|
77299
77361
|
docs
|
|
@@ -78875,6 +78937,11 @@ async function writeIndexFile2(config2, docs) {
|
|
|
78875
78937
|
module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
|
|
78876
78938
|
});
|
|
78877
78939
|
}
|
|
78940
|
+
if (plugin2.staticRuntime) {
|
|
78941
|
+
body += exportStar({
|
|
78942
|
+
module: relative2(config2.pluginStaticRuntimeDirectory(plugin2.name))
|
|
78943
|
+
});
|
|
78944
|
+
}
|
|
78878
78945
|
}
|
|
78879
78946
|
await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
|
|
78880
78947
|
}
|
|
@@ -82630,6 +82697,7 @@ async function componentFields2(config2, docs) {
|
|
|
82630
82697
|
|
|
82631
82698
|
// src/codegen/index.ts
|
|
82632
82699
|
async function compile(config2) {
|
|
82700
|
+
await generateStaticRuntimes({ config: config2 });
|
|
82633
82701
|
const documents = await collectDocuments(config2);
|
|
82634
82702
|
await runPipeline2(config2, documents);
|
|
82635
82703
|
}
|
|
@@ -83292,7 +83360,7 @@ function ensure_imports({
|
|
|
83292
83360
|
script.body.unshift({
|
|
83293
83361
|
type: "ImportDeclaration",
|
|
83294
83362
|
source: AST16.stringLiteral(sourceModule),
|
|
83295
|
-
importKind
|
|
83363
|
+
importKind: importKind === "type" ? "type" : "value"
|
|
83296
83364
|
});
|
|
83297
83365
|
}
|
|
83298
83366
|
return { ids: [], added: has_import ? 0 : 1 };
|
|
@@ -83306,13 +83374,12 @@ function ensure_imports({
|
|
|
83306
83374
|
)
|
|
83307
83375
|
);
|
|
83308
83376
|
if (toImport.length > 0) {
|
|
83377
|
+
const specifier = (identifier, i2) => importKind !== "module" ? !Array.isArray(importID) ? AST16.importDefaultSpecifier(identifier) : AST16.importSpecifier(identifier, as?.[i2] ? AST16.identifier(as[i2]) : identifier) : AST16.importNamespaceSpecifier(identifier);
|
|
83309
83378
|
script.body.unshift({
|
|
83310
83379
|
type: "ImportDeclaration",
|
|
83311
83380
|
source: AST16.stringLiteral(sourceModule),
|
|
83312
|
-
specifiers: toImport.map(
|
|
83313
|
-
|
|
83314
|
-
),
|
|
83315
|
-
importKind
|
|
83381
|
+
specifiers: toImport.map(specifier),
|
|
83382
|
+
importKind: importKind === "type" ? "type" : "value"
|
|
83316
83383
|
});
|
|
83317
83384
|
}
|
|
83318
83385
|
for (const [i2, target] of (as ?? []).entries()) {
|
package/build/vite-esm/index.js
CHANGED
|
@@ -73404,11 +73404,17 @@ var Config = class {
|
|
|
73404
73404
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
73405
73405
|
for (const plugin2 of this.plugins) {
|
|
73406
73406
|
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
73407
|
-
|
|
73407
|
+
const staticDir = this.pluginStaticRuntimeSource(plugin2);
|
|
73408
|
+
if (!runtimeDir && !staticDir) {
|
|
73408
73409
|
continue;
|
|
73409
73410
|
}
|
|
73410
|
-
const
|
|
73411
|
-
|
|
73411
|
+
for (const dir of [runtimeDir, staticDir]) {
|
|
73412
|
+
if (!dir) {
|
|
73413
|
+
continue;
|
|
73414
|
+
}
|
|
73415
|
+
const includePath = relative(this.projectRoot, dir);
|
|
73416
|
+
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
73417
|
+
}
|
|
73412
73418
|
}
|
|
73413
73419
|
return include;
|
|
73414
73420
|
}
|
|
@@ -73462,6 +73468,15 @@ var Config = class {
|
|
|
73462
73468
|
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
73463
73469
|
);
|
|
73464
73470
|
}
|
|
73471
|
+
pluginStaticRuntimeSource(plugin2) {
|
|
73472
|
+
if (!plugin2.staticRuntime) {
|
|
73473
|
+
return null;
|
|
73474
|
+
}
|
|
73475
|
+
return join2(
|
|
73476
|
+
dirname(plugin2.filepath),
|
|
73477
|
+
typeof plugin2.staticRuntime === "string" ? plugin2.staticRuntime : plugin2.staticRuntime?.[this.module]
|
|
73478
|
+
);
|
|
73479
|
+
}
|
|
73465
73480
|
async sourceFiles() {
|
|
73466
73481
|
return [
|
|
73467
73482
|
...new Set(
|
|
@@ -73646,6 +73661,9 @@ var Config = class {
|
|
|
73646
73661
|
pluginRuntimeDirectory(name) {
|
|
73647
73662
|
return join2(this.pluginDirectory(name), "runtime");
|
|
73648
73663
|
}
|
|
73664
|
+
pluginStaticRuntimeDirectory(name) {
|
|
73665
|
+
return join2(this.pluginDirectory(name), "static");
|
|
73666
|
+
}
|
|
73649
73667
|
get pluginRootDirectory() {
|
|
73650
73668
|
return houdini_mode.is_testing ? "../../../" : join2(this.rootDir, "plugins");
|
|
73651
73669
|
}
|
|
@@ -74015,7 +74033,7 @@ async function getConfig({
|
|
|
74015
74033
|
if (apiURL) {
|
|
74016
74034
|
if (glob2.hasMagic(_config.schemaPath)) {
|
|
74017
74035
|
console.log(
|
|
74018
|
-
`\u26A0\uFE0F Your houdini configuration contains
|
|
74036
|
+
`\u26A0\uFE0F Your houdini configuration contains a watchSchema url and a path pointing to multiple files.
|
|
74019
74037
|
This will prevent your schema from being pulled.`
|
|
74020
74038
|
);
|
|
74021
74039
|
} else if (!await readFile(_config.schemaPath)) {
|
|
@@ -77287,6 +77305,50 @@ function moduleStatments(config2) {
|
|
|
77287
77305
|
exportStarStatement
|
|
77288
77306
|
};
|
|
77289
77307
|
}
|
|
77308
|
+
async function generateStaticRuntimes({ config: config2 }) {
|
|
77309
|
+
if (houdini_mode.is_testing) {
|
|
77310
|
+
return;
|
|
77311
|
+
}
|
|
77312
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
77313
|
+
await Promise.all(
|
|
77314
|
+
config2.plugins.filter((plugin2) => plugin2.staticRuntime).map(async (plugin2) => {
|
|
77315
|
+
const runtime_path = config2.pluginStaticRuntimeSource(plugin2);
|
|
77316
|
+
if (!runtime_path) {
|
|
77317
|
+
return;
|
|
77318
|
+
}
|
|
77319
|
+
try {
|
|
77320
|
+
await stat(runtime_path);
|
|
77321
|
+
} catch {
|
|
77322
|
+
throw new HoudiniError({
|
|
77323
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
77324
|
+
description: "Maybe it was bundled?"
|
|
77325
|
+
});
|
|
77326
|
+
}
|
|
77327
|
+
const pluginDir = config2.pluginStaticRuntimeDirectory(plugin2.name);
|
|
77328
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
77329
|
+
if (transformMap && typeof transformMap === "function") {
|
|
77330
|
+
transformMap = transformMap([], { config: config2 });
|
|
77331
|
+
}
|
|
77332
|
+
await mkdirp(pluginDir);
|
|
77333
|
+
await recursiveCopy(
|
|
77334
|
+
runtime_path,
|
|
77335
|
+
pluginDir,
|
|
77336
|
+
Object.fromEntries(
|
|
77337
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
77338
|
+
join2(runtime_path, key),
|
|
77339
|
+
(content) => value({
|
|
77340
|
+
config: config2,
|
|
77341
|
+
content,
|
|
77342
|
+
importStatement,
|
|
77343
|
+
exportDefaultStatement,
|
|
77344
|
+
exportStarStatement
|
|
77345
|
+
})
|
|
77346
|
+
])
|
|
77347
|
+
)
|
|
77348
|
+
);
|
|
77349
|
+
})
|
|
77350
|
+
);
|
|
77351
|
+
}
|
|
77290
77352
|
async function generatePluginRuntimes({
|
|
77291
77353
|
config: config2,
|
|
77292
77354
|
docs
|
|
@@ -78868,6 +78930,11 @@ async function writeIndexFile2(config2, docs) {
|
|
|
78868
78930
|
module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
|
|
78869
78931
|
});
|
|
78870
78932
|
}
|
|
78933
|
+
if (plugin2.staticRuntime) {
|
|
78934
|
+
body += exportStar({
|
|
78935
|
+
module: relative2(config2.pluginStaticRuntimeDirectory(plugin2.name))
|
|
78936
|
+
});
|
|
78937
|
+
}
|
|
78871
78938
|
}
|
|
78872
78939
|
await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
|
|
78873
78940
|
}
|
|
@@ -82623,6 +82690,7 @@ async function componentFields2(config2, docs) {
|
|
|
82623
82690
|
|
|
82624
82691
|
// src/codegen/index.ts
|
|
82625
82692
|
async function compile(config2) {
|
|
82693
|
+
await generateStaticRuntimes({ config: config2 });
|
|
82626
82694
|
const documents = await collectDocuments(config2);
|
|
82627
82695
|
await runPipeline2(config2, documents);
|
|
82628
82696
|
}
|
|
@@ -83285,7 +83353,7 @@ function ensure_imports({
|
|
|
83285
83353
|
script.body.unshift({
|
|
83286
83354
|
type: "ImportDeclaration",
|
|
83287
83355
|
source: AST16.stringLiteral(sourceModule),
|
|
83288
|
-
importKind
|
|
83356
|
+
importKind: importKind === "type" ? "type" : "value"
|
|
83289
83357
|
});
|
|
83290
83358
|
}
|
|
83291
83359
|
return { ids: [], added: has_import ? 0 : 1 };
|
|
@@ -83299,13 +83367,12 @@ function ensure_imports({
|
|
|
83299
83367
|
)
|
|
83300
83368
|
);
|
|
83301
83369
|
if (toImport.length > 0) {
|
|
83370
|
+
const specifier = (identifier, i2) => importKind !== "module" ? !Array.isArray(importID) ? AST16.importDefaultSpecifier(identifier) : AST16.importSpecifier(identifier, as?.[i2] ? AST16.identifier(as[i2]) : identifier) : AST16.importNamespaceSpecifier(identifier);
|
|
83302
83371
|
script.body.unshift({
|
|
83303
83372
|
type: "ImportDeclaration",
|
|
83304
83373
|
source: AST16.stringLiteral(sourceModule),
|
|
83305
|
-
specifiers: toImport.map(
|
|
83306
|
-
|
|
83307
|
-
),
|
|
83308
|
-
importKind
|
|
83374
|
+
specifiers: toImport.map(specifier),
|
|
83375
|
+
importKind: importKind === "type" ? "type" : "value"
|
|
83309
83376
|
});
|
|
83310
83377
|
}
|
|
83311
83378
|
for (const [i2, target] of (as ?? []).entries()) {
|