houdini 1.0.0-next.5 → 1.0.0-next.6
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 +130 -121
- package/build/cmd-esm/index.js +130 -121
- package/build/codegen/generators/artifacts/index.d.ts +2 -2
- package/build/codegen/generators/artifacts/indexFile.d.ts +2 -2
- package/build/codegen/generators/artifacts/selection.d.ts +2 -2
- package/build/codegen/generators/indexFile/index.d.ts +2 -2
- package/build/codegen/generators/persistedQueries/index.d.ts +2 -2
- package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -2
- package/build/codegen/generators/runtime/index.d.ts +2 -2
- package/build/codegen/generators/typescript/documentTypes.d.ts +2 -2
- package/build/codegen/generators/typescript/imperativeTypeDef.d.ts +2 -2
- package/build/codegen/generators/typescript/index.d.ts +2 -2
- package/build/codegen/index.d.ts +2 -2
- package/build/codegen/transforms/addID.d.ts +2 -2
- package/build/codegen/transforms/composeQueries.d.ts +4 -4
- package/build/codegen/transforms/fragmentVariables.d.ts +2 -2
- package/build/codegen/transforms/list.d.ts +2 -2
- package/build/codegen/transforms/paginate.d.ts +2 -2
- package/build/codegen/transforms/schema.d.ts +2 -2
- package/build/codegen/transforms/typename.d.ts +2 -2
- package/build/codegen/validators/noIDAlias.d.ts +2 -2
- package/build/codegen/validators/plugins.d.ts +2 -2
- package/build/codegen/validators/typeCheck.d.ts +2 -2
- package/build/codegen/validators/uniqueNames.d.ts +2 -2
- package/build/codegen-cjs/index.js +127 -118
- package/build/codegen-esm/index.js +127 -118
- package/build/lib/graphql.d.ts +2 -2
- package/build/lib/types.d.ts +35 -35
- package/build/lib-cjs/index.js +1 -1
- package/build/lib-esm/index.js +1 -1
- package/build/test/index.d.ts +3 -3
- package/build/test-cjs/index.js +125 -116
- package/build/test-esm/index.js +125 -116
- package/build/vite-cjs/index.js +130 -121
- package/build/vite-esm/index.js +130 -121
- package/package.json +1 -1
package/build/vite-cjs/index.js
CHANGED
|
@@ -67369,7 +67369,7 @@ async function getConfig({
|
|
|
67369
67369
|
}
|
|
67370
67370
|
}
|
|
67371
67371
|
_config.plugins = orderedPlugins(plugins);
|
|
67372
|
-
await Promise.all(_config.plugins.map((plugin2) => plugin2.
|
|
67372
|
+
await Promise.all(_config.plugins.map((plugin2) => plugin2.afterLoad?.({ config: _config })));
|
|
67373
67373
|
resolve2(_config);
|
|
67374
67374
|
return _config;
|
|
67375
67375
|
} catch (e2) {
|
|
@@ -68282,7 +68282,7 @@ async function fragmentVariables(config4, documents) {
|
|
|
68282
68282
|
name: "generated::fragmentVariables",
|
|
68283
68283
|
kind: "HoudiniFragment" /* Fragment */,
|
|
68284
68284
|
document: doc,
|
|
68285
|
-
|
|
68285
|
+
originalParsed: doc,
|
|
68286
68286
|
generateStore: false,
|
|
68287
68287
|
generateArtifact: false,
|
|
68288
68288
|
filename: "generated::fragmentVariables",
|
|
@@ -69211,7 +69211,7 @@ async function paginate(config4, documents) {
|
|
|
69211
69211
|
filename: doc.filename,
|
|
69212
69212
|
name: refetchQueryName,
|
|
69213
69213
|
document: queryDoc,
|
|
69214
|
-
|
|
69214
|
+
originalParsed: queryDoc,
|
|
69215
69215
|
generateArtifact: true,
|
|
69216
69216
|
generateStore: false,
|
|
69217
69217
|
refetch: doc.refetch,
|
|
@@ -69631,7 +69631,7 @@ async function addListFragments(config4, documents) {
|
|
|
69631
69631
|
generateArtifact: false,
|
|
69632
69632
|
generateStore: false,
|
|
69633
69633
|
document: generatedDoc,
|
|
69634
|
-
|
|
69634
|
+
originalParsed: generatedDoc,
|
|
69635
69635
|
filename: "generated::lists",
|
|
69636
69636
|
originalString: "",
|
|
69637
69637
|
artifact: null
|
|
@@ -70159,11 +70159,11 @@ function artifactGenerator(stats) {
|
|
|
70159
70159
|
};
|
|
70160
70160
|
const plugin_data = config4.plugins.reduce(
|
|
70161
70161
|
(prev, plugin2) => {
|
|
70162
|
-
if (!plugin2.
|
|
70162
|
+
if (!plugin2.artifactData) {
|
|
70163
70163
|
return prev;
|
|
70164
70164
|
}
|
|
70165
70165
|
const result = { ...prev };
|
|
70166
|
-
const dataToAdd = plugin2.
|
|
70166
|
+
const dataToAdd = plugin2.artifactData({ config: config4, document: doc }) ?? {};
|
|
70167
70167
|
if (Object.keys(dataToAdd).length > 0) {
|
|
70168
70168
|
result[plugin2.name] = dataToAdd;
|
|
70169
70169
|
}
|
|
@@ -70208,10 +70208,10 @@ function artifactGenerator(stats) {
|
|
|
70208
70208
|
}
|
|
70209
70209
|
doc.artifact = artifact;
|
|
70210
70210
|
for (const plugin2 of config4.plugins) {
|
|
70211
|
-
if (!plugin2.
|
|
70211
|
+
if (!plugin2.artifactEnd) {
|
|
70212
70212
|
continue;
|
|
70213
70213
|
}
|
|
70214
|
-
plugin2.
|
|
70214
|
+
plugin2.artifactEnd({ config: config4, document: doc });
|
|
70215
70215
|
}
|
|
70216
70216
|
const file = AST5.program([
|
|
70217
70217
|
moduleExport(config4, "default", serializeValue(artifact)),
|
|
@@ -70251,18 +70251,18 @@ async function generateGraphqlReturnTypes(config4, docs) {
|
|
|
70251
70251
|
const indexPath = path_exports.join(config4.runtimeDirectory, "index.d.ts");
|
|
70252
70252
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
70253
70253
|
const contents = await parseJS(fileContent);
|
|
70254
|
-
const
|
|
70255
|
-
(plugin2) => plugin2.
|
|
70256
|
-
)?.
|
|
70257
|
-
if (!
|
|
70254
|
+
const graphqlTagReturn = config4.plugins.find(
|
|
70255
|
+
(plugin2) => plugin2.graphqlTagReturn
|
|
70256
|
+
)?.graphqlTagReturn;
|
|
70257
|
+
if (!graphqlTagReturn || !contents) {
|
|
70258
70258
|
return fileContent;
|
|
70259
70259
|
}
|
|
70260
70260
|
const overloaded_returns = {};
|
|
70261
70261
|
for (const doc of docs) {
|
|
70262
|
-
const return_value =
|
|
70262
|
+
const return_value = graphqlTagReturn({
|
|
70263
70263
|
config: config4,
|
|
70264
70264
|
document: doc,
|
|
70265
|
-
|
|
70265
|
+
ensureImport({ identifier, module: module2 }) {
|
|
70266
70266
|
ensureImports({
|
|
70267
70267
|
config: config4,
|
|
70268
70268
|
body: contents.script.body,
|
|
@@ -70310,18 +70310,18 @@ async function injectPlugins({
|
|
|
70310
70310
|
importStatement,
|
|
70311
70311
|
exportStatement
|
|
70312
70312
|
}) {
|
|
70313
|
-
const
|
|
70314
|
-
let plugins = plugin2.
|
|
70313
|
+
const clientPlugins = config4.plugins.filter((plugin2) => plugin2.clientPlugins).reduce((acc, plugin2) => {
|
|
70314
|
+
let plugins = plugin2.clientPlugins;
|
|
70315
70315
|
if (typeof plugins === "function") {
|
|
70316
70316
|
plugins = plugins(config4, config4.pluginConfig(plugin2.name));
|
|
70317
70317
|
}
|
|
70318
70318
|
return [...acc, ...Object.entries(plugins)];
|
|
70319
70319
|
}, []);
|
|
70320
|
-
return
|
|
70321
|
-
${
|
|
70320
|
+
return clientPlugins.length > 0 ? `
|
|
70321
|
+
${clientPlugins.map((plugin2, i2) => importStatement(plugin2[0], `plugin${i2}`))}
|
|
70322
70322
|
|
|
70323
70323
|
const plugins = [
|
|
70324
|
-
${
|
|
70324
|
+
${clientPlugins.map((plugin2, i2) => {
|
|
70325
70325
|
const suffix = `(${JSON.stringify(plugin2[1])})`;
|
|
70326
70326
|
return `plugin${i2}${suffix}`;
|
|
70327
70327
|
}).join(",\n")}
|
|
@@ -70365,18 +70365,18 @@ ${exportStatement("config")}
|
|
|
70365
70365
|
},
|
|
70366
70366
|
[path_exports.join(config4.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config4, content, importStatement, exportStatement })
|
|
70367
70367
|
}),
|
|
70368
|
-
...config4.plugins.filter((plugin2) => plugin2.
|
|
70368
|
+
...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, plugin2)),
|
|
70369
70369
|
generatePluginIndex({ config: config4, exportStatement: exportStar })
|
|
70370
70370
|
]);
|
|
70371
70371
|
await generateGraphqlReturnTypes(config4, docs);
|
|
70372
70372
|
}
|
|
70373
70373
|
async function generatePluginRuntime(config4, plugin2) {
|
|
70374
|
-
if (houdini_mode.is_testing || !plugin2.
|
|
70374
|
+
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
70375
70375
|
return;
|
|
70376
70376
|
}
|
|
70377
70377
|
const runtime_path = path_exports.join(
|
|
70378
70378
|
path_exports.dirname(plugin2.filepath),
|
|
70379
|
-
typeof plugin2.
|
|
70379
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config4.module]
|
|
70380
70380
|
);
|
|
70381
70381
|
try {
|
|
70382
70382
|
await fs_exports.stat(runtime_path);
|
|
@@ -70392,7 +70392,7 @@ async function generatePluginRuntime(config4, plugin2) {
|
|
|
70392
70392
|
runtime_path,
|
|
70393
70393
|
pluginDir,
|
|
70394
70394
|
Object.fromEntries(
|
|
70395
|
-
Object.entries(plugin2.
|
|
70395
|
+
Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
|
|
70396
70396
|
path_exports.join(runtime_path, key),
|
|
70397
70397
|
(content) => value({ config: config4, content })
|
|
70398
70398
|
])
|
|
@@ -70786,7 +70786,7 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70786
70786
|
const typePaths = [];
|
|
70787
70787
|
const fragmentDefinitions = {};
|
|
70788
70788
|
for (const document of docs) {
|
|
70789
|
-
for (const defn of document.
|
|
70789
|
+
for (const defn of document.originalParsed.definitions.filter(
|
|
70790
70790
|
({ kind }) => kind === "FragmentDefinition"
|
|
70791
70791
|
)) {
|
|
70792
70792
|
fragmentDefinitions[defn.name.value] = defn;
|
|
@@ -70794,47 +70794,54 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70794
70794
|
}
|
|
70795
70795
|
const missingScalars = /* @__PURE__ */ new Set();
|
|
70796
70796
|
await Promise.all(
|
|
70797
|
-
docs.map(
|
|
70798
|
-
|
|
70799
|
-
|
|
70800
|
-
|
|
70801
|
-
|
|
70802
|
-
|
|
70803
|
-
|
|
70804
|
-
|
|
70805
|
-
|
|
70806
|
-
|
|
70807
|
-
|
|
70808
|
-
|
|
70809
|
-
|
|
70810
|
-
|
|
70811
|
-
|
|
70812
|
-
applyFragments: definition.kind === "OperationDefinition"
|
|
70813
|
-
});
|
|
70814
|
-
if (definition?.kind === "OperationDefinition") {
|
|
70815
|
-
await generateOperationTypeDefs(
|
|
70816
|
-
config4,
|
|
70817
|
-
filename,
|
|
70818
|
-
program.body,
|
|
70819
|
-
definition,
|
|
70820
|
-
selections,
|
|
70821
|
-
visitedTypes,
|
|
70822
|
-
missingScalars
|
|
70823
|
-
);
|
|
70824
|
-
} else {
|
|
70825
|
-
await generateFragmentTypeDefs(
|
|
70826
|
-
config4,
|
|
70827
|
-
filename,
|
|
70828
|
-
program.body,
|
|
70829
|
-
selections,
|
|
70830
|
-
originalDocument.definitions,
|
|
70831
|
-
visitedTypes,
|
|
70832
|
-
missingScalars
|
|
70797
|
+
docs.map(
|
|
70798
|
+
async ({
|
|
70799
|
+
originalParsed: originalDocument,
|
|
70800
|
+
name,
|
|
70801
|
+
filename,
|
|
70802
|
+
generateArtifact
|
|
70803
|
+
}) => {
|
|
70804
|
+
if (!generateArtifact) {
|
|
70805
|
+
return;
|
|
70806
|
+
}
|
|
70807
|
+
const typeDefPath = config4.artifactTypePath(originalDocument);
|
|
70808
|
+
const program = AST11.program([]);
|
|
70809
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
70810
|
+
let definition = originalDocument.definitions.find(
|
|
70811
|
+
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name
|
|
70833
70812
|
);
|
|
70813
|
+
const selections = flattenSelections({
|
|
70814
|
+
config: config4,
|
|
70815
|
+
filepath: filename,
|
|
70816
|
+
selections: definition.selectionSet.selections,
|
|
70817
|
+
fragmentDefinitions,
|
|
70818
|
+
applyFragments: definition.kind === "OperationDefinition"
|
|
70819
|
+
});
|
|
70820
|
+
if (definition?.kind === "OperationDefinition") {
|
|
70821
|
+
await generateOperationTypeDefs(
|
|
70822
|
+
config4,
|
|
70823
|
+
filename,
|
|
70824
|
+
program.body,
|
|
70825
|
+
definition,
|
|
70826
|
+
selections,
|
|
70827
|
+
visitedTypes,
|
|
70828
|
+
missingScalars
|
|
70829
|
+
);
|
|
70830
|
+
} else {
|
|
70831
|
+
await generateFragmentTypeDefs(
|
|
70832
|
+
config4,
|
|
70833
|
+
filename,
|
|
70834
|
+
program.body,
|
|
70835
|
+
selections,
|
|
70836
|
+
originalDocument.definitions,
|
|
70837
|
+
visitedTypes,
|
|
70838
|
+
missingScalars
|
|
70839
|
+
);
|
|
70840
|
+
}
|
|
70841
|
+
await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
|
|
70842
|
+
typePaths.push(typeDefPath);
|
|
70834
70843
|
}
|
|
70835
|
-
|
|
70836
|
-
typePaths.push(typeDefPath);
|
|
70837
|
-
})
|
|
70844
|
+
)
|
|
70838
70845
|
);
|
|
70839
70846
|
const typeIndex = AST11.program(
|
|
70840
70847
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
@@ -70849,28 +70856,28 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70849
70856
|
AST11.exportAllDeclaration(AST11.literal("./graphql"), null)
|
|
70850
70857
|
])
|
|
70851
70858
|
);
|
|
70852
|
-
const
|
|
70859
|
+
const exportDefaultAs = ({ module: module2, as }) => `
|
|
70853
70860
|
export { default as ${as} } from "${module2}"
|
|
70854
70861
|
`;
|
|
70855
|
-
const
|
|
70862
|
+
const exportStarFrom2 = ({ module: module2 }) => `
|
|
70856
70863
|
export * from "${module2}"
|
|
70857
70864
|
`;
|
|
70858
70865
|
let indexContent = recast11.print(typeIndex).code;
|
|
70859
70866
|
for (const plugin2 of config4.plugins) {
|
|
70860
|
-
if (!plugin2.
|
|
70867
|
+
if (!plugin2.indexFile) {
|
|
70861
70868
|
continue;
|
|
70862
70869
|
}
|
|
70863
|
-
indexContent = plugin2.
|
|
70870
|
+
indexContent = plugin2.indexFile({
|
|
70864
70871
|
config: config4,
|
|
70865
70872
|
content: indexContent,
|
|
70866
|
-
|
|
70867
|
-
|
|
70868
|
-
|
|
70873
|
+
exportDefaultAs,
|
|
70874
|
+
exportStarFrom: exportStarFrom2,
|
|
70875
|
+
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
70869
70876
|
typedef: true,
|
|
70870
70877
|
documents: docs
|
|
70871
70878
|
});
|
|
70872
|
-
if (plugin2.
|
|
70873
|
-
indexContent +=
|
|
70879
|
+
if (plugin2.includeRuntime) {
|
|
70880
|
+
indexContent += exportStarFrom2({
|
|
70874
70881
|
module: "./" + path_exports.relative(config4.rootDir, config4.pluginRuntimeDirectory(plugin2.name))
|
|
70875
70882
|
});
|
|
70876
70883
|
}
|
|
@@ -71117,10 +71124,10 @@ var graphql19 = __toESM(require_graphql2(), 1);
|
|
|
71117
71124
|
var recast12 = __toESM(require_main2(), 1);
|
|
71118
71125
|
var AST12 = recast12.types.builders;
|
|
71119
71126
|
async function imperativeCacheTypef(config4, docs) {
|
|
71120
|
-
const returnType = (doc) => config4.plugins.find((plugin2) => plugin2.
|
|
71127
|
+
const returnType = (doc) => config4.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
71121
71128
|
config: config4,
|
|
71122
71129
|
document: doc,
|
|
71123
|
-
|
|
71130
|
+
ensureImport({ identifier, module: module2 }) {
|
|
71124
71131
|
ensureImports({
|
|
71125
71132
|
config: config4,
|
|
71126
71133
|
body,
|
|
@@ -71491,27 +71498,30 @@ async function persistOutputGenerator(config4, docs) {
|
|
|
71491
71498
|
console.log("Can only write the queryMap to a json file");
|
|
71492
71499
|
return;
|
|
71493
71500
|
}
|
|
71494
|
-
const queryMap = docs.reduce(
|
|
71495
|
-
|
|
71496
|
-
|
|
71497
|
-
|
|
71498
|
-
|
|
71499
|
-
graphql20.
|
|
71500
|
-
|
|
71501
|
-
|
|
71502
|
-
|
|
71501
|
+
const queryMap = docs.reduce(
|
|
71502
|
+
(acc, { document, generateArtifact }) => {
|
|
71503
|
+
if (!generateArtifact) {
|
|
71504
|
+
return acc;
|
|
71505
|
+
}
|
|
71506
|
+
let rawString = graphql20.print(
|
|
71507
|
+
graphql20.visit(document, {
|
|
71508
|
+
Directive(node) {
|
|
71509
|
+
if (config4.isInternalDirective(node.name.value)) {
|
|
71510
|
+
return null;
|
|
71511
|
+
}
|
|
71503
71512
|
}
|
|
71504
|
-
}
|
|
71505
|
-
|
|
71506
|
-
|
|
71507
|
-
|
|
71508
|
-
|
|
71509
|
-
|
|
71510
|
-
|
|
71511
|
-
|
|
71512
|
-
|
|
71513
|
-
|
|
71514
|
-
|
|
71513
|
+
})
|
|
71514
|
+
);
|
|
71515
|
+
const operations = document.definitions.filter(
|
|
71516
|
+
({ kind }) => kind === graphql20.Kind.OPERATION_DEFINITION
|
|
71517
|
+
);
|
|
71518
|
+
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
71519
|
+
acc[hashDocument({ config: config4, document: rawString })] = rawString;
|
|
71520
|
+
}
|
|
71521
|
+
return acc;
|
|
71522
|
+
},
|
|
71523
|
+
{}
|
|
71524
|
+
);
|
|
71515
71525
|
if (Object.keys(queryMap).length === 0)
|
|
71516
71526
|
return;
|
|
71517
71527
|
await fs_exports.writeFile(config4.persistedQueryPath, JSON.stringify(queryMap, null, 4));
|
|
@@ -71580,32 +71590,32 @@ async function writeIndexFile2(config4, docs) {
|
|
|
71580
71590
|
const definitionsDir = relative2(config4.definitionsDirectory);
|
|
71581
71591
|
const cjs = config4.module === "commonjs";
|
|
71582
71592
|
let body = cjs ? cjsIndexFilePreamble : "";
|
|
71583
|
-
const
|
|
71584
|
-
const
|
|
71593
|
+
const exportStar = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
71594
|
+
const exportDefaultAs = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
71585
71595
|
body += [
|
|
71586
|
-
|
|
71587
|
-
|
|
71588
|
-
|
|
71589
|
-
|
|
71596
|
+
exportStar({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
71597
|
+
exportStar({ module: runtimeDir }),
|
|
71598
|
+
exportStar({ module: artifactDir }),
|
|
71599
|
+
exportStar({ module: definitionsDir })
|
|
71590
71600
|
].join("");
|
|
71591
71601
|
for (const plugin2 of config4.plugins) {
|
|
71592
|
-
if (plugin2.
|
|
71593
|
-
body = plugin2.
|
|
71602
|
+
if (plugin2.indexFile) {
|
|
71603
|
+
body = plugin2.indexFile({
|
|
71594
71604
|
config: config4,
|
|
71595
71605
|
content: body,
|
|
71596
|
-
|
|
71597
|
-
|
|
71598
|
-
|
|
71606
|
+
exportDefaultAs,
|
|
71607
|
+
exportStarFrom: exportStar,
|
|
71608
|
+
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
71599
71609
|
typedef: false,
|
|
71600
71610
|
documents: docs
|
|
71601
71611
|
});
|
|
71602
71612
|
}
|
|
71603
|
-
if (plugin2.
|
|
71604
|
-
body +=
|
|
71613
|
+
if (plugin2.includeRuntime) {
|
|
71614
|
+
body += exportStar({
|
|
71605
71615
|
module: relative2(config4.pluginRuntimeDirectory(plugin2.name))
|
|
71606
71616
|
});
|
|
71607
71617
|
}
|
|
71608
|
-
if (!plugin2.
|
|
71618
|
+
if (!plugin2.indexFile) {
|
|
71609
71619
|
continue;
|
|
71610
71620
|
}
|
|
71611
71621
|
}
|
|
@@ -72653,10 +72663,10 @@ async function runPipeline2(config4, docs) {
|
|
|
72653
72663
|
deleted: []
|
|
72654
72664
|
};
|
|
72655
72665
|
const generatePlugins = config4.plugins.filter((plugin2) => plugin2.generate);
|
|
72656
|
-
const
|
|
72666
|
+
const afterValidate = config4.plugins.filter((plugin2) => plugin2.afterValidate).map((plugin2) => plugin2.afterValidate);
|
|
72657
72667
|
const validate2 = config4.plugins.filter((plugin2) => plugin2.validate).map((plugin2) => plugin2.validate);
|
|
72658
|
-
const
|
|
72659
|
-
const
|
|
72668
|
+
const beforeValidate = config4.plugins.filter((plugin2) => plugin2.beforeValidate).map((plugin2) => plugin2.beforeValidate);
|
|
72669
|
+
const beforeGenerate = config4.plugins.filter((plugin2) => plugin2.beforeGenerate).map((plugin2) => plugin2.beforeGenerate);
|
|
72660
72670
|
const wrapHook = (hooks) => hooks.map(
|
|
72661
72671
|
(fn) => (config5, docs2) => fn({
|
|
72662
72672
|
config: config5,
|
|
@@ -72669,20 +72679,20 @@ async function runPipeline2(config4, docs) {
|
|
|
72669
72679
|
config4,
|
|
72670
72680
|
[
|
|
72671
72681
|
graphqlExtensions,
|
|
72672
|
-
...wrapHook(
|
|
72682
|
+
...wrapHook(beforeValidate),
|
|
72673
72683
|
typeCheck,
|
|
72674
72684
|
uniqueDocumentNames,
|
|
72675
72685
|
noIDAlias,
|
|
72676
72686
|
validatePlugins,
|
|
72677
72687
|
...wrapHook(validate2),
|
|
72678
|
-
...wrapHook(
|
|
72688
|
+
...wrapHook(afterValidate),
|
|
72679
72689
|
addID,
|
|
72680
72690
|
addTypename,
|
|
72681
72691
|
addListFragments,
|
|
72682
72692
|
paginate,
|
|
72683
72693
|
fragmentVariables,
|
|
72684
72694
|
includeFragmentDefinitions,
|
|
72685
|
-
...wrapHook(
|
|
72695
|
+
...wrapHook(beforeGenerate),
|
|
72686
72696
|
artifactGenerator(artifactStats),
|
|
72687
72697
|
runtimeGenerator,
|
|
72688
72698
|
writeIndexFile2,
|
|
@@ -72693,14 +72703,13 @@ async function runPipeline2(config4, docs) {
|
|
|
72693
72703
|
(plugin2) => async (config5, docs2) => await plugin2.generate({
|
|
72694
72704
|
config: config5,
|
|
72695
72705
|
documents: docs2,
|
|
72696
|
-
|
|
72706
|
+
pluginRoot: config5.pluginDirectory(plugin2.name)
|
|
72697
72707
|
})
|
|
72698
72708
|
)
|
|
72699
72709
|
],
|
|
72700
72710
|
docs
|
|
72701
72711
|
);
|
|
72702
72712
|
} catch (e2) {
|
|
72703
|
-
console.log(e2);
|
|
72704
72713
|
error = e2;
|
|
72705
72714
|
}
|
|
72706
72715
|
const unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length - artifactStats.deleted.length;
|
|
@@ -72750,9 +72759,9 @@ async function collectDocuments(config4) {
|
|
|
72750
72759
|
".ts": []
|
|
72751
72760
|
};
|
|
72752
72761
|
for (const plugin2 of config4.plugins) {
|
|
72753
|
-
if (plugin2.extensions && plugin2.
|
|
72762
|
+
if (plugin2.extensions && plugin2.extractDocuments) {
|
|
72754
72763
|
for (const extension of plugin2.extensions) {
|
|
72755
|
-
extractors[extension] = [...extractors[extension] || [], plugin2.
|
|
72764
|
+
extractors[extension] = [...extractors[extension] || [], plugin2.extractDocuments];
|
|
72756
72765
|
}
|
|
72757
72766
|
}
|
|
72758
72767
|
}
|
|
@@ -72851,7 +72860,7 @@ async function processGraphQLDocument(config4, filepath, document) {
|
|
|
72851
72860
|
kind,
|
|
72852
72861
|
document: parsedDoc,
|
|
72853
72862
|
filename: filepath,
|
|
72854
|
-
|
|
72863
|
+
originalParsed: parsedDoc,
|
|
72855
72864
|
generateArtifact: true,
|
|
72856
72865
|
generateStore: true,
|
|
72857
72866
|
originalString: document,
|
|
@@ -72939,10 +72948,10 @@ function Plugin(opts = {}) {
|
|
|
72939
72948
|
filepath
|
|
72940
72949
|
};
|
|
72941
72950
|
for (const plugin2 of config3.plugins) {
|
|
72942
|
-
if (!plugin2.
|
|
72951
|
+
if (!plugin2.transformFile) {
|
|
72943
72952
|
continue;
|
|
72944
72953
|
}
|
|
72945
|
-
const { code: code2 } = await plugin2.
|
|
72954
|
+
const { code: code2 } = await plugin2.transformFile(ctx);
|
|
72946
72955
|
ctx.content = code2;
|
|
72947
72956
|
}
|
|
72948
72957
|
return { code: ctx.content };
|