houdini-svelte 1.2.30 → 1.2.32

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.
@@ -144471,6 +144471,9 @@ function find_exported_fn(body, name) {
144471
144471
  if (init.type === "TSSatisfiesExpression") {
144472
144472
  init = init.expression;
144473
144473
  }
144474
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
144475
+ init = init.arguments[0];
144476
+ }
144474
144477
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
144475
144478
  return init;
144476
144479
  }
@@ -144465,6 +144465,9 @@ function find_exported_fn(body, name) {
144465
144465
  if (init.type === "TSSatisfiesExpression") {
144466
144466
  init = init.expression;
144467
144467
  }
144468
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
144469
+ init = init.arguments[0];
144470
+ }
144468
144471
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
144469
144472
  return init;
144470
144473
  }
@@ -81865,7 +81865,15 @@ var Config = class {
81865
81865
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
81866
81866
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
81867
81867
  );
81868
- return [`src/**/*{${extensions.join(",")}}`];
81868
+ const include = [`src/**/*{${extensions.join(",")}}`];
81869
+ for (const plugin2 of this.plugins) {
81870
+ if (!plugin2.includeRuntime) {
81871
+ continue;
81872
+ }
81873
+ const includePath = relative(this.projectRoot, this.pluginDirectory(plugin2.name));
81874
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81875
+ }
81876
+ return include;
81869
81877
  }
81870
81878
  pluginConfig(name) {
81871
81879
  return this.configFile.plugins?.[name] ?? {};
@@ -176258,6 +176266,9 @@ function find_exported_fn(body, name) {
176258
176266
  if (init.type === "TSSatisfiesExpression") {
176259
176267
  init = init.expression;
176260
176268
  }
176269
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
176270
+ init = init.arguments[0];
176271
+ }
176261
176272
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
176262
176273
  return init;
176263
176274
  }
@@ -81862,7 +81862,15 @@ var Config = class {
81862
81862
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
81863
81863
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
81864
81864
  );
81865
- return [`src/**/*{${extensions.join(",")}}`];
81865
+ const include = [`src/**/*{${extensions.join(",")}}`];
81866
+ for (const plugin2 of this.plugins) {
81867
+ if (!plugin2.includeRuntime) {
81868
+ continue;
81869
+ }
81870
+ const includePath = relative(this.projectRoot, this.pluginDirectory(plugin2.name));
81871
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81872
+ }
81873
+ return include;
81866
81874
  }
81867
81875
  pluginConfig(name) {
81868
81876
  return this.configFile.plugins?.[name] ?? {};
@@ -176254,6 +176262,9 @@ function find_exported_fn(body, name) {
176254
176262
  if (init.type === "TSSatisfiesExpression") {
176255
176263
  init = init.expression;
176256
176264
  }
176265
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
176266
+ init = init.arguments[0];
176267
+ }
176257
176268
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
176258
176269
  return init;
176259
176270
  }
@@ -139063,9 +139063,11 @@ ${exportStatement("plugins")}
139063
139063
  ` : content;
139064
139064
  }
139065
139065
  async function runtimeGenerator(config2, docs) {
139066
- const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139067
- const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139068
- const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139066
+ const {
139067
+ importStatement,
139068
+ exportDefaultStatement: exportStatement,
139069
+ exportStarStatement: exportStar
139070
+ } = moduleStatments(config2);
139069
139071
  await Promise.all([
139070
139072
  fs_exports2.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
139071
139073
  [path_exports2.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -139083,66 +139085,47 @@ ${exportStatement("config")}
139083
139085
  },
139084
139086
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139085
139087
  }),
139086
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
139087
- (plugin2) => generatePluginRuntime({
139088
- config: config2,
139089
- docs,
139090
- plugin: plugin2,
139091
- importStatement,
139092
- exportDefaultStatement: exportStatement,
139093
- exportStarStatement: exportStar
139094
- })
139095
- ),
139088
+ transformPluginRuntimes({ config: config2, docs }),
139096
139089
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139097
139090
  ]);
139098
139091
  await generateGraphqlReturnTypes(config2, docs);
139099
139092
  }
139100
- async function generatePluginRuntime({
139101
- config: config2,
139102
- docs,
139103
- plugin: plugin2,
139104
- importStatement,
139105
- exportDefaultStatement,
139106
- exportStarStatement
139107
- }) {
139108
- if (houdini_mode2.is_testing || !plugin2.includeRuntime) {
139109
- return;
139110
- }
139111
- const runtime_path = path_exports2.join(
139112
- path_exports2.dirname(plugin2.filepath),
139113
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
139114
- );
139115
- try {
139116
- await fs_exports2.stat(runtime_path);
139117
- } catch {
139118
- throw new HoudiniError2({
139119
- message: "Cannot find runtime to generate for " + plugin2.name,
139120
- description: "Maybe it was bundled?"
139121
- });
139122
- }
139123
- const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
139124
- let transformMap = plugin2.transformRuntime ?? {};
139125
- if (transformMap && typeof transformMap === "function") {
139126
- transformMap = transformMap(docs, { config: config2 });
139127
- }
139128
- await fs_exports2.mkdirp(pluginDir);
139129
- await fs_exports2.recursiveCopy(
139130
- runtime_path,
139131
- pluginDir,
139132
- Object.fromEntries(
139133
- Object.entries(transformMap).map(([key, value2]) => [
139134
- path_exports2.join(runtime_path, key),
139135
- (content) => value2({
139093
+ async function transformPluginRuntimes({ config: config2, docs }) {
139094
+ const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
139095
+ await Promise.all(
139096
+ config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
139097
+ let transformMap = plugin2.transformRuntime ?? {};
139098
+ if (transformMap && typeof transformMap === "function") {
139099
+ transformMap = transformMap(docs, { config: config2 });
139100
+ }
139101
+ for (const [target, transform] of Object.entries(transformMap)) {
139102
+ const targetPath = path_exports2.join(config2.pluginRuntimeDirectory(plugin2.name), target);
139103
+ const content = await fs_exports2.readFile(targetPath);
139104
+ if (!content) {
139105
+ return;
139106
+ }
139107
+ const transformed = transform({
139136
139108
  config: config2,
139137
139109
  content,
139138
139110
  importStatement,
139139
139111
  exportDefaultStatement,
139140
139112
  exportStarStatement
139141
- })
139142
- ])
139143
- )
139113
+ });
139114
+ await fs_exports2.writeFile(targetPath, transformed);
139115
+ }
139116
+ })
139144
139117
  );
139145
139118
  }
139119
+ function moduleStatments(config2) {
139120
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139121
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139122
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139123
+ return {
139124
+ importStatement,
139125
+ exportDefaultStatement,
139126
+ exportStarStatement
139127
+ };
139128
+ }
139146
139129
  var recast12 = __toESM3(require_main22(), 1);
139147
139130
  var recast9 = __toESM3(require_main22(), 1);
139148
139131
  var recast8 = __toESM3(require_main22(), 1);
@@ -200684,7 +200667,15 @@ var Config = class {
200684
200667
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
200685
200668
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
200686
200669
  );
200687
- return [`src/**/*{${extensions.join(",")}}`];
200670
+ const include = [`src/**/*{${extensions.join(",")}}`];
200671
+ for (const plugin2 of this.plugins) {
200672
+ if (!plugin2.includeRuntime) {
200673
+ continue;
200674
+ }
200675
+ const includePath = relative3(this.projectRoot, this.pluginDirectory(plugin2.name));
200676
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200677
+ }
200678
+ return include;
200688
200679
  }
200689
200680
  pluginConfig(name) {
200690
200681
  return this.configFile.plugins?.[name] ?? {};
@@ -267347,6 +267338,9 @@ function find_exported_fn(body, name) {
267347
267338
  if (init.type === "TSSatisfiesExpression") {
267348
267339
  init = init.expression;
267349
267340
  }
267341
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
267342
+ init = init.arguments[0];
267343
+ }
267350
267344
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
267351
267345
  return init;
267352
267346
  }
@@ -139054,9 +139054,11 @@ ${exportStatement("plugins")}
139054
139054
  ` : content;
139055
139055
  }
139056
139056
  async function runtimeGenerator(config2, docs) {
139057
- const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139058
- const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139059
- const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139057
+ const {
139058
+ importStatement,
139059
+ exportDefaultStatement: exportStatement,
139060
+ exportStarStatement: exportStar
139061
+ } = moduleStatments(config2);
139060
139062
  await Promise.all([
139061
139063
  fs_exports2.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
139062
139064
  [path_exports2.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -139074,66 +139076,47 @@ ${exportStatement("config")}
139074
139076
  },
139075
139077
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139076
139078
  }),
139077
- ...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
139078
- (plugin2) => generatePluginRuntime({
139079
- config: config2,
139080
- docs,
139081
- plugin: plugin2,
139082
- importStatement,
139083
- exportDefaultStatement: exportStatement,
139084
- exportStarStatement: exportStar
139085
- })
139086
- ),
139079
+ transformPluginRuntimes({ config: config2, docs }),
139087
139080
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139088
139081
  ]);
139089
139082
  await generateGraphqlReturnTypes(config2, docs);
139090
139083
  }
139091
- async function generatePluginRuntime({
139092
- config: config2,
139093
- docs,
139094
- plugin: plugin2,
139095
- importStatement,
139096
- exportDefaultStatement,
139097
- exportStarStatement
139098
- }) {
139099
- if (houdini_mode2.is_testing || !plugin2.includeRuntime) {
139100
- return;
139101
- }
139102
- const runtime_path = path_exports2.join(
139103
- path_exports2.dirname(plugin2.filepath),
139104
- typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
139105
- );
139106
- try {
139107
- await fs_exports2.stat(runtime_path);
139108
- } catch {
139109
- throw new HoudiniError2({
139110
- message: "Cannot find runtime to generate for " + plugin2.name,
139111
- description: "Maybe it was bundled?"
139112
- });
139113
- }
139114
- const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
139115
- let transformMap = plugin2.transformRuntime ?? {};
139116
- if (transformMap && typeof transformMap === "function") {
139117
- transformMap = transformMap(docs, { config: config2 });
139118
- }
139119
- await fs_exports2.mkdirp(pluginDir);
139120
- await fs_exports2.recursiveCopy(
139121
- runtime_path,
139122
- pluginDir,
139123
- Object.fromEntries(
139124
- Object.entries(transformMap).map(([key, value2]) => [
139125
- path_exports2.join(runtime_path, key),
139126
- (content) => value2({
139084
+ async function transformPluginRuntimes({ config: config2, docs }) {
139085
+ const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
139086
+ await Promise.all(
139087
+ config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
139088
+ let transformMap = plugin2.transformRuntime ?? {};
139089
+ if (transformMap && typeof transformMap === "function") {
139090
+ transformMap = transformMap(docs, { config: config2 });
139091
+ }
139092
+ for (const [target, transform] of Object.entries(transformMap)) {
139093
+ const targetPath = path_exports2.join(config2.pluginRuntimeDirectory(plugin2.name), target);
139094
+ const content = await fs_exports2.readFile(targetPath);
139095
+ if (!content) {
139096
+ return;
139097
+ }
139098
+ const transformed = transform({
139127
139099
  config: config2,
139128
139100
  content,
139129
139101
  importStatement,
139130
139102
  exportDefaultStatement,
139131
139103
  exportStarStatement
139132
- })
139133
- ])
139134
- )
139104
+ });
139105
+ await fs_exports2.writeFile(targetPath, transformed);
139106
+ }
139107
+ })
139135
139108
  );
139136
139109
  }
139110
+ function moduleStatments(config2) {
139111
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139112
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139113
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139114
+ return {
139115
+ importStatement,
139116
+ exportDefaultStatement,
139117
+ exportStarStatement
139118
+ };
139119
+ }
139137
139120
  var recast12 = __toESM3(require_main22(), 1);
139138
139121
  var recast9 = __toESM3(require_main22(), 1);
139139
139122
  var recast8 = __toESM3(require_main22(), 1);
@@ -200674,7 +200657,15 @@ var Config = class {
200674
200657
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
200675
200658
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
200676
200659
  );
200677
- return [`src/**/*{${extensions.join(",")}}`];
200660
+ const include = [`src/**/*{${extensions.join(",")}}`];
200661
+ for (const plugin2 of this.plugins) {
200662
+ if (!plugin2.includeRuntime) {
200663
+ continue;
200664
+ }
200665
+ const includePath = relative3(this.projectRoot, this.pluginDirectory(plugin2.name));
200666
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200667
+ }
200668
+ return include;
200678
200669
  }
200679
200670
  pluginConfig(name) {
200680
200671
  return this.configFile.plugins?.[name] ?? {};
@@ -267336,6 +267327,9 @@ function find_exported_fn(body, name) {
267336
267327
  if (init.type === "TSSatisfiesExpression") {
267337
267328
  init = init.expression;
267338
267329
  }
267330
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
267331
+ init = init.arguments[0];
267332
+ }
267339
267333
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
267340
267334
  return init;
267341
267335
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.2.30",
3
+ "version": "1.2.32",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -32,7 +32,7 @@
32
32
  "rollup": "^3.7.4",
33
33
  "svelte": "^3.57.0",
34
34
  "vite": "^4.1.1",
35
- "houdini": "^1.2.30"
35
+ "houdini": "^1.2.32"
36
36
  },
37
37
  "files": [
38
38
  "build"