houdini 1.2.31 → 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.
@@ -68013,7 +68013,16 @@ var Config = class {
68013
68013
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
68014
68014
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
68015
68015
  );
68016
- return [`src/**/*{${extensions.join(",")}}`];
68016
+ const include = [`src/**/*{${extensions.join(",")}}`];
68017
+ for (const plugin2 of this.plugins) {
68018
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
68019
+ if (!runtimeDir) {
68020
+ continue;
68021
+ }
68022
+ const includePath = relative(this.projectRoot, runtimeDir);
68023
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
68024
+ }
68025
+ return include;
68017
68026
  }
68018
68027
  pluginConfig(name) {
68019
68028
  return this.configFile.plugins?.[name] ?? {};
@@ -68056,6 +68065,15 @@ var Config = class {
68056
68065
  );
68057
68066
  return headers;
68058
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
+ }
68059
68077
  async sourceFiles() {
68060
68078
  return [
68061
68079
  ...new Set(
@@ -72456,6 +72474,55 @@ async function generatePluginIndex({
72456
72474
  ]);
72457
72475
  }
72458
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
+
72459
72526
  // src/codegen/generators/runtime/runtimeConfig.ts
72460
72527
  async function injectConfig({
72461
72528
  config,
@@ -72482,9 +72549,11 @@ ${exportStatement("plugins")}
72482
72549
 
72483
72550
  // src/codegen/generators/runtime/index.ts
72484
72551
  async function runtimeGenerator(config, docs) {
72485
- const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
72486
- const exportStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
72487
- const exportStar = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
72552
+ const {
72553
+ importStatement,
72554
+ exportDefaultStatement: exportStatement,
72555
+ exportStarStatement: exportStar
72556
+ } = moduleStatments(config);
72488
72557
  await Promise.all([
72489
72558
  fs_exports.recursiveCopy(config.runtimeSource, config.runtimeDirectory, {
72490
72559
  [path_exports.join(config.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -72502,65 +72571,23 @@ ${exportStatement("config")}
72502
72571
  },
72503
72572
  [path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
72504
72573
  }),
72505
- ...config.plugins.filter((plugin2) => plugin2.includeRuntime).map(
72506
- (plugin2) => generatePluginRuntime({
72507
- config,
72508
- docs,
72509
- plugin: plugin2,
72510
- importStatement,
72511
- exportDefaultStatement: exportStatement,
72512
- exportStarStatement: exportStar
72513
- })
72514
- ),
72574
+ generatePluginRuntimes({
72575
+ config,
72576
+ docs
72577
+ }),
72515
72578
  generatePluginIndex({ config, exportStatement: exportStar })
72516
72579
  ]);
72517
72580
  await generateGraphqlReturnTypes(config, docs);
72518
72581
  }
72519
- async function generatePluginRuntime({
72520
- config,
72521
- docs,
72522
- plugin: plugin2,
72523
- importStatement,
72524
- exportDefaultStatement,
72525
- exportStarStatement
72526
- }) {
72527
- if (houdini_mode.is_testing || !plugin2.includeRuntime) {
72528
- return;
72529
- }
72530
- const runtime_path = path_exports.join(
72531
- path_exports.dirname(plugin2.filepath),
72532
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
72533
- );
72534
- try {
72535
- await fs_exports.stat(runtime_path);
72536
- } catch {
72537
- throw new HoudiniError({
72538
- message: "Cannot find runtime to generate for " + plugin2.name,
72539
- description: "Maybe it was bundled?"
72540
- });
72541
- }
72542
- const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
72543
- let transformMap = plugin2.transformRuntime ?? {};
72544
- if (transformMap && typeof transformMap === "function") {
72545
- transformMap = transformMap(docs, { config });
72546
- }
72547
- await fs_exports.mkdirp(pluginDir);
72548
- await fs_exports.recursiveCopy(
72549
- runtime_path,
72550
- pluginDir,
72551
- Object.fromEntries(
72552
- Object.entries(transformMap).map(([key, value]) => [
72553
- path_exports.join(runtime_path, key),
72554
- (content) => value({
72555
- config,
72556
- content,
72557
- importStatement,
72558
- exportDefaultStatement,
72559
- exportStarStatement
72560
- })
72561
- ])
72562
- )
72563
- );
72582
+ function moduleStatments(config) {
72583
+ const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
72584
+ const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
72585
+ const exportStarStatement = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
72586
+ return {
72587
+ importStatement,
72588
+ exportDefaultStatement,
72589
+ exportStarStatement
72590
+ };
72564
72591
  }
72565
72592
 
72566
72593
  // src/codegen/generators/typescript/documentTypes.ts
@@ -78491,12 +78518,12 @@ async function packageJSON(targetPath, frameworkInfo) {
78491
78518
  }
78492
78519
  packageJSON2.devDependencies = {
78493
78520
  ...packageJSON2.devDependencies,
78494
- houdini: "^1.2.31"
78521
+ houdini: "^1.2.33"
78495
78522
  };
78496
78523
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
78497
78524
  packageJSON2.devDependencies = {
78498
78525
  ...packageJSON2.devDependencies,
78499
- "houdini-svelte": "^1.2.31"
78526
+ "houdini-svelte": "^1.2.33"
78500
78527
  };
78501
78528
  } else {
78502
78529
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -68018,7 +68018,16 @@ var Config = class {
68018
68018
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
68019
68019
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
68020
68020
  );
68021
- return [`src/**/*{${extensions.join(",")}}`];
68021
+ const include = [`src/**/*{${extensions.join(",")}}`];
68022
+ for (const plugin2 of this.plugins) {
68023
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
68024
+ if (!runtimeDir) {
68025
+ continue;
68026
+ }
68027
+ const includePath = relative(this.projectRoot, runtimeDir);
68028
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
68029
+ }
68030
+ return include;
68022
68031
  }
68023
68032
  pluginConfig(name) {
68024
68033
  return this.configFile.plugins?.[name] ?? {};
@@ -68061,6 +68070,15 @@ var Config = class {
68061
68070
  );
68062
68071
  return headers;
68063
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
+ }
68064
68082
  async sourceFiles() {
68065
68083
  return [
68066
68084
  ...new Set(
@@ -72461,6 +72479,55 @@ async function generatePluginIndex({
72461
72479
  ]);
72462
72480
  }
72463
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
+
72464
72531
  // src/codegen/generators/runtime/runtimeConfig.ts
72465
72532
  async function injectConfig({
72466
72533
  config,
@@ -72487,9 +72554,11 @@ ${exportStatement("plugins")}
72487
72554
 
72488
72555
  // src/codegen/generators/runtime/index.ts
72489
72556
  async function runtimeGenerator(config, docs) {
72490
- const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
72491
- const exportStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
72492
- const exportStar = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
72557
+ const {
72558
+ importStatement,
72559
+ exportDefaultStatement: exportStatement,
72560
+ exportStarStatement: exportStar
72561
+ } = moduleStatments(config);
72493
72562
  await Promise.all([
72494
72563
  fs_exports.recursiveCopy(config.runtimeSource, config.runtimeDirectory, {
72495
72564
  [path_exports.join(config.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -72507,65 +72576,23 @@ ${exportStatement("config")}
72507
72576
  },
72508
72577
  [path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
72509
72578
  }),
72510
- ...config.plugins.filter((plugin2) => plugin2.includeRuntime).map(
72511
- (plugin2) => generatePluginRuntime({
72512
- config,
72513
- docs,
72514
- plugin: plugin2,
72515
- importStatement,
72516
- exportDefaultStatement: exportStatement,
72517
- exportStarStatement: exportStar
72518
- })
72519
- ),
72579
+ generatePluginRuntimes({
72580
+ config,
72581
+ docs
72582
+ }),
72520
72583
  generatePluginIndex({ config, exportStatement: exportStar })
72521
72584
  ]);
72522
72585
  await generateGraphqlReturnTypes(config, docs);
72523
72586
  }
72524
- async function generatePluginRuntime({
72525
- config,
72526
- docs,
72527
- plugin: plugin2,
72528
- importStatement,
72529
- exportDefaultStatement,
72530
- exportStarStatement
72531
- }) {
72532
- if (houdini_mode.is_testing || !plugin2.includeRuntime) {
72533
- return;
72534
- }
72535
- const runtime_path = path_exports.join(
72536
- path_exports.dirname(plugin2.filepath),
72537
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
72538
- );
72539
- try {
72540
- await fs_exports.stat(runtime_path);
72541
- } catch {
72542
- throw new HoudiniError({
72543
- message: "Cannot find runtime to generate for " + plugin2.name,
72544
- description: "Maybe it was bundled?"
72545
- });
72546
- }
72547
- const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
72548
- let transformMap = plugin2.transformRuntime ?? {};
72549
- if (transformMap && typeof transformMap === "function") {
72550
- transformMap = transformMap(docs, { config });
72551
- }
72552
- await fs_exports.mkdirp(pluginDir);
72553
- await fs_exports.recursiveCopy(
72554
- runtime_path,
72555
- pluginDir,
72556
- Object.fromEntries(
72557
- Object.entries(transformMap).map(([key, value]) => [
72558
- path_exports.join(runtime_path, key),
72559
- (content) => value({
72560
- config,
72561
- content,
72562
- importStatement,
72563
- exportDefaultStatement,
72564
- exportStarStatement
72565
- })
72566
- ])
72567
- )
72568
- );
72587
+ function moduleStatments(config) {
72588
+ const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
72589
+ const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
72590
+ const exportStarStatement = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
72591
+ return {
72592
+ importStatement,
72593
+ exportDefaultStatement,
72594
+ exportStarStatement
72595
+ };
72569
72596
  }
72570
72597
 
72571
72598
  // src/codegen/generators/typescript/documentTypes.ts
@@ -78496,12 +78523,12 @@ async function packageJSON(targetPath, frameworkInfo) {
78496
78523
  }
78497
78524
  packageJSON2.devDependencies = {
78498
78525
  ...packageJSON2.devDependencies,
78499
- houdini: "^1.2.31"
78526
+ houdini: "^1.2.33"
78500
78527
  };
78501
78528
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
78502
78529
  packageJSON2.devDependencies = {
78503
78530
  ...packageJSON2.devDependencies,
78504
- "houdini-svelte": "^1.2.31"
78531
+ "houdini-svelte": "^1.2.33"
78505
78532
  };
78506
78533
  } else {
78507
78534
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
@@ -1,2 +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>;
4
+ export declare function moduleStatments(config: Config): {
5
+ importStatement: typeof importDefaultFrom;
6
+ exportDefaultStatement: typeof exportDefault;
7
+ exportStarStatement: typeof exportStarFrom;
8
+ };
@@ -0,0 +1,5 @@
1
+ import type { Config, Document } from '../../../lib';
2
+ export declare function generatePluginRuntimes({ config, docs, }: {
3
+ config: Config;
4
+ docs: Document[];
5
+ }): Promise<void>;
@@ -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,
@@ -60889,9 +60938,11 @@ ${exportStatement("plugins")}
60889
60938
 
60890
60939
  // src/codegen/generators/runtime/index.ts
60891
60940
  async function runtimeGenerator(config, docs) {
60892
- const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
60893
- const exportStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
60894
- const exportStar = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
60941
+ const {
60942
+ importStatement,
60943
+ exportDefaultStatement: exportStatement,
60944
+ exportStarStatement: exportStar
60945
+ } = moduleStatments(config);
60895
60946
  await Promise.all([
60896
60947
  fs_exports.recursiveCopy(config.runtimeSource, config.runtimeDirectory, {
60897
60948
  [path_exports.join(config.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -60909,65 +60960,23 @@ ${exportStatement("config")}
60909
60960
  },
60910
60961
  [path_exports.join(config.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config, content, importStatement, exportStatement })
60911
60962
  }),
60912
- ...config.plugins.filter((plugin2) => plugin2.includeRuntime).map(
60913
- (plugin2) => generatePluginRuntime({
60914
- config,
60915
- docs,
60916
- plugin: plugin2,
60917
- importStatement,
60918
- exportDefaultStatement: exportStatement,
60919
- exportStarStatement: exportStar
60920
- })
60921
- ),
60963
+ generatePluginRuntimes({
60964
+ config,
60965
+ docs
60966
+ }),
60922
60967
  generatePluginIndex({ config, exportStatement: exportStar })
60923
60968
  ]);
60924
60969
  await generateGraphqlReturnTypes(config, docs);
60925
60970
  }
60926
- async function generatePluginRuntime({
60927
- config,
60928
- docs,
60929
- plugin: plugin2,
60930
- importStatement,
60931
- exportDefaultStatement,
60932
- exportStarStatement
60933
- }) {
60934
- if (houdini_mode.is_testing || !plugin2.includeRuntime) {
60935
- return;
60936
- }
60937
- const runtime_path = path_exports.join(
60938
- path_exports.dirname(plugin2.filepath),
60939
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config.module]
60940
- );
60941
- try {
60942
- await fs_exports.stat(runtime_path);
60943
- } catch {
60944
- throw new HoudiniError({
60945
- message: "Cannot find runtime to generate for " + plugin2.name,
60946
- description: "Maybe it was bundled?"
60947
- });
60948
- }
60949
- const pluginDir = config.pluginRuntimeDirectory(plugin2.name);
60950
- let transformMap = plugin2.transformRuntime ?? {};
60951
- if (transformMap && typeof transformMap === "function") {
60952
- transformMap = transformMap(docs, { config });
60953
- }
60954
- await fs_exports.mkdirp(pluginDir);
60955
- await fs_exports.recursiveCopy(
60956
- runtime_path,
60957
- pluginDir,
60958
- Object.fromEntries(
60959
- Object.entries(transformMap).map(([key, value]) => [
60960
- path_exports.join(runtime_path, key),
60961
- (content) => value({
60962
- config,
60963
- content,
60964
- importStatement,
60965
- exportDefaultStatement,
60966
- exportStarStatement
60967
- })
60968
- ])
60969
- )
60970
- );
60971
+ function moduleStatments(config) {
60972
+ const importStatement = config.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
60973
+ const exportDefaultStatement = config.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
60974
+ const exportStarStatement = config.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
60975
+ return {
60976
+ importStatement,
60977
+ exportDefaultStatement,
60978
+ exportStarStatement
60979
+ };
60971
60980
  }
60972
60981
 
60973
60982
  // src/codegen/generators/typescript/documentTypes.ts