houdini 1.2.32 → 1.2.33
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 +67 -56
- package/build/cmd-esm/index.js +67 -56
- package/build/codegen/generators/runtime/index.d.ts +6 -3
- package/build/codegen/generators/runtime/pluginRuntime.d.ts +5 -0
- package/build/codegen-cjs/index.js +53 -52
- package/build/codegen-esm/index.js +53 -52
- package/build/lib/config.d.ts +1 -0
- package/build/lib-cjs/index.js +12 -2
- package/build/lib-esm/index.js +12 -2
- package/build/test-cjs/index.js +65 -29
- package/build/test-esm/index.js +65 -29
- package/build/vite-cjs/index.js +65 -54
- package/build/vite-esm/index.js +65 -54
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -68015,10 +68015,11 @@ var Config = class {
|
|
|
68015
68015
|
);
|
|
68016
68016
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
68017
68017
|
for (const plugin2 of this.plugins) {
|
|
68018
|
-
|
|
68018
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
68019
|
+
if (!runtimeDir) {
|
|
68019
68020
|
continue;
|
|
68020
68021
|
}
|
|
68021
|
-
const includePath = relative(this.projectRoot,
|
|
68022
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
68022
68023
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
68023
68024
|
}
|
|
68024
68025
|
return include;
|
|
@@ -68064,6 +68065,15 @@ var Config = class {
|
|
|
68064
68065
|
);
|
|
68065
68066
|
return headers;
|
|
68066
68067
|
}
|
|
68068
|
+
pluginRuntimeSource(plugin2) {
|
|
68069
|
+
if (!plugin2.includeRuntime) {
|
|
68070
|
+
return null;
|
|
68071
|
+
}
|
|
68072
|
+
return join2(
|
|
68073
|
+
dirname(plugin2.filepath),
|
|
68074
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
68075
|
+
);
|
|
68076
|
+
}
|
|
68067
68077
|
async sourceFiles() {
|
|
68068
68078
|
return [
|
|
68069
68079
|
...new Set(
|
|
@@ -72464,6 +72474,55 @@ async function generatePluginIndex({
|
|
|
72464
72474
|
]);
|
|
72465
72475
|
}
|
|
72466
72476
|
|
|
72477
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
72478
|
+
async function generatePluginRuntimes({
|
|
72479
|
+
config,
|
|
72480
|
+
docs
|
|
72481
|
+
}) {
|
|
72482
|
+
if (houdini_mode.is_testing) {
|
|
72483
|
+
return;
|
|
72484
|
+
}
|
|
72485
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
72486
|
+
await Promise.all(
|
|
72487
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72488
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
72489
|
+
if (!runtime_path) {
|
|
72490
|
+
return;
|
|
72491
|
+
}
|
|
72492
|
+
try {
|
|
72493
|
+
await fs_exports.stat(runtime_path);
|
|
72494
|
+
} catch {
|
|
72495
|
+
throw new HoudiniError({
|
|
72496
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
72497
|
+
description: "Maybe it was bundled?"
|
|
72498
|
+
});
|
|
72499
|
+
}
|
|
72500
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
72501
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
72502
|
+
if (transformMap && typeof transformMap === "function") {
|
|
72503
|
+
transformMap = transformMap(docs, { config });
|
|
72504
|
+
}
|
|
72505
|
+
await fs_exports.mkdirp(pluginDir);
|
|
72506
|
+
await fs_exports.recursiveCopy(
|
|
72507
|
+
runtime_path,
|
|
72508
|
+
pluginDir,
|
|
72509
|
+
Object.fromEntries(
|
|
72510
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
72511
|
+
path_exports.join(runtime_path, key),
|
|
72512
|
+
(content) => value({
|
|
72513
|
+
config,
|
|
72514
|
+
content,
|
|
72515
|
+
importStatement,
|
|
72516
|
+
exportDefaultStatement,
|
|
72517
|
+
exportStarStatement
|
|
72518
|
+
})
|
|
72519
|
+
])
|
|
72520
|
+
)
|
|
72521
|
+
);
|
|
72522
|
+
})
|
|
72523
|
+
);
|
|
72524
|
+
}
|
|
72525
|
+
|
|
72467
72526
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
72468
72527
|
async function injectConfig({
|
|
72469
72528
|
config,
|
|
@@ -72512,61 +72571,14 @@ ${exportStatement("config")}
|
|
|
72512
72571
|
},
|
|
72513
72572
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
72514
72573
|
}),
|
|
72515
|
-
|
|
72574
|
+
generatePluginRuntimes({
|
|
72575
|
+
config,
|
|
72576
|
+
docs
|
|
72577
|
+
}),
|
|
72516
72578
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
72517
72579
|
]);
|
|
72518
72580
|
await generateGraphqlReturnTypes(config, docs);
|
|
72519
72581
|
}
|
|
72520
|
-
async function generatePluginRuntimes({ config }) {
|
|
72521
|
-
await Promise.all(
|
|
72522
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72523
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
72524
|
-
return;
|
|
72525
|
-
}
|
|
72526
|
-
const runtime_path = path_exports.join(
|
|
72527
|
-
path_exports.dirname(plugin2.filepath),
|
|
72528
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
|
|
72529
|
-
);
|
|
72530
|
-
try {
|
|
72531
|
-
await fs_exports.stat(runtime_path);
|
|
72532
|
-
} catch {
|
|
72533
|
-
throw new HoudiniError({
|
|
72534
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
72535
|
-
description: "Maybe it was bundled?"
|
|
72536
|
-
});
|
|
72537
|
-
}
|
|
72538
|
-
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
72539
|
-
await fs_exports.mkdirp(pluginDir);
|
|
72540
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
72541
|
-
})
|
|
72542
|
-
);
|
|
72543
|
-
}
|
|
72544
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
72545
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
72546
|
-
await Promise.all(
|
|
72547
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72548
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
72549
|
-
if (transformMap && typeof transformMap === "function") {
|
|
72550
|
-
transformMap = transformMap(docs, { config });
|
|
72551
|
-
}
|
|
72552
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
72553
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
72554
|
-
const content = await fs_exports.readFile(targetPath);
|
|
72555
|
-
if (!content) {
|
|
72556
|
-
return;
|
|
72557
|
-
}
|
|
72558
|
-
const transformed = transform({
|
|
72559
|
-
config,
|
|
72560
|
-
content,
|
|
72561
|
-
importStatement,
|
|
72562
|
-
exportDefaultStatement,
|
|
72563
|
-
exportStarStatement
|
|
72564
|
-
});
|
|
72565
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
72566
|
-
}
|
|
72567
|
-
})
|
|
72568
|
-
);
|
|
72569
|
-
}
|
|
72570
72582
|
function moduleStatments(config) {
|
|
72571
72583
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
72572
72584
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -77196,7 +77208,6 @@ async function componentFields2(config, docs) {
|
|
|
77196
77208
|
|
|
77197
77209
|
// src/codegen/index.ts
|
|
77198
77210
|
async function compile(config) {
|
|
77199
|
-
await generatePluginRuntimes({ config });
|
|
77200
77211
|
const documents = await collectDocuments(config);
|
|
77201
77212
|
await runPipeline2(config, documents);
|
|
77202
77213
|
}
|
|
@@ -78507,12 +78518,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78507
78518
|
}
|
|
78508
78519
|
packageJSON2.devDependencies = {
|
|
78509
78520
|
...packageJSON2.devDependencies,
|
|
78510
|
-
houdini: "^1.2.
|
|
78521
|
+
houdini: "^1.2.33"
|
|
78511
78522
|
};
|
|
78512
78523
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78513
78524
|
packageJSON2.devDependencies = {
|
|
78514
78525
|
...packageJSON2.devDependencies,
|
|
78515
|
-
"houdini-svelte": "^1.2.
|
|
78526
|
+
"houdini-svelte": "^1.2.33"
|
|
78516
78527
|
};
|
|
78517
78528
|
} else {
|
|
78518
78529
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -68020,10 +68020,11 @@ var Config = class {
|
|
|
68020
68020
|
);
|
|
68021
68021
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
68022
68022
|
for (const plugin2 of this.plugins) {
|
|
68023
|
-
|
|
68023
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
68024
|
+
if (!runtimeDir) {
|
|
68024
68025
|
continue;
|
|
68025
68026
|
}
|
|
68026
|
-
const includePath = relative(this.projectRoot,
|
|
68027
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
68027
68028
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
68028
68029
|
}
|
|
68029
68030
|
return include;
|
|
@@ -68069,6 +68070,15 @@ var Config = class {
|
|
|
68069
68070
|
);
|
|
68070
68071
|
return headers;
|
|
68071
68072
|
}
|
|
68073
|
+
pluginRuntimeSource(plugin2) {
|
|
68074
|
+
if (!plugin2.includeRuntime) {
|
|
68075
|
+
return null;
|
|
68076
|
+
}
|
|
68077
|
+
return join2(
|
|
68078
|
+
dirname(plugin2.filepath),
|
|
68079
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
68080
|
+
);
|
|
68081
|
+
}
|
|
68072
68082
|
async sourceFiles() {
|
|
68073
68083
|
return [
|
|
68074
68084
|
...new Set(
|
|
@@ -72469,6 +72479,55 @@ async function generatePluginIndex({
|
|
|
72469
72479
|
]);
|
|
72470
72480
|
}
|
|
72471
72481
|
|
|
72482
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
72483
|
+
async function generatePluginRuntimes({
|
|
72484
|
+
config,
|
|
72485
|
+
docs
|
|
72486
|
+
}) {
|
|
72487
|
+
if (houdini_mode.is_testing) {
|
|
72488
|
+
return;
|
|
72489
|
+
}
|
|
72490
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
72491
|
+
await Promise.all(
|
|
72492
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72493
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
72494
|
+
if (!runtime_path) {
|
|
72495
|
+
return;
|
|
72496
|
+
}
|
|
72497
|
+
try {
|
|
72498
|
+
await fs_exports.stat(runtime_path);
|
|
72499
|
+
} catch {
|
|
72500
|
+
throw new HoudiniError({
|
|
72501
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
72502
|
+
description: "Maybe it was bundled?"
|
|
72503
|
+
});
|
|
72504
|
+
}
|
|
72505
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
72506
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
72507
|
+
if (transformMap && typeof transformMap === "function") {
|
|
72508
|
+
transformMap = transformMap(docs, { config });
|
|
72509
|
+
}
|
|
72510
|
+
await fs_exports.mkdirp(pluginDir);
|
|
72511
|
+
await fs_exports.recursiveCopy(
|
|
72512
|
+
runtime_path,
|
|
72513
|
+
pluginDir,
|
|
72514
|
+
Object.fromEntries(
|
|
72515
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
72516
|
+
path_exports.join(runtime_path, key),
|
|
72517
|
+
(content) => value({
|
|
72518
|
+
config,
|
|
72519
|
+
content,
|
|
72520
|
+
importStatement,
|
|
72521
|
+
exportDefaultStatement,
|
|
72522
|
+
exportStarStatement
|
|
72523
|
+
})
|
|
72524
|
+
])
|
|
72525
|
+
)
|
|
72526
|
+
);
|
|
72527
|
+
})
|
|
72528
|
+
);
|
|
72529
|
+
}
|
|
72530
|
+
|
|
72472
72531
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
72473
72532
|
async function injectConfig({
|
|
72474
72533
|
config,
|
|
@@ -72517,61 +72576,14 @@ ${exportStatement("config")}
|
|
|
72517
72576
|
},
|
|
72518
72577
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
72519
72578
|
}),
|
|
72520
|
-
|
|
72579
|
+
generatePluginRuntimes({
|
|
72580
|
+
config,
|
|
72581
|
+
docs
|
|
72582
|
+
}),
|
|
72521
72583
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
72522
72584
|
]);
|
|
72523
72585
|
await generateGraphqlReturnTypes(config, docs);
|
|
72524
72586
|
}
|
|
72525
|
-
async function generatePluginRuntimes({ config }) {
|
|
72526
|
-
await Promise.all(
|
|
72527
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72528
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
72529
|
-
return;
|
|
72530
|
-
}
|
|
72531
|
-
const runtime_path = path_exports.join(
|
|
72532
|
-
path_exports.dirname(plugin2.filepath),
|
|
72533
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
|
|
72534
|
-
);
|
|
72535
|
-
try {
|
|
72536
|
-
await fs_exports.stat(runtime_path);
|
|
72537
|
-
} catch {
|
|
72538
|
-
throw new HoudiniError({
|
|
72539
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
72540
|
-
description: "Maybe it was bundled?"
|
|
72541
|
-
});
|
|
72542
|
-
}
|
|
72543
|
-
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
72544
|
-
await fs_exports.mkdirp(pluginDir);
|
|
72545
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
72546
|
-
})
|
|
72547
|
-
);
|
|
72548
|
-
}
|
|
72549
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
72550
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
72551
|
-
await Promise.all(
|
|
72552
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
72553
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
72554
|
-
if (transformMap && typeof transformMap === "function") {
|
|
72555
|
-
transformMap = transformMap(docs, { config });
|
|
72556
|
-
}
|
|
72557
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
72558
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
72559
|
-
const content = await fs_exports.readFile(targetPath);
|
|
72560
|
-
if (!content) {
|
|
72561
|
-
return;
|
|
72562
|
-
}
|
|
72563
|
-
const transformed = transform({
|
|
72564
|
-
config,
|
|
72565
|
-
content,
|
|
72566
|
-
importStatement,
|
|
72567
|
-
exportDefaultStatement,
|
|
72568
|
-
exportStarStatement
|
|
72569
|
-
});
|
|
72570
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
72571
|
-
}
|
|
72572
|
-
})
|
|
72573
|
-
);
|
|
72574
|
-
}
|
|
72575
72587
|
function moduleStatments(config) {
|
|
72576
72588
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
72577
72589
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -77201,7 +77213,6 @@ async function componentFields2(config, docs) {
|
|
|
77201
77213
|
|
|
77202
77214
|
// src/codegen/index.ts
|
|
77203
77215
|
async function compile(config) {
|
|
77204
|
-
await generatePluginRuntimes({ config });
|
|
77205
77216
|
const documents = await collectDocuments(config);
|
|
77206
77217
|
await runPipeline2(config, documents);
|
|
77207
77218
|
}
|
|
@@ -78512,12 +78523,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
78512
78523
|
}
|
|
78513
78524
|
packageJSON2.devDependencies = {
|
|
78514
78525
|
...packageJSON2.devDependencies,
|
|
78515
|
-
houdini: "^1.2.
|
|
78526
|
+
houdini: "^1.2.33"
|
|
78516
78527
|
};
|
|
78517
78528
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
78518
78529
|
packageJSON2.devDependencies = {
|
|
78519
78530
|
...packageJSON2.devDependencies,
|
|
78520
|
-
"houdini-svelte": "^1.2.
|
|
78531
|
+
"houdini-svelte": "^1.2.33"
|
|
78521
78532
|
};
|
|
78522
78533
|
} else {
|
|
78523
78534
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { exportDefault, exportStarFrom, importDefaultFrom } from '../../../codegen/utils';
|
|
1
2
|
import type { Config, Document } from '../../../lib';
|
|
2
3
|
export default function runtimeGenerator(config: Config, docs: Document[]): Promise<void>;
|
|
3
|
-
export declare function
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export declare function moduleStatments(config: Config): {
|
|
5
|
+
importStatement: typeof importDefaultFrom;
|
|
6
|
+
exportDefaultStatement: typeof exportDefault;
|
|
7
|
+
exportStarStatement: typeof exportStarFrom;
|
|
8
|
+
};
|
|
@@ -60863,6 +60863,55 @@ async function generatePluginIndex({
|
|
|
60863
60863
|
]);
|
|
60864
60864
|
}
|
|
60865
60865
|
|
|
60866
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
60867
|
+
async function generatePluginRuntimes({
|
|
60868
|
+
config,
|
|
60869
|
+
docs
|
|
60870
|
+
}) {
|
|
60871
|
+
if (houdini_mode.is_testing) {
|
|
60872
|
+
return;
|
|
60873
|
+
}
|
|
60874
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
60875
|
+
await Promise.all(
|
|
60876
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60877
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
60878
|
+
if (!runtime_path) {
|
|
60879
|
+
return;
|
|
60880
|
+
}
|
|
60881
|
+
try {
|
|
60882
|
+
await fs_exports.stat(runtime_path);
|
|
60883
|
+
} catch {
|
|
60884
|
+
throw new HoudiniError({
|
|
60885
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
60886
|
+
description: "Maybe it was bundled?"
|
|
60887
|
+
});
|
|
60888
|
+
}
|
|
60889
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
60890
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
60891
|
+
if (transformMap && typeof transformMap === "function") {
|
|
60892
|
+
transformMap = transformMap(docs, { config });
|
|
60893
|
+
}
|
|
60894
|
+
await fs_exports.mkdirp(pluginDir);
|
|
60895
|
+
await fs_exports.recursiveCopy(
|
|
60896
|
+
runtime_path,
|
|
60897
|
+
pluginDir,
|
|
60898
|
+
Object.fromEntries(
|
|
60899
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
60900
|
+
path_exports.join(runtime_path, key),
|
|
60901
|
+
(content) => value({
|
|
60902
|
+
config,
|
|
60903
|
+
content,
|
|
60904
|
+
importStatement,
|
|
60905
|
+
exportDefaultStatement,
|
|
60906
|
+
exportStarStatement
|
|
60907
|
+
})
|
|
60908
|
+
])
|
|
60909
|
+
)
|
|
60910
|
+
);
|
|
60911
|
+
})
|
|
60912
|
+
);
|
|
60913
|
+
}
|
|
60914
|
+
|
|
60866
60915
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
60867
60916
|
async function injectConfig({
|
|
60868
60917
|
config,
|
|
@@ -60911,61 +60960,14 @@ ${exportStatement("config")}
|
|
|
60911
60960
|
},
|
|
60912
60961
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
60913
60962
|
}),
|
|
60914
|
-
|
|
60963
|
+
generatePluginRuntimes({
|
|
60964
|
+
config,
|
|
60965
|
+
docs
|
|
60966
|
+
}),
|
|
60915
60967
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
60916
60968
|
]);
|
|
60917
60969
|
await generateGraphqlReturnTypes(config, docs);
|
|
60918
60970
|
}
|
|
60919
|
-
async function generatePluginRuntimes({ config }) {
|
|
60920
|
-
await Promise.all(
|
|
60921
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60922
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
60923
|
-
return;
|
|
60924
|
-
}
|
|
60925
|
-
const runtime_path = path_exports.join(
|
|
60926
|
-
path_exports.dirname(plugin2.filepath),
|
|
60927
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
|
|
60928
|
-
);
|
|
60929
|
-
try {
|
|
60930
|
-
await fs_exports.stat(runtime_path);
|
|
60931
|
-
} catch {
|
|
60932
|
-
throw new HoudiniError({
|
|
60933
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
60934
|
-
description: "Maybe it was bundled?"
|
|
60935
|
-
});
|
|
60936
|
-
}
|
|
60937
|
-
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
60938
|
-
await fs_exports.mkdirp(pluginDir);
|
|
60939
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
60940
|
-
})
|
|
60941
|
-
);
|
|
60942
|
-
}
|
|
60943
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
60944
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
60945
|
-
await Promise.all(
|
|
60946
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60947
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
60948
|
-
if (transformMap && typeof transformMap === "function") {
|
|
60949
|
-
transformMap = transformMap(docs, { config });
|
|
60950
|
-
}
|
|
60951
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
60952
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
60953
|
-
const content = await fs_exports.readFile(targetPath);
|
|
60954
|
-
if (!content) {
|
|
60955
|
-
return;
|
|
60956
|
-
}
|
|
60957
|
-
const transformed = transform({
|
|
60958
|
-
config,
|
|
60959
|
-
content,
|
|
60960
|
-
importStatement,
|
|
60961
|
-
exportDefaultStatement,
|
|
60962
|
-
exportStarStatement
|
|
60963
|
-
});
|
|
60964
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
60965
|
-
}
|
|
60966
|
-
})
|
|
60967
|
-
);
|
|
60968
|
-
}
|
|
60969
60971
|
function moduleStatments(config) {
|
|
60970
60972
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
60971
60973
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -65595,7 +65597,6 @@ async function componentFields2(config, docs) {
|
|
|
65595
65597
|
|
|
65596
65598
|
// src/codegen/index.ts
|
|
65597
65599
|
async function compile(config) {
|
|
65598
|
-
await generatePluginRuntimes({ config });
|
|
65599
65600
|
const documents = await collectDocuments(config);
|
|
65600
65601
|
await runPipeline2(config, documents);
|
|
65601
65602
|
}
|
|
@@ -60862,6 +60862,55 @@ async function generatePluginIndex({
|
|
|
60862
60862
|
]);
|
|
60863
60863
|
}
|
|
60864
60864
|
|
|
60865
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
60866
|
+
async function generatePluginRuntimes({
|
|
60867
|
+
config,
|
|
60868
|
+
docs
|
|
60869
|
+
}) {
|
|
60870
|
+
if (houdini_mode.is_testing) {
|
|
60871
|
+
return;
|
|
60872
|
+
}
|
|
60873
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
60874
|
+
await Promise.all(
|
|
60875
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60876
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
60877
|
+
if (!runtime_path) {
|
|
60878
|
+
return;
|
|
60879
|
+
}
|
|
60880
|
+
try {
|
|
60881
|
+
await fs_exports.stat(runtime_path);
|
|
60882
|
+
} catch {
|
|
60883
|
+
throw new HoudiniError({
|
|
60884
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
60885
|
+
description: "Maybe it was bundled?"
|
|
60886
|
+
});
|
|
60887
|
+
}
|
|
60888
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
60889
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
60890
|
+
if (transformMap && typeof transformMap === "function") {
|
|
60891
|
+
transformMap = transformMap(docs, { config });
|
|
60892
|
+
}
|
|
60893
|
+
await fs_exports.mkdirp(pluginDir);
|
|
60894
|
+
await fs_exports.recursiveCopy(
|
|
60895
|
+
runtime_path,
|
|
60896
|
+
pluginDir,
|
|
60897
|
+
Object.fromEntries(
|
|
60898
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
60899
|
+
path_exports.join(runtime_path, key),
|
|
60900
|
+
(content) => value({
|
|
60901
|
+
config,
|
|
60902
|
+
content,
|
|
60903
|
+
importStatement,
|
|
60904
|
+
exportDefaultStatement,
|
|
60905
|
+
exportStarStatement
|
|
60906
|
+
})
|
|
60907
|
+
])
|
|
60908
|
+
)
|
|
60909
|
+
);
|
|
60910
|
+
})
|
|
60911
|
+
);
|
|
60912
|
+
}
|
|
60913
|
+
|
|
60865
60914
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
60866
60915
|
async function injectConfig({
|
|
60867
60916
|
config,
|
|
@@ -60910,61 +60959,14 @@ ${exportStatement("config")}
|
|
|
60910
60959
|
},
|
|
60911
60960
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
60912
60961
|
}),
|
|
60913
|
-
|
|
60962
|
+
generatePluginRuntimes({
|
|
60963
|
+
config,
|
|
60964
|
+
docs
|
|
60965
|
+
}),
|
|
60914
60966
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
60915
60967
|
]);
|
|
60916
60968
|
await generateGraphqlReturnTypes(config, docs);
|
|
60917
60969
|
}
|
|
60918
|
-
async function generatePluginRuntimes({ config }) {
|
|
60919
|
-
await Promise.all(
|
|
60920
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60921
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
60922
|
-
return;
|
|
60923
|
-
}
|
|
60924
|
-
const runtime_path = path_exports.join(
|
|
60925
|
-
path_exports.dirname(plugin2.filepath),
|
|
60926
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
|
|
60927
|
-
);
|
|
60928
|
-
try {
|
|
60929
|
-
await fs_exports.stat(runtime_path);
|
|
60930
|
-
} catch {
|
|
60931
|
-
throw new HoudiniError({
|
|
60932
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
60933
|
-
description: "Maybe it was bundled?"
|
|
60934
|
-
});
|
|
60935
|
-
}
|
|
60936
|
-
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
60937
|
-
await fs_exports.mkdirp(pluginDir);
|
|
60938
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
60939
|
-
})
|
|
60940
|
-
);
|
|
60941
|
-
}
|
|
60942
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
60943
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
60944
|
-
await Promise.all(
|
|
60945
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
60946
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
60947
|
-
if (transformMap && typeof transformMap === "function") {
|
|
60948
|
-
transformMap = transformMap(docs, { config });
|
|
60949
|
-
}
|
|
60950
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
60951
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
60952
|
-
const content = await fs_exports.readFile(targetPath);
|
|
60953
|
-
if (!content) {
|
|
60954
|
-
return;
|
|
60955
|
-
}
|
|
60956
|
-
const transformed = transform({
|
|
60957
|
-
config,
|
|
60958
|
-
content,
|
|
60959
|
-
importStatement,
|
|
60960
|
-
exportDefaultStatement,
|
|
60961
|
-
exportStarStatement
|
|
60962
|
-
});
|
|
60963
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
60964
|
-
}
|
|
60965
|
-
})
|
|
60966
|
-
);
|
|
60967
|
-
}
|
|
60968
60970
|
function moduleStatments(config) {
|
|
60969
60971
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
60970
60972
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -65594,7 +65596,6 @@ async function componentFields2(config, docs) {
|
|
|
65594
65596
|
|
|
65595
65597
|
// src/codegen/index.ts
|
|
65596
65598
|
async function compile(config) {
|
|
65597
|
-
await generatePluginRuntimes({ config });
|
|
65598
65599
|
const documents = await collectDocuments(config);
|
|
65599
65600
|
await runPipeline2(config, documents);
|
|
65600
65601
|
}
|
package/build/lib/config.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export declare class Config {
|
|
|
53
53
|
getEnv(): Promise<Record<string, string | undefined>>;
|
|
54
54
|
processEnvValues(env: Record<string, string | undefined>, value: string | ((env: any) => string)): string | undefined;
|
|
55
55
|
pullHeaders(): Promise<any>;
|
|
56
|
+
pluginRuntimeSource(plugin: PluginMeta): string | null;
|
|
56
57
|
sourceFiles(): Promise<string[]>;
|
|
57
58
|
get componentScalar(): string;
|
|
58
59
|
schemaString: string;
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -67171,10 +67171,11 @@ var Config = class {
|
|
|
67171
67171
|
);
|
|
67172
67172
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
67173
67173
|
for (const plugin2 of this.plugins) {
|
|
67174
|
-
|
|
67174
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
67175
|
+
if (!runtimeDir) {
|
|
67175
67176
|
continue;
|
|
67176
67177
|
}
|
|
67177
|
-
const includePath = relative(this.projectRoot,
|
|
67178
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
67178
67179
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
67179
67180
|
}
|
|
67180
67181
|
return include;
|
|
@@ -67220,6 +67221,15 @@ var Config = class {
|
|
|
67220
67221
|
);
|
|
67221
67222
|
return headers;
|
|
67222
67223
|
}
|
|
67224
|
+
pluginRuntimeSource(plugin2) {
|
|
67225
|
+
if (!plugin2.includeRuntime) {
|
|
67226
|
+
return null;
|
|
67227
|
+
}
|
|
67228
|
+
return join2(
|
|
67229
|
+
dirname(plugin2.filepath),
|
|
67230
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
67231
|
+
);
|
|
67232
|
+
}
|
|
67223
67233
|
async sourceFiles() {
|
|
67224
67234
|
return [
|
|
67225
67235
|
...new Set(
|
package/build/lib-esm/index.js
CHANGED
|
@@ -67092,10 +67092,11 @@ var Config = class {
|
|
|
67092
67092
|
);
|
|
67093
67093
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
67094
67094
|
for (const plugin2 of this.plugins) {
|
|
67095
|
-
|
|
67095
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
67096
|
+
if (!runtimeDir) {
|
|
67096
67097
|
continue;
|
|
67097
67098
|
}
|
|
67098
|
-
const includePath = relative(this.projectRoot,
|
|
67099
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
67099
67100
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
67100
67101
|
}
|
|
67101
67102
|
return include;
|
|
@@ -67141,6 +67142,15 @@ var Config = class {
|
|
|
67141
67142
|
);
|
|
67142
67143
|
return headers;
|
|
67143
67144
|
}
|
|
67145
|
+
pluginRuntimeSource(plugin2) {
|
|
67146
|
+
if (!plugin2.includeRuntime) {
|
|
67147
|
+
return null;
|
|
67148
|
+
}
|
|
67149
|
+
return join2(
|
|
67150
|
+
dirname(plugin2.filepath),
|
|
67151
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
67152
|
+
);
|
|
67153
|
+
}
|
|
67144
67154
|
async sourceFiles() {
|
|
67145
67155
|
return [
|
|
67146
67156
|
...new Set(
|
package/build/test-cjs/index.js
CHANGED
|
@@ -57399,10 +57399,11 @@ var Config = class {
|
|
|
57399
57399
|
);
|
|
57400
57400
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
57401
57401
|
for (const plugin2 of this.plugins) {
|
|
57402
|
-
|
|
57402
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
57403
|
+
if (!runtimeDir) {
|
|
57403
57404
|
continue;
|
|
57404
57405
|
}
|
|
57405
|
-
const includePath = relative(this.projectRoot,
|
|
57406
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
57406
57407
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
57407
57408
|
}
|
|
57408
57409
|
return include;
|
|
@@ -57448,6 +57449,15 @@ var Config = class {
|
|
|
57448
57449
|
);
|
|
57449
57450
|
return headers;
|
|
57450
57451
|
}
|
|
57452
|
+
pluginRuntimeSource(plugin2) {
|
|
57453
|
+
if (!plugin2.includeRuntime) {
|
|
57454
|
+
return null;
|
|
57455
|
+
}
|
|
57456
|
+
return join(
|
|
57457
|
+
dirname(plugin2.filepath),
|
|
57458
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
57459
|
+
);
|
|
57460
|
+
}
|
|
57451
57461
|
async sourceFiles() {
|
|
57452
57462
|
return [
|
|
57453
57463
|
...new Set(
|
|
@@ -61207,6 +61217,55 @@ async function generatePluginIndex({
|
|
|
61207
61217
|
]);
|
|
61208
61218
|
}
|
|
61209
61219
|
|
|
61220
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
61221
|
+
async function generatePluginRuntimes({
|
|
61222
|
+
config,
|
|
61223
|
+
docs
|
|
61224
|
+
}) {
|
|
61225
|
+
if (houdini_mode.is_testing) {
|
|
61226
|
+
return;
|
|
61227
|
+
}
|
|
61228
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
61229
|
+
await Promise.all(
|
|
61230
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
61231
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
61232
|
+
if (!runtime_path) {
|
|
61233
|
+
return;
|
|
61234
|
+
}
|
|
61235
|
+
try {
|
|
61236
|
+
await fs_exports.stat(runtime_path);
|
|
61237
|
+
} catch {
|
|
61238
|
+
throw new HoudiniError({
|
|
61239
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
61240
|
+
description: "Maybe it was bundled?"
|
|
61241
|
+
});
|
|
61242
|
+
}
|
|
61243
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
61244
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
61245
|
+
if (transformMap && typeof transformMap === "function") {
|
|
61246
|
+
transformMap = transformMap(docs, { config });
|
|
61247
|
+
}
|
|
61248
|
+
await fs_exports.mkdirp(pluginDir);
|
|
61249
|
+
await fs_exports.recursiveCopy(
|
|
61250
|
+
runtime_path,
|
|
61251
|
+
pluginDir,
|
|
61252
|
+
Object.fromEntries(
|
|
61253
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
61254
|
+
path_exports.join(runtime_path, key),
|
|
61255
|
+
(content) => value({
|
|
61256
|
+
config,
|
|
61257
|
+
content,
|
|
61258
|
+
importStatement,
|
|
61259
|
+
exportDefaultStatement,
|
|
61260
|
+
exportStarStatement
|
|
61261
|
+
})
|
|
61262
|
+
])
|
|
61263
|
+
)
|
|
61264
|
+
);
|
|
61265
|
+
})
|
|
61266
|
+
);
|
|
61267
|
+
}
|
|
61268
|
+
|
|
61210
61269
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
61211
61270
|
async function injectConfig({
|
|
61212
61271
|
config,
|
|
@@ -61255,37 +61314,14 @@ ${exportStatement("config")}
|
|
|
61255
61314
|
},
|
|
61256
61315
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
61257
61316
|
}),
|
|
61258
|
-
|
|
61317
|
+
generatePluginRuntimes({
|
|
61318
|
+
config,
|
|
61319
|
+
docs
|
|
61320
|
+
}),
|
|
61259
61321
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
61260
61322
|
]);
|
|
61261
61323
|
await generateGraphqlReturnTypes(config, docs);
|
|
61262
61324
|
}
|
|
61263
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
61264
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
61265
|
-
await Promise.all(
|
|
61266
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
61267
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
61268
|
-
if (transformMap && typeof transformMap === "function") {
|
|
61269
|
-
transformMap = transformMap(docs, { config });
|
|
61270
|
-
}
|
|
61271
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
61272
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
61273
|
-
const content = await fs_exports.readFile(targetPath);
|
|
61274
|
-
if (!content) {
|
|
61275
|
-
return;
|
|
61276
|
-
}
|
|
61277
|
-
const transformed = transform({
|
|
61278
|
-
config,
|
|
61279
|
-
content,
|
|
61280
|
-
importStatement,
|
|
61281
|
-
exportDefaultStatement,
|
|
61282
|
-
exportStarStatement
|
|
61283
|
-
});
|
|
61284
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
61285
|
-
}
|
|
61286
|
-
})
|
|
61287
|
-
);
|
|
61288
|
-
}
|
|
61289
61325
|
function moduleStatments(config) {
|
|
61290
61326
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
61291
61327
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
package/build/test-esm/index.js
CHANGED
|
@@ -57395,10 +57395,11 @@ var Config = class {
|
|
|
57395
57395
|
);
|
|
57396
57396
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
57397
57397
|
for (const plugin2 of this.plugins) {
|
|
57398
|
-
|
|
57398
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
57399
|
+
if (!runtimeDir) {
|
|
57399
57400
|
continue;
|
|
57400
57401
|
}
|
|
57401
|
-
const includePath = relative(this.projectRoot,
|
|
57402
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
57402
57403
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
57403
57404
|
}
|
|
57404
57405
|
return include;
|
|
@@ -57444,6 +57445,15 @@ var Config = class {
|
|
|
57444
57445
|
);
|
|
57445
57446
|
return headers;
|
|
57446
57447
|
}
|
|
57448
|
+
pluginRuntimeSource(plugin2) {
|
|
57449
|
+
if (!plugin2.includeRuntime) {
|
|
57450
|
+
return null;
|
|
57451
|
+
}
|
|
57452
|
+
return join(
|
|
57453
|
+
dirname(plugin2.filepath),
|
|
57454
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
57455
|
+
);
|
|
57456
|
+
}
|
|
57447
57457
|
async sourceFiles() {
|
|
57448
57458
|
return [
|
|
57449
57459
|
...new Set(
|
|
@@ -61203,6 +61213,55 @@ async function generatePluginIndex({
|
|
|
61203
61213
|
]);
|
|
61204
61214
|
}
|
|
61205
61215
|
|
|
61216
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
61217
|
+
async function generatePluginRuntimes({
|
|
61218
|
+
config,
|
|
61219
|
+
docs
|
|
61220
|
+
}) {
|
|
61221
|
+
if (houdini_mode.is_testing) {
|
|
61222
|
+
return;
|
|
61223
|
+
}
|
|
61224
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
61225
|
+
await Promise.all(
|
|
61226
|
+
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
61227
|
+
const runtime_path = config.pluginRuntimeSource(plugin2);
|
|
61228
|
+
if (!runtime_path) {
|
|
61229
|
+
return;
|
|
61230
|
+
}
|
|
61231
|
+
try {
|
|
61232
|
+
await fs_exports.stat(runtime_path);
|
|
61233
|
+
} catch {
|
|
61234
|
+
throw new HoudiniError({
|
|
61235
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
61236
|
+
description: "Maybe it was bundled?"
|
|
61237
|
+
});
|
|
61238
|
+
}
|
|
61239
|
+
const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
|
|
61240
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
61241
|
+
if (transformMap && typeof transformMap === "function") {
|
|
61242
|
+
transformMap = transformMap(docs, { config });
|
|
61243
|
+
}
|
|
61244
|
+
await fs_exports.mkdirp(pluginDir);
|
|
61245
|
+
await fs_exports.recursiveCopy(
|
|
61246
|
+
runtime_path,
|
|
61247
|
+
pluginDir,
|
|
61248
|
+
Object.fromEntries(
|
|
61249
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
61250
|
+
path_exports.join(runtime_path, key),
|
|
61251
|
+
(content) => value({
|
|
61252
|
+
config,
|
|
61253
|
+
content,
|
|
61254
|
+
importStatement,
|
|
61255
|
+
exportDefaultStatement,
|
|
61256
|
+
exportStarStatement
|
|
61257
|
+
})
|
|
61258
|
+
])
|
|
61259
|
+
)
|
|
61260
|
+
);
|
|
61261
|
+
})
|
|
61262
|
+
);
|
|
61263
|
+
}
|
|
61264
|
+
|
|
61206
61265
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
61207
61266
|
async function injectConfig({
|
|
61208
61267
|
config,
|
|
@@ -61251,37 +61310,14 @@ ${exportStatement("config")}
|
|
|
61251
61310
|
},
|
|
61252
61311
|
[path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
|
|
61253
61312
|
}),
|
|
61254
|
-
|
|
61313
|
+
generatePluginRuntimes({
|
|
61314
|
+
config,
|
|
61315
|
+
docs
|
|
61316
|
+
}),
|
|
61255
61317
|
generatePluginIndex({ config, exportStatement: exportStar })
|
|
61256
61318
|
]);
|
|
61257
61319
|
await generateGraphqlReturnTypes(config, docs);
|
|
61258
61320
|
}
|
|
61259
|
-
async function transformPluginRuntimes({ config, docs }) {
|
|
61260
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config);
|
|
61261
|
-
await Promise.all(
|
|
61262
|
-
config.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
61263
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
61264
|
-
if (transformMap && typeof transformMap === "function") {
|
|
61265
|
-
transformMap = transformMap(docs, { config });
|
|
61266
|
-
}
|
|
61267
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
61268
|
-
const targetPath = path_exports.join(config.pluginRuntimeDirectory(plugin2.name), target);
|
|
61269
|
-
const content = await fs_exports.readFile(targetPath);
|
|
61270
|
-
if (!content) {
|
|
61271
|
-
return;
|
|
61272
|
-
}
|
|
61273
|
-
const transformed = transform({
|
|
61274
|
-
config,
|
|
61275
|
-
content,
|
|
61276
|
-
importStatement,
|
|
61277
|
-
exportDefaultStatement,
|
|
61278
|
-
exportStarStatement
|
|
61279
|
-
});
|
|
61280
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
61281
|
-
}
|
|
61282
|
-
})
|
|
61283
|
-
);
|
|
61284
|
-
}
|
|
61285
61321
|
function moduleStatments(config) {
|
|
61286
61322
|
const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
61287
61323
|
const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -69155,10 +69155,11 @@ var Config = class {
|
|
|
69155
69155
|
);
|
|
69156
69156
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
69157
69157
|
for (const plugin2 of this.plugins) {
|
|
69158
|
-
|
|
69158
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
69159
|
+
if (!runtimeDir) {
|
|
69159
69160
|
continue;
|
|
69160
69161
|
}
|
|
69161
|
-
const includePath = relative(this.projectRoot,
|
|
69162
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
69162
69163
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
69163
69164
|
}
|
|
69164
69165
|
return include;
|
|
@@ -69204,6 +69205,15 @@ var Config = class {
|
|
|
69204
69205
|
);
|
|
69205
69206
|
return headers;
|
|
69206
69207
|
}
|
|
69208
|
+
pluginRuntimeSource(plugin2) {
|
|
69209
|
+
if (!plugin2.includeRuntime) {
|
|
69210
|
+
return null;
|
|
69211
|
+
}
|
|
69212
|
+
return join2(
|
|
69213
|
+
dirname(plugin2.filepath),
|
|
69214
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
69215
|
+
);
|
|
69216
|
+
}
|
|
69207
69217
|
async sourceFiles() {
|
|
69208
69218
|
return [
|
|
69209
69219
|
...new Set(
|
|
@@ -73898,6 +73908,55 @@ async function generatePluginIndex({
|
|
|
73898
73908
|
]);
|
|
73899
73909
|
}
|
|
73900
73910
|
|
|
73911
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
73912
|
+
async function generatePluginRuntimes({
|
|
73913
|
+
config: config2,
|
|
73914
|
+
docs
|
|
73915
|
+
}) {
|
|
73916
|
+
if (houdini_mode.is_testing) {
|
|
73917
|
+
return;
|
|
73918
|
+
}
|
|
73919
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
73920
|
+
await Promise.all(
|
|
73921
|
+
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73922
|
+
const runtime_path = config2.pluginRuntimeSource(plugin2);
|
|
73923
|
+
if (!runtime_path) {
|
|
73924
|
+
return;
|
|
73925
|
+
}
|
|
73926
|
+
try {
|
|
73927
|
+
await fs_exports.stat(runtime_path);
|
|
73928
|
+
} catch {
|
|
73929
|
+
throw new HoudiniError({
|
|
73930
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
73931
|
+
description: "Maybe it was bundled?"
|
|
73932
|
+
});
|
|
73933
|
+
}
|
|
73934
|
+
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
73935
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
73936
|
+
if (transformMap && typeof transformMap === "function") {
|
|
73937
|
+
transformMap = transformMap(docs, { config: config2 });
|
|
73938
|
+
}
|
|
73939
|
+
await fs_exports.mkdirp(pluginDir);
|
|
73940
|
+
await fs_exports.recursiveCopy(
|
|
73941
|
+
runtime_path,
|
|
73942
|
+
pluginDir,
|
|
73943
|
+
Object.fromEntries(
|
|
73944
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
73945
|
+
path_exports.join(runtime_path, key),
|
|
73946
|
+
(content) => value({
|
|
73947
|
+
config: config2,
|
|
73948
|
+
content,
|
|
73949
|
+
importStatement,
|
|
73950
|
+
exportDefaultStatement,
|
|
73951
|
+
exportStarStatement
|
|
73952
|
+
})
|
|
73953
|
+
])
|
|
73954
|
+
)
|
|
73955
|
+
);
|
|
73956
|
+
})
|
|
73957
|
+
);
|
|
73958
|
+
}
|
|
73959
|
+
|
|
73901
73960
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
73902
73961
|
async function injectConfig({
|
|
73903
73962
|
config: config2,
|
|
@@ -73946,61 +74005,14 @@ ${exportStatement("config")}
|
|
|
73946
74005
|
},
|
|
73947
74006
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
73948
74007
|
}),
|
|
73949
|
-
|
|
74008
|
+
generatePluginRuntimes({
|
|
74009
|
+
config: config2,
|
|
74010
|
+
docs
|
|
74011
|
+
}),
|
|
73950
74012
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
73951
74013
|
]);
|
|
73952
74014
|
await generateGraphqlReturnTypes(config2, docs);
|
|
73953
74015
|
}
|
|
73954
|
-
async function generatePluginRuntimes({ config: config2 }) {
|
|
73955
|
-
await Promise.all(
|
|
73956
|
-
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73957
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
73958
|
-
return;
|
|
73959
|
-
}
|
|
73960
|
-
const runtime_path = path_exports.join(
|
|
73961
|
-
path_exports.dirname(plugin2.filepath),
|
|
73962
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
|
|
73963
|
-
);
|
|
73964
|
-
try {
|
|
73965
|
-
await fs_exports.stat(runtime_path);
|
|
73966
|
-
} catch {
|
|
73967
|
-
throw new HoudiniError({
|
|
73968
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
73969
|
-
description: "Maybe it was bundled?"
|
|
73970
|
-
});
|
|
73971
|
-
}
|
|
73972
|
-
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
73973
|
-
await fs_exports.mkdirp(pluginDir);
|
|
73974
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
73975
|
-
})
|
|
73976
|
-
);
|
|
73977
|
-
}
|
|
73978
|
-
async function transformPluginRuntimes({ config: config2, docs }) {
|
|
73979
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
73980
|
-
await Promise.all(
|
|
73981
|
-
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73982
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
73983
|
-
if (transformMap && typeof transformMap === "function") {
|
|
73984
|
-
transformMap = transformMap(docs, { config: config2 });
|
|
73985
|
-
}
|
|
73986
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
73987
|
-
const targetPath = path_exports.join(config2.pluginRuntimeDirectory(plugin2.name), target);
|
|
73988
|
-
const content = await fs_exports.readFile(targetPath);
|
|
73989
|
-
if (!content) {
|
|
73990
|
-
return;
|
|
73991
|
-
}
|
|
73992
|
-
const transformed = transform({
|
|
73993
|
-
config: config2,
|
|
73994
|
-
content,
|
|
73995
|
-
importStatement,
|
|
73996
|
-
exportDefaultStatement,
|
|
73997
|
-
exportStarStatement
|
|
73998
|
-
});
|
|
73999
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
74000
|
-
}
|
|
74001
|
-
})
|
|
74002
|
-
);
|
|
74003
|
-
}
|
|
74004
74016
|
function moduleStatments(config2) {
|
|
74005
74017
|
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
74006
74018
|
const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -78630,7 +78642,6 @@ async function componentFields2(config2, docs) {
|
|
|
78630
78642
|
|
|
78631
78643
|
// src/codegen/index.ts
|
|
78632
78644
|
async function compile(config2) {
|
|
78633
|
-
await generatePluginRuntimes({ config: config2 });
|
|
78634
78645
|
const documents = await collectDocuments(config2);
|
|
78635
78646
|
await runPipeline2(config2, documents);
|
|
78636
78647
|
}
|
package/build/vite-esm/index.js
CHANGED
|
@@ -69148,10 +69148,11 @@ var Config = class {
|
|
|
69148
69148
|
);
|
|
69149
69149
|
const include = [`src/**/*{${extensions.join(",")}}`];
|
|
69150
69150
|
for (const plugin2 of this.plugins) {
|
|
69151
|
-
|
|
69151
|
+
const runtimeDir = this.pluginRuntimeSource(plugin2);
|
|
69152
|
+
if (!runtimeDir) {
|
|
69152
69153
|
continue;
|
|
69153
69154
|
}
|
|
69154
|
-
const includePath = relative(this.projectRoot,
|
|
69155
|
+
const includePath = relative(this.projectRoot, runtimeDir);
|
|
69155
69156
|
include.push(`${includePath}/**/*{${extensions.join(",")}}`);
|
|
69156
69157
|
}
|
|
69157
69158
|
return include;
|
|
@@ -69197,6 +69198,15 @@ var Config = class {
|
|
|
69197
69198
|
);
|
|
69198
69199
|
return headers;
|
|
69199
69200
|
}
|
|
69201
|
+
pluginRuntimeSource(plugin2) {
|
|
69202
|
+
if (!plugin2.includeRuntime) {
|
|
69203
|
+
return null;
|
|
69204
|
+
}
|
|
69205
|
+
return join2(
|
|
69206
|
+
dirname(plugin2.filepath),
|
|
69207
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
|
|
69208
|
+
);
|
|
69209
|
+
}
|
|
69200
69210
|
async sourceFiles() {
|
|
69201
69211
|
return [
|
|
69202
69212
|
...new Set(
|
|
@@ -73891,6 +73901,55 @@ async function generatePluginIndex({
|
|
|
73891
73901
|
]);
|
|
73892
73902
|
}
|
|
73893
73903
|
|
|
73904
|
+
// src/codegen/generators/runtime/pluginRuntime.ts
|
|
73905
|
+
async function generatePluginRuntimes({
|
|
73906
|
+
config: config2,
|
|
73907
|
+
docs
|
|
73908
|
+
}) {
|
|
73909
|
+
if (houdini_mode.is_testing) {
|
|
73910
|
+
return;
|
|
73911
|
+
}
|
|
73912
|
+
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
73913
|
+
await Promise.all(
|
|
73914
|
+
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73915
|
+
const runtime_path = config2.pluginRuntimeSource(plugin2);
|
|
73916
|
+
if (!runtime_path) {
|
|
73917
|
+
return;
|
|
73918
|
+
}
|
|
73919
|
+
try {
|
|
73920
|
+
await fs_exports.stat(runtime_path);
|
|
73921
|
+
} catch {
|
|
73922
|
+
throw new HoudiniError({
|
|
73923
|
+
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
73924
|
+
description: "Maybe it was bundled?"
|
|
73925
|
+
});
|
|
73926
|
+
}
|
|
73927
|
+
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
73928
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
73929
|
+
if (transformMap && typeof transformMap === "function") {
|
|
73930
|
+
transformMap = transformMap(docs, { config: config2 });
|
|
73931
|
+
}
|
|
73932
|
+
await fs_exports.mkdirp(pluginDir);
|
|
73933
|
+
await fs_exports.recursiveCopy(
|
|
73934
|
+
runtime_path,
|
|
73935
|
+
pluginDir,
|
|
73936
|
+
Object.fromEntries(
|
|
73937
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
73938
|
+
path_exports.join(runtime_path, key),
|
|
73939
|
+
(content) => value({
|
|
73940
|
+
config: config2,
|
|
73941
|
+
content,
|
|
73942
|
+
importStatement,
|
|
73943
|
+
exportDefaultStatement,
|
|
73944
|
+
exportStarStatement
|
|
73945
|
+
})
|
|
73946
|
+
])
|
|
73947
|
+
)
|
|
73948
|
+
);
|
|
73949
|
+
})
|
|
73950
|
+
);
|
|
73951
|
+
}
|
|
73952
|
+
|
|
73894
73953
|
// src/codegen/generators/runtime/runtimeConfig.ts
|
|
73895
73954
|
async function injectConfig({
|
|
73896
73955
|
config: config2,
|
|
@@ -73939,61 +73998,14 @@ ${exportStatement("config")}
|
|
|
73939
73998
|
},
|
|
73940
73999
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
73941
74000
|
}),
|
|
73942
|
-
|
|
74001
|
+
generatePluginRuntimes({
|
|
74002
|
+
config: config2,
|
|
74003
|
+
docs
|
|
74004
|
+
}),
|
|
73943
74005
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
73944
74006
|
]);
|
|
73945
74007
|
await generateGraphqlReturnTypes(config2, docs);
|
|
73946
74008
|
}
|
|
73947
|
-
async function generatePluginRuntimes({ config: config2 }) {
|
|
73948
|
-
await Promise.all(
|
|
73949
|
-
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73950
|
-
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
73951
|
-
return;
|
|
73952
|
-
}
|
|
73953
|
-
const runtime_path = path_exports.join(
|
|
73954
|
-
path_exports.dirname(plugin2.filepath),
|
|
73955
|
-
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
|
|
73956
|
-
);
|
|
73957
|
-
try {
|
|
73958
|
-
await fs_exports.stat(runtime_path);
|
|
73959
|
-
} catch {
|
|
73960
|
-
throw new HoudiniError({
|
|
73961
|
-
message: "Cannot find runtime to generate for " + plugin2.name,
|
|
73962
|
-
description: "Maybe it was bundled?"
|
|
73963
|
-
});
|
|
73964
|
-
}
|
|
73965
|
-
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
73966
|
-
await fs_exports.mkdirp(pluginDir);
|
|
73967
|
-
await fs_exports.recursiveCopy(runtime_path, pluginDir);
|
|
73968
|
-
})
|
|
73969
|
-
);
|
|
73970
|
-
}
|
|
73971
|
-
async function transformPluginRuntimes({ config: config2, docs }) {
|
|
73972
|
-
const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
|
|
73973
|
-
await Promise.all(
|
|
73974
|
-
config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
|
|
73975
|
-
let transformMap = plugin2.transformRuntime ?? {};
|
|
73976
|
-
if (transformMap && typeof transformMap === "function") {
|
|
73977
|
-
transformMap = transformMap(docs, { config: config2 });
|
|
73978
|
-
}
|
|
73979
|
-
for (const [target, transform] of Object.entries(transformMap)) {
|
|
73980
|
-
const targetPath = path_exports.join(config2.pluginRuntimeDirectory(plugin2.name), target);
|
|
73981
|
-
const content = await fs_exports.readFile(targetPath);
|
|
73982
|
-
if (!content) {
|
|
73983
|
-
return;
|
|
73984
|
-
}
|
|
73985
|
-
const transformed = transform({
|
|
73986
|
-
config: config2,
|
|
73987
|
-
content,
|
|
73988
|
-
importStatement,
|
|
73989
|
-
exportDefaultStatement,
|
|
73990
|
-
exportStarStatement
|
|
73991
|
-
});
|
|
73992
|
-
await fs_exports.writeFile(targetPath, transformed);
|
|
73993
|
-
}
|
|
73994
|
-
})
|
|
73995
|
-
);
|
|
73996
|
-
}
|
|
73997
74009
|
function moduleStatments(config2) {
|
|
73998
74010
|
const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
|
|
73999
74011
|
const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
|
|
@@ -78623,7 +78635,6 @@ async function componentFields2(config2, docs) {
|
|
|
78623
78635
|
|
|
78624
78636
|
// src/codegen/index.ts
|
|
78625
78637
|
async function compile(config2) {
|
|
78626
|
-
await generatePluginRuntimes({ config: config2 });
|
|
78627
78638
|
const documents = await collectDocuments(config2);
|
|
78628
78639
|
await runPipeline2(config2, documents);
|
|
78629
78640
|
}
|