@powerlines/core 0.48.57 → 0.48.59
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/constants/log-level.d.cts +1 -1
- package/dist/constants/log-level.d.mts +1 -1
- package/dist/lib/context-helpers.d.cts +4 -4
- package/dist/lib/context-helpers.d.mts +4 -4
- package/dist/lib/vfs.cjs +43 -6
- package/dist/lib/vfs.d.cts +16 -2
- package/dist/lib/vfs.d.cts.map +1 -1
- package/dist/lib/vfs.d.mts +16 -2
- package/dist/lib/vfs.d.mts.map +1 -1
- package/dist/lib/vfs.mjs +43 -6
- package/dist/lib/vfs.mjs.map +1 -1
- package/dist/storage/base.d.cts +4 -4
- package/dist/storage/base.d.cts.map +1 -1
- package/dist/storage/base.d.mts +4 -4
- package/dist/storage/base.d.mts.map +1 -1
- package/dist/storage/base.mjs.map +1 -1
- package/dist/storage/file-system.cjs +6 -2
- package/dist/storage/file-system.d.cts +2 -2
- package/dist/storage/file-system.d.cts.map +1 -1
- package/dist/storage/file-system.d.mts +2 -2
- package/dist/storage/file-system.d.mts.map +1 -1
- package/dist/storage/file-system.mjs +6 -2
- package/dist/storage/file-system.mjs.map +1 -1
- package/dist/storage/virtual.d.cts +2 -2
- package/dist/storage/virtual.d.cts.map +1 -1
- package/dist/storage/virtual.d.mts +2 -2
- package/dist/storage/virtual.d.mts.map +1 -1
- package/dist/storage/virtual.mjs.map +1 -1
- package/dist/types/fs.d.cts +19 -6
- package/dist/types/fs.d.cts.map +1 -1
- package/dist/types/fs.d.mts +19 -6
- package/dist/types/fs.d.mts.map +1 -1
- package/package.json +6 -6
|
@@ -5,10 +5,12 @@ const require_storage_helpers = require('./helpers.cjs');
|
|
|
5
5
|
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
6
6
|
let _stryke_fs_is_file = require("@stryke/fs/is-file");
|
|
7
7
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
8
9
|
let _stryke_fs_list_files = require("@stryke/fs/list-files");
|
|
9
10
|
let node_fs = require("node:fs");
|
|
10
11
|
let _stryke_fs_read_file = require("@stryke/fs/read-file");
|
|
11
12
|
let _stryke_fs_write_file = require("@stryke/fs/write-file");
|
|
13
|
+
let _stryke_fs_buffer = require("@stryke/fs/buffer");
|
|
12
14
|
let _stryke_fs_helpers = require("@stryke/fs/helpers");
|
|
13
15
|
let node_fs_promises = require("node:fs/promises");
|
|
14
16
|
|
|
@@ -83,7 +85,8 @@ var FileSystemStorageAdapter = class extends require_storage_base.BaseStorageAda
|
|
|
83
85
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
84
86
|
const existingValue = this.getSync(this.resolve(key));
|
|
85
87
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(existingValue) && existingValue.includes(require_lib_utilities_file_header.getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"))) return (0, _stryke_fs_write_file.writeFileSync)(this.resolve(key), existingValue.replace(require_lib_utilities_file_header.getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"), require_lib_utilities_file_header.getFileHeaderWarningText(false, this.context.config.framework?.name || "powerlines")));
|
|
86
|
-
} else return (0, _stryke_fs_write_file.writeFileSync)(this.resolve(key), value);
|
|
88
|
+
} else if ((0, _stryke_type_checks_is_string.isString)(value)) return (0, _stryke_fs_write_file.writeFileSync)(this.resolve(key), value);
|
|
89
|
+
else return (0, _stryke_fs_buffer.writeFileBufferSync)(this.resolve(key), value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength));
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
89
92
|
* Asynchronously sets the value for a given key.
|
|
@@ -95,7 +98,8 @@ var FileSystemStorageAdapter = class extends require_storage_base.BaseStorageAda
|
|
|
95
98
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
96
99
|
const existingValue = await this.get(this.resolve(key));
|
|
97
100
|
if ((0, _stryke_type_checks_is_set_string.isSetString)(existingValue) && existingValue.includes(require_lib_utilities_file_header.getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"))) return (0, _stryke_fs_write_file.writeFile)(this.resolve(key), existingValue.replace(require_lib_utilities_file_header.getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"), require_lib_utilities_file_header.getFileHeaderWarningText(false, this.context.config.framework?.name || "powerlines")));
|
|
98
|
-
} else return (0, _stryke_fs_write_file.writeFile)(this.resolve(key), value);
|
|
101
|
+
} else if ((0, _stryke_type_checks_is_string.isString)(value)) return (0, _stryke_fs_write_file.writeFile)(this.resolve(key), value);
|
|
102
|
+
else return (0, _stryke_fs_buffer.writeFileBuffer)(this.resolve(key), value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength));
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* Synchronously removes a key from the storage.
|
|
@@ -61,14 +61,14 @@ declare class FileSystemStorageAdapter extends BaseStorageAdapter {
|
|
|
61
61
|
* @param key - The key to set the value for.
|
|
62
62
|
* @param value - The value to set.
|
|
63
63
|
*/
|
|
64
|
-
setSync(key: string, value: string): void;
|
|
64
|
+
setSync(key: string, value: string | NodeJS.ArrayBufferView): void;
|
|
65
65
|
/**
|
|
66
66
|
* Asynchronously sets the value for a given key.
|
|
67
67
|
*
|
|
68
68
|
* @param key - The key to set the value for.
|
|
69
69
|
* @param value - The value to set.
|
|
70
70
|
*/
|
|
71
|
-
set(key: string, value: string): Promise<void>;
|
|
71
|
+
set(key: string, value: string | NodeJS.ArrayBufferView): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* Synchronously removes a key from the storage.
|
|
74
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.d.cts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"file-system.d.cts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":";;;;;KAkCY,cAAA,GAAiB,UAAU,QAAQ,aAAA;AAAA,KACnC,UAAA,GAAa,UAAU,QAAQ,SAAA;AAD3C;;;AAAA,cAMa,wBAAA,SAAiC,kBAAA;EANc;AAC5D;;EASS,IAAA;EATgB;AAA2B;AAKpD;;;;EALyB,SAiBE,MAAA;EA4BkB;;;;;;cApBxB,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EA+MJ;;;;;;EArMpC,UAAA,CAAW,GAAA;;;;;;;EAUI,MAAA,CAAO,GAAA,WAAc,OAAA;EAArB;;;;;;EAUf,OAAA,CAAQ,GAAA;EAUyB;;;;;;EAAlB,GAAA,CAAI,GAAA,WAAc,OAAA;EA0DtC;;;;;;EAhDK,OAAA,CAAQ,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA;EA+G7B;;;;;;EAhEA,GAAA,CACpB,GAAA,UACA,KAAA,WAAgB,MAAA,CAAO,eAAA,GACtB,OAAA;EAiF2C;;;;;EAnCvC,UAAA,CAAW,GAAA;EA2EF;;;;;EA5DM,MAAA,CAAO,GAAA,WAAc,OAAA;;;;;;EAW3B,SAAA,CAAU,OAAA;;;;;;EASJ,KAAA,CAAM,OAAA,WAAkB,OAAA;;;;;;;EAUvC,QAAA,CAAS,IAAA;;;;;;;EAgBM,IAAA,CAAK,IAAA,YAAgB,OAAA;;;;;;;EAc3B,eAAA,CAAgB,GAAA;;;;;;;EAUhB,UAAA,CAAW,GAAA;AAAA"}
|
|
@@ -61,14 +61,14 @@ declare class FileSystemStorageAdapter extends BaseStorageAdapter {
|
|
|
61
61
|
* @param key - The key to set the value for.
|
|
62
62
|
* @param value - The value to set.
|
|
63
63
|
*/
|
|
64
|
-
setSync(key: string, value: string): void;
|
|
64
|
+
setSync(key: string, value: string | NodeJS.ArrayBufferView): void;
|
|
65
65
|
/**
|
|
66
66
|
* Asynchronously sets the value for a given key.
|
|
67
67
|
*
|
|
68
68
|
* @param key - The key to set the value for.
|
|
69
69
|
* @param value - The value to set.
|
|
70
70
|
*/
|
|
71
|
-
set(key: string, value: string): Promise<void>;
|
|
71
|
+
set(key: string, value: string | NodeJS.ArrayBufferView): Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* Synchronously removes a key from the storage.
|
|
74
74
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.d.mts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"file-system.d.mts","names":[],"sources":["../../src/storage/file-system.ts"],"mappings":";;;;;KAkCY,cAAA,GAAiB,UAAU,QAAQ,aAAA;AAAA,KACnC,UAAA,GAAa,UAAU,QAAQ,SAAA;AAD3C;;;AAAA,cAMa,wBAAA,SAAiC,kBAAA;EANc;AAC5D;;EASS,IAAA;EATgB;AAA2B;AAKpD;;;;EALyB,SAiBE,MAAA;EA4BkB;;;;;;cApBxB,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EA+MJ;;;;;;EArMpC,UAAA,CAAW,GAAA;;;;;;;EAUI,MAAA,CAAO,GAAA,WAAc,OAAA;EAArB;;;;;;EAUf,OAAA,CAAQ,GAAA;EAUyB;;;;;;EAAlB,GAAA,CAAI,GAAA,WAAc,OAAA;EA0DtC;;;;;;EAhDK,OAAA,CAAQ,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA;EA+G7B;;;;;;EAhEA,GAAA,CACpB,GAAA,UACA,KAAA,WAAgB,MAAA,CAAO,eAAA,GACtB,OAAA;EAiF2C;;;;;EAnCvC,UAAA,CAAW,GAAA;EA2EF;;;;;EA5DM,MAAA,CAAO,GAAA,WAAc,OAAA;;;;;;EAW3B,SAAA,CAAU,OAAA;;;;;;EASJ,KAAA,CAAM,OAAA,WAAkB,OAAA;;;;;;;EAUvC,QAAA,CAAS,IAAA;;;;;;;EAgBM,IAAA,CAAK,IAAA,YAAgB,OAAA;;;;;;;EAc3B,eAAA,CAAgB,GAAA;;;;;;;EAUhB,UAAA,CAAW,GAAA;AAAA"}
|
|
@@ -4,10 +4,12 @@ import { ignoreNotfound } from "./helpers.mjs";
|
|
|
4
4
|
import { exists, existsSync } from "@stryke/fs/exists";
|
|
5
5
|
import { isDirectory, isFile } from "@stryke/fs/is-file";
|
|
6
6
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
7
|
+
import { isString } from "@stryke/type-checks/is-string";
|
|
7
8
|
import { listFiles, listFilesSync } from "@stryke/fs/list-files";
|
|
8
9
|
import { unlinkSync } from "node:fs";
|
|
9
10
|
import { readFile, readFileSync } from "@stryke/fs/read-file";
|
|
10
11
|
import { writeFile, writeFileSync } from "@stryke/fs/write-file";
|
|
12
|
+
import { writeFileBuffer, writeFileBufferSync } from "@stryke/fs/buffer";
|
|
11
13
|
import { createDirectory, createDirectorySync } from "@stryke/fs/helpers";
|
|
12
14
|
import { unlink } from "node:fs/promises";
|
|
13
15
|
|
|
@@ -82,7 +84,8 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
82
84
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
83
85
|
const existingValue = this.getSync(this.resolve(key));
|
|
84
86
|
if (isSetString(existingValue) && existingValue.includes(getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"))) return writeFileSync(this.resolve(key), existingValue.replace(getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"), getFileHeaderWarningText(false, this.context.config.framework?.name || "powerlines")));
|
|
85
|
-
} else return writeFileSync(this.resolve(key), value);
|
|
87
|
+
} else if (isString(value)) return writeFileSync(this.resolve(key), value);
|
|
88
|
+
else return writeFileBufferSync(this.resolve(key), value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength));
|
|
86
89
|
}
|
|
87
90
|
/**
|
|
88
91
|
* Asynchronously sets the value for a given key.
|
|
@@ -94,7 +97,8 @@ var FileSystemStorageAdapter = class extends BaseStorageAdapter {
|
|
|
94
97
|
if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
|
|
95
98
|
const existingValue = await this.get(this.resolve(key));
|
|
96
99
|
if (isSetString(existingValue) && existingValue.includes(getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"))) return writeFile(this.resolve(key), existingValue.replace(getFileHeaderWarningText(true, this.context.config.framework?.name || "powerlines"), getFileHeaderWarningText(false, this.context.config.framework?.name || "powerlines")));
|
|
97
|
-
} else return writeFile(this.resolve(key), value);
|
|
100
|
+
} else if (isString(value)) return writeFile(this.resolve(key), value);
|
|
101
|
+
else return writeFileBuffer(this.resolve(key), value.buffer.slice(value.byteOffset, value.byteOffset + value.byteLength));
|
|
98
102
|
}
|
|
99
103
|
/**
|
|
100
104
|
* Synchronously removes a key from the storage.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.mjs","names":[],"sources":["../../src/storage/file-system.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 { 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 { getFileHeaderWarningText } from \"../lib/utilities/file-header\";\nimport type { Context } from \"../types/context\";\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(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\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(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\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"],"mappings":";;;;;;;;;;;;;;;;;AAsCA,IAAa,2BAAb,cAA8C,mBAAmB;;;;CAI/D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;;;;CAQlC,AAAO,YAAY,SAAkB,SAAiC;EACpE,MAAM,SAAS,OAAO;CACxB;;;;;;;CAQA,AAAO,WAAW,KAAsB;EACtC,OAAO,WAAW,KAAK,QAAQ,GAAG,CAAC;CACrC;;;;;;;CAQA,MAAsB,OAAO,KAA+B;EAC1D,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC;CACjC;;;;;;;CAQA,AAAO,QAAQ,KAA4B;EACzC,OAAO,aAAa,KAAK,QAAQ,GAAG,CAAC;CACvC;;;;;;;CAQA,MAAsB,IAAI,KAAqC;EAC7D,OAAO,SAAS,KAAK,QAAQ,GAAG,CAAC;CACnC;;;;;;;CAQA,AAAO,QAAQ,KAAa,OAAe;EACzC,IAAI,CAAC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AK,WAC3B,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC,MAAM,cAAc;CAEzD;;;;;;CAOA,AAAgB,UAAU,SAAiB;EACzC,oBAAoB,KAAK,QAAQ,OAAO,CAAC;CAC3C;;;;;;CAOA,MAAsB,MAAM,SAAgC;EAC1D,MAAM,gBAAgB,KAAK,QAAQ,OAAO,CAAC;CAC7C;;;;;;;CAQA,AAAO,SAAS,MAAyB;EACvC,IAAI;GACF,OAAO,cAAc,KAAK,QAAQ,IAAI,GAAG,EACvC,QAAQ,KAAK,QAAQ,OACvB,CAAC;EACH,SAAS,KAAK;GACZ,OAAO,eAAe,GAAG,KAAK,CAAC;EACjC;CACF;;;;;;;CAQA,MAAsB,KAAK,MAAkC;EAC3D,OAAO,UAAU,KAAK,QAAQ,IAAI,GAAG,EACnC,QAAQ,KAAK,QAAQ,OACvB,CAAC,CAAC,CACC,MAAM,cAAc,CAAC,CACrB,MAAK,MAAK,KAAK,CAAC,CAAC;CACtB;;;;;;;CAQA,AAAgB,gBAAgB,KAAsB;EACpD,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAC;CACtC;;;;;;;CAQA,AAAgB,WAAW,KAAsB;EAC/C,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC;CACjC;AACF"}
|
|
1
|
+
{"version":3,"file":"file-system.mjs","names":[],"sources":["../../src/storage/file-system.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 { writeFileBuffer, writeFileBufferSync } from \"@stryke/fs/buffer\";\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 { isString } from \"@stryke/type-checks/is-string\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { getFileHeaderWarningText } from \"../lib/utilities/file-header\";\nimport type { Context } from \"../types/context\";\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 | NodeJS.ArrayBufferView): void {\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(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFileSync(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else if (isString(value)) {\n return writeFileSync(this.resolve(key), value);\n } else {\n return writeFileBufferSync(\n this.resolve(key),\n value.buffer.slice(\n value.byteOffset,\n value.byteOffset + value.byteLength\n ) as ArrayBuffer\n );\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(\n key: string,\n value: string | NodeJS.ArrayBufferView\n ): 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(\n true,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n ) {\n return writeFile(\n this.resolve(key),\n existingValue.replace(\n getFileHeaderWarningText(\n true,\n this.context.config.framework?.name || \"powerlines\"\n ),\n getFileHeaderWarningText(\n false,\n this.context.config.framework?.name || \"powerlines\"\n )\n )\n );\n }\n } else if (isString(value)) {\n return writeFile(this.resolve(key), value);\n } else {\n return writeFileBuffer(\n this.resolve(key),\n value.buffer.slice(\n value.byteOffset,\n value.byteOffset + value.byteLength\n ) as ArrayBuffer\n );\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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AQ,KAAK,QAAQ,OACvB,CAAC;EACH,SAAS,KAAK;GACZ,OAAO,eAAe,GAAG,KAAK,CAAC;EACjC;CACF;;;;;;;CAQA,MAAsB,KAAK,MAAkC;EAC3D,OAAO,UAAU,KAAK,QAAQ,IAAI,GAAG,EACnC,QAAQ,KAAK,QAAQ,OACvB,CAAC,CAAC,CACC,MAAM,cAAc,CAAC,CACrB,MAAK,MAAK,KAAK,CAAC,CAAC;CACtB;;;;;;;CAQA,AAAgB,gBAAgB,KAAsB;EACpD,OAAO,YAAY,KAAK,QAAQ,GAAG,CAAC;CACtC;;;;;;;CAQA,AAAgB,WAAW,KAAsB;EAC/C,OAAO,OAAO,KAAK,QAAQ,GAAG,CAAC;CACjC;AACF"}
|
|
@@ -41,14 +41,14 @@ declare class VirtualStorageAdapter extends BaseStorageAdapter {
|
|
|
41
41
|
* @param key - The key whose value is to be retrieved.
|
|
42
42
|
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
43
43
|
*/
|
|
44
|
-
getSync(key: string): string | null;
|
|
44
|
+
getSync(key: string): string | NodeJS.ArrayBufferView | null;
|
|
45
45
|
/**
|
|
46
46
|
* Synchronously sets the value for a given key.
|
|
47
47
|
*
|
|
48
48
|
* @param key - The key to set the value for.
|
|
49
49
|
* @param value - The value to set.
|
|
50
50
|
*/
|
|
51
|
-
setSync(key: string, value: string): void;
|
|
51
|
+
setSync(key: string, value: string | NodeJS.ArrayBufferView): void;
|
|
52
52
|
/**
|
|
53
53
|
* Synchronously removes a key from the storage.
|
|
54
54
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;
|
|
1
|
+
{"version":3,"file":"virtual.d.cts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;EAyC+B;;;;;;EAAA,SAjCb,MAAA;EARlB;;;EAAA,UAaG,IAAA,EAAI,GAAA;;;;;;;cAQK,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EAoBxC;;;;;;EAVA,UAAA,CAAW,GAAA;EAoBiC;;;;;;EAV5C,OAAA,CAAQ,GAAA,oBAAuB,MAAA,CAAO,eAAA;EA8CZ;;;AASD;;;EA7CzB,OAAA,CAAQ,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA;;;;;;EAW5C,UAAA,CAAW,GAAA;;;;;;;EAYX,QAAA,CAAS,IAAA;;;;;;EAaM,OAAA,IAAW,OAAA;;;;;;gBASV,SAAA;AAAA"}
|
|
@@ -41,14 +41,14 @@ declare class VirtualStorageAdapter extends BaseStorageAdapter {
|
|
|
41
41
|
* @param key - The key whose value is to be retrieved.
|
|
42
42
|
* @returns The value associated with the key, or `null` if the key does not exist.
|
|
43
43
|
*/
|
|
44
|
-
getSync(key: string): string | null;
|
|
44
|
+
getSync(key: string): string | NodeJS.ArrayBufferView | null;
|
|
45
45
|
/**
|
|
46
46
|
* Synchronously sets the value for a given key.
|
|
47
47
|
*
|
|
48
48
|
* @param key - The key to set the value for.
|
|
49
49
|
* @param value - The value to set.
|
|
50
50
|
*/
|
|
51
|
-
setSync(key: string, value: string): void;
|
|
51
|
+
setSync(key: string, value: string | NodeJS.ArrayBufferView): void;
|
|
52
52
|
/**
|
|
53
53
|
* Synchronously removes a key from the storage.
|
|
54
54
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;
|
|
1
|
+
{"version":3,"file":"virtual.d.mts","names":[],"sources":["../../src/storage/virtual.ts"],"mappings":";;;;;;AAyBA;cAAa,qBAAA,SAA8B,kBAAA;;;;EAIlC,IAAA;EAyC+B;;;;;;EAAA,SAjCb,MAAA;EARlB;;;EAAA,UAaG,IAAA,EAAI,GAAA;;;;;;;cAQK,OAAA,EAAS,OAAA,EAAS,OAAA,GAAU,qBAAA;EAoBxC;;;;;;EAVA,UAAA,CAAW,GAAA;EAoBiC;;;;;;EAV5C,OAAA,CAAQ,GAAA,oBAAuB,MAAA,CAAO,eAAA;EA8CZ;;;AASD;;;EA7CzB,OAAA,CAAQ,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA;;;;;;EAW5C,UAAA,CAAW,GAAA;;;;;;;EAYX,QAAA,CAAS,IAAA;;;;;;EAaM,OAAA,IAAW,OAAA;;;;;;gBASV,SAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../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 { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types/context\";\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":";;;;;;;AAyBA,IAAa,wBAAb,cAA2C,mBAAmB;;;;CAI5D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;CAKlC,AAAU,uBAAO,IAAI,IAAiB;;;;;;;CAQtC,AAAO,YAAY,SAAkB,SAAiC;EACpE,MAAM,SAAS,OAAO;CACxB;;;;;;;CAQA,AAAO,WAAW,KAAsB;EACtC,OAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC;CACxC;;;;;;;CAQA,AAAO,QAAQ,
|
|
1
|
+
{"version":3,"file":"virtual.mjs","names":[],"sources":["../../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 { isParentPath } from \"@stryke/path/is-parent-path\";\nimport type { Context } from \"../types/context\";\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 | NodeJS.ArrayBufferView | 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 | NodeJS.ArrayBufferView) {\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":";;;;;;;AAyBA,IAAa,wBAAb,cAA2C,mBAAmB;;;;CAI5D,AAAO,OAAO;;;;;;;CAQd,AAAyB,SAAS;;;;CAKlC,AAAU,uBAAO,IAAI,IAAiB;;;;;;;CAQtC,AAAO,YAAY,SAAkB,SAAiC;EACpE,MAAM,SAAS,OAAO;CACxB;;;;;;;CAQA,AAAO,WAAW,KAAsB;EACtC,OAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC;CACxC;;;;;;;CAQA,AAAO,QAAQ,KAAqD;EAClE,OAAO,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,CAAC,KAAK;CAC7C;;;;;;;CAQA,AAAO,QAAQ,KAAa,OAAwC;EAClE,IAAI,CAAC,KAAK,eAAe,CAAC,KAAK,WAAW,GAAG,KAAK,KAAK,YACrD,KAAK,KAAK,IAAI,KAAK,QAAQ,GAAG,GAAG,KAAK;CAE1C;;;;;;CAOA,AAAO,WAAW,KAAa;EAC7B,IAAI,CAAC,KAAK,cAAc,KAAK,WAC3B,KAAK,KAAK,OAAO,KAAK,QAAQ,GAAG,CAAC;CAEtC;;;;;;;CAQA,AAAO,SAAS,MAAyB;EACvC,OAAO,CACL,GAAG,KAAK,KACL,KAAK,CAAC,CACN,QAAO,QAAQ,CAAC,OAAO,OAAO,aAAa,KAAK,KAAK,QAAQ,IAAI,CAAC,CAAE,CACzE;CACF;;;;;;CAOA,MAAsB,UAAyB;EAC7C,OAAO,KAAK,MAAM;CACpB;;;;;;CAOA,IAAuB,YAAY;EACjC,OAAO,CAAC,KAAK;CACf;AACF"}
|
package/dist/types/fs.d.cts
CHANGED
|
@@ -40,28 +40,28 @@ interface StorageAdapter {
|
|
|
40
40
|
* @param key - The key to read the value for.
|
|
41
41
|
* @returns A promise that resolves to the value if found, otherwise `null`.
|
|
42
42
|
*/
|
|
43
|
-
get: (key: string) => Promise<string | null>;
|
|
43
|
+
get: (key: string) => Promise<string | NodeJS.ArrayBufferView | null>;
|
|
44
44
|
/**
|
|
45
45
|
* Synchronously reads the value associated with a key from the storage.
|
|
46
46
|
*
|
|
47
47
|
* @param key - The key to read the value for.
|
|
48
48
|
* @returns The value if found, otherwise `null`.
|
|
49
49
|
*/
|
|
50
|
-
getSync: (key: string) => string | null;
|
|
50
|
+
getSync: (key: string) => string | NodeJS.ArrayBufferView | null;
|
|
51
51
|
/**
|
|
52
52
|
* Writes a value to the storage for the given key.
|
|
53
53
|
*
|
|
54
54
|
* @param key - The key to associate the value with.
|
|
55
55
|
* @param value - The value to store.
|
|
56
56
|
*/
|
|
57
|
-
set: (key: string, value: string) => Promise<void>;
|
|
57
|
+
set: (key: string, value: string | NodeJS.ArrayBufferView) => Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Synchronously writes a value to the storage for the given key.
|
|
60
60
|
*
|
|
61
61
|
* @param key - The key to associate the value with.
|
|
62
62
|
* @param value - The value to store.
|
|
63
63
|
*/
|
|
64
|
-
setSync: (key: string, value: string) => void;
|
|
64
|
+
setSync: (key: string, value: string | NodeJS.ArrayBufferView) => void;
|
|
65
65
|
/**
|
|
66
66
|
* Removes a value from the storage.
|
|
67
67
|
*
|
|
@@ -413,6 +413,19 @@ interface VirtualFileSystemInterface {
|
|
|
413
413
|
* @param path - The path or id of the file.
|
|
414
414
|
*/
|
|
415
415
|
readSync: (path: string) => string | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* Reads a file from the virtual file system (VFS).
|
|
418
|
+
*
|
|
419
|
+
* @param path - The path or id of the file.
|
|
420
|
+
* @returns The contents of the file if it exists, otherwise undefined.
|
|
421
|
+
*/
|
|
422
|
+
readBuffer: (path: string) => Promise<NodeJS.ArrayBufferView | undefined>;
|
|
423
|
+
/**
|
|
424
|
+
* Reads a file from the virtual file system (VFS).
|
|
425
|
+
*
|
|
426
|
+
* @param path - The path or id of the file.
|
|
427
|
+
*/
|
|
428
|
+
readBufferSync: (path: string) => NodeJS.ArrayBufferView | undefined;
|
|
416
429
|
/**
|
|
417
430
|
* Writes a file to the virtual file system (VFS).
|
|
418
431
|
*
|
|
@@ -421,7 +434,7 @@ interface VirtualFileSystemInterface {
|
|
|
421
434
|
* @param options - Options for writing the file.
|
|
422
435
|
* @returns A promise that resolves when the file is written.
|
|
423
436
|
*/
|
|
424
|
-
write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
|
|
437
|
+
write: (path: string, data: string | NodeJS.ArrayBufferView, options?: WriteOptions) => Promise<void>;
|
|
425
438
|
/**
|
|
426
439
|
* Writes a file to the virtual file system (VFS).
|
|
427
440
|
*
|
|
@@ -429,7 +442,7 @@ interface VirtualFileSystemInterface {
|
|
|
429
442
|
* @param data - The contents of the file.
|
|
430
443
|
* @param options - Options for writing the file.
|
|
431
444
|
*/
|
|
432
|
-
writeSync: (path: string, data: string, options?: WriteOptions) => void;
|
|
445
|
+
writeSync: (path: string, data: string | NodeJS.ArrayBufferView, options?: WriteOptions) => void;
|
|
433
446
|
/**
|
|
434
447
|
* Creates a directory at the specified path.
|
|
435
448
|
*
|
package/dist/types/fs.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.cts","names":[],"sources":["../../src/types/fs.ts"],"mappings":";;;;;KAsBY,oBAAA;AAAA,KAEA,aAAA;AAFZ;;;AAAA,UAOiB,cAAA;EAPe;AAEhC;;EASE,IAAA;EATuB;AAAA;AAKzB;;;;EAYE,MAAA,GAAS,aAAA;
|
|
1
|
+
{"version":3,"file":"fs.d.cts","names":[],"sources":["../../src/types/fs.ts"],"mappings":";;;;;KAsBY,oBAAA;AAAA,KAEA,aAAA;AAFZ;;;AAAA,UAOiB,cAAA;EAPe;AAEhC;;EASE,IAAA;EATuB;AAAA;AAKzB;;;;EAYE,MAAA,GAAS,aAAA;EAwB8B;;;;;;EAhBvC,MAAA,GAAS,GAAA,aAAgB,OAAA;EA6DG;;;;;;EArD5B,UAAA,GAAa,GAAA;EA+Hc;;;;;;EAvH3B,GAAA,GAAM,GAAA,aAAgB,OAAA,UAAiB,MAAA,CAAO,eAAA;EAR9C;;;;;;EAgBA,OAAA,GAAU,GAAA,sBAAyB,MAAA,CAAO,eAAA;EAA1C;;;;;;EAQA,GAAA,GAAM,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA,KAAoB,OAAA;EAApB;;;;;;EAQ1C,OAAA,GAAU,GAAA,UAAa,KAAA,WAAgB,MAAA,CAAO,eAAA;EAAvB;;;;;EAOvB,MAAA,GAAS,GAAA,aAAgB,OAAA;EAczB;;;;;EAPA,UAAA,GAAa,GAAA;EAqBL;;;;;EAdR,KAAA,GAAQ,OAAA,aAAoB,OAAA;EA6BH;;;;;EAtBzB,SAAA,GAAY,OAAA;EA8CZ;;;;;EAvCA,KAAA,GAAQ,IAAA,cAAkB,OAAA;E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AAiB,OAAA,CAAQ,MAAA,CAAO,eAAA;;;;;;EAO7C,cAAA,GAAiB,IAAA,aAAiB,MAAA,CAAO,eAAA;;;;;;;;;EAUzC,KAAA,GACE,IAAA,UACA,IAAA,WAAe,MAAA,CAAO,eAAA,EACtB,OAAA,GAAU,YAAA,KACP,OAAA;;;;;;;;EASL,SAAA,GACE,IAAA,UACA,IAAA,WAAe,MAAA,CAAO,eAAA,EACtB,OAAA,GAAU,YAAA;;;;;;EAQZ,KAAA,GAAQ,OAAA,aAAoB,OAAA;;;;;;EAO5B,SAAA,GAAY,OAAA;;;;;;;EAQZ,IAAA,GAAO,OAAA,UAAiB,QAAA,aAAqB,OAAA;;;;;;;EAQ7C,QAAA,GAAW,OAAA,UAAiB,QAAA;;;;;;;EAQ5B,IAAA,GACE,OAAA,WAAkB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC7B,QAAA,WAAmB,GAAA,KAChB,OAAA;;;;;;;EAQL,QAAA,GACE,OAAA,WAAkB,GAAA,GAAM,IAAA,CAAK,SAAA,aAC7B,QAAA,WAAmB,GAAA;;;;;;;EASrB,IAAA,GACE,QAAA,WAEI,IAAA,CAAK,SAAA,wBACK,IAAA,CAAK,SAAA,mBAChB,OAAA;;;;;;;EAQL,QAAA,GACE,QAAA,WAEI,IAAA,CAAK,SAAA,wBACK,IAAA,CAAK,SAAA;;;;;;;;;;;;;;;;;EAmBrB,OAAA,GACE,EAAA,UACA,QAAA,WACA,OAAA,GAAU,gBAAA,KACP,OAAA;;;;;;;;;;;;;;;;;EAkBL,WAAA,GACE,EAAA,UACA,QAAA,WACA,OAAA,GAAU,gBAAA;;;;;;;;;;EAYZ,YAAA,GAAe,EAAA;;;;EAKf,OAAA,QAAe,OAAA;AAAA"}
|
package/dist/types/fs.d.mts
CHANGED
|
@@ -40,28 +40,28 @@ interface StorageAdapter {
|
|
|
40
40
|
* @param key - The key to read the value for.
|
|
41
41
|
* @returns A promise that resolves to the value if found, otherwise `null`.
|
|
42
42
|
*/
|
|
43
|
-
get: (key: string) => Promise<string | null>;
|
|
43
|
+
get: (key: string) => Promise<string | NodeJS.ArrayBufferView | null>;
|
|
44
44
|
/**
|
|
45
45
|
* Synchronously reads the value associated with a key from the storage.
|
|
46
46
|
*
|
|
47
47
|
* @param key - The key to read the value for.
|
|
48
48
|
* @returns The value if found, otherwise `null`.
|
|
49
49
|
*/
|
|
50
|
-
getSync: (key: string) => string | null;
|
|
50
|
+
getSync: (key: string) => string | NodeJS.ArrayBufferView | null;
|
|
51
51
|
/**
|
|
52
52
|
* Writes a value to the storage for the given key.
|
|
53
53
|
*
|
|
54
54
|
* @param key - The key to associate the value with.
|
|
55
55
|
* @param value - The value to store.
|
|
56
56
|
*/
|
|
57
|
-
set: (key: string, value: string) => Promise<void>;
|
|
57
|
+
set: (key: string, value: string | NodeJS.ArrayBufferView) => Promise<void>;
|
|
58
58
|
/**
|
|
59
59
|
* Synchronously writes a value to the storage for the given key.
|
|
60
60
|
*
|
|
61
61
|
* @param key - The key to associate the value with.
|
|
62
62
|
* @param value - The value to store.
|
|
63
63
|
*/
|
|
64
|
-
setSync: (key: string, value: string) => void;
|
|
64
|
+
setSync: (key: string, value: string | NodeJS.ArrayBufferView) => void;
|
|
65
65
|
/**
|
|
66
66
|
* Removes a value from the storage.
|
|
67
67
|
*
|
|
@@ -413,6 +413,19 @@ interface VirtualFileSystemInterface {
|
|
|
413
413
|
* @param path - The path or id of the file.
|
|
414
414
|
*/
|
|
415
415
|
readSync: (path: string) => string | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* Reads a file from the virtual file system (VFS).
|
|
418
|
+
*
|
|
419
|
+
* @param path - The path or id of the file.
|
|
420
|
+
* @returns The contents of the file if it exists, otherwise undefined.
|
|
421
|
+
*/
|
|
422
|
+
readBuffer: (path: string) => Promise<NodeJS.ArrayBufferView | undefined>;
|
|
423
|
+
/**
|
|
424
|
+
* Reads a file from the virtual file system (VFS).
|
|
425
|
+
*
|
|
426
|
+
* @param path - The path or id of the file.
|
|
427
|
+
*/
|
|
428
|
+
readBufferSync: (path: string) => NodeJS.ArrayBufferView | undefined;
|
|
416
429
|
/**
|
|
417
430
|
* Writes a file to the virtual file system (VFS).
|
|
418
431
|
*
|
|
@@ -421,7 +434,7 @@ interface VirtualFileSystemInterface {
|
|
|
421
434
|
* @param options - Options for writing the file.
|
|
422
435
|
* @returns A promise that resolves when the file is written.
|
|
423
436
|
*/
|
|
424
|
-
write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
|
|
437
|
+
write: (path: string, data: string | NodeJS.ArrayBufferView, options?: WriteOptions) => Promise<void>;
|
|
425
438
|
/**
|
|
426
439
|
* Writes a file to the virtual file system (VFS).
|
|
427
440
|
*
|
|
@@ -429,7 +442,7 @@ interface VirtualFileSystemInterface {
|
|
|
429
442
|
* @param data - The contents of the file.
|
|
430
443
|
* @param options - Options for writing the file.
|
|
431
444
|
*/
|
|
432
|
-
writeSync: (path: string, data: string, options?: WriteOptions) => void;
|
|
445
|
+
writeSync: (path: string, data: string | NodeJS.ArrayBufferView, options?: WriteOptions) => void;
|
|
433
446
|
/**
|
|
434
447
|
* Creates a directory at the specified path.
|
|
435
448
|
*
|
package/dist/types/fs.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/types/fs.ts"],"mappings":";;;;;KAsBY,oBAAA;AAAA,KAEA,aAAA;AAFZ;;;AAAA,UAOiB,cAAA;EAPe;AAEhC;;EASE,IAAA;EATuB;AAAA;AAKzB;;;;EAYE,MAAA,GAAS,aAAA;
|
|
1
|
+
{"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/types/fs.ts"],"mappings":";;;;;KAsBY,oBAAA;AAAA,KAEA,aAAA;AAFZ;;;AAAA,UAOiB,cAAA;EAPe;AAEhC;;EASE,IAAA;EATuB;AAAA;AAKzB;;;;EAYE,MAAA,GAAS,aAAA;EAwB8B;;;;;;EAhBvC,MAAA,GAAS,GAAA,aAA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AC7B,QAAA,WAAmB,GAAA;;;;;;;EASrB,IAAA,GACE,QAAA,WAEI,IAAA,CAAK,SAAA,wBACK,IAAA,CAAK,SAAA,mBAChB,OAAA;;;;;;;EAQL,QAAA,GACE,QAAA,WAEI,IAAA,CAAK,SAAA,wBACK,IAAA,CAAK,SAAA;;;;;;;;;;;;;;;;;EAmBrB,OAAA,GACE,EAAA,UACA,QAAA,WACA,OAAA,GAAU,gBAAA,KACP,OAAA;;;;;;;;;;;;;;;;;EAkBL,WAAA,GACE,EAAA,UACA,QAAA,WACA,OAAA,GAAU,gBAAA;;;;;;;;;;EAYZ,YAAA,GAAe,EAAA;;;;EAKf,OAAA,QAAe,OAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/core",
|
|
3
|
-
"version": "0.48.
|
|
3
|
+
"version": "0.48.59",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -327,9 +327,9 @@
|
|
|
327
327
|
"@donedeal0/superdiff": "^3.2.0",
|
|
328
328
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
329
329
|
"@rolldown/pluginutils": "^1.0.1",
|
|
330
|
-
"@storm-software/config": "^1.
|
|
331
|
-
"@storm-software/config-tools": "^1.190.
|
|
332
|
-
"@storm-software/prettier": "^0.59.
|
|
330
|
+
"@storm-software/config": "^1.138.6",
|
|
331
|
+
"@storm-software/config-tools": "^1.190.69",
|
|
332
|
+
"@storm-software/prettier": "^0.59.122",
|
|
333
333
|
"@stryke/capnp": "^0.12.111",
|
|
334
334
|
"@stryke/convert": "^0.7.15",
|
|
335
335
|
"@stryke/env": "^0.20.102",
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
"unplugin-combine": "^2.4.0"
|
|
365
365
|
},
|
|
366
366
|
"devDependencies": {
|
|
367
|
-
"@storm-software/testing-tools": "^1.119.
|
|
367
|
+
"@storm-software/testing-tools": "^1.119.222",
|
|
368
368
|
"@stryke/types": "^0.12.12",
|
|
369
369
|
"@types/bun": "^1.3.14",
|
|
370
370
|
"@types/diff-match-patch": "^1.0.36",
|
|
@@ -378,5 +378,5 @@
|
|
|
378
378
|
"undici-types": "^7.27.2"
|
|
379
379
|
},
|
|
380
380
|
"publishConfig": { "access": "public" },
|
|
381
|
-
"gitHead": "
|
|
381
|
+
"gitHead": "e0caa13ad87b5419a945956312bb7cd2a5fb70d1"
|
|
382
382
|
}
|