houdini 1.1.3 → 1.1.4-react.0
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 +230 -158
- package/build/cmd-esm/index.js +230 -158
- package/build/codegen-cjs/index.js +217 -156
- package/build/codegen-esm/index.js +217 -156
- package/build/lib/config.d.ts +1 -0
- package/build/lib/parse.d.ts +2 -1
- package/build/lib/types.d.ts +4 -1
- package/build/lib-cjs/index.js +178 -146
- package/build/lib-esm/index.js +178 -146
- package/build/runtime/client/documentStore.d.ts +3 -0
- package/build/runtime/client/index.d.ts +1 -1
- package/build/runtime/lib/pageInfo.d.ts +7 -0
- package/build/runtime/lib/pagination.d.ts +29 -0
- package/build/runtime/lib/types.d.ts +46 -0
- package/build/runtime-cjs/client/documentStore.d.ts +3 -0
- package/build/runtime-cjs/client/documentStore.js +11 -6
- package/build/runtime-cjs/client/index.d.ts +1 -1
- package/build/runtime-cjs/client/plugins/cache.js +6 -3
- package/build/runtime-cjs/client/plugins/fragment.js +8 -1
- package/build/runtime-cjs/client/plugins/query.js +2 -1
- package/build/runtime-cjs/lib/pageInfo.d.ts +7 -0
- package/build/runtime-cjs/lib/pageInfo.js +79 -0
- package/build/runtime-cjs/lib/pagination.d.ts +29 -0
- package/build/runtime-cjs/lib/pagination.js +231 -0
- package/build/runtime-cjs/lib/types.d.ts +46 -0
- package/build/runtime-esm/client/documentStore.d.ts +3 -0
- package/build/runtime-esm/client/documentStore.js +11 -6
- package/build/runtime-esm/client/index.d.ts +1 -1
- package/build/runtime-esm/client/plugins/cache.js +6 -3
- package/build/runtime-esm/client/plugins/fragment.js +8 -1
- package/build/runtime-esm/client/plugins/query.js +2 -1
- package/build/runtime-esm/lib/pageInfo.d.ts +7 -0
- package/build/runtime-esm/lib/pageInfo.js +52 -0
- package/build/runtime-esm/lib/pagination.d.ts +29 -0
- package/build/runtime-esm/lib/pagination.js +206 -0
- package/build/runtime-esm/lib/types.d.ts +46 -0
- package/build/test-cjs/index.js +224 -155
- package/build/test-esm/index.js +224 -155
- package/build/vite-cjs/index.js +228 -156
- package/build/vite-esm/index.js +228 -156
- package/package.json +1 -1
package/build/vite-esm/index.js
CHANGED
|
@@ -6551,7 +6551,7 @@ var require_visitor = __commonJS({
|
|
|
6551
6551
|
Object.defineProperty(exports, "__esModule", {
|
|
6552
6552
|
value: true
|
|
6553
6553
|
});
|
|
6554
|
-
exports.visit =
|
|
6554
|
+
exports.visit = visit14;
|
|
6555
6555
|
exports.visitInParallel = visitInParallel;
|
|
6556
6556
|
exports.getVisitFn = getVisitFn;
|
|
6557
6557
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -6614,7 +6614,7 @@ var require_visitor = __commonJS({
|
|
|
6614
6614
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
6615
6615
|
var BREAK = Object.freeze({});
|
|
6616
6616
|
exports.BREAK = BREAK;
|
|
6617
|
-
function
|
|
6617
|
+
function visit14(root, visitor) {
|
|
6618
6618
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
6619
6619
|
var stack = void 0;
|
|
6620
6620
|
var inArray = Array.isArray(root);
|
|
@@ -45406,6 +45406,109 @@ var require_lib3 = __commonJS({
|
|
|
45406
45406
|
}
|
|
45407
45407
|
});
|
|
45408
45408
|
|
|
45409
|
+
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
45410
|
+
var require_cjs = __commonJS({
|
|
45411
|
+
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
45412
|
+
"use strict";
|
|
45413
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
45414
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
45415
|
+
};
|
|
45416
|
+
function isNonNullObject(value) {
|
|
45417
|
+
return !!value && typeof value === "object";
|
|
45418
|
+
}
|
|
45419
|
+
function isSpecial(value) {
|
|
45420
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
45421
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
45422
|
+
}
|
|
45423
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
45424
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
45425
|
+
function isReactElement(value) {
|
|
45426
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
45427
|
+
}
|
|
45428
|
+
function emptyTarget(val) {
|
|
45429
|
+
return Array.isArray(val) ? [] : {};
|
|
45430
|
+
}
|
|
45431
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
45432
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
45433
|
+
}
|
|
45434
|
+
function defaultArrayMerge(target, source, options) {
|
|
45435
|
+
return target.concat(source).map(function(element) {
|
|
45436
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
45437
|
+
});
|
|
45438
|
+
}
|
|
45439
|
+
function getMergeFunction(key, options) {
|
|
45440
|
+
if (!options.customMerge) {
|
|
45441
|
+
return deepmerge;
|
|
45442
|
+
}
|
|
45443
|
+
var customMerge = options.customMerge(key);
|
|
45444
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
45445
|
+
}
|
|
45446
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
45447
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
45448
|
+
return target.propertyIsEnumerable(symbol);
|
|
45449
|
+
}) : [];
|
|
45450
|
+
}
|
|
45451
|
+
function getKeys(target) {
|
|
45452
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
45453
|
+
}
|
|
45454
|
+
function propertyIsOnObject(object, property) {
|
|
45455
|
+
try {
|
|
45456
|
+
return property in object;
|
|
45457
|
+
} catch (_) {
|
|
45458
|
+
return false;
|
|
45459
|
+
}
|
|
45460
|
+
}
|
|
45461
|
+
function propertyIsUnsafe(target, key) {
|
|
45462
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
45463
|
+
}
|
|
45464
|
+
function mergeObject(target, source, options) {
|
|
45465
|
+
var destination = {};
|
|
45466
|
+
if (options.isMergeableObject(target)) {
|
|
45467
|
+
getKeys(target).forEach(function(key) {
|
|
45468
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
45469
|
+
});
|
|
45470
|
+
}
|
|
45471
|
+
getKeys(source).forEach(function(key) {
|
|
45472
|
+
if (propertyIsUnsafe(target, key)) {
|
|
45473
|
+
return;
|
|
45474
|
+
}
|
|
45475
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
45476
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
45477
|
+
} else {
|
|
45478
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
45479
|
+
}
|
|
45480
|
+
});
|
|
45481
|
+
return destination;
|
|
45482
|
+
}
|
|
45483
|
+
function deepmerge(target, source, options) {
|
|
45484
|
+
options = options || {};
|
|
45485
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
45486
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
45487
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
45488
|
+
var sourceIsArray = Array.isArray(source);
|
|
45489
|
+
var targetIsArray = Array.isArray(target);
|
|
45490
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
45491
|
+
if (!sourceAndTargetTypesMatch) {
|
|
45492
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
45493
|
+
} else if (sourceIsArray) {
|
|
45494
|
+
return options.arrayMerge(target, source, options);
|
|
45495
|
+
} else {
|
|
45496
|
+
return mergeObject(target, source, options);
|
|
45497
|
+
}
|
|
45498
|
+
}
|
|
45499
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
45500
|
+
if (!Array.isArray(array)) {
|
|
45501
|
+
throw new Error("first argument should be an array");
|
|
45502
|
+
}
|
|
45503
|
+
return array.reduce(function(prev, next) {
|
|
45504
|
+
return deepmerge(prev, next, options);
|
|
45505
|
+
}, {});
|
|
45506
|
+
};
|
|
45507
|
+
var deepmerge_1 = deepmerge;
|
|
45508
|
+
module.exports = deepmerge_1;
|
|
45509
|
+
}
|
|
45510
|
+
});
|
|
45511
|
+
|
|
45409
45512
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
45410
45513
|
var require_tslib = __commonJS({
|
|
45411
45514
|
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module) {
|
|
@@ -47675,7 +47778,7 @@ var require_path_visitor = __commonJS({
|
|
|
47675
47778
|
}
|
|
47676
47779
|
return target;
|
|
47677
47780
|
}
|
|
47678
|
-
PathVisitor.visit = function
|
|
47781
|
+
PathVisitor.visit = function visit14(node, methods) {
|
|
47679
47782
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
47680
47783
|
};
|
|
47681
47784
|
var PVp = PathVisitor.prototype;
|
|
@@ -47866,7 +47969,7 @@ var require_path_visitor = __commonJS({
|
|
|
47866
47969
|
this.needToCallTraverse = false;
|
|
47867
47970
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
47868
47971
|
};
|
|
47869
|
-
sharedContextProtoMethods.visit = function
|
|
47972
|
+
sharedContextProtoMethods.visit = function visit14(path2, newVisitor) {
|
|
47870
47973
|
if (!(this instanceof this.Context)) {
|
|
47871
47974
|
throw new Error("");
|
|
47872
47975
|
}
|
|
@@ -49259,7 +49362,7 @@ var require_main = __commonJS({
|
|
|
49259
49362
|
var someField = _a.someField;
|
|
49260
49363
|
var Type = _a.Type;
|
|
49261
49364
|
var use = _a.use;
|
|
49262
|
-
var
|
|
49365
|
+
var visit14 = _a.visit;
|
|
49263
49366
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
49264
49367
|
exports.builders = builders;
|
|
49265
49368
|
exports.builtInTypes = builtInTypes;
|
|
@@ -49276,7 +49379,7 @@ var require_main = __commonJS({
|
|
|
49276
49379
|
exports.someField = someField;
|
|
49277
49380
|
exports.Type = Type;
|
|
49278
49381
|
exports.use = use;
|
|
49279
|
-
exports.visit =
|
|
49382
|
+
exports.visit = visit14;
|
|
49280
49383
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
49281
49384
|
}
|
|
49282
49385
|
});
|
|
@@ -61738,109 +61841,6 @@ var require_main2 = __commonJS({
|
|
|
61738
61841
|
}
|
|
61739
61842
|
});
|
|
61740
61843
|
|
|
61741
|
-
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
61742
|
-
var require_cjs = __commonJS({
|
|
61743
|
-
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
61744
|
-
"use strict";
|
|
61745
|
-
var isMergeableObject = function isMergeableObject2(value) {
|
|
61746
|
-
return isNonNullObject(value) && !isSpecial(value);
|
|
61747
|
-
};
|
|
61748
|
-
function isNonNullObject(value) {
|
|
61749
|
-
return !!value && typeof value === "object";
|
|
61750
|
-
}
|
|
61751
|
-
function isSpecial(value) {
|
|
61752
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
61753
|
-
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
61754
|
-
}
|
|
61755
|
-
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
61756
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
61757
|
-
function isReactElement(value) {
|
|
61758
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
61759
|
-
}
|
|
61760
|
-
function emptyTarget(val) {
|
|
61761
|
-
return Array.isArray(val) ? [] : {};
|
|
61762
|
-
}
|
|
61763
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
61764
|
-
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
61765
|
-
}
|
|
61766
|
-
function defaultArrayMerge(target, source, options) {
|
|
61767
|
-
return target.concat(source).map(function(element) {
|
|
61768
|
-
return cloneUnlessOtherwiseSpecified(element, options);
|
|
61769
|
-
});
|
|
61770
|
-
}
|
|
61771
|
-
function getMergeFunction(key, options) {
|
|
61772
|
-
if (!options.customMerge) {
|
|
61773
|
-
return deepmerge;
|
|
61774
|
-
}
|
|
61775
|
-
var customMerge = options.customMerge(key);
|
|
61776
|
-
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
61777
|
-
}
|
|
61778
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
61779
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
61780
|
-
return target.propertyIsEnumerable(symbol);
|
|
61781
|
-
}) : [];
|
|
61782
|
-
}
|
|
61783
|
-
function getKeys(target) {
|
|
61784
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
61785
|
-
}
|
|
61786
|
-
function propertyIsOnObject(object, property) {
|
|
61787
|
-
try {
|
|
61788
|
-
return property in object;
|
|
61789
|
-
} catch (_) {
|
|
61790
|
-
return false;
|
|
61791
|
-
}
|
|
61792
|
-
}
|
|
61793
|
-
function propertyIsUnsafe(target, key) {
|
|
61794
|
-
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
61795
|
-
}
|
|
61796
|
-
function mergeObject(target, source, options) {
|
|
61797
|
-
var destination = {};
|
|
61798
|
-
if (options.isMergeableObject(target)) {
|
|
61799
|
-
getKeys(target).forEach(function(key) {
|
|
61800
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
61801
|
-
});
|
|
61802
|
-
}
|
|
61803
|
-
getKeys(source).forEach(function(key) {
|
|
61804
|
-
if (propertyIsUnsafe(target, key)) {
|
|
61805
|
-
return;
|
|
61806
|
-
}
|
|
61807
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
61808
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
61809
|
-
} else {
|
|
61810
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
61811
|
-
}
|
|
61812
|
-
});
|
|
61813
|
-
return destination;
|
|
61814
|
-
}
|
|
61815
|
-
function deepmerge(target, source, options) {
|
|
61816
|
-
options = options || {};
|
|
61817
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
61818
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
61819
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
61820
|
-
var sourceIsArray = Array.isArray(source);
|
|
61821
|
-
var targetIsArray = Array.isArray(target);
|
|
61822
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
61823
|
-
if (!sourceAndTargetTypesMatch) {
|
|
61824
|
-
return cloneUnlessOtherwiseSpecified(source, options);
|
|
61825
|
-
} else if (sourceIsArray) {
|
|
61826
|
-
return options.arrayMerge(target, source, options);
|
|
61827
|
-
} else {
|
|
61828
|
-
return mergeObject(target, source, options);
|
|
61829
|
-
}
|
|
61830
|
-
}
|
|
61831
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
61832
|
-
if (!Array.isArray(array)) {
|
|
61833
|
-
throw new Error("first argument should be an array");
|
|
61834
|
-
}
|
|
61835
|
-
return array.reduce(function(prev, next) {
|
|
61836
|
-
return deepmerge(prev, next, options);
|
|
61837
|
-
}, {});
|
|
61838
|
-
};
|
|
61839
|
-
var deepmerge_1 = deepmerge;
|
|
61840
|
-
module.exports = deepmerge_1;
|
|
61841
|
-
}
|
|
61842
|
-
});
|
|
61843
|
-
|
|
61844
61844
|
// src/vite/index.ts
|
|
61845
61845
|
var import_minimatch2 = __toESM(require_minimatch(), 1);
|
|
61846
61846
|
|
|
@@ -69001,10 +69001,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
69001
69001
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
69002
69002
|
}
|
|
69003
69003
|
lastVariables = { ...marshalVariables(ctx) };
|
|
69004
|
+
const variables = lastVariables;
|
|
69004
69005
|
subscriptionSpec = {
|
|
69005
69006
|
rootType: ctx.artifact.rootType,
|
|
69006
69007
|
selection: ctx.artifact.selection,
|
|
69007
|
-
variables: () =>
|
|
69008
|
+
variables: () => variables,
|
|
69008
69009
|
set: (newValue) => {
|
|
69009
69010
|
resolve2(ctx, {
|
|
69010
69011
|
data: newValue,
|
|
@@ -69033,12 +69034,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
69033
69034
|
// src/runtime/client/plugins/fragment.ts
|
|
69034
69035
|
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
69035
69036
|
let subscriptionSpec = null;
|
|
69037
|
+
let lastReference = null;
|
|
69036
69038
|
return {
|
|
69037
69039
|
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
69038
69040
|
if (!ctx.stuff.parentID) {
|
|
69039
69041
|
return next(ctx);
|
|
69040
69042
|
}
|
|
69041
|
-
|
|
69043
|
+
const currentReference = {
|
|
69044
|
+
parent: ctx.stuff.parentID,
|
|
69045
|
+
variables: marshalVariables(ctx)
|
|
69046
|
+
};
|
|
69047
|
+
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
69042
69048
|
if (subscriptionSpec) {
|
|
69043
69049
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
69044
69050
|
}
|
|
@@ -69061,6 +69067,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
69061
69067
|
}
|
|
69062
69068
|
};
|
|
69063
69069
|
cache_default.subscribe(subscriptionSpec, variables);
|
|
69070
|
+
lastReference = currentReference;
|
|
69064
69071
|
}
|
|
69065
69072
|
next(ctx);
|
|
69066
69073
|
},
|
|
@@ -69568,6 +69575,17 @@ var Config = class {
|
|
|
69568
69575
|
}, []) ?? [];
|
|
69569
69576
|
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
69570
69577
|
}
|
|
69578
|
+
needsRefetchArtifact(document) {
|
|
69579
|
+
let needsArtifact = false;
|
|
69580
|
+
graphql2.visit(document, {
|
|
69581
|
+
Directive: (node) => {
|
|
69582
|
+
if ([this.paginateDirective].includes(node.name.value)) {
|
|
69583
|
+
needsArtifact = true;
|
|
69584
|
+
}
|
|
69585
|
+
}
|
|
69586
|
+
});
|
|
69587
|
+
return needsArtifact;
|
|
69588
|
+
}
|
|
69571
69589
|
#fragmentVariableMaps;
|
|
69572
69590
|
registerFragmentVariablesHash({
|
|
69573
69591
|
hash,
|
|
@@ -70056,13 +70074,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
|
70056
70074
|
|
|
70057
70075
|
// src/lib/parse.ts
|
|
70058
70076
|
var import_parser = __toESM(require_lib3(), 1);
|
|
70059
|
-
|
|
70077
|
+
|
|
70078
|
+
// src/lib/deepMerge.ts
|
|
70079
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
70080
|
+
function deepMerge(filepath, ...targets) {
|
|
70081
|
+
try {
|
|
70082
|
+
if (targets.length === 1) {
|
|
70083
|
+
return targets[0];
|
|
70084
|
+
} else if (targets.length === 2) {
|
|
70085
|
+
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
70086
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
70087
|
+
});
|
|
70088
|
+
}
|
|
70089
|
+
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
70090
|
+
} catch (e2) {
|
|
70091
|
+
throw new HoudiniError({
|
|
70092
|
+
filepath,
|
|
70093
|
+
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
70094
|
+
description: e2.message
|
|
70095
|
+
});
|
|
70096
|
+
}
|
|
70097
|
+
}
|
|
70098
|
+
|
|
70099
|
+
// src/lib/parse.ts
|
|
70100
|
+
async function parseJS(str, config4) {
|
|
70101
|
+
const defaultConfig = {
|
|
70102
|
+
plugins: ["typescript"],
|
|
70103
|
+
sourceType: "module"
|
|
70104
|
+
};
|
|
70060
70105
|
return {
|
|
70061
70106
|
start: 0,
|
|
70062
|
-
script: (0, import_parser.parse)(
|
|
70063
|
-
|
|
70064
|
-
|
|
70065
|
-
|
|
70107
|
+
script: (0, import_parser.parse)(
|
|
70108
|
+
str || "",
|
|
70109
|
+
config4 ? deepMerge("", defaultConfig, config4) : defaultConfig
|
|
70110
|
+
).program,
|
|
70066
70111
|
end: str.length
|
|
70067
70112
|
};
|
|
70068
70113
|
}
|
|
@@ -70112,27 +70157,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
70112
70157
|
return allFilesNotInList;
|
|
70113
70158
|
}
|
|
70114
70159
|
|
|
70115
|
-
// src/lib/deepMerge.ts
|
|
70116
|
-
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
70117
|
-
function deepMerge(filepath, ...targets) {
|
|
70118
|
-
try {
|
|
70119
|
-
if (targets.length === 1) {
|
|
70120
|
-
return targets[0];
|
|
70121
|
-
} else if (targets.length === 2) {
|
|
70122
|
-
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
70123
|
-
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
70124
|
-
});
|
|
70125
|
-
}
|
|
70126
|
-
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
70127
|
-
} catch (e2) {
|
|
70128
|
-
throw new HoudiniError({
|
|
70129
|
-
filepath,
|
|
70130
|
-
message: "could not merge: " + targets,
|
|
70131
|
-
description: e2.message
|
|
70132
|
-
});
|
|
70133
|
-
}
|
|
70134
|
-
}
|
|
70135
|
-
|
|
70136
70160
|
// ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
|
|
70137
70161
|
var WalkerBase = class {
|
|
70138
70162
|
constructor() {
|
|
@@ -72997,12 +73021,12 @@ ${exportStatement("config")}
|
|
|
72997
73021
|
},
|
|
72998
73022
|
[path_exports.join(config4.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config4, content, importStatement, exportStatement })
|
|
72999
73023
|
}),
|
|
73000
|
-
...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, plugin2)),
|
|
73024
|
+
...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, docs, plugin2)),
|
|
73001
73025
|
generatePluginIndex({ config: config4, exportStatement: exportStar })
|
|
73002
73026
|
]);
|
|
73003
73027
|
await generateGraphqlReturnTypes(config4, docs);
|
|
73004
73028
|
}
|
|
73005
|
-
async function generatePluginRuntime(config4, plugin2) {
|
|
73029
|
+
async function generatePluginRuntime(config4, docs, plugin2) {
|
|
73006
73030
|
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
73007
73031
|
return;
|
|
73008
73032
|
}
|
|
@@ -73019,12 +73043,16 @@ async function generatePluginRuntime(config4, plugin2) {
|
|
|
73019
73043
|
});
|
|
73020
73044
|
}
|
|
73021
73045
|
const pluginDir = config4.pluginRuntimeDirectory(plugin2.name);
|
|
73046
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
73047
|
+
if (transformMap && typeof transformMap === "function") {
|
|
73048
|
+
transformMap = transformMap(docs);
|
|
73049
|
+
}
|
|
73022
73050
|
await fs_exports.mkdirp(pluginDir);
|
|
73023
73051
|
await fs_exports.recursiveCopy(
|
|
73024
73052
|
runtime_path,
|
|
73025
73053
|
pluginDir,
|
|
73026
73054
|
Object.fromEntries(
|
|
73027
|
-
Object.entries(
|
|
73055
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
73028
73056
|
path_exports.join(runtime_path, key),
|
|
73029
73057
|
(content) => value({ config: config4, content })
|
|
73030
73058
|
])
|
|
@@ -73464,7 +73492,8 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
73464
73492
|
originalParsed: originalDocument,
|
|
73465
73493
|
name,
|
|
73466
73494
|
filename,
|
|
73467
|
-
generateArtifact
|
|
73495
|
+
generateArtifact,
|
|
73496
|
+
artifact
|
|
73468
73497
|
}) => {
|
|
73469
73498
|
if (!generateArtifact) {
|
|
73470
73499
|
return;
|
|
@@ -73503,6 +73532,14 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
73503
73532
|
missingScalars
|
|
73504
73533
|
);
|
|
73505
73534
|
}
|
|
73535
|
+
program.body.push(
|
|
73536
|
+
AST11.exportNamedDeclaration(
|
|
73537
|
+
AST11.tsTypeAliasDeclaration(
|
|
73538
|
+
AST11.identifier(`${name}$artifact`),
|
|
73539
|
+
convertToTs(serializeValue(artifact))
|
|
73540
|
+
)
|
|
73541
|
+
)
|
|
73542
|
+
);
|
|
73506
73543
|
await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
|
|
73507
73544
|
typePaths.push(typeDefPath);
|
|
73508
73545
|
}
|
|
@@ -73529,18 +73566,17 @@ export * from "${module}"
|
|
|
73529
73566
|
`;
|
|
73530
73567
|
let indexContent = recast11.print(typeIndex).code;
|
|
73531
73568
|
for (const plugin2 of config4.plugins) {
|
|
73532
|
-
if (
|
|
73533
|
-
|
|
73569
|
+
if (plugin2.indexFile) {
|
|
73570
|
+
indexContent = plugin2.indexFile({
|
|
73571
|
+
config: config4,
|
|
73572
|
+
content: indexContent,
|
|
73573
|
+
exportDefaultAs,
|
|
73574
|
+
exportStarFrom: exportStarFrom2,
|
|
73575
|
+
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
73576
|
+
typedef: true,
|
|
73577
|
+
documents: docs
|
|
73578
|
+
});
|
|
73534
73579
|
}
|
|
73535
|
-
indexContent = plugin2.indexFile({
|
|
73536
|
-
config: config4,
|
|
73537
|
-
content: indexContent,
|
|
73538
|
-
exportDefaultAs,
|
|
73539
|
-
exportStarFrom: exportStarFrom2,
|
|
73540
|
-
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
73541
|
-
typedef: true,
|
|
73542
|
-
documents: docs
|
|
73543
|
-
});
|
|
73544
73580
|
if (plugin2.includeRuntime) {
|
|
73545
73581
|
indexContent += exportStarFrom2({
|
|
73546
73582
|
module: "./" + path_exports.relative(config4.rootDir, config4.pluginRuntimeDirectory(plugin2.name))
|
|
@@ -73572,6 +73608,42 @@ ${[...missingScalars].map(
|
|
|
73572
73608
|
For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
|
|
73573
73609
|
}
|
|
73574
73610
|
}
|
|
73611
|
+
function convertToTs(source) {
|
|
73612
|
+
if (source.type === "ObjectExpression") {
|
|
73613
|
+
return AST11.tsTypeLiteral(
|
|
73614
|
+
source.properties.reduce(
|
|
73615
|
+
(props, prop) => {
|
|
73616
|
+
if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
|
|
73617
|
+
return props;
|
|
73618
|
+
}
|
|
73619
|
+
return [
|
|
73620
|
+
...props,
|
|
73621
|
+
AST11.tsPropertySignature(
|
|
73622
|
+
prop.key,
|
|
73623
|
+
AST11.tsTypeAnnotation(convertToTs(prop.value))
|
|
73624
|
+
)
|
|
73625
|
+
];
|
|
73626
|
+
},
|
|
73627
|
+
[]
|
|
73628
|
+
)
|
|
73629
|
+
);
|
|
73630
|
+
}
|
|
73631
|
+
if (source.type === "ArrayExpression") {
|
|
73632
|
+
return AST11.tsTupleType(
|
|
73633
|
+
source.elements.map((element) => convertToTs(element))
|
|
73634
|
+
);
|
|
73635
|
+
}
|
|
73636
|
+
if (source.type === "Literal" && typeof source.value === "boolean") {
|
|
73637
|
+
return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
|
|
73638
|
+
}
|
|
73639
|
+
if (source.type === "Literal" && typeof source.value === "number") {
|
|
73640
|
+
return AST11.tsLiteralType(AST11.numericLiteral(source.value));
|
|
73641
|
+
}
|
|
73642
|
+
if (source.type === "Literal" && typeof source.value === "string") {
|
|
73643
|
+
return AST11.tsLiteralType(AST11.stringLiteral(source.value));
|
|
73644
|
+
}
|
|
73645
|
+
return AST11.tsLiteralType(source);
|
|
73646
|
+
}
|
|
73575
73647
|
async function generateOperationTypeDefs(config4, filepath, body, definition, selections, visitedTypes, missingScalars) {
|
|
73576
73648
|
let parentType = null;
|
|
73577
73649
|
if (definition.operation === "query") {
|
|
@@ -74279,9 +74351,6 @@ async function writeIndexFile2(config4, docs) {
|
|
|
74279
74351
|
module: relative2(config4.pluginRuntimeDirectory(plugin2.name))
|
|
74280
74352
|
});
|
|
74281
74353
|
}
|
|
74282
|
-
if (!plugin2.indexFile) {
|
|
74283
|
-
continue;
|
|
74284
|
-
}
|
|
74285
74354
|
}
|
|
74286
74355
|
await fs_exports.writeFile(path_exports.join(config4.rootDir, "index.js"), body);
|
|
74287
74356
|
}
|
|
@@ -75547,7 +75616,10 @@ async function collectDocuments(config4) {
|
|
|
75547
75616
|
}
|
|
75548
75617
|
}
|
|
75549
75618
|
} catch (err) {
|
|
75550
|
-
throw
|
|
75619
|
+
throw {
|
|
75620
|
+
message: err.message,
|
|
75621
|
+
filepath
|
|
75622
|
+
};
|
|
75551
75623
|
}
|
|
75552
75624
|
})
|
|
75553
75625
|
);
|