powerlines 0.42.4 → 0.42.6

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.
Files changed (54) hide show
  1. package/dist/{api-DQGouFwU.cjs → api-DoC5Fbbl.cjs} +44 -46
  2. package/dist/{api-BPqm4eLe.mjs → api-QF6YGs6J.mjs} +45 -47
  3. package/dist/api-QF6YGs6J.mjs.map +1 -0
  4. package/dist/astro.cjs +3 -3
  5. package/dist/astro.mjs +3 -3
  6. package/dist/context/index.cjs +3 -3
  7. package/dist/context/index.d.cts +1 -2
  8. package/dist/context/index.d.cts.map +1 -1
  9. package/dist/context/index.d.mts +1 -2
  10. package/dist/context/index.d.mts.map +1 -1
  11. package/dist/context/index.mjs +3 -3
  12. package/dist/esbuild.cjs +3 -3
  13. package/dist/esbuild.mjs +3 -3
  14. package/dist/farm.cjs +3 -3
  15. package/dist/farm.mjs +3 -3
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.d.cts.map +1 -1
  18. package/dist/index.d.mts.map +1 -1
  19. package/dist/index.mjs +3 -3
  20. package/dist/next.cjs +3 -3
  21. package/dist/next.mjs +3 -3
  22. package/dist/nuxt.cjs +3 -3
  23. package/dist/nuxt.mjs +3 -3
  24. package/dist/rolldown.cjs +3 -3
  25. package/dist/rolldown.mjs +3 -3
  26. package/dist/rollup.cjs +3 -3
  27. package/dist/rollup.mjs +3 -3
  28. package/dist/rspack.cjs +3 -3
  29. package/dist/rspack.mjs +3 -3
  30. package/dist/storage/index.cjs +1 -1
  31. package/dist/storage/index.mjs +1 -1
  32. package/dist/{tsconfig-D9GCB2I9.mjs → tsconfig-DcW7-RGh.mjs} +2 -2
  33. package/dist/{tsconfig-D9GCB2I9.mjs.map → tsconfig-DcW7-RGh.mjs.map} +1 -1
  34. package/dist/{tsconfig-BJrUrPC_.cjs → tsconfig-l-UmDdrR.cjs} +1 -1
  35. package/dist/tsdown.cjs +18 -15
  36. package/dist/tsdown.mjs +18 -15
  37. package/dist/tsdown.mjs.map +1 -1
  38. package/dist/tsup.cjs +3 -3
  39. package/dist/tsup.mjs +3 -3
  40. package/dist/typescript/index.cjs +1 -1
  41. package/dist/typescript/index.mjs +1 -1
  42. package/dist/unloader.cjs +3 -3
  43. package/dist/unloader.mjs +3 -3
  44. package/dist/unplugin.cjs +3 -3
  45. package/dist/unplugin.mjs +3 -3
  46. package/dist/{virtual-DvkJm7gK.mjs → virtual-B0n7dKeA.mjs} +3 -3
  47. package/dist/{virtual-DvkJm7gK.mjs.map → virtual-B0n7dKeA.mjs.map} +1 -1
  48. package/dist/{virtual-Cbvj12lU.cjs → virtual-BvouNuwf.cjs} +2 -2
  49. package/dist/vite.cjs +3 -3
  50. package/dist/vite.mjs +3 -3
  51. package/dist/webpack.cjs +3 -3
  52. package/dist/webpack.mjs +3 -3
  53. package/package.json +16 -16
  54. package/dist/api-BPqm4eLe.mjs.map +0 -1
@@ -1,13 +1,15 @@
1
1
  const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
- const require_tsconfig = require('./tsconfig-BJrUrPC_.cjs');
2
+ const require_tsconfig = require('./tsconfig-l-UmDdrR.cjs');
3
3
  const require_plugin_utils = require('./plugin-utils.cjs');
4
4
  const require_constants = require('./constants.cjs');
5
5
  const require_config = require('./config.cjs');
6
6
  const require_utils = require('./utils.cjs');
7
- const require_virtual = require('./virtual-Cbvj12lU.cjs');
7
+ const require_virtual = require('./virtual-BvouNuwf.cjs');
8
8
  let _stryke_fs_get_workspace_root = require("@stryke/fs/get-workspace-root");
9
9
  let _storm_software_config_tools_logger_console = require("@storm-software/config-tools/logger/console");
10
10
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
11
+ let _stryke_fs_copy_file = require("@stryke/fs/copy-file");
12
+ let _stryke_fs_exists = require("@stryke/fs/exists");
11
13
  let _stryke_fs_helpers = require("@stryke/fs/helpers");
12
14
  let _stryke_fs_install = require("@stryke/fs/install");
13
15
  let _stryke_fs_list_files = require("@stryke/fs/list-files");
@@ -15,6 +17,8 @@ let _stryke_fs_package_fns = require("@stryke/fs/package-fns");
15
17
  let _stryke_fs_resolve = require("@stryke/fs/resolve");
16
18
  let _stryke_helpers_omit = require("@stryke/helpers/omit");
17
19
  let _stryke_path_append = require("@stryke/path/append");
20
+ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
21
+ let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
18
22
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
19
23
  let _stryke_path_replace = require("@stryke/path/replace");
20
24
  let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
@@ -30,14 +34,11 @@ let chalk = require("chalk");
30
34
  chalk = require_chunk.__toESM(chalk);
31
35
  let handlebars = require("handlebars");
32
36
  handlebars = require_chunk.__toESM(handlebars);
33
- let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
34
- let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
35
37
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
36
38
  let ts_morph = require("ts-morph");
37
39
  let defu = require("defu");
38
40
  defu = require_chunk.__toESM(defu);
39
41
  let _stryke_string_format_package = require("@stryke/string-format/package");
40
- let _stryke_fs_exists = require("@stryke/fs/exists");
41
42
  let _stryke_fs_json = require("@stryke/fs/json");
42
43
  require("@stryke/fs/remove-file");
43
44
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
@@ -76,7 +77,7 @@ let unplugin = require("unplugin");
76
77
 
77
78
  //#region package.json
78
79
  var name = "powerlines";
79
- var version = "0.42.4";
80
+ var version = "0.42.6";
80
81
 
81
82
  //#endregion
82
83
  //#region src/_internal/helpers/generate-types.ts
@@ -1126,8 +1127,8 @@ var VirtualFileSystem = class VirtualFileSystem {
1126
1127
  if (!this.#resolverCache) this.#resolverCache = (0, flat_cache.create)({
1127
1128
  cacheId: "module-resolution",
1128
1129
  cacheDir: this.#context.cachePath,
1129
- ttl: 120 * 1e3,
1130
- lruSize: 5e3,
1130
+ ttl: 2.5 * 60 * 1e3,
1131
+ lruSize: 8e3,
1131
1132
  persistInterval: 100
1132
1133
  });
1133
1134
  return this.#resolverCache;
@@ -1170,8 +1171,8 @@ var VirtualFileSystem = class VirtualFileSystem {
1170
1171
  ...this.#context.config.output.storage
1171
1172
  };
1172
1173
  this.#storage.virtual ??= new require_virtual.VirtualStorageAdapter(context, { base: "/_virtual" });
1173
- if (this.#context.config.output.publishPath) this.#storage[this.#context.config.output.publishPath] ??= new require_virtual.FileSystemStorageAdapter(context, { base: this.#context.config.output.publishPath });
1174
1174
  this.#storage[this.#context.config.output.path] ??= new require_virtual.FileSystemStorageAdapter(context, { base: this.#context.config.output.path });
1175
+ if (this.#context.config.output.copy && this.#context.config.output.copy.path) this.#storage[this.#context.config.output.copy.path] ??= new require_virtual.FileSystemStorageAdapter(context, { base: this.#context.config.output.copy.path });
1175
1176
  if (this.#context.config.output.storage !== "fs") {
1176
1177
  this.#storage[this.#context.artifactsPath] ??= new require_virtual.VirtualStorageAdapter(context, { base: this.#context.artifactsPath });
1177
1178
  this.#storage[this.#context.builtinsPath] ??= new require_virtual.VirtualStorageAdapter(context, { base: this.#context.builtinsPath });
@@ -1906,8 +1907,12 @@ var PowerlinesContext = class PowerlinesContext {
1906
1907
  * The logger function
1907
1908
  */
1908
1909
  get log() {
1909
- if (!this.logFn) this.logFn = this.createLog();
1910
- return this.logFn;
1910
+ const level = this.config.logLevel || "info";
1911
+ if (!this.logger || this.logger.level !== level) this.logger = {
1912
+ log: this.createLog(),
1913
+ level
1914
+ };
1915
+ return this.logger.log;
1911
1916
  }
1912
1917
  /**
1913
1918
  * The workspace configuration
@@ -2512,7 +2517,7 @@ var PowerlinesContext = class PowerlinesContext {
2512
2517
  /**
2513
2518
  * A logger function specific to this context
2514
2519
  */
2515
- logFn;
2520
+ logger;
2516
2521
  /**
2517
2522
  * Initialize the context with the provided configuration options
2518
2523
  *
@@ -2580,11 +2585,7 @@ var PowerlinesContext = class PowerlinesContext {
2580
2585
  description: this.packageJson?.description,
2581
2586
  output: (0, require_plugin_utils.plugin_utils_exports.mergeConfig)(config.output ?? {}, {
2582
2587
  path: cacheKey.root ? (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(cacheKey.root, "dist"), this.workspaceConfig?.workspaceRoot) : void 0,
2583
- publishPath: this.workspaceConfig?.directories?.build && cacheKey.root ? (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(cacheKey.root, this.workspaceConfig?.directories?.build || "dist"), this.workspaceConfig?.workspaceRoot) : cacheKey.root ? (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)(cacheKey.root, this.workspaceConfig?.directories?.build || "dist"), this.workspaceConfig?.workspaceRoot) : void 0,
2584
- artifactsPath: `.${config.framework ?? "powerlines"}`,
2585
- dts: true,
2586
- typegen: (0, _stryke_path_join.joinPaths)(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
2587
- assets: [
2588
+ copy: { assets: [
2588
2589
  { glob: "LICENSE" },
2589
2590
  {
2590
2591
  input: cacheKey.root,
@@ -2594,7 +2595,10 @@ var PowerlinesContext = class PowerlinesContext {
2594
2595
  input: cacheKey.root,
2595
2596
  glob: "package.json"
2596
2597
  }
2597
- ]
2598
+ ] },
2599
+ artifactsPath: `.${config.framework ?? "powerlines"}`,
2600
+ dts: true,
2601
+ typegen: (0, _stryke_path_join.joinPaths)(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`)
2598
2602
  })
2599
2603
  }, options.isHighPriority ? {} : this.#getConfigProps(config), {
2600
2604
  inlineConfig: {},
@@ -2618,19 +2622,17 @@ var PowerlinesContext = class PowerlinesContext {
2618
2622
  if (this.config.resolve.noExternal) this.config.resolve.noExternal = (0, _stryke_helpers_get_unique.getUnique)(this.config.resolve.noExternal);
2619
2623
  this.config.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
2620
2624
  if (this.config.output.dts !== false && !this.config.output.typegen) this.config.output.typegen = `${this.config.root ? `${this.config.root}/` : ""}${this.config.framework ?? "powerlines"}.d.ts`;
2621
- if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) {
2622
- this.config.output.path ??= (0, _stryke_path_join.joinPaths)(this.config.root, "dist");
2623
- if (this.config.output.publishPath !== false) this.config.output.publishPath ??= (0, _stryke_path_join.joinPaths)("dist", this.config.root);
2624
- } else {
2625
- this.config.output.path ??= "dist";
2626
- if (this.config.output.publishPath !== false) this.config.output.publishPath ??= this.config.output.path;
2627
- }
2628
- if (this.config.output.publishPath === false) this.config.output.assets = [];
2629
- else this.config.output.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(this.config.output.assets.map((asset) => {
2625
+ if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) this.config.output.path ??= (0, _stryke_path_join.joinPaths)(this.config.root, "dist");
2626
+ else this.config.output.path ??= "dist";
2627
+ if (this.config.root && this.config.output.copy !== false) this.config.output.copy = {
2628
+ path: (0, _stryke_path_join.joinPaths)(this.workspaceConfig.workspaceRoot, "dist", (0, _stryke_path_replace.replacePath)(this.config.root, this.workspaceConfig.workspaceRoot)),
2629
+ ...this.config.output.copy || {}
2630
+ };
2631
+ if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(this.config.output.copy.assets.map((asset) => {
2630
2632
  return {
2631
2633
  glob: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) ? asset.glob : asset,
2632
2634
  input: (0, _stryke_type_checks_is_string.isString)(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : (0, _stryke_path_is_parent_path.isParentPath)(asset.input, this.workspaceConfig.workspaceRoot) || asset.input === this.workspaceConfig.workspaceRoot ? asset.input : (0, _stryke_path_append.appendPath)(asset.input, this.workspaceConfig.workspaceRoot),
2633
- output: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.output ? (0, _stryke_path_is_parent_path.isParentPath)(asset.output, this.workspaceConfig.workspaceRoot) ? asset.output : (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(this.config.output.publishPath || this.config.output.path, (0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(asset.output, (0, _stryke_path_replace.replacePath)(this.config.output.publishPath || this.config.output.path, this.workspaceConfig.workspaceRoot)), this.config.output.publishPath || this.config.output.path)), this.workspaceConfig.workspaceRoot) : (0, _stryke_path_append.appendPath)(this.config.output.publishPath || this.config.output.path, this.workspaceConfig.workspaceRoot),
2635
+ output: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.output ? (0, _stryke_path_is_parent_path.isParentPath)(asset.output, this.workspaceConfig.workspaceRoot) ? asset.output : (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(this.config.output.copy.path, (0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(asset.output, (0, _stryke_path_replace.replacePath)(this.config.output.copy.path, this.workspaceConfig.workspaceRoot)), this.config.output.copy.path)), this.workspaceConfig.workspaceRoot) : (0, _stryke_path_append.appendPath)(this.config.output.copy.path, this.workspaceConfig.workspaceRoot),
2634
2636
  ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
2635
2637
  };
2636
2638
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
@@ -2642,7 +2644,7 @@ var PowerlinesContext = class PowerlinesContext {
2642
2644
  if (this.config.tsconfig) this.config.tsconfig = (0, require_plugin_utils.plugin_utils_exports.replacePathTokens)(this, this.config.tsconfig);
2643
2645
  if (this.config.output.typegen) if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.output.typegen)) this.config.output.typegen = (0, require_plugin_utils.plugin_utils_exports.replacePathTokens)(this, this.config.output.typegen);
2644
2646
  else this.config.output.typegen = (0, _stryke_path_join.joinPaths)(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2645
- if (this.config.output.assets) this.config.output.assets = this.config.output.assets.map((asset) => ({
2647
+ if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
2646
2648
  ...asset,
2647
2649
  glob: (0, require_plugin_utils.plugin_utils_exports.replacePathTokens)(this, asset.glob),
2648
2650
  ignore: asset.ignore ? asset.ignore.map((ignore) => (0, require_plugin_utils.plugin_utils_exports.replacePathTokens)(this, ignore)) : void 0,
@@ -3016,7 +3018,6 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3016
3018
  var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext {
3017
3019
  #environments = {};
3018
3020
  #plugins = [];
3019
- #log;
3020
3021
  /**
3021
3022
  * Create a new Storm context from the workspace root and user config.
3022
3023
  *
@@ -3061,10 +3062,6 @@ var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext
3061
3062
  get environments() {
3062
3063
  return this.#environments;
3063
3064
  }
3064
- get log() {
3065
- if (!this.#log) this.#log = this.createLog();
3066
- return this.#log;
3067
- }
3068
3065
  get plugins() {
3069
3066
  return this.#plugins;
3070
3067
  }
@@ -3450,7 +3447,7 @@ var PowerlinesAPI = class PowerlinesAPI {
3450
3447
  this.context.info(" 📦 Building the Powerlines project");
3451
3448
  await this.context.generateChecksum();
3452
3449
  if (this.context.meta.checksum !== this.context.persistedMeta?.checksum || this.context.config.skipCache) {
3453
- this.context.info("The project has been modified since the last time `prepare` was ran. Re-preparing the project.");
3450
+ this.context.info(!this.context.persistedMeta?.checksum ? "No previous build cache found. Preparing the project for the initial build." : this.context.meta.checksum !== this.context.persistedMeta.checksum ? "The project has been modified since the last time `prepare` was ran. Re-preparing the project." : "The project is configured to skip cache. Re-preparing the project.");
3454
3451
  inlineConfig.command ??= "build";
3455
3452
  await this.prepare(inlineConfig);
3456
3453
  }
@@ -3550,18 +3547,19 @@ var PowerlinesAPI = class PowerlinesAPI {
3550
3547
  environment: context,
3551
3548
  order: "normal"
3552
3549
  });
3553
- if (context.config.output.publishPath && context.config.output.path !== context.config.output.publishPath) {
3550
+ if (context.config.output.copy) {
3551
+ context.debug("Copying project's files from build output directory.");
3552
+ const destinationPath = (0, _stryke_path_is_parent_path.isParentPath)((0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot), (0, _stryke_path_append.appendPath)(context.config.root, context.workspaceConfig.workspaceRoot)) ? (0, _stryke_path_join_paths.joinPaths)(context.config.output.copy.path, (0, _stryke_path_file_path_fns.relativePath)((0, _stryke_path_append.appendPath)(context.config.root, context.workspaceConfig.workspaceRoot), (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot))) : (0, _stryke_path_join_paths.joinPaths)(context.config.output.copy.path, "dist");
3554
3553
  const sourcePath = (0, _stryke_path_append.appendPath)(context.config.output.path, context.workspaceConfig.workspaceRoot);
3555
- const destinationPath = (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(context.config.output.publishPath, context.workspaceConfig.workspaceRoot), "dist");
3556
- if (context.fs.existsSync(sourcePath) && sourcePath !== destinationPath) {
3557
- context.debug(`Copying output files from project's output directory (${context.config.output.path}) to the publish output directory (${context.config.output.publishPath}).`);
3558
- await context.fs.copy(sourcePath, destinationPath);
3559
- }
3560
- }
3561
- await Promise.all(context.config.output.assets.map(async (asset) => {
3562
- context.trace(`Copying asset(s): ${chalk.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : (0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.input, context.workspaceConfig.workspaceRoot)))} -> ${chalk.default.greenBright((0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.output, context.workspaceConfig.workspaceRoot)))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk.default.yellowBright(i)).join(", ")})` : ""}`);
3563
- await context.fs.copy(asset, asset.output);
3564
- }));
3554
+ if ((0, _stryke_fs_exists.existsSync)(sourcePath) && sourcePath !== destinationPath) {
3555
+ context.debug(`Copying files from project's build output directory (${context.config.output.path}) to the project's copy/publish directory (${destinationPath}).`);
3556
+ await (0, _stryke_fs_copy_file.copyFiles)(sourcePath, destinationPath);
3557
+ } else context.warn(`The source path for the copy operation ${!(0, _stryke_fs_exists.existsSync)(sourcePath) ? "does not exist" : "is the same as the destination path"}. Source: ${sourcePath}, Destination: ${destinationPath}. Skipping copying of build output files.`);
3558
+ if (context.config.output.copy.assets && Array.isArray(context.config.output.copy.assets)) await Promise.all(context.config.output.copy.assets.map(async (asset) => {
3559
+ context.trace(`Copying asset(s): ${chalk.default.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : (0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.input, context.workspaceConfig.workspaceRoot)))} -> ${chalk.default.greenBright((0, _stryke_path_append.appendPath)(asset.glob, (0, _stryke_path_replace.replacePath)(asset.output, context.workspaceConfig.workspaceRoot)))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk.default.yellowBright(i)).join(", ")})` : ""}`);
3560
+ await context.fs.copy(asset, asset.output);
3561
+ }));
3562
+ } else context.debug("No copy configuration found for the project output. Skipping the copying of build output files.");
3565
3563
  await this.callHook("build", {
3566
3564
  environment: context,
3567
3565
  order: "post"
@@ -1,13 +1,15 @@
1
1
  import { n as __reExport, t as __exportAll } from "./chunk-CtajNgzt.mjs";
2
- import { a as isIncludeMatchFound, i as getTsconfigFilePath, l as createProgram, r as getParsedTypeScriptConfig } from "./tsconfig-D9GCB2I9.mjs";
2
+ import { a as isIncludeMatchFound, i as getTsconfigFilePath, l as createProgram, r as getParsedTypeScriptConfig } from "./tsconfig-DcW7-RGh.mjs";
3
3
  import { t as plugin_utils_exports } from "./plugin-utils.mjs";
4
4
  import { t as constants_exports } from "./constants.mjs";
5
5
  import { t as config_exports } from "./config.mjs";
6
6
  import { t as utils_exports } from "./utils.mjs";
7
- import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-DvkJm7gK.mjs";
7
+ import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-B0n7dKeA.mjs";
8
8
  import { getWorkspaceRoot, relativeToWorkspaceRoot } from "@stryke/fs/get-workspace-root";
9
9
  import { formatLogMessage } from "@storm-software/config-tools/logger/console";
10
10
  import { toArray } from "@stryke/convert/to-array";
11
+ import { copyFiles } from "@stryke/fs/copy-file";
12
+ import { existsSync } from "@stryke/fs/exists";
11
13
  import { createDirectory } from "@stryke/fs/helpers";
12
14
  import { install } from "@stryke/fs/install";
13
15
  import { listFiles } from "@stryke/fs/list-files";
@@ -15,6 +17,8 @@ import { doesPackageMatch, getPackageListing, isPackageExists, isPackageListed }
15
17
  import { getResolutionCombinations, resolve, resolvePackage, resolveSync } from "@stryke/fs/resolve";
16
18
  import { omit } from "@stryke/helpers/omit";
17
19
  import { appendPath } from "@stryke/path/append";
20
+ import { findFileDotExtensionSafe, findFileExtensionSafe, findFileName, findFilePath, hasFileExtension, relativePath } from "@stryke/path/file-path-fns";
21
+ import { isParentPath } from "@stryke/path/is-parent-path";
18
22
  import { joinPaths } from "@stryke/path/join-paths";
19
23
  import { replaceExtension, replacePath } from "@stryke/path/replace";
20
24
  import { isError } from "@stryke/type-checks/is-error";
@@ -28,13 +32,10 @@ import { isSetString } from "@stryke/type-checks/is-set-string";
28
32
  import { isString } from "@stryke/type-checks/is-string";
29
33
  import chalk from "chalk";
30
34
  import Handlebars from "handlebars";
31
- import { findFileDotExtensionSafe, findFileExtensionSafe, findFileName, findFilePath, hasFileExtension, relativePath } from "@stryke/path/file-path-fns";
32
- import { isParentPath } from "@stryke/path/is-parent-path";
33
35
  import { prettyBytes } from "@stryke/string-format/pretty-bytes";
34
36
  import { DiagnosticCategory } from "ts-morph";
35
37
  import defu$1, { createDefu, defu } from "defu";
36
38
  import { getPackageName, getPackageVersion, hasPackageVersion } from "@stryke/string-format/package";
37
- import { existsSync } from "@stryke/fs/exists";
38
39
  import { readJsonFile } from "@stryke/fs/json";
39
40
  import "@stryke/fs/remove-file";
40
41
  import { kebabCase } from "@stryke/string-format/kebab-case";
@@ -72,7 +73,7 @@ import { setParseImpl } from "unplugin";
72
73
 
73
74
  //#region package.json
74
75
  var name = "powerlines";
75
- var version = "0.42.4";
76
+ var version = "0.42.6";
76
77
 
77
78
  //#endregion
78
79
  //#region src/_internal/helpers/generate-types.ts
@@ -1122,8 +1123,8 @@ var VirtualFileSystem = class VirtualFileSystem {
1122
1123
  if (!this.#resolverCache) this.#resolverCache = create({
1123
1124
  cacheId: "module-resolution",
1124
1125
  cacheDir: this.#context.cachePath,
1125
- ttl: 120 * 1e3,
1126
- lruSize: 5e3,
1126
+ ttl: 2.5 * 60 * 1e3,
1127
+ lruSize: 8e3,
1127
1128
  persistInterval: 100
1128
1129
  });
1129
1130
  return this.#resolverCache;
@@ -1166,8 +1167,8 @@ var VirtualFileSystem = class VirtualFileSystem {
1166
1167
  ...this.#context.config.output.storage
1167
1168
  };
1168
1169
  this.#storage.virtual ??= new VirtualStorageAdapter(context, { base: "/_virtual" });
1169
- if (this.#context.config.output.publishPath) this.#storage[this.#context.config.output.publishPath] ??= new FileSystemStorageAdapter(context, { base: this.#context.config.output.publishPath });
1170
1170
  this.#storage[this.#context.config.output.path] ??= new FileSystemStorageAdapter(context, { base: this.#context.config.output.path });
1171
+ if (this.#context.config.output.copy && this.#context.config.output.copy.path) this.#storage[this.#context.config.output.copy.path] ??= new FileSystemStorageAdapter(context, { base: this.#context.config.output.copy.path });
1171
1172
  if (this.#context.config.output.storage !== "fs") {
1172
1173
  this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.artifactsPath });
1173
1174
  this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.builtinsPath });
@@ -1902,8 +1903,12 @@ var PowerlinesContext = class PowerlinesContext {
1902
1903
  * The logger function
1903
1904
  */
1904
1905
  get log() {
1905
- if (!this.logFn) this.logFn = this.createLog();
1906
- return this.logFn;
1906
+ const level = this.config.logLevel || "info";
1907
+ if (!this.logger || this.logger.level !== level) this.logger = {
1908
+ log: this.createLog(),
1909
+ level
1910
+ };
1911
+ return this.logger.log;
1907
1912
  }
1908
1913
  /**
1909
1914
  * The workspace configuration
@@ -2508,7 +2513,7 @@ var PowerlinesContext = class PowerlinesContext {
2508
2513
  /**
2509
2514
  * A logger function specific to this context
2510
2515
  */
2511
- logFn;
2516
+ logger;
2512
2517
  /**
2513
2518
  * Initialize the context with the provided configuration options
2514
2519
  *
@@ -2576,11 +2581,7 @@ var PowerlinesContext = class PowerlinesContext {
2576
2581
  description: this.packageJson?.description,
2577
2582
  output: (0, plugin_utils_exports.mergeConfig)(config.output ?? {}, {
2578
2583
  path: cacheKey.root ? appendPath(joinPaths$1(cacheKey.root, "dist"), this.workspaceConfig?.workspaceRoot) : void 0,
2579
- publishPath: this.workspaceConfig?.directories?.build && cacheKey.root ? appendPath(appendPath(cacheKey.root, this.workspaceConfig?.directories?.build || "dist"), this.workspaceConfig?.workspaceRoot) : cacheKey.root ? appendPath(appendPath(cacheKey.root, this.workspaceConfig?.directories?.build || "dist"), this.workspaceConfig?.workspaceRoot) : void 0,
2580
- artifactsPath: `.${config.framework ?? "powerlines"}`,
2581
- dts: true,
2582
- typegen: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`),
2583
- assets: [
2584
+ copy: { assets: [
2584
2585
  { glob: "LICENSE" },
2585
2586
  {
2586
2587
  input: cacheKey.root,
@@ -2590,7 +2591,10 @@ var PowerlinesContext = class PowerlinesContext {
2590
2591
  input: cacheKey.root,
2591
2592
  glob: "package.json"
2592
2593
  }
2593
- ]
2594
+ ] },
2595
+ artifactsPath: `.${config.framework ?? "powerlines"}`,
2596
+ dts: true,
2597
+ typegen: joinPaths$1(cacheKey.root, `${config.framework ?? "powerlines"}.d.ts`)
2594
2598
  })
2595
2599
  }, options.isHighPriority ? {} : this.#getConfigProps(config), {
2596
2600
  inlineConfig: {},
@@ -2614,19 +2618,17 @@ var PowerlinesContext = class PowerlinesContext {
2614
2618
  if (this.config.resolve.noExternal) this.config.resolve.noExternal = getUnique(this.config.resolve.noExternal);
2615
2619
  this.config.output.format = getUnique(toArray(this.config.output?.format ?? (this.config.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
2616
2620
  if (this.config.output.dts !== false && !this.config.output.typegen) this.config.output.typegen = `${this.config.root ? `${this.config.root}/` : ""}${this.config.framework ?? "powerlines"}.d.ts`;
2617
- if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) {
2618
- this.config.output.path ??= joinPaths$1(this.config.root, "dist");
2619
- if (this.config.output.publishPath !== false) this.config.output.publishPath ??= joinPaths$1("dist", this.config.root);
2620
- } else {
2621
- this.config.output.path ??= "dist";
2622
- if (this.config.output.publishPath !== false) this.config.output.publishPath ??= this.config.output.path;
2623
- }
2624
- if (this.config.output.publishPath === false) this.config.output.assets = [];
2625
- else this.config.output.assets = getUniqueBy(this.config.output.assets.map((asset) => {
2621
+ if (this.config.root && this.config.root !== "." && this.config.root !== "./" && this.config.root !== this.workspaceConfig.workspaceRoot) this.config.output.path ??= joinPaths$1(this.config.root, "dist");
2622
+ else this.config.output.path ??= "dist";
2623
+ if (this.config.root && this.config.output.copy !== false) this.config.output.copy = {
2624
+ path: joinPaths$1(this.workspaceConfig.workspaceRoot, "dist", replacePath(this.config.root, this.workspaceConfig.workspaceRoot)),
2625
+ ...this.config.output.copy || {}
2626
+ };
2627
+ if (this.config.output.copy && this.config.output.copy.path && this.config.output.copy.assets && Array.isArray(this.config.output.copy.assets)) this.config.output.copy.assets = getUniqueBy(this.config.output.copy.assets.map((asset) => {
2626
2628
  return {
2627
2629
  glob: isSetObject(asset) ? asset.glob : asset,
2628
2630
  input: isString(asset) || !asset.input || asset.input === "." || asset.input === "/" || asset.input === "./" ? this.workspaceConfig.workspaceRoot : isParentPath(asset.input, this.workspaceConfig.workspaceRoot) || asset.input === this.workspaceConfig.workspaceRoot ? asset.input : appendPath(asset.input, this.workspaceConfig.workspaceRoot),
2629
- output: isSetObject(asset) && asset.output ? isParentPath(asset.output, this.workspaceConfig.workspaceRoot) ? asset.output : appendPath(joinPaths$1(this.config.output.publishPath || this.config.output.path, replacePath(replacePath(asset.output, replacePath(this.config.output.publishPath || this.config.output.path, this.workspaceConfig.workspaceRoot)), this.config.output.publishPath || this.config.output.path)), this.workspaceConfig.workspaceRoot) : appendPath(this.config.output.publishPath || this.config.output.path, this.workspaceConfig.workspaceRoot),
2631
+ output: isSetObject(asset) && asset.output ? isParentPath(asset.output, this.workspaceConfig.workspaceRoot) ? asset.output : appendPath(joinPaths$1(this.config.output.copy.path, replacePath(replacePath(asset.output, replacePath(this.config.output.copy.path, this.workspaceConfig.workspaceRoot)), this.config.output.copy.path)), this.workspaceConfig.workspaceRoot) : appendPath(this.config.output.copy.path, this.workspaceConfig.workspaceRoot),
2630
2632
  ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
2631
2633
  };
2632
2634
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
@@ -2638,7 +2640,7 @@ var PowerlinesContext = class PowerlinesContext {
2638
2640
  if (this.config.tsconfig) this.config.tsconfig = (0, plugin_utils_exports.replacePathTokens)(this, this.config.tsconfig);
2639
2641
  if (this.config.output.typegen) if (isSetString(this.config.output.typegen)) this.config.output.typegen = (0, plugin_utils_exports.replacePathTokens)(this, this.config.output.typegen);
2640
2642
  else this.config.output.typegen = joinPaths$1(this.config.root, `${this.config.framework ?? "powerlines"}.d.ts`);
2641
- if (this.config.output.assets) this.config.output.assets = this.config.output.assets.map((asset) => ({
2643
+ if (this.config.output.copy && this.config.output.copy.assets) this.config.output.copy.assets = this.config.output.copy.assets.map((asset) => ({
2642
2644
  ...asset,
2643
2645
  glob: (0, plugin_utils_exports.replacePathTokens)(this, asset.glob),
2644
2646
  ignore: asset.ignore ? asset.ignore.map((ignore) => (0, plugin_utils_exports.replacePathTokens)(this, ignore)) : void 0,
@@ -3013,7 +3015,6 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3013
3015
  var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext {
3014
3016
  #environments = {};
3015
3017
  #plugins = [];
3016
- #log;
3017
3018
  /**
3018
3019
  * Create a new Storm context from the workspace root and user config.
3019
3020
  *
@@ -3058,10 +3059,6 @@ var PowerlinesAPIContext = class PowerlinesAPIContext extends PowerlinesContext
3058
3059
  get environments() {
3059
3060
  return this.#environments;
3060
3061
  }
3061
- get log() {
3062
- if (!this.#log) this.#log = this.createLog();
3063
- return this.#log;
3064
- }
3065
3062
  get plugins() {
3066
3063
  return this.#plugins;
3067
3064
  }
@@ -3447,7 +3444,7 @@ var PowerlinesAPI = class PowerlinesAPI {
3447
3444
  this.context.info(" 📦 Building the Powerlines project");
3448
3445
  await this.context.generateChecksum();
3449
3446
  if (this.context.meta.checksum !== this.context.persistedMeta?.checksum || this.context.config.skipCache) {
3450
- this.context.info("The project has been modified since the last time `prepare` was ran. Re-preparing the project.");
3447
+ this.context.info(!this.context.persistedMeta?.checksum ? "No previous build cache found. Preparing the project for the initial build." : this.context.meta.checksum !== this.context.persistedMeta.checksum ? "The project has been modified since the last time `prepare` was ran. Re-preparing the project." : "The project is configured to skip cache. Re-preparing the project.");
3451
3448
  inlineConfig.command ??= "build";
3452
3449
  await this.prepare(inlineConfig);
3453
3450
  }
@@ -3547,18 +3544,19 @@ var PowerlinesAPI = class PowerlinesAPI {
3547
3544
  environment: context,
3548
3545
  order: "normal"
3549
3546
  });
3550
- if (context.config.output.publishPath && context.config.output.path !== context.config.output.publishPath) {
3547
+ if (context.config.output.copy) {
3548
+ context.debug("Copying project's files from build output directory.");
3549
+ const destinationPath = isParentPath(appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot), appendPath(context.config.root, context.workspaceConfig.workspaceRoot)) ? joinPaths(context.config.output.copy.path, relativePath(appendPath(context.config.root, context.workspaceConfig.workspaceRoot), appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot))) : joinPaths(context.config.output.copy.path, "dist");
3551
3550
  const sourcePath = appendPath(context.config.output.path, context.workspaceConfig.workspaceRoot);
3552
- const destinationPath = joinPaths(appendPath(context.config.output.publishPath, context.workspaceConfig.workspaceRoot), "dist");
3553
- if (context.fs.existsSync(sourcePath) && sourcePath !== destinationPath) {
3554
- context.debug(`Copying output files from project's output directory (${context.config.output.path}) to the publish output directory (${context.config.output.publishPath}).`);
3555
- await context.fs.copy(sourcePath, destinationPath);
3556
- }
3557
- }
3558
- await Promise.all(context.config.output.assets.map(async (asset) => {
3559
- context.trace(`Copying asset(s): ${chalk.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : appendPath(asset.glob, replacePath(asset.input, context.workspaceConfig.workspaceRoot)))} -> ${chalk.greenBright(appendPath(asset.glob, replacePath(asset.output, context.workspaceConfig.workspaceRoot)))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk.yellowBright(i)).join(", ")})` : ""}`);
3560
- await context.fs.copy(asset, asset.output);
3561
- }));
3551
+ if (existsSync(sourcePath) && sourcePath !== destinationPath) {
3552
+ context.debug(`Copying files from project's build output directory (${context.config.output.path}) to the project's copy/publish directory (${destinationPath}).`);
3553
+ await copyFiles(sourcePath, destinationPath);
3554
+ } else context.warn(`The source path for the copy operation ${!existsSync(sourcePath) ? "does not exist" : "is the same as the destination path"}. Source: ${sourcePath}, Destination: ${destinationPath}. Skipping copying of build output files.`);
3555
+ if (context.config.output.copy.assets && Array.isArray(context.config.output.copy.assets)) await Promise.all(context.config.output.copy.assets.map(async (asset) => {
3556
+ context.trace(`Copying asset(s): ${chalk.redBright(context.workspaceConfig.workspaceRoot === asset.input ? asset.glob : appendPath(asset.glob, replacePath(asset.input, context.workspaceConfig.workspaceRoot)))} -> ${chalk.greenBright(appendPath(asset.glob, replacePath(asset.output, context.workspaceConfig.workspaceRoot)))} ${Array.isArray(asset.ignore) && asset.ignore.length > 0 ? ` (ignoring: ${asset.ignore.map((i) => chalk.yellowBright(i)).join(", ")})` : ""}`);
3557
+ await context.fs.copy(asset, asset.output);
3558
+ }));
3559
+ } else context.debug("No copy configuration found for the project output. Skipping the copying of build output files.");
3562
3560
  await this.callHook("build", {
3563
3561
  environment: context,
3564
3562
  order: "post"
@@ -3783,4 +3781,4 @@ ${formatTypes(types)}
3783
3781
 
3784
3782
  //#endregion
3785
3783
  export { createUnpluginFactory as a, FileMetadata as c, FileSystem as d, _capnpFileId as f, createPluginContext as i, FileMetadata_KeyValuePair as l, version as m, PowerlinesAPIContext as n, PowerlinesContext as o, name as p, PowerlinesEnvironmentContext as r, FileId as s, PowerlinesAPI as t, FileStorage as u };
3786
- //# sourceMappingURL=api-BPqm4eLe.mjs.map
3784
+ //# sourceMappingURL=api-QF6YGs6J.mjs.map