houdini-svelte 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.
@@ -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,16 @@ 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
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
81871
+ if (!runtimeDir) {
81872
+ continue;
81873
+ }
81874
+ const includePath = relative(this.projectRoot, runtimeDir);
81875
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81876
+ }
81877
+ return include;
81869
81878
  }
81870
81879
  pluginConfig(name) {
81871
81880
  return this.configFile.plugins?.[name] ?? {};
@@ -81908,6 +81917,15 @@ var Config = class {
81908
81917
  );
81909
81918
  return headers;
81910
81919
  }
81920
+ pluginRuntimeSource(plugin2) {
81921
+ if (!plugin2.includeRuntime) {
81922
+ return null;
81923
+ }
81924
+ return join2(
81925
+ dirname(plugin2.filepath),
81926
+ typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
81927
+ );
81928
+ }
81911
81929
  async sourceFiles() {
81912
81930
  return [
81913
81931
  ...new Set(
@@ -176258,6 +176276,9 @@ function find_exported_fn(body, name) {
176258
176276
  if (init.type === "TSSatisfiesExpression") {
176259
176277
  init = init.expression;
176260
176278
  }
176279
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
176280
+ init = init.arguments[0];
176281
+ }
176261
176282
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
176262
176283
  return init;
176263
176284
  }
@@ -81862,7 +81862,16 @@ 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
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
81868
+ if (!runtimeDir) {
81869
+ continue;
81870
+ }
81871
+ const includePath = relative(this.projectRoot, runtimeDir);
81872
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81873
+ }
81874
+ return include;
81866
81875
  }
81867
81876
  pluginConfig(name) {
81868
81877
  return this.configFile.plugins?.[name] ?? {};
@@ -81905,6 +81914,15 @@ var Config = class {
81905
81914
  );
81906
81915
  return headers;
81907
81916
  }
81917
+ pluginRuntimeSource(plugin2) {
81918
+ if (!plugin2.includeRuntime) {
81919
+ return null;
81920
+ }
81921
+ return join2(
81922
+ dirname(plugin2.filepath),
81923
+ typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
81924
+ );
81925
+ }
81908
81926
  async sourceFiles() {
81909
81927
  return [
81910
81928
  ...new Set(
@@ -176254,6 +176272,9 @@ function find_exported_fn(body, name) {
176254
176272
  if (init.type === "TSSatisfiesExpression") {
176255
176273
  init = init.expression;
176256
176274
  }
176275
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
176276
+ init = init.arguments[0];
176277
+ }
176257
176278
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
176258
176279
  return init;
176259
176280
  }
@@ -139040,6 +139040,53 @@ async function generatePluginIndex({
139040
139040
  fs_exports2.writeFile(path_exports2.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
139041
139041
  ]);
139042
139042
  }
139043
+ async function generatePluginRuntimes({
139044
+ config: config2,
139045
+ docs
139046
+ }) {
139047
+ if (houdini_mode2.is_testing) {
139048
+ return;
139049
+ }
139050
+ const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
139051
+ await Promise.all(
139052
+ config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
139053
+ const runtime_path = config2.pluginRuntimeSource(plugin2);
139054
+ if (!runtime_path) {
139055
+ return;
139056
+ }
139057
+ try {
139058
+ await fs_exports2.stat(runtime_path);
139059
+ } catch {
139060
+ throw new HoudiniError2({
139061
+ message: "Cannot find runtime to generate for " + plugin2.name,
139062
+ description: "Maybe it was bundled?"
139063
+ });
139064
+ }
139065
+ const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
139066
+ let transformMap = plugin2.transformRuntime ?? {};
139067
+ if (transformMap && typeof transformMap === "function") {
139068
+ transformMap = transformMap(docs, { config: config2 });
139069
+ }
139070
+ await fs_exports2.mkdirp(pluginDir);
139071
+ await fs_exports2.recursiveCopy(
139072
+ runtime_path,
139073
+ pluginDir,
139074
+ Object.fromEntries(
139075
+ Object.entries(transformMap).map(([key, value2]) => [
139076
+ path_exports2.join(runtime_path, key),
139077
+ (content) => value2({
139078
+ config: config2,
139079
+ content,
139080
+ importStatement,
139081
+ exportDefaultStatement,
139082
+ exportStarStatement
139083
+ })
139084
+ ])
139085
+ )
139086
+ );
139087
+ })
139088
+ );
139089
+ }
139043
139090
  async function injectConfig({
139044
139091
  config: config2,
139045
139092
  content,
@@ -139063,9 +139110,11 @@ ${exportStatement("plugins")}
139063
139110
  ` : content;
139064
139111
  }
139065
139112
  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}'`;
139113
+ const {
139114
+ importStatement,
139115
+ exportDefaultStatement: exportStatement,
139116
+ exportStarStatement: exportStar
139117
+ } = moduleStatments(config2);
139069
139118
  await Promise.all([
139070
139119
  fs_exports2.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
139071
139120
  [path_exports2.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -139083,65 +139132,23 @@ ${exportStatement("config")}
139083
139132
  },
139084
139133
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139085
139134
  }),
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
- ),
139135
+ generatePluginRuntimes({
139136
+ config: config2,
139137
+ docs
139138
+ }),
139096
139139
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139097
139140
  ]);
139098
139141
  await generateGraphqlReturnTypes(config2, docs);
139099
139142
  }
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({
139136
- config: config2,
139137
- content,
139138
- importStatement,
139139
- exportDefaultStatement,
139140
- exportStarStatement
139141
- })
139142
- ])
139143
- )
139144
- );
139143
+ function moduleStatments(config2) {
139144
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139145
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139146
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139147
+ return {
139148
+ importStatement,
139149
+ exportDefaultStatement,
139150
+ exportStarStatement
139151
+ };
139145
139152
  }
139146
139153
  var recast12 = __toESM3(require_main22(), 1);
139147
139154
  var recast9 = __toESM3(require_main22(), 1);
@@ -200684,7 +200691,16 @@ var Config = class {
200684
200691
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
200685
200692
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
200686
200693
  );
200687
- return [`src/**/*{${extensions.join(",")}}`];
200694
+ const include = [`src/**/*{${extensions.join(",")}}`];
200695
+ for (const plugin2 of this.plugins) {
200696
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
200697
+ if (!runtimeDir) {
200698
+ continue;
200699
+ }
200700
+ const includePath = relative3(this.projectRoot, runtimeDir);
200701
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200702
+ }
200703
+ return include;
200688
200704
  }
200689
200705
  pluginConfig(name) {
200690
200706
  return this.configFile.plugins?.[name] ?? {};
@@ -200727,6 +200743,15 @@ var Config = class {
200727
200743
  );
200728
200744
  return headers;
200729
200745
  }
200746
+ pluginRuntimeSource(plugin2) {
200747
+ if (!plugin2.includeRuntime) {
200748
+ return null;
200749
+ }
200750
+ return join4(
200751
+ dirname3(plugin2.filepath),
200752
+ typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
200753
+ );
200754
+ }
200730
200755
  async sourceFiles() {
200731
200756
  return [
200732
200757
  ...new Set(
@@ -267347,6 +267372,9 @@ function find_exported_fn(body, name) {
267347
267372
  if (init.type === "TSSatisfiesExpression") {
267348
267373
  init = init.expression;
267349
267374
  }
267375
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
267376
+ init = init.arguments[0];
267377
+ }
267350
267378
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
267351
267379
  return init;
267352
267380
  }
@@ -139031,6 +139031,53 @@ async function generatePluginIndex({
139031
139031
  fs_exports2.writeFile(path_exports2.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
139032
139032
  ]);
139033
139033
  }
139034
+ async function generatePluginRuntimes({
139035
+ config: config2,
139036
+ docs
139037
+ }) {
139038
+ if (houdini_mode2.is_testing) {
139039
+ return;
139040
+ }
139041
+ const { importStatement, exportDefaultStatement, exportStarStatement } = moduleStatments(config2);
139042
+ await Promise.all(
139043
+ config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(async (plugin2) => {
139044
+ const runtime_path = config2.pluginRuntimeSource(plugin2);
139045
+ if (!runtime_path) {
139046
+ return;
139047
+ }
139048
+ try {
139049
+ await fs_exports2.stat(runtime_path);
139050
+ } catch {
139051
+ throw new HoudiniError2({
139052
+ message: "Cannot find runtime to generate for " + plugin2.name,
139053
+ description: "Maybe it was bundled?"
139054
+ });
139055
+ }
139056
+ const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
139057
+ let transformMap = plugin2.transformRuntime ?? {};
139058
+ if (transformMap && typeof transformMap === "function") {
139059
+ transformMap = transformMap(docs, { config: config2 });
139060
+ }
139061
+ await fs_exports2.mkdirp(pluginDir);
139062
+ await fs_exports2.recursiveCopy(
139063
+ runtime_path,
139064
+ pluginDir,
139065
+ Object.fromEntries(
139066
+ Object.entries(transformMap).map(([key, value2]) => [
139067
+ path_exports2.join(runtime_path, key),
139068
+ (content) => value2({
139069
+ config: config2,
139070
+ content,
139071
+ importStatement,
139072
+ exportDefaultStatement,
139073
+ exportStarStatement
139074
+ })
139075
+ ])
139076
+ )
139077
+ );
139078
+ })
139079
+ );
139080
+ }
139034
139081
  async function injectConfig({
139035
139082
  config: config2,
139036
139083
  content,
@@ -139054,9 +139101,11 @@ ${exportStatement("plugins")}
139054
139101
  ` : content;
139055
139102
  }
139056
139103
  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}'`;
139104
+ const {
139105
+ importStatement,
139106
+ exportDefaultStatement: exportStatement,
139107
+ exportStarStatement: exportStar
139108
+ } = moduleStatments(config2);
139060
139109
  await Promise.all([
139061
139110
  fs_exports2.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
139062
139111
  [path_exports2.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
@@ -139074,65 +139123,23 @@ ${exportStatement("config")}
139074
139123
  },
139075
139124
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139076
139125
  }),
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
- ),
139126
+ generatePluginRuntimes({
139127
+ config: config2,
139128
+ docs
139129
+ }),
139087
139130
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139088
139131
  ]);
139089
139132
  await generateGraphqlReturnTypes(config2, docs);
139090
139133
  }
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({
139127
- config: config2,
139128
- content,
139129
- importStatement,
139130
- exportDefaultStatement,
139131
- exportStarStatement
139132
- })
139133
- ])
139134
- )
139135
- );
139134
+ function moduleStatments(config2) {
139135
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139136
+ const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
139137
+ const exportStarStatement = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
139138
+ return {
139139
+ importStatement,
139140
+ exportDefaultStatement,
139141
+ exportStarStatement
139142
+ };
139136
139143
  }
139137
139144
  var recast12 = __toESM3(require_main22(), 1);
139138
139145
  var recast9 = __toESM3(require_main22(), 1);
@@ -200674,7 +200681,16 @@ var Config = class {
200674
200681
  const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
200675
200682
  this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
200676
200683
  );
200677
- return [`src/**/*{${extensions.join(",")}}`];
200684
+ const include = [`src/**/*{${extensions.join(",")}}`];
200685
+ for (const plugin2 of this.plugins) {
200686
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
200687
+ if (!runtimeDir) {
200688
+ continue;
200689
+ }
200690
+ const includePath = relative3(this.projectRoot, runtimeDir);
200691
+ include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200692
+ }
200693
+ return include;
200678
200694
  }
200679
200695
  pluginConfig(name) {
200680
200696
  return this.configFile.plugins?.[name] ?? {};
@@ -200717,6 +200733,15 @@ var Config = class {
200717
200733
  );
200718
200734
  return headers;
200719
200735
  }
200736
+ pluginRuntimeSource(plugin2) {
200737
+ if (!plugin2.includeRuntime) {
200738
+ return null;
200739
+ }
200740
+ return join4(
200741
+ dirname3(plugin2.filepath),
200742
+ typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime?.[this.module]
200743
+ );
200744
+ }
200720
200745
  async sourceFiles() {
200721
200746
  return [
200722
200747
  ...new Set(
@@ -267336,6 +267361,9 @@ function find_exported_fn(body, name) {
267336
267361
  if (init.type === "TSSatisfiesExpression") {
267337
267362
  init = init.expression;
267338
267363
  }
267364
+ if (init.type === "CallExpression" && init.arguments[0] && (init.arguments[0].type === "FunctionExpression" || init.arguments[0].type === "ArrowFunctionExpression")) {
267365
+ init = init.arguments[0];
267366
+ }
267339
267367
  if (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression") {
267340
267368
  return init;
267341
267369
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.2.31",
3
+ "version": "1.2.33",
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.31"
35
+ "houdini": "^1.2.33"
36
36
  },
37
37
  "files": [
38
38
  "build"