houdini 0.17.5 → 0.17.6

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 (40) hide show
  1. package/.turbo/turbo-compile.log +2 -2
  2. package/.turbo/turbo-typedefs.log +2 -2
  3. package/CHANGELOG.md +12 -0
  4. package/build/cmd/init.d.ts +2 -2
  5. package/build/cmd-cjs/index.js +222 -188
  6. package/build/cmd-esm/index.js +222 -188
  7. package/build/codegen-cjs/index.js +84 -31
  8. package/build/codegen-esm/index.js +84 -31
  9. package/build/lib/constants.d.ts +7 -0
  10. package/build/lib/fs.d.ts +2 -0
  11. package/build/lib-cjs/index.js +87 -32
  12. package/build/lib-esm/index.js +86 -32
  13. package/build/runtime/cache/subscription.d.ts +2 -1
  14. package/build/runtime/lib/network.d.ts +4 -2
  15. package/build/runtime-cjs/cache/cache.js +5 -3
  16. package/build/runtime-cjs/cache/subscription.d.ts +2 -1
  17. package/build/runtime-cjs/cache/subscription.js +6 -4
  18. package/build/runtime-cjs/cache/tests/subscriptions.test.js +101 -0
  19. package/build/runtime-cjs/lib/network.d.ts +4 -2
  20. package/build/runtime-cjs/lib/network.js +8 -4
  21. package/build/runtime-esm/cache/cache.js +5 -3
  22. package/build/runtime-esm/cache/subscription.d.ts +2 -1
  23. package/build/runtime-esm/cache/subscription.js +6 -4
  24. package/build/runtime-esm/cache/tests/subscriptions.test.js +101 -0
  25. package/build/runtime-esm/lib/network.d.ts +4 -2
  26. package/build/runtime-esm/lib/network.js +8 -4
  27. package/build/test-cjs/index.js +86 -33
  28. package/build/test-esm/index.js +86 -33
  29. package/build/vite-cjs/index.js +86 -33
  30. package/build/vite-esm/index.js +86 -33
  31. package/package.json +1 -1
  32. package/src/cmd/init.ts +169 -187
  33. package/src/codegen/generators/runtime/index.ts +2 -2
  34. package/src/lib/config.ts +3 -2
  35. package/src/lib/constants.ts +10 -0
  36. package/src/lib/fs.ts +59 -12
  37. package/src/runtime/cache/cache.ts +3 -1
  38. package/src/runtime/cache/subscription.ts +6 -4
  39. package/src/runtime/cache/tests/subscriptions.test.ts +115 -0
  40. package/src/runtime/lib/network.ts +11 -5
@@ -16077,8 +16077,8 @@ var require_graceful_fs = __commonJS({
16077
16077
  }
16078
16078
  var fs$copyFile = fs3.copyFile;
16079
16079
  if (fs$copyFile)
16080
- fs3.copyFile = copyFile;
16081
- function copyFile(src, dest, flags, cb) {
16080
+ fs3.copyFile = copyFile2;
16081
+ function copyFile2(src, dest, flags, cb) {
16082
16082
  if (typeof flags === "function") {
16083
16083
  cb = flags;
16084
16084
  flags = 0;
@@ -16751,7 +16751,7 @@ var require_copy = __commonJS({
16751
16751
  }
16752
16752
  function onFile(srcStat, destStat, src, dest, opts, cb) {
16753
16753
  if (!destStat)
16754
- return copyFile(srcStat, src, dest, opts, cb);
16754
+ return copyFile2(srcStat, src, dest, opts, cb);
16755
16755
  return mayCopyFile(srcStat, src, dest, opts, cb);
16756
16756
  }
16757
16757
  function mayCopyFile(srcStat, src, dest, opts, cb) {
@@ -16759,14 +16759,14 @@ var require_copy = __commonJS({
16759
16759
  fs2.unlink(dest, (err) => {
16760
16760
  if (err)
16761
16761
  return cb(err);
16762
- return copyFile(srcStat, src, dest, opts, cb);
16762
+ return copyFile2(srcStat, src, dest, opts, cb);
16763
16763
  });
16764
16764
  } else if (opts.errorOnExist) {
16765
16765
  return cb(new Error(`'${dest}' already exists`));
16766
16766
  } else
16767
16767
  return cb();
16768
16768
  }
16769
- function copyFile(srcStat, src, dest, opts, cb) {
16769
+ function copyFile2(srcStat, src, dest, opts, cb) {
16770
16770
  fs2.copyFile(src, dest, (err) => {
16771
16771
  if (err)
16772
16772
  return cb(err);
@@ -16949,18 +16949,18 @@ var require_copy_sync = __commonJS({
16949
16949
  }
16950
16950
  function onFile(srcStat, destStat, src, dest, opts) {
16951
16951
  if (!destStat)
16952
- return copyFile(srcStat, src, dest, opts);
16952
+ return copyFile2(srcStat, src, dest, opts);
16953
16953
  return mayCopyFile(srcStat, src, dest, opts);
16954
16954
  }
16955
16955
  function mayCopyFile(srcStat, src, dest, opts) {
16956
16956
  if (opts.overwrite) {
16957
16957
  fs2.unlinkSync(dest);
16958
- return copyFile(srcStat, src, dest, opts);
16958
+ return copyFile2(srcStat, src, dest, opts);
16959
16959
  } else if (opts.errorOnExist) {
16960
16960
  throw new Error(`'${dest}' already exists`);
16961
16961
  }
16962
16962
  }
16963
- function copyFile(srcStat, src, dest, opts) {
16963
+ function copyFile2(srcStat, src, dest, opts) {
16964
16964
  fs2.copyFileSync(src, dest);
16965
16965
  if (opts.preserveTimestamps)
16966
16966
  handleTimestamps(srcStat.mode, src, dest);
@@ -54349,10 +54349,11 @@ var InMemorySubscriptions = class {
54349
54349
  parent,
54350
54350
  selection: selection2,
54351
54351
  variables,
54352
- subscribers
54352
+ subscribers,
54353
+ parentType
54353
54354
  }) {
54354
54355
  for (const fieldSelection of Object.values(selection2)) {
54355
- const { keyRaw, fields } = fieldSelection;
54356
+ const { type: linkedType, keyRaw, fields } = fieldSelection;
54356
54357
  const key = evaluateKey(keyRaw, variables);
54357
54358
  for (const spec of subscribers) {
54358
54359
  this.addFieldSubscription({
@@ -54360,7 +54361,7 @@ var InMemorySubscriptions = class {
54360
54361
  key,
54361
54362
  selection: fieldSelection,
54362
54363
  spec,
54363
- parentType: "asdf",
54364
+ parentType,
54364
54365
  variables
54365
54366
  });
54366
54367
  }
@@ -54375,7 +54376,8 @@ var InMemorySubscriptions = class {
54375
54376
  parent: linkedRecord,
54376
54377
  selection: fields,
54377
54378
  variables,
54378
- subscribers
54379
+ subscribers,
54380
+ parentType: linkedType
54379
54381
  });
54380
54382
  }
54381
54383
  }
@@ -54555,7 +54557,7 @@ var CacheInternal = class {
54555
54557
  this.cache = cache;
54556
54558
  this.lifetimes = lifetimes;
54557
54559
  try {
54558
- this._disabled = process.env.TEST !== "true";
54560
+ this._disabled = process.env.HOUDINI_TEST !== "true";
54559
54561
  } catch {
54560
54562
  this._disabled = typeof globalThis.window === "undefined";
54561
54563
  }
@@ -54653,7 +54655,8 @@ var CacheInternal = class {
54653
54655
  parent: linkedID,
54654
54656
  selection: fields,
54655
54657
  subscribers: currentSubscribers,
54656
- variables
54658
+ variables,
54659
+ parentType: linkedType
54657
54660
  });
54658
54661
  toNotify.push(...currentSubscribers);
54659
54662
  }
@@ -54759,7 +54762,8 @@ var CacheInternal = class {
54759
54762
  parent: id,
54760
54763
  selection: fields,
54761
54764
  subscribers: currentSubscribers,
54762
- variables
54765
+ variables,
54766
+ parentType: linkedType
54763
54767
  });
54764
54768
  }
54765
54769
  }
@@ -55044,6 +55048,14 @@ var CompiledMutationKind = "HoudiniMutation" /* Mutation */;
55044
55048
  var CompiledQueryKind = "HoudiniQuery" /* Query */;
55045
55049
  var CompiledSubscriptionKind = "HoudiniSubscription" /* Subscription */;
55046
55050
 
55051
+ // src/lib/constants.ts
55052
+ var siteURL = "https://houdinigraphql.com";
55053
+ var houdini_mode = {
55054
+ get is_testing() {
55055
+ return process.env.HOUDINI_TEST === "true";
55056
+ }
55057
+ };
55058
+
55047
55059
  // src/lib/error.ts
55048
55060
  var HoudiniError = class extends Error {
55049
55061
  filepath = null;
@@ -55067,6 +55079,8 @@ var HoudiniError = class extends Error {
55067
55079
  var fs_exports = {};
55068
55080
  __export(fs_exports, {
55069
55081
  access: () => access,
55082
+ copyFile: () => copyFile,
55083
+ copyFileSync: () => copyFileSync,
55070
55084
  existsSync: () => existsSync,
55071
55085
  glob: () => glob,
55072
55086
  mkdir: () => mkdir,
@@ -55136,8 +55150,50 @@ function importPath(target) {
55136
55150
  }
55137
55151
 
55138
55152
  // src/lib/fs.ts
55153
+ function copyFileSync(src, dest) {
55154
+ if (houdini_mode.is_testing) {
55155
+ try {
55156
+ if (src.includes("build/runtime") || dest.includes("build/runtime")) {
55157
+ import_fs_extra.default.copyFileSync(src, dest);
55158
+ return;
55159
+ }
55160
+ import_memfs.fs.copyFileSync(src, dest);
55161
+ return;
55162
+ } catch (e) {
55163
+ return null;
55164
+ }
55165
+ }
55166
+ try {
55167
+ import_fs_extra.default.copyFileSync(src, dest);
55168
+ return;
55169
+ } catch (e) {
55170
+ }
55171
+ return null;
55172
+ }
55173
+ async function copyFile(src, dest) {
55174
+ if (houdini_mode.is_testing) {
55175
+ try {
55176
+ if (src.includes("build/runtime") || dest.includes("build/runtime")) {
55177
+ await import_promises.default.copyFile(src, dest);
55178
+ return;
55179
+ }
55180
+ await import_memfs.fs.copyFile(src, dest, (err) => {
55181
+ throw err;
55182
+ });
55183
+ return;
55184
+ } catch (e) {
55185
+ return null;
55186
+ }
55187
+ }
55188
+ try {
55189
+ await import_promises.default.copyFile(src, dest);
55190
+ return;
55191
+ } catch (e) {
55192
+ }
55193
+ return null;
55194
+ }
55139
55195
  async function readFile(filepath) {
55140
- if (process.env.NODE_ENV === "test") {
55196
+ if (houdini_mode.is_testing) {
55141
55197
  try {
55142
55198
  if (filepath.includes("build/runtime")) {
55143
55199
  return await import_promises.default.readFile(filepath, "utf-8");
@@ -55154,7 +55210,7 @@ async function readFile(filepath) {
55154
55210
  return null;
55155
55211
  }
55156
55212
  function readFileSync(filepath) {
55157
- if (process.env.NODE_ENV === "test") {
55213
+ if (houdini_mode.is_testing) {
55158
55214
  try {
55159
55215
  if (filepath.includes("build/runtime")) {
55160
55216
  return import_fs_extra.default.readFileSync(filepath, "utf-8");
@@ -55175,13 +55231,13 @@ async function writeFile(filepath, data) {
55175
55231
  if (data === existingFileData) {
55176
55232
  return;
55177
55233
  }
55178
- if (process.env.NODE_ENV === "test") {
55234
+ if (houdini_mode.is_testing) {
55179
55235
  return import_memfs.fs.writeFileSync(filepath, data);
55180
55236
  }
55181
55237
  return await import_promises.default.writeFile(filepath, data, "utf8");
55182
55238
  }
55183
55239
  async function access(filepath) {
55184
- if (process.env.NODE_ENV !== "test") {
55240
+ if (!houdini_mode.is_testing) {
55185
55241
  return await import_promises.default.access(filepath);
55186
55242
  }
55187
55243
  if (filepath.includes("build/runtime")) {
@@ -55190,25 +55246,25 @@ async function access(filepath) {
55190
55246
  return import_memfs.fs.statSync(filepath);
55191
55247
  }
55192
55248
  async function mkdirp(filepath) {
55193
- if (process.env.NODE_ENV !== "test") {
55249
+ if (!houdini_mode.is_testing) {
55194
55250
  return await import_fs_extra.default.mkdirp(filepath);
55195
55251
  }
55196
55252
  return import_memfs.fs.mkdirpSync(filepath);
55197
55253
  }
55198
55254
  async function mkdirpSync(filepath) {
55199
- if (process.env.NODE_ENV !== "test") {
55255
+ if (!houdini_mode.is_testing) {
55200
55256
  return import_fs_extra.default.mkdirpSync(filepath);
55201
55257
  }
55202
55258
  return import_memfs.fs.mkdirpSync(filepath);
55203
55259
  }
55204
55260
  async function mkdir(filepath) {
55205
- if (process.env.NODE_ENV !== "test") {
55261
+ if (!houdini_mode.is_testing) {
55206
55262
  return await import_promises.default.mkdir(filepath);
55207
55263
  }
55208
55264
  return import_memfs.fs.mkdirSync(filepath);
55209
55265
  }
55210
55266
  async function rmdir(filepath) {
55211
- if (process.env.NODE_ENV !== "test") {
55267
+ if (!houdini_mode.is_testing) {
55212
55268
  return await import_promises.default.rm(filepath, {
55213
55269
  recursive: true
55214
55270
  });
@@ -55216,7 +55272,7 @@ async function rmdir(filepath) {
55216
55272
  return await (0, import_util.promisify)(import_memfs.fs.rmdir)(filepath);
55217
55273
  }
55218
55274
  async function stat(filepath) {
55219
- if (process.env.NODE_ENV !== "test") {
55275
+ if (!houdini_mode.is_testing) {
55220
55276
  return await import_promises.default.stat(filepath);
55221
55277
  }
55222
55278
  if (filepath.includes("build/runtime")) {
@@ -55225,13 +55281,13 @@ async function stat(filepath) {
55225
55281
  return import_memfs.fs.statSync(filepath);
55226
55282
  }
55227
55283
  function existsSync(dirPath) {
55228
- if (process.env.NODE_ENV !== "test") {
55284
+ if (!houdini_mode.is_testing) {
55229
55285
  return import_fs_extra.default.existsSync(dirPath);
55230
55286
  }
55231
55287
  return import_memfs.fs.existsSync(dirPath);
55232
55288
  }
55233
55289
  async function readdir(filepath) {
55234
- if (process.env.NODE_ENV !== "test") {
55290
+ if (!houdini_mode.is_testing) {
55235
55291
  return await import_promises.default.readdir(filepath);
55236
55292
  }
55237
55293
  if (filepath.includes("build/runtime")) {
@@ -55244,7 +55300,7 @@ async function readdir(filepath) {
55244
55300
  }
55245
55301
  }
55246
55302
  async function remove(filepath) {
55247
- if (process.env.NODE_ENV !== "test") {
55303
+ if (!houdini_mode.is_testing) {
55248
55304
  return await import_promises.default.rm(filepath);
55249
55305
  }
55250
55306
  return import_memfs.vol.rmSync(filepath);
@@ -55433,9 +55489,6 @@ function ensureImports({
55433
55489
  return Array.isArray(importID) ? toImport : toImport[0];
55434
55490
  }
55435
55491
 
55436
- // src/lib/constants.ts
55437
- var siteURL = "https://houdinigraphql.com";
55438
-
55439
55492
  // src/lib/cleanupFiles.ts
55440
55493
  async function cleanupFiles(pathFolder, listOfObj) {
55441
55494
  const listFile = await readdir(pathFolder);
@@ -57483,7 +57536,7 @@ async function runtimeGenerator(config2) {
57483
57536
  ]);
57484
57537
  }
57485
57538
  async function generatePluginRuntime(config2, plugin) {
57486
- if (process.env.TEST) {
57539
+ if (houdini_mode.is_testing) {
57487
57540
  return;
57488
57541
  }
57489
57542
  const source = path_exports.join(
@@ -16082,8 +16082,8 @@ var require_graceful_fs = __commonJS({
16082
16082
  }
16083
16083
  var fs$copyFile = fs3.copyFile;
16084
16084
  if (fs$copyFile)
16085
- fs3.copyFile = copyFile;
16086
- function copyFile(src, dest, flags, cb) {
16085
+ fs3.copyFile = copyFile2;
16086
+ function copyFile2(src, dest, flags, cb) {
16087
16087
  if (typeof flags === "function") {
16088
16088
  cb = flags;
16089
16089
  flags = 0;
@@ -16756,7 +16756,7 @@ var require_copy = __commonJS({
16756
16756
  }
16757
16757
  function onFile(srcStat, destStat, src, dest, opts, cb) {
16758
16758
  if (!destStat)
16759
- return copyFile(srcStat, src, dest, opts, cb);
16759
+ return copyFile2(srcStat, src, dest, opts, cb);
16760
16760
  return mayCopyFile(srcStat, src, dest, opts, cb);
16761
16761
  }
16762
16762
  function mayCopyFile(srcStat, src, dest, opts, cb) {
@@ -16764,14 +16764,14 @@ var require_copy = __commonJS({
16764
16764
  fs2.unlink(dest, (err) => {
16765
16765
  if (err)
16766
16766
  return cb(err);
16767
- return copyFile(srcStat, src, dest, opts, cb);
16767
+ return copyFile2(srcStat, src, dest, opts, cb);
16768
16768
  });
16769
16769
  } else if (opts.errorOnExist) {
16770
16770
  return cb(new Error(`'${dest}' already exists`));
16771
16771
  } else
16772
16772
  return cb();
16773
16773
  }
16774
- function copyFile(srcStat, src, dest, opts, cb) {
16774
+ function copyFile2(srcStat, src, dest, opts, cb) {
16775
16775
  fs2.copyFile(src, dest, (err) => {
16776
16776
  if (err)
16777
16777
  return cb(err);
@@ -16954,18 +16954,18 @@ var require_copy_sync = __commonJS({
16954
16954
  }
16955
16955
  function onFile(srcStat, destStat, src, dest, opts) {
16956
16956
  if (!destStat)
16957
- return copyFile(srcStat, src, dest, opts);
16957
+ return copyFile2(srcStat, src, dest, opts);
16958
16958
  return mayCopyFile(srcStat, src, dest, opts);
16959
16959
  }
16960
16960
  function mayCopyFile(srcStat, src, dest, opts) {
16961
16961
  if (opts.overwrite) {
16962
16962
  fs2.unlinkSync(dest);
16963
- return copyFile(srcStat, src, dest, opts);
16963
+ return copyFile2(srcStat, src, dest, opts);
16964
16964
  } else if (opts.errorOnExist) {
16965
16965
  throw new Error(`'${dest}' already exists`);
16966
16966
  }
16967
16967
  }
16968
- function copyFile(srcStat, src, dest, opts) {
16968
+ function copyFile2(srcStat, src, dest, opts) {
16969
16969
  fs2.copyFileSync(src, dest);
16970
16970
  if (opts.preserveTimestamps)
16971
16971
  handleTimestamps(srcStat.mode, src, dest);
@@ -54348,10 +54348,11 @@ var InMemorySubscriptions = class {
54348
54348
  parent,
54349
54349
  selection: selection2,
54350
54350
  variables,
54351
- subscribers
54351
+ subscribers,
54352
+ parentType
54352
54353
  }) {
54353
54354
  for (const fieldSelection of Object.values(selection2)) {
54354
- const { keyRaw, fields } = fieldSelection;
54355
+ const { type: linkedType, keyRaw, fields } = fieldSelection;
54355
54356
  const key = evaluateKey(keyRaw, variables);
54356
54357
  for (const spec of subscribers) {
54357
54358
  this.addFieldSubscription({
@@ -54359,7 +54360,7 @@ var InMemorySubscriptions = class {
54359
54360
  key,
54360
54361
  selection: fieldSelection,
54361
54362
  spec,
54362
- parentType: "asdf",
54363
+ parentType,
54363
54364
  variables
54364
54365
  });
54365
54366
  }
@@ -54374,7 +54375,8 @@ var InMemorySubscriptions = class {
54374
54375
  parent: linkedRecord,
54375
54376
  selection: fields,
54376
54377
  variables,
54377
- subscribers
54378
+ subscribers,
54379
+ parentType: linkedType
54378
54380
  });
54379
54381
  }
54380
54382
  }
@@ -54554,7 +54556,7 @@ var CacheInternal = class {
54554
54556
  this.cache = cache;
54555
54557
  this.lifetimes = lifetimes;
54556
54558
  try {
54557
- this._disabled = process.env.TEST !== "true";
54559
+ this._disabled = process.env.HOUDINI_TEST !== "true";
54558
54560
  } catch {
54559
54561
  this._disabled = typeof globalThis.window === "undefined";
54560
54562
  }
@@ -54652,7 +54654,8 @@ var CacheInternal = class {
54652
54654
  parent: linkedID,
54653
54655
  selection: fields,
54654
54656
  subscribers: currentSubscribers,
54655
- variables
54657
+ variables,
54658
+ parentType: linkedType
54656
54659
  });
54657
54660
  toNotify.push(...currentSubscribers);
54658
54661
  }
@@ -54758,7 +54761,8 @@ var CacheInternal = class {
54758
54761
  parent: id,
54759
54762
  selection: fields,
54760
54763
  subscribers: currentSubscribers,
54761
- variables
54764
+ variables,
54765
+ parentType: linkedType
54762
54766
  });
54763
54767
  }
54764
54768
  }
@@ -55043,6 +55047,14 @@ var CompiledMutationKind = "HoudiniMutation" /* Mutation */;
55043
55047
  var CompiledQueryKind = "HoudiniQuery" /* Query */;
55044
55048
  var CompiledSubscriptionKind = "HoudiniSubscription" /* Subscription */;
55045
55049
 
55050
+ // src/lib/constants.ts
55051
+ var siteURL = "https://houdinigraphql.com";
55052
+ var houdini_mode = {
55053
+ get is_testing() {
55054
+ return process.env.HOUDINI_TEST === "true";
55055
+ }
55056
+ };
55057
+
55046
55058
  // src/lib/error.ts
55047
55059
  var HoudiniError = class extends Error {
55048
55060
  filepath = null;
@@ -55066,6 +55078,8 @@ var HoudiniError = class extends Error {
55066
55078
  var fs_exports = {};
55067
55079
  __export(fs_exports, {
55068
55080
  access: () => access,
55081
+ copyFile: () => copyFile,
55082
+ copyFileSync: () => copyFileSync,
55069
55083
  existsSync: () => existsSync,
55070
55084
  glob: () => glob,
55071
55085
  mkdir: () => mkdir,
@@ -55135,8 +55149,50 @@ function importPath(target) {
55135
55149
  }
55136
55150
 
55137
55151
  // src/lib/fs.ts
55152
+ function copyFileSync(src, dest) {
55153
+ if (houdini_mode.is_testing) {
55154
+ try {
55155
+ if (src.includes("build/runtime") || dest.includes("build/runtime")) {
55156
+ import_fs_extra.default.copyFileSync(src, dest);
55157
+ return;
55158
+ }
55159
+ import_memfs.fs.copyFileSync(src, dest);
55160
+ return;
55161
+ } catch (e) {
55162
+ return null;
55163
+ }
55164
+ }
55165
+ try {
55166
+ import_fs_extra.default.copyFileSync(src, dest);
55167
+ return;
55168
+ } catch (e) {
55169
+ }
55170
+ return null;
55171
+ }
55172
+ async function copyFile(src, dest) {
55173
+ if (houdini_mode.is_testing) {
55174
+ try {
55175
+ if (src.includes("build/runtime") || dest.includes("build/runtime")) {
55176
+ await fs.copyFile(src, dest);
55177
+ return;
55178
+ }
55179
+ await import_memfs.fs.copyFile(src, dest, (err) => {
55180
+ throw err;
55181
+ });
55182
+ return;
55183
+ } catch (e) {
55184
+ return null;
55185
+ }
55186
+ }
55187
+ try {
55188
+ await fs.copyFile(src, dest);
55189
+ return;
55190
+ } catch (e) {
55191
+ }
55192
+ return null;
55193
+ }
55138
55194
  async function readFile(filepath) {
55139
- if (process.env.NODE_ENV === "test") {
55195
+ if (houdini_mode.is_testing) {
55140
55196
  try {
55141
55197
  if (filepath.includes("build/runtime")) {
55142
55198
  return await fs.readFile(filepath, "utf-8");
@@ -55153,7 +55209,7 @@ async function readFile(filepath) {
55153
55209
  return null;
55154
55210
  }
55155
55211
  function readFileSync(filepath) {
55156
- if (process.env.NODE_ENV === "test") {
55212
+ if (houdini_mode.is_testing) {
55157
55213
  try {
55158
55214
  if (filepath.includes("build/runtime")) {
55159
55215
  return import_fs_extra.default.readFileSync(filepath, "utf-8");
@@ -55174,13 +55230,13 @@ async function writeFile(filepath, data) {
55174
55230
  if (data === existingFileData) {
55175
55231
  return;
55176
55232
  }
55177
- if (process.env.NODE_ENV === "test") {
55233
+ if (houdini_mode.is_testing) {
55178
55234
  return import_memfs.fs.writeFileSync(filepath, data);
55179
55235
  }
55180
55236
  return await fs.writeFile(filepath, data, "utf8");
55181
55237
  }
55182
55238
  async function access(filepath) {
55183
- if (process.env.NODE_ENV !== "test") {
55239
+ if (!houdini_mode.is_testing) {
55184
55240
  return await fs.access(filepath);
55185
55241
  }
55186
55242
  if (filepath.includes("build/runtime")) {
@@ -55189,25 +55245,25 @@ async function access(filepath) {
55189
55245
  return import_memfs.fs.statSync(filepath);
55190
55246
  }
55191
55247
  async function mkdirp(filepath) {
55192
- if (process.env.NODE_ENV !== "test") {
55248
+ if (!houdini_mode.is_testing) {
55193
55249
  return await import_fs_extra.default.mkdirp(filepath);
55194
55250
  }
55195
55251
  return import_memfs.fs.mkdirpSync(filepath);
55196
55252
  }
55197
55253
  async function mkdirpSync(filepath) {
55198
- if (process.env.NODE_ENV !== "test") {
55254
+ if (!houdini_mode.is_testing) {
55199
55255
  return import_fs_extra.default.mkdirpSync(filepath);
55200
55256
  }
55201
55257
  return import_memfs.fs.mkdirpSync(filepath);
55202
55258
  }
55203
55259
  async function mkdir(filepath) {
55204
- if (process.env.NODE_ENV !== "test") {
55260
+ if (!houdini_mode.is_testing) {
55205
55261
  return await fs.mkdir(filepath);
55206
55262
  }
55207
55263
  return import_memfs.fs.mkdirSync(filepath);
55208
55264
  }
55209
55265
  async function rmdir(filepath) {
55210
- if (process.env.NODE_ENV !== "test") {
55266
+ if (!houdini_mode.is_testing) {
55211
55267
  return await fs.rm(filepath, {
55212
55268
  recursive: true
55213
55269
  });
@@ -55215,7 +55271,7 @@ async function rmdir(filepath) {
55215
55271
  return await promisify(import_memfs.fs.rmdir)(filepath);
55216
55272
  }
55217
55273
  async function stat(filepath) {
55218
- if (process.env.NODE_ENV !== "test") {
55274
+ if (!houdini_mode.is_testing) {
55219
55275
  return await fs.stat(filepath);
55220
55276
  }
55221
55277
  if (filepath.includes("build/runtime")) {
@@ -55224,13 +55280,13 @@ async function stat(filepath) {
55224
55280
  return import_memfs.fs.statSync(filepath);
55225
55281
  }
55226
55282
  function existsSync(dirPath) {
55227
- if (process.env.NODE_ENV !== "test") {
55283
+ if (!houdini_mode.is_testing) {
55228
55284
  return import_fs_extra.default.existsSync(dirPath);
55229
55285
  }
55230
55286
  return import_memfs.fs.existsSync(dirPath);
55231
55287
  }
55232
55288
  async function readdir(filepath) {
55233
- if (process.env.NODE_ENV !== "test") {
55289
+ if (!houdini_mode.is_testing) {
55234
55290
  return await fs.readdir(filepath);
55235
55291
  }
55236
55292
  if (filepath.includes("build/runtime")) {
@@ -55243,7 +55299,7 @@ async function readdir(filepath) {
55243
55299
  }
55244
55300
  }
55245
55301
  async function remove(filepath) {
55246
- if (process.env.NODE_ENV !== "test") {
55302
+ if (!houdini_mode.is_testing) {
55247
55303
  return await fs.rm(filepath);
55248
55304
  }
55249
55305
  return import_memfs.vol.rmSync(filepath);
@@ -55431,9 +55487,6 @@ function ensureImports({
55431
55487
  return Array.isArray(importID) ? toImport : toImport[0];
55432
55488
  }
55433
55489
 
55434
- // src/lib/constants.ts
55435
- var siteURL = "https://houdinigraphql.com";
55436
-
55437
55490
  // src/lib/cleanupFiles.ts
55438
55491
  async function cleanupFiles(pathFolder, listOfObj) {
55439
55492
  const listFile = await readdir(pathFolder);
@@ -57481,7 +57534,7 @@ async function runtimeGenerator(config2) {
57481
57534
  ]);
57482
57535
  }
57483
57536
  async function generatePluginRuntime(config2, plugin) {
57484
- if (process.env.TEST) {
57537
+ if (houdini_mode.is_testing) {
57485
57538
  return;
57486
57539
  }
57487
57540
  const source = path_exports.join(
@@ -1 +1,8 @@
1
1
  export declare const siteURL = "https://houdinigraphql.com";
2
+ export declare const houdini_mode: {
3
+ /**
4
+ * to set the testing mode do like this:
5
+ * `process.env.HOUDINI_TEST = 'true'`
6
+ */
7
+ readonly is_testing: boolean;
8
+ };
package/build/lib/fs.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="glob" />
3
3
  import fsExtra from 'fs-extra';
4
+ export declare function copyFileSync(src: string, dest: string): void | null;
5
+ export declare function copyFile(src: string, dest: string): Promise<void | null>;
4
6
  export declare function readFile(filepath: string): Promise<string | null>;
5
7
  export declare function readFileSync(filepath: string): string | null;
6
8
  export declare function writeFile(filepath: string, data: string): Promise<void>;