powerlines 0.40.2 → 0.40.4

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 (132) hide show
  1. package/dist/{api-CHXfSSj6.mjs → api-BaHkkIMl.mjs} +5 -5
  2. package/dist/{api-CHXfSSj6.mjs.map → api-BaHkkIMl.mjs.map} +1 -1
  3. package/dist/{api-DtumO6qc.cjs → api-XX-usBTN.cjs} +4 -4
  4. package/dist/astro.cjs +5 -5
  5. package/dist/astro.d.cts +1 -1
  6. package/dist/astro.d.mts +5 -5
  7. package/dist/astro.mjs +5 -5
  8. package/dist/{config-CY-rNoQX.d.cts → config-BNcBL0tI.d.cts} +23 -1
  9. package/dist/config-BNcBL0tI.d.cts.map +1 -0
  10. package/dist/{config-BYUOZn2-.d.mts → config-Bu97tgeF.d.cts} +2 -2
  11. package/dist/{config-BYUOZn2-.d.mts.map → config-Bu97tgeF.d.cts.map} +1 -1
  12. package/dist/{config-tAvhtoU3.d.cts → config-D2cqq84p.d.mts} +2 -2
  13. package/dist/{config-tAvhtoU3.d.cts.map → config-D2cqq84p.d.mts.map} +1 -1
  14. package/dist/{config-B76VxuFj.d.mts → config-jcYnkMvq.d.mts} +23 -1
  15. package/dist/config-jcYnkMvq.d.mts.map +1 -0
  16. package/dist/config.d.cts +1 -1
  17. package/dist/config.d.mts +2 -2
  18. package/dist/context/index.cjs +3 -3
  19. package/dist/context/index.d.cts +1 -1
  20. package/dist/context/index.d.mts +4 -4
  21. package/dist/context/index.mjs +3 -3
  22. package/dist/{esbuild-ChH1x8Hc.mjs → esbuild-aZZE7sY8.mjs} +3 -3
  23. package/dist/{esbuild-ChH1x8Hc.mjs.map → esbuild-aZZE7sY8.mjs.map} +1 -1
  24. package/dist/{esbuild-BVasizva.cjs → esbuild-osvOb1W1.cjs} +2 -2
  25. package/dist/esbuild.cjs +5 -5
  26. package/dist/esbuild.d.cts +1 -1
  27. package/dist/esbuild.d.mts +4 -4
  28. package/dist/esbuild.mjs +5 -5
  29. package/dist/farm.cjs +3 -3
  30. package/dist/farm.d.cts +1 -1
  31. package/dist/farm.d.mts +4 -4
  32. package/dist/farm.mjs +3 -3
  33. package/dist/{index-C60deASW.d.mts → index-4WNH8dg3.d.mts} +2 -2
  34. package/dist/{index-C60deASW.d.mts.map → index-4WNH8dg3.d.mts.map} +1 -1
  35. package/dist/{index-BbFz3REx.d.mts → index-BjLkEvse.d.mts} +2 -2
  36. package/dist/{index-BbFz3REx.d.mts.map → index-BjLkEvse.d.mts.map} +1 -1
  37. package/dist/{index-DkZkdzSQ.d.cts → index-Cie2X8UH.d.cts} +2 -2
  38. package/dist/{index-DkZkdzSQ.d.cts.map → index-Cie2X8UH.d.cts.map} +1 -1
  39. package/dist/{write-file-gkuvUoFn.d.cts → index-DP6juTGE.d.mts} +35 -6
  40. package/dist/index-DP6juTGE.d.mts.map +1 -0
  41. package/dist/index.cjs +3 -3
  42. package/dist/index.d.cts +6 -6
  43. package/dist/index.d.mts +6 -6
  44. package/dist/index.mjs +3 -3
  45. package/dist/next.cjs +4 -4
  46. package/dist/next.mjs +4 -4
  47. package/dist/nuxt.cjs +6 -6
  48. package/dist/nuxt.d.cts +1 -1
  49. package/dist/nuxt.d.mts +4 -4
  50. package/dist/nuxt.mjs +6 -6
  51. package/dist/{plugin-DE7BXFkV.d.mts → plugin-CO_BQ0th.d.cts} +2 -2
  52. package/dist/{plugin-DE7BXFkV.d.mts.map → plugin-CO_BQ0th.d.cts.map} +1 -1
  53. package/dist/{plugin-C4Et_TED.d.cts → plugin-CvPFipli.d.cts} +2 -2
  54. package/dist/{plugin-C4Et_TED.d.cts.map → plugin-CvPFipli.d.cts.map} +1 -1
  55. package/dist/plugin-utils.d.cts +1 -1
  56. package/dist/plugin-utils.d.mts +5 -5
  57. package/dist/{plugin-XET4WKK4.d.cts → plugin-xJ2LIFca.d.mts} +2 -2
  58. package/dist/{plugin-XET4WKK4.d.cts.map → plugin-xJ2LIFca.d.mts.map} +1 -1
  59. package/dist/{resolve-options-B1gzDFxb.cjs → resolve-options-BQnTgg3V.cjs} +1 -1
  60. package/dist/{resolve-options-Ym_q-Hb7.mjs → resolve-options-DHL3RM8F.mjs} +2 -2
  61. package/dist/{resolve-options-Ym_q-Hb7.mjs.map → resolve-options-DHL3RM8F.mjs.map} +1 -1
  62. package/dist/{rolldown-BEruRGiG.cjs → rolldown-Bn7LucRb.cjs} +1 -1
  63. package/dist/{rolldown-B9d-UBOh.mjs → rolldown-DW7PjwCw.mjs} +2 -2
  64. package/dist/{rolldown-B9d-UBOh.mjs.map → rolldown-DW7PjwCw.mjs.map} +1 -1
  65. package/dist/rolldown.cjs +4 -4
  66. package/dist/rolldown.d.cts +1 -1
  67. package/dist/rolldown.d.mts +4 -4
  68. package/dist/rolldown.mjs +4 -4
  69. package/dist/rollup.cjs +3 -3
  70. package/dist/rollup.d.cts +1 -1
  71. package/dist/rollup.d.mts +4 -4
  72. package/dist/rollup.mjs +3 -3
  73. package/dist/rspack.cjs +3 -3
  74. package/dist/rspack.d.cts +1 -1
  75. package/dist/rspack.d.mts +4 -4
  76. package/dist/rspack.mjs +3 -3
  77. package/dist/storage/index.cjs +3 -1
  78. package/dist/storage/index.d.cts +1 -1
  79. package/dist/storage/index.d.cts.map +1 -1
  80. package/dist/storage/index.d.mts +4 -4
  81. package/dist/storage/index.d.mts.map +1 -1
  82. package/dist/storage/index.mjs +3 -1
  83. package/dist/tsdown.cjs +4 -4
  84. package/dist/tsdown.d.cts +1 -1
  85. package/dist/tsdown.d.mts +4 -4
  86. package/dist/tsdown.mjs +4 -4
  87. package/dist/tsup.cjs +5 -5
  88. package/dist/tsup.d.cts +1 -1
  89. package/dist/tsup.d.mts +4 -4
  90. package/dist/tsup.mjs +5 -5
  91. package/dist/typescript/index.d.cts +1 -1
  92. package/dist/typescript/index.d.mts +4 -4
  93. package/dist/unloader.cjs +3 -3
  94. package/dist/unloader.d.cts +1 -1
  95. package/dist/unloader.d.mts +4 -4
  96. package/dist/unloader.mjs +3 -3
  97. package/dist/unplugin.cjs +3 -3
  98. package/dist/unplugin.d.cts +2 -2
  99. package/dist/unplugin.d.mts +4 -4
  100. package/dist/unplugin.mjs +3 -3
  101. package/dist/{utils-CxKWmhs2.cjs → utils-BbDma_5Y.cjs} +54 -9
  102. package/dist/{utils-RU0EjpzP.mjs → utils-DoQcX7Sk.mjs} +40 -7
  103. package/dist/{utils-RU0EjpzP.mjs.map → utils-DoQcX7Sk.mjs.map} +1 -1
  104. package/dist/utils.cjs +4 -2
  105. package/dist/utils.d.cts +2 -2
  106. package/dist/utils.d.mts +3 -3
  107. package/dist/utils.mjs +2 -2
  108. package/dist/{virtual-D8bn8LRN.cjs → virtual-B1MLgqnQ.cjs} +10 -2
  109. package/dist/{virtual-D-9vfvVY.mjs → virtual-B9imjOqe.mjs} +11 -3
  110. package/dist/virtual-B9imjOqe.mjs.map +1 -0
  111. package/dist/{vite-BF6-Ngk0.cjs → vite-BqvfCVtZ.cjs} +2 -2
  112. package/dist/{vite-DOMQMT51.mjs → vite-D-iV7jRu.mjs} +3 -3
  113. package/dist/{vite-DOMQMT51.mjs.map → vite-D-iV7jRu.mjs.map} +1 -1
  114. package/dist/vite.cjs +5 -5
  115. package/dist/vite.d.cts +2 -2
  116. package/dist/vite.d.mts +5 -5
  117. package/dist/vite.mjs +5 -5
  118. package/dist/{webpack-u38abx-b.cjs → webpack-D8CVT5MS.cjs} +1 -1
  119. package/dist/{webpack-Bm8A2hrJ.mjs → webpack-HfqSdyWi.mjs} +2 -2
  120. package/dist/{webpack-Bm8A2hrJ.mjs.map → webpack-HfqSdyWi.mjs.map} +1 -1
  121. package/dist/webpack.cjs +4 -4
  122. package/dist/webpack.d.cts +1 -1
  123. package/dist/webpack.d.mts +4 -4
  124. package/dist/webpack.mjs +4 -4
  125. package/dist/{index-TMfRNrCg.d.mts → write-file-DKA8GehT.d.cts} +35 -6
  126. package/dist/write-file-DKA8GehT.d.cts.map +1 -0
  127. package/package.json +13 -13
  128. package/dist/config-B76VxuFj.d.mts.map +0 -1
  129. package/dist/config-CY-rNoQX.d.cts.map +0 -1
  130. package/dist/index-TMfRNrCg.d.mts.map +0 -1
  131. package/dist/virtual-D-9vfvVY.mjs.map +0 -1
  132. package/dist/write-file-gkuvUoFn.d.cts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"virtual-D-9vfvVY.mjs","names":["context: Context","#isDisposed","existsSync"],"sources":["../src/storage/base.ts","../src/storage/helpers.ts","../src/storage/file-system.ts","../src/storage/virtual.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 { appendPath } from \"@stryke/path/append\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport { resolve } from \"node:path\";\nimport type { Context, StorageAdapter, StoragePreset } from \"../types\";\n\nexport interface StorageAdapterOptions {\n base: string;\n isReadOnly?: boolean;\n ignore?: string | string[];\n}\n\n/**\n * Abstract base class for storage adapters, providing a template for storage operations.\n */\nexport abstract class BaseStorageAdapter<\n TOptions extends StorageAdapterOptions = StorageAdapterOptions\n> implements StorageAdapter {\n /**\n * Indicates whether the storage adapter has been disposed.\n */\n #isDisposed = false;\n\n /**\n * A name identifying the storage adapter type.\n */\n public abstract name: string;\n\n /**\n * Configuration options for the storage adapter.\n */\n public options: TOptions;\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public readonly preset?: StoragePreset | null = null;\n\n /**\n * Constructor for the BaseStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(\n protected context: Context,\n options: TOptions = { base: \"/\" } as TOptions\n ) {\n this.options = options;\n this.options.base = resolve(options.base);\n this.options.isReadOnly = !!options.isReadOnly;\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public abstract existsSync(key: string): boolean;\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public async exists(key: string): Promise<boolean> {\n return this.existsSync(key);\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public abstract getSync(key: string): string | null;\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public async get(key: string): Promise<string | null> {\n return this.getSync(key);\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public abstract setSync(key: string, value: string): void;\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.setSync(key, value);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param _ - The path of the directory to create.\n */\n public mkdirSync(_: string) {}\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public async mkdir(dirPath: string): Promise<void> {\n return Promise.resolve(this.mkdirSync(dirPath));\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public abstract removeSync(key: string): void;\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n this.removeSync(key);\n }\n }\n\n /**\n * Synchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n */\n public clearSync(base?: string) {\n if (!this.isReadOnly && this.overwrite) {\n const keys = this.listSync(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n keys.map(key =>\n this.removeSync(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n );\n }\n }\n\n /**\n * Asynchronously removes all entries from the storage that match the provided base path.\n *\n * @param base - The base path to clear keys from.\n * @returns A promise that resolves when the operation is complete.\n */\n public async clear(base?: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n const keys = await this.list(base || this.options.base);\n if (!keys.length) {\n return;\n }\n\n await Promise.all(\n keys.map(async key =>\n this.remove(\n base && !key.startsWith(base) ? joinPaths(base, key) : key\n )\n )\n );\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public abstract listSync(base?: string): string[];\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public async list(base?: string): Promise<string[]> {\n return this.listSync(base);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param _ - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public isDirectorySync(_: string): boolean {\n return false;\n }\n\n /**\n * Checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.\n */\n public async isDirectory(key: string) {\n return Promise.resolve(this.isDirectorySync(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public isFileSync(key: string): boolean {\n return this.existsSync(key) && !this.isDirectorySync(key);\n }\n\n /**\n * Checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.\n */\n public async isFile(key: string) {\n return Promise.resolve(this.isFileSync(key));\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public dispose(): MaybePromise<void> {\n return Promise.resolve();\n }\n\n /**\n * Async dispose method to clean up resources.\n *\n * @returns A promise that resolves when disposal is complete.\n */\n public async [Symbol.asyncDispose]() {\n return this._dispose();\n }\n\n /**\n * Determines if the storage adapter is read-only based on the provided options.\n *\n * @returns `true` if the storage adapter is read-only, otherwise `false`.\n */\n protected get isReadOnly() {\n return !!this.options.isReadOnly;\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected get overwrite() {\n return !this.isReadOnly && this.context.config.output.overwrite !== false;\n }\n\n /**\n * Resolves a given key to its full path within the storage adapter.\n *\n * @param key - The key to resolve.\n * @returns The resolved full path for the key.\n */\n protected resolve(key?: string) {\n if (!key) {\n return this.options.base;\n }\n\n if (/\\.\\.:|\\.\\.$/.test(key)) {\n throw new Error(\n `[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`\n );\n }\n\n return appendPath(correctPath(key).replace(/:/g, \"/\"), this.options.base);\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n protected async _dispose(): Promise<void> {\n if (!this.#isDisposed) {\n await Promise.resolve(this.dispose());\n this.#isDisposed = true;\n }\n }\n}\n","/* -------------------------------------------------------------------\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 { isError } from \"@stryke/type-checks/is-error\";\n\n/**\n * Checks if an error is a file system error.\n *\n * @param err - The error to check.\n * @returns `true` if the error is a file system error, otherwise `false`.\n */\nexport function isFileError(err: any) {\n return isError(err) && \"code\" in err && err.code;\n}\n\n/**\n * Ignores file not found errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file not found error, otherwise returns the error.\n */\nexport function ignoreNotfound(err: any) {\n return (\n isFileError(err) &&\n (err.code === \"ENOENT\" || err.code === \"EISDIR\" ? null : err)\n );\n}\n\n/**\n * Ignores file exists errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file exists error, otherwise returns the error.\n */\nexport function ignoreExists(err: any) {\n return isFileError(err) && err.code === \"EEXIST\" ? null : err;\n}\n","/* -------------------------------------------------------------------\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 { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport type { Context } from \"../types\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\nimport { ignoreNotfound } from \"./helpers\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n return writeFileSync(this.resolve(key), value);\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n return writeFile(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.isReadOnly && this.overwrite) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return isFile(this.resolve(key));\n }\n}\n","/* -------------------------------------------------------------------\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 { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\n/**\n * Virtual/in-memory storage adapter implementation.\n */\nexport class VirtualStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"virtual\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"virtual\";\n\n /**\n * In-memory data storage.\n */\n protected data = new Map<string, any>();\n\n /**\n * Constructor for the VirtualStorageAdapter.\n *\n * @param context - The Powerlines context.\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(context: Context, options?: StorageAdapterOptions) {\n super(context, options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return this.data.has(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return this.data.get(this.resolve(key)) ?? null;\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) {\n this.data.set(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.isReadOnly && this.overwrite) {\n this.data.delete(this.resolve(key));\n }\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n return [\n ...this.data\n .keys()\n .filter(key => (!base ? true : isParentPath(key, this.resolve(base))))\n ];\n }\n\n /**\n * Disposes of the storage adapter, releasing any held resources.\n *\n * @returns A promise that resolves when the disposal is complete.\n */\n public override async dispose(): Promise<void> {\n return this.clear();\n }\n\n /**\n * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.\n *\n * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.\n */\n protected override get overwrite() {\n return !this.isReadOnly;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkCA,IAAsB,qBAAtB,MAE4B;;;;CAI1B,cAAc;;;;CAUd,AAAO;;;;;;;CAQP,AAAgB,SAAgC;;;;;;;CAQhD,AAAO,YACL,AAAUA,SACV,UAAoB,EAAE,MAAM,KAAK,EACjC;EAFU;AAGV,OAAK,UAAU;AACf,OAAK,QAAQ,OAAO,QAAQ,QAAQ,KAAK;AACzC,OAAK,QAAQ,aAAa,CAAC,CAAC,QAAQ;;;;;;;;CAiBtC,MAAa,OAAO,KAA+B;AACjD,SAAO,KAAK,WAAW,IAAI;;;;;;;;CAiB7B,MAAa,IAAI,KAAqC;AACpD,SAAO,KAAK,QAAQ,IAAI;;;;;;;;CAiB1B,MAAa,IAAI,KAAa,OAA8B;AAC1D,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,IAAI,IAAI,KAAK,WACrD,MAAK,QAAQ,KAAK,MAAM;;;;;;;CAS5B,AAAO,UAAU,GAAW;;;;;;CAO5B,MAAa,MAAM,SAAgC;AACjD,SAAO,QAAQ,QAAQ,KAAK,UAAU,QAAQ,CAAC;;;;;;;CAejD,MAAa,OAAO,KAA4B;AAC9C,MAAI,CAAC,KAA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2C,mBAAmB;;;;CAI5D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;CAKlC,AAAU,uBAAO,IAAI,KAAkB;;;;;;;CAQvC,AAAO,YAAY,SAAkB,SAAiC;AACpE,QAAM,SAAS,QAAQ;;;;;;;;CASzB,AAAO,WAAW,KAAsB;AACtC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CASzC,AAAO,QAAQ,KAA4B;AACzC,SAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI;;;;;;;;CAS7C,AAAO,QAAQ,KAAa,OAAe;AACzC,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,IAAI,IAAI,KAAK,WACrD,MAAK,KAAK,IAAI,KAAK,QAAQ,IAAI,EAAE,MAAM;;;;;;;CAS3C,AAAO,WAAW,KAAa;AAC7B,MAAI,CAAC,KAAK,cAAc,KAAK,UAC3B,MAAK,KAAK,OAAO,KAAK,QAAQ,IAAI,CAAC;;;;;;;;CAUvC,AAAO,SAAS,MAAyB;AACvC,SAAO,CACL,GAAG,KAAK,KACL,MAAM,CACN,QAAO,QAAQ,CAAC,OAAO,OAAO,aAAa,KAAK,KAAK,QAAQ,KAAK,CAAC,CAAE,CACzE;;;;;;;CAQH,MAAsB,UAAyB;AAC7C,SAAO,KAAK,OAAO;;;;;;;CAQrB,IAAuB,YAAY;AACjC,SAAO,CAAC,KAAK"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"write-file-gkuvUoFn.d.cts","names":[],"sources":["../../core/src/lib/entry.ts","../../core/src/lib/logger.ts","../../core/src/lib/utilities/file-header.ts","../../core/src/lib/utilities/format.ts","../../core/src/lib/utilities/source-file.ts","../../core/src/lib/utilities/source-map.ts","../../core/src/lib/utilities/write-file.ts"],"sourcesContent":[],"mappings":";;;;;;;iBAsCgB,kBAAA,UACL,yBACO;iBA6BF,YAAA,UACL,yBACO,wBACR,2CAEP;;AApCH;AA+BA;;;;;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