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-esm/index.js
CHANGED
|
@@ -67363,7 +67363,7 @@ async function getConfig({
|
|
|
67363
67363
|
}
|
|
67364
67364
|
}
|
|
67365
67365
|
_config.plugins = orderedPlugins(plugins);
|
|
67366
|
-
await Promise.all(_config.plugins.map((plugin2) => plugin2.
|
|
67366
|
+
await Promise.all(_config.plugins.map((plugin2) => plugin2.afterLoad?.({ config: _config })));
|
|
67367
67367
|
resolve2(_config);
|
|
67368
67368
|
return _config;
|
|
67369
67369
|
} catch (e2) {
|
|
@@ -68276,7 +68276,7 @@ async function fragmentVariables(config4, documents) {
|
|
|
68276
68276
|
name: "generated::fragmentVariables",
|
|
68277
68277
|
kind: "HoudiniFragment" /* Fragment */,
|
|
68278
68278
|
document: doc,
|
|
68279
|
-
|
|
68279
|
+
originalParsed: doc,
|
|
68280
68280
|
generateStore: false,
|
|
68281
68281
|
generateArtifact: false,
|
|
68282
68282
|
filename: "generated::fragmentVariables",
|
|
@@ -69205,7 +69205,7 @@ async function paginate(config4, documents) {
|
|
|
69205
69205
|
filename: doc.filename,
|
|
69206
69206
|
name: refetchQueryName,
|
|
69207
69207
|
document: queryDoc,
|
|
69208
|
-
|
|
69208
|
+
originalParsed: queryDoc,
|
|
69209
69209
|
generateArtifact: true,
|
|
69210
69210
|
generateStore: false,
|
|
69211
69211
|
refetch: doc.refetch,
|
|
@@ -69625,7 +69625,7 @@ async function addListFragments(config4, documents) {
|
|
|
69625
69625
|
generateArtifact: false,
|
|
69626
69626
|
generateStore: false,
|
|
69627
69627
|
document: generatedDoc,
|
|
69628
|
-
|
|
69628
|
+
originalParsed: generatedDoc,
|
|
69629
69629
|
filename: "generated::lists",
|
|
69630
69630
|
originalString: "",
|
|
69631
69631
|
artifact: null
|
|
@@ -70153,11 +70153,11 @@ function artifactGenerator(stats) {
|
|
|
70153
70153
|
};
|
|
70154
70154
|
const plugin_data = config4.plugins.reduce(
|
|
70155
70155
|
(prev, plugin2) => {
|
|
70156
|
-
if (!plugin2.
|
|
70156
|
+
if (!plugin2.artifactData) {
|
|
70157
70157
|
return prev;
|
|
70158
70158
|
}
|
|
70159
70159
|
const result = { ...prev };
|
|
70160
|
-
const dataToAdd = plugin2.
|
|
70160
|
+
const dataToAdd = plugin2.artifactData({ config: config4, document: doc }) ?? {};
|
|
70161
70161
|
if (Object.keys(dataToAdd).length > 0) {
|
|
70162
70162
|
result[plugin2.name] = dataToAdd;
|
|
70163
70163
|
}
|
|
@@ -70202,10 +70202,10 @@ function artifactGenerator(stats) {
|
|
|
70202
70202
|
}
|
|
70203
70203
|
doc.artifact = artifact;
|
|
70204
70204
|
for (const plugin2 of config4.plugins) {
|
|
70205
|
-
if (!plugin2.
|
|
70205
|
+
if (!plugin2.artifactEnd) {
|
|
70206
70206
|
continue;
|
|
70207
70207
|
}
|
|
70208
|
-
plugin2.
|
|
70208
|
+
plugin2.artifactEnd({ config: config4, document: doc });
|
|
70209
70209
|
}
|
|
70210
70210
|
const file = AST5.program([
|
|
70211
70211
|
moduleExport(config4, "default", serializeValue(artifact)),
|
|
@@ -70245,18 +70245,18 @@ async function generateGraphqlReturnTypes(config4, docs) {
|
|
|
70245
70245
|
const indexPath = path_exports.join(config4.runtimeDirectory, "index.d.ts");
|
|
70246
70246
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
70247
70247
|
const contents = await parseJS(fileContent);
|
|
70248
|
-
const
|
|
70249
|
-
(plugin2) => plugin2.
|
|
70250
|
-
)?.
|
|
70251
|
-
if (!
|
|
70248
|
+
const graphqlTagReturn = config4.plugins.find(
|
|
70249
|
+
(plugin2) => plugin2.graphqlTagReturn
|
|
70250
|
+
)?.graphqlTagReturn;
|
|
70251
|
+
if (!graphqlTagReturn || !contents) {
|
|
70252
70252
|
return fileContent;
|
|
70253
70253
|
}
|
|
70254
70254
|
const overloaded_returns = {};
|
|
70255
70255
|
for (const doc of docs) {
|
|
70256
|
-
const return_value =
|
|
70256
|
+
const return_value = graphqlTagReturn({
|
|
70257
70257
|
config: config4,
|
|
70258
70258
|
document: doc,
|
|
70259
|
-
|
|
70259
|
+
ensureImport({ identifier, module }) {
|
|
70260
70260
|
ensureImports({
|
|
70261
70261
|
config: config4,
|
|
70262
70262
|
body: contents.script.body,
|
|
@@ -70304,18 +70304,18 @@ async function injectPlugins({
|
|
|
70304
70304
|
importStatement,
|
|
70305
70305
|
exportStatement
|
|
70306
70306
|
}) {
|
|
70307
|
-
const
|
|
70308
|
-
let plugins = plugin2.
|
|
70307
|
+
const clientPlugins = config4.plugins.filter((plugin2) => plugin2.clientPlugins).reduce((acc, plugin2) => {
|
|
70308
|
+
let plugins = plugin2.clientPlugins;
|
|
70309
70309
|
if (typeof plugins === "function") {
|
|
70310
70310
|
plugins = plugins(config4, config4.pluginConfig(plugin2.name));
|
|
70311
70311
|
}
|
|
70312
70312
|
return [...acc, ...Object.entries(plugins)];
|
|
70313
70313
|
}, []);
|
|
70314
|
-
return
|
|
70315
|
-
${
|
|
70314
|
+
return clientPlugins.length > 0 ? `
|
|
70315
|
+
${clientPlugins.map((plugin2, i2) => importStatement(plugin2[0], `plugin${i2}`))}
|
|
70316
70316
|
|
|
70317
70317
|
const plugins = [
|
|
70318
|
-
${
|
|
70318
|
+
${clientPlugins.map((plugin2, i2) => {
|
|
70319
70319
|
const suffix = `(${JSON.stringify(plugin2[1])})`;
|
|
70320
70320
|
return `plugin${i2}${suffix}`;
|
|
70321
70321
|
}).join(",\n")}
|
|
@@ -70359,18 +70359,18 @@ ${exportStatement("config")}
|
|
|
70359
70359
|
},
|
|
70360
70360
|
[path_exports.join(config4.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config4, content, importStatement, exportStatement })
|
|
70361
70361
|
}),
|
|
70362
|
-
...config4.plugins.filter((plugin2) => plugin2.
|
|
70362
|
+
...config4.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config4, plugin2)),
|
|
70363
70363
|
generatePluginIndex({ config: config4, exportStatement: exportStar })
|
|
70364
70364
|
]);
|
|
70365
70365
|
await generateGraphqlReturnTypes(config4, docs);
|
|
70366
70366
|
}
|
|
70367
70367
|
async function generatePluginRuntime(config4, plugin2) {
|
|
70368
|
-
if (houdini_mode.is_testing || !plugin2.
|
|
70368
|
+
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
70369
70369
|
return;
|
|
70370
70370
|
}
|
|
70371
70371
|
const runtime_path = path_exports.join(
|
|
70372
70372
|
path_exports.dirname(plugin2.filepath),
|
|
70373
|
-
typeof plugin2.
|
|
70373
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config4.module]
|
|
70374
70374
|
);
|
|
70375
70375
|
try {
|
|
70376
70376
|
await fs_exports.stat(runtime_path);
|
|
@@ -70386,7 +70386,7 @@ async function generatePluginRuntime(config4, plugin2) {
|
|
|
70386
70386
|
runtime_path,
|
|
70387
70387
|
pluginDir,
|
|
70388
70388
|
Object.fromEntries(
|
|
70389
|
-
Object.entries(plugin2.
|
|
70389
|
+
Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
|
|
70390
70390
|
path_exports.join(runtime_path, key),
|
|
70391
70391
|
(content) => value({ config: config4, content })
|
|
70392
70392
|
])
|
|
@@ -70780,7 +70780,7 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70780
70780
|
const typePaths = [];
|
|
70781
70781
|
const fragmentDefinitions = {};
|
|
70782
70782
|
for (const document of docs) {
|
|
70783
|
-
for (const defn of document.
|
|
70783
|
+
for (const defn of document.originalParsed.definitions.filter(
|
|
70784
70784
|
({ kind }) => kind === "FragmentDefinition"
|
|
70785
70785
|
)) {
|
|
70786
70786
|
fragmentDefinitions[defn.name.value] = defn;
|
|
@@ -70788,47 +70788,54 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70788
70788
|
}
|
|
70789
70789
|
const missingScalars = /* @__PURE__ */ new Set();
|
|
70790
70790
|
await Promise.all(
|
|
70791
|
-
docs.map(
|
|
70792
|
-
|
|
70793
|
-
|
|
70794
|
-
|
|
70795
|
-
|
|
70796
|
-
|
|
70797
|
-
|
|
70798
|
-
|
|
70799
|
-
|
|
70800
|
-
|
|
70801
|
-
|
|
70802
|
-
|
|
70803
|
-
|
|
70804
|
-
|
|
70805
|
-
|
|
70806
|
-
applyFragments: definition.kind === "OperationDefinition"
|
|
70807
|
-
});
|
|
70808
|
-
if (definition?.kind === "OperationDefinition") {
|
|
70809
|
-
await generateOperationTypeDefs(
|
|
70810
|
-
config4,
|
|
70811
|
-
filename,
|
|
70812
|
-
program.body,
|
|
70813
|
-
definition,
|
|
70814
|
-
selections,
|
|
70815
|
-
visitedTypes,
|
|
70816
|
-
missingScalars
|
|
70817
|
-
);
|
|
70818
|
-
} else {
|
|
70819
|
-
await generateFragmentTypeDefs(
|
|
70820
|
-
config4,
|
|
70821
|
-
filename,
|
|
70822
|
-
program.body,
|
|
70823
|
-
selections,
|
|
70824
|
-
originalDocument.definitions,
|
|
70825
|
-
visitedTypes,
|
|
70826
|
-
missingScalars
|
|
70791
|
+
docs.map(
|
|
70792
|
+
async ({
|
|
70793
|
+
originalParsed: originalDocument,
|
|
70794
|
+
name,
|
|
70795
|
+
filename,
|
|
70796
|
+
generateArtifact
|
|
70797
|
+
}) => {
|
|
70798
|
+
if (!generateArtifact) {
|
|
70799
|
+
return;
|
|
70800
|
+
}
|
|
70801
|
+
const typeDefPath = config4.artifactTypePath(originalDocument);
|
|
70802
|
+
const program = AST11.program([]);
|
|
70803
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
70804
|
+
let definition = originalDocument.definitions.find(
|
|
70805
|
+
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name
|
|
70827
70806
|
);
|
|
70807
|
+
const selections = flattenSelections({
|
|
70808
|
+
config: config4,
|
|
70809
|
+
filepath: filename,
|
|
70810
|
+
selections: definition.selectionSet.selections,
|
|
70811
|
+
fragmentDefinitions,
|
|
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
|
|
70833
|
+
);
|
|
70834
|
+
}
|
|
70835
|
+
await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
|
|
70836
|
+
typePaths.push(typeDefPath);
|
|
70828
70837
|
}
|
|
70829
|
-
|
|
70830
|
-
typePaths.push(typeDefPath);
|
|
70831
|
-
})
|
|
70838
|
+
)
|
|
70832
70839
|
);
|
|
70833
70840
|
const typeIndex = AST11.program(
|
|
70834
70841
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
@@ -70843,28 +70850,28 @@ async function generateDocumentTypes(config4, docs) {
|
|
|
70843
70850
|
AST11.exportAllDeclaration(AST11.literal("./graphql"), null)
|
|
70844
70851
|
])
|
|
70845
70852
|
);
|
|
70846
|
-
const
|
|
70853
|
+
const exportDefaultAs = ({ module, as }) => `
|
|
70847
70854
|
export { default as ${as} } from "${module}"
|
|
70848
70855
|
`;
|
|
70849
|
-
const
|
|
70856
|
+
const exportStarFrom2 = ({ module }) => `
|
|
70850
70857
|
export * from "${module}"
|
|
70851
70858
|
`;
|
|
70852
70859
|
let indexContent = recast11.print(typeIndex).code;
|
|
70853
70860
|
for (const plugin2 of config4.plugins) {
|
|
70854
|
-
if (!plugin2.
|
|
70861
|
+
if (!plugin2.indexFile) {
|
|
70855
70862
|
continue;
|
|
70856
70863
|
}
|
|
70857
|
-
indexContent = plugin2.
|
|
70864
|
+
indexContent = plugin2.indexFile({
|
|
70858
70865
|
config: config4,
|
|
70859
70866
|
content: indexContent,
|
|
70860
|
-
|
|
70861
|
-
|
|
70862
|
-
|
|
70867
|
+
exportDefaultAs,
|
|
70868
|
+
exportStarFrom: exportStarFrom2,
|
|
70869
|
+
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
70863
70870
|
typedef: true,
|
|
70864
70871
|
documents: docs
|
|
70865
70872
|
});
|
|
70866
|
-
if (plugin2.
|
|
70867
|
-
indexContent +=
|
|
70873
|
+
if (plugin2.includeRuntime) {
|
|
70874
|
+
indexContent += exportStarFrom2({
|
|
70868
70875
|
module: "./" + path_exports.relative(config4.rootDir, config4.pluginRuntimeDirectory(plugin2.name))
|
|
70869
70876
|
});
|
|
70870
70877
|
}
|
|
@@ -71111,10 +71118,10 @@ var graphql19 = __toESM(require_graphql2(), 1);
|
|
|
71111
71118
|
var recast12 = __toESM(require_main2(), 1);
|
|
71112
71119
|
var AST12 = recast12.types.builders;
|
|
71113
71120
|
async function imperativeCacheTypef(config4, docs) {
|
|
71114
|
-
const returnType = (doc) => config4.plugins.find((plugin2) => plugin2.
|
|
71121
|
+
const returnType = (doc) => config4.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
71115
71122
|
config: config4,
|
|
71116
71123
|
document: doc,
|
|
71117
|
-
|
|
71124
|
+
ensureImport({ identifier, module }) {
|
|
71118
71125
|
ensureImports({
|
|
71119
71126
|
config: config4,
|
|
71120
71127
|
body,
|
|
@@ -71485,27 +71492,30 @@ async function persistOutputGenerator(config4, docs) {
|
|
|
71485
71492
|
console.log("Can only write the queryMap to a json file");
|
|
71486
71493
|
return;
|
|
71487
71494
|
}
|
|
71488
|
-
const queryMap = docs.reduce(
|
|
71489
|
-
|
|
71490
|
-
|
|
71491
|
-
|
|
71492
|
-
|
|
71493
|
-
graphql20.
|
|
71494
|
-
|
|
71495
|
-
|
|
71496
|
-
|
|
71495
|
+
const queryMap = docs.reduce(
|
|
71496
|
+
(acc, { document, generateArtifact }) => {
|
|
71497
|
+
if (!generateArtifact) {
|
|
71498
|
+
return acc;
|
|
71499
|
+
}
|
|
71500
|
+
let rawString = graphql20.print(
|
|
71501
|
+
graphql20.visit(document, {
|
|
71502
|
+
Directive(node) {
|
|
71503
|
+
if (config4.isInternalDirective(node.name.value)) {
|
|
71504
|
+
return null;
|
|
71505
|
+
}
|
|
71497
71506
|
}
|
|
71498
|
-
}
|
|
71499
|
-
|
|
71500
|
-
|
|
71501
|
-
|
|
71502
|
-
|
|
71503
|
-
|
|
71504
|
-
|
|
71505
|
-
|
|
71506
|
-
|
|
71507
|
-
|
|
71508
|
-
|
|
71507
|
+
})
|
|
71508
|
+
);
|
|
71509
|
+
const operations = document.definitions.filter(
|
|
71510
|
+
({ kind }) => kind === graphql20.Kind.OPERATION_DEFINITION
|
|
71511
|
+
);
|
|
71512
|
+
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
71513
|
+
acc[hashDocument({ config: config4, document: rawString })] = rawString;
|
|
71514
|
+
}
|
|
71515
|
+
return acc;
|
|
71516
|
+
},
|
|
71517
|
+
{}
|
|
71518
|
+
);
|
|
71509
71519
|
if (Object.keys(queryMap).length === 0)
|
|
71510
71520
|
return;
|
|
71511
71521
|
await fs_exports.writeFile(config4.persistedQueryPath, JSON.stringify(queryMap, null, 4));
|
|
@@ -71574,32 +71584,32 @@ async function writeIndexFile2(config4, docs) {
|
|
|
71574
71584
|
const definitionsDir = relative2(config4.definitionsDirectory);
|
|
71575
71585
|
const cjs = config4.module === "commonjs";
|
|
71576
71586
|
let body = cjs ? cjsIndexFilePreamble : "";
|
|
71577
|
-
const
|
|
71578
|
-
const
|
|
71587
|
+
const exportStar = ({ module }) => "\n" + (cjs ? exportStarFrom(module) : `export * from "${module}"`) + "\n";
|
|
71588
|
+
const exportDefaultAs = ({ module, as }) => "\n" + (cjs ? exportDefaultFrom(module, as) : `export { default as ${as} } from "${module}"`) + "\n";
|
|
71579
71589
|
body += [
|
|
71580
|
-
|
|
71581
|
-
|
|
71582
|
-
|
|
71583
|
-
|
|
71590
|
+
exportStar({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
71591
|
+
exportStar({ module: runtimeDir }),
|
|
71592
|
+
exportStar({ module: artifactDir }),
|
|
71593
|
+
exportStar({ module: definitionsDir })
|
|
71584
71594
|
].join("");
|
|
71585
71595
|
for (const plugin2 of config4.plugins) {
|
|
71586
|
-
if (plugin2.
|
|
71587
|
-
body = plugin2.
|
|
71596
|
+
if (plugin2.indexFile) {
|
|
71597
|
+
body = plugin2.indexFile({
|
|
71588
71598
|
config: config4,
|
|
71589
71599
|
content: body,
|
|
71590
|
-
|
|
71591
|
-
|
|
71592
|
-
|
|
71600
|
+
exportDefaultAs,
|
|
71601
|
+
exportStarFrom: exportStar,
|
|
71602
|
+
pluginRoot: config4.pluginDirectory(plugin2.name),
|
|
71593
71603
|
typedef: false,
|
|
71594
71604
|
documents: docs
|
|
71595
71605
|
});
|
|
71596
71606
|
}
|
|
71597
|
-
if (plugin2.
|
|
71598
|
-
body +=
|
|
71607
|
+
if (plugin2.includeRuntime) {
|
|
71608
|
+
body += exportStar({
|
|
71599
71609
|
module: relative2(config4.pluginRuntimeDirectory(plugin2.name))
|
|
71600
71610
|
});
|
|
71601
71611
|
}
|
|
71602
|
-
if (!plugin2.
|
|
71612
|
+
if (!plugin2.indexFile) {
|
|
71603
71613
|
continue;
|
|
71604
71614
|
}
|
|
71605
71615
|
}
|
|
@@ -72647,10 +72657,10 @@ async function runPipeline2(config4, docs) {
|
|
|
72647
72657
|
deleted: []
|
|
72648
72658
|
};
|
|
72649
72659
|
const generatePlugins = config4.plugins.filter((plugin2) => plugin2.generate);
|
|
72650
|
-
const
|
|
72660
|
+
const afterValidate = config4.plugins.filter((plugin2) => plugin2.afterValidate).map((plugin2) => plugin2.afterValidate);
|
|
72651
72661
|
const validate2 = config4.plugins.filter((plugin2) => plugin2.validate).map((plugin2) => plugin2.validate);
|
|
72652
|
-
const
|
|
72653
|
-
const
|
|
72662
|
+
const beforeValidate = config4.plugins.filter((plugin2) => plugin2.beforeValidate).map((plugin2) => plugin2.beforeValidate);
|
|
72663
|
+
const beforeGenerate = config4.plugins.filter((plugin2) => plugin2.beforeGenerate).map((plugin2) => plugin2.beforeGenerate);
|
|
72654
72664
|
const wrapHook = (hooks) => hooks.map(
|
|
72655
72665
|
(fn) => (config5, docs2) => fn({
|
|
72656
72666
|
config: config5,
|
|
@@ -72663,20 +72673,20 @@ async function runPipeline2(config4, docs) {
|
|
|
72663
72673
|
config4,
|
|
72664
72674
|
[
|
|
72665
72675
|
graphqlExtensions,
|
|
72666
|
-
...wrapHook(
|
|
72676
|
+
...wrapHook(beforeValidate),
|
|
72667
72677
|
typeCheck,
|
|
72668
72678
|
uniqueDocumentNames,
|
|
72669
72679
|
noIDAlias,
|
|
72670
72680
|
validatePlugins,
|
|
72671
72681
|
...wrapHook(validate2),
|
|
72672
|
-
...wrapHook(
|
|
72682
|
+
...wrapHook(afterValidate),
|
|
72673
72683
|
addID,
|
|
72674
72684
|
addTypename,
|
|
72675
72685
|
addListFragments,
|
|
72676
72686
|
paginate,
|
|
72677
72687
|
fragmentVariables,
|
|
72678
72688
|
includeFragmentDefinitions,
|
|
72679
|
-
...wrapHook(
|
|
72689
|
+
...wrapHook(beforeGenerate),
|
|
72680
72690
|
artifactGenerator(artifactStats),
|
|
72681
72691
|
runtimeGenerator,
|
|
72682
72692
|
writeIndexFile2,
|
|
@@ -72687,14 +72697,13 @@ async function runPipeline2(config4, docs) {
|
|
|
72687
72697
|
(plugin2) => async (config5, docs2) => await plugin2.generate({
|
|
72688
72698
|
config: config5,
|
|
72689
72699
|
documents: docs2,
|
|
72690
|
-
|
|
72700
|
+
pluginRoot: config5.pluginDirectory(plugin2.name)
|
|
72691
72701
|
})
|
|
72692
72702
|
)
|
|
72693
72703
|
],
|
|
72694
72704
|
docs
|
|
72695
72705
|
);
|
|
72696
72706
|
} catch (e2) {
|
|
72697
|
-
console.log(e2);
|
|
72698
72707
|
error = e2;
|
|
72699
72708
|
}
|
|
72700
72709
|
const unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length - artifactStats.deleted.length;
|
|
@@ -72744,9 +72753,9 @@ async function collectDocuments(config4) {
|
|
|
72744
72753
|
".ts": []
|
|
72745
72754
|
};
|
|
72746
72755
|
for (const plugin2 of config4.plugins) {
|
|
72747
|
-
if (plugin2.extensions && plugin2.
|
|
72756
|
+
if (plugin2.extensions && plugin2.extractDocuments) {
|
|
72748
72757
|
for (const extension of plugin2.extensions) {
|
|
72749
|
-
extractors[extension] = [...extractors[extension] || [], plugin2.
|
|
72758
|
+
extractors[extension] = [...extractors[extension] || [], plugin2.extractDocuments];
|
|
72750
72759
|
}
|
|
72751
72760
|
}
|
|
72752
72761
|
}
|
|
@@ -72845,7 +72854,7 @@ async function processGraphQLDocument(config4, filepath, document) {
|
|
|
72845
72854
|
kind,
|
|
72846
72855
|
document: parsedDoc,
|
|
72847
72856
|
filename: filepath,
|
|
72848
|
-
|
|
72857
|
+
originalParsed: parsedDoc,
|
|
72849
72858
|
generateArtifact: true,
|
|
72850
72859
|
generateStore: true,
|
|
72851
72860
|
originalString: document,
|
|
@@ -72933,10 +72942,10 @@ function Plugin(opts = {}) {
|
|
|
72933
72942
|
filepath
|
|
72934
72943
|
};
|
|
72935
72944
|
for (const plugin2 of config3.plugins) {
|
|
72936
|
-
if (!plugin2.
|
|
72945
|
+
if (!plugin2.transformFile) {
|
|
72937
72946
|
continue;
|
|
72938
72947
|
}
|
|
72939
|
-
const { code: code2 } = await plugin2.
|
|
72948
|
+
const { code: code2 } = await plugin2.transformFile(ctx);
|
|
72940
72949
|
ctx.content = code2;
|
|
72941
72950
|
}
|
|
72942
72951
|
return { code: ctx.content };
|