powerlines 0.42.4 → 0.42.7

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-BPqm4eLe.mjs → api-Ad5YIsnZ.mjs} +45 -47
  2. package/dist/api-Ad5YIsnZ.mjs.map +1 -0
  3. package/dist/{api-DQGouFwU.cjs → api-B6pHJuxy.cjs} +44 -46
  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 +17 -17
  54. package/dist/api-BPqm4eLe.mjs.map +0 -1
@@ -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.7";
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-Ad5YIsnZ.mjs.map