@powerlines/core 0.6.2 → 0.7.0

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.
@@ -16,7 +16,7 @@ let prettier = require("prettier");
16
16
  * @returns A promise that resolves to the formatted code string.
17
17
  */
18
18
  async function format(context, path, data, force = false) {
19
- if (!force && ((0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) || (0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot)))) return data;
19
+ if (!force && (context.config.output.publishPath && (0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) || (0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot)))) return data;
20
20
  let code = data;
21
21
  const resolvedConfig = await (0, prettier.resolveConfig)(path);
22
22
  if (resolvedConfig) code = await (0, prettier.format)(data, {
@@ -33,8 +33,8 @@ async function format(context, path, data, force = false) {
33
33
  * @returns A promise that resolves when all files have been formatted.
34
34
  */
35
35
  async function formatFolder(context, path) {
36
- if (!(0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !(0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot))) await Promise.allSettled((await (0, _stryke_fs_list_files.listFiles)(path)).map(async (file) => {
37
- if (!(0, _stryke_path_is_parent_path.isParentPath)(file, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !(0, _stryke_path_is_parent_path.isParentPath)(file, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot))) {
36
+ if (!context.config.output.publishPath || !(0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !(0, _stryke_path_is_parent_path.isParentPath)(path, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot))) await Promise.allSettled((await (0, _stryke_fs_list_files.listFiles)(path)).map(async (file) => {
37
+ if ((!context.config.output.publishPath || !(0, _stryke_path_is_parent_path.isParentPath)(file, (0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot))) && !(0, _stryke_path_is_parent_path.isParentPath)(file, (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot))) {
38
38
  const data = await context.fs.read(file);
39
39
  if (data) {
40
40
  const formatted = await format(context, file, data);
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.cts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,OAAA,EACT,IAAA,UACA,IAAA,UACA,KAAA,aACC,OAAA;;;;;AAwCH;;;iBAAsB,YAAA,CAAa,OAAA,EAAS,OAAA,EAAS,IAAA,WAAY,OAAA"}
1
+ {"version":3,"file":"format.d.cts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,OAAA,EACT,IAAA,UACA,IAAA,UACA,KAAA,aACC,OAAA;;;;;AAyCH;;;iBAAsB,YAAA,CAAa,OAAA,EAAS,OAAA,EAAS,IAAA,WAAY,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.mts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,OAAA,EACT,IAAA,UACA,IAAA,UACA,KAAA,aACC,OAAA;;;;;AAwCH;;;iBAAsB,YAAA,CAAa,OAAA,EAAS,OAAA,EAAS,IAAA,WAAY,OAAA"}
1
+ {"version":3,"file":"format.d.mts","names":[],"sources":["../../../src/lib/utilities/format.ts"],"mappings":";;;;;AAiCA;;;;;;;iBAAsB,MAAA,CACpB,OAAA,EAAS,OAAA,EACT,IAAA,UACA,IAAA,UACA,KAAA,aACC,OAAA;;;;;AAyCH;;;iBAAsB,YAAA,CAAa,OAAA,EAAS,OAAA,EAAS,IAAA,WAAY,OAAA"}
@@ -14,7 +14,7 @@ import { format as format$1, resolveConfig } from "prettier";
14
14
  * @returns A promise that resolves to the formatted code string.
15
15
  */
16
16
  async function format(context, path, data, force = false) {
17
- if (!force && (isParentPath(path, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) || isParentPath(path, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot)))) return data;
17
+ if (!force && (context.config.output.publishPath && isParentPath(path, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) || isParentPath(path, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot)))) return data;
18
18
  let code = data;
19
19
  const resolvedConfig = await resolveConfig(path);
20
20
  if (resolvedConfig) code = await format$1(data, {
@@ -31,8 +31,8 @@ async function format(context, path, data, force = false) {
31
31
  * @returns A promise that resolves when all files have been formatted.
32
32
  */
33
33
  async function formatFolder(context, path) {
34
- if (!isParentPath(path, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !isParentPath(path, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot))) await Promise.allSettled((await listFiles(path)).map(async (file) => {
35
- if (!isParentPath(file, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !isParentPath(file, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot))) {
34
+ if (!context.config.output.publishPath || !isParentPath(path, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot)) && !isParentPath(path, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot))) await Promise.allSettled((await listFiles(path)).map(async (file) => {
35
+ if ((!context.config.output.publishPath || !isParentPath(file, appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot))) && !isParentPath(file, appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot))) {
36
36
  const data = await context.fs.read(file);
37
37
  if (data) {
38
38
  const formatted = await format(context, file, data);
@@ -1 +1 @@
1
- {"version":3,"file":"format.mjs","names":["prettier"],"sources":["../../../src/lib/utilities/format.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { format as prettier, resolveConfig } from \"prettier\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n (isParentPath(\n path,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n ) ||\n isParentPath(\n path,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n ))\n ) {\n return data;\n }\n\n let code = data;\n const resolvedConfig = await resolveConfig(path);\n if (resolvedConfig) {\n code = await prettier(data, {\n absolutePath: path,\n ...resolvedConfig\n });\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !isParentPath(\n path,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n ) &&\n !isParentPath(\n path,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n !isParentPath(\n file,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n ) &&\n !isParentPath(\n file,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;AACjB,KACE,CAAC,UACA,aACC,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,IACC,aACE,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,EAEH,QAAO;CAGT,IAAI,OAAO;CACX,MAAM,iBAAiB,MAAM,cAAc,KAAK;AAChD,KAAI,eACF,QAAO,MAAMA,SAAS,MAAM;EAC1B,cAAc;EACd,GAAG;EACJ,CAAC;AAGJ,QAAO;;;;;;;;;AAUT,eAAsB,aAAa,SAAkB,MAAc;AACjE,KACE,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,IACD,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,CAED,OAAM,QAAQ,YACX,MAAM,UAAU,KAAK,EAAE,IAAI,OAAM,SAAQ;AACxC,MACE,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,IACD,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,EACD;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,KAAK;AACxC,OAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,KAAK;AAEnD,WAAO,QAAQ,GAAG,MAAM,MAAM,UAAU;;;GAG5C,CACH"}
1
+ {"version":3,"file":"format.mjs","names":["prettier"],"sources":["../../../src/lib/utilities/format.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { listFiles } from \"@stryke/fs/list-files\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { format as prettier, resolveConfig } from \"prettier\";\nimport { Context } from \"../../types/context\";\n\n/**\n * Formats code using Prettier based on the file path.\n *\n * @param context - The Powerlines context.\n * @param path - The file path to use for resolving Prettier configuration.\n * @param data - The code string to format.\n * @param force - Whether to force formatting even for output/build paths.\n * @returns A promise that resolves to the formatted code string.\n */\nexport async function format(\n context: Context,\n path: string,\n data: string,\n force = false\n): Promise<string> {\n if (\n !force &&\n ((context.config.output.publishPath &&\n isParentPath(\n path,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n )) ||\n isParentPath(\n path,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n ))\n ) {\n return data;\n }\n\n let code = data;\n const resolvedConfig = await resolveConfig(path);\n if (resolvedConfig) {\n code = await prettier(data, {\n absolutePath: path,\n ...resolvedConfig\n });\n }\n\n return code;\n}\n\n/**\n * Formats all files in a folder using Prettier based on their file paths.\n *\n * @param context - The Powerlines context.\n * @param path - The folder path containing files to format.\n * @returns A promise that resolves when all files have been formatted.\n */\nexport async function formatFolder(context: Context, path: string) {\n if (\n !context.config.output.publishPath ||\n (!isParentPath(\n path,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n ) &&\n !isParentPath(\n path,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n ))\n ) {\n await Promise.allSettled(\n (await listFiles(path)).map(async file => {\n if (\n (!context.config.output.publishPath ||\n !isParentPath(\n file,\n appendPath(\n context.config.output.publishPath,\n context.workspaceConfig.workspaceRoot\n )\n )) &&\n !isParentPath(\n file,\n appendPath(\n context.config.output.path,\n context.workspaceConfig.workspaceRoot\n )\n )\n ) {\n const data = await context.fs.read(file);\n if (data) {\n const formatted = await format(context, file, data);\n\n return context.fs.write(file, formatted);\n }\n }\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiCA,eAAsB,OACpB,SACA,MACA,MACA,QAAQ,OACS;AACjB,KACE,CAAC,UACC,QAAQ,OAAO,OAAO,eACtB,aACE,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,IACD,aACE,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,EAEH,QAAO;CAGT,IAAI,OAAO;CACX,MAAM,iBAAiB,MAAM,cAAc,KAAK;AAChD,KAAI,eACF,QAAO,MAAMA,SAAS,MAAM;EAC1B,cAAc;EACd,GAAG;EACJ,CAAC;AAGJ,QAAO;;;;;;;;;AAUT,eAAsB,aAAa,SAAkB,MAAc;AACjE,KACE,CAAC,QAAQ,OAAO,OAAO,eACtB,CAAC,aACA,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,IACC,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,CAEH,OAAM,QAAQ,YACX,MAAM,UAAU,KAAK,EAAE,IAAI,OAAM,SAAQ;AACxC,OACG,CAAC,QAAQ,OAAO,OAAO,eACtB,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,aACtB,QAAQ,gBAAgB,cACzB,CACF,KACH,CAAC,aACC,MACA,WACE,QAAQ,OAAO,OAAO,MACtB,QAAQ,gBAAgB,cACzB,CACF,EACD;GACA,MAAM,OAAO,MAAM,QAAQ,GAAG,KAAK,KAAK;AACxC,OAAI,MAAM;IACR,MAAM,YAAY,MAAM,OAAO,SAAS,MAAM,KAAK;AAEnD,WAAO,QAAQ,GAAG,MAAM,MAAM,UAAU;;;GAG5C,CACH"}
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_path_replace = require("@stryke/path/replace");
4
+ let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
5
  let _stryke_path_join = require("@stryke/path/join");
5
6
 
6
7
  //#region src/plugin-utils/paths.ts
@@ -33,7 +34,8 @@ let _stryke_path_join = require("@stryke/path/join");
33
34
  */
34
35
  function replacePathTokens(context, path) {
35
36
  if (!path) return path;
36
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", (0, _stryke_path_join.joinPaths)(context.config.root, "src")).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.path).replaceAll("{output}", context.config.output.path).replaceAll("{publishPath}", context.config.output.publishPath).replaceAll("{publish}", context.config.output.publishPath).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));
37
+ const result = path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", (0, _stryke_path_join.joinPaths)(context.config.root, "src")).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.path).replaceAll("{output}", context.config.output.path).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));
38
+ return (0, _stryke_type_checks_is_set_string.isSetString)(context.config.output.publishPath) ? result.replaceAll("{publishPath}", context.config.output.publishPath).replaceAll("{publish}", context.config.output.publishPath) : result;
37
39
  }
38
40
 
39
41
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.cts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AAkDA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
1
+ {"version":3,"file":"paths.d.cts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AAmDA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.mts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AAkDA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
1
+ {"version":3,"file":"paths.d.mts","names":[],"sources":["../../src/plugin-utils/paths.ts"],"mappings":";;;;;;AAmDA;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,EACT,IAAA,YACC,WAAA,QAAmB,IAAA"}
@@ -1,4 +1,5 @@
1
1
  import { replacePath } from "@stryke/path/replace";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
2
3
  import { joinPaths } from "@stryke/path/join";
3
4
 
4
5
  //#region src/plugin-utils/paths.ts
@@ -31,7 +32,8 @@ import { joinPaths } from "@stryke/path/join";
31
32
  */
32
33
  function replacePathTokens(context, path) {
33
34
  if (!path) return path;
34
- return path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", joinPaths(context.config.root, "src")).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.path).replaceAll("{output}", context.config.output.path).replaceAll("{publishPath}", context.config.output.publishPath).replaceAll("{publish}", context.config.output.publishPath).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
35
+ const result = path.replaceAll("{workspaceRoot}", context.workspaceConfig.workspaceRoot).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", joinPaths(context.config.root, "src")).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.path).replaceAll("{output}", context.config.output.path).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)).replaceAll("{entryPath}", replacePath(context.entryPath, context.workspaceConfig.workspaceRoot));
36
+ return isSetString(context.config.output.publishPath) ? result.replaceAll("{publishPath}", context.config.output.publishPath).replaceAll("{publish}", context.config.output.publishPath) : result;
35
37
  }
36
38
 
37
39
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{workspaceRoot}` - The root directory of the workspace.\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `./src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{output}` - The configured output directory for the project.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{publish}` - The configured final/copied distribution directory for the project.\n * - `{publishPath}` - The configured final/copied distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n return path\n .replaceAll(\"{workspaceRoot}\", context.workspaceConfig.workspaceRoot)\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.path)\n .replaceAll(\"{output}\", context.config.output.path)\n .replaceAll(\"{publishPath}\", context.config.output.publishPath)\n .replaceAll(\"{publish}\", context.config.output.publishPath)\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.workspaceConfig.workspaceRoot)\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;AAGT,QAAO,KACJ,WAAW,mBAAmB,QAAQ,gBAAgB,cAAc,CACpE,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,gBAAgB,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WAAW,gBAAgB,QAAQ,OAAO,OAAO,KAAK,CACtD,WAAW,YAAY,QAAQ,OAAO,OAAO,KAAK,CAClD,WAAW,iBAAiB,QAAQ,OAAO,OAAO,YAAY,CAC9D,WAAW,aAAa,QAAQ,OAAO,OAAO,YAAY,CAC1D,WACC,mBACA,YAAY,QAAQ,eAAe,QAAQ,gBAAgB,cAAc,CAC1E,CACA,WACC,iBACA,YAAY,QAAQ,cAAc,QAAQ,gBAAgB,cAAc,CACzE,CACA,WACC,eACA,YAAY,QAAQ,WAAW,QAAQ,gBAAgB,cAAc,CACtE"}
1
+ {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{workspaceRoot}` - The root directory of the workspace.\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `./src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{output}` - The configured output directory for the project.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{publish}` - The configured final/copied distribution directory for the project.\n * - `{publishPath}` - The configured final/copied distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n const result = path\n .replaceAll(\"{workspaceRoot}\", context.workspaceConfig.workspaceRoot)\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.path)\n .replaceAll(\"{output}\", context.config.output.path)\n\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.workspaceConfig.workspaceRoot)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.workspaceConfig.workspaceRoot)\n );\n\n return isSetString(context.config.output.publishPath)\n ? result\n .replaceAll(\"{publishPath}\", context.config.output.publishPath)\n .replaceAll(\"{publish}\", context.config.output.publishPath)\n : result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;CAGT,MAAM,SAAS,KACZ,WAAW,mBAAmB,QAAQ,gBAAgB,cAAc,CACpE,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,gBAAgB,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WAAW,gBAAgB,QAAQ,OAAO,OAAO,KAAK,CACtD,WAAW,YAAY,QAAQ,OAAO,OAAO,KAAK,CAElD,WACC,mBACA,YAAY,QAAQ,eAAe,QAAQ,gBAAgB,cAAc,CAC1E,CACA,WACC,iBACA,YAAY,QAAQ,cAAc,QAAQ,gBAAgB,cAAc,CACzE,CACA,WACC,eACA,YAAY,QAAQ,WAAW,QAAQ,gBAAgB,cAAc,CACtE;AAEH,QAAO,YAAY,QAAQ,OAAO,OAAO,YAAY,GACjD,OACG,WAAW,iBAAiB,QAAQ,OAAO,OAAO,YAAY,CAC9D,WAAW,aAAa,QAAQ,OAAO,OAAO,YAAY,GAC7D"}
@@ -147,7 +147,7 @@ interface OutputConfig {
147
147
  * @remarks
148
148
  * This option is useful when a separate directory is needed for collecting distributable files that are copied from the project, such as static assets or other non-code files. When using [Nx monorepo tools](https://nx.dev/), it is common for the {@link OutputConfig.path | project's output} to be copied to the `{workspaceRoot}/dist/{root}` directory, so that all of the monorepo's output is consolidated in a single location.
149
149
  */
150
- publishPath?: string;
150
+ publishPath?: string | false;
151
151
  /**
152
152
  * The folder where the generated runtime artifacts will be located
153
153
  *
@@ -147,7 +147,7 @@ interface OutputConfig {
147
147
  * @remarks
148
148
  * This option is useful when a separate directory is needed for collecting distributable files that are copied from the project, such as static assets or other non-code files. When using [Nx monorepo tools](https://nx.dev/), it is common for the {@link OutputConfig.path | project's output} to be copied to the `{workspaceRoot}/dist/{root}` directory, so that all of the monorepo's output is consolidated in a single location.
149
149
  */
150
- publishPath?: string;
150
+ publishPath?: string | false;
151
151
  /**
152
152
  * The folder where the generated runtime artifacts will be located
153
153
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -526,5 +526,5 @@
526
526
  "typescript": "^5.9.3"
527
527
  },
528
528
  "publishConfig": { "access": "public" },
529
- "gitHead": "c9c61ea343f037afaa4097720d77cb822eb86e63"
529
+ "gitHead": "c3243c1ec0fbacb4afd4bd3db20432f443334076"
530
530
  }