@powerlines/plugin-graphql 0.1.122 → 0.1.124
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-BgAdqTbb.d.mts +1 -0
- package/dist/index-CEgs-Dz2.d.cts +1 -0
- package/dist/index.cjs +111 -7
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -3
- package/dist/index.mjs +80 -2
- package/dist/plugin-B-JWUDie.d.mts +1792 -0
- package/dist/plugin-BTRNOsqk.d.cts +1792 -0
- package/dist/plugin-C3MaN5jp.mjs +1 -0
- package/dist/plugin-DHXHjv16.cjs +0 -0
- package/dist/types/index.cjs +2 -0
- package/dist/types/index.d.cts +2 -1
- package/dist/types/index.d.mts +2 -1
- package/dist/types/index.mjs +3 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +1 -40
- package/dist/types/plugin.d.mts +1 -40
- package/dist/types/plugin.mjs +2 -0
- package/dist/types-CTUnla4x.mjs +1 -0
- package/dist/types-DHkg7xmX.cjs +0 -0
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.cjs +0 -29
- package/dist/powerlines/src/plugin-utils/get-config-path.cjs +0 -49
- package/dist/powerlines/src/plugin-utils/get-config-path.mjs +0 -48
- package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
- package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
- package/dist/powerlines/src/types/babel.d.mts +0 -2
- package/dist/powerlines/src/types/build.d.cts +0 -145
- package/dist/powerlines/src/types/build.d.mts +0 -145
- package/dist/powerlines/src/types/commands.d.cts +0 -8
- package/dist/powerlines/src/types/commands.d.mts +0 -9
- package/dist/powerlines/src/types/config.d.cts +0 -369
- package/dist/powerlines/src/types/config.d.mts +0 -369
- package/dist/powerlines/src/types/context.d.cts +0 -403
- package/dist/powerlines/src/types/context.d.mts +0 -405
- package/dist/powerlines/src/types/fs.d.cts +0 -486
- package/dist/powerlines/src/types/fs.d.mts +0 -486
- package/dist/powerlines/src/types/hooks.d.mts +0 -2
- package/dist/powerlines/src/types/plugin.d.cts +0 -231
- package/dist/powerlines/src/types/plugin.d.mts +0 -231
- package/dist/powerlines/src/types/resolved.d.cts +0 -81
- package/dist/powerlines/src/types/resolved.d.mts +0 -81
- package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
- package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
//#region rolldown:runtime
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
require('./plugin-DHXHjv16.cjs');
|
|
30
|
+
require('./types-DHkg7xmX.cjs');
|
|
5
31
|
let __graphql_codegen_cli = require("@graphql-codegen/cli");
|
|
6
32
|
let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
7
33
|
let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
@@ -9,8 +35,86 @@ let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
|
9
35
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
10
36
|
let __stryke_path_replace = require("@stryke/path/replace");
|
|
11
37
|
let defu = require("defu");
|
|
12
|
-
defu =
|
|
38
|
+
defu = __toESM(defu);
|
|
39
|
+
let __stryke_path_join = require("@stryke/path/join");
|
|
40
|
+
let node_fs = require("node:fs");
|
|
41
|
+
|
|
42
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
43
|
+
/**
|
|
44
|
+
* Get the configuration file path for a given name.
|
|
45
|
+
*
|
|
46
|
+
* @param context - The Powerlines context.
|
|
47
|
+
* @param name - The name of the configuration file (without extension).
|
|
48
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
49
|
+
*/
|
|
50
|
+
function getConfigPath(context, name) {
|
|
51
|
+
if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
52
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
53
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
54
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
55
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
56
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
57
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
58
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
59
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
60
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
61
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
62
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
63
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
64
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
65
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
66
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
67
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
68
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
69
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
70
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
71
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
72
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
73
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
74
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
75
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
76
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
77
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
78
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
79
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
80
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
81
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
82
|
+
else if ((0, node_fs.existsSync)((0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return (0, __stryke_path_join.joinPaths)(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
87
|
+
/**
|
|
88
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* The following tokens are supported:
|
|
92
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
93
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
94
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
95
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
96
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
97
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
98
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
99
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
100
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
101
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
102
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
103
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
104
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
105
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
106
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
107
|
+
*
|
|
108
|
+
* @param context - The context containing the values for the path tokens.
|
|
109
|
+
* @param path - The path string with tokens to replace.
|
|
110
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
111
|
+
*/
|
|
112
|
+
function replacePathTokens(context, path) {
|
|
113
|
+
if (!path) return path;
|
|
114
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", (0, __stryke_path_replace.replacePath)(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", (0, __stryke_path_replace.replacePath)(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", (0, __stryke_path_replace.replacePath)(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
115
|
+
}
|
|
13
116
|
|
|
117
|
+
//#endregion
|
|
14
118
|
//#region src/index.ts
|
|
15
119
|
/**
|
|
16
120
|
* A Powerlines plugin to integrate GraphQL for code generation.
|
|
@@ -24,9 +128,9 @@ const plugin = (options = {}) => {
|
|
|
24
128
|
config() {
|
|
25
129
|
let configFile = options.configFile;
|
|
26
130
|
if (!configFile) {
|
|
27
|
-
configFile =
|
|
131
|
+
configFile = getConfigPath(this, "codegen");
|
|
28
132
|
if (!configFile) {
|
|
29
|
-
configFile =
|
|
133
|
+
configFile = getConfigPath(this, "graphql-codegen");
|
|
30
134
|
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.`);
|
|
31
135
|
}
|
|
32
136
|
}
|
|
@@ -40,7 +144,7 @@ const plugin = (options = {}) => {
|
|
|
40
144
|
},
|
|
41
145
|
async configResolved() {
|
|
42
146
|
this.dependencies.graphql = "latest";
|
|
43
|
-
this.config.graphql.outputPath =
|
|
147
|
+
this.config.graphql.outputPath = replacePathTokens(this, this.config.graphql.outputPath);
|
|
44
148
|
this.graphql ??= {};
|
|
45
149
|
this.graphql.codegen = await (0, __graphql_codegen_cli.loadContext)(this.config.graphql.configFile);
|
|
46
150
|
(0, __graphql_codegen_cli.updateContextWithCliFlags)(this.graphql.codegen, {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import
|
|
1
|
+
import { a as __ΩGraphQLPluginContext, c as __ΩGraphQLPluginUserConfig, i as GraphQLPluginUserConfig, l as Plugin, n as GraphQLPluginOptions, o as __ΩGraphQLPluginOptions, r as GraphQLPluginResolvedConfig, s as __ΩGraphQLPluginResolvedConfig, t as GraphQLPluginContext } from "./plugin-BTRNOsqk.cjs";
|
|
2
|
+
import "./index-CEgs-Dz2.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/index.d.ts
|
|
5
5
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Plugin } from "./
|
|
2
|
-
import
|
|
3
|
-
import "./types/index.mjs";
|
|
1
|
+
import { a as __ΩGraphQLPluginContext, c as __ΩGraphQLPluginUserConfig, i as GraphQLPluginUserConfig, l as Plugin, n as GraphQLPluginOptions, o as __ΩGraphQLPluginOptions, r as GraphQLPluginResolvedConfig, s as __ΩGraphQLPluginResolvedConfig, t as GraphQLPluginContext } from "./plugin-B-JWUDie.mjs";
|
|
2
|
+
import "./index-BgAdqTbb.mjs";
|
|
4
3
|
|
|
5
4
|
//#region src/index.d.ts
|
|
6
5
|
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import "./plugin-C3MaN5jp.mjs";
|
|
2
|
+
import "./types-CTUnla4x.mjs";
|
|
3
3
|
import { generate, loadContext, updateContextWithCliFlags } from "@graphql-codegen/cli";
|
|
4
4
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
5
5
|
import { findFileName } from "@stryke/path/file-path-fns";
|
|
@@ -7,7 +7,85 @@ import { isParentPath } from "@stryke/path/is-parent-path";
|
|
|
7
7
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
8
8
|
import { replacePath } from "@stryke/path/replace";
|
|
9
9
|
import defu from "defu";
|
|
10
|
+
import { joinPaths as joinPaths$1 } from "@stryke/path/join";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
10
12
|
|
|
13
|
+
//#region ../powerlines/src/plugin-utils/get-config-path.ts
|
|
14
|
+
/**
|
|
15
|
+
* Get the configuration file path for a given name.
|
|
16
|
+
*
|
|
17
|
+
* @param context - The Powerlines context.
|
|
18
|
+
* @param name - The name of the configuration file (without extension).
|
|
19
|
+
* @returns The absolute path to the configuration file, or undefined if not found.
|
|
20
|
+
*/
|
|
21
|
+
function getConfigPath(context, name) {
|
|
22
|
+
if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
|
|
23
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
|
|
24
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
|
|
25
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
|
|
26
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
|
|
27
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
|
|
28
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
|
|
29
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
|
|
30
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
|
|
31
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
|
|
32
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
|
|
33
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
|
|
34
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
|
|
35
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
|
|
36
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
|
|
37
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
|
|
38
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.yml`);
|
|
39
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
|
|
40
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.json`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.json`);
|
|
41
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
|
|
42
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.ts`);
|
|
43
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.cts`);
|
|
44
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.mts`);
|
|
45
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.js`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.js`);
|
|
46
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
|
|
47
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
|
|
48
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
|
|
49
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
|
|
50
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
|
|
51
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
|
|
52
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
|
|
53
|
+
else if (existsSync(joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return joinPaths$1(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region ../powerlines/src/plugin-utils/paths.ts
|
|
58
|
+
/**
|
|
59
|
+
* Replaces tokens in the given path string with their corresponding values from the context.
|
|
60
|
+
*
|
|
61
|
+
* @remarks
|
|
62
|
+
* The following tokens are supported:
|
|
63
|
+
* - `{workspaceRoot}` - The root directory of the workspace.
|
|
64
|
+
* - `{root}` - The root directory of the project (same as `{projectRoot}`).
|
|
65
|
+
* - `{projectRoot}` - The root directory of the project (same as `{root}`).
|
|
66
|
+
* - `{sourceRoot}` - The source root directory of the project (usually `./src`).
|
|
67
|
+
* - `{powerlinesPath}` - The directory where Powerlines is installed.
|
|
68
|
+
* - `{cachePath}` - The environment's directory for cached files.
|
|
69
|
+
* - `{dataPath}` - The environment's directory for data files.
|
|
70
|
+
* - `{logPath}` - The environment's directory for log files.
|
|
71
|
+
* - `{tempPath}` - The environment's directory for temporary files.
|
|
72
|
+
* - `{configPath}` - The environment's directory for configuration files.
|
|
73
|
+
* - `{outputPath}` - The configured output directory for the project.
|
|
74
|
+
* - `{buildPath}` - The configured distribution directory for the project.
|
|
75
|
+
* - `{artifactsPath}` - The configured directory for build artifacts.
|
|
76
|
+
* - `{builtinPath}` - The configured directory for generated built-in plugins.
|
|
77
|
+
* - `{entryPath}` - The configured directory for generated entry files.
|
|
78
|
+
*
|
|
79
|
+
* @param context - The context containing the values for the path tokens.
|
|
80
|
+
* @param path - The path string with tokens to replace.
|
|
81
|
+
* @returns The path string with tokens replaced by their corresponding values from the context.
|
|
82
|
+
*/
|
|
83
|
+
function replacePathTokens(context, path) {
|
|
84
|
+
if (!path) return path;
|
|
85
|
+
return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.projectRoot).replaceAll("{projectRoot}", context.config.projectRoot).replaceAll("{sourceRoot}", context.config.sourceRoot).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.outputPath).replaceAll("{buildPath}", context.config.output.buildPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
11
89
|
//#region src/index.ts
|
|
12
90
|
/**
|
|
13
91
|
* A Powerlines plugin to integrate GraphQL for code generation.
|