houdini 1.2.0 → 1.2.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 +75 -47
- package/build/cmd-esm/index.js +75 -47
- package/build/codegen/utils/flattenSelections.d.ts +2 -1
- package/build/codegen-cjs/index.js +73 -45
- package/build/codegen-esm/index.js +73 -45
- package/build/lib-cjs/index.js +1 -1
- package/build/lib-esm/index.js +1 -1
- package/build/test-cjs/index.js +75 -45
- package/build/test-esm/index.js +75 -45
- package/build/vite-cjs/index.js +73 -45
- package/build/vite-esm/index.js +73 -45
- package/package.json +1 -1
|
@@ -56999,7 +56999,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
56999
56999
|
// src/lib/parse.ts
|
|
57000
57000
|
async function parseJS(str, config2) {
|
|
57001
57001
|
const defaultConfig = {
|
|
57002
|
-
plugins: ["typescript", "importAssertions"
|
|
57002
|
+
plugins: ["typescript", "importAssertions"],
|
|
57003
57003
|
sourceType: "module"
|
|
57004
57004
|
};
|
|
57005
57005
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -57282,7 +57282,8 @@ function flattenSelections({
|
|
|
57282
57282
|
selections,
|
|
57283
57283
|
fragmentDefinitions,
|
|
57284
57284
|
ignoreMaskDisable,
|
|
57285
|
-
keepFragmentSpreadNodes
|
|
57285
|
+
keepFragmentSpreadNodes,
|
|
57286
|
+
hoistFragments
|
|
57286
57287
|
}) {
|
|
57287
57288
|
const fields = new FieldCollection({
|
|
57288
57289
|
config: config2,
|
|
@@ -57290,7 +57291,8 @@ function flattenSelections({
|
|
|
57290
57291
|
selections,
|
|
57291
57292
|
fragmentDefinitions,
|
|
57292
57293
|
ignoreMaskDisable: !!ignoreMaskDisable,
|
|
57293
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
57294
|
+
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
57295
|
+
hoistFragments
|
|
57294
57296
|
});
|
|
57295
57297
|
return fields.toSelectionSet();
|
|
57296
57298
|
}
|
|
@@ -57303,6 +57305,7 @@ var FieldCollection = class {
|
|
|
57303
57305
|
fragmentSpreads;
|
|
57304
57306
|
ignoreMaskDisable;
|
|
57305
57307
|
keepFragmentSpreadNodes;
|
|
57308
|
+
hoistFragments;
|
|
57306
57309
|
constructor(args) {
|
|
57307
57310
|
this.config = args.config;
|
|
57308
57311
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
@@ -57311,15 +57314,32 @@ var FieldCollection = class {
|
|
|
57311
57314
|
this.fields = {};
|
|
57312
57315
|
this.inlineFragments = {};
|
|
57313
57316
|
this.fragmentSpreads = {};
|
|
57317
|
+
this.hoistFragments = !!args.hoistFragments;
|
|
57314
57318
|
this.filepath = args.filepath;
|
|
57315
57319
|
for (const selection of args.selections) {
|
|
57316
|
-
this.add(selection);
|
|
57320
|
+
this.add({ selection });
|
|
57317
57321
|
}
|
|
57318
57322
|
}
|
|
57319
57323
|
get size() {
|
|
57320
57324
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57321
57325
|
}
|
|
57322
|
-
add(selection) {
|
|
57326
|
+
add({ selection, external }) {
|
|
57327
|
+
let includeFragments = this.config.defaultFragmentMasking === "disable";
|
|
57328
|
+
const maskEnableDirective = selection.directives?.find(
|
|
57329
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
57330
|
+
);
|
|
57331
|
+
if (maskEnableDirective) {
|
|
57332
|
+
includeFragments = false;
|
|
57333
|
+
}
|
|
57334
|
+
const maskDisableDirective = selection.directives?.find(
|
|
57335
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
57336
|
+
);
|
|
57337
|
+
if (maskDisableDirective) {
|
|
57338
|
+
includeFragments = true;
|
|
57339
|
+
}
|
|
57340
|
+
if (this.ignoreMaskDisable) {
|
|
57341
|
+
includeFragments = true;
|
|
57342
|
+
}
|
|
57323
57343
|
if (selection.kind === "Field") {
|
|
57324
57344
|
const key = selection.alias?.value || selection.name.value;
|
|
57325
57345
|
if (!this.fields[key]) {
|
|
@@ -57329,41 +57349,30 @@ var FieldCollection = class {
|
|
|
57329
57349
|
};
|
|
57330
57350
|
}
|
|
57331
57351
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
57332
|
-
this.fields[key].selection.add(
|
|
57352
|
+
this.fields[key].selection.add({
|
|
57353
|
+
selection: subselect,
|
|
57354
|
+
external
|
|
57355
|
+
});
|
|
57356
|
+
}
|
|
57357
|
+
if (!external && includeFragments) {
|
|
57358
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
57359
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57360
|
+
...this.fields[key].selection.fragmentSpreads
|
|
57361
|
+
};
|
|
57333
57362
|
}
|
|
57334
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
57335
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57336
|
-
...this.fields[key].selection.fragmentSpreads
|
|
57337
|
-
};
|
|
57338
57363
|
return;
|
|
57339
57364
|
}
|
|
57340
57365
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
57341
57366
|
for (const subselect of selection.selectionSet.selections) {
|
|
57342
|
-
this.add(subselect);
|
|
57367
|
+
this.add({ selection: subselect, external });
|
|
57343
57368
|
}
|
|
57344
57369
|
}
|
|
57345
57370
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57346
|
-
this.walkInlineFragment(selection);
|
|
57371
|
+
this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
|
|
57347
57372
|
return;
|
|
57348
57373
|
}
|
|
57349
57374
|
if (selection.kind === "FragmentSpread") {
|
|
57350
|
-
|
|
57351
|
-
const maskEnableDirective = selection.directives?.find(
|
|
57352
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
57353
|
-
);
|
|
57354
|
-
if (maskEnableDirective) {
|
|
57355
|
-
includeFragments = false;
|
|
57356
|
-
}
|
|
57357
|
-
const maskDisableDirective = selection.directives?.find(
|
|
57358
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
57359
|
-
);
|
|
57360
|
-
if (maskDisableDirective) {
|
|
57361
|
-
includeFragments = true;
|
|
57362
|
-
}
|
|
57363
|
-
if (this.ignoreMaskDisable) {
|
|
57364
|
-
includeFragments = true;
|
|
57365
|
-
}
|
|
57366
|
-
if (this.keepFragmentSpreadNodes) {
|
|
57375
|
+
if (this.keepFragmentSpreadNodes && !external) {
|
|
57367
57376
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57368
57377
|
}
|
|
57369
57378
|
if (!includeFragments) {
|
|
@@ -57377,18 +57386,21 @@ var FieldCollection = class {
|
|
|
57377
57386
|
});
|
|
57378
57387
|
}
|
|
57379
57388
|
this.add({
|
|
57380
|
-
|
|
57381
|
-
|
|
57382
|
-
|
|
57383
|
-
|
|
57384
|
-
|
|
57385
|
-
|
|
57389
|
+
selection: {
|
|
57390
|
+
kind: "InlineFragment",
|
|
57391
|
+
typeCondition: {
|
|
57392
|
+
kind: "NamedType",
|
|
57393
|
+
name: {
|
|
57394
|
+
kind: "Name",
|
|
57395
|
+
value: definition.typeCondition.name.value
|
|
57396
|
+
}
|
|
57397
|
+
},
|
|
57398
|
+
selectionSet: {
|
|
57399
|
+
kind: "SelectionSet",
|
|
57400
|
+
selections: [...definition.selectionSet.selections]
|
|
57386
57401
|
}
|
|
57387
57402
|
},
|
|
57388
|
-
|
|
57389
|
-
kind: "SelectionSet",
|
|
57390
|
-
selections: [...definition.selectionSet.selections]
|
|
57391
|
-
}
|
|
57403
|
+
external
|
|
57392
57404
|
});
|
|
57393
57405
|
}
|
|
57394
57406
|
}
|
|
@@ -57444,7 +57456,11 @@ var FieldCollection = class {
|
|
|
57444
57456
|
})
|
|
57445
57457
|
);
|
|
57446
57458
|
}
|
|
57447
|
-
walkInlineFragment(
|
|
57459
|
+
walkInlineFragment({
|
|
57460
|
+
selection,
|
|
57461
|
+
external,
|
|
57462
|
+
hoistFragments
|
|
57463
|
+
}) {
|
|
57448
57464
|
const key = selection.typeCondition.name.value;
|
|
57449
57465
|
if (!this.inlineFragments[key]) {
|
|
57450
57466
|
this.inlineFragments[key] = {
|
|
@@ -57453,11 +57469,21 @@ var FieldCollection = class {
|
|
|
57453
57469
|
};
|
|
57454
57470
|
}
|
|
57455
57471
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57456
|
-
if (subselect.kind
|
|
57457
|
-
this.inlineFragments[key].selection.add(
|
|
57472
|
+
if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57473
|
+
this.inlineFragments[key].selection.add({
|
|
57474
|
+
selection: subselect,
|
|
57475
|
+
external
|
|
57476
|
+
});
|
|
57458
57477
|
continue;
|
|
57478
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
57479
|
+
this.add({
|
|
57480
|
+
selection: subselect,
|
|
57481
|
+
external: true
|
|
57482
|
+
});
|
|
57483
|
+
continue;
|
|
57484
|
+
} else {
|
|
57485
|
+
this.walkInlineFragment({ selection: subselect, external, hoistFragments });
|
|
57459
57486
|
}
|
|
57460
|
-
this.walkInlineFragment(subselect);
|
|
57461
57487
|
}
|
|
57462
57488
|
}
|
|
57463
57489
|
empty() {
|
|
@@ -57467,7 +57493,8 @@ var FieldCollection = class {
|
|
|
57467
57493
|
selections: [],
|
|
57468
57494
|
filepath: this.filepath,
|
|
57469
57495
|
ignoreMaskDisable: this.ignoreMaskDisable,
|
|
57470
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
57496
|
+
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
57497
|
+
hoistFragments: this.hoistFragments
|
|
57471
57498
|
});
|
|
57472
57499
|
}
|
|
57473
57500
|
};
|
|
@@ -59912,7 +59939,8 @@ function artifactGenerator(stats) {
|
|
|
59912
59939
|
selections: selectionSet.selections,
|
|
59913
59940
|
fragmentDefinitions,
|
|
59914
59941
|
ignoreMaskDisable: docKind !== "HoudiniFragment",
|
|
59915
|
-
keepFragmentSpreadNodes: true
|
|
59942
|
+
keepFragmentSpreadNodes: true,
|
|
59943
|
+
hoistFragments: true
|
|
59916
59944
|
}),
|
|
59917
59945
|
operations: operationsByPath(
|
|
59918
59946
|
config2,
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -67483,7 +67483,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
67483
67483
|
// src/lib/parse.ts
|
|
67484
67484
|
async function parseJS(str, config) {
|
|
67485
67485
|
const defaultConfig = {
|
|
67486
|
-
plugins: ["typescript", "importAssertions"
|
|
67486
|
+
plugins: ["typescript", "importAssertions"],
|
|
67487
67487
|
sourceType: "module"
|
|
67488
67488
|
};
|
|
67489
67489
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
package/build/lib-esm/index.js
CHANGED
|
@@ -67424,7 +67424,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
67424
67424
|
// src/lib/parse.ts
|
|
67425
67425
|
async function parseJS(str, config) {
|
|
67426
67426
|
const defaultConfig = {
|
|
67427
|
-
plugins: ["typescript", "importAssertions"
|
|
67427
|
+
plugins: ["typescript", "importAssertions"],
|
|
67428
67428
|
sourceType: "module"
|
|
67429
67429
|
};
|
|
67430
67430
|
return (0, import_parser.parse)(str || "", config ? deepMerge2("", defaultConfig, config) : defaultConfig).program;
|
package/build/test-cjs/index.js
CHANGED
|
@@ -57592,7 +57592,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
57592
57592
|
// src/lib/parse.ts
|
|
57593
57593
|
async function parseJS(str, config2) {
|
|
57594
57594
|
const defaultConfig = {
|
|
57595
|
-
plugins: ["typescript", "importAssertions"
|
|
57595
|
+
plugins: ["typescript", "importAssertions"],
|
|
57596
57596
|
sourceType: "module"
|
|
57597
57597
|
};
|
|
57598
57598
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -57691,7 +57691,8 @@ function flattenSelections({
|
|
|
57691
57691
|
selections,
|
|
57692
57692
|
fragmentDefinitions,
|
|
57693
57693
|
ignoreMaskDisable,
|
|
57694
|
-
keepFragmentSpreadNodes
|
|
57694
|
+
keepFragmentSpreadNodes,
|
|
57695
|
+
hoistFragments
|
|
57695
57696
|
}) {
|
|
57696
57697
|
const fields = new FieldCollection({
|
|
57697
57698
|
config: config2,
|
|
@@ -57699,7 +57700,8 @@ function flattenSelections({
|
|
|
57699
57700
|
selections,
|
|
57700
57701
|
fragmentDefinitions,
|
|
57701
57702
|
ignoreMaskDisable: !!ignoreMaskDisable,
|
|
57702
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
57703
|
+
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
57704
|
+
hoistFragments
|
|
57703
57705
|
});
|
|
57704
57706
|
return fields.toSelectionSet();
|
|
57705
57707
|
}
|
|
@@ -57712,6 +57714,7 @@ var FieldCollection = class {
|
|
|
57712
57714
|
fragmentSpreads;
|
|
57713
57715
|
ignoreMaskDisable;
|
|
57714
57716
|
keepFragmentSpreadNodes;
|
|
57717
|
+
hoistFragments;
|
|
57715
57718
|
constructor(args) {
|
|
57716
57719
|
this.config = args.config;
|
|
57717
57720
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
@@ -57720,15 +57723,32 @@ var FieldCollection = class {
|
|
|
57720
57723
|
this.fields = {};
|
|
57721
57724
|
this.inlineFragments = {};
|
|
57722
57725
|
this.fragmentSpreads = {};
|
|
57726
|
+
this.hoistFragments = !!args.hoistFragments;
|
|
57723
57727
|
this.filepath = args.filepath;
|
|
57724
57728
|
for (const selection of args.selections) {
|
|
57725
|
-
this.add(selection);
|
|
57729
|
+
this.add({ selection });
|
|
57726
57730
|
}
|
|
57727
57731
|
}
|
|
57728
57732
|
get size() {
|
|
57729
57733
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57730
57734
|
}
|
|
57731
|
-
add(selection) {
|
|
57735
|
+
add({ selection, external }) {
|
|
57736
|
+
let includeFragments = this.config.defaultFragmentMasking === "disable";
|
|
57737
|
+
const maskEnableDirective = selection.directives?.find(
|
|
57738
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
57739
|
+
);
|
|
57740
|
+
if (maskEnableDirective) {
|
|
57741
|
+
includeFragments = false;
|
|
57742
|
+
}
|
|
57743
|
+
const maskDisableDirective = selection.directives?.find(
|
|
57744
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
57745
|
+
);
|
|
57746
|
+
if (maskDisableDirective) {
|
|
57747
|
+
includeFragments = true;
|
|
57748
|
+
}
|
|
57749
|
+
if (this.ignoreMaskDisable) {
|
|
57750
|
+
includeFragments = true;
|
|
57751
|
+
}
|
|
57732
57752
|
if (selection.kind === "Field") {
|
|
57733
57753
|
const key = selection.alias?.value || selection.name.value;
|
|
57734
57754
|
if (!this.fields[key]) {
|
|
@@ -57738,41 +57758,30 @@ var FieldCollection = class {
|
|
|
57738
57758
|
};
|
|
57739
57759
|
}
|
|
57740
57760
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
57741
|
-
this.fields[key].selection.add(
|
|
57761
|
+
this.fields[key].selection.add({
|
|
57762
|
+
selection: subselect,
|
|
57763
|
+
external
|
|
57764
|
+
});
|
|
57765
|
+
}
|
|
57766
|
+
if (!external && includeFragments) {
|
|
57767
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
57768
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57769
|
+
...this.fields[key].selection.fragmentSpreads
|
|
57770
|
+
};
|
|
57742
57771
|
}
|
|
57743
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
57744
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57745
|
-
...this.fields[key].selection.fragmentSpreads
|
|
57746
|
-
};
|
|
57747
57772
|
return;
|
|
57748
57773
|
}
|
|
57749
57774
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
57750
57775
|
for (const subselect of selection.selectionSet.selections) {
|
|
57751
|
-
this.add(subselect);
|
|
57776
|
+
this.add({ selection: subselect, external });
|
|
57752
57777
|
}
|
|
57753
57778
|
}
|
|
57754
57779
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57755
|
-
this.walkInlineFragment(selection);
|
|
57780
|
+
this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
|
|
57756
57781
|
return;
|
|
57757
57782
|
}
|
|
57758
57783
|
if (selection.kind === "FragmentSpread") {
|
|
57759
|
-
|
|
57760
|
-
const maskEnableDirective = selection.directives?.find(
|
|
57761
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
57762
|
-
);
|
|
57763
|
-
if (maskEnableDirective) {
|
|
57764
|
-
includeFragments = false;
|
|
57765
|
-
}
|
|
57766
|
-
const maskDisableDirective = selection.directives?.find(
|
|
57767
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
57768
|
-
);
|
|
57769
|
-
if (maskDisableDirective) {
|
|
57770
|
-
includeFragments = true;
|
|
57771
|
-
}
|
|
57772
|
-
if (this.ignoreMaskDisable) {
|
|
57773
|
-
includeFragments = true;
|
|
57774
|
-
}
|
|
57775
|
-
if (this.keepFragmentSpreadNodes) {
|
|
57784
|
+
if (this.keepFragmentSpreadNodes && !external) {
|
|
57776
57785
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57777
57786
|
}
|
|
57778
57787
|
if (!includeFragments) {
|
|
@@ -57786,18 +57795,21 @@ var FieldCollection = class {
|
|
|
57786
57795
|
});
|
|
57787
57796
|
}
|
|
57788
57797
|
this.add({
|
|
57789
|
-
|
|
57790
|
-
|
|
57791
|
-
|
|
57792
|
-
|
|
57793
|
-
|
|
57794
|
-
|
|
57798
|
+
selection: {
|
|
57799
|
+
kind: "InlineFragment",
|
|
57800
|
+
typeCondition: {
|
|
57801
|
+
kind: "NamedType",
|
|
57802
|
+
name: {
|
|
57803
|
+
kind: "Name",
|
|
57804
|
+
value: definition.typeCondition.name.value
|
|
57805
|
+
}
|
|
57806
|
+
},
|
|
57807
|
+
selectionSet: {
|
|
57808
|
+
kind: "SelectionSet",
|
|
57809
|
+
selections: [...definition.selectionSet.selections]
|
|
57795
57810
|
}
|
|
57796
57811
|
},
|
|
57797
|
-
|
|
57798
|
-
kind: "SelectionSet",
|
|
57799
|
-
selections: [...definition.selectionSet.selections]
|
|
57800
|
-
}
|
|
57812
|
+
external
|
|
57801
57813
|
});
|
|
57802
57814
|
}
|
|
57803
57815
|
}
|
|
@@ -57853,7 +57865,11 @@ var FieldCollection = class {
|
|
|
57853
57865
|
})
|
|
57854
57866
|
);
|
|
57855
57867
|
}
|
|
57856
|
-
walkInlineFragment(
|
|
57868
|
+
walkInlineFragment({
|
|
57869
|
+
selection,
|
|
57870
|
+
external,
|
|
57871
|
+
hoistFragments
|
|
57872
|
+
}) {
|
|
57857
57873
|
const key = selection.typeCondition.name.value;
|
|
57858
57874
|
if (!this.inlineFragments[key]) {
|
|
57859
57875
|
this.inlineFragments[key] = {
|
|
@@ -57862,11 +57878,21 @@ var FieldCollection = class {
|
|
|
57862
57878
|
};
|
|
57863
57879
|
}
|
|
57864
57880
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57865
|
-
if (subselect.kind
|
|
57866
|
-
this.inlineFragments[key].selection.add(
|
|
57881
|
+
if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57882
|
+
this.inlineFragments[key].selection.add({
|
|
57883
|
+
selection: subselect,
|
|
57884
|
+
external
|
|
57885
|
+
});
|
|
57867
57886
|
continue;
|
|
57887
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
57888
|
+
this.add({
|
|
57889
|
+
selection: subselect,
|
|
57890
|
+
external: true
|
|
57891
|
+
});
|
|
57892
|
+
continue;
|
|
57893
|
+
} else {
|
|
57894
|
+
this.walkInlineFragment({ selection: subselect, external, hoistFragments });
|
|
57868
57895
|
}
|
|
57869
|
-
this.walkInlineFragment(subselect);
|
|
57870
57896
|
}
|
|
57871
57897
|
}
|
|
57872
57898
|
empty() {
|
|
@@ -57876,7 +57902,8 @@ var FieldCollection = class {
|
|
|
57876
57902
|
selections: [],
|
|
57877
57903
|
filepath: this.filepath,
|
|
57878
57904
|
ignoreMaskDisable: this.ignoreMaskDisable,
|
|
57879
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
57905
|
+
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
57906
|
+
hoistFragments: this.hoistFragments
|
|
57880
57907
|
});
|
|
57881
57908
|
}
|
|
57882
57909
|
};
|
|
@@ -60321,7 +60348,8 @@ function artifactGenerator(stats) {
|
|
|
60321
60348
|
selections: selectionSet.selections,
|
|
60322
60349
|
fragmentDefinitions,
|
|
60323
60350
|
ignoreMaskDisable: docKind !== "HoudiniFragment",
|
|
60324
|
-
keepFragmentSpreadNodes: true
|
|
60351
|
+
keepFragmentSpreadNodes: true,
|
|
60352
|
+
hoistFragments: true
|
|
60325
60353
|
}),
|
|
60326
60354
|
operations: operationsByPath(
|
|
60327
60355
|
config2,
|
|
@@ -63564,6 +63592,8 @@ function testConfigFile({ plugins, ...config2 } = {}) {
|
|
|
63564
63592
|
customIdList: [CustomIdType]!
|
|
63565
63593
|
nodes(ids: [ID!]!): [Node!]!
|
|
63566
63594
|
monkeys: MonkeyConnection!
|
|
63595
|
+
animals(first: Int, after: String): AnimalConnection
|
|
63596
|
+
|
|
63567
63597
|
}
|
|
63568
63598
|
|
|
63569
63599
|
input UserFilter {
|
package/build/test-esm/index.js
CHANGED
|
@@ -57587,7 +57587,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
57587
57587
|
// src/lib/parse.ts
|
|
57588
57588
|
async function parseJS(str, config2) {
|
|
57589
57589
|
const defaultConfig = {
|
|
57590
|
-
plugins: ["typescript", "importAssertions"
|
|
57590
|
+
plugins: ["typescript", "importAssertions"],
|
|
57591
57591
|
sourceType: "module"
|
|
57592
57592
|
};
|
|
57593
57593
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -57686,7 +57686,8 @@ function flattenSelections({
|
|
|
57686
57686
|
selections,
|
|
57687
57687
|
fragmentDefinitions,
|
|
57688
57688
|
ignoreMaskDisable,
|
|
57689
|
-
keepFragmentSpreadNodes
|
|
57689
|
+
keepFragmentSpreadNodes,
|
|
57690
|
+
hoistFragments
|
|
57690
57691
|
}) {
|
|
57691
57692
|
const fields = new FieldCollection({
|
|
57692
57693
|
config: config2,
|
|
@@ -57694,7 +57695,8 @@ function flattenSelections({
|
|
|
57694
57695
|
selections,
|
|
57695
57696
|
fragmentDefinitions,
|
|
57696
57697
|
ignoreMaskDisable: !!ignoreMaskDisable,
|
|
57697
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
57698
|
+
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
57699
|
+
hoistFragments
|
|
57698
57700
|
});
|
|
57699
57701
|
return fields.toSelectionSet();
|
|
57700
57702
|
}
|
|
@@ -57707,6 +57709,7 @@ var FieldCollection = class {
|
|
|
57707
57709
|
fragmentSpreads;
|
|
57708
57710
|
ignoreMaskDisable;
|
|
57709
57711
|
keepFragmentSpreadNodes;
|
|
57712
|
+
hoistFragments;
|
|
57710
57713
|
constructor(args) {
|
|
57711
57714
|
this.config = args.config;
|
|
57712
57715
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
@@ -57715,15 +57718,32 @@ var FieldCollection = class {
|
|
|
57715
57718
|
this.fields = {};
|
|
57716
57719
|
this.inlineFragments = {};
|
|
57717
57720
|
this.fragmentSpreads = {};
|
|
57721
|
+
this.hoistFragments = !!args.hoistFragments;
|
|
57718
57722
|
this.filepath = args.filepath;
|
|
57719
57723
|
for (const selection of args.selections) {
|
|
57720
|
-
this.add(selection);
|
|
57724
|
+
this.add({ selection });
|
|
57721
57725
|
}
|
|
57722
57726
|
}
|
|
57723
57727
|
get size() {
|
|
57724
57728
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57725
57729
|
}
|
|
57726
|
-
add(selection) {
|
|
57730
|
+
add({ selection, external }) {
|
|
57731
|
+
let includeFragments = this.config.defaultFragmentMasking === "disable";
|
|
57732
|
+
const maskEnableDirective = selection.directives?.find(
|
|
57733
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
57734
|
+
);
|
|
57735
|
+
if (maskEnableDirective) {
|
|
57736
|
+
includeFragments = false;
|
|
57737
|
+
}
|
|
57738
|
+
const maskDisableDirective = selection.directives?.find(
|
|
57739
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
57740
|
+
);
|
|
57741
|
+
if (maskDisableDirective) {
|
|
57742
|
+
includeFragments = true;
|
|
57743
|
+
}
|
|
57744
|
+
if (this.ignoreMaskDisable) {
|
|
57745
|
+
includeFragments = true;
|
|
57746
|
+
}
|
|
57727
57747
|
if (selection.kind === "Field") {
|
|
57728
57748
|
const key = selection.alias?.value || selection.name.value;
|
|
57729
57749
|
if (!this.fields[key]) {
|
|
@@ -57733,41 +57753,30 @@ var FieldCollection = class {
|
|
|
57733
57753
|
};
|
|
57734
57754
|
}
|
|
57735
57755
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
57736
|
-
this.fields[key].selection.add(
|
|
57756
|
+
this.fields[key].selection.add({
|
|
57757
|
+
selection: subselect,
|
|
57758
|
+
external
|
|
57759
|
+
});
|
|
57760
|
+
}
|
|
57761
|
+
if (!external && includeFragments) {
|
|
57762
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
57763
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57764
|
+
...this.fields[key].selection.fragmentSpreads
|
|
57765
|
+
};
|
|
57737
57766
|
}
|
|
57738
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
57739
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57740
|
-
...this.fields[key].selection.fragmentSpreads
|
|
57741
|
-
};
|
|
57742
57767
|
return;
|
|
57743
57768
|
}
|
|
57744
57769
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
57745
57770
|
for (const subselect of selection.selectionSet.selections) {
|
|
57746
|
-
this.add(subselect);
|
|
57771
|
+
this.add({ selection: subselect, external });
|
|
57747
57772
|
}
|
|
57748
57773
|
}
|
|
57749
57774
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57750
|
-
this.walkInlineFragment(selection);
|
|
57775
|
+
this.walkInlineFragment({ selection, external, hoistFragments: this.hoistFragments });
|
|
57751
57776
|
return;
|
|
57752
57777
|
}
|
|
57753
57778
|
if (selection.kind === "FragmentSpread") {
|
|
57754
|
-
|
|
57755
|
-
const maskEnableDirective = selection.directives?.find(
|
|
57756
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
57757
|
-
);
|
|
57758
|
-
if (maskEnableDirective) {
|
|
57759
|
-
includeFragments = false;
|
|
57760
|
-
}
|
|
57761
|
-
const maskDisableDirective = selection.directives?.find(
|
|
57762
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
57763
|
-
);
|
|
57764
|
-
if (maskDisableDirective) {
|
|
57765
|
-
includeFragments = true;
|
|
57766
|
-
}
|
|
57767
|
-
if (this.ignoreMaskDisable) {
|
|
57768
|
-
includeFragments = true;
|
|
57769
|
-
}
|
|
57770
|
-
if (this.keepFragmentSpreadNodes) {
|
|
57779
|
+
if (this.keepFragmentSpreadNodes && !external) {
|
|
57771
57780
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57772
57781
|
}
|
|
57773
57782
|
if (!includeFragments) {
|
|
@@ -57781,18 +57790,21 @@ var FieldCollection = class {
|
|
|
57781
57790
|
});
|
|
57782
57791
|
}
|
|
57783
57792
|
this.add({
|
|
57784
|
-
|
|
57785
|
-
|
|
57786
|
-
|
|
57787
|
-
|
|
57788
|
-
|
|
57789
|
-
|
|
57793
|
+
selection: {
|
|
57794
|
+
kind: "InlineFragment",
|
|
57795
|
+
typeCondition: {
|
|
57796
|
+
kind: "NamedType",
|
|
57797
|
+
name: {
|
|
57798
|
+
kind: "Name",
|
|
57799
|
+
value: definition.typeCondition.name.value
|
|
57800
|
+
}
|
|
57801
|
+
},
|
|
57802
|
+
selectionSet: {
|
|
57803
|
+
kind: "SelectionSet",
|
|
57804
|
+
selections: [...definition.selectionSet.selections]
|
|
57790
57805
|
}
|
|
57791
57806
|
},
|
|
57792
|
-
|
|
57793
|
-
kind: "SelectionSet",
|
|
57794
|
-
selections: [...definition.selectionSet.selections]
|
|
57795
|
-
}
|
|
57807
|
+
external
|
|
57796
57808
|
});
|
|
57797
57809
|
}
|
|
57798
57810
|
}
|
|
@@ -57848,7 +57860,11 @@ var FieldCollection = class {
|
|
|
57848
57860
|
})
|
|
57849
57861
|
);
|
|
57850
57862
|
}
|
|
57851
|
-
walkInlineFragment(
|
|
57863
|
+
walkInlineFragment({
|
|
57864
|
+
selection,
|
|
57865
|
+
external,
|
|
57866
|
+
hoistFragments
|
|
57867
|
+
}) {
|
|
57852
57868
|
const key = selection.typeCondition.name.value;
|
|
57853
57869
|
if (!this.inlineFragments[key]) {
|
|
57854
57870
|
this.inlineFragments[key] = {
|
|
@@ -57857,11 +57873,21 @@ var FieldCollection = class {
|
|
|
57857
57873
|
};
|
|
57858
57874
|
}
|
|
57859
57875
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57860
|
-
if (subselect.kind
|
|
57861
|
-
this.inlineFragments[key].selection.add(
|
|
57876
|
+
if (subselect.kind === "FragmentSpread" && !hoistFragments || subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57877
|
+
this.inlineFragments[key].selection.add({
|
|
57878
|
+
selection: subselect,
|
|
57879
|
+
external
|
|
57880
|
+
});
|
|
57862
57881
|
continue;
|
|
57882
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
57883
|
+
this.add({
|
|
57884
|
+
selection: subselect,
|
|
57885
|
+
external: true
|
|
57886
|
+
});
|
|
57887
|
+
continue;
|
|
57888
|
+
} else {
|
|
57889
|
+
this.walkInlineFragment({ selection: subselect, external, hoistFragments });
|
|
57863
57890
|
}
|
|
57864
|
-
this.walkInlineFragment(subselect);
|
|
57865
57891
|
}
|
|
57866
57892
|
}
|
|
57867
57893
|
empty() {
|
|
@@ -57871,7 +57897,8 @@ var FieldCollection = class {
|
|
|
57871
57897
|
selections: [],
|
|
57872
57898
|
filepath: this.filepath,
|
|
57873
57899
|
ignoreMaskDisable: this.ignoreMaskDisable,
|
|
57874
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
57900
|
+
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
57901
|
+
hoistFragments: this.hoistFragments
|
|
57875
57902
|
});
|
|
57876
57903
|
}
|
|
57877
57904
|
};
|
|
@@ -60316,7 +60343,8 @@ function artifactGenerator(stats) {
|
|
|
60316
60343
|
selections: selectionSet.selections,
|
|
60317
60344
|
fragmentDefinitions,
|
|
60318
60345
|
ignoreMaskDisable: docKind !== "HoudiniFragment",
|
|
60319
|
-
keepFragmentSpreadNodes: true
|
|
60346
|
+
keepFragmentSpreadNodes: true,
|
|
60347
|
+
hoistFragments: true
|
|
60320
60348
|
}),
|
|
60321
60349
|
operations: operationsByPath(
|
|
60322
60350
|
config2,
|
|
@@ -63559,6 +63587,8 @@ function testConfigFile({ plugins, ...config2 } = {}) {
|
|
|
63559
63587
|
customIdList: [CustomIdType]!
|
|
63560
63588
|
nodes(ids: [ID!]!): [Node!]!
|
|
63561
63589
|
monkeys: MonkeyConnection!
|
|
63590
|
+
animals(first: Int, after: String): AnimalConnection
|
|
63591
|
+
|
|
63562
63592
|
}
|
|
63563
63593
|
|
|
63564
63594
|
input UserFilter {
|