@powerlines/plugin-graphql 0.1.118 → 0.1.120

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.
@@ -1 +1,29 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
1
+ //#region rolldown:runtime
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) {
13
+ __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ }
19
+ }
20
+ return to;
21
+ };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
+ value: mod,
24
+ enumerable: true
25
+ }) : target, mod));
26
+
27
+ //#endregion
28
+
29
+ exports.__toESM = __toESM;
package/dist/index.cjs CHANGED
@@ -1 +1,69 @@
1
- Object.defineProperty(exports,`__esModule`,{value:!0});const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./powerlines/src/plugin-utils/get-config-path.cjs`),n=require(`./powerlines/src/plugin-utils/paths.cjs`);let r=require(`@graphql-codegen/cli`),i=require(`@storm-software/config-tools/types`),a=require(`@stryke/path/file-path-fns`),o=require(`@stryke/path/is-parent-path`),s=require(`@stryke/path/join-paths`),c=require(`@stryke/path/replace`),l=require(`defu`);l=e.__toESM(l);const u=(e={})=>({name:`graphql`,config(){let n=e.configFile;if(!n&&(n=t.getConfigPath(this,`codegen`),!n&&(n=t.getConfigPath(this,`graphql-codegen`),!n)))throw Error("No GraphQL Codegen configuration file found. Please specify a valid config file path in the Biome plugin's `configFile` options.");return{graphql:(0,l.default)(e,{configFile:n,silent:this.config.logLevel===null,verbose:this.config.logLevel===i.LogLevelLabel.DEBUG||this.config.logLevel===i.LogLevelLabel.TRACE,debug:this.config.mode===`development`,outputPath:(0,s.joinPaths)(`{builtinPath}`,`graphql`)})}},async configResolved(){this.dependencies.graphql=`latest`,this.config.graphql.outputPath=n.replacePathTokens(this,this.config.graphql.outputPath),this.graphql??={},this.graphql.codegen=await(0,r.loadContext)(this.config.graphql.configFile),(0,r.updateContextWithCliFlags)(this.graphql.codegen,{require:[],overwrite:!0,project:this.config.projectRoot,...this.config.graphql,config:this.config.graphql.configFile,watch:!1})},async prepare(){let e=await(0,r.generate)({...this.graphql.codegen,cwd:(0,s.joinPaths)(this.workspaceConfig.workspaceRoot,this.config.projectRoot)},!1);(0,o.isParentPath)(this.config.graphql.outputPath,this.builtinsPath)?await Promise.all(e.map(async e=>this.emitBuiltin(e.content,(0,a.findFileName)((0,s.joinPaths)((0,c.replacePath)(this.config.graphql.outputPath,this.builtinsPath),e.filename),{withExtension:!1}),(0,s.joinPaths)(this.config.graphql.outputPath,e.filename)))):await Promise.all(e.map(async e=>this.fs.write((0,s.joinPaths)(this.config.graphql.outputPath,e.filename),e.content)))}});var d=u;exports.default=d,exports.plugin=u;
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_get_config_path = require('./powerlines/src/plugin-utils/get-config-path.cjs');
4
+ const require_paths = require('./powerlines/src/plugin-utils/paths.cjs');
5
+ let __graphql_codegen_cli = require("@graphql-codegen/cli");
6
+ let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
7
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
8
+ let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
9
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
10
+ let __stryke_path_replace = require("@stryke/path/replace");
11
+ let defu = require("defu");
12
+ defu = require_rolldown_runtime.__toESM(defu);
13
+
14
+ //#region src/index.ts
15
+ /**
16
+ * A Powerlines plugin to integrate GraphQL for code generation.
17
+ *
18
+ * @param options - The plugin options.
19
+ * @returns A Powerlines plugin instance.
20
+ */
21
+ const plugin = (options = {}) => {
22
+ return {
23
+ name: "graphql",
24
+ config() {
25
+ let configFile = options.configFile;
26
+ if (!configFile) {
27
+ configFile = require_get_config_path.getConfigPath(this, "codegen");
28
+ if (!configFile) {
29
+ configFile = require_get_config_path.getConfigPath(this, "graphql-codegen");
30
+ 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
+ }
32
+ }
33
+ return { graphql: (0, defu.default)(options, {
34
+ configFile,
35
+ silent: this.config.logLevel === null,
36
+ verbose: this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.DEBUG || this.config.logLevel === __storm_software_config_tools_types.LogLevelLabel.TRACE,
37
+ debug: this.config.mode === "development",
38
+ outputPath: (0, __stryke_path_join_paths.joinPaths)("{builtinPath}", "graphql")
39
+ }) };
40
+ },
41
+ async configResolved() {
42
+ this.dependencies.graphql = "latest";
43
+ this.config.graphql.outputPath = require_paths.replacePathTokens(this, this.config.graphql.outputPath);
44
+ this.graphql ??= {};
45
+ this.graphql.codegen = await (0, __graphql_codegen_cli.loadContext)(this.config.graphql.configFile);
46
+ (0, __graphql_codegen_cli.updateContextWithCliFlags)(this.graphql.codegen, {
47
+ require: [],
48
+ overwrite: true,
49
+ project: this.config.projectRoot,
50
+ ...this.config.graphql,
51
+ config: this.config.graphql.configFile,
52
+ watch: false
53
+ });
54
+ },
55
+ async prepare() {
56
+ const result = await (0, __graphql_codegen_cli.generate)({
57
+ ...this.graphql.codegen,
58
+ cwd: (0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot)
59
+ }, false);
60
+ 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 }), (0, __stryke_path_join_paths.joinPaths)(this.config.graphql.outputPath, output.filename))));
61
+ 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)));
62
+ }
63
+ };
64
+ };
65
+ var src_default = plugin;
66
+
67
+ //#endregion
68
+ exports.default = src_default;
69
+ exports.plugin = plugin;
package/dist/index.mjs CHANGED
@@ -1 +1,65 @@
1
- import{getConfigPath as e}from"./powerlines/src/plugin-utils/get-config-path.mjs";import{replacePathTokens as t}from"./powerlines/src/plugin-utils/paths.mjs";import{generate as n,loadContext as r,updateContextWithCliFlags as i}from"@graphql-codegen/cli";import{LogLevelLabel as a}from"@storm-software/config-tools/types";import{findFileName as o}from"@stryke/path/file-path-fns";import{isParentPath as s}from"@stryke/path/is-parent-path";import{joinPaths as c}from"@stryke/path/join-paths";import{replacePath as l}from"@stryke/path/replace";import u from"defu";const d=(d={})=>({name:`graphql`,config(){let t=d.configFile;if(!t&&(t=e(this,`codegen`),!t&&(t=e(this,`graphql-codegen`),!t)))throw Error("No GraphQL Codegen configuration file found. Please specify a valid config file path in the Biome plugin's `configFile` options.");return{graphql:u(d,{configFile:t,silent:this.config.logLevel===null,verbose:this.config.logLevel===a.DEBUG||this.config.logLevel===a.TRACE,debug:this.config.mode===`development`,outputPath:c(`{builtinPath}`,`graphql`)})}},async configResolved(){this.dependencies.graphql=`latest`,this.config.graphql.outputPath=t(this,this.config.graphql.outputPath),this.graphql??={},this.graphql.codegen=await r(this.config.graphql.configFile),i(this.graphql.codegen,{require:[],overwrite:!0,project:this.config.projectRoot,...this.config.graphql,config:this.config.graphql.configFile,watch:!1})},async prepare(){let e=await n({...this.graphql.codegen,cwd:c(this.workspaceConfig.workspaceRoot,this.config.projectRoot)},!1);s(this.config.graphql.outputPath,this.builtinsPath)?await Promise.all(e.map(async e=>this.emitBuiltin(e.content,o(c(l(this.config.graphql.outputPath,this.builtinsPath),e.filename),{withExtension:!1}),c(this.config.graphql.outputPath,e.filename)))):await Promise.all(e.map(async e=>this.fs.write(c(this.config.graphql.outputPath,e.filename),e.content)))}});var f=d;export{f as default,d as plugin};
1
+ import { getConfigPath } from "./powerlines/src/plugin-utils/get-config-path.mjs";
2
+ import { replacePathTokens } from "./powerlines/src/plugin-utils/paths.mjs";
3
+ import { generate, loadContext, updateContextWithCliFlags } from "@graphql-codegen/cli";
4
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
5
+ import { findFileName } from "@stryke/path/file-path-fns";
6
+ import { isParentPath } from "@stryke/path/is-parent-path";
7
+ import { joinPaths } from "@stryke/path/join-paths";
8
+ import { replacePath } from "@stryke/path/replace";
9
+ import defu from "defu";
10
+
11
+ //#region src/index.ts
12
+ /**
13
+ * A Powerlines plugin to integrate GraphQL for code generation.
14
+ *
15
+ * @param options - The plugin options.
16
+ * @returns A Powerlines plugin instance.
17
+ */
18
+ const plugin = (options = {}) => {
19
+ return {
20
+ name: "graphql",
21
+ config() {
22
+ let configFile = options.configFile;
23
+ if (!configFile) {
24
+ configFile = getConfigPath(this, "codegen");
25
+ if (!configFile) {
26
+ configFile = getConfigPath(this, "graphql-codegen");
27
+ 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.`);
28
+ }
29
+ }
30
+ return { graphql: defu(options, {
31
+ configFile,
32
+ silent: this.config.logLevel === null,
33
+ verbose: this.config.logLevel === LogLevelLabel.DEBUG || this.config.logLevel === LogLevelLabel.TRACE,
34
+ debug: this.config.mode === "development",
35
+ outputPath: joinPaths("{builtinPath}", "graphql")
36
+ }) };
37
+ },
38
+ async configResolved() {
39
+ this.dependencies.graphql = "latest";
40
+ this.config.graphql.outputPath = replacePathTokens(this, this.config.graphql.outputPath);
41
+ this.graphql ??= {};
42
+ this.graphql.codegen = await loadContext(this.config.graphql.configFile);
43
+ updateContextWithCliFlags(this.graphql.codegen, {
44
+ require: [],
45
+ overwrite: true,
46
+ project: this.config.projectRoot,
47
+ ...this.config.graphql,
48
+ config: this.config.graphql.configFile,
49
+ watch: false
50
+ });
51
+ },
52
+ async prepare() {
53
+ const result = await generate({
54
+ ...this.graphql.codegen,
55
+ cwd: joinPaths(this.workspaceConfig.workspaceRoot, this.config.projectRoot)
56
+ }, false);
57
+ 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 }), joinPaths(this.config.graphql.outputPath, output.filename))));
58
+ else await Promise.all(result.map(async (output) => this.fs.write(joinPaths(this.config.graphql.outputPath, output.filename), output.content)));
59
+ }
60
+ };
61
+ };
62
+ var src_default = plugin;
63
+
64
+ //#endregion
65
+ export { src_default as default, plugin };
@@ -1 +1,49 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/join`),n=require(`node:fs`);function r(e,r){if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.yml`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.yml`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.yaml`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.yaml`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.json`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.json`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.jsonc`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.jsonc`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.ts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.ts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.cts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.cts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.mts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.mts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.js`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.js`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.cjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.cjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.mjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.mjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.ts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.ts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.cts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.cts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.mts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.mts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.js`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.js`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.cjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.cjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.mjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,e.config.projectRoot,`${r}.config.mjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.yml`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.yml`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.yaml`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.yaml`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.json`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.json`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.jsonc`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.jsonc`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.ts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.ts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.cts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.cts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.mts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.mts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.js`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.js`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.cjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.cjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.mjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.mjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.ts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.ts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.cts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.cts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.mts`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.mts`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.js`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.js`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.cjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.cjs`);if((0,n.existsSync)((0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.mjs`)))return(0,t.joinPaths)(e.workspaceConfig.workspaceRoot,`${r}.config.mjs`)}exports.getConfigPath=r;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_path_join = require("@stryke/path/join");
3
+ let node_fs = require("node:fs");
4
+
5
+ //#region ../powerlines/src/plugin-utils/get-config-path.ts
6
+ /**
7
+ * Get the configuration file path for a given name.
8
+ *
9
+ * @param context - The Powerlines context.
10
+ * @param name - The name of the configuration file (without extension).
11
+ * @returns The absolute path to the configuration file, or undefined if not found.
12
+ */
13
+ function getConfigPath(context, name) {
14
+ 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`);
15
+ 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`);
16
+ 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`);
17
+ 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`);
18
+ 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`);
19
+ 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`);
20
+ 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`);
21
+ 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`);
22
+ 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`);
23
+ 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`);
24
+ 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`);
25
+ 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`);
26
+ 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`);
27
+ 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`);
28
+ 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`);
29
+ 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`);
30
+ 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`);
31
+ 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`);
32
+ 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`);
33
+ 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`);
34
+ 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`);
35
+ 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`);
36
+ 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`);
37
+ 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`);
38
+ 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`);
39
+ 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`);
40
+ 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`);
41
+ 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`);
42
+ 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`);
43
+ 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`);
44
+ 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`);
45
+ 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`);
46
+ }
47
+
48
+ //#endregion
49
+ exports.getConfigPath = getConfigPath;
@@ -1 +1,48 @@
1
- import{joinPaths as e}from"@stryke/path/join";import{existsSync as t}from"node:fs";function n(n,r){if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.yml`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.yml`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.yaml`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.yaml`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.json`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.json`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.jsonc`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.jsonc`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.ts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.ts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.cts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.cts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.mts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.mts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.js`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.js`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.cjs`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.cjs`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.mjs`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.mjs`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.ts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.ts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.cts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.cts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.mts`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.mts`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.js`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.js`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.cjs`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.cjs`);if(t(e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.mjs`)))return e(n.workspaceConfig.workspaceRoot,n.config.projectRoot,`${r}.config.mjs`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.yml`)))return e(n.workspaceConfig.workspaceRoot,`${r}.yml`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.yaml`)))return e(n.workspaceConfig.workspaceRoot,`${r}.yaml`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.json`)))return e(n.workspaceConfig.workspaceRoot,`${r}.json`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.jsonc`)))return e(n.workspaceConfig.workspaceRoot,`${r}.jsonc`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.ts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.ts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.cts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.cts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.mts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.mts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.js`)))return e(n.workspaceConfig.workspaceRoot,`${r}.js`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.cjs`)))return e(n.workspaceConfig.workspaceRoot,`${r}.cjs`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.mjs`)))return e(n.workspaceConfig.workspaceRoot,`${r}.mjs`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.ts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.ts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.cts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.cts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.mts`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.mts`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.js`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.js`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.cjs`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.cjs`);if(t(e(n.workspaceConfig.workspaceRoot,`${r}.config.mjs`)))return e(n.workspaceConfig.workspaceRoot,`${r}.config.mjs`)}export{n as getConfigPath};
1
+ import { joinPaths } from "@stryke/path/join";
2
+ import { existsSync } from "node:fs";
3
+
4
+ //#region ../powerlines/src/plugin-utils/get-config-path.ts
5
+ /**
6
+ * Get the configuration file path for a given name.
7
+ *
8
+ * @param context - The Powerlines context.
9
+ * @param name - The name of the configuration file (without extension).
10
+ * @returns The absolute path to the configuration file, or undefined if not found.
11
+ */
12
+ function getConfigPath(context, name) {
13
+ if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yml`);
14
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.yaml`);
15
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.json`);
16
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.jsonc`);
17
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.ts`);
18
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cts`);
19
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mts`);
20
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.js`);
21
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.cjs`);
22
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.mjs`);
23
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.ts`);
24
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cts`);
25
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mts`);
26
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.js`);
27
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.cjs`);
28
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, context.config.projectRoot, `${name}.config.mjs`);
29
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yml`);
30
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.yaml`);
31
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.json`);
32
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.jsonc`);
33
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.ts`);
34
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cts`);
35
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mts`);
36
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.js`);
37
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.cjs`);
38
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.mjs`);
39
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.ts`);
40
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cts`);
41
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mts`);
42
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.js`);
43
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.cjs`);
44
+ else if (existsSync(joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`))) return joinPaths(context.workspaceConfig.workspaceRoot, `${name}.config.mjs`);
45
+ }
46
+
47
+ //#endregion
48
+ export { getConfigPath };
@@ -1 +1,36 @@
1
- const e=require(`../../../_virtual/rolldown_runtime.cjs`);let t=require(`@stryke/path/replace`);function n(e,n){return n&&n.replaceAll(`{workspaceRoot}`,e.workspaceConfig.workspaceRoot).replaceAll(`{root}`,e.config.projectRoot).replaceAll(`{projectRoot}`,e.config.projectRoot).replaceAll(`{sourceRoot}`,e.config.sourceRoot).replaceAll(`{powerlinesPath}`,e.powerlinesPath).replaceAll(`{cachePath}`,e.cachePath).replaceAll(`{dataPath}`,e.dataPath).replaceAll(`{logPath}`,e.envPaths.log).replaceAll(`{tempPath}`,e.envPaths.temp).replaceAll(`{configPath}`,e.envPaths.config).replaceAll(`{outputPath}`,e.config.output.outputPath).replaceAll(`{buildPath}`,e.config.output.buildPath).replaceAll(`{artifactsPath}`,(0,t.replacePath)(e.artifactsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,(0,t.replacePath)(e.builtinsPath,e.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,(0,t.replacePath)(e.entryPath,e.workspaceConfig.workspaceRoot))}exports.replacePathTokens=n;
1
+ const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_path_replace = require("@stryke/path/replace");
3
+
4
+ //#region ../powerlines/src/plugin-utils/paths.ts
5
+ /**
6
+ * Replaces tokens in the given path string with their corresponding values from the context.
7
+ *
8
+ * @remarks
9
+ * The following tokens are supported:
10
+ * - `{workspaceRoot}` - The root directory of the workspace.
11
+ * - `{root}` - The root directory of the project (same as `{projectRoot}`).
12
+ * - `{projectRoot}` - The root directory of the project (same as `{root}`).
13
+ * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
14
+ * - `{powerlinesPath}` - The directory where Powerlines is installed.
15
+ * - `{cachePath}` - The environment's directory for cached files.
16
+ * - `{dataPath}` - The environment's directory for data files.
17
+ * - `{logPath}` - The environment's directory for log files.
18
+ * - `{tempPath}` - The environment's directory for temporary files.
19
+ * - `{configPath}` - The environment's directory for configuration files.
20
+ * - `{outputPath}` - The configured output directory for the project.
21
+ * - `{buildPath}` - The configured distribution directory for the project.
22
+ * - `{artifactsPath}` - The configured directory for build artifacts.
23
+ * - `{builtinPath}` - The configured directory for generated built-in plugins.
24
+ * - `{entryPath}` - The configured directory for generated entry files.
25
+ *
26
+ * @param context - The context containing the values for the path tokens.
27
+ * @param path - The path string with tokens to replace.
28
+ * @returns The path string with tokens replaced by their corresponding values from the context.
29
+ */
30
+ function replacePathTokens(context, path) {
31
+ if (!path) return path;
32
+ 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));
33
+ }
34
+
35
+ //#endregion
36
+ exports.replacePathTokens = replacePathTokens;
@@ -1 +1,35 @@
1
- import{replacePath as e}from"@stryke/path/replace";function t(t,n){return n&&n.replaceAll(`{workspaceRoot}`,t.workspaceConfig.workspaceRoot).replaceAll(`{root}`,t.config.projectRoot).replaceAll(`{projectRoot}`,t.config.projectRoot).replaceAll(`{sourceRoot}`,t.config.sourceRoot).replaceAll(`{powerlinesPath}`,t.powerlinesPath).replaceAll(`{cachePath}`,t.cachePath).replaceAll(`{dataPath}`,t.dataPath).replaceAll(`{logPath}`,t.envPaths.log).replaceAll(`{tempPath}`,t.envPaths.temp).replaceAll(`{configPath}`,t.envPaths.config).replaceAll(`{outputPath}`,t.config.output.outputPath).replaceAll(`{buildPath}`,t.config.output.buildPath).replaceAll(`{artifactsPath}`,e(t.artifactsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{builtinPath}`,e(t.builtinsPath,t.workspaceConfig.workspaceRoot)).replaceAll(`{entryPath}`,e(t.entryPath,t.workspaceConfig.workspaceRoot))}export{t as replacePathTokens};
1
+ import { replacePath } from "@stryke/path/replace";
2
+
3
+ //#region ../powerlines/src/plugin-utils/paths.ts
4
+ /**
5
+ * Replaces tokens in the given path string with their corresponding values from the context.
6
+ *
7
+ * @remarks
8
+ * The following tokens are supported:
9
+ * - `{workspaceRoot}` - The root directory of the workspace.
10
+ * - `{root}` - The root directory of the project (same as `{projectRoot}`).
11
+ * - `{projectRoot}` - The root directory of the project (same as `{root}`).
12
+ * - `{sourceRoot}` - The source root directory of the project (usually `./src`).
13
+ * - `{powerlinesPath}` - The directory where Powerlines is installed.
14
+ * - `{cachePath}` - The environment's directory for cached files.
15
+ * - `{dataPath}` - The environment's directory for data files.
16
+ * - `{logPath}` - The environment's directory for log files.
17
+ * - `{tempPath}` - The environment's directory for temporary files.
18
+ * - `{configPath}` - The environment's directory for configuration files.
19
+ * - `{outputPath}` - The configured output directory for the project.
20
+ * - `{buildPath}` - The configured distribution directory for the project.
21
+ * - `{artifactsPath}` - The configured directory for build artifacts.
22
+ * - `{builtinPath}` - The configured directory for generated built-in plugins.
23
+ * - `{entryPath}` - The configured directory for generated entry files.
24
+ *
25
+ * @param context - The context containing the values for the path tokens.
26
+ * @param path - The path string with tokens to replace.
27
+ * @returns The path string with tokens replaced by their corresponding values from the context.
28
+ */
29
+ function replacePathTokens(context, path) {
30
+ if (!path) return path;
31
+ 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));
32
+ }
33
+
34
+ //#endregion
35
+ export { replacePathTokens };
@@ -78,10 +78,18 @@ interface ParseOptions extends ParserOptions {
78
78
  */
79
79
  allowReturnOutsideFunction?: boolean;
80
80
  }
81
+ interface EmitOptions extends WriteOptions {
82
+ /**
83
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
84
+ */
85
+ emitWithBundler?: boolean;
86
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
87
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
88
+ }
81
89
  /**
82
90
  * Options for emitting entry virtual files
83
91
  */
84
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
92
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
85
93
  /**
86
94
  * The unresolved Powerlines context.
87
95
  *
@@ -292,6 +300,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
292
300
  * The Powerlines builtin virtual files
293
301
  */
294
302
  getBuiltins: () => Promise<VirtualFile[]>;
303
+ /**
304
+ * Resolves a file and writes it to the VFS if it does not already exist
305
+ *
306
+ * @param code - The source code of the file
307
+ * @param path - The path to write the file to
308
+ * @param options - Additional options for writing the file
309
+ */
310
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
311
+ /**
312
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
313
+ *
314
+ * @param code - The source code of the file
315
+ * @param path - The path to write the file to
316
+ * @param options - Additional options for writing the file
317
+ */
318
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
295
319
  /**
296
320
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
297
321
  *
@@ -300,7 +324,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
300
324
  * @param path - An optional path to write the builtin file to
301
325
  * @param options - Additional options for writing the builtin file
302
326
  */
303
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
327
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
304
328
  /**
305
329
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
306
330
  *
@@ -309,7 +333,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
309
333
  * @param path - An optional path to write the builtin file to
310
334
  * @param options - Additional options for writing the builtin file
311
335
  */
312
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
336
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
313
337
  /**
314
338
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
315
339
  *
@@ -80,10 +80,18 @@ interface ParseOptions extends ParserOptions {
80
80
  */
81
81
  allowReturnOutsideFunction?: boolean;
82
82
  }
83
+ interface EmitOptions extends WriteOptions {
84
+ /**
85
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
86
+ */
87
+ emitWithBundler?: boolean;
88
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
89
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
90
+ }
83
91
  /**
84
92
  * Options for emitting entry virtual files
85
93
  */
86
- type EmitEntryOptions = WriteOptions & Omit<ResolvedEntryTypeDefinition, "file">;
94
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
87
95
  /**
88
96
  * The unresolved Powerlines context.
89
97
  *
@@ -294,6 +302,22 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
294
302
  * The Powerlines builtin virtual files
295
303
  */
296
304
  getBuiltins: () => Promise<VirtualFile[]>;
305
+ /**
306
+ * Resolves a file and writes it to the VFS if it does not already exist
307
+ *
308
+ * @param code - The source code of the file
309
+ * @param path - The path to write the file to
310
+ * @param options - Additional options for writing the file
311
+ */
312
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
313
+ /**
314
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
315
+ *
316
+ * @param code - The source code of the file
317
+ * @param path - The path to write the file to
318
+ * @param options - Additional options for writing the file
319
+ */
320
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
297
321
  /**
298
322
  * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
299
323
  *
@@ -302,7 +326,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
302
326
  * @param path - An optional path to write the builtin file to
303
327
  * @param options - Additional options for writing the builtin file
304
328
  */
305
- emitBuiltin: (code: string, id: string, path?: string, options?: WriteOptions) => Promise<void>;
329
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
306
330
  /**
307
331
  * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
308
332
  *
@@ -311,7 +335,7 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
311
335
  * @param path - An optional path to write the builtin file to
312
336
  * @param options - Additional options for writing the builtin file
313
337
  */
314
- emitBuiltinSync: (code: string, id: string, path?: string, options?: WriteOptions) => void;
338
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
315
339
  /**
316
340
  * Resolves a entry virtual file and writes it to the VFS if it does not already exist
317
341
  *
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-graphql",
3
- "version": "0.1.118",
3
+ "version": "0.1.120",
4
4
  "type": "module",
5
5
  "description": "A Powerlines plugin to generate project code from GraphQL schemas.",
6
6
  "repository": {
@@ -118,19 +118,19 @@
118
118
  "keywords": ["graphql", "powerlines", "storm-software", "powerlines-plugin"],
119
119
  "dependencies": {
120
120
  "@graphql-codegen/cli": "^6.1.0",
121
- "@stryke/path": "^0.24.0",
122
- "@stryke/type-checks": "^0.5.14",
123
- "@stryke/types": "^0.10.28",
121
+ "@stryke/path": "^0.24.1",
122
+ "@stryke/type-checks": "^0.5.15",
123
+ "@stryke/types": "^0.10.29",
124
124
  "defu": "^6.1.4",
125
125
  "jiti": "^2.6.1",
126
- "powerlines": "^0.36.22"
126
+ "powerlines": "^0.36.24"
127
127
  },
128
128
  "devDependencies": {
129
129
  "@graphql-codegen/plugin-helpers": "^6.1.0",
130
- "@powerlines/nx": "^0.11.48",
131
- "@powerlines/plugin-plugin": "^0.12.69",
130
+ "@powerlines/nx": "^0.11.50",
131
+ "@powerlines/plugin-plugin": "^0.12.71",
132
132
  "@types/node": "^24.10.4"
133
133
  },
134
134
  "publishConfig": { "access": "public" },
135
- "gitHead": "f88fe8eb30f96536b83fc9af884972d48e31e63a"
135
+ "gitHead": "4b695d4b3476fd9dd79521f92258d52dab2b8d72"
136
136
  }