powerlines 0.40.1 → 0.40.3
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.
- package/dist/{api-D1TJOJXE.mjs → api-C9xtrjcq.mjs} +105 -57
- package/dist/api-C9xtrjcq.mjs.map +1 -0
- package/dist/{api-CMgoAQum.cjs → api-CW410d4B.cjs} +104 -56
- package/dist/astro.cjs +5 -5
- package/dist/astro.d.cts +1 -1
- package/dist/astro.d.mts +5 -5
- package/dist/astro.mjs +5 -5
- package/dist/{config-CY-rNoQX.d.cts → config-BNcBL0tI.d.cts} +23 -1
- package/dist/config-BNcBL0tI.d.cts.map +1 -0
- package/dist/{config-BYUOZn2-.d.mts → config-Bu97tgeF.d.cts} +2 -2
- package/dist/{config-BYUOZn2-.d.mts.map → config-Bu97tgeF.d.cts.map} +1 -1
- package/dist/{config-tAvhtoU3.d.cts → config-D2cqq84p.d.mts} +2 -2
- package/dist/{config-tAvhtoU3.d.cts.map → config-D2cqq84p.d.mts.map} +1 -1
- package/dist/{config-B76VxuFj.d.mts → config-jcYnkMvq.d.mts} +23 -1
- package/dist/config-jcYnkMvq.d.mts.map +1 -0
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +21 -1
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +24 -4
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{esbuild-B8xqzmmF.cjs → esbuild-CiPqZPkA.cjs} +2 -2
- package/dist/{esbuild-Bo7TrGmt.mjs → esbuild-DQAGVDY_.mjs} +3 -3
- package/dist/{esbuild-Bo7TrGmt.mjs.map → esbuild-DQAGVDY_.mjs.map} +1 -1
- package/dist/esbuild.cjs +5 -5
- package/dist/esbuild.d.cts +1 -1
- package/dist/esbuild.d.mts +4 -4
- package/dist/esbuild.mjs +5 -5
- package/dist/farm.cjs +3 -3
- package/dist/farm.d.cts +1 -1
- package/dist/farm.d.mts +4 -4
- package/dist/farm.mjs +3 -3
- package/dist/{index-C60deASW.d.mts → index-4WNH8dg3.d.mts} +2 -2
- package/dist/{index-C60deASW.d.mts.map → index-4WNH8dg3.d.mts.map} +1 -1
- package/dist/{index-Dqk6Rh9U.d.mts → index-BjLkEvse.d.mts} +3 -3
- package/dist/{index-Dqk6Rh9U.d.mts.map → index-BjLkEvse.d.mts.map} +1 -1
- package/dist/{index-DkZkdzSQ.d.cts → index-Cie2X8UH.d.cts} +2 -2
- package/dist/{index-DkZkdzSQ.d.cts.map → index-Cie2X8UH.d.cts.map} +1 -1
- package/dist/{write-file-gkuvUoFn.d.cts → index-DP6juTGE.d.mts} +35 -6
- package/dist/index-DP6juTGE.d.mts.map +1 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +6 -6
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +3 -3
- package/dist/next.cjs +4 -4
- package/dist/next.mjs +4 -4
- package/dist/nuxt.cjs +6 -6
- package/dist/nuxt.d.cts +1 -1
- package/dist/nuxt.d.mts +4 -4
- package/dist/nuxt.mjs +6 -6
- package/dist/{plugin-DE7BXFkV.d.mts → plugin-CO_BQ0th.d.cts} +2 -2
- package/dist/{plugin-DE7BXFkV.d.mts.map → plugin-CO_BQ0th.d.cts.map} +1 -1
- package/dist/{plugin-CPi1BC54.d.cts → plugin-CvPFipli.d.cts} +3 -3
- package/dist/{plugin-CPi1BC54.d.cts.map → plugin-CvPFipli.d.cts.map} +1 -1
- package/dist/plugin-utils.d.cts +3 -3
- package/dist/plugin-utils.d.cts.map +1 -1
- package/dist/plugin-utils.d.mts +7 -7
- package/dist/plugin-utils.d.mts.map +1 -1
- package/dist/{plugin-XET4WKK4.d.cts → plugin-xJ2LIFca.d.mts} +2 -2
- package/dist/{plugin-XET4WKK4.d.cts.map → plugin-xJ2LIFca.d.mts.map} +1 -1
- package/dist/{resolve-options-B1gzDFxb.cjs → resolve-options-BQnTgg3V.cjs} +1 -1
- package/dist/{resolve-options-Ym_q-Hb7.mjs → resolve-options-DHL3RM8F.mjs} +2 -2
- package/dist/{resolve-options-Ym_q-Hb7.mjs.map → resolve-options-DHL3RM8F.mjs.map} +1 -1
- package/dist/{rolldown-HYYWYM2Y.mjs → rolldown-B2frMllJ.mjs} +2 -2
- package/dist/{rolldown-HYYWYM2Y.mjs.map → rolldown-B2frMllJ.mjs.map} +1 -1
- package/dist/{rolldown-1g-LKcc6.cjs → rolldown-Cop6Gb8O.cjs} +1 -1
- package/dist/rolldown.cjs +4 -4
- package/dist/rolldown.d.cts +1 -1
- package/dist/rolldown.d.mts +4 -4
- package/dist/rolldown.mjs +4 -4
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.d.cts +1 -1
- package/dist/rollup.d.mts +4 -4
- package/dist/rollup.mjs +3 -3
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.d.cts +1 -1
- package/dist/rspack.d.mts +4 -4
- package/dist/rspack.mjs +3 -3
- package/dist/storage/index.cjs +3 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +4 -4
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +3 -1
- package/dist/tsdown.cjs +4 -4
- package/dist/tsdown.d.cts +1 -1
- package/dist/tsdown.d.mts +4 -4
- package/dist/tsdown.mjs +4 -4
- package/dist/tsup.cjs +5 -5
- package/dist/tsup.d.cts +1 -1
- package/dist/tsup.d.mts +4 -4
- package/dist/tsup.mjs +5 -5
- package/dist/typescript/index.d.cts +1 -1
- package/dist/typescript/index.d.mts +4 -4
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.d.cts +1 -1
- package/dist/unloader.d.mts +4 -4
- package/dist/unloader.mjs +3 -3
- package/dist/unplugin.cjs +3 -3
- package/dist/unplugin.d.cts +2 -2
- package/dist/unplugin.d.mts +4 -4
- package/dist/unplugin.mjs +3 -3
- package/dist/{utils-CxKWmhs2.cjs → utils-BbDma_5Y.cjs} +54 -9
- package/dist/{utils-RU0EjpzP.mjs → utils-DoQcX7Sk.mjs} +40 -7
- package/dist/{utils-RU0EjpzP.mjs.map → utils-DoQcX7Sk.mjs.map} +1 -1
- package/dist/utils.cjs +4 -2
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.mts +3 -3
- package/dist/utils.mjs +2 -2
- package/dist/{virtual-D8bn8LRN.cjs → virtual-B1MLgqnQ.cjs} +10 -2
- package/dist/{virtual-D-9vfvVY.mjs → virtual-B9imjOqe.mjs} +11 -3
- package/dist/virtual-B9imjOqe.mjs.map +1 -0
- package/dist/{vite-C6OXShid.cjs → vite-7nY8fpz4.cjs} +2 -2
- package/dist/{vite-BKmkglFo.mjs → vite-C5AaWEV1.mjs} +3 -3
- package/dist/{vite-BKmkglFo.mjs.map → vite-C5AaWEV1.mjs.map} +1 -1
- package/dist/vite.cjs +5 -5
- package/dist/vite.d.cts +2 -2
- package/dist/vite.d.mts +5 -5
- package/dist/vite.mjs +5 -5
- package/dist/{webpack-L3DT059U.cjs → webpack-DAKZgaMR.cjs} +1 -1
- package/dist/{webpack-DZvno7jS.mjs → webpack-L68CX5gk.mjs} +2 -2
- package/dist/{webpack-DZvno7jS.mjs.map → webpack-L68CX5gk.mjs.map} +1 -1
- package/dist/webpack.cjs +4 -4
- package/dist/webpack.d.cts +1 -1
- package/dist/webpack.d.mts +4 -4
- package/dist/webpack.mjs +4 -4
- package/dist/{index-TMfRNrCg.d.mts → write-file-DKA8GehT.d.cts} +35 -6
- package/dist/write-file-DKA8GehT.d.cts.map +1 -0
- package/package.json +28 -28
- package/dist/api-D1TJOJXE.mjs.map +0 -1
- package/dist/config-B76VxuFj.d.mts.map +0 -1
- package/dist/config-CY-rNoQX.d.cts.map +0 -1
- package/dist/index-TMfRNrCg.d.mts.map +0 -1
- package/dist/virtual-D-9vfvVY.mjs.map +0 -1
- package/dist/write-file-gkuvUoFn.d.cts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-B9imjOqe.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport type { Context } from \"../types\";\nimport { getFileHeaderWarningText } from \"../utils\";\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) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = this.getSync(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(true, this.context.config.framework)\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(true, this.context.config.framework),\n getFileHeaderWarningText(false, this.context.config.framework)\n )\n );\n }\n } else {\n return writeFileSync(this.resolve(key), value);\n }\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) {\n if (this.existsSync(this.resolve(key)) && !this.overwrite) {\n const existingValue = await this.get(this.resolve(key));\n if (\n isSetString(existingValue) &&\n existingValue.includes(\n getFileHeaderWarningText(true, this.context.config.framework)\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(true, this.context.config.framework),\n getFileHeaderWarningText(false, this.context.config.framework)\n )\n );\n }\n } else {\n return writeFile(this.resolve(key), value);\n }\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;AAC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B;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,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_api = require('./api-
|
|
3
|
-
const require_resolve_options = require('./resolve-options-
|
|
2
|
+
const require_api = require('./api-CW410d4B.cjs');
|
|
3
|
+
const require_resolve_options = require('./resolve-options-BQnTgg3V.cjs');
|
|
4
4
|
const require_resolve_options$1 = require('./resolve-options-vyFhhkLp.cjs');
|
|
5
5
|
const require_resolve_options$2 = require('./resolve-options-lxQ2pm0W.cjs');
|
|
6
6
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
2
|
-
import { r as resolveOptions$1 } from "./resolve-options-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-C9xtrjcq.mjs";
|
|
2
|
+
import { r as resolveOptions$1 } from "./resolve-options-DHL3RM8F.mjs";
|
|
3
3
|
import { n as resolveOptions$3 } from "./resolve-options-6sXFqzEA.mjs";
|
|
4
4
|
import { t as resolveOptions$2 } from "./resolve-options-D-RGs8j8.mjs";
|
|
5
5
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
@@ -168,4 +168,4 @@ var vite_default = unplugin;
|
|
|
168
168
|
|
|
169
169
|
//#endregion
|
|
170
170
|
export { vite_default as n, src_default as r, unplugin as t };
|
|
171
|
-
//# sourceMappingURL=vite-
|
|
171
|
+
//# sourceMappingURL=vite-C5AaWEV1.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-BKmkglFo.mjs","names":["DEFAULT_VITE_CONFIG: Partial<ViteOptions>","resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions","createVitePlugin","createViteUnplugin","createVitePlugin","plugin"],"sources":["../../plugin-vite/src/helpers/resolve-options.ts","../../plugin-vite/src/helpers/unplugin.ts","../../plugin-vite/src/index.ts","../src/vite.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 { Context } from \"@powerlines/core\";\nimport { resolveOptions as resolveEsbuildOptions } from \"@powerlines/plugin-esbuild/helpers/resolve-options\";\nimport { resolveOptions as resolveRolldownOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { ESBuildOptions } from \"vite\";\nimport { VitePluginResolvedConfig } from \"../types\";\nimport { ViteOptions } from \"../types/build\";\n\nexport const DEFAULT_VITE_CONFIG: Partial<ViteOptions> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): ViteOptions {\n return defu(\n {\n resolve: {\n alias: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n ),\n dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n }\n },\n (context.config as VitePluginResolvedConfig).vite\n ? defu(\n (context.config as VitePluginResolvedConfig).vite,\n {\n optimizeDeps:\n (context.config as VitePluginResolvedConfig).vite?.optimizeDeps ??\n {}\n },\n {\n optimizeDeps: {\n extensions: context.config.resolve.extensions\n }\n }\n )\n : {},\n {\n define: context.config.define,\n rootDir: context.fs.existsSync(joinPaths(context.config.root, \"src\"))\n ? joinPaths(context.config.root, \"src\")\n : context.config.root,\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n outDir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel: context.config.logLevel ?? undefined,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n ) as ViteOptions;\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createVitePlugin as createViteUnplugin } from \"unplugin\";\nimport { VitePluginContext } from \"../types/plugin\";\n\nexport function createVitePlugin(context: VitePluginContext) {\n return createViteUnplugin(createUnplugin(context))({});\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 { Context, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { UNSAFE_VitePluginContext } from \"./types/_internal\";\nimport {\n VitePluginContext,\n VitePluginOptions,\n VitePluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n vite?: VitePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends VitePluginContext = VitePluginContext>(\n options: VitePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"vite\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `vite` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n vite: {\n ...DEFAULT_VITE_CONFIG,\n ...options\n },\n singleBuild: true\n } as Partial<VitePluginResolvedConfig>;\n },\n async build() {\n this.trace(`Building the Powerlines plugin.`);\n\n const environments = (this as unknown as UNSAFE_VitePluginContext)\n ?.$$internal?.api?.context?.environments;\n if (!environments || Object.keys(environments).length === 0) {\n throw new Error(\n `No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`\n );\n }\n\n this.trace(\n `Running Vite for ${Object.keys(environments).length} environments.`\n );\n\n const config = defu(\n {\n config: false,\n entry: this.entry,\n environments: Object.fromEntries(\n Object.entries(environments).map(([name, env]) => [\n name,\n resolveOptions(env as Context)\n ])\n )\n },\n resolveOptions(this),\n {\n plugins: [createVitePlugin(this)]\n }\n );\n\n await build(config as InlineConfig);\n }\n };\n};\n\nexport default plugin;\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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"powerlines/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;AA4BA,MAAaA,sBAA4C;CACvD,SAAS,EACP,YAAY;EAAC;EAAQ;EAAO;EAAQ;EAAO;EAAQ;EAAQ;EAAQ,EACpE;CACD,MAAM,EACJ,WAAW,MACZ;CACD,UAAU;CACV,aAAa;CACd;;;;;;;AAQD,SAAgB,eAAe,SAA+B;AAC5D,QAAO,KACL,EACE,SAAS;EACP,OAAO,OAAO,QAAQ,QAAQ,MAAM,CAAC,QAClC,KAAK,CAAC,IAAI,UAAU;AACnB,OAAI,CAAC,IAAI,MAAK,MAAK,EAAE,SAAS,GAAG,CAC/B,KAAI,KAAK;IACP,MAAM;IACN,aAAa;IACd,CAAC;OAEF,SAAQ,KACN,8BAA8B,GAAG,2CAClC;AAGH,UAAO;KAET,EAAE,CACH;EACD,QAAQ,QAAQ,OAAO,QAAQ;EAC/B,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACnC,YAAY,QAAQ,OAAO,QAAQ;EACpC,EACF,EACA,QAAQ,OAAoC,OACzC,KACG,QAAQ,OAAoC,MAC7C,EACE,cACG,QAAQ,OAAoC,MAAM,gBACnD,EAAE,EACL,EACD,EACE,cAAc,EACZ,YAAY,QAAQ,OAAO,QAAQ,YACpC,EACF,CACF,GACD,EAAE,EACN;EACE,QAAQ,QAAQ,OAAO;EACvB,SAAS,QAAQ,GAAG,WAAW,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,GACjE,UAAU,QAAQ,OAAO,MAAM,MAAM,GACrC,QAAQ,OAAO;EACnB,UAAU,QAAQ,OAAO;EACzB,MACE,QAAQ,OAAO,SAAS,gBAAgB,gBAAgB;EAC1D,UAAU,UAAU,QAAQ,WAAW,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;;GAEpE;EACF;EACD,CACH;AAED,mBAAe"}
|
|
1
|
+
{"version":3,"file":"vite-C5AaWEV1.mjs","names":["DEFAULT_VITE_CONFIG: Partial<ViteOptions>","resolveEsbuildOptions","resolveRolldownOptions","resolveRollupOptions","createVitePlugin","createViteUnplugin","createVitePlugin","plugin"],"sources":["../../plugin-vite/src/helpers/resolve-options.ts","../../plugin-vite/src/helpers/unplugin.ts","../../plugin-vite/src/index.ts","../src/vite.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 { Context } from \"@powerlines/core\";\nimport { resolveOptions as resolveEsbuildOptions } from \"@powerlines/plugin-esbuild/helpers/resolve-options\";\nimport { resolveOptions as resolveRolldownOptions } from \"@powerlines/plugin-rolldown/helpers/resolve-options\";\nimport { resolveOptions as resolveRollupOptions } from \"@powerlines/plugin-rollup/helpers/resolve-options\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { ESBuildOptions } from \"vite\";\nimport { VitePluginResolvedConfig } from \"../types\";\nimport { ViteOptions } from \"../types/build\";\n\nexport const DEFAULT_VITE_CONFIG: Partial<ViteOptions> = {\n resolve: {\n extensions: [\".mjs\", \".js\", \".mts\", \".ts\", \".jsx\", \".tsx\", \".json\"]\n },\n json: {\n stringify: true\n },\n logLevel: \"silent\",\n clearScreen: true\n};\n\n/**\n * Resolves the options for [vite](https://vitejs.dev/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): ViteOptions {\n return defu(\n {\n resolve: {\n alias: Object.entries(context.alias).reduce(\n (ret, [id, path]) => {\n if (!ret.find(e => e.find === id)) {\n ret.push({\n find: id,\n replacement: path\n });\n } else {\n context.warn(\n `Duplicate alias entry for '${id}' detected. The first entry will be used.`\n );\n }\n\n return ret;\n },\n [] as { find: string; replacement: string }[]\n ),\n dedupe: context.config.resolve.dedupe,\n mainFields: context.config.resolve.mainFields,\n conditions: context.config.resolve.conditions,\n extensions: context.config.resolve.extensions\n }\n },\n (context.config as VitePluginResolvedConfig).vite\n ? defu(\n (context.config as VitePluginResolvedConfig).vite,\n {\n optimizeDeps:\n (context.config as VitePluginResolvedConfig).vite?.optimizeDeps ??\n {}\n },\n {\n optimizeDeps: {\n extensions: context.config.resolve.extensions\n }\n }\n )\n : {},\n {\n define: context.config.define,\n rootDir: context.fs.existsSync(joinPaths(context.config.root, \"src\"))\n ? joinPaths(context.config.root, \"src\")\n : context.config.root,\n platform: context.config.platform,\n mode:\n context.config.mode === \"development\" ? \"development\" : \"production\",\n cacheDir: joinPaths(context.cachePath, \"vite\"),\n build: {\n minify: context.config.mode !== \"development\",\n metafile: context.config.mode === \"development\",\n sourcemap: context.config.mode === \"development\",\n outDir: context.config.output.buildPath,\n tsconfig: context.tsconfig.tsconfigFilePath,\n tsconfigRaw: context.tsconfig.tsconfigJson\n },\n esbuild: resolveEsbuildOptions(context) as ESBuildOptions,\n optimizeDeps: {\n rolldownOptions: resolveRolldownOptions(context),\n rollupOptions: resolveRollupOptions(context),\n esbuildOptions: resolveEsbuildOptions(context)\n },\n logLevel: context.config.logLevel ?? undefined,\n envDir: context.config.root\n } as ViteOptions,\n DEFAULT_VITE_CONFIG\n ) as ViteOptions;\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createVitePlugin as createViteUnplugin } from \"unplugin\";\nimport { VitePluginContext } from \"../types/plugin\";\n\nexport function createVitePlugin(context: VitePluginContext) {\n return createViteUnplugin(createUnplugin(context))({});\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 { Context, Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport { build, InlineConfig } from \"vite\";\nimport { DEFAULT_VITE_CONFIG, resolveOptions } from \"./helpers/resolve-options\";\nimport { createVitePlugin } from \"./helpers/unplugin\";\nimport { UNSAFE_VitePluginContext } from \"./types/_internal\";\nimport {\n VitePluginContext,\n VitePluginOptions,\n VitePluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n vite?: VitePluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <TContext extends VitePluginContext = VitePluginContext>(\n options: VitePluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"vite\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `vite` build plugin.\"\n );\n\n return {\n output: {\n format: [\"cjs\", \"esm\"]\n },\n vite: {\n ...DEFAULT_VITE_CONFIG,\n ...options\n },\n singleBuild: true\n } as Partial<VitePluginResolvedConfig>;\n },\n async build() {\n this.trace(`Building the Powerlines plugin.`);\n\n const environments = (this as unknown as UNSAFE_VitePluginContext)\n ?.$$internal?.api?.context?.environments;\n if (!environments || Object.keys(environments).length === 0) {\n throw new Error(\n `No environments found in the Powerlines context. At least one environment should have been generated - please report this issue to https://github.com/storm-software/powerlines/issues.`\n );\n }\n\n this.trace(\n `Running Vite for ${Object.keys(environments).length} environments.`\n );\n\n const config = defu(\n {\n config: false,\n entry: this.entry,\n environments: Object.fromEntries(\n Object.entries(environments).map(([name, env]) => [\n name,\n resolveOptions(env as Context)\n ])\n )\n },\n resolveOptions(this),\n {\n plugins: [createVitePlugin(this)]\n }\n );\n\n await build(config as InlineConfig);\n }\n };\n};\n\nexport default plugin;\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 { resolveOptions } from \"@powerlines/plugin-vite/helpers/resolve-options\";\nimport {\n ViteOptions,\n VitePluginUserConfig\n} from \"@powerlines/plugin-vite/types\";\nimport { isDevelopmentMode, isTestMode } from \"@stryke/env/environment-checks\";\nimport defu from \"defu\";\nimport { createVitePlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport { default as plugin, default as vite } from \"@powerlines/plugin-vite\";\n\n/**\n * A Vite plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://vitejs.dev/guide/api-plugin.html#plugin-api\n *\n * @example\n * ```ts\n * // vite.config.ts\n * import powerlines from \"powerlines/vite\";\n *\n * export default defineConfig({\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * });\n *\n * ```\n */\nexport const unplugin = createVitePlugin<Partial<VitePluginUserConfig>>(\n createUnpluginFactory(\"vite\", (api, plugin) => {\n return {\n ...plugin,\n vite: {\n sharedDuringBuild: true,\n\n async hotUpdate(options) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:hotUpdate\", { environment }, options);\n },\n async config(config, env) {\n api.context.config.mode = isDevelopmentMode(env.mode)\n ? \"development\"\n : isTestMode(env.mode)\n ? \"test\"\n : \"production\";\n\n const environment = await api.context.getEnvironment();\n const result = await api.callHook(\n \"vite:config\",\n { environment },\n config,\n env\n );\n\n return defu(\n resolveOptions(api.context),\n // Need to use `any` here to avoid excessive type complexity\n result?.build ?? {},\n config\n ) as Omit<ViteOptions, \"plugins\">;\n },\n async configResolved(_config) {\n const environment = await api.context.getEnvironment();\n\n await api.callHook(\"configResolved\", { environment });\n },\n async configureServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:configureServer\", { environment }, server);\n },\n async configurePreviewServer(server) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:configurePreviewServer\",\n { environment },\n server\n );\n },\n async transformIndexHtml(html, ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\n \"vite:transformIndexHtml\",\n { environment },\n html,\n ctx\n );\n },\n async handleHotUpdate(ctx) {\n const environment = await api.context.getEnvironment();\n\n return api.callHook(\"vite:handleHotUpdate\", { environment }, ctx);\n }\n }\n };\n })\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;AA4BA,MAAaA,sBAA4C;CACvD,SAAS,EACP,YAAY;EAAC;EAAQ;EAAO;EAAQ;EAAO;EAAQ;EAAQ;EAAQ,EACpE;CACD,MAAM,EACJ,WAAW,MACZ;CACD,UAAU;CACV,aAAa;CACd;;;;;;;AAQD,SAAgB,eAAe,SAA+B;AAC5D,QAAO,KACL,EACE,S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M,cAAc,MAAM,IAAI,QAAQ,gBAAgB;IACtD,MAAM,SAAS,MAAM,IAAI,SACvB,eACA,EAAE,aAAa,EACf,QACA,IACD;AAED,WAAO,KACL,eAAe,IAAI,QAAQ,EAE3B,QAAQ,SAAS,EAAE,EACnB,OACD;;GAEH,MAAM,eAAe,SAAS;IAC5B,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,UAAM,IAAI,SAAS,kBAAkB,EAAE,aAAa,CAAC;;GAEvD,MAAM,gBAAgB,QAAQ;IAC5B,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,wBAAwB,EAAE,aAAa,EAAE,OAAO;;GAEtE,MAAM,uBAAuB,QAAQ;IACnC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,+BACA,EAAE,aAAa,EACf,OACD;;GAEH,MAAM,mBAAmB,MAAM,KAAK;IAClC,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SACT,2BACA,EAAE,aAAa,EACf,MACA,IACD;;GAEH,MAAM,gBAAgB,KAAK;IACzB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IAAI,SAAS,wBAAwB,EAAE,aAAa,EAAE,IAAI;;GAEpE;EACF;EACD,CACH;AAED,mBAAe"}
|
package/dist/vite.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./api-
|
|
2
|
+
require('./api-CW410d4B.cjs');
|
|
3
3
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
4
4
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
5
5
|
require('./plugin-CZ_PJPpQ.cjs');
|
|
6
6
|
require('./paths-YmyIGEVo.cjs');
|
|
7
7
|
require('./constants-CZh5rsgh.cjs');
|
|
8
8
|
require('./config-D86Vw7SC.cjs');
|
|
9
|
-
require('./
|
|
10
|
-
require('./
|
|
11
|
-
require('./resolve-options-
|
|
9
|
+
require('./utils-BbDma_5Y.cjs');
|
|
10
|
+
require('./virtual-B1MLgqnQ.cjs');
|
|
11
|
+
require('./resolve-options-BQnTgg3V.cjs');
|
|
12
12
|
require('./resolve-options-vyFhhkLp.cjs');
|
|
13
13
|
require('./resolve-options-lxQ2pm0W.cjs');
|
|
14
|
-
const require_vite = require('./vite-
|
|
14
|
+
const require_vite = require('./vite-7nY8fpz4.cjs');
|
|
15
15
|
|
|
16
16
|
exports.default = require_vite.vite_default;
|
|
17
17
|
exports["module.exports"] = require_vite.unplugin;
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Zn as Plugin } from "./config-
|
|
2
|
-
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-
|
|
1
|
+
import { Zn as Plugin } from "./config-BNcBL0tI.cjs";
|
|
2
|
+
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-CO_BQ0th.cjs";
|
|
3
3
|
import * as vite0 from "vite";
|
|
4
4
|
|
|
5
5
|
//#region ../plugin-vite/src/index.d.ts
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Zn as Plugin } from "./config-
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./index-
|
|
4
|
-
import "./index-
|
|
5
|
-
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-
|
|
1
|
+
import { Zn as Plugin } from "./config-jcYnkMvq.mjs";
|
|
2
|
+
import "./config-D2cqq84p.mjs";
|
|
3
|
+
import "./index-DP6juTGE.mjs";
|
|
4
|
+
import "./index-BjLkEvse.mjs";
|
|
5
|
+
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-xJ2LIFca.mjs";
|
|
6
6
|
import * as vite0 from "vite";
|
|
7
7
|
|
|
8
8
|
//#region ../plugin-vite/src/index.d.ts
|
package/dist/vite.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import "./api-
|
|
1
|
+
import "./api-C9xtrjcq.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
5
5
|
import "./paths-CS8ecCnW.mjs";
|
|
6
6
|
import "./constants-cXxSHhNp.mjs";
|
|
7
7
|
import "./config-D4Fh2gQL.mjs";
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import "./resolve-options-
|
|
8
|
+
import "./utils-DoQcX7Sk.mjs";
|
|
9
|
+
import "./virtual-B9imjOqe.mjs";
|
|
10
|
+
import "./resolve-options-DHL3RM8F.mjs";
|
|
11
11
|
import "./resolve-options-6sXFqzEA.mjs";
|
|
12
12
|
import "./resolve-options-D-RGs8j8.mjs";
|
|
13
|
-
import { n as vite_default, r as src_default, t as unplugin } from "./vite-
|
|
13
|
+
import { n as vite_default, r as src_default, t as unplugin } from "./vite-C5AaWEV1.mjs";
|
|
14
14
|
|
|
15
15
|
export { vite_default as default, unplugin as "module.exports", unplugin, src_default as plugin, src_default as vite };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_api = require('./api-
|
|
2
|
+
const require_api = require('./api-CW410d4B.cjs');
|
|
3
3
|
let __stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
4
4
|
let defu = require("defu");
|
|
5
5
|
defu = require_chunk.__toESM(defu);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as createUnpluginFactory, o as createUnplugin } from "./api-
|
|
1
|
+
import { a as createUnpluginFactory, o as createUnplugin } from "./api-C9xtrjcq.mjs";
|
|
2
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
3
|
import defu from "defu";
|
|
4
4
|
import { createWebpackPlugin } from "unplugin";
|
|
@@ -85,4 +85,4 @@ var webpack_default = unplugin;
|
|
|
85
85
|
|
|
86
86
|
//#endregion
|
|
87
87
|
export { webpack_default as n, src_default as r, unplugin as t };
|
|
88
|
-
//# sourceMappingURL=webpack-
|
|
88
|
+
//# sourceMappingURL=webpack-L68CX5gk.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-
|
|
1
|
+
{"version":3,"file":"webpack-L68CX5gk.mjs","names":["createWebpackPlugin","createWebpackUnplugin","createWebpackPlugin"],"sources":["../../plugin-webpack/src/helpers/resolve-options.ts","../../plugin-webpack/src/helpers/unplugin.ts","../../plugin-webpack/src/index.ts","../src/webpack.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 { Context } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport type { Configuration as ExternalWebpackOptions } from \"webpack\";\nimport { WebpackPluginResolvedConfig } from \"../types\";\n\n/**\n * Resolves the options for [webpack](https://webpack.js.org/).\n *\n * @param context - The build context.\n * @returns The resolved options.\n */\nexport function resolveOptions(context: Context): ExternalWebpackOptions {\n return defu(\n {\n resolve: {\n alias: context.alias\n }\n },\n (context.config as WebpackPluginResolvedConfig).webpack\n ? (context.config as WebpackPluginResolvedConfig).webpack\n : {},\n {\n output: {\n path: joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.output.buildPath\n )\n },\n name: context.config.name,\n plugins:\n (context.config as WebpackPluginResolvedConfig).webpack?.plugins ?? [],\n node:\n context.config.platform === \"node\"\n ? ({\n __dirname: true,\n __filename: true,\n global: true\n } as ExternalWebpackOptions[\"node\"])\n : false,\n mode:\n context.config.mode === \"development\"\n ? (\"development\" as const)\n : (\"production\" as const),\n cache: {\n type: \"filesystem\" as const,\n cacheDirectory: joinPaths(context.cachePath, \"webpack\", \"cache\")\n },\n recordsInputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n recordsOutputPath: joinPaths(\n context.cachePath,\n \"webpack\",\n \".webpack-records.json\"\n ),\n context: joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n ),\n noExternal: context.builtins,\n devtool: (context.config.mode !== \"development\"\n ? false\n : \"source-map\") as string | false,\n optimization: {\n minimize: context.config.mode !== \"development\"\n }\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 { createUnplugin } from \"@powerlines/core/lib/unplugin\";\nimport { createWebpackPlugin as createWebpackUnplugin } from \"unplugin\";\nimport { WebpackPluginContext } from \"../types/plugin\";\n\nexport function createWebpackPlugin(context: WebpackPluginContext) {\n return createWebpackUnplugin(createUnplugin(context))({});\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 { Plugin } from \"@powerlines/core\";\nimport defu from \"defu\";\nimport build from \"webpack\";\nimport { resolveOptions } from \"./helpers/resolve-options\";\nimport { createWebpackPlugin } from \"./helpers/unplugin\";\nimport {\n WebpackPluginContext,\n WebpackPluginOptions,\n WebpackPluginResolvedConfig\n} from \"./types/plugin\";\n\nexport * from \"./helpers\";\nexport * from \"./types\";\n\ndeclare module \"@powerlines/core\" {\n interface BaseConfig {\n webpack?: WebpackPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to assist in developing other Powerlines plugins.\n */\nexport const plugin = <\n TContext extends WebpackPluginContext = WebpackPluginContext\n>(\n options: WebpackPluginOptions = {}\n): Plugin<TContext> => {\n return {\n name: \"webpack\",\n config() {\n this.trace(\n \"Providing default configuration for the Powerlines `webpack` build plugin.\"\n );\n\n return {\n webpack: {\n ...options\n }\n } as Partial<WebpackPluginResolvedConfig>;\n },\n async build() {\n build(\n defu(\n {\n entry: this.entry.reduce(\n (ret, entry) => {\n ret[entry.output || entry.name || entry.file] = entry.file;\n\n return ret;\n },\n {} as Record<string, string>\n )\n },\n resolveOptions(this),\n {\n plugins: [createWebpackPlugin(this)]\n }\n )\n );\n }\n };\n};\n\nexport default plugin;\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 { WebpackPluginUserConfig } from \"@powerlines/plugin-webpack/types/plugin\";\nimport { createWebpackPlugin } from \"unplugin\";\nimport { createUnpluginFactory } from \"./unplugin\";\n\nexport {\n default as plugin,\n default as webpack\n} from \"@powerlines/plugin-webpack\";\n\n/**\n * An Webpack plugin that will invoke the Powerlines API hooks during the build process.\n *\n * @see https://webpack.js.org/contribute/writing-a-plugin/#basic-plugin-architecture\n *\n * @example\n * ```js\n * // webpack.config.js\n * import powerlines from \"powerlines/webpack\";\n *\n * export default {\n * plugins: [powerlines({ name: \"example-app\", ... })],\n * }\n * ```\n */\nexport const unplugin = createWebpackPlugin<Partial<WebpackPluginUserConfig>>(\n createUnpluginFactory(\"webpack\")\n);\n\nexport default unplugin;\n\nexport { unplugin as \"module.exports\" };\n"],"mappings":";;;;;;;;;;;;;AA8BA,SAAgB,eAAe,SAA0C;AACvE,QAAO,KACL,EACE,SAAS,EACP,OAAO,QAAQ,OAChB,EACF,EACA,QAAQ,OAAuC,UAC3C,QAAQ,OAAuC,UAChD,EAAE,EACN;EACE,QAAQ,EACN,MAAM,UACJ,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,OAAO,UACvB,EACF;EACD,MAAM,QAAQ,OAAO;EACrB,SACG,QAAQ,OAAuC,SAAS,WAAW,EAAE;EACxE,MACE,QAAQ,OAAO,aAAa,SACvB;GACC,WAAW;GACX,YAAY;GACZ,QAAQ;GACT,GACD;EACN,MACE,QAAQ,OAAO,SAAS,gBACnB,gBACA;EACP,OAAO;GACL,MAAM;GACN,gBAAgB,UAAU,QAAQ,WAAW,WAAW,QAAQ;GACjE;EACD,kBAAkB,UAChB,QAAQ,WACR,WACA,wBACD;EACD,mBAAmB,UACjB,QAAQ,WACR,WACA,wBACD;EACD,SAAS,UACP,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB;EACD,YAAY,QAAQ;EACpB,SAAU,QAAQ,OAAO,SAAS,gBAC9B,QACA;EACJ,cAAc,EACZ,UAAU,QAAQ,OAAO,SAAS,eACnC;EACF,CACF;;;;;AClEH,SAAgBA,sBAAoB,SAA+B;AACjE,QAAOC,oBAAsB,eAAe,QAAQ,CAAC,CAAC,EAAE,CAAC;;;;;;;;ACkB3D,MAAa,UAGX,UAAgC,EAAE,KACb;AACrB,QAAO;EACL,MAAM;EACN,SAAS;AACP,QAAK,MACH,6EACD;AAED,UAAO,EACL,SAAS,EACP,GAAG,SACJ,EACF;;EAEH,MAAM,QAAQ;AACZ,SACE,KACE,EACE,OAAO,KAAK,MAAM,QACf,KAAK,UAAU;AACd,QAAI,MAAM,UAAU,MAAM,QAAQ,MAAM,QAAQ,MAAM;AAEtD,WAAO;MAET,EAAE,CACH,EACF,EACD,eAAe,KAAK,EACpB,EACE,SAAS,CAACC,sBAAoB,KAAK,CAAC,EACrC,CACF,CACF;;EAEJ;;AAGH,kBAAe;;;;;;;;;;;;;;;;;;;ACxCf,MAAa,WAAW,oBACtB,sBAAsB,UAAU,CACjC;AAED,sBAAe"}
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
require('./api-
|
|
2
|
+
require('./api-CW410d4B.cjs');
|
|
3
3
|
require('./tsconfig-C8M8X6U0.cjs');
|
|
4
4
|
require('./plugin-utils-Ck3cx3w6.cjs');
|
|
5
5
|
require('./plugin-CZ_PJPpQ.cjs');
|
|
6
6
|
require('./paths-YmyIGEVo.cjs');
|
|
7
7
|
require('./constants-CZh5rsgh.cjs');
|
|
8
8
|
require('./config-D86Vw7SC.cjs');
|
|
9
|
-
require('./
|
|
10
|
-
require('./
|
|
11
|
-
const require_webpack = require('./webpack-
|
|
9
|
+
require('./utils-BbDma_5Y.cjs');
|
|
10
|
+
require('./virtual-B1MLgqnQ.cjs');
|
|
11
|
+
const require_webpack = require('./webpack-DAKZgaMR.cjs');
|
|
12
12
|
|
|
13
13
|
exports.default = require_webpack.webpack_default;
|
|
14
14
|
exports["module.exports"] = require_webpack.unplugin;
|
package/dist/webpack.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Et as PluginContext, N as UserConfig, Zn as Plugin, j as ResolvedConfig } from "./config-
|
|
1
|
+
import { Et as PluginContext, N as UserConfig, Zn as Plugin, j as ResolvedConfig } from "./config-BNcBL0tI.cjs";
|
|
2
2
|
import * as webpack0 from "webpack";
|
|
3
3
|
import { Configuration } from "webpack";
|
|
4
4
|
|
package/dist/webpack.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Et as PluginContext, N as UserConfig, Zn as Plugin, j as ResolvedConfig } from "./config-
|
|
2
|
-
import "./config-
|
|
3
|
-
import "./index-
|
|
4
|
-
import "./index-
|
|
1
|
+
import { Et as PluginContext, N as UserConfig, Zn as Plugin, j as ResolvedConfig } from "./config-jcYnkMvq.mjs";
|
|
2
|
+
import "./config-D2cqq84p.mjs";
|
|
3
|
+
import "./index-DP6juTGE.mjs";
|
|
4
|
+
import "./index-BjLkEvse.mjs";
|
|
5
5
|
import * as webpack0 from "webpack";
|
|
6
6
|
import { Configuration } from "webpack";
|
|
7
7
|
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./api-
|
|
1
|
+
import "./api-C9xtrjcq.mjs";
|
|
2
2
|
import "./tsconfig-B92heKit.mjs";
|
|
3
3
|
import "./plugin-utils-C3HnZJl1.mjs";
|
|
4
4
|
import "./plugin-E5foRD0k.mjs";
|
|
5
5
|
import "./paths-CS8ecCnW.mjs";
|
|
6
6
|
import "./constants-cXxSHhNp.mjs";
|
|
7
7
|
import "./config-D4Fh2gQL.mjs";
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import { n as webpack_default, r as src_default, t as unplugin } from "./webpack-
|
|
8
|
+
import "./utils-DoQcX7Sk.mjs";
|
|
9
|
+
import "./virtual-B9imjOqe.mjs";
|
|
10
|
+
import { n as webpack_default, r as src_default, t as unplugin } from "./webpack-L68CX5gk.mjs";
|
|
11
11
|
|
|
12
12
|
export { webpack_default as default, unplugin as "module.exports", unplugin, src_default as plugin, src_default as webpack };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { M as ResolvedEntryTypeDefinition, Mt as TransformResult$1, P as WorkspaceConfig, _t as Context, jt as SourceFile, n as BaseConfig, p as LogFn } from "./config-
|
|
1
|
+
import { M as ResolvedEntryTypeDefinition, Mt as TransformResult$1, P as WorkspaceConfig, _t as Context, jt as SourceFile, n as BaseConfig, p as LogFn } from "./config-BNcBL0tI.cjs";
|
|
2
2
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
3
|
+
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
3
4
|
import MagicString from "magic-string";
|
|
4
5
|
import { TransformResult } from "unplugin";
|
|
5
|
-
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
6
6
|
|
|
7
7
|
//#region ../core/src/lib/entry.d.ts
|
|
8
8
|
declare function resolveEntryOutput(context: Context, typeDefinition: TypeDefinition): string;
|
|
@@ -68,8 +68,37 @@ interface FileHeaderOptions {
|
|
|
68
68
|
directive?: string | null;
|
|
69
69
|
prettierIgnore?: boolean;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Generates a file header comment with a warning about automatic overwriting.
|
|
73
|
+
*
|
|
74
|
+
* @param overwrite - Whether the file will be automatically overwritten. If `false`, the warning will indicate that the file will not be overwritten. If `true` or omitted, the warning will indicate that the file will be overwritten.
|
|
75
|
+
* @param framework - The name of the framework to include in the warning message. Defaults to "powerlines".
|
|
76
|
+
* @returns A string containing the file header warning message.
|
|
77
|
+
*/
|
|
78
|
+
declare function getFileHeaderWarningText(overwrite?: boolean, framework?: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Generates a file header warning message based on the provided context.
|
|
81
|
+
*
|
|
82
|
+
* @param context - The Powerlines context.
|
|
83
|
+
* @returns A string containing the file header warning message.
|
|
84
|
+
*/
|
|
85
|
+
declare function getFileHeaderWarning(context: Context): string;
|
|
86
|
+
/**
|
|
87
|
+
* Generates a file header comment for a generated source file, including a warning about automatic overwriting.
|
|
88
|
+
*
|
|
89
|
+
* @param context - The Powerlines context.
|
|
90
|
+
* @param comment - The comment syntax to use for the header (e.g., `//` for JavaScript/TypeScript, `#` for Python). Defaults to `//`.
|
|
91
|
+
* @returns A string containing the file header comment.
|
|
92
|
+
*/
|
|
93
|
+
declare function getFileHeader(context: Context, comment?: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Generates a file header comment for a generated TypeScript source file, including a warning about automatic overwriting.
|
|
96
|
+
*
|
|
97
|
+
* @param context - The Powerlines context.
|
|
98
|
+
* @param options - Additional options for generating the file header, such as a directive to include and whether to add a Prettier ignore comment.
|
|
99
|
+
* @returns A string containing the file header comment for a TypeScript file.
|
|
100
|
+
*/
|
|
101
|
+
declare function getTypescriptFileHeader(context: Context, options?: FileHeaderOptions): string;
|
|
73
102
|
declare type __ΩFileHeaderOptions = any[];
|
|
74
103
|
//#endregion
|
|
75
104
|
//#region ../core/src/lib/utilities/format.d.ts
|
|
@@ -138,5 +167,5 @@ declare function generateSourceMap(code: MagicString, id: string, transpiled?: s
|
|
|
138
167
|
*/
|
|
139
168
|
declare function writeFile(log: LogFn, filepath: string, content: string, skipFormat?: boolean): Promise<void>;
|
|
140
169
|
//#endregion
|
|
141
|
-
export {
|
|
142
|
-
//# sourceMappingURL=
|
|
170
|
+
export { resolveInputs as C, resolveInput as S, extendLog as _, getString as a, isTypeDefinition as b, FileHeaderOptions as c, getFileHeaderWarning as d, getFileHeaderWarningText as f, createLog as g, __ΩCreateLogOptions as h, getSourceFile as i, __ΩFileHeaderOptions as l, CreateLogOptions as m, generateSourceMap as n, format as o, getTypescriptFileHeader as p, getMagicString as r, formatFolder as s, writeFile as t, getFileHeader as u, getUniqueInputs as v, resolveInputsSync as w, resolveEntryOutput as x, isResolvedEntryTypeDefinition as y };
|
|
171
|
+
//# sourceMappingURL=write-file-DKA8GehT.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-file-DKA8GehT.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;;;;;AAK8B,iBAeR,aAAA,CAfQ,OAAA,EAgBnB,OAhBmB,EAAA,eAAA,EAkBxB,uBAlBwB,GAmBxB,uBAnBwB,EAAA,GAoBxB,MApBwB,CAAA,MAAA,EAoBT,uBApBS,GAoBiB,uBApBjB,EAAA,CAAA,CAAA,EAqB3B,OArB2B,CAqBnB,2BArBmB,EAAA,CAAA;AAe9B;;;;;;;AAMW,iBA2EK,iBAAA,CA3EL,OAAA,EA4EA,OA5EA,EAAA,eAAA,EA8EL,uBA9EK,GA+EL,uBA/EK,EAAA,GAgFL,MAhFK,CAAA,MAAA,EAgFU,uBAhFV,GAgFoC,uBAhFpC,EAAA,CAAA,CAAA,EAiFR,2BAjFQ,EAAA;;;AA2EX;;;;AAKqB,iBAyDL,gBAAA,CAzDK,KAAA,EAAA,GAAA,CAAA,EAAA,KAAA,IAyDkC,cAzDlC;;;;;AAyDrB;AAUA;AACS,iBADO,6BAAA,CACP,KAAA,EAAA,uBAAA,GAA0B,2BAA1B,CAAA,EAAA,KAAA,IACG,2BADH;;;;AAcT;;;iBAAgB,eAAA,UACN,sBACP;;;UCxOc,gBAAA;;aAEJ;iBACI;WACN;ADOX;AA+BA;;;;;;AAoBA;AACW,cCjDE,SDiDF,EAAA,CAAA,IAAA,EAAA,MAAA,GAAA,IAAA,EAAA,OAAA,CAAA,EC/CA,gBD+CA,EAAA,GC9CR,KD8C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AA,MAAA,CAAA,EIjG9B,UJiG8B;;;;;;;;AApIjC;AA+BA;;AAEkB,iBKvCF,iBAAA,CLuCE,IAAA,EKtCV,WLsCU,EAAA,EAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,MAAA,CAAA,EKnCf,iBLmCe,GAAA,SAAA;;;;;;;;;AAjClB;AA+BA;AACW,iBMvCW,SAAA,CNuCX,GAAA,EMtCJ,KNsCI,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,UAAA,CAAA,EAAA,OAAA,CAAA,EMnCS,ONmCT,CAAA,IAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powerlines",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The \"any framework\" framework that simplifies modern dev tool usage, generates virtual (or actual) code modules, and improves DX across the board.",
|
|
6
6
|
"keywords": [
|
|
@@ -341,21 +341,21 @@
|
|
|
341
341
|
"dependencies": {
|
|
342
342
|
"@cacheable/memory": "^2.0.8",
|
|
343
343
|
"@donedeal0/superdiff": "^3.2.0",
|
|
344
|
-
"@powerlines/core": "^0.
|
|
345
|
-
"@storm-software/config": "^1.135.
|
|
346
|
-
"@storm-software/config-tools": "^1.189.
|
|
344
|
+
"@powerlines/core": "^0.2.0",
|
|
345
|
+
"@storm-software/config": "^1.135.18",
|
|
346
|
+
"@storm-software/config-tools": "^1.189.17",
|
|
347
347
|
"@stryke/capnp": "^0.12.75",
|
|
348
|
-
"@stryke/convert": "^0.6.
|
|
349
|
-
"@stryke/env": "^0.20.
|
|
350
|
-
"@stryke/fs": "^0.33.
|
|
351
|
-
"@stryke/hash": "^0.13.
|
|
352
|
-
"@stryke/helpers": "^0.9.
|
|
353
|
-
"@stryke/http": "^0.12.
|
|
354
|
-
"@stryke/json": "^0.14.
|
|
355
|
-
"@stryke/path": "^0.26.
|
|
348
|
+
"@stryke/convert": "^0.6.49",
|
|
349
|
+
"@stryke/env": "^0.20.70",
|
|
350
|
+
"@stryke/fs": "^0.33.53",
|
|
351
|
+
"@stryke/hash": "^0.13.6",
|
|
352
|
+
"@stryke/helpers": "^0.9.51",
|
|
353
|
+
"@stryke/http": "^0.12.45",
|
|
354
|
+
"@stryke/json": "^0.14.3",
|
|
355
|
+
"@stryke/path": "^0.26.15",
|
|
356
356
|
"@stryke/string-format": "^0.14.8",
|
|
357
|
-
"@stryke/type-checks": "^0.5.
|
|
358
|
-
"@stryke/unique-id": "^0.3.
|
|
357
|
+
"@stryke/type-checks": "^0.5.34",
|
|
358
|
+
"@stryke/unique-id": "^0.3.64",
|
|
359
359
|
"bundle-require": "^5.1.0",
|
|
360
360
|
"compatx": "^0.2.0",
|
|
361
361
|
"defu": "^6.1.4",
|
|
@@ -369,22 +369,22 @@
|
|
|
369
369
|
"unplugin": "^3.0.0"
|
|
370
370
|
},
|
|
371
371
|
"devDependencies": {
|
|
372
|
-
"@powerlines/plugin-esbuild": "^0.13.
|
|
373
|
-
"@powerlines/plugin-rolldown": "^0.7.
|
|
374
|
-
"@powerlines/plugin-rollup": "^0.7.
|
|
375
|
-
"@powerlines/plugin-rspack": "^0.5.
|
|
376
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
377
|
-
"@powerlines/plugin-tsup": "^0.12.
|
|
378
|
-
"@powerlines/plugin-unbuild": "^0.5.
|
|
379
|
-
"@powerlines/plugin-vite": "^0.14.
|
|
380
|
-
"@powerlines/plugin-webpack": "^0.5.
|
|
381
|
-
"@storm-software/testing-tools": "^1.119.
|
|
382
|
-
"@stryke/types": "^0.10.
|
|
372
|
+
"@powerlines/plugin-esbuild": "^0.13.322",
|
|
373
|
+
"@powerlines/plugin-rolldown": "^0.7.324",
|
|
374
|
+
"@powerlines/plugin-rollup": "^0.7.323",
|
|
375
|
+
"@powerlines/plugin-rspack": "^0.5.322",
|
|
376
|
+
"@powerlines/plugin-tsdown": "^0.1.267",
|
|
377
|
+
"@powerlines/plugin-tsup": "^0.12.323",
|
|
378
|
+
"@powerlines/plugin-unbuild": "^0.5.323",
|
|
379
|
+
"@powerlines/plugin-vite": "^0.14.316",
|
|
380
|
+
"@powerlines/plugin-webpack": "^0.5.322",
|
|
381
|
+
"@storm-software/testing-tools": "^1.119.92",
|
|
382
|
+
"@stryke/types": "^0.10.48",
|
|
383
383
|
"@types/bun": "^1.3.10",
|
|
384
|
-
"@types/node": "^25.3.
|
|
384
|
+
"@types/node": "^25.3.5",
|
|
385
385
|
"@types/semver": "^7.7.1",
|
|
386
386
|
"bun-types-no-globals": "^1.3.10",
|
|
387
|
-
"rolldown": "1.0.0-rc.
|
|
387
|
+
"rolldown": "1.0.0-rc.7",
|
|
388
388
|
"tsdown": "^0.17.2",
|
|
389
389
|
"typescript": "^5.9.3",
|
|
390
390
|
"undici-types": "^7.22.0"
|
|
@@ -425,5 +425,5 @@
|
|
|
425
425
|
"unloader": { "optional": true }
|
|
426
426
|
},
|
|
427
427
|
"publishConfig": { "access": "public" },
|
|
428
|
-
"gitHead": "
|
|
428
|
+
"gitHead": "50b8a5ce8e5dbafd182ff7c8659469af86eef47c"
|
|
429
429
|
}
|