houdini-svelte 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.
@@ -81867,10 +81867,11 @@ var Config = class {
81867
81867
  );
81868
81868
  const include = [`src/**/*{${extensions.join(",")}}`];
81869
81869
  for (const plugin2 of this.plugins) {
81870
- if (!plugin2.includeRuntime) {
81870
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
81871
+ if (!runtimeDir) {
81871
81872
  continue;
81872
81873
  }
81873
- const includePath = relative(this.projectRoot, this.pluginDirectory(plugin2.name));
81874
+ const includePath = relative(this.projectRoot, runtimeDir);
81874
81875
  include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81875
81876
  }
81876
81877
  return include;
@@ -81916,6 +81917,15 @@ var Config = class {
81916
81917
  );
81917
81918
  return headers;
81918
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
+ }
81919
81929
  async sourceFiles() {
81920
81930
  return [
81921
81931
  ...new Set(
@@ -81864,10 +81864,11 @@ var Config = class {
81864
81864
  );
81865
81865
  const include = [`src/**/*{${extensions.join(",")}}`];
81866
81866
  for (const plugin2 of this.plugins) {
81867
- if (!plugin2.includeRuntime) {
81867
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
81868
+ if (!runtimeDir) {
81868
81869
  continue;
81869
81870
  }
81870
- const includePath = relative(this.projectRoot, this.pluginDirectory(plugin2.name));
81871
+ const includePath = relative(this.projectRoot, runtimeDir);
81871
81872
  include.push(`${includePath}/**/*{${extensions.join(",")}}`);
81872
81873
  }
81873
81874
  return include;
@@ -81913,6 +81914,15 @@ var Config = class {
81913
81914
  );
81914
81915
  return headers;
81915
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
+ }
81916
81926
  async sourceFiles() {
81917
81927
  return [
81918
81928
  ...new Set(
@@ -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,
@@ -139085,37 +139132,14 @@ ${exportStatement("config")}
139085
139132
  },
139086
139133
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139087
139134
  }),
139088
- transformPluginRuntimes({ config: config2, docs }),
139135
+ generatePluginRuntimes({
139136
+ config: config2,
139137
+ docs
139138
+ }),
139089
139139
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139090
139140
  ]);
139091
139141
  await generateGraphqlReturnTypes(config2, docs);
139092
139142
  }
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({
139108
- config: config2,
139109
- content,
139110
- importStatement,
139111
- exportDefaultStatement,
139112
- exportStarStatement
139113
- });
139114
- await fs_exports2.writeFile(targetPath, transformed);
139115
- }
139116
- })
139117
- );
139118
- }
139119
139143
  function moduleStatments(config2) {
139120
139144
  const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139121
139145
  const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
@@ -200669,10 +200693,11 @@ var Config = class {
200669
200693
  );
200670
200694
  const include = [`src/**/*{${extensions.join(",")}}`];
200671
200695
  for (const plugin2 of this.plugins) {
200672
- if (!plugin2.includeRuntime) {
200696
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
200697
+ if (!runtimeDir) {
200673
200698
  continue;
200674
200699
  }
200675
- const includePath = relative3(this.projectRoot, this.pluginDirectory(plugin2.name));
200700
+ const includePath = relative3(this.projectRoot, runtimeDir);
200676
200701
  include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200677
200702
  }
200678
200703
  return include;
@@ -200718,6 +200743,15 @@ var Config = class {
200718
200743
  );
200719
200744
  return headers;
200720
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
+ }
200721
200755
  async sourceFiles() {
200722
200756
  return [
200723
200757
  ...new Set(
@@ -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,
@@ -139076,37 +139123,14 @@ ${exportStatement("config")}
139076
139123
  },
139077
139124
  [path_exports2.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
139078
139125
  }),
139079
- transformPluginRuntimes({ config: config2, docs }),
139126
+ generatePluginRuntimes({
139127
+ config: config2,
139128
+ docs
139129
+ }),
139080
139130
  generatePluginIndex({ config: config2, exportStatement: exportStar })
139081
139131
  ]);
139082
139132
  await generateGraphqlReturnTypes(config2, docs);
139083
139133
  }
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({
139099
- config: config2,
139100
- content,
139101
- importStatement,
139102
- exportDefaultStatement,
139103
- exportStarStatement
139104
- });
139105
- await fs_exports2.writeFile(targetPath, transformed);
139106
- }
139107
- })
139108
- );
139109
- }
139110
139134
  function moduleStatments(config2) {
139111
139135
  const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
139112
139136
  const exportDefaultStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
@@ -200659,10 +200683,11 @@ var Config = class {
200659
200683
  );
200660
200684
  const include = [`src/**/*{${extensions.join(",")}}`];
200661
200685
  for (const plugin2 of this.plugins) {
200662
- if (!plugin2.includeRuntime) {
200686
+ const runtimeDir = this.pluginRuntimeSource(plugin2);
200687
+ if (!runtimeDir) {
200663
200688
  continue;
200664
200689
  }
200665
- const includePath = relative3(this.projectRoot, this.pluginDirectory(plugin2.name));
200690
+ const includePath = relative3(this.projectRoot, runtimeDir);
200666
200691
  include.push(`${includePath}/**/*{${extensions.join(",")}}`);
200667
200692
  }
200668
200693
  return include;
@@ -200708,6 +200733,15 @@ var Config = class {
200708
200733
  );
200709
200734
  return headers;
200710
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
+ }
200711
200745
  async sourceFiles() {
200712
200746
  return [
200713
200747
  ...new Set(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.2.32",
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.32"
35
+ "houdini": "^1.2.33"
36
36
  },
37
37
  "files": [
38
38
  "build"