@powerlines/plugin-graphql 0.1.605 → 0.1.607

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/dist/index.cjs CHANGED
@@ -1,65 +1,77 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- let _graphql_codegen_cli = require("@graphql-codegen/cli");
4
- let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
5
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
6
- let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
3
+ let _power_plant_graphql_codegen = require("@power-plant/graphql-codegen");
4
+ _power_plant_graphql_codegen = require_runtime.__toESM(_power_plant_graphql_codegen, 1);
5
+ let _power_plant_graphql_schema_codegen = require("@power-plant/graphql-schema/codegen");
6
+ let _powerlines_plugin_power_plant = require("@powerlines/plugin-power-plant");
7
+ _powerlines_plugin_power_plant = require_runtime.__toESM(_powerlines_plugin_power_plant, 1);
8
+ let _stryke_fs_exists = require("@stryke/fs/exists");
7
9
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
8
- let _stryke_path_replace = require("@stryke/path/replace");
9
10
  let defu = require("defu");
10
11
  defu = require_runtime.__toESM(defu, 1);
12
+ let graphql = require("graphql");
11
13
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
12
14
 
13
15
  //#region src/index.ts
14
16
  /**
15
- * A Powerlines plugin to integrate GraphQL for code generation.
17
+ * A Powerlines plugin to integrate GraphQL Codegen via Power Plant.
18
+ *
19
+ * @see https://the-guild.dev/graphql/codegen
20
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/graphql-codegen
16
21
  *
17
22
  * @param options - The plugin options.
18
- * @returns A Powerlines plugin instance.
23
+ * @returns Powerlines plugin instances.
19
24
  */
20
25
  const plugin = (options = {}) => {
21
- return {
26
+ const generatorConfig = { ..._power_plant_graphql_codegen.default };
27
+ return [(0, _powerlines_plugin_power_plant.default)(generatorConfig), {
22
28
  name: "graphql",
23
29
  config() {
24
- let configFile = options.configFile;
25
- if (!configFile) {
26
- configFile = (0, powerlines_plugin_utils.getConfigPath)(this, "codegen");
27
- if (!configFile) {
28
- configFile = (0, powerlines_plugin_utils.getConfigPath)(this, "graphql-codegen");
29
- if (!configFile) throw new Error(`No GraphQL Codegen configuration file found. Please specify a valid config file path in the Biome plugin's \`configFile\` options.`);
30
- }
31
- }
32
30
  return { graphql: (0, defu.default)(options, {
33
- configFile,
34
- silent: this.config.logLevel === null,
35
- verbose: this.config.logLevel === _storm_software_config_tools_types.LogLevelLabel.DEBUG || this.config.logLevel === _storm_software_config_tools_types.LogLevelLabel.TRACE,
36
- debug: this.config.mode === "development",
37
- outputPath: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "graphql")
31
+ schema: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd ?? "./", this.config.root, "schema.graphql"),
32
+ filename: (0, _stryke_path_join_paths.joinPaths)("{builtinPath}", "graphql", "types.ts"),
33
+ documents: [],
34
+ config: {}
38
35
  }) };
39
36
  },
40
37
  async configResolved() {
41
38
  this.dependencies.graphql = "latest";
42
- this.config.graphql.outputPath = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.graphql.outputPath);
43
- this.graphql ??= {};
44
- this.graphql.codegen = await (0, _graphql_codegen_cli.loadContext)(this.config.graphql.configFile);
45
- (0, _graphql_codegen_cli.updateContextWithCliFlags)(this.graphql.codegen, {
46
- require: [],
47
- overwrite: true,
48
- project: this.config.root,
49
- ...this.config.graphql,
50
- config: this.config.graphql.configFile,
51
- watch: false
52
- });
53
- },
54
- async prepare() {
55
- const result = await (0, _graphql_codegen_cli.generate)({
56
- ...this.graphql.codegen,
57
- cwd: (0, _stryke_path_join_paths.joinPaths)(this.config.cwd, this.config.root)
58
- }, false);
59
- if ((0, _stryke_path_is_parent_path.isParentPath)(this.config.graphql.outputPath, this.builtinsPath)) await Promise.all(result.map(async (output) => this.emitBuiltin(output.content, (0, _stryke_path_file_path_fns.findFileName)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_replace.replacePath)(this.config.graphql.outputPath, this.builtinsPath), output.filename), { withExtension: false }))));
60
- else await Promise.all(result.map(async (output) => this.fs.write((0, _stryke_path_join_paths.joinPaths)(this.config.graphql.outputPath, output.filename), output.content)));
39
+ if (!this.config.graphql.schema) throw new Error("GraphQL schema is required. Please specify it in the plugin options or your Powerlines configuration under \"graphql.schema\".");
40
+ if (!this.config.graphql.plugins?.length) throw new Error("GraphQL Codegen plugins are required. Please specify them in the plugin options or your Powerlines configuration under \"graphql.plugins\".");
41
+ if (!this.config.graphql.pluginMap) throw new Error("GraphQL Codegen pluginMap is required. Please specify it in the plugin options or your Powerlines configuration under \"graphql.pluginMap\".");
42
+ let document;
43
+ if ((0, graphql.isSchema)(this.config.graphql.schema)) document = this.config.graphql.schema;
44
+ else {
45
+ const schemaRef = this.config.graphql.schema.toString();
46
+ if ((0, _stryke_fs_exists.existsSync)(schemaRef)) {
47
+ const sdl = await this.fs.read(schemaRef);
48
+ if (!sdl) throw new Error(`Failed to read GraphQL schema from file: ${schemaRef}`);
49
+ document = (0, graphql.buildSchema)(sdl);
50
+ } else {
51
+ const response = await this.fetch(schemaRef);
52
+ if (!response) throw new Error(`Failed to fetch GraphQL schema from endpoint: ${schemaRef}`);
53
+ document = (0, graphql.buildSchema)(await response.text());
54
+ }
55
+ }
56
+ this.config.graphql.filename = (0, powerlines_plugin_utils.replacePathTokens)(this, this.config.graphql.filename);
57
+ this.config.graphql.document = document;
58
+ const { schema: _schema, document: loadedDocument, filename, documents, plugins, pluginMap, config, ...rest } = this.config.graphql;
59
+ this.config.powerplant = {
60
+ ...generatorConfig,
61
+ input: loadedDocument
62
+ };
63
+ this.powerplant.options = {
64
+ ...rest,
65
+ filename,
66
+ documents: documents ?? [],
67
+ plugins,
68
+ pluginMap,
69
+ config: config ?? {},
70
+ schema: (0, _power_plant_graphql_schema_codegen.schemaToCodegenDocument)(loadedDocument),
71
+ schemaAst: loadedDocument
72
+ };
61
73
  }
62
- };
74
+ }];
63
75
  };
64
76
 
65
77
  //#endregion
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig } from "./types/plugin.cjs";
1
+ import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, PowerPlantGraphQLCodegenOptions } from "./types/plugin.cjs";
2
2
  import "./types/index.cjs";
3
3
  import { Plugin } from "powerlines";
4
4
  //#region src/index.d.ts
@@ -8,12 +8,15 @@ declare module "powerlines" {
8
8
  }
9
9
  }
10
10
  /**
11
- * A Powerlines plugin to integrate GraphQL for code generation.
11
+ * A Powerlines plugin to integrate GraphQL Codegen via Power Plant.
12
+ *
13
+ * @see https://the-guild.dev/graphql/codegen
14
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/graphql-codegen
12
15
  *
13
16
  * @param options - The plugin options.
14
- * @returns A Powerlines plugin instance.
17
+ * @returns Powerlines plugin instances.
15
18
  */
16
- declare const plugin: <TContext extends GraphQLPluginContext = GraphQLPluginContext>(options?: GraphQLPluginOptions) => Plugin<TContext>;
19
+ declare const plugin: <TContext extends GraphQLPluginContext = GraphQLPluginContext>(options?: GraphQLPluginOptions) => Plugin<TContext>[];
17
20
  //#endregion
18
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, plugin as default, plugin };
21
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions, plugin as default, plugin };
19
22
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;YAoCY;IACR,UAAU;;;;;;;;;cAUD,SACX,iBAAiB,uBAAuB,sBAExC,UAAS,yBACR,OAAO"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;YAsCY;IACR,UAAU;;;;;;;;;;;;cAaD,SACX,iBAAiB,uBAAuB,sBAExC,UAAS,yBACR,OAAO"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig } from "./types/plugin.mjs";
1
+ import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, PowerPlantGraphQLCodegenOptions } from "./types/plugin.mjs";
2
2
  import "./types/index.mjs";
3
3
  import { Plugin } from "powerlines";
4
4
  //#region src/index.d.ts
@@ -8,12 +8,15 @@ declare module "powerlines" {
8
8
  }
9
9
  }
10
10
  /**
11
- * A Powerlines plugin to integrate GraphQL for code generation.
11
+ * A Powerlines plugin to integrate GraphQL Codegen via Power Plant.
12
+ *
13
+ * @see https://the-guild.dev/graphql/codegen
14
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/graphql-codegen
12
15
  *
13
16
  * @param options - The plugin options.
14
- * @returns A Powerlines plugin instance.
17
+ * @returns Powerlines plugin instances.
15
18
  */
16
- declare const plugin: <TContext extends GraphQLPluginContext = GraphQLPluginContext>(options?: GraphQLPluginOptions) => Plugin<TContext>;
19
+ declare const plugin: <TContext extends GraphQLPluginContext = GraphQLPluginContext>(options?: GraphQLPluginOptions) => Plugin<TContext>[];
17
20
  //#endregion
18
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, plugin as default, plugin };
21
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions, plugin as default, plugin };
19
22
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,62 +1,72 @@
1
- import { generate, loadContext, updateContextWithCliFlags } from "@graphql-codegen/cli";
2
- import { LogLevelLabel } from "@storm-software/config-tools/types";
3
- import { findFileName } from "@stryke/path/file-path-fns";
4
- import { isParentPath } from "@stryke/path/is-parent-path";
1
+ import graphqlCodegenGenerator from "@power-plant/graphql-codegen";
2
+ import { schemaToCodegenDocument } from "@power-plant/graphql-schema/codegen";
3
+ import powerPlant from "@powerlines/plugin-power-plant";
4
+ import { existsSync } from "@stryke/fs/exists";
5
5
  import { joinPaths } from "@stryke/path/join-paths";
6
- import { replacePath } from "@stryke/path/replace";
7
6
  import defu from "defu";
8
- import { getConfigPath, replacePathTokens } from "powerlines/plugin-utils";
7
+ import { buildSchema, isSchema } from "graphql";
8
+ import { replacePathTokens } from "powerlines/plugin-utils";
9
9
 
10
10
  //#region src/index.ts
11
11
  /**
12
- * A Powerlines plugin to integrate GraphQL for code generation.
12
+ * A Powerlines plugin to integrate GraphQL Codegen via Power Plant.
13
+ *
14
+ * @see https://the-guild.dev/graphql/codegen
15
+ * @see https://github.com/storm-software/power-plant/tree/main/packages/generators/graphql-codegen
13
16
  *
14
17
  * @param options - The plugin options.
15
- * @returns A Powerlines plugin instance.
18
+ * @returns Powerlines plugin instances.
16
19
  */
17
20
  const plugin = (options = {}) => {
18
- return {
21
+ const generatorConfig = { ...graphqlCodegenGenerator };
22
+ return [powerPlant(generatorConfig), {
19
23
  name: "graphql",
20
24
  config() {
21
- let configFile = options.configFile;
22
- if (!configFile) {
23
- configFile = getConfigPath(this, "codegen");
24
- if (!configFile) {
25
- configFile = getConfigPath(this, "graphql-codegen");
26
- if (!configFile) throw new Error(`No GraphQL Codegen configuration file found. Please specify a valid config file path in the Biome plugin's \`configFile\` options.`);
27
- }
28
- }
29
25
  return { graphql: defu(options, {
30
- configFile,
31
- silent: this.config.logLevel === null,
32
- verbose: this.config.logLevel === LogLevelLabel.DEBUG || this.config.logLevel === LogLevelLabel.TRACE,
33
- debug: this.config.mode === "development",
34
- outputPath: joinPaths("{builtinPath}", "graphql")
26
+ schema: joinPaths(this.config.cwd ?? "./", this.config.root, "schema.graphql"),
27
+ filename: joinPaths("{builtinPath}", "graphql", "types.ts"),
28
+ documents: [],
29
+ config: {}
35
30
  }) };
36
31
  },
37
32
  async configResolved() {
38
33
  this.dependencies.graphql = "latest";
39
- this.config.graphql.outputPath = replacePathTokens(this, this.config.graphql.outputPath);
40
- this.graphql ??= {};
41
- this.graphql.codegen = await loadContext(this.config.graphql.configFile);
42
- updateContextWithCliFlags(this.graphql.codegen, {
43
- require: [],
44
- overwrite: true,
45
- project: this.config.root,
46
- ...this.config.graphql,
47
- config: this.config.graphql.configFile,
48
- watch: false
49
- });
50
- },
51
- async prepare() {
52
- const result = await generate({
53
- ...this.graphql.codegen,
54
- cwd: joinPaths(this.config.cwd, this.config.root)
55
- }, false);
56
- if (isParentPath(this.config.graphql.outputPath, this.builtinsPath)) await Promise.all(result.map(async (output) => this.emitBuiltin(output.content, findFileName(joinPaths(replacePath(this.config.graphql.outputPath, this.builtinsPath), output.filename), { withExtension: false }))));
57
- else await Promise.all(result.map(async (output) => this.fs.write(joinPaths(this.config.graphql.outputPath, output.filename), output.content)));
34
+ if (!this.config.graphql.schema) throw new Error("GraphQL schema is required. Please specify it in the plugin options or your Powerlines configuration under \"graphql.schema\".");
35
+ if (!this.config.graphql.plugins?.length) throw new Error("GraphQL Codegen plugins are required. Please specify them in the plugin options or your Powerlines configuration under \"graphql.plugins\".");
36
+ if (!this.config.graphql.pluginMap) throw new Error("GraphQL Codegen pluginMap is required. Please specify it in the plugin options or your Powerlines configuration under \"graphql.pluginMap\".");
37
+ let document;
38
+ if (isSchema(this.config.graphql.schema)) document = this.config.graphql.schema;
39
+ else {
40
+ const schemaRef = this.config.graphql.schema.toString();
41
+ if (existsSync(schemaRef)) {
42
+ const sdl = await this.fs.read(schemaRef);
43
+ if (!sdl) throw new Error(`Failed to read GraphQL schema from file: ${schemaRef}`);
44
+ document = buildSchema(sdl);
45
+ } else {
46
+ const response = await this.fetch(schemaRef);
47
+ if (!response) throw new Error(`Failed to fetch GraphQL schema from endpoint: ${schemaRef}`);
48
+ document = buildSchema(await response.text());
49
+ }
50
+ }
51
+ this.config.graphql.filename = replacePathTokens(this, this.config.graphql.filename);
52
+ this.config.graphql.document = document;
53
+ const { schema: _schema, document: loadedDocument, filename, documents, plugins, pluginMap, config, ...rest } = this.config.graphql;
54
+ this.config.powerplant = {
55
+ ...generatorConfig,
56
+ input: loadedDocument
57
+ };
58
+ this.powerplant.options = {
59
+ ...rest,
60
+ filename,
61
+ documents: documents ?? [],
62
+ plugins,
63
+ pluginMap,
64
+ config: config ?? {},
65
+ schema: schemaToCodegenDocument(loadedDocument),
66
+ schemaAst: loadedDocument
67
+ };
58
68
  }
59
- };
69
+ }];
60
70
  };
61
71
 
62
72
  //#endregion
@@ -1,2 +1,2 @@
1
- import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig } from "./plugin.cjs";
2
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig };
1
+ import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, PowerPlantGraphQLCodegenOptions } from "./plugin.cjs";
2
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions };
@@ -1,2 +1,2 @@
1
- import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig } from "./plugin.mjs";
2
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig };
1
+ import { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, PowerPlantGraphQLCodegenOptions } from "./plugin.mjs";
2
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions };
@@ -1,35 +1,34 @@
1
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
2
- import { CodegenContext, YamlCliFlags } from "@graphql-codegen/cli";
1
+ import { ResolvedConfig, UserConfig } from "powerlines";
2
+ import { Options, Options as PowerPlantGraphQLCodegenOptions } from "@power-plant/graphql-codegen";
3
+ import { PowerPlantPluginContext, PowerPlantPluginResolvedConfig } from "@powerlines/plugin-power-plant/types/plugin";
4
+ import { GraphQLSchema } from "graphql";
3
5
  //#region src/types/plugin.d.ts
4
- type GraphQLPluginOptions = Partial<Omit<YamlCliFlags, "config" | "watch">> & {
6
+ /**
7
+ * Options for the GraphQL Powerlines plugin.
8
+ */
9
+ type GraphQLPluginOptions = Partial<Omit<Options, "schema" | "schemaAst">> & {
5
10
  /**
6
- * The path to a custom GraphQL Codegen configuration file.
11
+ * The GraphQL schema to generate from.
7
12
  *
8
13
  * @remarks
9
- * If not provided, the plugin will attempt to locate a configuration file by searching for one of the following filenames in the project root (in order): "codegen.yml", "codegen.yaml", "codegen.json", "codegen.js", "codegen.cjs".
10
- */
11
- configFile?: string;
12
- /**
13
- * The path to the output file generated by the plugin.
14
+ * This can be a {@link GraphQLSchema} instance, a local file path, a remote URL
15
+ * string, or a {@link URL} object.
14
16
  *
15
- * @remarks
16
- * If using the default value, the file can be imported from "powerlines:graphql/schema-name". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
17
- *
18
- * @defaultValue "\{builtinsPath\}/graphql"
17
+ * @defaultValue "\{projectRoot\}/schema.graphql"
19
18
  */
20
- outputPath?: string;
19
+ schema?: string | URL | GraphQLSchema;
21
20
  };
22
21
  type GraphQLPluginUserConfig = UserConfig & {
23
- graphql?: Omit<YamlCliFlags, "config" | "watch" | "project" | "overwrite" | "require"> & Omit<GraphQLPluginOptions, "outputPath" | "configFile"> & Required<Pick<GraphQLPluginOptions, "outputPath" | "configFile">>;
24
- };
25
- type GraphQLPluginResolvedConfig = ResolvedConfig & {
26
- graphql: Omit<YamlCliFlags, "config" | "watch" | "project" | "overwrite" | "require"> & Omit<GraphQLPluginOptions, "outputPath" | "configFile"> & Required<Pick<GraphQLPluginOptions, "outputPath" | "configFile">>;
22
+ graphql?: GraphQLPluginOptions;
27
23
  };
28
- type GraphQLPluginContext<TResolvedConfig extends GraphQLPluginResolvedConfig = GraphQLPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
29
- graphql: {
30
- codegen: CodegenContext;
24
+ type GraphQLPluginResolvedConfig = ResolvedConfig & PowerPlantPluginResolvedConfig<GraphQLSchema, Options> & {
25
+ graphql: Omit<GraphQLPluginOptions, "schema" | "filename"> & {
26
+ schema: string | URL | GraphQLSchema;
27
+ filename: string;
28
+ document: GraphQLSchema;
31
29
  };
32
30
  };
31
+ type GraphQLPluginContext<TResolvedConfig extends GraphQLPluginResolvedConfig = GraphQLPluginResolvedConfig> = PowerPlantPluginContext<GraphQLSchema, Options, TResolvedConfig>;
33
32
  //#endregion
34
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig };
33
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions };
35
34
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;KAqBY,uBAAuB,QACjC,KAAK;;;;;;;EAQL;;;;;;;;;EAUA;;KAGU,0BAA0B;EACpC,UAAU,KACR,0EAGA,KAAK,qDACL,SAAS,KAAK;;KAGN,8BAA8B;EACxC,SAAS,KACP,0EAGA,KAAK,qDACL,SAAS,KAAK;;KAGN,qBACV,wBAAwB,8BACtB,+BACA,cAAc;EAChB;IACE,SAAS"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;KA+BY,uBAAuB,QACjC,KAAK;;;;;;;;;;EAWL,kBAAkB,MAAM;;KAGd,0BAA0B;EACpC,UAAU;;KAGA,8BAA8B,iBACxC,+BACE,eACA;EAEA,SAAS,KAAK;IACZ,iBAAiB,MAAM;IACvB;IACA,UAAU;;;KAIJ,qBACV,wBAAwB,8BACtB,+BACA,wBACF,eACA,SACA"}
@@ -1,35 +1,34 @@
1
- import { CodegenContext, YamlCliFlags } from "@graphql-codegen/cli";
2
- import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
1
+ import { Options, Options as PowerPlantGraphQLCodegenOptions } from "@power-plant/graphql-codegen";
2
+ import { GraphQLSchema } from "graphql";
3
+ import { ResolvedConfig, UserConfig } from "powerlines";
4
+ import { PowerPlantPluginContext, PowerPlantPluginResolvedConfig } from "@powerlines/plugin-power-plant/types/plugin";
3
5
  //#region src/types/plugin.d.ts
4
- type GraphQLPluginOptions = Partial<Omit<YamlCliFlags, "config" | "watch">> & {
6
+ /**
7
+ * Options for the GraphQL Powerlines plugin.
8
+ */
9
+ type GraphQLPluginOptions = Partial<Omit<Options, "schema" | "schemaAst">> & {
5
10
  /**
6
- * The path to a custom GraphQL Codegen configuration file.
11
+ * The GraphQL schema to generate from.
7
12
  *
8
13
  * @remarks
9
- * If not provided, the plugin will attempt to locate a configuration file by searching for one of the following filenames in the project root (in order): "codegen.yml", "codegen.yaml", "codegen.json", "codegen.js", "codegen.cjs".
10
- */
11
- configFile?: string;
12
- /**
13
- * The path to the output file generated by the plugin.
14
+ * This can be a {@link GraphQLSchema} instance, a local file path, a remote URL
15
+ * string, or a {@link URL} object.
14
16
  *
15
- * @remarks
16
- * If using the default value, the file can be imported from "powerlines:graphql/schema-name". This field allows the use of the "\{builtinsPath\}" token to refer to the built-in Powerlines plugins directory - the value will be replaced with the correct file path by the plugin.
17
- *
18
- * @defaultValue "\{builtinsPath\}/graphql"
17
+ * @defaultValue "\{projectRoot\}/schema.graphql"
19
18
  */
20
- outputPath?: string;
19
+ schema?: string | URL | GraphQLSchema;
21
20
  };
22
21
  type GraphQLPluginUserConfig = UserConfig & {
23
- graphql?: Omit<YamlCliFlags, "config" | "watch" | "project" | "overwrite" | "require"> & Omit<GraphQLPluginOptions, "outputPath" | "configFile"> & Required<Pick<GraphQLPluginOptions, "outputPath" | "configFile">>;
24
- };
25
- type GraphQLPluginResolvedConfig = ResolvedConfig & {
26
- graphql: Omit<YamlCliFlags, "config" | "watch" | "project" | "overwrite" | "require"> & Omit<GraphQLPluginOptions, "outputPath" | "configFile"> & Required<Pick<GraphQLPluginOptions, "outputPath" | "configFile">>;
22
+ graphql?: GraphQLPluginOptions;
27
23
  };
28
- type GraphQLPluginContext<TResolvedConfig extends GraphQLPluginResolvedConfig = GraphQLPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
29
- graphql: {
30
- codegen: CodegenContext;
24
+ type GraphQLPluginResolvedConfig = ResolvedConfig & PowerPlantPluginResolvedConfig<GraphQLSchema, Options> & {
25
+ graphql: Omit<GraphQLPluginOptions, "schema" | "filename"> & {
26
+ schema: string | URL | GraphQLSchema;
27
+ filename: string;
28
+ document: GraphQLSchema;
31
29
  };
32
30
  };
31
+ type GraphQLPluginContext<TResolvedConfig extends GraphQLPluginResolvedConfig = GraphQLPluginResolvedConfig> = PowerPlantPluginContext<GraphQLSchema, Options, TResolvedConfig>;
33
32
  //#endregion
34
- export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig };
33
+ export { GraphQLPluginContext, GraphQLPluginOptions, GraphQLPluginResolvedConfig, GraphQLPluginUserConfig, type PowerPlantGraphQLCodegenOptions };
35
34
  //# sourceMappingURL=plugin.d.mts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-graphql",
3
- "version": "0.1.605",
3
+ "version": "0.1.607",
4
4
  "private": false,
5
5
  "description": "A Powerlines plugin to generate project code from GraphQL schemas.",
6
6
  "keywords": ["graphql", "powerlines", "storm-software", "powerlines-plugin"],
@@ -90,20 +90,20 @@
90
90
  "typings": "dist/index.d.mts",
91
91
  "files": ["dist/**/*"],
92
92
  "dependencies": {
93
- "@graphql-codegen/cli": "^6.3.1",
94
- "@storm-software/config-tools": "^1.190.92",
95
- "@stryke/path": "^0.29.22",
96
- "@stryke/type-checks": "^0.6.28",
97
- "@stryke/types": "^0.12.23",
93
+ "@power-plant/core": "^0.0.23",
94
+ "@power-plant/graphql-codegen": "^0.0.19",
95
+ "@power-plant/graphql-schema": "^0.0.1",
96
+ "@powerlines/plugin-power-plant": "^0.1.1",
97
+ "@stryke/fs": "^0.33.97",
98
+ "@stryke/path": "^0.29.23",
98
99
  "defu": "^6.1.7",
99
- "jiti": "^2.7.0",
100
- "powerlines": "^0.47.143"
100
+ "graphql": "^17.0.2",
101
+ "powerlines": "^0.47.145"
101
102
  },
102
103
  "devDependencies": {
103
- "@graphql-codegen/plugin-helpers": "^6.3.0",
104
- "@powerlines/plugin-plugin": "^0.12.555",
104
+ "@powerlines/plugin-plugin": "^0.12.557",
105
105
  "@types/node": "^25.9.5"
106
106
  },
107
107
  "publishConfig": { "access": "public" },
108
- "gitHead": "cea2b02d3fb6556ff2e53576b6a17787b4e28d67"
108
+ "gitHead": "d81170b608c0b80e7726e129c3edd1b7b6ca2605"
109
109
  }