houdini 1.1.3 → 1.2.0-react.1
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/cmd-esm/index.js
CHANGED
|
@@ -4157,7 +4157,7 @@ var require_visitor = __commonJS({
|
|
|
4157
4157
|
Object.defineProperty(exports, "__esModule", {
|
|
4158
4158
|
value: true
|
|
4159
4159
|
});
|
|
4160
|
-
exports.visit =
|
|
4160
|
+
exports.visit = visit14;
|
|
4161
4161
|
exports.visitInParallel = visitInParallel;
|
|
4162
4162
|
exports.getVisitFn = getVisitFn;
|
|
4163
4163
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -4220,7 +4220,7 @@ var require_visitor = __commonJS({
|
|
|
4220
4220
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
4221
4221
|
var BREAK = Object.freeze({});
|
|
4222
4222
|
exports.BREAK = BREAK;
|
|
4223
|
-
function
|
|
4223
|
+
function visit14(root, visitor) {
|
|
4224
4224
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
4225
4225
|
var stack = void 0;
|
|
4226
4226
|
var inArray = Array.isArray(root);
|
|
@@ -43775,6 +43775,109 @@ var require_lib3 = __commonJS({
|
|
|
43775
43775
|
}
|
|
43776
43776
|
});
|
|
43777
43777
|
|
|
43778
|
+
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
43779
|
+
var require_cjs = __commonJS({
|
|
43780
|
+
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
43781
|
+
"use strict";
|
|
43782
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
43783
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
43784
|
+
};
|
|
43785
|
+
function isNonNullObject(value) {
|
|
43786
|
+
return !!value && typeof value === "object";
|
|
43787
|
+
}
|
|
43788
|
+
function isSpecial(value) {
|
|
43789
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
43790
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
43791
|
+
}
|
|
43792
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
43793
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
43794
|
+
function isReactElement(value) {
|
|
43795
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
43796
|
+
}
|
|
43797
|
+
function emptyTarget(val) {
|
|
43798
|
+
return Array.isArray(val) ? [] : {};
|
|
43799
|
+
}
|
|
43800
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
43801
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
43802
|
+
}
|
|
43803
|
+
function defaultArrayMerge(target, source, options) {
|
|
43804
|
+
return target.concat(source).map(function(element) {
|
|
43805
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
43806
|
+
});
|
|
43807
|
+
}
|
|
43808
|
+
function getMergeFunction(key, options) {
|
|
43809
|
+
if (!options.customMerge) {
|
|
43810
|
+
return deepmerge;
|
|
43811
|
+
}
|
|
43812
|
+
var customMerge = options.customMerge(key);
|
|
43813
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
43814
|
+
}
|
|
43815
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
43816
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
43817
|
+
return target.propertyIsEnumerable(symbol);
|
|
43818
|
+
}) : [];
|
|
43819
|
+
}
|
|
43820
|
+
function getKeys(target) {
|
|
43821
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
43822
|
+
}
|
|
43823
|
+
function propertyIsOnObject(object, property) {
|
|
43824
|
+
try {
|
|
43825
|
+
return property in object;
|
|
43826
|
+
} catch (_) {
|
|
43827
|
+
return false;
|
|
43828
|
+
}
|
|
43829
|
+
}
|
|
43830
|
+
function propertyIsUnsafe(target, key) {
|
|
43831
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
43832
|
+
}
|
|
43833
|
+
function mergeObject(target, source, options) {
|
|
43834
|
+
var destination = {};
|
|
43835
|
+
if (options.isMergeableObject(target)) {
|
|
43836
|
+
getKeys(target).forEach(function(key) {
|
|
43837
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
43838
|
+
});
|
|
43839
|
+
}
|
|
43840
|
+
getKeys(source).forEach(function(key) {
|
|
43841
|
+
if (propertyIsUnsafe(target, key)) {
|
|
43842
|
+
return;
|
|
43843
|
+
}
|
|
43844
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
43845
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
43846
|
+
} else {
|
|
43847
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
43848
|
+
}
|
|
43849
|
+
});
|
|
43850
|
+
return destination;
|
|
43851
|
+
}
|
|
43852
|
+
function deepmerge(target, source, options) {
|
|
43853
|
+
options = options || {};
|
|
43854
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
43855
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
43856
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
43857
|
+
var sourceIsArray = Array.isArray(source);
|
|
43858
|
+
var targetIsArray = Array.isArray(target);
|
|
43859
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
43860
|
+
if (!sourceAndTargetTypesMatch) {
|
|
43861
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
43862
|
+
} else if (sourceIsArray) {
|
|
43863
|
+
return options.arrayMerge(target, source, options);
|
|
43864
|
+
} else {
|
|
43865
|
+
return mergeObject(target, source, options);
|
|
43866
|
+
}
|
|
43867
|
+
}
|
|
43868
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
43869
|
+
if (!Array.isArray(array)) {
|
|
43870
|
+
throw new Error("first argument should be an array");
|
|
43871
|
+
}
|
|
43872
|
+
return array.reduce(function(prev, next) {
|
|
43873
|
+
return deepmerge(prev, next, options);
|
|
43874
|
+
}, {});
|
|
43875
|
+
};
|
|
43876
|
+
var deepmerge_1 = deepmerge;
|
|
43877
|
+
module.exports = deepmerge_1;
|
|
43878
|
+
}
|
|
43879
|
+
});
|
|
43880
|
+
|
|
43778
43881
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
43779
43882
|
var require_tslib = __commonJS({
|
|
43780
43883
|
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module) {
|
|
@@ -46044,7 +46147,7 @@ var require_path_visitor = __commonJS({
|
|
|
46044
46147
|
}
|
|
46045
46148
|
return target;
|
|
46046
46149
|
}
|
|
46047
|
-
PathVisitor.visit = function
|
|
46150
|
+
PathVisitor.visit = function visit14(node, methods) {
|
|
46048
46151
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
46049
46152
|
};
|
|
46050
46153
|
var PVp = PathVisitor.prototype;
|
|
@@ -46235,7 +46338,7 @@ var require_path_visitor = __commonJS({
|
|
|
46235
46338
|
this.needToCallTraverse = false;
|
|
46236
46339
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
46237
46340
|
};
|
|
46238
|
-
sharedContextProtoMethods.visit = function
|
|
46341
|
+
sharedContextProtoMethods.visit = function visit14(path2, newVisitor) {
|
|
46239
46342
|
if (!(this instanceof this.Context)) {
|
|
46240
46343
|
throw new Error("");
|
|
46241
46344
|
}
|
|
@@ -47628,7 +47731,7 @@ var require_main = __commonJS({
|
|
|
47628
47731
|
var someField = _a.someField;
|
|
47629
47732
|
var Type = _a.Type;
|
|
47630
47733
|
var use = _a.use;
|
|
47631
|
-
var
|
|
47734
|
+
var visit14 = _a.visit;
|
|
47632
47735
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
47633
47736
|
exports.builders = builders;
|
|
47634
47737
|
exports.builtInTypes = builtInTypes;
|
|
@@ -47645,7 +47748,7 @@ var require_main = __commonJS({
|
|
|
47645
47748
|
exports.someField = someField;
|
|
47646
47749
|
exports.Type = Type;
|
|
47647
47750
|
exports.use = use;
|
|
47648
|
-
exports.visit =
|
|
47751
|
+
exports.visit = visit14;
|
|
47649
47752
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
47650
47753
|
}
|
|
47651
47754
|
});
|
|
@@ -60107,109 +60210,6 @@ var require_main2 = __commonJS({
|
|
|
60107
60210
|
}
|
|
60108
60211
|
});
|
|
60109
60212
|
|
|
60110
|
-
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
60111
|
-
var require_cjs = __commonJS({
|
|
60112
|
-
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module) {
|
|
60113
|
-
"use strict";
|
|
60114
|
-
var isMergeableObject = function isMergeableObject2(value) {
|
|
60115
|
-
return isNonNullObject(value) && !isSpecial(value);
|
|
60116
|
-
};
|
|
60117
|
-
function isNonNullObject(value) {
|
|
60118
|
-
return !!value && typeof value === "object";
|
|
60119
|
-
}
|
|
60120
|
-
function isSpecial(value) {
|
|
60121
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
60122
|
-
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
60123
|
-
}
|
|
60124
|
-
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
60125
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
60126
|
-
function isReactElement(value) {
|
|
60127
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
60128
|
-
}
|
|
60129
|
-
function emptyTarget(val) {
|
|
60130
|
-
return Array.isArray(val) ? [] : {};
|
|
60131
|
-
}
|
|
60132
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
60133
|
-
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
60134
|
-
}
|
|
60135
|
-
function defaultArrayMerge(target, source, options) {
|
|
60136
|
-
return target.concat(source).map(function(element) {
|
|
60137
|
-
return cloneUnlessOtherwiseSpecified(element, options);
|
|
60138
|
-
});
|
|
60139
|
-
}
|
|
60140
|
-
function getMergeFunction(key, options) {
|
|
60141
|
-
if (!options.customMerge) {
|
|
60142
|
-
return deepmerge;
|
|
60143
|
-
}
|
|
60144
|
-
var customMerge = options.customMerge(key);
|
|
60145
|
-
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
60146
|
-
}
|
|
60147
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
60148
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
60149
|
-
return target.propertyIsEnumerable(symbol);
|
|
60150
|
-
}) : [];
|
|
60151
|
-
}
|
|
60152
|
-
function getKeys(target) {
|
|
60153
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
60154
|
-
}
|
|
60155
|
-
function propertyIsOnObject(object, property) {
|
|
60156
|
-
try {
|
|
60157
|
-
return property in object;
|
|
60158
|
-
} catch (_) {
|
|
60159
|
-
return false;
|
|
60160
|
-
}
|
|
60161
|
-
}
|
|
60162
|
-
function propertyIsUnsafe(target, key) {
|
|
60163
|
-
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
60164
|
-
}
|
|
60165
|
-
function mergeObject(target, source, options) {
|
|
60166
|
-
var destination = {};
|
|
60167
|
-
if (options.isMergeableObject(target)) {
|
|
60168
|
-
getKeys(target).forEach(function(key) {
|
|
60169
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
60170
|
-
});
|
|
60171
|
-
}
|
|
60172
|
-
getKeys(source).forEach(function(key) {
|
|
60173
|
-
if (propertyIsUnsafe(target, key)) {
|
|
60174
|
-
return;
|
|
60175
|
-
}
|
|
60176
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
60177
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
60178
|
-
} else {
|
|
60179
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
60180
|
-
}
|
|
60181
|
-
});
|
|
60182
|
-
return destination;
|
|
60183
|
-
}
|
|
60184
|
-
function deepmerge(target, source, options) {
|
|
60185
|
-
options = options || {};
|
|
60186
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
60187
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
60188
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
60189
|
-
var sourceIsArray = Array.isArray(source);
|
|
60190
|
-
var targetIsArray = Array.isArray(target);
|
|
60191
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
60192
|
-
if (!sourceAndTargetTypesMatch) {
|
|
60193
|
-
return cloneUnlessOtherwiseSpecified(source, options);
|
|
60194
|
-
} else if (sourceIsArray) {
|
|
60195
|
-
return options.arrayMerge(target, source, options);
|
|
60196
|
-
} else {
|
|
60197
|
-
return mergeObject(target, source, options);
|
|
60198
|
-
}
|
|
60199
|
-
}
|
|
60200
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
60201
|
-
if (!Array.isArray(array)) {
|
|
60202
|
-
throw new Error("first argument should be an array");
|
|
60203
|
-
}
|
|
60204
|
-
return array.reduce(function(prev, next) {
|
|
60205
|
-
return deepmerge(prev, next, options);
|
|
60206
|
-
}, {});
|
|
60207
|
-
};
|
|
60208
|
-
var deepmerge_1 = deepmerge;
|
|
60209
|
-
module.exports = deepmerge_1;
|
|
60210
|
-
}
|
|
60211
|
-
});
|
|
60212
|
-
|
|
60213
60213
|
// ../../node_modules/.pnpm/kleur@3.0.3/node_modules/kleur/index.js
|
|
60214
60214
|
var require_kleur = __commonJS({
|
|
60215
60215
|
"../../node_modules/.pnpm/kleur@3.0.3/node_modules/kleur/index.js"(exports, module) {
|
|
@@ -72147,10 +72147,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
72147
72147
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
72148
72148
|
}
|
|
72149
72149
|
lastVariables = { ...marshalVariables(ctx) };
|
|
72150
|
+
const variables = lastVariables;
|
|
72150
72151
|
subscriptionSpec = {
|
|
72151
72152
|
rootType: ctx.artifact.rootType,
|
|
72152
72153
|
selection: ctx.artifact.selection,
|
|
72153
|
-
variables: () =>
|
|
72154
|
+
variables: () => variables,
|
|
72154
72155
|
set: (newValue) => {
|
|
72155
72156
|
resolve2(ctx, {
|
|
72156
72157
|
data: newValue,
|
|
@@ -72179,12 +72180,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
72179
72180
|
// src/runtime/client/plugins/fragment.ts
|
|
72180
72181
|
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
72181
72182
|
let subscriptionSpec = null;
|
|
72183
|
+
let lastReference = null;
|
|
72182
72184
|
return {
|
|
72183
72185
|
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
72184
72186
|
if (!ctx.stuff.parentID) {
|
|
72185
72187
|
return next(ctx);
|
|
72186
72188
|
}
|
|
72187
|
-
|
|
72189
|
+
const currentReference = {
|
|
72190
|
+
parent: ctx.stuff.parentID,
|
|
72191
|
+
variables: marshalVariables(ctx)
|
|
72192
|
+
};
|
|
72193
|
+
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
72188
72194
|
if (subscriptionSpec) {
|
|
72189
72195
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
72190
72196
|
}
|
|
@@ -72207,6 +72213,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
72207
72213
|
}
|
|
72208
72214
|
};
|
|
72209
72215
|
cache_default.subscribe(subscriptionSpec, variables);
|
|
72216
|
+
lastReference = currentReference;
|
|
72210
72217
|
}
|
|
72211
72218
|
next(ctx);
|
|
72212
72219
|
},
|
|
@@ -72714,6 +72721,17 @@ var Config = class {
|
|
|
72714
72721
|
}, []) ?? [];
|
|
72715
72722
|
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
72716
72723
|
}
|
|
72724
|
+
needsRefetchArtifact(document) {
|
|
72725
|
+
let needsArtifact = false;
|
|
72726
|
+
graphql2.visit(document, {
|
|
72727
|
+
Directive: (node) => {
|
|
72728
|
+
if ([this.paginateDirective].includes(node.name.value)) {
|
|
72729
|
+
needsArtifact = true;
|
|
72730
|
+
}
|
|
72731
|
+
}
|
|
72732
|
+
});
|
|
72733
|
+
return needsArtifact;
|
|
72734
|
+
}
|
|
72717
72735
|
#fragmentVariableMaps;
|
|
72718
72736
|
registerFragmentVariablesHash({
|
|
72719
72737
|
hash,
|
|
@@ -73202,13 +73220,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
|
73202
73220
|
|
|
73203
73221
|
// src/lib/parse.ts
|
|
73204
73222
|
var import_parser = __toESM(require_lib3(), 1);
|
|
73205
|
-
|
|
73223
|
+
|
|
73224
|
+
// src/lib/deepMerge.ts
|
|
73225
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
73226
|
+
function deepMerge(filepath, ...targets) {
|
|
73227
|
+
try {
|
|
73228
|
+
if (targets.length === 1) {
|
|
73229
|
+
return targets[0];
|
|
73230
|
+
} else if (targets.length === 2) {
|
|
73231
|
+
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
73232
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
73233
|
+
});
|
|
73234
|
+
}
|
|
73235
|
+
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
73236
|
+
} catch (e2) {
|
|
73237
|
+
throw new HoudiniError({
|
|
73238
|
+
filepath,
|
|
73239
|
+
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
73240
|
+
description: e2.message
|
|
73241
|
+
});
|
|
73242
|
+
}
|
|
73243
|
+
}
|
|
73244
|
+
|
|
73245
|
+
// src/lib/parse.ts
|
|
73246
|
+
async function parseJS(str, config2) {
|
|
73247
|
+
const defaultConfig = {
|
|
73248
|
+
plugins: ["typescript"],
|
|
73249
|
+
sourceType: "module"
|
|
73250
|
+
};
|
|
73206
73251
|
return {
|
|
73207
73252
|
start: 0,
|
|
73208
|
-
script: (0, import_parser.parse)(
|
|
73209
|
-
|
|
73210
|
-
|
|
73211
|
-
|
|
73253
|
+
script: (0, import_parser.parse)(
|
|
73254
|
+
str || "",
|
|
73255
|
+
config2 ? deepMerge("", defaultConfig, config2) : defaultConfig
|
|
73256
|
+
).program,
|
|
73212
73257
|
end: str.length
|
|
73213
73258
|
};
|
|
73214
73259
|
}
|
|
@@ -73262,27 +73307,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
73262
73307
|
return allFilesNotInList;
|
|
73263
73308
|
}
|
|
73264
73309
|
|
|
73265
|
-
// src/lib/deepMerge.ts
|
|
73266
|
-
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
73267
|
-
function deepMerge(filepath, ...targets) {
|
|
73268
|
-
try {
|
|
73269
|
-
if (targets.length === 1) {
|
|
73270
|
-
return targets[0];
|
|
73271
|
-
} else if (targets.length === 2) {
|
|
73272
|
-
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
73273
|
-
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
73274
|
-
});
|
|
73275
|
-
}
|
|
73276
|
-
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
73277
|
-
} catch (e2) {
|
|
73278
|
-
throw new HoudiniError({
|
|
73279
|
-
filepath,
|
|
73280
|
-
message: "could not merge: " + targets,
|
|
73281
|
-
description: e2.message
|
|
73282
|
-
});
|
|
73283
|
-
}
|
|
73284
|
-
}
|
|
73285
|
-
|
|
73286
73310
|
// src/lib/detectTools.ts
|
|
73287
73311
|
async function detectFromPackageJSON(cwd) {
|
|
73288
73312
|
try {
|
|
@@ -76195,12 +76219,12 @@ ${exportStatement("config")}
|
|
|
76195
76219
|
},
|
|
76196
76220
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
76197
76221
|
}),
|
|
76198
|
-
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, plugin2)),
|
|
76222
|
+
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, docs, plugin2)),
|
|
76199
76223
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
76200
76224
|
]);
|
|
76201
76225
|
await generateGraphqlReturnTypes(config2, docs);
|
|
76202
76226
|
}
|
|
76203
|
-
async function generatePluginRuntime(config2, plugin2) {
|
|
76227
|
+
async function generatePluginRuntime(config2, docs, plugin2) {
|
|
76204
76228
|
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
76205
76229
|
return;
|
|
76206
76230
|
}
|
|
@@ -76217,12 +76241,16 @@ async function generatePluginRuntime(config2, plugin2) {
|
|
|
76217
76241
|
});
|
|
76218
76242
|
}
|
|
76219
76243
|
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
76244
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
76245
|
+
if (transformMap && typeof transformMap === "function") {
|
|
76246
|
+
transformMap = transformMap(docs);
|
|
76247
|
+
}
|
|
76220
76248
|
await fs_exports.mkdirp(pluginDir);
|
|
76221
76249
|
await fs_exports.recursiveCopy(
|
|
76222
76250
|
runtime_path,
|
|
76223
76251
|
pluginDir,
|
|
76224
76252
|
Object.fromEntries(
|
|
76225
|
-
Object.entries(
|
|
76253
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
76226
76254
|
path_exports.join(runtime_path, key),
|
|
76227
76255
|
(content) => value({ config: config2, content })
|
|
76228
76256
|
])
|
|
@@ -76662,7 +76690,8 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
76662
76690
|
originalParsed: originalDocument,
|
|
76663
76691
|
name,
|
|
76664
76692
|
filename,
|
|
76665
|
-
generateArtifact
|
|
76693
|
+
generateArtifact,
|
|
76694
|
+
artifact
|
|
76666
76695
|
}) => {
|
|
76667
76696
|
if (!generateArtifact) {
|
|
76668
76697
|
return;
|
|
@@ -76701,6 +76730,14 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
76701
76730
|
missingScalars
|
|
76702
76731
|
);
|
|
76703
76732
|
}
|
|
76733
|
+
program3.body.push(
|
|
76734
|
+
AST11.exportNamedDeclaration(
|
|
76735
|
+
AST11.tsTypeAliasDeclaration(
|
|
76736
|
+
AST11.identifier(`${name}$artifact`),
|
|
76737
|
+
convertToTs(serializeValue(artifact))
|
|
76738
|
+
)
|
|
76739
|
+
)
|
|
76740
|
+
);
|
|
76704
76741
|
await fs_exports.writeFile(typeDefPath, recast11.print(program3).code);
|
|
76705
76742
|
typePaths.push(typeDefPath);
|
|
76706
76743
|
}
|
|
@@ -76727,18 +76764,17 @@ export * from "${module}"
|
|
|
76727
76764
|
`;
|
|
76728
76765
|
let indexContent = recast11.print(typeIndex).code;
|
|
76729
76766
|
for (const plugin2 of config2.plugins) {
|
|
76730
|
-
if (
|
|
76731
|
-
|
|
76767
|
+
if (plugin2.indexFile) {
|
|
76768
|
+
indexContent = plugin2.indexFile({
|
|
76769
|
+
config: config2,
|
|
76770
|
+
content: indexContent,
|
|
76771
|
+
exportDefaultAs,
|
|
76772
|
+
exportStarFrom: exportStarFrom2,
|
|
76773
|
+
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
76774
|
+
typedef: true,
|
|
76775
|
+
documents: docs
|
|
76776
|
+
});
|
|
76732
76777
|
}
|
|
76733
|
-
indexContent = plugin2.indexFile({
|
|
76734
|
-
config: config2,
|
|
76735
|
-
content: indexContent,
|
|
76736
|
-
exportDefaultAs,
|
|
76737
|
-
exportStarFrom: exportStarFrom2,
|
|
76738
|
-
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
76739
|
-
typedef: true,
|
|
76740
|
-
documents: docs
|
|
76741
|
-
});
|
|
76742
76778
|
if (plugin2.includeRuntime) {
|
|
76743
76779
|
indexContent += exportStarFrom2({
|
|
76744
76780
|
module: "./" + path_exports.relative(config2.rootDir, config2.pluginRuntimeDirectory(plugin2.name))
|
|
@@ -76770,6 +76806,42 @@ ${[...missingScalars].map(
|
|
|
76770
76806
|
For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
|
|
76771
76807
|
}
|
|
76772
76808
|
}
|
|
76809
|
+
function convertToTs(source) {
|
|
76810
|
+
if (source.type === "ObjectExpression") {
|
|
76811
|
+
return AST11.tsTypeLiteral(
|
|
76812
|
+
source.properties.reduce(
|
|
76813
|
+
(props, prop) => {
|
|
76814
|
+
if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
|
|
76815
|
+
return props;
|
|
76816
|
+
}
|
|
76817
|
+
return [
|
|
76818
|
+
...props,
|
|
76819
|
+
AST11.tsPropertySignature(
|
|
76820
|
+
prop.key,
|
|
76821
|
+
AST11.tsTypeAnnotation(convertToTs(prop.value))
|
|
76822
|
+
)
|
|
76823
|
+
];
|
|
76824
|
+
},
|
|
76825
|
+
[]
|
|
76826
|
+
)
|
|
76827
|
+
);
|
|
76828
|
+
}
|
|
76829
|
+
if (source.type === "ArrayExpression") {
|
|
76830
|
+
return AST11.tsTupleType(
|
|
76831
|
+
source.elements.map((element) => convertToTs(element))
|
|
76832
|
+
);
|
|
76833
|
+
}
|
|
76834
|
+
if (source.type === "Literal" && typeof source.value === "boolean") {
|
|
76835
|
+
return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
|
|
76836
|
+
}
|
|
76837
|
+
if (source.type === "Literal" && typeof source.value === "number") {
|
|
76838
|
+
return AST11.tsLiteralType(AST11.numericLiteral(source.value));
|
|
76839
|
+
}
|
|
76840
|
+
if (source.type === "Literal" && typeof source.value === "string") {
|
|
76841
|
+
return AST11.tsLiteralType(AST11.stringLiteral(source.value));
|
|
76842
|
+
}
|
|
76843
|
+
return AST11.tsLiteralType(source);
|
|
76844
|
+
}
|
|
76773
76845
|
async function generateOperationTypeDefs(config2, filepath, body, definition, selections, visitedTypes, missingScalars) {
|
|
76774
76846
|
let parentType = null;
|
|
76775
76847
|
if (definition.operation === "query") {
|
|
@@ -77477,9 +77549,6 @@ async function writeIndexFile2(config2, docs) {
|
|
|
77477
77549
|
module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
|
|
77478
77550
|
});
|
|
77479
77551
|
}
|
|
77480
|
-
if (!plugin2.indexFile) {
|
|
77481
|
-
continue;
|
|
77482
|
-
}
|
|
77483
77552
|
}
|
|
77484
77553
|
await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
|
|
77485
77554
|
}
|
|
@@ -78745,7 +78814,10 @@ async function collectDocuments(config2) {
|
|
|
78745
78814
|
}
|
|
78746
78815
|
}
|
|
78747
78816
|
} catch (err) {
|
|
78748
|
-
throw
|
|
78817
|
+
throw {
|
|
78818
|
+
message: err.message,
|
|
78819
|
+
filepath
|
|
78820
|
+
};
|
|
78749
78821
|
}
|
|
78750
78822
|
})
|
|
78751
78823
|
);
|
|
@@ -79292,8 +79364,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
79292
79364
|
}
|
|
79293
79365
|
packageJSON.devDependencies = {
|
|
79294
79366
|
...packageJSON.devDependencies,
|
|
79295
|
-
houdini: "^1.1
|
|
79296
|
-
"houdini-svelte": "^1.1
|
|
79367
|
+
houdini: "^1.2.0-react.1",
|
|
79368
|
+
"houdini-svelte": "^1.2.0-react.1"
|
|
79297
79369
|
};
|
|
79298
79370
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
79299
79371
|
}
|