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
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as graphql from 'graphql';
|
|
2
|
-
import type { Config,
|
|
3
|
-
export default function typeCheck(config: Config, docs:
|
|
2
|
+
import type { Config, Document } from '../../lib';
|
|
3
|
+
export default function typeCheck(config: Config, docs: Document[]): Promise<void>;
|
|
4
4
|
export declare function getAndVerifyNodeInterface(config: Config): graphql.GraphQLInterfaceType | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Config,
|
|
2
|
-
export default function uniqueDocumentNames(config: Config, docs:
|
|
1
|
+
import type { Config, Document } from '../../lib';
|
|
2
|
+
export default function uniqueDocumentNames(config: Config, docs: Document[]): Promise<void>;
|
|
@@ -55155,7 +55155,7 @@ async function fragmentVariables(config2, documents) {
|
|
|
55155
55155
|
name: "generated::fragmentVariables",
|
|
55156
55156
|
kind: "HoudiniFragment" /* Fragment */,
|
|
55157
55157
|
document: doc,
|
|
55158
|
-
|
|
55158
|
+
originalParsed: doc,
|
|
55159
55159
|
generateStore: false,
|
|
55160
55160
|
generateArtifact: false,
|
|
55161
55161
|
filename: "generated::fragmentVariables",
|
|
@@ -56078,7 +56078,7 @@ async function paginate(config2, documents) {
|
|
|
56078
56078
|
filename: doc.filename,
|
|
56079
56079
|
name: refetchQueryName,
|
|
56080
56080
|
document: queryDoc,
|
|
56081
|
-
|
|
56081
|
+
originalParsed: queryDoc,
|
|
56082
56082
|
generateArtifact: true,
|
|
56083
56083
|
generateStore: false,
|
|
56084
56084
|
refetch: doc.refetch,
|
|
@@ -56498,7 +56498,7 @@ async function addListFragments(config2, documents) {
|
|
|
56498
56498
|
generateArtifact: false,
|
|
56499
56499
|
generateStore: false,
|
|
56500
56500
|
document: generatedDoc,
|
|
56501
|
-
|
|
56501
|
+
originalParsed: generatedDoc,
|
|
56502
56502
|
filename: "generated::lists",
|
|
56503
56503
|
originalString: "",
|
|
56504
56504
|
artifact: null
|
|
@@ -57026,11 +57026,11 @@ function artifactGenerator(stats) {
|
|
|
57026
57026
|
};
|
|
57027
57027
|
const plugin_data = config2.plugins.reduce(
|
|
57028
57028
|
(prev, plugin2) => {
|
|
57029
|
-
if (!plugin2.
|
|
57029
|
+
if (!plugin2.artifactData) {
|
|
57030
57030
|
return prev;
|
|
57031
57031
|
}
|
|
57032
57032
|
const result = { ...prev };
|
|
57033
|
-
const dataToAdd = plugin2.
|
|
57033
|
+
const dataToAdd = plugin2.artifactData({ config: config2, document: doc }) ?? {};
|
|
57034
57034
|
if (Object.keys(dataToAdd).length > 0) {
|
|
57035
57035
|
result[plugin2.name] = dataToAdd;
|
|
57036
57036
|
}
|
|
@@ -57075,10 +57075,10 @@ function artifactGenerator(stats) {
|
|
|
57075
57075
|
}
|
|
57076
57076
|
doc.artifact = artifact;
|
|
57077
57077
|
for (const plugin2 of config2.plugins) {
|
|
57078
|
-
if (!plugin2.
|
|
57078
|
+
if (!plugin2.artifactEnd) {
|
|
57079
57079
|
continue;
|
|
57080
57080
|
}
|
|
57081
|
-
plugin2.
|
|
57081
|
+
plugin2.artifactEnd({ config: config2, document: doc });
|
|
57082
57082
|
}
|
|
57083
57083
|
const file = AST5.program([
|
|
57084
57084
|
moduleExport(config2, "default", serializeValue(artifact)),
|
|
@@ -57118,18 +57118,18 @@ async function generateGraphqlReturnTypes(config2, docs) {
|
|
|
57118
57118
|
const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
|
|
57119
57119
|
const fileContent = await fs_exports.readFile(indexPath) || "";
|
|
57120
57120
|
const contents = await parseJS(fileContent);
|
|
57121
|
-
const
|
|
57122
|
-
(plugin2) => plugin2.
|
|
57123
|
-
)?.
|
|
57124
|
-
if (!
|
|
57121
|
+
const graphqlTagReturn = config2.plugins.find(
|
|
57122
|
+
(plugin2) => plugin2.graphqlTagReturn
|
|
57123
|
+
)?.graphqlTagReturn;
|
|
57124
|
+
if (!graphqlTagReturn || !contents) {
|
|
57125
57125
|
return fileContent;
|
|
57126
57126
|
}
|
|
57127
57127
|
const overloaded_returns = {};
|
|
57128
57128
|
for (const doc of docs) {
|
|
57129
|
-
const return_value =
|
|
57129
|
+
const return_value = graphqlTagReturn({
|
|
57130
57130
|
config: config2,
|
|
57131
57131
|
document: doc,
|
|
57132
|
-
|
|
57132
|
+
ensureImport({ identifier, module: module2 }) {
|
|
57133
57133
|
ensureImports({
|
|
57134
57134
|
config: config2,
|
|
57135
57135
|
body: contents.script.body,
|
|
@@ -57177,18 +57177,18 @@ async function injectPlugins({
|
|
|
57177
57177
|
importStatement,
|
|
57178
57178
|
exportStatement
|
|
57179
57179
|
}) {
|
|
57180
|
-
const
|
|
57181
|
-
let plugins = plugin2.
|
|
57180
|
+
const clientPlugins = config2.plugins.filter((plugin2) => plugin2.clientPlugins).reduce((acc, plugin2) => {
|
|
57181
|
+
let plugins = plugin2.clientPlugins;
|
|
57182
57182
|
if (typeof plugins === "function") {
|
|
57183
57183
|
plugins = plugins(config2, config2.pluginConfig(plugin2.name));
|
|
57184
57184
|
}
|
|
57185
57185
|
return [...acc, ...Object.entries(plugins)];
|
|
57186
57186
|
}, []);
|
|
57187
|
-
return
|
|
57188
|
-
${
|
|
57187
|
+
return clientPlugins.length > 0 ? `
|
|
57188
|
+
${clientPlugins.map((plugin2, i) => importStatement(plugin2[0], `plugin${i}`))}
|
|
57189
57189
|
|
|
57190
57190
|
const plugins = [
|
|
57191
|
-
${
|
|
57191
|
+
${clientPlugins.map((plugin2, i) => {
|
|
57192
57192
|
const suffix = `(${JSON.stringify(plugin2[1])})`;
|
|
57193
57193
|
return `plugin${i}${suffix}`;
|
|
57194
57194
|
}).join(",\n")}
|
|
@@ -57232,18 +57232,18 @@ ${exportStatement("config")}
|
|
|
57232
57232
|
},
|
|
57233
57233
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
57234
57234
|
}),
|
|
57235
|
-
...config2.plugins.filter((plugin2) => plugin2.
|
|
57235
|
+
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map((plugin2) => generatePluginRuntime(config2, plugin2)),
|
|
57236
57236
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
57237
57237
|
]);
|
|
57238
57238
|
await generateGraphqlReturnTypes(config2, docs);
|
|
57239
57239
|
}
|
|
57240
57240
|
async function generatePluginRuntime(config2, plugin2) {
|
|
57241
|
-
if (houdini_mode.is_testing || !plugin2.
|
|
57241
|
+
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
57242
57242
|
return;
|
|
57243
57243
|
}
|
|
57244
57244
|
const runtime_path = path_exports.join(
|
|
57245
57245
|
path_exports.dirname(plugin2.filepath),
|
|
57246
|
-
typeof plugin2.
|
|
57246
|
+
typeof plugin2.includeRuntime === "string" ? plugin2.includeRuntime : plugin2.includeRuntime[config2.module]
|
|
57247
57247
|
);
|
|
57248
57248
|
try {
|
|
57249
57249
|
await fs_exports.stat(runtime_path);
|
|
@@ -57259,7 +57259,7 @@ async function generatePluginRuntime(config2, plugin2) {
|
|
|
57259
57259
|
runtime_path,
|
|
57260
57260
|
pluginDir,
|
|
57261
57261
|
Object.fromEntries(
|
|
57262
|
-
Object.entries(plugin2.
|
|
57262
|
+
Object.entries(plugin2.transformRuntime ?? {}).map(([key, value]) => [
|
|
57263
57263
|
path_exports.join(runtime_path, key),
|
|
57264
57264
|
(content) => value({ config: config2, content })
|
|
57265
57265
|
])
|
|
@@ -57653,7 +57653,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
57653
57653
|
const typePaths = [];
|
|
57654
57654
|
const fragmentDefinitions = {};
|
|
57655
57655
|
for (const document of docs) {
|
|
57656
|
-
for (const defn of document.
|
|
57656
|
+
for (const defn of document.originalParsed.definitions.filter(
|
|
57657
57657
|
({ kind }) => kind === "FragmentDefinition"
|
|
57658
57658
|
)) {
|
|
57659
57659
|
fragmentDefinitions[defn.name.value] = defn;
|
|
@@ -57661,47 +57661,54 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
57661
57661
|
}
|
|
57662
57662
|
const missingScalars = /* @__PURE__ */ new Set();
|
|
57663
57663
|
await Promise.all(
|
|
57664
|
-
docs.map(
|
|
57665
|
-
|
|
57666
|
-
|
|
57667
|
-
|
|
57668
|
-
|
|
57669
|
-
|
|
57670
|
-
|
|
57671
|
-
|
|
57672
|
-
|
|
57673
|
-
|
|
57674
|
-
|
|
57675
|
-
|
|
57676
|
-
|
|
57677
|
-
|
|
57678
|
-
|
|
57679
|
-
applyFragments: definition.kind === "OperationDefinition"
|
|
57680
|
-
});
|
|
57681
|
-
if (definition?.kind === "OperationDefinition") {
|
|
57682
|
-
await generateOperationTypeDefs(
|
|
57683
|
-
config2,
|
|
57684
|
-
filename,
|
|
57685
|
-
program.body,
|
|
57686
|
-
definition,
|
|
57687
|
-
selections,
|
|
57688
|
-
visitedTypes,
|
|
57689
|
-
missingScalars
|
|
57690
|
-
);
|
|
57691
|
-
} else {
|
|
57692
|
-
await generateFragmentTypeDefs(
|
|
57693
|
-
config2,
|
|
57694
|
-
filename,
|
|
57695
|
-
program.body,
|
|
57696
|
-
selections,
|
|
57697
|
-
originalDocument.definitions,
|
|
57698
|
-
visitedTypes,
|
|
57699
|
-
missingScalars
|
|
57664
|
+
docs.map(
|
|
57665
|
+
async ({
|
|
57666
|
+
originalParsed: originalDocument,
|
|
57667
|
+
name,
|
|
57668
|
+
filename,
|
|
57669
|
+
generateArtifact
|
|
57670
|
+
}) => {
|
|
57671
|
+
if (!generateArtifact) {
|
|
57672
|
+
return;
|
|
57673
|
+
}
|
|
57674
|
+
const typeDefPath = config2.artifactTypePath(originalDocument);
|
|
57675
|
+
const program = AST11.program([]);
|
|
57676
|
+
const visitedTypes = /* @__PURE__ */ new Set();
|
|
57677
|
+
let definition = originalDocument.definitions.find(
|
|
57678
|
+
(def) => (def.kind === "OperationDefinition" || def.kind === "FragmentDefinition") && def.name?.value === name
|
|
57700
57679
|
);
|
|
57680
|
+
const selections = flattenSelections({
|
|
57681
|
+
config: config2,
|
|
57682
|
+
filepath: filename,
|
|
57683
|
+
selections: definition.selectionSet.selections,
|
|
57684
|
+
fragmentDefinitions,
|
|
57685
|
+
applyFragments: definition.kind === "OperationDefinition"
|
|
57686
|
+
});
|
|
57687
|
+
if (definition?.kind === "OperationDefinition") {
|
|
57688
|
+
await generateOperationTypeDefs(
|
|
57689
|
+
config2,
|
|
57690
|
+
filename,
|
|
57691
|
+
program.body,
|
|
57692
|
+
definition,
|
|
57693
|
+
selections,
|
|
57694
|
+
visitedTypes,
|
|
57695
|
+
missingScalars
|
|
57696
|
+
);
|
|
57697
|
+
} else {
|
|
57698
|
+
await generateFragmentTypeDefs(
|
|
57699
|
+
config2,
|
|
57700
|
+
filename,
|
|
57701
|
+
program.body,
|
|
57702
|
+
selections,
|
|
57703
|
+
originalDocument.definitions,
|
|
57704
|
+
visitedTypes,
|
|
57705
|
+
missingScalars
|
|
57706
|
+
);
|
|
57707
|
+
}
|
|
57708
|
+
await fs_exports.writeFile(typeDefPath, recast11.print(program).code);
|
|
57709
|
+
typePaths.push(typeDefPath);
|
|
57701
57710
|
}
|
|
57702
|
-
|
|
57703
|
-
typePaths.push(typeDefPath);
|
|
57704
|
-
})
|
|
57711
|
+
)
|
|
57705
57712
|
);
|
|
57706
57713
|
const typeIndex = AST11.program(
|
|
57707
57714
|
typePaths.sort((a, b) => a.localeCompare(b)).map((typePath) => {
|
|
@@ -57716,28 +57723,28 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
57716
57723
|
AST11.exportAllDeclaration(AST11.literal("./graphql"), null)
|
|
57717
57724
|
])
|
|
57718
57725
|
);
|
|
57719
|
-
const
|
|
57726
|
+
const exportDefaultAs = ({ module: module2, as }) => `
|
|
57720
57727
|
export { default as ${as} } from "${module2}"
|
|
57721
57728
|
`;
|
|
57722
|
-
const
|
|
57729
|
+
const exportStarFrom2 = ({ module: module2 }) => `
|
|
57723
57730
|
export * from "${module2}"
|
|
57724
57731
|
`;
|
|
57725
57732
|
let indexContent = recast11.print(typeIndex).code;
|
|
57726
57733
|
for (const plugin2 of config2.plugins) {
|
|
57727
|
-
if (!plugin2.
|
|
57734
|
+
if (!plugin2.indexFile) {
|
|
57728
57735
|
continue;
|
|
57729
57736
|
}
|
|
57730
|
-
indexContent = plugin2.
|
|
57737
|
+
indexContent = plugin2.indexFile({
|
|
57731
57738
|
config: config2,
|
|
57732
57739
|
content: indexContent,
|
|
57733
|
-
|
|
57734
|
-
|
|
57735
|
-
|
|
57740
|
+
exportDefaultAs,
|
|
57741
|
+
exportStarFrom: exportStarFrom2,
|
|
57742
|
+
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
57736
57743
|
typedef: true,
|
|
57737
57744
|
documents: docs
|
|
57738
57745
|
});
|
|
57739
|
-
if (plugin2.
|
|
57740
|
-
indexContent +=
|
|
57746
|
+
if (plugin2.includeRuntime) {
|
|
57747
|
+
indexContent += exportStarFrom2({
|
|
57741
57748
|
module: "./" + path_exports.relative(config2.rootDir, config2.pluginRuntimeDirectory(plugin2.name))
|
|
57742
57749
|
});
|
|
57743
57750
|
}
|
|
@@ -57984,10 +57991,10 @@ var graphql17 = __toESM(require_graphql2(), 1);
|
|
|
57984
57991
|
var recast12 = __toESM(require_main2(), 1);
|
|
57985
57992
|
var AST12 = recast12.types.builders;
|
|
57986
57993
|
async function imperativeCacheTypef(config2, docs) {
|
|
57987
|
-
const returnType = (doc) => config2.plugins.find((plugin2) => plugin2.
|
|
57994
|
+
const returnType = (doc) => config2.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
|
|
57988
57995
|
config: config2,
|
|
57989
57996
|
document: doc,
|
|
57990
|
-
|
|
57997
|
+
ensureImport({ identifier, module: module2 }) {
|
|
57991
57998
|
ensureImports({
|
|
57992
57999
|
config: config2,
|
|
57993
58000
|
body,
|
|
@@ -58358,27 +58365,30 @@ async function persistOutputGenerator(config2, docs) {
|
|
|
58358
58365
|
console.log("Can only write the queryMap to a json file");
|
|
58359
58366
|
return;
|
|
58360
58367
|
}
|
|
58361
|
-
const queryMap = docs.reduce(
|
|
58362
|
-
|
|
58363
|
-
|
|
58364
|
-
|
|
58365
|
-
|
|
58366
|
-
graphql18.
|
|
58367
|
-
|
|
58368
|
-
|
|
58369
|
-
|
|
58368
|
+
const queryMap = docs.reduce(
|
|
58369
|
+
(acc, { document, generateArtifact }) => {
|
|
58370
|
+
if (!generateArtifact) {
|
|
58371
|
+
return acc;
|
|
58372
|
+
}
|
|
58373
|
+
let rawString = graphql18.print(
|
|
58374
|
+
graphql18.visit(document, {
|
|
58375
|
+
Directive(node) {
|
|
58376
|
+
if (config2.isInternalDirective(node.name.value)) {
|
|
58377
|
+
return null;
|
|
58378
|
+
}
|
|
58370
58379
|
}
|
|
58371
|
-
}
|
|
58372
|
-
|
|
58373
|
-
|
|
58374
|
-
|
|
58375
|
-
|
|
58376
|
-
|
|
58377
|
-
|
|
58378
|
-
|
|
58379
|
-
|
|
58380
|
-
|
|
58381
|
-
|
|
58380
|
+
})
|
|
58381
|
+
);
|
|
58382
|
+
const operations = document.definitions.filter(
|
|
58383
|
+
({ kind }) => kind === graphql18.Kind.OPERATION_DEFINITION
|
|
58384
|
+
);
|
|
58385
|
+
if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
|
|
58386
|
+
acc[hashDocument({ config: config2, document: rawString })] = rawString;
|
|
58387
|
+
}
|
|
58388
|
+
return acc;
|
|
58389
|
+
},
|
|
58390
|
+
{}
|
|
58391
|
+
);
|
|
58382
58392
|
if (Object.keys(queryMap).length === 0)
|
|
58383
58393
|
return;
|
|
58384
58394
|
await fs_exports.writeFile(config2.persistedQueryPath, JSON.stringify(queryMap, null, 4));
|
|
@@ -58447,32 +58457,32 @@ async function writeIndexFile2(config2, docs) {
|
|
|
58447
58457
|
const definitionsDir = relative2(config2.definitionsDirectory);
|
|
58448
58458
|
const cjs = config2.module === "commonjs";
|
|
58449
58459
|
let body = cjs ? cjsIndexFilePreamble : "";
|
|
58450
|
-
const
|
|
58451
|
-
const
|
|
58460
|
+
const exportStar = ({ module: module2 }) => "\n" + (cjs ? exportStarFrom(module2) : `export * from "${module2}"`) + "\n";
|
|
58461
|
+
const exportDefaultAs = ({ module: module2, as }) => "\n" + (cjs ? exportDefaultFrom(module2, as) : `export { default as ${as} } from "${module2}"`) + "\n";
|
|
58452
58462
|
body += [
|
|
58453
|
-
|
|
58454
|
-
|
|
58455
|
-
|
|
58456
|
-
|
|
58463
|
+
exportStar({ module: "./" + path_exports.join(runtimeDir, "client") }),
|
|
58464
|
+
exportStar({ module: runtimeDir }),
|
|
58465
|
+
exportStar({ module: artifactDir }),
|
|
58466
|
+
exportStar({ module: definitionsDir })
|
|
58457
58467
|
].join("");
|
|
58458
58468
|
for (const plugin2 of config2.plugins) {
|
|
58459
|
-
if (plugin2.
|
|
58460
|
-
body = plugin2.
|
|
58469
|
+
if (plugin2.indexFile) {
|
|
58470
|
+
body = plugin2.indexFile({
|
|
58461
58471
|
config: config2,
|
|
58462
58472
|
content: body,
|
|
58463
|
-
|
|
58464
|
-
|
|
58465
|
-
|
|
58473
|
+
exportDefaultAs,
|
|
58474
|
+
exportStarFrom: exportStar,
|
|
58475
|
+
pluginRoot: config2.pluginDirectory(plugin2.name),
|
|
58466
58476
|
typedef: false,
|
|
58467
58477
|
documents: docs
|
|
58468
58478
|
});
|
|
58469
58479
|
}
|
|
58470
|
-
if (plugin2.
|
|
58471
|
-
body +=
|
|
58480
|
+
if (plugin2.includeRuntime) {
|
|
58481
|
+
body += exportStar({
|
|
58472
58482
|
module: relative2(config2.pluginRuntimeDirectory(plugin2.name))
|
|
58473
58483
|
});
|
|
58474
58484
|
}
|
|
58475
|
-
if (!plugin2.
|
|
58485
|
+
if (!plugin2.indexFile) {
|
|
58476
58486
|
continue;
|
|
58477
58487
|
}
|
|
58478
58488
|
}
|
|
@@ -59520,10 +59530,10 @@ async function runPipeline2(config2, docs) {
|
|
|
59520
59530
|
deleted: []
|
|
59521
59531
|
};
|
|
59522
59532
|
const generatePlugins = config2.plugins.filter((plugin2) => plugin2.generate);
|
|
59523
|
-
const
|
|
59533
|
+
const afterValidate = config2.plugins.filter((plugin2) => plugin2.afterValidate).map((plugin2) => plugin2.afterValidate);
|
|
59524
59534
|
const validate2 = config2.plugins.filter((plugin2) => plugin2.validate).map((plugin2) => plugin2.validate);
|
|
59525
|
-
const
|
|
59526
|
-
const
|
|
59535
|
+
const beforeValidate = config2.plugins.filter((plugin2) => plugin2.beforeValidate).map((plugin2) => plugin2.beforeValidate);
|
|
59536
|
+
const beforeGenerate = config2.plugins.filter((plugin2) => plugin2.beforeGenerate).map((plugin2) => plugin2.beforeGenerate);
|
|
59527
59537
|
const wrapHook = (hooks) => hooks.map(
|
|
59528
59538
|
(fn) => (config3, docs2) => fn({
|
|
59529
59539
|
config: config3,
|
|
@@ -59536,20 +59546,20 @@ async function runPipeline2(config2, docs) {
|
|
|
59536
59546
|
config2,
|
|
59537
59547
|
[
|
|
59538
59548
|
graphqlExtensions,
|
|
59539
|
-
...wrapHook(
|
|
59549
|
+
...wrapHook(beforeValidate),
|
|
59540
59550
|
typeCheck,
|
|
59541
59551
|
uniqueDocumentNames,
|
|
59542
59552
|
noIDAlias,
|
|
59543
59553
|
validatePlugins,
|
|
59544
59554
|
...wrapHook(validate2),
|
|
59545
|
-
...wrapHook(
|
|
59555
|
+
...wrapHook(afterValidate),
|
|
59546
59556
|
addID,
|
|
59547
59557
|
addTypename,
|
|
59548
59558
|
addListFragments,
|
|
59549
59559
|
paginate,
|
|
59550
59560
|
fragmentVariables,
|
|
59551
59561
|
includeFragmentDefinitions,
|
|
59552
|
-
...wrapHook(
|
|
59562
|
+
...wrapHook(beforeGenerate),
|
|
59553
59563
|
artifactGenerator(artifactStats),
|
|
59554
59564
|
runtimeGenerator,
|
|
59555
59565
|
writeIndexFile2,
|
|
@@ -59560,14 +59570,13 @@ async function runPipeline2(config2, docs) {
|
|
|
59560
59570
|
(plugin2) => async (config3, docs2) => await plugin2.generate({
|
|
59561
59571
|
config: config3,
|
|
59562
59572
|
documents: docs2,
|
|
59563
|
-
|
|
59573
|
+
pluginRoot: config3.pluginDirectory(plugin2.name)
|
|
59564
59574
|
})
|
|
59565
59575
|
)
|
|
59566
59576
|
],
|
|
59567
59577
|
docs
|
|
59568
59578
|
);
|
|
59569
59579
|
} catch (e) {
|
|
59570
|
-
console.log(e);
|
|
59571
59580
|
error = e;
|
|
59572
59581
|
}
|
|
59573
59582
|
const unchanged = artifactStats.total.length - artifactStats.changed.length - artifactStats.new.length - artifactStats.deleted.length;
|
|
@@ -59617,9 +59626,9 @@ async function collectDocuments(config2) {
|
|
|
59617
59626
|
".ts": []
|
|
59618
59627
|
};
|
|
59619
59628
|
for (const plugin2 of config2.plugins) {
|
|
59620
|
-
if (plugin2.extensions && plugin2.
|
|
59629
|
+
if (plugin2.extensions && plugin2.extractDocuments) {
|
|
59621
59630
|
for (const extension of plugin2.extensions) {
|
|
59622
|
-
extractors[extension] = [...extractors[extension] || [], plugin2.
|
|
59631
|
+
extractors[extension] = [...extractors[extension] || [], plugin2.extractDocuments];
|
|
59623
59632
|
}
|
|
59624
59633
|
}
|
|
59625
59634
|
}
|
|
@@ -59718,7 +59727,7 @@ async function processGraphQLDocument(config2, filepath, document) {
|
|
|
59718
59727
|
kind,
|
|
59719
59728
|
document: parsedDoc,
|
|
59720
59729
|
filename: filepath,
|
|
59721
|
-
|
|
59730
|
+
originalParsed: parsedDoc,
|
|
59722
59731
|
generateArtifact: true,
|
|
59723
59732
|
generateStore: true,
|
|
59724
59733
|
originalString: document,
|