@powerlines/nx 0.11.240 → 0.11.241

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 (56) hide show
  1. package/dist/src/base/base-executor.d.mts +1 -1
  2. package/dist/src/base/base-executor.d.ts +1 -1
  3. package/dist/src/base/base-executor.js +1 -1
  4. package/dist/src/base/base-executor.mjs +1 -1
  5. package/dist/src/base/index.d.mts +1 -1
  6. package/dist/src/base/index.d.ts +1 -1
  7. package/dist/src/base/index.js +1 -1
  8. package/dist/src/base/index.mjs +1 -1
  9. package/dist/src/{base-executor-Bqr3-YkU.mjs → base-executor-BvEsnkBL.mjs} +55 -25
  10. package/dist/src/base-executor-BvEsnkBL.mjs.map +1 -0
  11. package/dist/src/{base-executor-yjvW7EQ1.d.ts → base-executor-CZijjH-b.d.ts} +12 -3
  12. package/dist/src/{base-executor-yjvW7EQ1.d.ts.map → base-executor-CZijjH-b.d.ts.map} +1 -1
  13. package/dist/src/{base-executor-CkwqGHfN.js → base-executor-CcbUno8j.js} +54 -24
  14. package/dist/src/base-executor-DZRSu2uF.mjs +4658 -0
  15. package/dist/src/base-executor-DZRSu2uF.mjs.map +1 -0
  16. package/dist/src/{base-executor-BcCIQY-2.d.mts → base-executor-kPTbnW7K.d.mts} +12 -3
  17. package/dist/src/{base-executor-BcCIQY-2.d.mts.map → base-executor-kPTbnW7K.d.mts.map} +1 -1
  18. package/dist/src/base-executor-pl95GpNV.js +4676 -0
  19. package/dist/src/base-executor.untyped-7SvGKXcO.d.mts +7 -0
  20. package/dist/src/base-executor.untyped-7SvGKXcO.d.mts.map +1 -0
  21. package/dist/src/executors/build/executor.d.mts +1 -1
  22. package/dist/src/executors/build/executor.d.ts +1 -1
  23. package/dist/src/executors/build/executor.js +1 -1
  24. package/dist/src/executors/build/executor.mjs +1 -1
  25. package/dist/src/executors/build/untyped.d.mts +2 -2
  26. package/dist/src/executors/clean/executor.d.mts +1 -1
  27. package/dist/src/executors/clean/executor.d.ts +1 -1
  28. package/dist/src/executors/clean/executor.js +1 -1
  29. package/dist/src/executors/clean/executor.mjs +1 -1
  30. package/dist/src/executors/clean/untyped.d.mts +2 -2
  31. package/dist/src/executors/clean/untyped.d.ts +2 -2
  32. package/dist/src/executors/docs/executor.d.mts +1 -1
  33. package/dist/src/executors/docs/executor.d.ts +1 -1
  34. package/dist/src/executors/docs/executor.js +1 -1
  35. package/dist/src/executors/docs/executor.mjs +1 -1
  36. package/dist/src/executors/docs/untyped.d.mts +2 -2
  37. package/dist/src/executors/docs/untyped.d.ts +2 -2
  38. package/dist/src/executors/lint/executor.d.mts +1 -1
  39. package/dist/src/executors/lint/executor.d.ts +1 -1
  40. package/dist/src/executors/lint/executor.js +1 -1
  41. package/dist/src/executors/lint/executor.mjs +1 -1
  42. package/dist/src/executors/lint/untyped.d.mts +2 -2
  43. package/dist/src/executors/lint/untyped.d.ts +2 -2
  44. package/dist/src/executors/prepare/executor.d.mts +1 -1
  45. package/dist/src/executors/prepare/executor.d.ts +1 -1
  46. package/dist/src/executors/prepare/executor.js +1 -1
  47. package/dist/src/executors/prepare/executor.mjs +1 -1
  48. package/dist/src/executors/prepare/untyped.d.mts +2 -2
  49. package/dist/src/executors/prepare/untyped.d.ts +2 -2
  50. package/dist/src/generators/sync/untyped.d.ts +2 -2
  51. package/dist/src/index.d.mts +1 -1
  52. package/dist/src/index.d.ts +1 -1
  53. package/dist/src/index.js +1 -1
  54. package/dist/src/index.mjs +1 -1
  55. package/package.json +10 -10
  56. package/dist/src/base-executor-Bqr3-YkU.mjs.map +0 -1
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-BcCIQY-2.mjs";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-kPTbnW7K.mjs";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-yjvW7EQ1.js";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CZijjH-b.js";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,4 +1,4 @@
1
1
  require('../config-CGQhS8tm.js');
2
- const require_base_executor = require('../base-executor-CkwqGHfN.js');
2
+ const require_base_executor = require('../base-executor-CcbUno8j.js');
3
3
 
4
4
  exports.withExecutor = require_base_executor.withExecutor;
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../base-executor-Bqr3-YkU.mjs";
1
+ import { t as withExecutor } from "../base-executor-BvEsnkBL.mjs";
2
2
  import "../config-LoR-NIJg.mjs";
3
3
 
4
4
  export { withExecutor };
@@ -1,4 +1,4 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-BcCIQY-2.mjs";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-kPTbnW7K.mjs";
2
2
  import "../base-executor.untyped-imww7Gm9.mjs";
3
3
  import "../index-LhFpnU-f.mjs";
4
4
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,2 +1,2 @@
1
- import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-yjvW7EQ1.js";
1
+ import { n as withExecutor, t as PowerlinesExecutorContext } from "../base-executor-CZijjH-b.js";
2
2
  export { PowerlinesExecutorContext, withExecutor };
@@ -1,5 +1,5 @@
1
1
  require('../config-CGQhS8tm.js');
2
- const require_base_executor = require('../base-executor-CkwqGHfN.js');
2
+ const require_base_executor = require('../base-executor-CcbUno8j.js');
3
3
  require('../base-executor.untyped-Cz1Zw_02.js');
4
4
  require('../base-B7jekb-W.js');
5
5
 
@@ -1,4 +1,4 @@
1
- import { t as withExecutor } from "../base-executor-Bqr3-YkU.mjs";
1
+ import { t as withExecutor } from "../base-executor-BvEsnkBL.mjs";
2
2
  import "../config-LoR-NIJg.mjs";
3
3
  import "../base-executor.untyped-C1pQETnQ.mjs";
4
4
  import "../base-BRSa-clf.mjs";
@@ -78,7 +78,7 @@ import Diff from "diff-match-patch";
78
78
  import "unplugin";
79
79
 
80
80
  //#region ../powerlines/package.json
81
- var version = "0.39.19";
81
+ var version = "0.40.0";
82
82
 
83
83
  //#endregion
84
84
  //#region ../powerlines/src/typescript/ts-morph.ts
@@ -1187,9 +1187,11 @@ var BaseStorageAdapter = class {
1187
1187
  /**
1188
1188
  * Constructor for the BaseStorageAdapter.
1189
1189
  *
1190
+ * @param context - The Powerlines context.
1190
1191
  * @param options - Configuration options for the storage adapter.
1191
1192
  */
1192
- constructor(options = { base: "/" }) {
1193
+ constructor(context, options = { base: "/" }) {
1194
+ this.context = context;
1193
1195
  this.options = options;
1194
1196
  this.options.base = resolve$1(options.base);
1195
1197
  this.options.isReadOnly = !!options.isReadOnly;
@@ -1219,7 +1221,7 @@ var BaseStorageAdapter = class {
1219
1221
  * @param value - The value to set.
1220
1222
  */
1221
1223
  async set(key, value) {
1222
- if (!this.options.isReadOnly) this.setSync(key, value);
1224
+ if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) this.setSync(key, value);
1223
1225
  }
1224
1226
  /**
1225
1227
  * Synchronously creates a directory at the specified path.
@@ -1241,7 +1243,7 @@ var BaseStorageAdapter = class {
1241
1243
  * @param key - The key to remove.
1242
1244
  */
1243
1245
  async remove(key) {
1244
- if (!this.options.isReadOnly) this.removeSync(key);
1246
+ if (!this.isReadOnly && this.overwrite) this.removeSync(key);
1245
1247
  }
1246
1248
  /**
1247
1249
  * Synchronously removes all entries from the storage that match the provided base path.
@@ -1249,7 +1251,7 @@ var BaseStorageAdapter = class {
1249
1251
  * @param base - The base path to clear keys from.
1250
1252
  */
1251
1253
  clearSync(base) {
1252
- if (!this.options.isReadOnly) {
1254
+ if (!this.isReadOnly && this.overwrite) {
1253
1255
  const keys = this.listSync(base || this.options.base);
1254
1256
  if (!keys.length) return;
1255
1257
  keys.map((key) => this.removeSync(base && !key.startsWith(base) ? joinPaths$1(base, key) : key));
@@ -1262,7 +1264,7 @@ var BaseStorageAdapter = class {
1262
1264
  * @returns A promise that resolves when the operation is complete.
1263
1265
  */
1264
1266
  async clear(base) {
1265
- if (!this.options.isReadOnly) {
1267
+ if (!this.isReadOnly && this.overwrite) {
1266
1268
  const keys = await this.list(base || this.options.base);
1267
1269
  if (!keys.length) return;
1268
1270
  await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? joinPaths$1(base, key) : key)));
@@ -1330,6 +1332,22 @@ var BaseStorageAdapter = class {
1330
1332
  return this._dispose();
1331
1333
  }
1332
1334
  /**
1335
+ * Determines if the storage adapter is read-only based on the provided options.
1336
+ *
1337
+ * @returns `true` if the storage adapter is read-only, otherwise `false`.
1338
+ */
1339
+ get isReadOnly() {
1340
+ return !!this.options.isReadOnly;
1341
+ }
1342
+ /**
1343
+ * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.
1344
+ *
1345
+ * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.
1346
+ */
1347
+ get overwrite() {
1348
+ return !this.isReadOnly && this.context.config.output.overwrite !== false;
1349
+ }
1350
+ /**
1333
1351
  * Resolves a given key to its full path within the storage adapter.
1334
1352
  *
1335
1353
  * @param key - The key to resolve.
@@ -1394,10 +1412,11 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1394
1412
  /**
1395
1413
  * Constructor for the FileSystemStorageAdapter.
1396
1414
  *
1415
+ * @param context - The Powerlines context.
1397
1416
  * @param options - Configuration options for the storage adapter.
1398
1417
  */
1399
- constructor(options) {
1400
- super(options);
1418
+ constructor(context, options) {
1419
+ super(context, options);
1401
1420
  }
1402
1421
  /**
1403
1422
  * Synchronously checks if a key exists in the storage.
@@ -1442,7 +1461,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1442
1461
  * @param value - The value to set.
1443
1462
  */
1444
1463
  setSync(key, value) {
1445
- if (!this.options.isReadOnly) return writeFileSync(this.resolve(key), value);
1464
+ if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) return writeFileSync(this.resolve(key), value);
1446
1465
  }
1447
1466
  /**
1448
1467
  * Asynchronously sets the value for a given key.
@@ -1451,7 +1470,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1451
1470
  * @param value - The value to set.
1452
1471
  */
1453
1472
  async set(key, value) {
1454
- if (!this.options.isReadOnly) return writeFile(this.resolve(key), value);
1473
+ if (!this.isReadOnly && this.overwrite) return writeFile(this.resolve(key), value);
1455
1474
  }
1456
1475
  /**
1457
1476
  * Synchronously removes a key from the storage.
@@ -1459,7 +1478,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1459
1478
  * @param key - The key to remove.
1460
1479
  */
1461
1480
  removeSync(key) {
1462
- if (!this.options.isReadOnly) try {
1481
+ if (!this.isReadOnly && this.overwrite) try {
1463
1482
  return unlinkSync(this.resolve(key));
1464
1483
  } catch (err) {
1465
1484
  return ignoreNotfound(err);
@@ -1471,7 +1490,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
1471
1490
  * @param key - The key to remove.
1472
1491
  */
1473
1492
  async remove(key) {
1474
- if (!this.options.isReadOnly) return unlink(this.resolve(key)).catch(ignoreNotfound);
1493
+ if (!this.isReadOnly && this.overwrite) return unlink(this.resolve(key)).catch(ignoreNotfound);
1475
1494
  }
1476
1495
  /**
1477
1496
  * Synchronously creates a directory at the specified path.
@@ -1555,10 +1574,11 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1555
1574
  /**
1556
1575
  * Constructor for the VirtualStorageAdapter.
1557
1576
  *
1577
+ * @param context - The Powerlines context.
1558
1578
  * @param options - Configuration options for the storage adapter.
1559
1579
  */
1560
- constructor(options) {
1561
- super(options);
1580
+ constructor(context, options) {
1581
+ super(context, options);
1562
1582
  }
1563
1583
  /**
1564
1584
  * Synchronously checks if a key exists in the storage.
@@ -1585,7 +1605,7 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1585
1605
  * @param value - The value to set.
1586
1606
  */
1587
1607
  setSync(key, value) {
1588
- if (!this.options.isReadOnly) this.data.set(this.resolve(key), value);
1608
+ if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) this.data.set(this.resolve(key), value);
1589
1609
  }
1590
1610
  /**
1591
1611
  * Synchronously removes a key from the storage.
@@ -1593,7 +1613,7 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1593
1613
  * @param key - The key to remove.
1594
1614
  */
1595
1615
  removeSync(key) {
1596
- if (!this.options.isReadOnly) this.data.delete(this.resolve(key));
1616
+ if (!this.isReadOnly && this.overwrite) this.data.delete(this.resolve(key));
1597
1617
  }
1598
1618
  /**
1599
1619
  * Lists all keys under a given base path synchronously.
@@ -1612,6 +1632,14 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
1612
1632
  async dispose() {
1613
1633
  return this.clear();
1614
1634
  }
1635
+ /**
1636
+ * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.
1637
+ *
1638
+ * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.
1639
+ */
1640
+ get overwrite() {
1641
+ return !this.isReadOnly;
1642
+ }
1615
1643
  };
1616
1644
 
1617
1645
  //#endregion
@@ -1735,8 +1763,8 @@ const extendLog = (logFn, name) => {
1735
1763
  //#region ../core/src/lib/utilities/file-header.ts
1736
1764
  function getBaseFileHeader(context) {
1737
1765
  return `
1738
- // Generated with ${titleCase(context.config.framework)}
1739
- // Note: Do not edit this file manually - it will be overwritten automatically
1766
+ // Generated by ${titleCase(context.config.framework) || "Powerlines"}
1767
+ ${context.config.output?.overwrite !== false ? `// Do not edit this file manually - it will be overwritten automatically. Automatic overwrites can be disabled by using the \`output.overwrite\` option.` : `// This file was generated on ${(/* @__PURE__ */ new Date()).toLocaleString()} - it will not be overwritten by ${titleCase(context.config.framework)} while the \`output.overwrite\` option is set to \`true\`.`}
1740
1768
  `;
1741
1769
  }
1742
1770
  function getFileHeader(context, options = {}) {
@@ -1828,7 +1856,7 @@ var VirtualFileSystem = class VirtualFileSystem {
1828
1856
  * @remarks
1829
1857
  * This volume allows for seamless access to both virtual and real files.
1830
1858
  */
1831
- #storage = { "": new FileSystemStorageAdapter() };
1859
+ #storage;
1832
1860
  /**
1833
1861
  * A cache for module resolution results.
1834
1862
  */
@@ -1886,7 +1914,7 @@ var VirtualFileSystem = class VirtualFileSystem {
1886
1914
  relativeKey: path,
1887
1915
  adapter: this.#storage[""]
1888
1916
  };
1889
- this.#storage[path] = preset === "virtual" ? new VirtualStorageAdapter({ base: path }) : new FileSystemStorageAdapter({ base: path });
1917
+ this.#storage[path] = preset === "virtual" ? new VirtualStorageAdapter(this.#context, { base: path }) : new FileSystemStorageAdapter(this.#context, { base: path });
1890
1918
  return {
1891
1919
  base: path,
1892
1920
  relativeKey: "",
@@ -2069,15 +2097,16 @@ var VirtualFileSystem = class VirtualFileSystem {
2069
2097
  */
2070
2098
  constructor(context, fs) {
2071
2099
  this.#context = context;
2100
+ this.#storage = { "": new FileSystemStorageAdapter(context) };
2072
2101
  if (isSetObject(this.#context.config.output.storage)) this.#storage = {
2073
2102
  ...this.#storage,
2074
2103
  ...this.#context.config.output.storage
2075
2104
  };
2076
- this.#storage.virtual ??= new VirtualStorageAdapter({ base: "/_virtual" });
2105
+ this.#storage.virtual ??= new VirtualStorageAdapter(context, { base: "/_virtual" });
2077
2106
  if (this.#context.config.output.storage !== "fs") {
2078
- this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter({ base: this.#context.artifactsPath });
2079
- this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter({ base: this.#context.builtinsPath });
2080
- this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter({ base: this.#context.entryPath });
2107
+ this.#storage[this.#context.artifactsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.artifactsPath });
2108
+ this.#storage[this.#context.builtinsPath] ??= new VirtualStorageAdapter(context, { base: this.#context.builtinsPath });
2109
+ this.#storage[this.#context.entryPath] ??= new VirtualStorageAdapter(context, { base: this.#context.entryPath });
2081
2110
  }
2082
2111
  this.#metadata = {};
2083
2112
  if (fs._hasMetadata()) this.#metadata = fs.metadata.values().reduce((ret, metadata) => {
@@ -3561,6 +3590,7 @@ var PowerlinesContext = class PowerlinesContext {
3561
3590
  input: replacePathTokens(this, asset.input),
3562
3591
  output: replacePathTokens(this, asset.output)
3563
3592
  }));
3593
+ if (isSetString(config.output?.storage) && config.output.storage === "virtual" || isSetObject(config.output?.storage) && Object.values(config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
3564
3594
  this.#fs ??= await VirtualFileSystem.create(this);
3565
3595
  }
3566
3596
  mergeUserConfig(from = {}, into = this.config.userConfig ?? {}) {
@@ -4625,4 +4655,4 @@ ${error.stack}` : "Unknown error"}`);
4625
4655
 
4626
4656
  //#endregion
4627
4657
  export { withExecutor as t };
4628
- //# sourceMappingURL=base-executor-Bqr3-YkU.mjs.map
4658
+ //# sourceMappingURL=base-executor-BvEsnkBL.mjs.map