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.
@@ -69153,7 +69153,16 @@ var Config = class {
69153
69153
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
69154
69154
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
69155
69155
  );
69156
- return [`src/**/*{${extensions.join(",")}}`];
69156
+ const include = [`src/**/*{${extensions.join(",")}}`];
69157
+ for (const plugin2 of this.plugins) {
69158
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
69159
+ if (!runtimeDir) {
69160
+ continue;
69161
+ }
69162
+ const includePath = relative(this.projectRoot, runtimeDir);
69163
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
69164
+ }
69165
+ return include;
69157
69166
  }
69158
69167
  pluginConfig(name) {
69159
69168
  return this.configFile.plugins?.[name] ?? {};
@@ -69196,6 +69205,15 @@ var Config = class {
69196
69205
  );
69197
69206
  return headers;
69198
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
+ }
69199
69217
  async sourceFiles() {
69200
69218
  return [
69201
69219
  ...new Set(
@@ -73890,6 +73908,55 @@ async function generatePluginIndex({
73890
73908
  ]);
73891
73909
  }
73892
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
+
73893
73960
  // src/codegen/generators/runtime/runtimeConfig.ts
73894
73961
  async function injectConfig({
73895
73962
  config: config2,
@@ -73916,9 +73983,11 @@ ${exportStatement("plugins")}
73916
73983
 
73917
73984
  // src/codegen/generators/runtime/index.ts
73918
73985
  async function runtimeGenerator(config2, docs) {
73919
- const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
73920
- const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
73921
- const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
73986
+ const {
73987
+ importStatement,
73988
+ exportDefaultStatement: exportStatement,
73989
+ exportStarStatement: exportStar
73990
+ } = moduleStatments(config2);
73922
73991
  await Promise.all([
73923
73992
  fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
73924
73993
  [path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -73936,65 +74005,23 @@ ${exportStatement("config")}
73936
74005
  },
73937
74006
  [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
73938
74007
  }),
73939
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
73940
- (plugin2) => generatePluginRuntime({
73941
- config: config2,
73942
- docs,
73943
- plugin: plugin2,
73944
- importStatement,
73945
- exportDefaultStatement: exportStatement,
73946
- exportStarStatement: exportStar
73947
- })
73948
- ),
74008
+ generatePluginRuntimes({
74009
+ config: config2,
74010
+ docs
74011
+ }),
73949
74012
  generatePluginIndex({ config: config2, exportStatement: exportStar })
73950
74013
  ]);
73951
74014
  await generateGraphqlReturnTypes(config2, docs);
73952
74015
  }
73953
- async function generatePluginRuntime({
73954
- config: config2,
73955
- docs,
73956
- plugin: plugin2,
73957
- importStatement,
73958
- exportDefaultStatement,
73959
- exportStarStatement
73960
- }) {
73961
- if (houdini_mode.is_testing || !plugin2.includeRuntime) {
73962
- return;
73963
- }
73964
- const runtime_path = path_exports.join(
73965
- path_exports.dirname(plugin2.filepath),
73966
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
73967
- );
73968
- try {
73969
- await fs_exports.stat(runtime_path);
73970
- } catch {
73971
- throw new HoudiniError({
73972
- message: "Cannot find runtime to generate for " + plugin2.name,
73973
- description: "Maybe it was bundled?"
73974
- });
73975
- }
73976
- const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
73977
- let transformMap = plugin2.transformRuntime ?? {};
73978
- if (transformMap && typeof transformMap === "function") {
73979
- transformMap = transformMap(docs, { config: config2 });
73980
- }
73981
- await fs_exports.mkdirp(pluginDir);
73982
- await fs_exports.recursiveCopy(
73983
- runtime_path,
73984
- pluginDir,
73985
- Object.fromEntries(
73986
- Object.entries(transformMap).map(([key, value]) => [
73987
- path_exports.join(runtime_path, key),
73988
- (content) => value({
73989
- config: config2,
73990
- content,
73991
- importStatement,
73992
- exportDefaultStatement,
73993
- exportStarStatement
73994
- })
73995
- ])
73996
- )
73997
- );
74016
+ function moduleStatments(config2) {
74017
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
74018
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
74019
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
74020
+ return {
74021
+ importStatement,
74022
+ exportDefaultStatement,
74023
+ exportStarStatement
74024
+ };
73998
74025
  }
73999
74026
 
74000
74027
  // src/codegen/generators/typescript/documentTypes.ts
@@ -79208,6 +79235,9 @@ function find_exported_fn(body, name) {
79208
79235
  if (init.type === "TSSatisfiesExpression") {
79209
79236
  init = init.expression;
79210
79237
  }
79238
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
79239
+ init = init.arguments[0];
79240
+ }
79211
79241
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
79212
79242
  return init;
79213
79243
  }
@@ -69146,7 +69146,16 @@ var Config = class {
69146
69146
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
69147
69147
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
69148
69148
  );
69149
- return [`src/**/*{${extensions.join(",")}}`];
69149
+ const include = [`src/**/*{${extensions.join(",")}}`];
69150
+ for (const plugin2 of this.plugins) {
69151
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
69152
+ if (!runtimeDir) {
69153
+ continue;
69154
+ }
69155
+ const includePath = relative(this.projectRoot, runtimeDir);
69156
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
69157
+ }
69158
+ return include;
69150
69159
  }
69151
69160
  pluginConfig(name) {
69152
69161
  return this.configFile.plugins?.[name] ?? {};
@@ -69189,6 +69198,15 @@ var Config = class {
69189
69198
  );
69190
69199
  return headers;
69191
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
+ }
69192
69210
  async sourceFiles() {
69193
69211
  return [
69194
69212
  ...new Set(
@@ -73883,6 +73901,55 @@ async function generatePluginIndex({
73883
73901
  ]);
73884
73902
  }
73885
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
+
73886
73953
  // src/codegen/generators/runtime/runtimeConfig.ts
73887
73954
  async function injectConfig({
73888
73955
  config: config2,
@@ -73909,9 +73976,11 @@ ${exportStatement("plugins")}
73909
73976
 
73910
73977
  // src/codegen/generators/runtime/index.ts
73911
73978
  async function runtimeGenerator(config2, docs) {
73912
- const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
73913
- const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
73914
- const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
73979
+ const {
73980
+ importStatement,
73981
+ exportDefaultStatement: exportStatement,
73982
+ exportStarStatement: exportStar
73983
+ } = moduleStatments(config2);
73915
73984
  await Promise.all([
73916
73985
  fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
73917
73986
  [path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -73929,65 +73998,23 @@ ${exportStatement("config")}
73929
73998
  },
73930
73999
  [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
73931
74000
  }),
73932
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
73933
- (plugin2) => generatePluginRuntime({
73934
- config: config2,
73935
- docs,
73936
- plugin: plugin2,
73937
- importStatement,
73938
- exportDefaultStatement: exportStatement,
73939
- exportStarStatement: exportStar
73940
- })
73941
- ),
74001
+ generatePluginRuntimes({
74002
+ config: config2,
74003
+ docs
74004
+ }),
73942
74005
  generatePluginIndex({ config: config2, exportStatement: exportStar })
73943
74006
  ]);
73944
74007
  await generateGraphqlReturnTypes(config2, docs);
73945
74008
  }
73946
- async function generatePluginRuntime({
73947
- config: config2,
73948
- docs,
73949
- plugin: plugin2,
73950
- importStatement,
73951
- exportDefaultStatement,
73952
- exportStarStatement
73953
- }) {
73954
- if (houdini_mode.is_testing || !plugin2.includeRuntime) {
73955
- return;
73956
- }
73957
- const runtime_path = path_exports.join(
73958
- path_exports.dirname(plugin2.filepath),
73959
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
73960
- );
73961
- try {
73962
- await fs_exports.stat(runtime_path);
73963
- } catch {
73964
- throw new HoudiniError({
73965
- message: "Cannot find runtime to generate for " + plugin2.name,
73966
- description: "Maybe it was bundled?"
73967
- });
73968
- }
73969
- const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
73970
- let transformMap = plugin2.transformRuntime ?? {};
73971
- if (transformMap && typeof transformMap === "function") {
73972
- transformMap = transformMap(docs, { config: config2 });
73973
- }
73974
- await fs_exports.mkdirp(pluginDir);
73975
- await fs_exports.recursiveCopy(
73976
- runtime_path,
73977
- pluginDir,
73978
- Object.fromEntries(
73979
- Object.entries(transformMap).map(([key, value]) => [
73980
- path_exports.join(runtime_path, key),
73981
- (content) => value({
73982
- config: config2,
73983
- content,
73984
- importStatement,
73985
- exportDefaultStatement,
73986
- exportStarStatement
73987
- })
73988
- ])
73989
- )
73990
- );
74009
+ function moduleStatments(config2) {
74010
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
74011
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
74012
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
74013
+ return {
74014
+ importStatement,
74015
+ exportDefaultStatement,
74016
+ exportStarStatement
74017
+ };
73991
74018
  }
73992
74019
 
73993
74020
  // src/codegen/generators/typescript/documentTypes.ts
@@ -79201,6 +79228,9 @@ function find_exported_fn(body, name) {
79201
79228
  if (init.type === "TSSatisfiesExpression") {
79202
79229
  init = init.expression;
79203
79230
  }
79231
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
79232
+ init = init.arguments[0];
79233
+ }
79204
79234
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
79205
79235
  return init;
79206
79236
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",