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-cjs/index.js
CHANGED
|
@@ -4151,7 +4151,7 @@ var require_visitor = __commonJS({
|
|
|
4151
4151
|
Object.defineProperty(exports, "__esModule", {
|
|
4152
4152
|
value: true
|
|
4153
4153
|
});
|
|
4154
|
-
exports.visit =
|
|
4154
|
+
exports.visit = visit14;
|
|
4155
4155
|
exports.visitInParallel = visitInParallel;
|
|
4156
4156
|
exports.getVisitFn = getVisitFn;
|
|
4157
4157
|
exports.BREAK = exports.QueryDocumentKeys = void 0;
|
|
@@ -4214,7 +4214,7 @@ var require_visitor = __commonJS({
|
|
|
4214
4214
|
exports.QueryDocumentKeys = QueryDocumentKeys;
|
|
4215
4215
|
var BREAK = Object.freeze({});
|
|
4216
4216
|
exports.BREAK = BREAK;
|
|
4217
|
-
function
|
|
4217
|
+
function visit14(root, visitor) {
|
|
4218
4218
|
var visitorKeys = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : QueryDocumentKeys;
|
|
4219
4219
|
var stack = void 0;
|
|
4220
4220
|
var inArray = Array.isArray(root);
|
|
@@ -43769,6 +43769,109 @@ var require_lib3 = __commonJS({
|
|
|
43769
43769
|
}
|
|
43770
43770
|
});
|
|
43771
43771
|
|
|
43772
|
+
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
43773
|
+
var require_cjs = __commonJS({
|
|
43774
|
+
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
|
|
43775
|
+
"use strict";
|
|
43776
|
+
var isMergeableObject = function isMergeableObject2(value) {
|
|
43777
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
43778
|
+
};
|
|
43779
|
+
function isNonNullObject(value) {
|
|
43780
|
+
return !!value && typeof value === "object";
|
|
43781
|
+
}
|
|
43782
|
+
function isSpecial(value) {
|
|
43783
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
43784
|
+
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
43785
|
+
}
|
|
43786
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
43787
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
43788
|
+
function isReactElement(value) {
|
|
43789
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
43790
|
+
}
|
|
43791
|
+
function emptyTarget(val) {
|
|
43792
|
+
return Array.isArray(val) ? [] : {};
|
|
43793
|
+
}
|
|
43794
|
+
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
43795
|
+
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
43796
|
+
}
|
|
43797
|
+
function defaultArrayMerge(target, source, options) {
|
|
43798
|
+
return target.concat(source).map(function(element) {
|
|
43799
|
+
return cloneUnlessOtherwiseSpecified(element, options);
|
|
43800
|
+
});
|
|
43801
|
+
}
|
|
43802
|
+
function getMergeFunction(key, options) {
|
|
43803
|
+
if (!options.customMerge) {
|
|
43804
|
+
return deepmerge;
|
|
43805
|
+
}
|
|
43806
|
+
var customMerge = options.customMerge(key);
|
|
43807
|
+
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
43808
|
+
}
|
|
43809
|
+
function getEnumerableOwnPropertySymbols(target) {
|
|
43810
|
+
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
43811
|
+
return target.propertyIsEnumerable(symbol);
|
|
43812
|
+
}) : [];
|
|
43813
|
+
}
|
|
43814
|
+
function getKeys(target) {
|
|
43815
|
+
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
43816
|
+
}
|
|
43817
|
+
function propertyIsOnObject(object, property) {
|
|
43818
|
+
try {
|
|
43819
|
+
return property in object;
|
|
43820
|
+
} catch (_) {
|
|
43821
|
+
return false;
|
|
43822
|
+
}
|
|
43823
|
+
}
|
|
43824
|
+
function propertyIsUnsafe(target, key) {
|
|
43825
|
+
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
43826
|
+
}
|
|
43827
|
+
function mergeObject(target, source, options) {
|
|
43828
|
+
var destination = {};
|
|
43829
|
+
if (options.isMergeableObject(target)) {
|
|
43830
|
+
getKeys(target).forEach(function(key) {
|
|
43831
|
+
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
43832
|
+
});
|
|
43833
|
+
}
|
|
43834
|
+
getKeys(source).forEach(function(key) {
|
|
43835
|
+
if (propertyIsUnsafe(target, key)) {
|
|
43836
|
+
return;
|
|
43837
|
+
}
|
|
43838
|
+
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
43839
|
+
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
43840
|
+
} else {
|
|
43841
|
+
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
43842
|
+
}
|
|
43843
|
+
});
|
|
43844
|
+
return destination;
|
|
43845
|
+
}
|
|
43846
|
+
function deepmerge(target, source, options) {
|
|
43847
|
+
options = options || {};
|
|
43848
|
+
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
43849
|
+
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
43850
|
+
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
43851
|
+
var sourceIsArray = Array.isArray(source);
|
|
43852
|
+
var targetIsArray = Array.isArray(target);
|
|
43853
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
43854
|
+
if (!sourceAndTargetTypesMatch) {
|
|
43855
|
+
return cloneUnlessOtherwiseSpecified(source, options);
|
|
43856
|
+
} else if (sourceIsArray) {
|
|
43857
|
+
return options.arrayMerge(target, source, options);
|
|
43858
|
+
} else {
|
|
43859
|
+
return mergeObject(target, source, options);
|
|
43860
|
+
}
|
|
43861
|
+
}
|
|
43862
|
+
deepmerge.all = function deepmergeAll(array, options) {
|
|
43863
|
+
if (!Array.isArray(array)) {
|
|
43864
|
+
throw new Error("first argument should be an array");
|
|
43865
|
+
}
|
|
43866
|
+
return array.reduce(function(prev, next) {
|
|
43867
|
+
return deepmerge(prev, next, options);
|
|
43868
|
+
}, {});
|
|
43869
|
+
};
|
|
43870
|
+
var deepmerge_1 = deepmerge;
|
|
43871
|
+
module2.exports = deepmerge_1;
|
|
43872
|
+
}
|
|
43873
|
+
});
|
|
43874
|
+
|
|
43772
43875
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
43773
43876
|
var require_tslib = __commonJS({
|
|
43774
43877
|
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
|
|
@@ -46038,7 +46141,7 @@ var require_path_visitor = __commonJS({
|
|
|
46038
46141
|
}
|
|
46039
46142
|
return target;
|
|
46040
46143
|
}
|
|
46041
|
-
PathVisitor.visit = function
|
|
46144
|
+
PathVisitor.visit = function visit14(node, methods) {
|
|
46042
46145
|
return PathVisitor.fromMethodsObject(methods).visit(node);
|
|
46043
46146
|
};
|
|
46044
46147
|
var PVp = PathVisitor.prototype;
|
|
@@ -46229,7 +46332,7 @@ var require_path_visitor = __commonJS({
|
|
|
46229
46332
|
this.needToCallTraverse = false;
|
|
46230
46333
|
return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
|
|
46231
46334
|
};
|
|
46232
|
-
sharedContextProtoMethods.visit = function
|
|
46335
|
+
sharedContextProtoMethods.visit = function visit14(path2, newVisitor) {
|
|
46233
46336
|
if (!(this instanceof this.Context)) {
|
|
46234
46337
|
throw new Error("");
|
|
46235
46338
|
}
|
|
@@ -47622,7 +47725,7 @@ var require_main = __commonJS({
|
|
|
47622
47725
|
var someField = _a.someField;
|
|
47623
47726
|
var Type = _a.Type;
|
|
47624
47727
|
var use = _a.use;
|
|
47625
|
-
var
|
|
47728
|
+
var visit14 = _a.visit;
|
|
47626
47729
|
exports.astNodesAreEquivalent = astNodesAreEquivalent;
|
|
47627
47730
|
exports.builders = builders;
|
|
47628
47731
|
exports.builtInTypes = builtInTypes;
|
|
@@ -47639,7 +47742,7 @@ var require_main = __commonJS({
|
|
|
47639
47742
|
exports.someField = someField;
|
|
47640
47743
|
exports.Type = Type;
|
|
47641
47744
|
exports.use = use;
|
|
47642
|
-
exports.visit =
|
|
47745
|
+
exports.visit = visit14;
|
|
47643
47746
|
Object.assign(namedTypes_1.namedTypes, n);
|
|
47644
47747
|
}
|
|
47645
47748
|
});
|
|
@@ -60101,109 +60204,6 @@ var require_main2 = __commonJS({
|
|
|
60101
60204
|
}
|
|
60102
60205
|
});
|
|
60103
60206
|
|
|
60104
|
-
// ../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js
|
|
60105
|
-
var require_cjs = __commonJS({
|
|
60106
|
-
"../../node_modules/.pnpm/deepmerge@4.2.2/node_modules/deepmerge/dist/cjs.js"(exports, module2) {
|
|
60107
|
-
"use strict";
|
|
60108
|
-
var isMergeableObject = function isMergeableObject2(value) {
|
|
60109
|
-
return isNonNullObject(value) && !isSpecial(value);
|
|
60110
|
-
};
|
|
60111
|
-
function isNonNullObject(value) {
|
|
60112
|
-
return !!value && typeof value === "object";
|
|
60113
|
-
}
|
|
60114
|
-
function isSpecial(value) {
|
|
60115
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
60116
|
-
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
60117
|
-
}
|
|
60118
|
-
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
60119
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
60120
|
-
function isReactElement(value) {
|
|
60121
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
60122
|
-
}
|
|
60123
|
-
function emptyTarget(val) {
|
|
60124
|
-
return Array.isArray(val) ? [] : {};
|
|
60125
|
-
}
|
|
60126
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
60127
|
-
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
60128
|
-
}
|
|
60129
|
-
function defaultArrayMerge(target, source, options) {
|
|
60130
|
-
return target.concat(source).map(function(element) {
|
|
60131
|
-
return cloneUnlessOtherwiseSpecified(element, options);
|
|
60132
|
-
});
|
|
60133
|
-
}
|
|
60134
|
-
function getMergeFunction(key, options) {
|
|
60135
|
-
if (!options.customMerge) {
|
|
60136
|
-
return deepmerge;
|
|
60137
|
-
}
|
|
60138
|
-
var customMerge = options.customMerge(key);
|
|
60139
|
-
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
60140
|
-
}
|
|
60141
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
60142
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
60143
|
-
return target.propertyIsEnumerable(symbol);
|
|
60144
|
-
}) : [];
|
|
60145
|
-
}
|
|
60146
|
-
function getKeys(target) {
|
|
60147
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
60148
|
-
}
|
|
60149
|
-
function propertyIsOnObject(object, property) {
|
|
60150
|
-
try {
|
|
60151
|
-
return property in object;
|
|
60152
|
-
} catch (_) {
|
|
60153
|
-
return false;
|
|
60154
|
-
}
|
|
60155
|
-
}
|
|
60156
|
-
function propertyIsUnsafe(target, key) {
|
|
60157
|
-
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
60158
|
-
}
|
|
60159
|
-
function mergeObject(target, source, options) {
|
|
60160
|
-
var destination = {};
|
|
60161
|
-
if (options.isMergeableObject(target)) {
|
|
60162
|
-
getKeys(target).forEach(function(key) {
|
|
60163
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
60164
|
-
});
|
|
60165
|
-
}
|
|
60166
|
-
getKeys(source).forEach(function(key) {
|
|
60167
|
-
if (propertyIsUnsafe(target, key)) {
|
|
60168
|
-
return;
|
|
60169
|
-
}
|
|
60170
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
60171
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
60172
|
-
} else {
|
|
60173
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
60174
|
-
}
|
|
60175
|
-
});
|
|
60176
|
-
return destination;
|
|
60177
|
-
}
|
|
60178
|
-
function deepmerge(target, source, options) {
|
|
60179
|
-
options = options || {};
|
|
60180
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
60181
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
60182
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
60183
|
-
var sourceIsArray = Array.isArray(source);
|
|
60184
|
-
var targetIsArray = Array.isArray(target);
|
|
60185
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
60186
|
-
if (!sourceAndTargetTypesMatch) {
|
|
60187
|
-
return cloneUnlessOtherwiseSpecified(source, options);
|
|
60188
|
-
} else if (sourceIsArray) {
|
|
60189
|
-
return options.arrayMerge(target, source, options);
|
|
60190
|
-
} else {
|
|
60191
|
-
return mergeObject(target, source, options);
|
|
60192
|
-
}
|
|
60193
|
-
}
|
|
60194
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
60195
|
-
if (!Array.isArray(array)) {
|
|
60196
|
-
throw new Error("first argument should be an array");
|
|
60197
|
-
}
|
|
60198
|
-
return array.reduce(function(prev, next) {
|
|
60199
|
-
return deepmerge(prev, next, options);
|
|
60200
|
-
}, {});
|
|
60201
|
-
};
|
|
60202
|
-
var deepmerge_1 = deepmerge;
|
|
60203
|
-
module2.exports = deepmerge_1;
|
|
60204
|
-
}
|
|
60205
|
-
});
|
|
60206
|
-
|
|
60207
60207
|
// ../../node_modules/.pnpm/kleur@3.0.3/node_modules/kleur/index.js
|
|
60208
60208
|
var require_kleur = __commonJS({
|
|
60209
60209
|
"../../node_modules/.pnpm/kleur@3.0.3/node_modules/kleur/index.js"(exports, module2) {
|
|
@@ -72141,10 +72141,11 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
72141
72141
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
72142
72142
|
}
|
|
72143
72143
|
lastVariables = { ...marshalVariables(ctx) };
|
|
72144
|
+
const variables = lastVariables;
|
|
72144
72145
|
subscriptionSpec = {
|
|
72145
72146
|
rootType: ctx.artifact.rootType,
|
|
72146
72147
|
selection: ctx.artifact.selection,
|
|
72147
|
-
variables: () =>
|
|
72148
|
+
variables: () => variables,
|
|
72148
72149
|
set: (newValue) => {
|
|
72149
72150
|
resolve2(ctx, {
|
|
72150
72151
|
data: newValue,
|
|
@@ -72173,12 +72174,17 @@ var query = documentPlugin(ArtifactKind.Query, function() {
|
|
|
72173
72174
|
// src/runtime/client/plugins/fragment.ts
|
|
72174
72175
|
var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
72175
72176
|
let subscriptionSpec = null;
|
|
72177
|
+
let lastReference = null;
|
|
72176
72178
|
return {
|
|
72177
72179
|
start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
|
|
72178
72180
|
if (!ctx.stuff.parentID) {
|
|
72179
72181
|
return next(ctx);
|
|
72180
72182
|
}
|
|
72181
|
-
|
|
72183
|
+
const currentReference = {
|
|
72184
|
+
parent: ctx.stuff.parentID,
|
|
72185
|
+
variables: marshalVariables(ctx)
|
|
72186
|
+
};
|
|
72187
|
+
if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
|
|
72182
72188
|
if (subscriptionSpec) {
|
|
72183
72189
|
cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
|
|
72184
72190
|
}
|
|
@@ -72201,6 +72207,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
72201
72207
|
}
|
|
72202
72208
|
};
|
|
72203
72209
|
cache_default.subscribe(subscriptionSpec, variables);
|
|
72210
|
+
lastReference = currentReference;
|
|
72204
72211
|
}
|
|
72205
72212
|
next(ctx);
|
|
72206
72213
|
},
|
|
@@ -72709,6 +72716,17 @@ var Config = class {
|
|
|
72709
72716
|
}, []) ?? [];
|
|
72710
72717
|
return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
|
|
72711
72718
|
}
|
|
72719
|
+
needsRefetchArtifact(document) {
|
|
72720
|
+
let needsArtifact = false;
|
|
72721
|
+
graphql2.visit(document, {
|
|
72722
|
+
Directive: (node) => {
|
|
72723
|
+
if ([this.paginateDirective].includes(node.name.value)) {
|
|
72724
|
+
needsArtifact = true;
|
|
72725
|
+
}
|
|
72726
|
+
}
|
|
72727
|
+
});
|
|
72728
|
+
return needsArtifact;
|
|
72729
|
+
}
|
|
72712
72730
|
#fragmentVariableMaps;
|
|
72713
72731
|
registerFragmentVariablesHash({
|
|
72714
72732
|
hash,
|
|
@@ -73197,13 +73215,40 @@ var TypeWrapper = /* @__PURE__ */ ((TypeWrapper2) => {
|
|
|
73197
73215
|
|
|
73198
73216
|
// src/lib/parse.ts
|
|
73199
73217
|
var import_parser = __toESM(require_lib3(), 1);
|
|
73200
|
-
|
|
73218
|
+
|
|
73219
|
+
// src/lib/deepMerge.ts
|
|
73220
|
+
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
73221
|
+
function deepMerge(filepath, ...targets) {
|
|
73222
|
+
try {
|
|
73223
|
+
if (targets.length === 1) {
|
|
73224
|
+
return targets[0];
|
|
73225
|
+
} else if (targets.length === 2) {
|
|
73226
|
+
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
73227
|
+
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
73228
|
+
});
|
|
73229
|
+
}
|
|
73230
|
+
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
73231
|
+
} catch (e2) {
|
|
73232
|
+
throw new HoudiniError({
|
|
73233
|
+
filepath,
|
|
73234
|
+
message: "could not merge: " + JSON.stringify(targets, null, 4),
|
|
73235
|
+
description: e2.message
|
|
73236
|
+
});
|
|
73237
|
+
}
|
|
73238
|
+
}
|
|
73239
|
+
|
|
73240
|
+
// src/lib/parse.ts
|
|
73241
|
+
async function parseJS(str, config2) {
|
|
73242
|
+
const defaultConfig = {
|
|
73243
|
+
plugins: ["typescript"],
|
|
73244
|
+
sourceType: "module"
|
|
73245
|
+
};
|
|
73201
73246
|
return {
|
|
73202
73247
|
start: 0,
|
|
73203
|
-
script: (0, import_parser.parse)(
|
|
73204
|
-
|
|
73205
|
-
|
|
73206
|
-
|
|
73248
|
+
script: (0, import_parser.parse)(
|
|
73249
|
+
str || "",
|
|
73250
|
+
config2 ? deepMerge("", defaultConfig, config2) : defaultConfig
|
|
73251
|
+
).program,
|
|
73207
73252
|
end: str.length
|
|
73208
73253
|
};
|
|
73209
73254
|
}
|
|
@@ -73257,27 +73302,6 @@ async function cleanupFiles(pathFolder, listOfObj) {
|
|
|
73257
73302
|
return allFilesNotInList;
|
|
73258
73303
|
}
|
|
73259
73304
|
|
|
73260
|
-
// src/lib/deepMerge.ts
|
|
73261
|
-
var import_deepmerge = __toESM(require_cjs(), 1);
|
|
73262
|
-
function deepMerge(filepath, ...targets) {
|
|
73263
|
-
try {
|
|
73264
|
-
if (targets.length === 1) {
|
|
73265
|
-
return targets[0];
|
|
73266
|
-
} else if (targets.length === 2) {
|
|
73267
|
-
return (0, import_deepmerge.default)(targets[0], targets[1], {
|
|
73268
|
-
arrayMerge: (source, update) => [...new Set(source.concat(update))]
|
|
73269
|
-
});
|
|
73270
|
-
}
|
|
73271
|
-
return deepMerge(filepath, targets[0], deepMerge(filepath, ...targets.slice(1)));
|
|
73272
|
-
} catch (e2) {
|
|
73273
|
-
throw new HoudiniError({
|
|
73274
|
-
filepath,
|
|
73275
|
-
message: "could not merge: " + targets,
|
|
73276
|
-
description: e2.message
|
|
73277
|
-
});
|
|
73278
|
-
}
|
|
73279
|
-
}
|
|
73280
|
-
|
|
73281
73305
|
// src/lib/detectTools.ts
|
|
73282
73306
|
async function detectFromPackageJSON(cwd) {
|
|
73283
73307
|
try {
|
|
@@ -76190,12 +76214,12 @@ ${exportStatement("config")}
|
|
|
76190
76214
|
},
|
|
76191
76215
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
76192
76216
|
}),
|
|
76193
|
-
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, plugin2)),
|
|
76217
|
+
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, docs, plugin2)),
|
|
76194
76218
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
76195
76219
|
]);
|
|
76196
76220
|
await generateGraphqlReturnTypes(config2, docs);
|
|
76197
76221
|
}
|
|
76198
|
-
async function generatePluginRuntime(config2, plugin2) {
|
|
76222
|
+
async function generatePluginRuntime(config2, docs, plugin2) {
|
|
76199
76223
|
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
76200
76224
|
return;
|
|
76201
76225
|
}
|
|
@@ -76212,12 +76236,16 @@ async function generatePluginRuntime(config2, plugin2) {
|
|
|
76212
76236
|
});
|
|
76213
76237
|
}
|
|
76214
76238
|
const pluginDir = config2.pluginRuntimeDirectory(plugin2.name);
|
|
76239
|
+
let transformMap = plugin2.transformRuntime ?? {};
|
|
76240
|
+
if (transformMap && typeof transformMap === "function") {
|
|
76241
|
+
transformMap = transformMap(docs);
|
|
76242
|
+
}
|
|
76215
76243
|
await fs_exports.mkdirp(pluginDir);
|
|
76216
76244
|
await fs_exports.recursiveCopy(
|
|
76217
76245
|
runtime_path,
|
|
76218
76246
|
pluginDir,
|
|
76219
76247
|
Object.fromEntries(
|
|
76220
|
-
Object.entries(
|
|
76248
|
+
Object.entries(transformMap).map(([key, value]) => [
|
|
76221
76249
|
path_exports.join(runtime_path, key),
|
|
76222
76250
|
(content) => value({ config: config2, content })
|
|
76223
76251
|
])
|
|
@@ -76657,7 +76685,8 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
76657
76685
|
originalParsed: originalDocument,
|
|
76658
76686
|
name,
|
|
76659
76687
|
filename,
|
|
76660
|
-
generateArtifact
|
|
76688
|
+
generateArtifact,
|
|
76689
|
+
artifact
|
|
76661
76690
|
}) => {
|
|
76662
76691
|
if (!generateArtifact) {
|
|
76663
76692
|
return;
|
|
@@ -76696,6 +76725,14 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
76696
76725
|
missingScalars
|
|
76697
76726
|
);
|
|
76698
76727
|
}
|
|
76728
|
+
program3.body.push(
|
|
76729
|
+
AST11.exportNamedDeclaration(
|
|
76730
|
+
AST11.tsTypeAliasDeclaration(
|
|
76731
|
+
AST11.identifier(`${name}$artifact`),
|
|
76732
|
+
convertToTs(serializeValue(artifact))
|
|
76733
|
+
)
|
|
76734
|
+
)
|
|
76735
|
+
);
|
|
76699
76736
|
await fs_exports.writeFile(typeDefPath, recast11.print(program3).code);
|
|
76700
76737
|
typePaths.push(typeDefPath);
|
|
76701
76738
|
}
|
|
@@ -76722,18 +76759,17 @@ export * from "${module2}"
|
|
|
76722
76759
|
`;
|
|
76723
76760
|
let indexContent = recast11.print(typeIndex).code;
|
|
76724
76761
|
for (const plugin2 of config2.plugins) {
|
|
76725
|
-
if (
|
|
76726
|
-
|
|
76762
|
+
if (plugin2.indexFile) {
|
|
76763
|
+
indexContent = plugin2.indexFile({
|
|
76764
|
+
config: config2,
|
|
76765
|
+
content: indexContent,
|
|
76766
|
+
exportDefaultAs,
|
|
76767
|
+
exportStarFrom: exportStarFrom2,
|
|
76768
|
+
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
76769
|
+
typedef: true,
|
|
76770
|
+
documents: docs
|
|
76771
|
+
});
|
|
76727
76772
|
}
|
|
76728
|
-
indexContent = plugin2.indexFile({
|
|
76729
|
-
config: config2,
|
|
76730
|
-
content: indexContent,
|
|
76731
|
-
exportDefaultAs,
|
|
76732
|
-
exportStarFrom: exportStarFrom2,
|
|
76733
|
-
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
76734
|
-
typedef: true,
|
|
76735
|
-
documents: docs
|
|
76736
|
-
});
|
|
76737
76773
|
if (plugin2.includeRuntime) {
|
|
76738
76774
|
indexContent += exportStarFrom2({
|
|
76739
76775
|
module: "./" + path_exports.relative(config2.rootDir, config2.pluginRuntimeDirectory(plugin2.name))
|
|
@@ -76765,6 +76801,42 @@ ${[...missingScalars].map(
|
|
|
76765
76801
|
For more information, please visit this link: ${siteURL}/api/config#custom-scalars`);
|
|
76766
76802
|
}
|
|
76767
76803
|
}
|
|
76804
|
+
function convertToTs(source) {
|
|
76805
|
+
if (source.type === "ObjectExpression") {
|
|
76806
|
+
return AST11.tsTypeLiteral(
|
|
76807
|
+
source.properties.reduce(
|
|
76808
|
+
(props, prop) => {
|
|
76809
|
+
if (prop.type !== "ObjectProperty" || prop.key.type !== "StringLiteral" && prop.key.type === "Identifier") {
|
|
76810
|
+
return props;
|
|
76811
|
+
}
|
|
76812
|
+
return [
|
|
76813
|
+
...props,
|
|
76814
|
+
AST11.tsPropertySignature(
|
|
76815
|
+
prop.key,
|
|
76816
|
+
AST11.tsTypeAnnotation(convertToTs(prop.value))
|
|
76817
|
+
)
|
|
76818
|
+
];
|
|
76819
|
+
},
|
|
76820
|
+
[]
|
|
76821
|
+
)
|
|
76822
|
+
);
|
|
76823
|
+
}
|
|
76824
|
+
if (source.type === "ArrayExpression") {
|
|
76825
|
+
return AST11.tsTupleType(
|
|
76826
|
+
source.elements.map((element) => convertToTs(element))
|
|
76827
|
+
);
|
|
76828
|
+
}
|
|
76829
|
+
if (source.type === "Literal" && typeof source.value === "boolean") {
|
|
76830
|
+
return AST11.tsLiteralType(AST11.booleanLiteral(source.value));
|
|
76831
|
+
}
|
|
76832
|
+
if (source.type === "Literal" && typeof source.value === "number") {
|
|
76833
|
+
return AST11.tsLiteralType(AST11.numericLiteral(source.value));
|
|
76834
|
+
}
|
|
76835
|
+
if (source.type === "Literal" && typeof source.value === "string") {
|
|
76836
|
+
return AST11.tsLiteralType(AST11.stringLiteral(source.value));
|
|
76837
|
+
}
|
|
76838
|
+
return AST11.tsLiteralType(source);
|
|
76839
|
+
}
|
|
76768
76840
|
async function generateOperationTypeDefs(config2, filepath, body, definition, selections, visitedTypes, missingScalars) {
|
|
76769
76841
|
let parentType = null;
|
|
76770
76842
|
if (definition.operation === "query") {
|
|
@@ -77472,9 +77544,6 @@ async function writeIndexFile2(config2, docs) {
|
|
|
77472
77544
|
module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
|
|
77473
77545
|
});
|
|
77474
77546
|
}
|
|
77475
|
-
if (!plugin2.indexFile) {
|
|
77476
|
-
continue;
|
|
77477
|
-
}
|
|
77478
77547
|
}
|
|
77479
77548
|
await fs_exports.writeFile(path_exports.join(config2.rootDir, "index.js"), body);
|
|
77480
77549
|
}
|
|
@@ -78740,7 +78809,10 @@ async function collectDocuments(config2) {
|
|
|
78740
78809
|
}
|
|
78741
78810
|
}
|
|
78742
78811
|
} catch (err) {
|
|
78743
|
-
throw
|
|
78812
|
+
throw {
|
|
78813
|
+
message: err.message,
|
|
78814
|
+
filepath
|
|
78815
|
+
};
|
|
78744
78816
|
}
|
|
78745
78817
|
})
|
|
78746
78818
|
);
|
|
@@ -79287,8 +79359,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
79287
79359
|
}
|
|
79288
79360
|
packageJSON.devDependencies = {
|
|
79289
79361
|
...packageJSON.devDependencies,
|
|
79290
|
-
houdini: "^1.1
|
|
79291
|
-
"houdini-svelte": "^1.1
|
|
79362
|
+
houdini: "^1.2.0-react.1",
|
|
79363
|
+
"houdini-svelte": "^1.2.0-react.1"
|
|
79292
79364
|
};
|
|
79293
79365
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
79294
79366
|
}
|