powerlines 0.41.6 → 0.41.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -16
- package/dist/{api-CY668wMZ.mjs → api-6f2oVwGy.mjs} +142 -333
- package/dist/api-6f2oVwGy.mjs.map +1 -0
- package/dist/{api-GPlMYw0d.cjs → api-CFXLaAxU.cjs} +505 -722
- package/dist/astro.cjs +8 -18
- package/dist/astro.d.cts +1 -2
- package/dist/astro.d.cts.map +1 -1
- package/dist/astro.d.mts +1 -6
- package/dist/astro.d.mts.map +1 -1
- package/dist/astro.mjs +6 -16
- package/dist/astro.mjs.map +1 -1
- package/dist/{chunk-CbDLau6x.cjs → chunk-AIJqnxB6.cjs} +27 -1
- package/dist/chunk-CtajNgzt.mjs +36 -0
- package/dist/config.cjs +20 -4
- package/dist/config.d.cts +1 -2
- package/dist/config.d.mts +1 -3
- package/dist/config.mjs +11 -2
- package/dist/config.mjs.map +1 -0
- package/dist/constants.cjs +20 -20
- package/dist/constants.d.cts +1 -24
- package/dist/constants.d.mts +1 -24
- package/dist/constants.mjs +11 -3
- package/dist/constants.mjs.map +1 -0
- package/dist/context/index.cjs +4 -9
- package/dist/context/index.d.cts +56 -132
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +55 -135
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -9
- package/dist/esbuild.cjs +60 -17
- package/dist/esbuild.d.cts +5 -29
- package/dist/esbuild.d.cts.map +1 -1
- package/dist/esbuild.d.mts +5 -33
- package/dist/esbuild.d.mts.map +1 -1
- package/dist/esbuild.mjs +44 -12
- package/dist/esbuild.mjs.map +1 -0
- package/dist/farm.cjs +6 -13
- package/dist/farm.d.cts +2 -3
- package/dist/farm.d.cts.map +1 -1
- package/dist/farm.d.mts +2 -6
- package/dist/farm.d.mts.map +1 -1
- package/dist/farm.mjs +4 -11
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +7 -13
- package/dist/index.d.cts +263 -6
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +263 -7
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -9
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +7 -14
- package/dist/next.d.cts +0 -1
- package/dist/next.d.cts.map +1 -1
- package/dist/next.d.mts +0 -1
- package/dist/next.d.mts.map +1 -1
- package/dist/next.mjs +6 -13
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.cjs +12 -22
- package/dist/nuxt.d.cts +2 -3
- package/dist/nuxt.d.cts.map +1 -1
- package/dist/nuxt.d.mts +2 -7
- package/dist/nuxt.d.mts.map +1 -1
- package/dist/nuxt.mjs +8 -18
- package/dist/nuxt.mjs.map +1 -1
- package/dist/plugin-utils.cjs +20 -28
- package/dist/plugin-utils.d.cts +1 -267
- package/dist/plugin-utils.d.mts +1 -272
- package/dist/plugin-utils.mjs +11 -4
- package/dist/plugin-utils.mjs.map +1 -0
- package/dist/rolldown.cjs +52 -18
- package/dist/rolldown.d.cts +5 -29
- package/dist/rolldown.d.cts.map +1 -1
- package/dist/rolldown.d.mts +5 -32
- package/dist/rolldown.d.mts.map +1 -1
- package/dist/rolldown.mjs +36 -13
- package/dist/rolldown.mjs.map +1 -0
- package/dist/rollup.cjs +20 -48
- package/dist/rollup.d.cts +5 -29
- package/dist/rollup.d.cts.map +1 -1
- package/dist/rollup.d.mts +5 -32
- package/dist/rollup.d.mts.map +1 -1
- package/dist/rollup.mjs +6 -44
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +20 -82
- package/dist/rspack.d.cts +4 -24
- package/dist/rspack.d.cts.map +1 -1
- package/dist/rspack.d.mts +4 -27
- package/dist/rspack.d.mts.map +1 -1
- package/dist/rspack.mjs +5 -77
- package/dist/rspack.mjs.map +1 -1
- package/dist/storage/index.cjs +2 -3
- package/dist/storage/index.d.cts +7 -7
- package/dist/storage/index.d.cts.map +1 -1
- package/dist/storage/index.d.mts +7 -11
- package/dist/storage/index.d.mts.map +1 -1
- package/dist/storage/index.mjs +1 -3
- package/dist/{tsconfig-C8M8X6U0.cjs → tsconfig-BJrUrPC_.cjs} +13 -13
- package/dist/{tsconfig-B92heKit.mjs → tsconfig-D9GCB2I9.mjs} +5 -5
- package/dist/tsconfig-D9GCB2I9.mjs.map +1 -0
- package/dist/tsdown.cjs +38 -187
- package/dist/tsdown.d.cts +2 -24
- package/dist/tsdown.d.cts.map +1 -1
- package/dist/tsdown.d.mts +4 -30
- package/dist/tsdown.d.mts.map +1 -1
- package/dist/tsdown.mjs +8 -167
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +29 -134
- package/dist/tsup.d.cts +2 -24
- package/dist/tsup.d.cts.map +1 -1
- package/dist/tsup.d.mts +2 -28
- package/dist/tsup.d.mts.map +1 -1
- package/dist/tsup.mjs +7 -122
- package/dist/tsup.mjs.map +1 -1
- package/dist/types-DerAvFjs.d.cts +4 -0
- package/dist/types-DerAvFjs.d.cts.map +1 -0
- package/dist/types-ro7jWCtL.d.mts +4 -0
- package/dist/types-ro7jWCtL.d.mts.map +1 -0
- package/dist/typescript/index.cjs +2 -1
- package/dist/typescript/index.d.cts +2 -2
- package/dist/typescript/index.d.cts.map +1 -1
- package/dist/typescript/index.d.mts +1 -4
- package/dist/typescript/index.d.mts.map +1 -1
- package/dist/typescript/index.mjs +1 -1
- package/dist/unloader.cjs +6 -13
- package/dist/unloader.d.cts +2 -4
- package/dist/unloader.d.cts.map +1 -1
- package/dist/unloader.d.mts +2 -7
- package/dist/unloader.d.mts.map +1 -1
- package/dist/unloader.mjs +4 -11
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.cjs +11 -14
- package/dist/unplugin.d.cts +5 -6
- package/dist/unplugin.d.cts.map +1 -1
- package/dist/unplugin.d.mts +3 -6
- package/dist/unplugin.d.mts.map +1 -1
- package/dist/unplugin.mjs +6 -10
- package/dist/utils.cjs +38 -22
- package/dist/utils.d.cts +3 -2
- package/dist/utils.d.mts +3 -3
- package/dist/utils.mjs +19 -3
- package/dist/utils.mjs.map +1 -0
- package/dist/{virtual-B1MLgqnQ.cjs → virtual-Cbvj12lU.cjs} +33 -33
- package/dist/{virtual-B9imjOqe.mjs → virtual-DvkJm7gK.mjs} +7 -7
- package/dist/virtual-DvkJm7gK.mjs.map +1 -0
- package/dist/vite.cjs +84 -19
- package/dist/vite.d.cts +5 -16
- package/dist/vite.d.cts.map +1 -1
- package/dist/vite.d.mts +5 -19
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +67 -14
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +42 -16
- package/dist/webpack.d.cts +5 -29
- package/dist/webpack.d.cts.map +1 -1
- package/dist/webpack.d.mts +5 -32
- package/dist/webpack.d.mts.map +1 -1
- package/dist/webpack.mjs +26 -11
- package/dist/webpack.mjs.map +1 -0
- package/package.json +15 -15
- package/dist/api-CY668wMZ.mjs.map +0 -1
- package/dist/commands-7TWNqTU1.d.cts +0 -12
- package/dist/commands-7TWNqTU1.d.cts.map +0 -1
- package/dist/commands-yacLkOi0.d.mts +0 -12
- package/dist/commands-yacLkOi0.d.mts.map +0 -1
- package/dist/config-CK756s0L.d.mts +0 -2232
- package/dist/config-CK756s0L.d.mts.map +0 -1
- package/dist/config-CiPXgwzt.d.mts +0 -39
- package/dist/config-CiPXgwzt.d.mts.map +0 -1
- package/dist/config-D4Fh2gQL.mjs +0 -87
- package/dist/config-D4Fh2gQL.mjs.map +0 -1
- package/dist/config-D86Vw7SC.cjs +0 -105
- package/dist/config-J74ORCFY.d.cts +0 -39
- package/dist/config-J74ORCFY.d.cts.map +0 -1
- package/dist/config-vnrrSxEB.d.cts +0 -2232
- package/dist/config-vnrrSxEB.d.cts.map +0 -1
- package/dist/constants-CZh5rsgh.cjs +0 -103
- package/dist/constants-cXxSHhNp.mjs +0 -32
- package/dist/constants-cXxSHhNp.mjs.map +0 -1
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts.map +0 -1
- package/dist/esbuild-B3NuCco0.cjs +0 -100
- package/dist/esbuild-DWiE0pYc.mjs +0 -82
- package/dist/esbuild-DWiE0pYc.mjs.map +0 -1
- package/dist/index-2JXW-b2-.d.mts +0 -82
- package/dist/index-2JXW-b2-.d.mts.map +0 -1
- package/dist/index-6BLROVtJ.d.mts +0 -261
- package/dist/index-6BLROVtJ.d.mts.map +0 -1
- package/dist/index-C7W0kmm7.d.mts +0 -171
- package/dist/index-C7W0kmm7.d.mts.map +0 -1
- package/dist/index-DJ-k0GOX.d.cts +0 -261
- package/dist/index-DJ-k0GOX.d.cts.map +0 -1
- package/dist/paths-CS8ecCnW.mjs +0 -81
- package/dist/paths-CS8ecCnW.mjs.map +0 -1
- package/dist/paths-YmyIGEVo.cjs +0 -98
- package/dist/plugin-B9TQt-p0.d.cts +0 -82
- package/dist/plugin-B9TQt-p0.d.cts.map +0 -1
- package/dist/plugin-BE3wmhoU.d.cts +0 -26
- package/dist/plugin-BE3wmhoU.d.cts.map +0 -1
- package/dist/plugin-CZ_PJPpQ.cjs +0 -96
- package/dist/plugin-C_8RhG5V.d.mts +0 -26
- package/dist/plugin-C_8RhG5V.d.mts.map +0 -1
- package/dist/plugin-E5foRD0k.mjs +0 -61
- package/dist/plugin-E5foRD0k.mjs.map +0 -1
- package/dist/plugin-utils-C3HnZJl1.mjs +0 -387
- package/dist/plugin-utils-C3HnZJl1.mjs.map +0 -1
- package/dist/plugin-utils-Ck3cx3w6.cjs +0 -531
- package/dist/plugin-utils.d.cts.map +0 -1
- package/dist/plugin-utils.d.mts.map +0 -1
- package/dist/resolve-options-6sXFqzEA.mjs +0 -116
- package/dist/resolve-options-6sXFqzEA.mjs.map +0 -1
- package/dist/resolve-options-BQnTgg3V.cjs +0 -105
- package/dist/resolve-options-D-RGs8j8.mjs +0 -117
- package/dist/resolve-options-D-RGs8j8.mjs.map +0 -1
- package/dist/resolve-options-DHL3RM8F.mjs +0 -87
- package/dist/resolve-options-DHL3RM8F.mjs.map +0 -1
- package/dist/resolve-options-lxQ2pm0W.cjs +0 -127
- package/dist/resolve-options-vyFhhkLp.cjs +0 -133
- package/dist/rolldown-CQI8ps6f.cjs +0 -83
- package/dist/rolldown-DsXEFXyP.mjs +0 -65
- package/dist/rolldown-DsXEFXyP.mjs.map +0 -1
- package/dist/tsconfig-B92heKit.mjs.map +0 -1
- package/dist/types-Bh_vLuQ0.d.mts +0 -1
- package/dist/utils-BbDma_5Y.cjs +0 -449
- package/dist/utils-DoQcX7Sk.mjs +0 -339
- package/dist/utils-DoQcX7Sk.mjs.map +0 -1
- package/dist/virtual-B9imjOqe.mjs.map +0 -1
- package/dist/vite-Bx1gbbj3.mjs +0 -171
- package/dist/vite-Bx1gbbj3.mjs.map +0 -1
- package/dist/vite-XV170zx6.cjs +0 -189
- package/dist/webpack-9G4xJBfz.cjs +0 -107
- package/dist/webpack-BkTkELre.mjs +0 -88
- package/dist/webpack-BkTkELre.mjs.map +0 -1
- package/dist/write-file-CpNWY8SV.d.cts +0 -171
- package/dist/write-file-CpNWY8SV.d.cts.map +0 -1
package/dist/utils.mjs
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import { _ as resolveInputs, a as getString, c as getFileHeaderWarningText, d as extendLog, f as getUniqueInputs, g as resolveInput, h as resolveEntryOutput, i as getSourceFile, l as getTypescriptFileHeader, m as isTypeDefinition, n as generateSourceMap, o as getFileHeader, p as isResolvedEntryTypeDefinition, r as getMagicString, s as getFileHeaderWarning, t as writeFile, u as createLog, v as resolveInputsSync } from "./utils-DoQcX7Sk.mjs";
|
|
1
|
+
import { n as __reExport, t as __exportAll } from "./chunk-CtajNgzt.mjs";
|
|
3
2
|
|
|
4
|
-
export
|
|
3
|
+
export * from "@powerlines/core/lib/entry"
|
|
4
|
+
|
|
5
|
+
export * from "@powerlines/core/lib/logger"
|
|
6
|
+
|
|
7
|
+
export * from "@powerlines/core/lib/utilities"
|
|
8
|
+
|
|
9
|
+
//#region src/utils.ts
|
|
10
|
+
var utils_exports = /* @__PURE__ */ __exportAll({});
|
|
11
|
+
import * as import__powerlines_core_lib_entry from "@powerlines/core/lib/entry";
|
|
12
|
+
__reExport(utils_exports, import__powerlines_core_lib_entry);
|
|
13
|
+
import * as import__powerlines_core_lib_logger from "@powerlines/core/lib/logger";
|
|
14
|
+
__reExport(utils_exports, import__powerlines_core_lib_logger);
|
|
15
|
+
import * as import__powerlines_core_lib_utilities from "@powerlines/core/lib/utilities";
|
|
16
|
+
__reExport(utils_exports, import__powerlines_core_lib_utilities);
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { utils_exports as t };
|
|
20
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.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\nexport * from \"@powerlines/core/lib/entry\";\nexport * from \"@powerlines/core/lib/logger\";\nexport * from \"@powerlines/core/lib/utilities\";\n"],"mappings":""}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const require_chunk = require('./chunk-
|
|
2
|
-
const require_utils = require('./utils
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
1
|
+
const require_chunk = require('./chunk-AIJqnxB6.cjs');
|
|
2
|
+
const require_utils = require('./utils.cjs');
|
|
3
|
+
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
4
|
+
let _stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
5
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
6
|
+
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
7
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
|
+
let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
|
|
9
|
+
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
10
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
11
|
+
let _stryke_path_correct_path = require("@stryke/path/correct-path");
|
|
12
|
+
let _stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
13
|
+
let _stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
14
|
+
let _stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
10
15
|
let node_fs = require("node:fs");
|
|
11
|
-
let __stryke_fs_exists = require("@stryke/fs/exists");
|
|
12
|
-
let __stryke_path_correct_path = require("@stryke/path/correct-path");
|
|
13
|
-
let __stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
14
|
-
let __stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
15
|
-
let __stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
16
16
|
let node_fs_promises = require("node:fs/promises");
|
|
17
17
|
let node_path = require("node:path");
|
|
18
18
|
|
|
@@ -106,7 +106,7 @@ var BaseStorageAdapter = class {
|
|
|
106
106
|
if (!this.isReadOnly && this.overwrite) {
|
|
107
107
|
const keys = this.listSync(base || this.options.base);
|
|
108
108
|
if (!keys.length) return;
|
|
109
|
-
keys.map((key) => this.removeSync(base && !key.startsWith(base) ? (0,
|
|
109
|
+
keys.map((key) => this.removeSync(base && !key.startsWith(base) ? (0, _stryke_path_join.joinPaths)(base, key) : key));
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
@@ -119,7 +119,7 @@ var BaseStorageAdapter = class {
|
|
|
119
119
|
if (!this.isReadOnly && this.overwrite) {
|
|
120
120
|
const keys = await this.list(base || this.options.base);
|
|
121
121
|
if (!keys.length) return;
|
|
122
|
-
await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? (0,
|
|
122
|
+
await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? (0, _stryke_path_join.joinPaths)(base, key) : key)));
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
@@ -208,7 +208,7 @@ var BaseStorageAdapter = class {
|
|
|
208
208
|
resolve(key) {
|
|
209
209
|
if (!key) return this.options.base;
|
|
210
210
|
if (/\.\.:|\.\.$/.test(key)) throw new Error(`[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`);
|
|
211
|
-
return (0,
|
|
211
|
+
return (0, _stryke_path_append.appendPath)((0, _stryke_path_correct_path.correctPath)(key).replace(/:/g, "/"), this.options.base);
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
214
|
* Disposes of the storage adapter, releasing any held resources.
|
|
@@ -232,7 +232,7 @@ var BaseStorageAdapter = class {
|
|
|
232
232
|
* @returns `true` if the error is a file system error, otherwise `false`.
|
|
233
233
|
*/
|
|
234
234
|
function isFileError(err) {
|
|
235
|
-
return (0,
|
|
235
|
+
return (0, _stryke_type_checks_is_error.isError)(err) && "code" in err && err.code;
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Ignores file not found errors.
|
|
@@ -286,7 +286,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
286
286
|
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
287
287
|
*/
|
|
288
288
|
existsSync(key) {
|
|
289
|
-
return (0,
|
|
289
|
+
return (0, _stryke_fs_exists.existsSync)(this.resolve(key));
|
|
290
290
|
}
|
|
291
291
|
/**
|
|
292
292
|
* Asynchronously checks if a key exists in the storage.
|
|
@@ -295,7 +295,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
295
295
|
* @returns A promise that resolves to `true` if the key exists, otherwise `false`.
|
|
296
296
|
*/
|
|
297
297
|
async exists(key) {
|
|
298
|
-
return (0,
|
|
298
|
+
return (0, _stryke_fs_exists.exists)(this.resolve(key));
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
* Synchronously retrieves the value associated with a given key.
|
|
@@ -304,7 +304,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
304
304
|
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
305
305
|
*/
|
|
306
306
|
getSync(key) {
|
|
307
|
-
return (0,
|
|
307
|
+
return (0, _stryke_fs_read_file.readFileSync)(this.resolve(key));
|
|
308
308
|
}
|
|
309
309
|
/**
|
|
310
310
|
* Asynchronously retrieves the value associated with a given key.
|
|
@@ -313,7 +313,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
313
313
|
* @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
|
|
314
314
|
*/
|
|
315
315
|
async get(key) {
|
|
316
|
-
return (0,
|
|
316
|
+
return (0, _stryke_fs_read_file.readFile)(this.resolve(key));
|
|
317
317
|
}
|
|
318
318
|
/**
|
|
319
319
|
* Synchronously sets the value for a given key.
|
|
@@ -324,8 +324,8 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
324
324
|
setSync(key, value) {
|
|
325
325
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
326
326
|
const existingValue = this.getSync(this.resolve(key));
|
|
327
|
-
if ((0,
|
|
328
|
-
} else return (0,
|
|
327
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(existingValue) && existingValue.includes((0, require_utils.utils_exports.getFileHeaderWarningText)(true, this.context.config.framework))) return (0, _stryke_fs_write_file.writeFileSync)(this.resolve(key), existingValue.replace((0, require_utils.utils_exports.getFileHeaderWarningText)(true, this.context.config.framework), (0, require_utils.utils_exports.getFileHeaderWarningText)(false, this.context.config.framework)));
|
|
328
|
+
} else return (0, _stryke_fs_write_file.writeFileSync)(this.resolve(key), value);
|
|
329
329
|
}
|
|
330
330
|
/**
|
|
331
331
|
* Asynchronously sets the value for a given key.
|
|
@@ -336,8 +336,8 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
336
336
|
async set(key, value) {
|
|
337
337
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
338
338
|
const existingValue = await this.get(this.resolve(key));
|
|
339
|
-
if ((0,
|
|
340
|
-
} else return (0,
|
|
339
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(existingValue) && existingValue.includes((0, require_utils.utils_exports.getFileHeaderWarningText)(true, this.context.config.framework))) return (0, _stryke_fs_write_file.writeFile)(this.resolve(key), existingValue.replace((0, require_utils.utils_exports.getFileHeaderWarningText)(true, this.context.config.framework), (0, require_utils.utils_exports.getFileHeaderWarningText)(false, this.context.config.framework)));
|
|
340
|
+
} else return (0, _stryke_fs_write_file.writeFile)(this.resolve(key), value);
|
|
341
341
|
}
|
|
342
342
|
/**
|
|
343
343
|
* Synchronously removes a key from the storage.
|
|
@@ -365,7 +365,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
365
365
|
* @param dirPath - The path of the directory to create.
|
|
366
366
|
*/
|
|
367
367
|
mkdirSync(dirPath) {
|
|
368
|
-
(0,
|
|
368
|
+
(0, _stryke_fs_helpers.createDirectorySync)(this.resolve(dirPath));
|
|
369
369
|
}
|
|
370
370
|
/**
|
|
371
371
|
* Creates a directory at the specified path.
|
|
@@ -373,7 +373,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
373
373
|
* @param dirPath - The path of the directory to create.
|
|
374
374
|
*/
|
|
375
375
|
async mkdir(dirPath) {
|
|
376
|
-
await (0,
|
|
376
|
+
await (0, _stryke_fs_helpers.createDirectory)(this.resolve(dirPath));
|
|
377
377
|
}
|
|
378
378
|
/**
|
|
379
379
|
* Lists all keys under a given base path synchronously.
|
|
@@ -383,7 +383,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
383
383
|
*/
|
|
384
384
|
listSync(base) {
|
|
385
385
|
try {
|
|
386
|
-
return (0,
|
|
386
|
+
return (0, _stryke_fs_list_files.listFilesSync)(this.resolve(base), { ignore: this.options.ignore });
|
|
387
387
|
} catch (err) {
|
|
388
388
|
return ignoreNotfound(err) ?? [];
|
|
389
389
|
}
|
|
@@ -395,7 +395,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
395
395
|
* @returns A promise that resolves to an array of keys under the specified base path.
|
|
396
396
|
*/
|
|
397
397
|
async list(base) {
|
|
398
|
-
return (0,
|
|
398
|
+
return (0, _stryke_fs_list_files.listFiles)(this.resolve(base), { ignore: this.options.ignore }).catch(ignoreNotfound).then((r) => r || []);
|
|
399
399
|
}
|
|
400
400
|
/**
|
|
401
401
|
* Synchronously checks if the given key is a directory.
|
|
@@ -404,7 +404,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
404
404
|
* @returns `true` if the key is a directory, otherwise `false`.
|
|
405
405
|
*/
|
|
406
406
|
isDirectorySync(key) {
|
|
407
|
-
return (0,
|
|
407
|
+
return (0, _stryke_fs_is_file.isDirectory)(this.resolve(key));
|
|
408
408
|
}
|
|
409
409
|
/**
|
|
410
410
|
* Synchronously checks if the given key is a file.
|
|
@@ -413,7 +413,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
413
413
|
* @returns `true` if the key is a file, otherwise `false`.
|
|
414
414
|
*/
|
|
415
415
|
isFileSync(key) {
|
|
416
|
-
return (0,
|
|
416
|
+
return (0, _stryke_fs_is_file.isFile)(this.resolve(key));
|
|
417
417
|
}
|
|
418
418
|
};
|
|
419
419
|
|
|
@@ -489,7 +489,7 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
|
489
489
|
* @returns An array of keys under the specified base path.
|
|
490
490
|
*/
|
|
491
491
|
listSync(base) {
|
|
492
|
-
return [...this.data.keys().filter((key) => !base ? true : (0,
|
|
492
|
+
return [...this.data.keys().filter((key) => !base ? true : (0, _stryke_path_is_parent_path.isParentPath)(key, this.resolve(base)))];
|
|
493
493
|
}
|
|
494
494
|
/**
|
|
495
495
|
* Disposes of the storage adapter, releasing any held resources.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as utils_exports } from "./utils.mjs";
|
|
2
2
|
import { createDirectory, createDirectorySync } from "@stryke/fs/helpers";
|
|
3
3
|
import { listFiles, listFilesSync } from "@stryke/fs/list-files";
|
|
4
4
|
import { appendPath } from "@stryke/path/append";
|
|
5
5
|
import { isError } from "@stryke/type-checks/is-error";
|
|
6
6
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
7
7
|
import { isParentPath } from "@stryke/path/is-parent-path";
|
|
8
|
+
import { exists, existsSync } from "@stryke/fs/exists";
|
|
8
9
|
import { joinPaths } from "@stryke/path/join";
|
|
9
|
-
import { unlinkSync } from "node:fs";
|
|
10
|
-
import { exists, existsSync as existsSync$1 } from "@stryke/fs/exists";
|
|
11
10
|
import { correctPath } from "@stryke/path/correct-path";
|
|
12
11
|
import { isDirectory, isFile } from "@stryke/fs/is-file";
|
|
13
12
|
import { readFile, readFileSync } from "@stryke/fs/read-file";
|
|
14
13
|
import { writeFile, writeFileSync } from "@stryke/fs/write-file";
|
|
14
|
+
import { unlinkSync } from "node:fs";
|
|
15
15
|
import { unlink } from "node:fs/promises";
|
|
16
16
|
import { resolve } from "node:path";
|
|
17
17
|
|
|
@@ -285,7 +285,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
285
285
|
* @returns Returns `true` if the key exists, otherwise `false`.
|
|
286
286
|
*/
|
|
287
287
|
existsSync(key) {
|
|
288
|
-
return existsSync
|
|
288
|
+
return existsSync(this.resolve(key));
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Asynchronously checks if a key exists in the storage.
|
|
@@ -323,7 +323,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
323
323
|
setSync(key, value) {
|
|
324
324
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
325
325
|
const existingValue = this.getSync(this.resolve(key));
|
|
326
|
-
if (isSetString(existingValue) && existingValue.includes(getFileHeaderWarningText(true, this.context.config.framework))) return writeFileSync(this.resolve(key), existingValue.replace(getFileHeaderWarningText(true, this.context.config.framework), getFileHeaderWarningText(false, this.context.config.framework)));
|
|
326
|
+
if (isSetString(existingValue) && existingValue.includes((0, utils_exports.getFileHeaderWarningText)(true, this.context.config.framework))) return writeFileSync(this.resolve(key), existingValue.replace((0, utils_exports.getFileHeaderWarningText)(true, this.context.config.framework), (0, utils_exports.getFileHeaderWarningText)(false, this.context.config.framework)));
|
|
327
327
|
} else return writeFileSync(this.resolve(key), value);
|
|
328
328
|
}
|
|
329
329
|
/**
|
|
@@ -335,7 +335,7 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
335
335
|
async set(key, value) {
|
|
336
336
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
337
337
|
const existingValue = await this.get(this.resolve(key));
|
|
338
|
-
if (isSetString(existingValue) && existingValue.includes(getFileHeaderWarningText(true, this.context.config.framework))) return writeFile(this.resolve(key), existingValue.replace(getFileHeaderWarningText(true, this.context.config.framework), getFileHeaderWarningText(false, this.context.config.framework)));
|
|
338
|
+
if (isSetString(existingValue) && existingValue.includes((0, utils_exports.getFileHeaderWarningText)(true, this.context.config.framework))) return writeFile(this.resolve(key), existingValue.replace((0, utils_exports.getFileHeaderWarningText)(true, this.context.config.framework), (0, utils_exports.getFileHeaderWarningText)(false, this.context.config.framework)));
|
|
339
339
|
} else return writeFile(this.resolve(key), value);
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
@@ -510,4 +510,4 @@ var VirtualStorageAdapter = class extends BaseStorageAdapter {
|
|
|
510
510
|
|
|
511
511
|
//#endregion
|
|
512
512
|
export { isFileError as a, ignoreNotfound as i, FileSystemStorageAdapter as n, BaseStorageAdapter as o, ignoreExists as r, VirtualStorageAdapter as t };
|
|
513
|
-
//# sourceMappingURL=virtual-
|
|
513
|
+
//# sourceMappingURL=virtual-DvkJm7gK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-DvkJm7gK.mjs","names":["#isDisposed"],"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,AAAU,SACV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AA2C,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"}
|
package/dist/vite.cjs
CHANGED
|
@@ -1,20 +1,85 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
require('./
|
|
3
|
-
require('./
|
|
4
|
-
require('./
|
|
5
|
-
require('./
|
|
6
|
-
require(
|
|
7
|
-
|
|
8
|
-
require(
|
|
9
|
-
require(
|
|
10
|
-
require(
|
|
11
|
-
require(
|
|
12
|
-
|
|
13
|
-
require('./resolve-options-lxQ2pm0W.cjs');
|
|
14
|
-
const require_vite = require('./vite-XV170zx6.cjs');
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_chunk = require('./chunk-AIJqnxB6.cjs');
|
|
3
|
+
const require_api = require('./api-CFXLaAxU.cjs');
|
|
4
|
+
require('./tsconfig-BJrUrPC_.cjs');
|
|
5
|
+
require('./virtual-Cbvj12lU.cjs');
|
|
6
|
+
let defu = require("defu");
|
|
7
|
+
defu = require_chunk.__toESM(defu);
|
|
8
|
+
let unplugin = require("unplugin");
|
|
9
|
+
let _powerlines_plugin_vite_helpers_resolve_options = require("@powerlines/plugin-vite/helpers/resolve-options");
|
|
10
|
+
let _stryke_env_environment_checks = require("@stryke/env/environment-checks");
|
|
11
|
+
let _powerlines_plugin_vite = require("@powerlines/plugin-vite");
|
|
12
|
+
_powerlines_plugin_vite = require_chunk.__toESM(_powerlines_plugin_vite);
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
//#region src/vite.ts
|
|
15
|
+
/**
|
|
16
|
+
* A Vite plugin that will invoke the Powerlines API hooks during the build process.
|
|
17
|
+
*
|
|
18
|
+
* @see https://vitejs.dev/guide/api-plugin.html#plugin-api
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* // vite.config.ts
|
|
23
|
+
* import powerlines from "powerlines/vite";
|
|
24
|
+
*
|
|
25
|
+
* export default defineConfig({
|
|
26
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
const unplugin$1 = (0, unplugin.createVitePlugin)(require_api.createUnpluginFactory("vite", (api, plugin) => {
|
|
32
|
+
return {
|
|
33
|
+
...plugin,
|
|
34
|
+
vite: {
|
|
35
|
+
sharedDuringBuild: true,
|
|
36
|
+
async hotUpdate(options) {
|
|
37
|
+
const environment = await api.context.getEnvironment();
|
|
38
|
+
return api.callHook("vite:hotUpdate", { environment }, options);
|
|
39
|
+
},
|
|
40
|
+
async config(config, env) {
|
|
41
|
+
api.context.config.mode = (0, _stryke_env_environment_checks.isDevelopmentMode)(env.mode) ? "development" : (0, _stryke_env_environment_checks.isTestMode)(env.mode) ? "test" : "production";
|
|
42
|
+
const environment = await api.context.getEnvironment();
|
|
43
|
+
const result = await api.callHook("vite:config", { environment }, config, env);
|
|
44
|
+
return (0, defu.default)((0, _powerlines_plugin_vite_helpers_resolve_options.resolveOptions)(api.context), result?.build ?? {}, config);
|
|
45
|
+
},
|
|
46
|
+
async configResolved(_config) {
|
|
47
|
+
const environment = await api.context.getEnvironment();
|
|
48
|
+
await api.callHook("configResolved", { environment });
|
|
49
|
+
},
|
|
50
|
+
async configureServer(server) {
|
|
51
|
+
const environment = await api.context.getEnvironment();
|
|
52
|
+
return api.callHook("vite:configureServer", { environment }, server);
|
|
53
|
+
},
|
|
54
|
+
async configurePreviewServer(server) {
|
|
55
|
+
const environment = await api.context.getEnvironment();
|
|
56
|
+
return api.callHook("vite:configurePreviewServer", { environment }, server);
|
|
57
|
+
},
|
|
58
|
+
async transformIndexHtml(html, ctx) {
|
|
59
|
+
const environment = await api.context.getEnvironment();
|
|
60
|
+
return api.callHook("vite:transformIndexHtml", { environment }, html, ctx);
|
|
61
|
+
},
|
|
62
|
+
async handleHotUpdate(ctx) {
|
|
63
|
+
const environment = await api.context.getEnvironment();
|
|
64
|
+
return api.callHook("vite:handleHotUpdate", { environment }, ctx);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.default = unplugin$1;
|
|
72
|
+
exports["module.exports"] = unplugin$1;
|
|
73
|
+
exports.unplugin = unplugin$1;
|
|
74
|
+
Object.defineProperty(exports, 'plugin', {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function () {
|
|
77
|
+
return _powerlines_plugin_vite.default;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, 'vite', {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function () {
|
|
83
|
+
return _powerlines_plugin_vite.default;
|
|
84
|
+
}
|
|
85
|
+
});
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import * as vite$1 from "vite";
|
|
2
|
+
import { VitePluginUserConfig } from "@powerlines/plugin-vite/types";
|
|
3
|
+
import plugin, { default as vite } from "@powerlines/plugin-vite";
|
|
4
4
|
|
|
5
|
-
//#region ../plugin-vite/src/index.d.ts
|
|
6
|
-
declare module "@powerlines/core" {
|
|
7
|
-
interface Config {
|
|
8
|
-
vite?: VitePluginOptions;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
13
|
-
*/
|
|
14
|
-
declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(options?: VitePluginOptions) => Plugin<TContext>;
|
|
15
|
-
//#endregion
|
|
16
5
|
//#region src/vite.d.ts
|
|
17
6
|
/**
|
|
18
7
|
* A Vite plugin that will invoke the Powerlines API hooks during the build process.
|
|
@@ -30,7 +19,7 @@ declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(o
|
|
|
30
19
|
*
|
|
31
20
|
* ```
|
|
32
21
|
*/
|
|
33
|
-
declare const unplugin: (options: Partial<VitePluginUserConfig>) =>
|
|
22
|
+
declare const unplugin: (options: Partial<VitePluginUserConfig>) => vite$1.Plugin<any> | vite$1.Plugin<any>[];
|
|
34
23
|
//#endregion
|
|
35
|
-
export { unplugin as default, unplugin as "module.exports", unplugin, plugin,
|
|
24
|
+
export { unplugin as default, unplugin as "module.exports", unplugin, plugin, vite };
|
|
36
25
|
//# sourceMappingURL=vite.d.cts.map
|
package/dist/vite.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.cts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"vite.d.cts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;cAAa,QAAA,GAAQ,OAAA,EAAA,OAAA,CAAA,oBAAA,MAAA,MAAA,CAAA,MAAA,QAAA,MAAA,CAAA,MAAA"}
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "./index-2JXW-b2-.mjs";
|
|
5
|
-
import { n as VitePluginOptions, r as VitePluginUserConfig, t as VitePluginContext } from "./plugin-C_8RhG5V.mjs";
|
|
6
|
-
import * as vite0 from "vite";
|
|
1
|
+
import plugin, { default as vite } from "@powerlines/plugin-vite";
|
|
2
|
+
import * as vite$1 from "vite";
|
|
3
|
+
import { VitePluginUserConfig } from "@powerlines/plugin-vite/types";
|
|
7
4
|
|
|
8
|
-
//#region ../plugin-vite/src/index.d.ts
|
|
9
|
-
declare module "@powerlines/core" {
|
|
10
|
-
interface Config {
|
|
11
|
-
vite?: VitePluginOptions;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A Powerlines plugin to assist in developing other Powerlines plugins.
|
|
16
|
-
*/
|
|
17
|
-
declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(options?: VitePluginOptions) => Plugin<TContext>;
|
|
18
|
-
//#endregion
|
|
19
5
|
//#region src/vite.d.ts
|
|
20
6
|
/**
|
|
21
7
|
* A Vite plugin that will invoke the Powerlines API hooks during the build process.
|
|
@@ -33,7 +19,7 @@ declare const plugin: <TContext extends VitePluginContext = VitePluginContext>(o
|
|
|
33
19
|
*
|
|
34
20
|
* ```
|
|
35
21
|
*/
|
|
36
|
-
declare const unplugin: (options: Partial<VitePluginUserConfig>) =>
|
|
22
|
+
declare const unplugin: (options: Partial<VitePluginUserConfig>) => vite$1.Plugin<any> | vite$1.Plugin<any>[];
|
|
37
23
|
//#endregion
|
|
38
|
-
export { unplugin as default, unplugin as "module.exports", unplugin, plugin,
|
|
24
|
+
export { unplugin as default, unplugin as "module.exports", unplugin, plugin, vite };
|
|
39
25
|
//# sourceMappingURL=vite.d.mts.map
|
package/dist/vite.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.mts","names":[],"sources":["
|
|
1
|
+
{"version":3,"file":"vite.d.mts","names":[],"sources":["../src/vite.ts"],"mappings":";;;;;;;;AA8CA;;;;;;;;;;;;;cAAa,QAAA,GAAQ,OAAA,EAAA,OAAA,CAAA,oBAAA,MAAA,MAAA,CAAA,MAAA,QAAA,MAAA,CAAA,MAAA"}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,15 +1,68 @@
|
|
|
1
|
-
import "./api-
|
|
2
|
-
import "./tsconfig-
|
|
3
|
-
import "./
|
|
4
|
-
import "
|
|
5
|
-
import "
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "./virtual-B9imjOqe.mjs";
|
|
10
|
-
import "./resolve-options-DHL3RM8F.mjs";
|
|
11
|
-
import "./resolve-options-6sXFqzEA.mjs";
|
|
12
|
-
import "./resolve-options-D-RGs8j8.mjs";
|
|
13
|
-
import { n as vite_default, r as src_default, t as unplugin } from "./vite-Bx1gbbj3.mjs";
|
|
1
|
+
import { a as createUnpluginFactory } from "./api-6f2oVwGy.mjs";
|
|
2
|
+
import "./tsconfig-D9GCB2I9.mjs";
|
|
3
|
+
import "./virtual-DvkJm7gK.mjs";
|
|
4
|
+
import defu$1 from "defu";
|
|
5
|
+
import { createVitePlugin } from "unplugin";
|
|
6
|
+
import { resolveOptions } from "@powerlines/plugin-vite/helpers/resolve-options";
|
|
7
|
+
import { isDevelopmentMode, isTestMode } from "@stryke/env/environment-checks";
|
|
8
|
+
import plugin, { default as vite } from "@powerlines/plugin-vite";
|
|
14
9
|
|
|
15
|
-
|
|
10
|
+
//#region src/vite.ts
|
|
11
|
+
/**
|
|
12
|
+
* A Vite plugin that will invoke the Powerlines API hooks during the build process.
|
|
13
|
+
*
|
|
14
|
+
* @see https://vitejs.dev/guide/api-plugin.html#plugin-api
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // vite.config.ts
|
|
19
|
+
* import powerlines from "powerlines/vite";
|
|
20
|
+
*
|
|
21
|
+
* export default defineConfig({
|
|
22
|
+
* plugins: [powerlines({ name: "example-app", ... })],
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
const unplugin = createVitePlugin(createUnpluginFactory("vite", (api, plugin) => {
|
|
28
|
+
return {
|
|
29
|
+
...plugin,
|
|
30
|
+
vite: {
|
|
31
|
+
sharedDuringBuild: true,
|
|
32
|
+
async hotUpdate(options) {
|
|
33
|
+
const environment = await api.context.getEnvironment();
|
|
34
|
+
return api.callHook("vite:hotUpdate", { environment }, options);
|
|
35
|
+
},
|
|
36
|
+
async config(config, env) {
|
|
37
|
+
api.context.config.mode = isDevelopmentMode(env.mode) ? "development" : isTestMode(env.mode) ? "test" : "production";
|
|
38
|
+
const environment = await api.context.getEnvironment();
|
|
39
|
+
const result = await api.callHook("vite:config", { environment }, config, env);
|
|
40
|
+
return defu$1(resolveOptions(api.context), result?.build ?? {}, config);
|
|
41
|
+
},
|
|
42
|
+
async configResolved(_config) {
|
|
43
|
+
const environment = await api.context.getEnvironment();
|
|
44
|
+
await api.callHook("configResolved", { environment });
|
|
45
|
+
},
|
|
46
|
+
async configureServer(server) {
|
|
47
|
+
const environment = await api.context.getEnvironment();
|
|
48
|
+
return api.callHook("vite:configureServer", { environment }, server);
|
|
49
|
+
},
|
|
50
|
+
async configurePreviewServer(server) {
|
|
51
|
+
const environment = await api.context.getEnvironment();
|
|
52
|
+
return api.callHook("vite:configurePreviewServer", { environment }, server);
|
|
53
|
+
},
|
|
54
|
+
async transformIndexHtml(html, ctx) {
|
|
55
|
+
const environment = await api.context.getEnvironment();
|
|
56
|
+
return api.callHook("vite:transformIndexHtml", { environment }, html, ctx);
|
|
57
|
+
},
|
|
58
|
+
async handleHotUpdate(ctx) {
|
|
59
|
+
const environment = await api.context.getEnvironment();
|
|
60
|
+
return api.callHook("vite:handleHotUpdate", { environment }, ctx);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { unplugin as default, unplugin as "module.exports", unplugin, plugin, vite };
|
|
68
|
+
//# sourceMappingURL=vite.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite.mjs","names":["defu"],"sources":["../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 { 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":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,MAAa,WAAW,iBACtB,sBAAsB,SAAS,KAAK,WAAW;AAC7C,QAAO;EACL,GAAG;EACH,MAAM;GACJ,mBAAmB;GAEnB,MAAM,UAAU,SAAS;IACvB,MAAM,cAAc,MAAM,IAAI,QAAQ,gBAAgB;AAEtD,WAAO,IA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