@powerlines/core 0.6.1 → 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.
@@ -46,16 +46,16 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
46
46
  if (!resolvedUserConfigFile) resolvedUserConfigFile = (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.ts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.js`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.js`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
47
47
  if (resolvedUserConfigFile) {
48
48
  const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
49
- if (resolved) {
49
+ if (resolved?.default) {
50
50
  let config = {};
51
- if ((0, _stryke_type_checks_is_function.isFunction)(resolved)) config = await Promise.resolve(resolved({
51
+ if ((0, _stryke_type_checks_is_function.isFunction)(resolved.default)) config = await Promise.resolve(resolved.default({
52
52
  command,
53
53
  mode,
54
54
  framework,
55
55
  projectRoot,
56
56
  workspaceRoot
57
57
  }));
58
- else if ((0, _stryke_type_checks_is_set_object.isSetObject)(resolved)) config = resolved;
58
+ else if ((0, _stryke_type_checks_is_set_object.isSetObject)(resolved.default)) config = resolved.default;
59
59
  if ((0, _stryke_type_checks_is_set_object.isSetObject)(config)) resolvedUserConfig = {
60
60
  ...config,
61
61
  config,
@@ -43,16 +43,16 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
43
43
  if (!resolvedUserConfigFile) resolvedUserConfigFile = existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.ts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.js`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mts`) : existsSync(joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? joinPaths(appendPath(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
44
44
  if (resolvedUserConfigFile) {
45
45
  const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
46
- if (resolved) {
46
+ if (resolved?.default) {
47
47
  let config = {};
48
- if (isFunction(resolved)) config = await Promise.resolve(resolved({
48
+ if (isFunction(resolved.default)) config = await Promise.resolve(resolved.default({
49
49
  command,
50
50
  mode,
51
51
  framework,
52
52
  projectRoot,
53
53
  workspaceRoot
54
54
  }));
55
- else if (isSetObject(resolved)) config = resolved;
55
+ else if (isSetObject(resolved.default)) config = resolved.default;
56
56
  if (isSetObject(config)) resolvedUserConfig = {
57
57
  ...config,
58
58
  config,
@@ -1 +1 @@
1
- {"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.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 { getWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport type { Jiti } from \"jiti\";\nimport type {\n ParsedUserConfig,\n PowerlinesCommand,\n UserConfig,\n UserConfigFn,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param cwd - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n workspaceRoot: string,\n cwd: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot\n },\n await getWorkspaceConfig(true, {\n cwd,\n workspaceRoot,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param projectRoot - The root directory of the project.\n * @param workspaceRoot - The root directory of the workspace.\n * @param jiti - An instance of Jiti to resolve modules from\n * @param command - The {@link PowerlinesCommand} string associated with the current running process\n * @param mode - The mode in which the project is running (default is \"production\").\n * @param configFile - An optional path to a specific configuration file.\n * @param framework - The framework name to use for default configuration file names.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n projectRoot: string,\n workspaceRoot: string,\n jiti: Jiti,\n command?: PowerlinesCommand,\n mode = \"production\",\n configFile?: string,\n framework = \"powerlines\"\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot))\n ? replacePath(configFile, projectRoot)\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n : existsSync(\n joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n )\n ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<UserConfig | UserConfigFn>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved) {\n let config = {};\n if (isFunction(resolved)) {\n config = await Promise.resolve(\n resolved({\n command,\n mode,\n framework,\n projectRoot,\n workspaceRoot\n })\n );\n } else if (isSetObject(resolved)) {\n config = resolved;\n }\n\n if (isSetObject(config)) {\n resolvedUserConfig = {\n ...config,\n config: config as UserConfig,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: projectRoot,\n name: framework,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,eAAsB,oBACpB,eACA,KAC0B;AAC1B,QAAO,KACL,EACE,eACD,EACD,MAAM,mBAAmB,MAAM;EAC7B;EACA;EACA,YAAY;EACb,CAAC,CACH;;;;;;;;;;;;;;AAeH,eAAsB,mBACpB,aACA,eACA,MACA,SACA,OAAO,cACP,YACA,YAAY,cACe;CAC3B,IAAI,qBAAgD,EAAE;CAEtD,IAAI;AACJ,KAAI,WACF,0BAAyB,WAAW,YAAY,YAAY,YAAY,CAAC,GACrE,YAAY,YAAY,YAAY,GACpC,WACI,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,GACD,WACI,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,CAC9D,GACD,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,GAC7D;AAGV,KAAI,CAAC,uBACH,0BAAyB,WACvB,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACG,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD;AAGpB,KAAI,wBAAwB;EAC1B,MAAM,WAAW,MAAM,KAAK,OAC1B,KAAK,WAAW,uBAAuB,CACxC;AACD,MAAI,UAAU;GACZ,IAAI,SAAS,EAAE;AACf,OAAI,WAAW,SAAS,CACtB,UAAS,MAAM,QAAQ,QACrB,SAAS;IACP;IACA;IACA;IACA;IACA;IACD,CAAC,CACH;YACQ,YAAY,SAAS,CAC9B,UAAS;AAGX,OAAI,YAAY,OAAO,CACrB,sBAAqB;IACnB,GAAG;IACK;IACR,YAAY;IACb;;;CAKP,MAAM,SAAS,MAAMA,WAAc;EACjC,KAAK;EACL,MAAM;EACN,SAAS;EACT,UAAU;EACV,aAAa,UAAU,UAAU;EACjC,QAAQ;EACR;EACD,CAAC;AAEF,QAAO,KACL,oBACA,YAAY,QAAQ,OAAO,GAAG;EAAE,GAAG,OAAO;EAAQ,GAAG;EAAQ,GAAG,EAAE,CACnE;;;;;;;;AASH,SAAgB,aAAa,QAAmC;AAC9D,QAAO"}
1
+ {"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.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 { getWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport type { Jiti } from \"jiti\";\nimport type {\n ParsedUserConfig,\n PowerlinesCommand,\n UserConfig,\n UserConfigFn,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param cwd - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n workspaceRoot: string,\n cwd: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot\n },\n await getWorkspaceConfig(true, {\n cwd,\n workspaceRoot,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param projectRoot - The root directory of the project.\n * @param workspaceRoot - The root directory of the workspace.\n * @param jiti - An instance of Jiti to resolve modules from\n * @param command - The {@link PowerlinesCommand} string associated with the current running process\n * @param mode - The mode in which the project is running (default is \"production\").\n * @param configFile - An optional path to a specific configuration file.\n * @param framework - The framework name to use for default configuration file names.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n projectRoot: string,\n workspaceRoot: string,\n jiti: Jiti,\n command?: PowerlinesCommand,\n mode = \"production\",\n configFile?: string,\n framework = \"powerlines\"\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot))\n ? replacePath(configFile, projectRoot)\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n : existsSync(\n joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n )\n ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<{ default: UserConfig | UserConfigFn }>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved?.default) {\n let config = {};\n if (isFunction(resolved.default)) {\n config = await Promise.resolve(\n resolved.default({\n command,\n mode,\n framework,\n projectRoot,\n workspaceRoot\n })\n );\n } else if (isSetObject(resolved.default)) {\n config = resolved.default;\n }\n\n if (isSetObject(config)) {\n resolvedUserConfig = {\n ...config,\n config: config as UserConfig,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: projectRoot,\n name: framework,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,eAAsB,oBACpB,eACA,KAC0B;AAC1B,QAAO,KACL,EACE,eACD,EACD,MAAM,mBAAmB,MAAM;EAC7B;EACA;EACA,YAAY;EACb,CAAC,CACH;;;;;;;;;;;;;;AAeH,eAAsB,mBACpB,aACA,eACA,MACA,SACA,OAAO,cACP,YACA,YAAY,cACe;CAC3B,IAAI,qBAAgD,EAAE;CAEtD,IAAI;AACJ,KAAI,WACF,0BAAyB,WAAW,YAAY,YAAY,YAAY,CAAC,GACrE,YAAY,YAAY,YAAY,GACpC,WACI,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,GACD,WACI,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,CAC9D,GACD,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,GAC7D;AAGV,KAAI,CAAC,uBACH,0BAAyB,WACvB,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACG,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,YACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,GAAG,KAAK,aACtB,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,YACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD,WACI,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,GAAG,UAAU,aACd,GACD;AAGpB,KAAI,wBAAwB;EAC1B,MAAM,WAAW,MAAM,KAAK,OAC1B,KAAK,WAAW,uBAAuB,CACxC;AACD,MAAI,UAAU,SAAS;GACrB,IAAI,SAAS,EAAE;AACf,OAAI,WAAW,SAAS,QAAQ,CAC9B,UAAS,MAAM,QAAQ,QACrB,SAAS,QAAQ;IACf;IACA;IACA;IACA;IACA;IACD,CAAC,CACH;YACQ,YAAY,SAAS,QAAQ,CACtC,UAAS,SAAS;AAGpB,OAAI,YAAY,OAAO,CACrB,sBAAqB;IACnB,GAAG;IACK;IACR,YAAY;IACb;;;CAKP,MAAM,SAAS,MAAMA,WAAc;EACjC,KAAK;EACL,MAAM;EACN,SAAS;EACT,UAAU;EACV,aAAa,UAAU,UAAU;EACjC,QAAQ;EACR;EACD,CAAC;AAEF,QAAO,KACL,oBACA,YAAY,QAAQ,OAAO,GAAG;EAAE,GAAG,OAAO;EAAQ,GAAG;EAAQ,GAAG,EAAE,CACnE;;;;;;;;AASH,SAAgB,aAAa,QAAmC;AAC9D,QAAO"}
@@ -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.1",
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": "d00a8306c2e4bc7b8fd853b0f935b5ef5f32d845"
529
+ "gitHead": "c3243c1ec0fbacb4afd4bd3db20432f443334076"
530
530
  }