houdini 1.0.0-next.3 → 1.0.0-next.5
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.
- package/build/cmd-cjs/index.js +1254 -1062
- package/build/cmd-esm/index.js +1254 -1062
- package/build/codegen/generators/artifacts/selection.d.ts +3 -3
- package/build/codegen/generators/artifacts/utils.d.ts +0 -1
- package/build/codegen-cjs/index.js +847 -717
- package/build/codegen-esm/index.js +847 -717
- package/build/lib/config.d.ts +10 -90
- package/build/lib/deepMerge.d.ts +1 -0
- package/build/lib/graphql.d.ts +5 -2
- package/build/lib/index.d.ts +2 -0
- package/build/lib/pipeline.d.ts +1 -1
- package/build/lib/plugin.d.ts +2 -0
- package/build/lib/types.d.ts +250 -2
- package/build/lib-cjs/index.js +351 -162
- package/build/lib-esm/index.js +349 -162
- package/build/runtime/cache/cache.d.ts +23 -6
- package/build/runtime/cache/staleManager.d.ts +30 -0
- package/build/runtime/cache/subscription.d.ts +2 -1
- package/build/runtime/client/documentStore.d.ts +1 -1
- package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime/client/plugins/subscription.d.ts +1 -2
- package/build/runtime/lib/config.d.ts +4 -0
- package/build/runtime/lib/index.d.ts +1 -0
- package/build/runtime/lib/key.d.ts +6 -0
- package/build/runtime/lib/types.d.ts +4 -5
- package/build/runtime/public/cache.d.ts +8 -1
- package/build/runtime/public/record.d.ts +11 -1
- package/build/runtime/public/tests/test.d.ts +9 -10
- package/build/runtime-cjs/cache/cache.d.ts +23 -6
- package/build/runtime-cjs/cache/cache.js +95 -21
- package/build/runtime-cjs/cache/gc.js +9 -0
- package/build/runtime-cjs/cache/lists.js +3 -3
- package/build/runtime-cjs/cache/staleManager.d.ts +30 -0
- package/build/runtime-cjs/cache/staleManager.js +95 -0
- package/build/runtime-cjs/cache/subscription.d.ts +2 -1
- package/build/runtime-cjs/cache/subscription.js +6 -3
- package/build/runtime-cjs/client/documentStore.d.ts +1 -1
- package/build/runtime-cjs/client/documentStore.js +1 -0
- package/build/runtime-cjs/client/plugins/cache.js +5 -3
- package/build/runtime-cjs/client/plugins/fetch.js +1 -0
- package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/fetchParams.js +6 -1
- package/build/runtime-cjs/client/plugins/query.js +1 -1
- package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -2
- package/build/runtime-cjs/client/plugins/subscription.js +2 -0
- package/build/runtime-cjs/lib/config.d.ts +4 -0
- package/build/runtime-cjs/lib/index.d.ts +1 -0
- package/build/runtime-cjs/lib/index.js +1 -0
- package/build/runtime-cjs/lib/key.d.ts +6 -0
- package/build/runtime-cjs/lib/key.js +41 -0
- package/build/runtime-cjs/lib/types.d.ts +4 -5
- package/build/runtime-cjs/public/cache.d.ts +8 -1
- package/build/runtime-cjs/public/cache.js +3 -0
- package/build/runtime-cjs/public/record.d.ts +11 -1
- package/build/runtime-cjs/public/record.js +8 -1
- package/build/runtime-cjs/public/tests/test.d.ts +9 -10
- package/build/runtime-esm/cache/cache.d.ts +23 -6
- package/build/runtime-esm/cache/cache.js +96 -22
- package/build/runtime-esm/cache/gc.js +9 -0
- package/build/runtime-esm/cache/lists.js +3 -3
- package/build/runtime-esm/cache/staleManager.d.ts +30 -0
- package/build/runtime-esm/cache/staleManager.js +71 -0
- package/build/runtime-esm/cache/subscription.d.ts +2 -1
- package/build/runtime-esm/cache/subscription.js +6 -3
- package/build/runtime-esm/client/documentStore.d.ts +1 -1
- package/build/runtime-esm/client/documentStore.js +1 -0
- package/build/runtime-esm/client/plugins/cache.js +5 -3
- package/build/runtime-esm/client/plugins/fetch.js +1 -0
- package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
- package/build/runtime-esm/client/plugins/fetchParams.js +6 -1
- package/build/runtime-esm/client/plugins/query.js +1 -1
- package/build/runtime-esm/client/plugins/subscription.d.ts +1 -2
- package/build/runtime-esm/client/plugins/subscription.js +2 -0
- package/build/runtime-esm/lib/config.d.ts +4 -0
- package/build/runtime-esm/lib/index.d.ts +1 -0
- package/build/runtime-esm/lib/index.js +1 -0
- package/build/runtime-esm/lib/key.d.ts +6 -0
- package/build/runtime-esm/lib/key.js +17 -0
- package/build/runtime-esm/lib/types.d.ts +4 -5
- package/build/runtime-esm/public/cache.d.ts +8 -1
- package/build/runtime-esm/public/cache.js +3 -0
- package/build/runtime-esm/public/record.d.ts +11 -1
- package/build/runtime-esm/public/record.js +8 -1
- package/build/runtime-esm/public/tests/test.d.ts +9 -10
- package/build/test-cjs/index.js +930 -788
- package/build/test-esm/index.js +930 -788
- package/build/vite-cjs/index.js +1232 -1039
- package/build/vite-esm/index.js +1232 -1039
- package/package.json +3 -2
package/build/lib-cjs/index.js
CHANGED
|
@@ -15475,6 +15475,109 @@ var require_minimatch = __commonJS({
|
|
|
15475
15475
|
}
|
|
15476
15476
|
});
|
|
15477
15477
|
|
|
15478
|
+
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
15479
|
+
var require_cjs = __commonJS({
|
|
15480
|
+
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
|
|
15481
|
+
"use strict";
|
|
15482
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
15483
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
15484
|
+
};
|
|
15485
|
+
function isNonNullObject(value) {
|
|
15486
|
+
return !!value && typeof value === "object";
|
|
15487
|
+
}
|
|
15488
|
+
function isSpecial(value) {
|
|
15489
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
15490
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
15491
|
+
}
|
|
15492
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
15493
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
15494
|
+
function isReactElement(value) {
|
|
15495
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
15496
|
+
}
|
|
15497
|
+
function emptyTarget(val) {
|
|
15498
|
+
return Array.isArray(val) ? [] : {};
|
|
15499
|
+
}
|
|
15500
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
15501
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
15502
|
+
}
|
|
15503
|
+
function defaultArrayMerge(target, source, options) {
|
|
15504
|
+
return target.concat(source).map(function(element) {
|
|
15505
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
15506
|
+
});
|
|
15507
|
+
}
|
|
15508
|
+
function getMergeFunction(key, options) {
|
|
15509
|
+
if (!options.customMerge) {
|
|
15510
|
+
return deepmerge;
|
|
15511
|
+
}
|
|
15512
|
+
var customMerge = options.customMerge(key);
|
|
15513
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
15514
|
+
}
|
|
15515
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
15516
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
15517
|
+
return target.propertyIsEnumerable(symbol);
|
|
15518
|
+
}) : [];
|
|
15519
|
+
}
|
|
15520
|
+
function getKeys(target) {
|
|
15521
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
15522
|
+
}
|
|
15523
|
+
function propertyIsOnObject(object, property) {
|
|
15524
|
+
try {
|
|
15525
|
+
return property in object;
|
|
15526
|
+
} catch (_) {
|
|
15527
|
+
return false;
|
|
15528
|
+
}
|
|
15529
|
+
}
|
|
15530
|
+
function propertyIsUnsafe(target, key) {
|
|
15531
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
15532
|
+
}
|
|
15533
|
+
function mergeObject(target, source, options) {
|
|
15534
|
+
var destination = {};
|
|
15535
|
+
if (options.isMergeableObject(target)) {
|
|
15536
|
+
getKeys(target).forEach(function(key) {
|
|
15537
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
15538
|
+
});
|
|
15539
|
+
}
|
|
15540
|
+
getKeys(source).forEach(function(key) {
|
|
15541
|
+
if (propertyIsUnsafe(target, key)) {
|
|
15542
|
+
return;
|
|
15543
|
+
}
|
|
15544
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
15545
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
15546
|
+
} else {
|
|
15547
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
15548
|
+
}
|
|
15549
|
+
});
|
|
15550
|
+
return destination;
|
|
15551
|
+
}
|
|
15552
|
+
function deepmerge(target, source, options) {
|
|
15553
|
+
options = options || {};
|
|
15554
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
15555
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
15556
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
15557
|
+
var sourceIsArray = Array.isArray(source);
|
|
15558
|
+
var targetIsArray = Array.isArray(target);
|
|
15559
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
15560
|
+
if (!sourceAndTargetTypesMatch) {
|
|
15561
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
15562
|
+
} else if (sourceIsArray) {
|
|
15563
|
+
return options.arrayMerge(target, source, options);
|
|
15564
|
+
} else {
|
|
15565
|
+
return mergeObject(target, source, options);
|
|
15566
|
+
}
|
|
15567
|
+
}
|
|
15568
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
15569
|
+
if (!Array.isArray(array)) {
|
|
15570
|
+
throw new Error("first argument should be an array");
|
|
15571
|
+
}
|
|
15572
|
+
return array.reduce(function(prev, next) {
|
|
15573
|
+
return deepmerge(prev, next, options);
|
|
15574
|
+
}, {});
|
|
15575
|
+
};
|
|
15576
|
+
var deepmerge_1 = deepmerge;
|
|
15577
|
+
module2.exports = deepmerge_1;
|
|
15578
|
+
}
|
|
15579
|
+
});
|
|
15580
|
+
|
|
15478
15581
|
// ../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js
|
|
15479
15582
|
var require_universalify = __commonJS({
|
|
15480
15583
|
"../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js"(exports) {
|
|
@@ -29192,9 +29295,9 @@ var require_lib3 = __commonJS({
|
|
|
29192
29295
|
return true;
|
|
29193
29296
|
}
|
|
29194
29297
|
}
|
|
29195
|
-
getPluginOption(
|
|
29298
|
+
getPluginOption(plugin2, name) {
|
|
29196
29299
|
var _this$plugins$get;
|
|
29197
|
-
return (_this$plugins$get = this.plugins.get(
|
|
29300
|
+
return (_this$plugins$get = this.plugins.get(plugin2)) == null ? void 0 : _this$plugins$get[name];
|
|
29198
29301
|
}
|
|
29199
29302
|
};
|
|
29200
29303
|
function setTrailingComments(node, comments) {
|
|
@@ -37598,15 +37701,15 @@ var require_lib3 = __commonJS({
|
|
|
37598
37701
|
});
|
|
37599
37702
|
}
|
|
37600
37703
|
function getPluginOption(plugins, name, option) {
|
|
37601
|
-
const
|
|
37602
|
-
if (Array.isArray(
|
|
37603
|
-
return
|
|
37704
|
+
const plugin2 = plugins.find((plugin3) => {
|
|
37705
|
+
if (Array.isArray(plugin3)) {
|
|
37706
|
+
return plugin3[0] === name;
|
|
37604
37707
|
} else {
|
|
37605
|
-
return
|
|
37708
|
+
return plugin3 === name;
|
|
37606
37709
|
}
|
|
37607
37710
|
});
|
|
37608
|
-
if (
|
|
37609
|
-
return
|
|
37711
|
+
if (plugin2 && Array.isArray(plugin2) && plugin2.length > 1) {
|
|
37712
|
+
return plugin2[1][option];
|
|
37610
37713
|
}
|
|
37611
37714
|
return null;
|
|
37612
37715
|
}
|
|
@@ -41936,8 +42039,8 @@ var require_lib3 = __commonJS({
|
|
|
41936
42039
|
};
|
|
41937
42040
|
function pluginsMap(plugins) {
|
|
41938
42041
|
const pluginMap = /* @__PURE__ */ new Map();
|
|
41939
|
-
for (const
|
|
41940
|
-
const [name, options] = Array.isArray(
|
|
42042
|
+
for (const plugin2 of plugins) {
|
|
42043
|
+
const [name, options] = Array.isArray(plugin2) ? plugin2 : [plugin2, {}];
|
|
41941
42044
|
if (!pluginMap.has(name))
|
|
41942
42045
|
pluginMap.set(name, options || {});
|
|
41943
42046
|
}
|
|
@@ -42006,8 +42109,8 @@ var require_lib3 = __commonJS({
|
|
|
42006
42109
|
let cls = parserClassCache[key];
|
|
42007
42110
|
if (!cls) {
|
|
42008
42111
|
cls = Parser;
|
|
42009
|
-
for (const
|
|
42010
|
-
cls = mixinPlugins[
|
|
42112
|
+
for (const plugin2 of pluginList) {
|
|
42113
|
+
cls = mixinPlugins[plugin2](cls);
|
|
42011
42114
|
}
|
|
42012
42115
|
parserClassCache[key] = cls;
|
|
42013
42116
|
}
|
|
@@ -44638,12 +44741,12 @@ var require_fork = __commonJS({
|
|
|
44638
44741
|
function createFork() {
|
|
44639
44742
|
var used = [];
|
|
44640
44743
|
var usedResult = [];
|
|
44641
|
-
function use(
|
|
44642
|
-
var idx = used.indexOf(
|
|
44744
|
+
function use(plugin2) {
|
|
44745
|
+
var idx = used.indexOf(plugin2);
|
|
44643
44746
|
if (idx === -1) {
|
|
44644
44747
|
idx = used.length;
|
|
44645
|
-
used.push(
|
|
44646
|
-
usedResult[idx] =
|
|
44748
|
+
used.push(plugin2);
|
|
44749
|
+
usedResult[idx] = plugin2(fork);
|
|
44647
44750
|
}
|
|
44648
44751
|
return usedResult[idx];
|
|
44649
44752
|
}
|
|
@@ -58301,6 +58404,7 @@ __export(lib_exports, {
|
|
|
58301
58404
|
TypeWrapper: () => TypeWrapper,
|
|
58302
58405
|
cleanupFiles: () => cleanupFiles,
|
|
58303
58406
|
computeID: () => computeID,
|
|
58407
|
+
deepMerge: () => deepMerge,
|
|
58304
58408
|
defaultConfigValues: () => defaultConfigValues,
|
|
58305
58409
|
definitionFromAncestors: () => definitionFromAncestors,
|
|
58306
58410
|
ensureArtifactImport: () => ensureArtifactImport,
|
|
@@ -58321,6 +58425,7 @@ __export(lib_exports, {
|
|
|
58321
58425
|
parseJS: () => parseJS,
|
|
58322
58426
|
parseJSON: () => parseJSON,
|
|
58323
58427
|
path: () => path_exports,
|
|
58428
|
+
plugin: () => plugin,
|
|
58324
58429
|
pullSchema: () => pullSchema,
|
|
58325
58430
|
readConfigFile: () => readConfigFile,
|
|
58326
58431
|
runPipeline: () => runPipeline,
|
|
@@ -61545,6 +61650,9 @@ var houdini_mode = {
|
|
|
61545
61650
|
}
|
|
61546
61651
|
};
|
|
61547
61652
|
|
|
61653
|
+
// src/lib/deepMerge.ts
|
|
61654
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
61655
|
+
|
|
61548
61656
|
// src/lib/error.ts
|
|
61549
61657
|
var HoudiniError = class extends Error {
|
|
61550
61658
|
filepath = null;
|
|
@@ -61564,6 +61672,20 @@ var HoudiniError = class extends Error {
|
|
|
61564
61672
|
}
|
|
61565
61673
|
};
|
|
61566
61674
|
|
|
61675
|
+
// src/lib/deepMerge.ts
|
|
61676
|
+
function deepMerge(filepath, ...targets) {
|
|
61677
|
+
try {
|
|
61678
|
+
if (targets.length === 1) {
|
|
61679
|
+
return targets[0];
|
|
61680
|
+
} else if (targets.length === 2) {
|
|
61681
|
+
return (0, import_deepmerge.default)(targets[0], targets[1]);
|
|
61682
|
+
}
|
|
61683
|
+
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
61684
|
+
} catch (e2) {
|
|
61685
|
+
throw new HoudiniError({ filepath, message: "could not merge: " + targets });
|
|
61686
|
+
}
|
|
61687
|
+
}
|
|
61688
|
+
|
|
61567
61689
|
// src/lib/fs.ts
|
|
61568
61690
|
var fs_exports = {};
|
|
61569
61691
|
__export(fs_exports, {
|
|
@@ -63081,6 +63203,31 @@ async function pullSchema(url, schemaPath, headers) {
|
|
|
63081
63203
|
return false;
|
|
63082
63204
|
}
|
|
63083
63205
|
|
|
63206
|
+
// src/lib/plugin.ts
|
|
63207
|
+
function plugin(name, hooks) {
|
|
63208
|
+
const data = {
|
|
63209
|
+
name,
|
|
63210
|
+
plugin: hooks,
|
|
63211
|
+
__plugin_init__: true,
|
|
63212
|
+
with(config) {
|
|
63213
|
+
return {
|
|
63214
|
+
...data,
|
|
63215
|
+
config
|
|
63216
|
+
};
|
|
63217
|
+
}
|
|
63218
|
+
};
|
|
63219
|
+
return data;
|
|
63220
|
+
}
|
|
63221
|
+
|
|
63222
|
+
// src/lib/types.ts
|
|
63223
|
+
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
63224
|
+
LogLevel2["Full"] = "full";
|
|
63225
|
+
LogLevel2["Summary"] = "summary";
|
|
63226
|
+
LogLevel2["ShortSummary"] = "short-summary";
|
|
63227
|
+
LogLevel2["Quiet"] = "quiet";
|
|
63228
|
+
return LogLevel2;
|
|
63229
|
+
})(LogLevel || {});
|
|
63230
|
+
|
|
63084
63231
|
// src/lib/config.ts
|
|
63085
63232
|
var import_meta = {};
|
|
63086
63233
|
var currentDir = global.__dirname || dirname((0, import_url.fileURLToPath)(import_meta.url));
|
|
@@ -63100,7 +63247,6 @@ var Config = class {
|
|
|
63100
63247
|
internalListPosition;
|
|
63101
63248
|
defaultListTarget = null;
|
|
63102
63249
|
definitionsFolder;
|
|
63103
|
-
newSchema = "";
|
|
63104
63250
|
newDocuments = "";
|
|
63105
63251
|
defaultKeys = ["id"];
|
|
63106
63252
|
typeConfig;
|
|
@@ -63154,7 +63300,7 @@ var Config = class {
|
|
|
63154
63300
|
Object.values(LogLevel)
|
|
63155
63301
|
)}`
|
|
63156
63302
|
);
|
|
63157
|
-
logLevel =
|
|
63303
|
+
logLevel = "summary" /* Summary */;
|
|
63158
63304
|
}
|
|
63159
63305
|
this.schemaPath = schemaPath;
|
|
63160
63306
|
this.filepath = filepath;
|
|
@@ -63170,7 +63316,7 @@ var Config = class {
|
|
|
63170
63316
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
63171
63317
|
this.defaultListTarget = defaultListTarget;
|
|
63172
63318
|
this.definitionsFolder = definitionsPath;
|
|
63173
|
-
this.logLevel = (logLevel ||
|
|
63319
|
+
this.logLevel = (logLevel || "summary" /* Summary */).toLowerCase();
|
|
63174
63320
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
63175
63321
|
this.routesDir = join2(this.projectRoot, "src", "routes");
|
|
63176
63322
|
this.schemaPollInterval = watchSchema?.interval ?? 2e3;
|
|
@@ -63199,7 +63345,7 @@ var Config = class {
|
|
|
63199
63345
|
return Array.isArray(this.configFile.include) ? this.configFile.include : [this.configFile.include];
|
|
63200
63346
|
}
|
|
63201
63347
|
const extensions = [".graphql", ".gql", ".ts", ".js"].concat(
|
|
63202
|
-
this.plugins.flatMap((
|
|
63348
|
+
this.plugins.flatMap((plugin2) => plugin2.extensions ?? [])
|
|
63203
63349
|
);
|
|
63204
63350
|
return [`src/**/*{${extensions.join(",")}}`];
|
|
63205
63351
|
}
|
|
@@ -63208,10 +63354,10 @@ var Config = class {
|
|
|
63208
63354
|
}
|
|
63209
63355
|
async getEnv() {
|
|
63210
63356
|
let env = process.env;
|
|
63211
|
-
for (const
|
|
63212
|
-
if (
|
|
63357
|
+
for (const plugin2 of this.plugins) {
|
|
63358
|
+
if (plugin2.env) {
|
|
63213
63359
|
env = {
|
|
63214
|
-
...await
|
|
63360
|
+
...await plugin2.env({ config: this, env })
|
|
63215
63361
|
};
|
|
63216
63362
|
}
|
|
63217
63363
|
}
|
|
@@ -63261,6 +63407,19 @@ var Config = class {
|
|
|
63261
63407
|
)
|
|
63262
63408
|
];
|
|
63263
63409
|
}
|
|
63410
|
+
#newSchemaInstance = null;
|
|
63411
|
+
#schemaString = "";
|
|
63412
|
+
set newSchema(value) {
|
|
63413
|
+
this.#schemaString = value;
|
|
63414
|
+
if (value) {
|
|
63415
|
+
this.#newSchemaInstance = graphql2.buildSchema(value);
|
|
63416
|
+
} else {
|
|
63417
|
+
this.#newSchemaInstance = null;
|
|
63418
|
+
}
|
|
63419
|
+
}
|
|
63420
|
+
get newSchema() {
|
|
63421
|
+
return this.#schemaString;
|
|
63422
|
+
}
|
|
63264
63423
|
get artifactDirectory() {
|
|
63265
63424
|
return join2(this.rootDir, this.artifactDirectoryName);
|
|
63266
63425
|
}
|
|
@@ -63297,23 +63456,8 @@ var Config = class {
|
|
|
63297
63456
|
get typeRootFile() {
|
|
63298
63457
|
return "$houdini.d.ts";
|
|
63299
63458
|
}
|
|
63300
|
-
findModule(pkg = "houdini", currentLocation = join2(dirname(this.filepath))) {
|
|
63301
|
-
const pathEndingBy = ["node_modules", pkg];
|
|
63302
|
-
let locationFound = join2(currentLocation, ...pathEndingBy);
|
|
63303
|
-
let previousLocation = "";
|
|
63304
|
-
const backFolder = [];
|
|
63305
|
-
while (previousLocation !== locationFound && !existsSync(locationFound)) {
|
|
63306
|
-
previousLocation = locationFound;
|
|
63307
|
-
backFolder.push("../");
|
|
63308
|
-
locationFound = join2(currentLocation, ...backFolder, ...pathEndingBy);
|
|
63309
|
-
}
|
|
63310
|
-
if (previousLocation === locationFound) {
|
|
63311
|
-
throw new Error("Could not find any node_modules/houdini folder");
|
|
63312
|
-
}
|
|
63313
|
-
return locationFound;
|
|
63314
|
-
}
|
|
63315
63459
|
get runtimeSource() {
|
|
63316
|
-
const relative2 = houdini_mode.is_testing ? join2(currentDir, "..", "..") : this.
|
|
63460
|
+
const relative2 = houdini_mode.is_testing ? join2(currentDir, "..", "..") : findModule("houdini", join2(dirname(this.filepath)));
|
|
63317
63461
|
const which = this.module === "esm" ? "esm" : "cjs";
|
|
63318
63462
|
return resolve(relative2, "build", `runtime-${which}`);
|
|
63319
63463
|
}
|
|
@@ -63368,16 +63512,27 @@ var Config = class {
|
|
|
63368
63512
|
relative(process.cwd(), filepath).replaceAll(sep, "_").replace(".ts", ".js")
|
|
63369
63513
|
);
|
|
63370
63514
|
}
|
|
63515
|
+
excludeFile(filepath) {
|
|
63516
|
+
if (this.exclude.length > 0 && this.exclude.some((pattern) => (0, import_minimatch.default)(filepath, pattern))) {
|
|
63517
|
+
return true;
|
|
63518
|
+
}
|
|
63519
|
+
for (const plugin2 of this.plugins) {
|
|
63520
|
+
if (plugin2?.exclude?.({ config: this, filepath })) {
|
|
63521
|
+
return true;
|
|
63522
|
+
}
|
|
63523
|
+
}
|
|
63524
|
+
return false;
|
|
63525
|
+
}
|
|
63371
63526
|
includeFile(filepath, {
|
|
63372
63527
|
root = this.projectRoot,
|
|
63373
63528
|
ignore_plugins = false
|
|
63374
63529
|
} = {}) {
|
|
63375
63530
|
let included = false;
|
|
63376
|
-
for (const
|
|
63377
|
-
if (!
|
|
63531
|
+
for (const plugin2 of ignore_plugins ? [] : this.plugins) {
|
|
63532
|
+
if (!plugin2.include) {
|
|
63378
63533
|
continue;
|
|
63379
63534
|
}
|
|
63380
|
-
if (
|
|
63535
|
+
if (plugin2.include({ config: this, filepath })) {
|
|
63381
63536
|
included = true;
|
|
63382
63537
|
break;
|
|
63383
63538
|
}
|
|
@@ -63385,7 +63540,7 @@ var Config = class {
|
|
|
63385
63540
|
if (!included && !this.include.some((pattern) => (0, import_minimatch.default)(filepath, join2(root, pattern)))) {
|
|
63386
63541
|
return false;
|
|
63387
63542
|
}
|
|
63388
|
-
return !this.
|
|
63543
|
+
return !this.excludeFile(filepath);
|
|
63389
63544
|
}
|
|
63390
63545
|
pluginRuntimeDirectory(name) {
|
|
63391
63546
|
return join2(this.pluginDirectory(name), "runtime");
|
|
@@ -63501,23 +63656,9 @@ var Config = class {
|
|
|
63501
63656
|
isInternalEnum(node) {
|
|
63502
63657
|
return node.name.value === "CachePolicy";
|
|
63503
63658
|
}
|
|
63504
|
-
isInternalDirective(
|
|
63505
|
-
|
|
63506
|
-
|
|
63507
|
-
this.listPrependDirective,
|
|
63508
|
-
this.listAppendDirective,
|
|
63509
|
-
this.listParentDirective,
|
|
63510
|
-
this.listAllListsDirective,
|
|
63511
|
-
this.whenDirective,
|
|
63512
|
-
this.whenNotDirective,
|
|
63513
|
-
this.argumentsDirective,
|
|
63514
|
-
this.withDirective,
|
|
63515
|
-
this.paginateDirective,
|
|
63516
|
-
this.cacheDirective,
|
|
63517
|
-
this.loadDirective,
|
|
63518
|
-
this.maskEnableDirective,
|
|
63519
|
-
this.maskDisableDirective
|
|
63520
|
-
].includes(name.value) || this.isDeleteDirective(name.value);
|
|
63659
|
+
isInternalDirective(name) {
|
|
63660
|
+
const internalDirectives = this.#newSchemaInstance?.getDirectives().map((directive) => directive.name) ?? [];
|
|
63661
|
+
return internalDirectives.includes(name) || this.isDeleteDirective(name);
|
|
63521
63662
|
}
|
|
63522
63663
|
isListFragment(name) {
|
|
63523
63664
|
return name.endsWith(this.insertFragmentSuffix) || name.endsWith(this.removeFragmentSuffix) || name.endsWith(this.toggleFragmentSuffix);
|
|
@@ -63575,53 +63716,7 @@ var Config = class {
|
|
|
63575
63716
|
}
|
|
63576
63717
|
};
|
|
63577
63718
|
var DEFAULT_CONFIG_PATH = join2(process.cwd(), "houdini.config.js");
|
|
63578
|
-
async function readConfigFile(configPath = DEFAULT_CONFIG_PATH) {
|
|
63579
|
-
let importPath2 = importPath(configPath);
|
|
63580
|
-
let imported;
|
|
63581
|
-
try {
|
|
63582
|
-
imported = await import(importPath2);
|
|
63583
|
-
} catch (e2) {
|
|
63584
|
-
throw new Error(`Could not load config file at file://${configPath}.
|
|
63585
|
-
${e2.message}`);
|
|
63586
|
-
}
|
|
63587
|
-
const config = imported.default || imported;
|
|
63588
|
-
return config;
|
|
63589
|
-
}
|
|
63590
63719
|
var _config;
|
|
63591
|
-
async function loadSchemaFile(schemaPath) {
|
|
63592
|
-
if (isAbsolute(schemaPath)) {
|
|
63593
|
-
const relPath = relative(process.cwd(), schemaPath);
|
|
63594
|
-
const error = new Error(
|
|
63595
|
-
`Invalid config value: 'schemaPath' must now be passed as a relative directory. Please change its value to "./${relPath}".`
|
|
63596
|
-
);
|
|
63597
|
-
error.stack = "";
|
|
63598
|
-
throw error;
|
|
63599
|
-
}
|
|
63600
|
-
if (glob.hasMagic(schemaPath)) {
|
|
63601
|
-
const sourceFiles = await glob(schemaPath);
|
|
63602
|
-
return mergeSchemas({
|
|
63603
|
-
typeDefs: await Promise.all(
|
|
63604
|
-
sourceFiles.map(async (filepath) => await readFile(filepath))
|
|
63605
|
-
)
|
|
63606
|
-
});
|
|
63607
|
-
}
|
|
63608
|
-
try {
|
|
63609
|
-
await stat(schemaPath);
|
|
63610
|
-
} catch {
|
|
63611
|
-
throw new HoudiniError({
|
|
63612
|
-
message: `Schema file does not exist! Create it using houdini pull-schema`
|
|
63613
|
-
});
|
|
63614
|
-
}
|
|
63615
|
-
const contents = await readFile(schemaPath);
|
|
63616
|
-
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
63617
|
-
return graphql2.buildSchema(contents);
|
|
63618
|
-
}
|
|
63619
|
-
const jsonContents = JSON.parse(contents);
|
|
63620
|
-
if (jsonContents.data) {
|
|
63621
|
-
return graphql2.buildClientSchema(jsonContents.data);
|
|
63622
|
-
}
|
|
63623
|
-
return graphql2.buildClientSchema(jsonContents);
|
|
63624
|
-
}
|
|
63625
63720
|
var pendingConfigPromise = null;
|
|
63626
63721
|
async function getConfig({
|
|
63627
63722
|
configPath = DEFAULT_CONFIG_PATH,
|
|
@@ -63642,15 +63737,34 @@ async function getConfig({
|
|
|
63642
63737
|
resolve2 = res;
|
|
63643
63738
|
reject = rej;
|
|
63644
63739
|
});
|
|
63645
|
-
let configFile = {
|
|
63646
|
-
...await readConfigFile(configPath)
|
|
63647
|
-
};
|
|
63648
|
-
if (!configFile.plugins) {
|
|
63649
|
-
throw new HoudiniError({
|
|
63650
|
-
message: "Welcome to 0.17.0! Please following the migration guide here: http://www.houdinigraphql.com/guides/release-notes#0170"
|
|
63651
|
-
});
|
|
63652
|
-
}
|
|
63653
63740
|
try {
|
|
63741
|
+
let configFile = await readConfigFile(configPath);
|
|
63742
|
+
const pluginsNested = [];
|
|
63743
|
+
for (const [pluginName, plugin_config] of Object.entries(configFile.plugins ?? {})) {
|
|
63744
|
+
let pluginFile = join2(dirname(configPath), pluginName);
|
|
63745
|
+
if (!pluginName.startsWith(".")) {
|
|
63746
|
+
pluginFile = await pluginPath(pluginName, configPath);
|
|
63747
|
+
}
|
|
63748
|
+
const { default: pluginInit } = await import((0, import_url.pathToFileURL)(pluginFile).toString());
|
|
63749
|
+
if (!pluginInit.plugin || !pluginInit.name) {
|
|
63750
|
+
throw new HoudiniError({
|
|
63751
|
+
filepath: pluginFile,
|
|
63752
|
+
message: `The default export does not match the expected shape.`,
|
|
63753
|
+
description: "Please make sure that the file exports the default of the plugin function."
|
|
63754
|
+
});
|
|
63755
|
+
}
|
|
63756
|
+
const hooks = await pluginInit.plugin(plugin_config);
|
|
63757
|
+
const hooksList = (Array.isArray(hooks) ? hooks : [hooks]).filter(Boolean).flat();
|
|
63758
|
+
pluginsNested.push(
|
|
63759
|
+
await flattenPluginList(configPath, hooksList, pluginName, pluginFile)
|
|
63760
|
+
);
|
|
63761
|
+
}
|
|
63762
|
+
const plugins = pluginsNested.flat();
|
|
63763
|
+
for (const plugin2 of plugins) {
|
|
63764
|
+
if (plugin2.config) {
|
|
63765
|
+
configFile = deepMerge(configPath, configFile, await plugin2.config(configFile));
|
|
63766
|
+
}
|
|
63767
|
+
}
|
|
63654
63768
|
_config = new Config({
|
|
63655
63769
|
...configFile,
|
|
63656
63770
|
...extraConfig,
|
|
@@ -63663,7 +63777,7 @@ async function getConfig({
|
|
|
63663
63777
|
if (glob.hasMagic(_config.schemaPath)) {
|
|
63664
63778
|
console.log(
|
|
63665
63779
|
`\u26A0\uFE0F Your houdini configuration contains an apiUrl and a path pointing to multiple files.
|
|
63666
|
-
This will prevent your schema from being pulled.`
|
|
63780
|
+
This will prevent your schema from being pulled.`
|
|
63667
63781
|
);
|
|
63668
63782
|
} else if (!await readFile(_config.schemaPath)) {
|
|
63669
63783
|
console.log("\u231B Pulling schema from api");
|
|
@@ -63674,67 +63788,138 @@ This will prevent your schema from being pulled.`
|
|
|
63674
63788
|
_config.schema = await loadSchemaFile(_config.schemaPath);
|
|
63675
63789
|
}
|
|
63676
63790
|
}
|
|
63791
|
+
_config.plugins = orderedPlugins(plugins);
|
|
63792
|
+
await Promise.all(_config.plugins.map((plugin2) => plugin2.after_load?.({ config: _config })));
|
|
63793
|
+
resolve2(_config);
|
|
63794
|
+
return _config;
|
|
63677
63795
|
} catch (e2) {
|
|
63678
63796
|
reject(e2);
|
|
63679
63797
|
throw e2;
|
|
63680
63798
|
}
|
|
63681
|
-
|
|
63682
|
-
|
|
63683
|
-
|
|
63684
|
-
|
|
63685
|
-
|
|
63686
|
-
|
|
63687
|
-
|
|
63688
|
-
|
|
63689
|
-
|
|
63690
|
-
|
|
63691
|
-
|
|
63692
|
-
|
|
63693
|
-
|
|
63694
|
-
|
|
63695
|
-
|
|
63696
|
-
|
|
63697
|
-
|
|
63698
|
-
|
|
63699
|
-
|
|
63700
|
-
|
|
63799
|
+
}
|
|
63800
|
+
async function flattenPluginList(root, list, name, pluginFile) {
|
|
63801
|
+
const pluginsLeft = [
|
|
63802
|
+
{
|
|
63803
|
+
...plugin(name, async () => list),
|
|
63804
|
+
local: pluginFile
|
|
63805
|
+
}
|
|
63806
|
+
];
|
|
63807
|
+
const result = [];
|
|
63808
|
+
while (pluginsLeft.length > 0) {
|
|
63809
|
+
const head = pluginsLeft.shift();
|
|
63810
|
+
if (!head) {
|
|
63811
|
+
break;
|
|
63812
|
+
}
|
|
63813
|
+
const nestedFile = head.local ?? await pluginPath(head.name, root);
|
|
63814
|
+
const nestedPlugin = await head.plugin(head.config ?? {});
|
|
63815
|
+
const nestedPluginValues = Array.isArray(nestedPlugin) ? nestedPlugin : [nestedPlugin];
|
|
63816
|
+
for (const value of nestedPluginValues) {
|
|
63817
|
+
if (!value) {
|
|
63818
|
+
continue;
|
|
63701
63819
|
}
|
|
63702
|
-
if (
|
|
63703
|
-
|
|
63704
|
-
|
|
63705
|
-
|
|
63706
|
-
|
|
63707
|
-
|
|
63708
|
-
|
|
63820
|
+
if ("__plugin_init__" in value) {
|
|
63821
|
+
pluginsLeft.push(value);
|
|
63822
|
+
} else {
|
|
63823
|
+
result.push({
|
|
63824
|
+
...value,
|
|
63825
|
+
name: head.name,
|
|
63826
|
+
filepath: nestedFile
|
|
63709
63827
|
});
|
|
63710
|
-
|
|
63711
|
-
throw new Error(
|
|
63712
|
-
`Could not find plugin: ${pluginName}. Are you sure its installed? If so, please open a ticket on GitHub.`
|
|
63713
|
-
);
|
|
63828
|
+
}
|
|
63714
63829
|
}
|
|
63715
63830
|
}
|
|
63716
|
-
|
|
63717
|
-
|
|
63718
|
-
|
|
63719
|
-
|
|
63831
|
+
return result;
|
|
63832
|
+
}
|
|
63833
|
+
async function readConfigFile(configPath = DEFAULT_CONFIG_PATH) {
|
|
63834
|
+
let importPath2 = importPath(configPath);
|
|
63835
|
+
let imported;
|
|
63836
|
+
try {
|
|
63837
|
+
imported = await import(importPath2);
|
|
63838
|
+
} catch (e2) {
|
|
63839
|
+
throw new Error(`Could not load config file at file://${configPath}.
|
|
63840
|
+
${e2.message}`);
|
|
63841
|
+
}
|
|
63842
|
+
const config = imported.default || imported;
|
|
63843
|
+
return config;
|
|
63720
63844
|
}
|
|
63721
|
-
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
63722
|
-
LogLevel2["Full"] = "full";
|
|
63723
|
-
LogLevel2["Summary"] = "summary";
|
|
63724
|
-
LogLevel2["ShortSummary"] = "short-summary";
|
|
63725
|
-
LogLevel2["Quiet"] = "quiet";
|
|
63726
|
-
return LogLevel2;
|
|
63727
|
-
})(LogLevel || {});
|
|
63728
63845
|
var orderedPlugins = (plugins) => {
|
|
63729
63846
|
const ordered = plugins.filter(
|
|
63730
|
-
(
|
|
63847
|
+
(plugin2) => plugin2.order === "before" || plugin2.order === void 0
|
|
63731
63848
|
);
|
|
63732
63849
|
ordered.push(
|
|
63733
|
-
...plugins.filter((
|
|
63734
|
-
...plugins.filter((
|
|
63850
|
+
...plugins.filter((plugin2) => plugin2.order === "core"),
|
|
63851
|
+
...plugins.filter((plugin2) => plugin2.order === "after")
|
|
63735
63852
|
);
|
|
63736
63853
|
return ordered;
|
|
63737
63854
|
};
|
|
63855
|
+
async function pluginPath(plugin_name, config_path) {
|
|
63856
|
+
try {
|
|
63857
|
+
const pluginDirectory = findModule(plugin_name, config_path);
|
|
63858
|
+
const packageJsonSrc = await readFile(join2(pluginDirectory, "package.json"));
|
|
63859
|
+
if (!packageJsonSrc) {
|
|
63860
|
+
throw new Error("skip");
|
|
63861
|
+
}
|
|
63862
|
+
const packageJSON = JSON.parse(packageJsonSrc);
|
|
63863
|
+
if (!packageJSON.exports?.["."]?.import) {
|
|
63864
|
+
throw new Error("");
|
|
63865
|
+
}
|
|
63866
|
+
return join2(pluginDirectory, packageJSON.exports["."].import);
|
|
63867
|
+
} catch {
|
|
63868
|
+
const err = new Error(
|
|
63869
|
+
`Could not find plugin: ${plugin_name}. Are you sure its installed? If so, please open a ticket on GitHub.`
|
|
63870
|
+
);
|
|
63871
|
+
throw err;
|
|
63872
|
+
}
|
|
63873
|
+
}
|
|
63874
|
+
function findModule(pkg = "houdini", currentLocation) {
|
|
63875
|
+
const pathEndingBy = ["node_modules", pkg];
|
|
63876
|
+
let locationFound = join2(currentLocation, ...pathEndingBy);
|
|
63877
|
+
let previousLocation = "";
|
|
63878
|
+
const backFolder = [];
|
|
63879
|
+
while (previousLocation !== locationFound && !existsSync(locationFound)) {
|
|
63880
|
+
previousLocation = locationFound;
|
|
63881
|
+
backFolder.push("../");
|
|
63882
|
+
locationFound = join2(currentLocation, ...backFolder, ...pathEndingBy);
|
|
63883
|
+
}
|
|
63884
|
+
if (previousLocation === locationFound) {
|
|
63885
|
+
throw new Error("Could not find any node_modules/houdini folder");
|
|
63886
|
+
}
|
|
63887
|
+
return locationFound;
|
|
63888
|
+
}
|
|
63889
|
+
async function loadSchemaFile(schemaPath) {
|
|
63890
|
+
if (isAbsolute(schemaPath)) {
|
|
63891
|
+
const relPath = relative(process.cwd(), schemaPath);
|
|
63892
|
+
const error = new Error(
|
|
63893
|
+
`Invalid config value: 'schemaPath' must now be passed as a relative directory. Please change its value to "./${relPath}".`
|
|
63894
|
+
);
|
|
63895
|
+
error.stack = "";
|
|
63896
|
+
throw error;
|
|
63897
|
+
}
|
|
63898
|
+
if (glob.hasMagic(schemaPath)) {
|
|
63899
|
+
const sourceFiles = await glob(schemaPath);
|
|
63900
|
+
return mergeSchemas({
|
|
63901
|
+
typeDefs: await Promise.all(
|
|
63902
|
+
sourceFiles.map(async (filepath) => await readFile(filepath))
|
|
63903
|
+
)
|
|
63904
|
+
});
|
|
63905
|
+
}
|
|
63906
|
+
try {
|
|
63907
|
+
await stat(schemaPath);
|
|
63908
|
+
} catch {
|
|
63909
|
+
throw new HoudiniError({
|
|
63910
|
+
message: `Schema file does not exist! Create it using houdini pull-schema`
|
|
63911
|
+
});
|
|
63912
|
+
}
|
|
63913
|
+
const contents = await readFile(schemaPath);
|
|
63914
|
+
if (schemaPath.endsWith("gql") || schemaPath.endsWith("graphql")) {
|
|
63915
|
+
return graphql2.buildSchema(contents);
|
|
63916
|
+
}
|
|
63917
|
+
const jsonContents = JSON.parse(contents);
|
|
63918
|
+
if (jsonContents.data) {
|
|
63919
|
+
return graphql2.buildClientSchema(jsonContents.data);
|
|
63920
|
+
}
|
|
63921
|
+
return graphql2.buildClientSchema(jsonContents);
|
|
63922
|
+
}
|
|
63738
63923
|
|
|
63739
63924
|
// src/lib/graphql.ts
|
|
63740
63925
|
var import_crypto = __toESM(require("crypto"), 1);
|
|
@@ -63748,8 +63933,10 @@ function getRootType(type) {
|
|
|
63748
63933
|
}
|
|
63749
63934
|
return type;
|
|
63750
63935
|
}
|
|
63751
|
-
function hashDocument(
|
|
63752
|
-
|
|
63936
|
+
function hashDocument({
|
|
63937
|
+
document
|
|
63938
|
+
}) {
|
|
63939
|
+
const docString = typeof document === "string" ? document : graphql3.print(document.document);
|
|
63753
63940
|
return import_crypto.default.createHash("sha256").update(docString).digest("hex");
|
|
63754
63941
|
}
|
|
63755
63942
|
function parentTypeFromAncestors(schema, filepath, ancestors) {
|
|
@@ -64179,6 +64366,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
64179
64366
|
TypeWrapper,
|
|
64180
64367
|
cleanupFiles,
|
|
64181
64368
|
computeID,
|
|
64369
|
+
deepMerge,
|
|
64182
64370
|
defaultConfigValues,
|
|
64183
64371
|
definitionFromAncestors,
|
|
64184
64372
|
ensureArtifactImport,
|
|
@@ -64199,6 +64387,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
64199
64387
|
parseJS,
|
|
64200
64388
|
parseJSON,
|
|
64201
64389
|
path,
|
|
64390
|
+
plugin,
|
|
64202
64391
|
pullSchema,
|
|
64203
64392
|
readConfigFile,
|
|
64204
64393
|
runPipeline,
|