houdini 1.0.0-next.7 → 1.0.0-next.8

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.
Files changed (63) hide show
  1. package/build/cmd-cjs/index.js +45 -46
  2. package/build/cmd-esm/index.js +18 -19
  3. package/build/codegen-cjs/index.js +19 -19
  4. package/build/codegen-esm/index.js +6 -6
  5. package/build/lib/config.d.ts +2 -1
  6. package/build/lib/path.d.ts +1 -1
  7. package/build/lib-cjs/index.js +40 -37
  8. package/build/lib-esm/index.js +14 -11
  9. package/build/runtime/cache/cache.d.ts +6 -6
  10. package/build/runtime/cache/storage.d.ts +5 -5
  11. package/build/runtime/cache/stuff.d.ts +0 -2
  12. package/build/runtime/client/documentStore.d.ts +4 -3
  13. package/build/runtime/client/index.d.ts +5 -4
  14. package/build/runtime/client/plugins/injectedPlugins.d.ts +2 -1
  15. package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
  16. package/build/runtime/lib/flatten.d.ts +2 -0
  17. package/build/runtime/lib/types.d.ts +1 -0
  18. package/build/runtime/public/record.d.ts +1 -2
  19. package/build/runtime-cjs/cache/cache.d.ts +6 -6
  20. package/build/runtime-cjs/cache/cache.js +6 -5
  21. package/build/runtime-cjs/cache/lists.js +3 -3
  22. package/build/runtime-cjs/cache/storage.d.ts +5 -5
  23. package/build/runtime-cjs/cache/storage.js +2 -2
  24. package/build/runtime-cjs/cache/stuff.d.ts +0 -2
  25. package/build/runtime-cjs/cache/stuff.js +2 -19
  26. package/build/runtime-cjs/cache/subscription.js +5 -4
  27. package/build/runtime-cjs/client/documentStore.d.ts +4 -3
  28. package/build/runtime-cjs/client/documentStore.js +3 -3
  29. package/build/runtime-cjs/client/index.d.ts +5 -4
  30. package/build/runtime-cjs/client/index.js +37 -11
  31. package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +2 -1
  32. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
  33. package/build/runtime-cjs/lib/flatten.d.ts +2 -0
  34. package/build/runtime-cjs/lib/flatten.js +41 -0
  35. package/build/runtime-cjs/lib/types.d.ts +1 -0
  36. package/build/runtime-cjs/public/cache.js +2 -2
  37. package/build/runtime-cjs/public/record.d.ts +1 -2
  38. package/build/runtime-cjs/public/record.js +1 -2
  39. package/build/runtime-esm/cache/cache.d.ts +6 -6
  40. package/build/runtime-esm/cache/cache.js +7 -6
  41. package/build/runtime-esm/cache/lists.js +3 -3
  42. package/build/runtime-esm/cache/storage.d.ts +5 -5
  43. package/build/runtime-esm/cache/storage.js +2 -2
  44. package/build/runtime-esm/cache/stuff.d.ts +0 -2
  45. package/build/runtime-esm/cache/stuff.js +1 -17
  46. package/build/runtime-esm/cache/subscription.js +6 -5
  47. package/build/runtime-esm/client/documentStore.d.ts +4 -3
  48. package/build/runtime-esm/client/documentStore.js +3 -3
  49. package/build/runtime-esm/client/index.d.ts +5 -4
  50. package/build/runtime-esm/client/index.js +36 -11
  51. package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +2 -1
  52. package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
  53. package/build/runtime-esm/lib/flatten.d.ts +2 -0
  54. package/build/runtime-esm/lib/flatten.js +17 -0
  55. package/build/runtime-esm/lib/types.d.ts +1 -0
  56. package/build/runtime-esm/public/cache.js +2 -2
  57. package/build/runtime-esm/public/record.d.ts +1 -2
  58. package/build/runtime-esm/public/record.js +1 -2
  59. package/build/test-cjs/index.js +19 -19
  60. package/build/test-esm/index.js +6 -6
  61. package/build/vite-cjs/index.js +42 -38
  62. package/build/vite-esm/index.js +16 -12
  63. package/package.json +4 -4
@@ -1,3 +1,4 @@
1
+ import { flatten } from "../lib/flatten";
1
2
  import { DocumentStore } from "./documentStore";
2
3
  import {
3
4
  fetchParamsPlugin,
@@ -18,16 +19,18 @@ class HoudiniClient {
18
19
  "A client cannot be given a pipeline and a list of plugins at the same time."
19
20
  );
20
21
  }
21
- this.#plugins = [].concat(
22
- throwOnError ? [throwOnErrorPlugin(throwOnError)] : [],
23
- fetchParamsPlugin(fetchParams),
24
- pipeline ?? [
25
- queryPlugin,
26
- mutationPlugin
27
- ].concat(
28
- plugins ?? [],
29
- pluginsFromPlugins,
30
- fetchPlugin()
22
+ this.#plugins = flatten(
23
+ [].concat(
24
+ throwOnError ? [throwOnErrorPlugin(throwOnError)] : [],
25
+ fetchParamsPlugin(fetchParams),
26
+ pipeline ?? [
27
+ queryPlugin,
28
+ mutationPlugin
29
+ ].concat(
30
+ plugins ?? [],
31
+ pluginsFromPlugins,
32
+ fetchPlugin()
33
+ )
31
34
  )
32
35
  );
33
36
  this.url = url;
@@ -41,16 +44,38 @@ class HoudiniClient {
41
44
  return new DocumentStore({
42
45
  client: this,
43
46
  artifact,
44
- plugins: this.#plugins,
47
+ plugins: createPluginHooks(this.#plugins),
45
48
  cache,
46
49
  initialValue,
47
50
  fetching
48
51
  });
49
52
  }
50
53
  }
54
+ function createPluginHooks(plugins) {
55
+ return plugins.reduce((hooks, plugin) => {
56
+ const result = plugin();
57
+ if (!result) {
58
+ return hooks;
59
+ }
60
+ if (!Array.isArray(result)) {
61
+ return hooks.concat(result);
62
+ }
63
+ for (const value of result) {
64
+ if (!value) {
65
+ continue;
66
+ }
67
+ if (typeof value === "function") {
68
+ return hooks.concat(createPluginHooks([value]));
69
+ }
70
+ hooks.push(value);
71
+ }
72
+ return hooks;
73
+ }, []);
74
+ }
51
75
  export {
52
76
  DocumentStore2 as DocumentStore,
53
77
  HoudiniClient,
78
+ createPluginHooks,
54
79
  fetchPlugin2 as fetchPlugin,
55
80
  mutationPlugin2 as mutationPlugin,
56
81
  queryPlugin2 as queryPlugin,
@@ -1,3 +1,4 @@
1
+ import type { NestedList } from '../../lib/types';
1
2
  import type { ClientPlugin } from '../documentStore';
2
- declare const plugins: ClientPlugin[];
3
+ declare const plugins: NestedList<ClientPlugin>;
3
4
  export default plugins;
@@ -1,3 +1,3 @@
1
1
  import type { ArtifactKind } from '../../lib/types';
2
- import type { ClientPlugin } from '../documentStore';
3
- export declare const documentPlugin: (kind: ArtifactKind, source: ClientPlugin) => ClientPlugin;
2
+ import type { ClientPlugin, ClientHooks } from '../documentStore';
3
+ export declare const documentPlugin: (kind: ArtifactKind, source: () => ClientHooks) => ClientPlugin;
@@ -0,0 +1,2 @@
1
+ import type { NestedList } from './types';
2
+ export declare function flatten<T>(source?: NestedList<T>): T[];
@@ -0,0 +1,17 @@
1
+ function flatten(source) {
2
+ if (!source) {
3
+ return [];
4
+ }
5
+ return source.reduce((acc, element) => {
6
+ if (!element) {
7
+ return acc;
8
+ }
9
+ if (Array.isArray(element)) {
10
+ return acc.concat(flatten(element));
11
+ }
12
+ return acc.concat(element);
13
+ }, []);
14
+ }
15
+ export {
16
+ flatten
17
+ };
@@ -182,4 +182,5 @@ export type RequestPayload<GraphQLObject = any> = {
182
182
  message: string;
183
183
  }[] | null;
184
184
  };
185
+ export type NestedList<_Result = string> = (_Result | null | NestedList<_Result>)[];
185
186
  export {};
@@ -64,8 +64,8 @@ Please acknowledge this by setting acceptImperativeInstability to true in your c
64
64
  });
65
65
  return;
66
66
  }
67
- markStale(type, options = {}) {
68
- return this._internal_unstable.markTypeStale(type, options);
67
+ markStale(type, options) {
68
+ return this._internal_unstable.markTypeStale(type ? { ...options, type } : void 0);
69
69
  }
70
70
  }
71
71
  export {
@@ -34,8 +34,7 @@ export declare class Record<Def extends CacheTypeDef, Type extends ValidTypes<De
34
34
  * @param field
35
35
  * @param when
36
36
  */
37
- markStale<Field extends TypeFieldNames<Def, Type>>({ field, when, }?: {
38
- field?: Field;
37
+ markStale<Field extends TypeFieldNames<Def, Type>>(field?: Field, { when, }?: {
39
38
  when?: ArgType<Def, Type, Field>;
40
39
  }): void;
41
40
  }
@@ -54,8 +54,7 @@ class Record {
54
54
  delete() {
55
55
  this.#cache._internal_unstable.delete(this.#id);
56
56
  }
57
- markStale({
58
- field,
57
+ markStale(field, {
59
58
  when
60
59
  } = {}) {
61
60
  this.#cache._internal_unstable.markRecordStale(this.#id, { field, when });
@@ -54058,7 +54058,7 @@ async function runPipeline(config2, pipeline, target) {
54058
54058
  // src/lib/config.ts
54059
54059
  var graphql = __toESM(require_graphql2(), 1);
54060
54060
  var import_minimatch = __toESM(require_minimatch(), 1);
54061
- var import_url = require("url");
54061
+ var import_node_url = require("node:url");
54062
54062
 
54063
54063
  // src/runtime/lib/config.ts
54064
54064
  function defaultConfigValues(file) {
@@ -54155,10 +54155,10 @@ __export(fs_exports, {
54155
54155
  writeFile: () => writeFile
54156
54156
  });
54157
54157
  var import_fs_extra = __toESM(require_lib2(), 1);
54158
- var import_promises = __toESM(require("fs/promises"), 1);
54159
54158
  var import_glob = __toESM(require_glob(), 1);
54160
54159
  var import_memfs = __toESM(require_lib(), 1);
54161
- var import_util = require("util");
54160
+ var import_promises = __toESM(require("node:fs/promises"), 1);
54161
+ var import_node_util = require("node:util");
54162
54162
 
54163
54163
  // src/lib/path.ts
54164
54164
  var path_exports = {};
@@ -54175,36 +54175,36 @@ __export(path_exports, {
54175
54175
  resolve: () => resolve,
54176
54176
  sep: () => sep
54177
54177
  });
54178
- var import_os = __toESM(require("os"), 1);
54179
- var import_path = __toESM(require("path"), 1);
54178
+ var import_node_os = __toESM(require("node:os"), 1);
54179
+ var import_node_path = __toESM(require("node:path"), 1);
54180
54180
  var sep = "/";
54181
54181
  function resolve(...parts) {
54182
- return posixify(import_path.default.resolve(...parts));
54182
+ return posixify(import_node_path.default.resolve(...parts));
54183
54183
  }
54184
54184
  function join(...parts) {
54185
- return posixify(import_path.default.join(...parts));
54185
+ return posixify(import_node_path.default.join(...parts));
54186
54186
  }
54187
54187
  function extname(target) {
54188
- return import_path.default.extname(target);
54188
+ return import_node_path.default.extname(target);
54189
54189
  }
54190
54190
  function relative(from, to) {
54191
- return posixify(import_path.default.relative(from, to));
54191
+ return posixify(import_node_path.default.relative(from, to));
54192
54192
  }
54193
54193
  function basename(target) {
54194
- return import_path.default.basename(target);
54194
+ return import_node_path.default.basename(target);
54195
54195
  }
54196
54196
  function dirname(target) {
54197
- return import_path.default.dirname(target);
54197
+ return import_node_path.default.dirname(target);
54198
54198
  }
54199
54199
  function isAbsolute(target) {
54200
- return import_path.default.isAbsolute(target);
54200
+ return import_node_path.default.isAbsolute(target);
54201
54201
  }
54202
54202
  function parse(target) {
54203
- return import_path.default.parse(target);
54203
+ return import_node_path.default.parse(target);
54204
54204
  }
54205
54205
  var posixify = (str) => str.replace(/\\/g, "/");
54206
54206
  function importPath(target) {
54207
- return ["win32", "win64"].includes(import_os.default.platform()) ? "file:///" + target : target;
54207
+ return ["win32", "win64"].includes(import_node_os.default.platform()) ? "file:///" + target : target;
54208
54208
  }
54209
54209
 
54210
54210
  // src/lib/fs.ts
@@ -54328,7 +54328,7 @@ async function rmdir(filepath) {
54328
54328
  recursive: true
54329
54329
  });
54330
54330
  }
54331
- return await (0, import_util.promisify)(import_memfs.fs.rmdir)(filepath);
54331
+ return await (0, import_node_util.promisify)(import_memfs.fs.rmdir)(filepath);
54332
54332
  }
54333
54333
  async function stat(filepath) {
54334
54334
  if (!houdini_mode.is_testing) {
@@ -54406,7 +54406,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
54406
54406
  }
54407
54407
  }
54408
54408
  async function glob(pattern) {
54409
- return await (0, import_util.promisify)(import_glob.glob)(posixify(pattern));
54409
+ return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
54410
54410
  }
54411
54411
  glob.hasMagic = import_glob.glob.hasMagic;
54412
54412
 
@@ -54421,7 +54421,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
54421
54421
 
54422
54422
  // src/lib/config.ts
54423
54423
  var import_meta = {};
54424
- var currentDir = global.__dirname || dirname((0, import_url.fileURLToPath)(import_meta.url));
54424
+ var currentDir = global.__dirname || dirname((0, import_node_url.fileURLToPath)(import_meta.url));
54425
54425
  var Config = class {
54426
54426
  filepath;
54427
54427
  rootDir;
@@ -54924,8 +54924,8 @@ function findModule(pkg = "houdini", currentLocation) {
54924
54924
  }
54925
54925
 
54926
54926
  // src/lib/graphql.ts
54927
- var import_crypto = __toESM(require("crypto"), 1);
54928
54927
  var graphql2 = __toESM(require_graphql2(), 1);
54928
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
54929
54929
  function getRootType(type) {
54930
54930
  if (graphql2.isNonNullType(type)) {
54931
54931
  return getRootType(type.ofType);
@@ -54939,7 +54939,7 @@ function hashDocument({
54939
54939
  document
54940
54940
  }) {
54941
54941
  const docString = typeof document === "string" ? document : document.artifact?.raw;
54942
- return import_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
54942
+ return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
54943
54943
  }
54944
54944
  function parentTypeFromAncestors(schema, filepath, ancestors) {
54945
54945
  const parents = [...ancestors];
@@ -54054,7 +54054,7 @@ async function runPipeline(config2, pipeline, target) {
54054
54054
  // src/lib/config.ts
54055
54055
  var graphql = __toESM(require_graphql2(), 1);
54056
54056
  var import_minimatch = __toESM(require_minimatch(), 1);
54057
- import { fileURLToPath, pathToFileURL } from "url";
54057
+ import { fileURLToPath, pathToFileURL } from "node:url";
54058
54058
 
54059
54059
  // src/runtime/lib/config.ts
54060
54060
  function defaultConfigValues(file) {
@@ -54153,8 +54153,8 @@ __export(fs_exports, {
54153
54153
  var import_fs_extra = __toESM(require_lib2(), 1);
54154
54154
  var import_glob = __toESM(require_glob(), 1);
54155
54155
  var import_memfs = __toESM(require_lib(), 1);
54156
- import fs from "fs/promises";
54157
- import { promisify } from "util";
54156
+ import fs from "node:fs/promises";
54157
+ import { promisify } from "node:util";
54158
54158
 
54159
54159
  // src/lib/path.ts
54160
54160
  var path_exports = {};
@@ -54171,8 +54171,8 @@ __export(path_exports, {
54171
54171
  resolve: () => resolve,
54172
54172
  sep: () => sep
54173
54173
  });
54174
- import os from "os";
54175
- import path from "path";
54174
+ import os from "node:os";
54175
+ import path from "node:path";
54176
54176
  var sep = "/";
54177
54177
  function resolve(...parts) {
54178
54178
  return posixify(path.resolve(...parts));
@@ -54920,7 +54920,7 @@ function findModule(pkg = "houdini", currentLocation) {
54920
54920
 
54921
54921
  // src/lib/graphql.ts
54922
54922
  var graphql2 = __toESM(require_graphql2(), 1);
54923
- import crypto from "crypto";
54923
+ import crypto from "node:crypto";
54924
54924
  function getRootType(type) {
54925
54925
  if (graphql2.isNonNullType(type)) {
54926
54926
  return getRootType(type.ofType);
@@ -65185,7 +65185,7 @@ function mergeSchemas(config4) {
65185
65185
  // src/lib/config.ts
65186
65186
  var graphql2 = __toESM(require_graphql2(), 1);
65187
65187
  var import_minimatch = __toESM(require_minimatch(), 1);
65188
- var import_url = require("url");
65188
+ var import_node_url2 = require("node:url");
65189
65189
 
65190
65190
  // src/runtime/lib/config.ts
65191
65191
  function defaultConfigValues(file) {
@@ -65288,10 +65288,10 @@ __export(fs_exports, {
65288
65288
  writeFile: () => writeFile
65289
65289
  });
65290
65290
  var import_fs_extra = __toESM(require_lib(), 1);
65291
- var import_promises = __toESM(require("fs/promises"), 1);
65292
65291
  var import_glob = __toESM(require_glob(), 1);
65293
65292
  var import_memfs = __toESM(require_lib2(), 1);
65294
- var import_util = require("util");
65293
+ var import_promises = __toESM(require("node:fs/promises"), 1);
65294
+ var import_node_util = require("node:util");
65295
65295
 
65296
65296
  // src/lib/path.ts
65297
65297
  var path_exports = {};
@@ -65308,36 +65308,36 @@ __export(path_exports, {
65308
65308
  resolve: () => resolve,
65309
65309
  sep: () => sep
65310
65310
  });
65311
- var import_os = __toESM(require("os"), 1);
65312
- var import_path = __toESM(require("path"), 1);
65311
+ var import_node_os = __toESM(require("node:os"), 1);
65312
+ var import_node_path = __toESM(require("node:path"), 1);
65313
65313
  var sep = "/";
65314
65314
  function resolve(...parts) {
65315
- return posixify(import_path.default.resolve(...parts));
65315
+ return posixify(import_node_path.default.resolve(...parts));
65316
65316
  }
65317
65317
  function join2(...parts) {
65318
- return posixify(import_path.default.join(...parts));
65318
+ return posixify(import_node_path.default.join(...parts));
65319
65319
  }
65320
65320
  function extname(target) {
65321
- return import_path.default.extname(target);
65321
+ return import_node_path.default.extname(target);
65322
65322
  }
65323
65323
  function relative(from, to) {
65324
- return posixify(import_path.default.relative(from, to));
65324
+ return posixify(import_node_path.default.relative(from, to));
65325
65325
  }
65326
65326
  function basename(target) {
65327
- return import_path.default.basename(target);
65327
+ return import_node_path.default.basename(target);
65328
65328
  }
65329
65329
  function dirname(target) {
65330
- return import_path.default.dirname(target);
65330
+ return import_node_path.default.dirname(target);
65331
65331
  }
65332
65332
  function isAbsolute(target) {
65333
- return import_path.default.isAbsolute(target);
65333
+ return import_node_path.default.isAbsolute(target);
65334
65334
  }
65335
65335
  function parse2(target) {
65336
- return import_path.default.parse(target);
65336
+ return import_node_path.default.parse(target);
65337
65337
  }
65338
65338
  var posixify = (str) => str.replace(/\\/g, "/");
65339
65339
  function importPath(target) {
65340
- return ["win32", "win64"].includes(import_os.default.platform()) ? "file:///" + target : target;
65340
+ return ["win32", "win64"].includes(import_node_os.default.platform()) ? "file:///" + target : target;
65341
65341
  }
65342
65342
 
65343
65343
  // src/lib/fs.ts
@@ -65461,7 +65461,7 @@ async function rmdir(filepath) {
65461
65461
  recursive: true
65462
65462
  });
65463
65463
  }
65464
- return await (0, import_util.promisify)(import_memfs.fs.rmdir)(filepath);
65464
+ return await (0, import_node_util.promisify)(import_memfs.fs.rmdir)(filepath);
65465
65465
  }
65466
65466
  async function stat(filepath) {
65467
65467
  if (!houdini_mode.is_testing) {
@@ -65539,7 +65539,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
65539
65539
  }
65540
65540
  }
65541
65541
  async function glob(pattern) {
65542
- return await (0, import_util.promisify)(import_glob.glob)(posixify(pattern));
65542
+ return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
65543
65543
  }
65544
65544
  glob.hasMagic = import_glob.glob.hasMagic;
65545
65545
 
@@ -65594,7 +65594,7 @@ var dist_default = dataUriToBuffer;
65594
65594
 
65595
65595
  // ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/body.js
65596
65596
  var import_node_stream = __toESM(require("node:stream"), 1);
65597
- var import_node_util = require("node:util");
65597
+ var import_node_util2 = require("node:util");
65598
65598
  var import_node_buffer = require("node:buffer");
65599
65599
  init_fetch_blob();
65600
65600
  init_esm_min();
@@ -65648,7 +65648,7 @@ var isSameProtocol = (destination, original) => {
65648
65648
  };
65649
65649
 
65650
65650
  // ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/body.js
65651
- var pipeline = (0, import_node_util.promisify)(import_node_stream.default.pipeline);
65651
+ var pipeline = (0, import_node_util2.promisify)(import_node_stream.default.pipeline);
65652
65652
  var INTERNALS = Symbol("Body internals");
65653
65653
  var Body = class {
65654
65654
  constructor(body, {
@@ -65661,7 +65661,7 @@ var Body = class {
65661
65661
  body = import_node_buffer.Buffer.from(body.toString());
65662
65662
  } else if (isBlob(body)) {
65663
65663
  } else if (import_node_buffer.Buffer.isBuffer(body)) {
65664
- } else if (import_node_util.types.isAnyArrayBuffer(body)) {
65664
+ } else if (import_node_util2.types.isAnyArrayBuffer(body)) {
65665
65665
  body = import_node_buffer.Buffer.from(body);
65666
65666
  } else if (ArrayBuffer.isView(body)) {
65667
65667
  body = import_node_buffer.Buffer.from(body.buffer, body.byteOffset, body.byteLength);
@@ -65735,7 +65735,7 @@ var Body = class {
65735
65735
  return consumeBody(this);
65736
65736
  }
65737
65737
  };
65738
- Body.prototype.buffer = (0, import_node_util.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
65738
+ Body.prototype.buffer = (0, import_node_util2.deprecate)(Body.prototype.buffer, "Please use 'response.arrayBuffer()' instead of 'response.buffer()'", "node-fetch#buffer");
65739
65739
  Object.defineProperties(Body.prototype, {
65740
65740
  body: { enumerable: true },
65741
65741
  bodyUsed: { enumerable: true },
@@ -65743,7 +65743,7 @@ Object.defineProperties(Body.prototype, {
65743
65743
  blob: { enumerable: true },
65744
65744
  json: { enumerable: true },
65745
65745
  text: { enumerable: true },
65746
- data: { get: (0, import_node_util.deprecate)(
65746
+ data: { get: (0, import_node_util2.deprecate)(
65747
65747
  () => {
65748
65748
  },
65749
65749
  "data doesn't exist, use json(), text(), arrayBuffer(), or body instead",
@@ -65811,7 +65811,7 @@ var clone = (instance, highWaterMark) => {
65811
65811
  }
65812
65812
  return body;
65813
65813
  };
65814
- var getNonSpecFormDataBoundary = (0, import_node_util.deprecate)(
65814
+ var getNonSpecFormDataBoundary = (0, import_node_util2.deprecate)(
65815
65815
  (body) => body.getBoundary(),
65816
65816
  "form-data doesn't follow the spec and requires special treatment. Use alternative package",
65817
65817
  "https://github.com/node-fetch/node-fetch/issues/1167"
@@ -65829,7 +65829,7 @@ var extractContentType = (body, request) => {
65829
65829
  if (isBlob(body)) {
65830
65830
  return body.type || null;
65831
65831
  }
65832
- if (import_node_buffer.Buffer.isBuffer(body) || import_node_util.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
65832
+ if (import_node_buffer.Buffer.isBuffer(body) || import_node_util2.types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
65833
65833
  return null;
65834
65834
  }
65835
65835
  if (body instanceof FormData) {
@@ -65868,7 +65868,7 @@ var writeToStream = async (dest, { body }) => {
65868
65868
  };
65869
65869
 
65870
65870
  // ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/headers.js
65871
- var import_node_util2 = require("node:util");
65871
+ var import_node_util3 = require("node:util");
65872
65872
  var import_node_http = __toESM(require("node:http"), 1);
65873
65873
  var validateHeaderName = typeof import_node_http.default.validateHeaderName === "function" ? import_node_http.default.validateHeaderName : (name) => {
65874
65874
  if (!/^[\^`\-\w!#$%&'*+.|~]+$/.test(name)) {
@@ -65893,7 +65893,7 @@ var Headers = class extends URLSearchParams {
65893
65893
  result.push(...values.map((value) => [name, value]));
65894
65894
  }
65895
65895
  } else if (init == null) {
65896
- } else if (typeof init === "object" && !import_node_util2.types.isBoxedPrimitive(init)) {
65896
+ } else if (typeof init === "object" && !import_node_util3.types.isBoxedPrimitive(init)) {
65897
65897
  const method = init[Symbol.iterator];
65898
65898
  if (method == null) {
65899
65899
  result.push(...Object.entries(init));
@@ -65902,7 +65902,7 @@ var Headers = class extends URLSearchParams {
65902
65902
  throw new TypeError("Header pairs must be iterable");
65903
65903
  }
65904
65904
  result = [...init].map((pair) => {
65905
- if (typeof pair !== "object" || import_node_util2.types.isBoxedPrimitive(pair)) {
65905
+ if (typeof pair !== "object" || import_node_util3.types.isBoxedPrimitive(pair)) {
65906
65906
  throw new TypeError("Each header pair must be an iterable object");
65907
65907
  }
65908
65908
  return [...pair];
@@ -66149,7 +66149,7 @@ Object.defineProperties(Response.prototype, {
66149
66149
 
66150
66150
  // ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/request.js
66151
66151
  var import_node_url = require("node:url");
66152
- var import_node_util3 = require("node:util");
66152
+ var import_node_util4 = require("node:util");
66153
66153
 
66154
66154
  // ../../node_modules/.pnpm/node-fetch@3.3.0/node_modules/node-fetch/src/utils/get-search.js
66155
66155
  var getSearch = (parsedURL) => {
@@ -66306,7 +66306,7 @@ var INTERNALS3 = Symbol("Request internals");
66306
66306
  var isRequest = (object) => {
66307
66307
  return typeof object === "object" && typeof object[INTERNALS3] === "object";
66308
66308
  };
66309
- var doBadDataWarn = (0, import_node_util3.deprecate)(
66309
+ var doBadDataWarn = (0, import_node_util4.deprecate)(
66310
66310
  () => {
66311
66311
  },
66312
66312
  ".data is not a valid RequestInit property, use .body instead",
@@ -66810,7 +66810,7 @@ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
66810
66810
 
66811
66811
  // src/lib/config.ts
66812
66812
  var import_meta = {};
66813
- var currentDir = global.__dirname || dirname((0, import_url.fileURLToPath)(import_meta.url));
66813
+ var currentDir = global.__dirname || dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
66814
66814
  var Config = class {
66815
66815
  filepath;
66816
66816
  rootDir;
@@ -67301,13 +67301,16 @@ var pendingConfigPromise = null;
67301
67301
  async function getConfig({
67302
67302
  configPath = DEFAULT_CONFIG_PATH,
67303
67303
  noSchema,
67304
+ forceReload,
67304
67305
  ...extraConfig
67305
67306
  } = {}) {
67306
- if (_config) {
67307
- return _config;
67308
- }
67309
- if (pendingConfigPromise) {
67310
- return await pendingConfigPromise;
67307
+ if (!forceReload) {
67308
+ if (_config) {
67309
+ return _config;
67310
+ }
67311
+ if (pendingConfigPromise) {
67312
+ return await pendingConfigPromise;
67313
+ }
67311
67314
  }
67312
67315
  let resolve2 = () => {
67313
67316
  };
@@ -67325,7 +67328,7 @@ async function getConfig({
67325
67328
  if (!pluginName.startsWith(".")) {
67326
67329
  pluginFile = await pluginPath(pluginName, configPath);
67327
67330
  }
67328
- const { default: pluginInit } = await import((0, import_url.pathToFileURL)(pluginFile).toString());
67331
+ const { default: pluginInit } = await import((0, import_node_url2.pathToFileURL)(pluginFile).toString());
67329
67332
  if (!pluginInit.plugin || !pluginInit.name) {
67330
67333
  throw new HoudiniError({
67331
67334
  filepath: pluginFile,
@@ -67502,8 +67505,8 @@ async function loadSchemaFile(schemaPath) {
67502
67505
  }
67503
67506
 
67504
67507
  // src/lib/graphql.ts
67505
- var import_crypto = __toESM(require("crypto"), 1);
67506
67508
  var graphql3 = __toESM(require_graphql2(), 1);
67509
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
67507
67510
  function getRootType(type) {
67508
67511
  if (graphql3.isNonNullType(type)) {
67509
67512
  return getRootType(type.ofType);
@@ -67517,7 +67520,7 @@ function hashDocument({
67517
67520
  document
67518
67521
  }) {
67519
67522
  const docString = typeof document === "string" ? document : document.artifact?.raw;
67520
- return import_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
67523
+ return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
67521
67524
  }
67522
67525
  function parentTypeFromAncestors(schema, filepath, ancestors) {
67523
67526
  const parents = [...ancestors];
@@ -73175,9 +73178,10 @@ function vite_default(opts) {
73175
73178
  name: "Houdini",
73176
73179
  quiet: true,
73177
73180
  async watchFile(filepath) {
73178
- const config4 = await getConfig(opts);
73181
+ let config4 = await getConfig(opts);
73179
73182
  const schemaPath = path_exports.join(path_exports.dirname(config4.filepath), config4.schemaPath);
73180
73183
  if ((0, import_minimatch2.default)(filepath, schemaPath)) {
73184
+ config4 = await getConfig({ ...opts, forceReload: true });
73181
73185
  return true;
73182
73186
  }
73183
73187
  return config4.includeFile(filepath, { root: process.cwd() });
@@ -65180,7 +65180,7 @@ function mergeSchemas(config4) {
65180
65180
  // src/lib/config.ts
65181
65181
  var graphql2 = __toESM(require_graphql2(), 1);
65182
65182
  var import_minimatch = __toESM(require_minimatch(), 1);
65183
- import { fileURLToPath, pathToFileURL } from "url";
65183
+ import { fileURLToPath, pathToFileURL } from "node:url";
65184
65184
 
65185
65185
  // src/runtime/lib/config.ts
65186
65186
  function defaultConfigValues(file) {
@@ -65285,8 +65285,8 @@ __export(fs_exports, {
65285
65285
  var import_fs_extra = __toESM(require_lib(), 1);
65286
65286
  var import_glob = __toESM(require_glob(), 1);
65287
65287
  var import_memfs = __toESM(require_lib2(), 1);
65288
- import fs from "fs/promises";
65289
- import { promisify } from "util";
65288
+ import fs from "node:fs/promises";
65289
+ import { promisify } from "node:util";
65290
65290
 
65291
65291
  // src/lib/path.ts
65292
65292
  var path_exports = {};
@@ -65303,8 +65303,8 @@ __export(path_exports, {
65303
65303
  resolve: () => resolve,
65304
65304
  sep: () => sep
65305
65305
  });
65306
- import os from "os";
65307
- import path from "path";
65306
+ import os from "node:os";
65307
+ import path from "node:path";
65308
65308
  var sep = "/";
65309
65309
  function resolve(...parts) {
65310
65310
  return posixify(path.resolve(...parts));
@@ -67295,13 +67295,16 @@ var pendingConfigPromise = null;
67295
67295
  async function getConfig({
67296
67296
  configPath = DEFAULT_CONFIG_PATH,
67297
67297
  noSchema,
67298
+ forceReload,
67298
67299
  ...extraConfig
67299
67300
  } = {}) {
67300
- if (_config) {
67301
- return _config;
67302
- }
67303
- if (pendingConfigPromise) {
67304
- return await pendingConfigPromise;
67301
+ if (!forceReload) {
67302
+ if (_config) {
67303
+ return _config;
67304
+ }
67305
+ if (pendingConfigPromise) {
67306
+ return await pendingConfigPromise;
67307
+ }
67305
67308
  }
67306
67309
  let resolve2 = () => {
67307
67310
  };
@@ -67497,7 +67500,7 @@ async function loadSchemaFile(schemaPath) {
67497
67500
 
67498
67501
  // src/lib/graphql.ts
67499
67502
  var graphql3 = __toESM(require_graphql2(), 1);
67500
- import crypto from "crypto";
67503
+ import crypto from "node:crypto";
67501
67504
  function getRootType(type) {
67502
67505
  if (graphql3.isNonNullType(type)) {
67503
67506
  return getRootType(type.ofType);
@@ -73169,9 +73172,10 @@ function vite_default(opts) {
73169
73172
  name: "Houdini",
73170
73173
  quiet: true,
73171
73174
  async watchFile(filepath) {
73172
- const config4 = await getConfig(opts);
73175
+ let config4 = await getConfig(opts);
73173
73176
  const schemaPath = path_exports.join(path_exports.dirname(config4.filepath), config4.schemaPath);
73174
73177
  if ((0, import_minimatch2.default)(filepath, schemaPath)) {
73178
+ config4 = await getConfig({ ...opts, forceReload: true });
73175
73179
  return true;
73176
73180
  }
73177
73181
  return config4.includeFile(filepath, { root: process.cwd() });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.0.0-next.7",
3
+ "version": "1.0.0-next.8",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",
@@ -16,15 +16,15 @@
16
16
  "license": "MIT",
17
17
  "type": "module",
18
18
  "devDependencies": {
19
- "@trivago/prettier-plugin-sort-imports": "^3.3.0",
19
+ "@trivago/prettier-plugin-sort-imports": "^4.0.0",
20
20
  "@types/glob": "^8.0.0",
21
21
  "@types/minimatch": "^5.1.2",
22
22
  "@types/node": "^18.7.23",
23
- "prettier": "^2.5.1",
23
+ "prettier": "^2.8.3",
24
24
  "rollup": "^3.7.4",
25
25
  "turbo": "^1.5.4",
26
26
  "vite": "^4.0.4",
27
- "vitest": "^0.23.4",
27
+ "vitest": "^0.28.3",
28
28
  "scripts": "^1.0.0"
29
29
  },
30
30
  "dependencies": {