powerlines 0.42.41 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/dist/{chunk-AIJqnxB6.cjs → _virtual/_rolldown/runtime.cjs} +1 -32
  2. package/dist/{chunk-CtajNgzt.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
  3. package/dist/api.cjs +10 -0
  4. package/dist/api.d.cts +2 -0
  5. package/dist/api.d.mts +2 -0
  6. package/dist/api.mjs +3 -0
  7. package/dist/config.cjs +0 -12
  8. package/dist/config.mjs +1 -10
  9. package/dist/constants.cjs +0 -12
  10. package/dist/constants.mjs +1 -10
  11. package/dist/context.cjs +9 -0
  12. package/dist/context.d.cts +1 -0
  13. package/dist/context.d.mts +1 -0
  14. package/dist/context.mjs +3 -0
  15. package/dist/engine.cjs +30 -0
  16. package/dist/engine.d.cts +24 -0
  17. package/dist/engine.d.cts.map +1 -0
  18. package/dist/engine.d.mts +24 -0
  19. package/dist/engine.d.mts.map +1 -0
  20. package/dist/engine.mjs +29 -0
  21. package/dist/engine.mjs.map +1 -0
  22. package/dist/esbuild.cjs +2 -2
  23. package/dist/esbuild.mjs.map +1 -1
  24. package/dist/farm.cjs +1 -1
  25. package/dist/index.cjs +24 -16
  26. package/dist/index.d.cts +13 -260
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts +13 -260
  29. package/dist/index.d.mts.map +1 -1
  30. package/dist/index.mjs +14 -8
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/nuxt.cjs +4 -4
  33. package/dist/nuxt.d.cts +1 -1
  34. package/dist/nuxt.d.mts +1 -1
  35. package/dist/nuxt.mjs +1 -1
  36. package/dist/package.cjs +18 -0
  37. package/dist/package.mjs +7 -0
  38. package/dist/package.mjs.map +1 -0
  39. package/dist/plugin-utils.cjs +0 -12
  40. package/dist/plugin-utils.mjs +1 -10
  41. package/dist/rolldown.cjs +2 -2
  42. package/dist/rollup.cjs +2 -2
  43. package/dist/rspack.cjs +2 -2
  44. package/dist/schemas.cjs +9 -0
  45. package/dist/schemas.d.cts +1 -0
  46. package/dist/schemas.d.mts +1 -0
  47. package/dist/schemas.mjs +3 -0
  48. package/dist/storage.cjs +9 -0
  49. package/dist/storage.d.cts +1 -0
  50. package/dist/storage.d.mts +1 -0
  51. package/dist/storage.mjs +3 -0
  52. package/dist/tsdown.cjs +3 -3
  53. package/dist/tsdown.mjs +1 -1
  54. package/dist/tsup.cjs +2 -2
  55. package/dist/types.cjs +0 -0
  56. package/dist/types.d.cts +8 -0
  57. package/dist/types.d.cts.map +1 -0
  58. package/dist/types.d.mts +8 -0
  59. package/dist/types.d.mts.map +1 -0
  60. package/dist/types.mjs +1 -0
  61. package/dist/typescript.cjs +9 -0
  62. package/dist/typescript.d.cts +1 -0
  63. package/dist/typescript.d.mts +1 -0
  64. package/dist/typescript.mjs +3 -0
  65. package/dist/unbuild.cjs +17 -0
  66. package/dist/unbuild.d.cts +2 -0
  67. package/dist/unbuild.d.mts +2 -0
  68. package/dist/unbuild.mjs +3 -0
  69. package/dist/unloader.cjs +1 -1
  70. package/dist/unplugin.cjs +13 -14
  71. package/dist/unplugin.d.cts +3 -2
  72. package/dist/unplugin.d.cts.map +1 -1
  73. package/dist/unplugin.d.mts +3 -2
  74. package/dist/unplugin.d.mts.map +1 -1
  75. package/dist/unplugin.mjs +11 -13
  76. package/dist/unplugin.mjs.map +1 -1
  77. package/dist/utils.cjs +0 -14
  78. package/dist/utils.d.mts +1 -1
  79. package/dist/utils.mjs +2 -15
  80. package/dist/vite.cjs +4 -4
  81. package/dist/vite.mjs +1 -1
  82. package/dist/vite.mjs.map +1 -1
  83. package/dist/webpack.cjs +2 -2
  84. package/package.json +64 -53
  85. package/dist/api-CyXUks49.mjs +0 -1078
  86. package/dist/api-CyXUks49.mjs.map +0 -1
  87. package/dist/api-DITWluqG.cjs +0 -1098
  88. package/dist/api-context-BDFU_IC7.cjs +0 -3066
  89. package/dist/api-context-Cb99qIjE.mjs +0 -2986
  90. package/dist/api-context-Cb99qIjE.mjs.map +0 -1
  91. package/dist/config.mjs.map +0 -1
  92. package/dist/constants.mjs.map +0 -1
  93. package/dist/context/index.cjs +0 -7
  94. package/dist/context/index.d.cts +0 -600
  95. package/dist/context/index.d.cts.map +0 -1
  96. package/dist/context/index.d.mts +0 -600
  97. package/dist/context/index.d.mts.map +0 -1
  98. package/dist/context/index.mjs +0 -3
  99. package/dist/plugin-utils.mjs.map +0 -1
  100. package/dist/storage/index.cjs +0 -9
  101. package/dist/storage/index.d.cts +0 -419
  102. package/dist/storage/index.d.cts.map +0 -1
  103. package/dist/storage/index.d.mts +0 -419
  104. package/dist/storage/index.d.mts.map +0 -1
  105. package/dist/storage/index.mjs +0 -3
  106. package/dist/ts-morph-B85ZbV1Q.mjs +0 -102
  107. package/dist/ts-morph-B85ZbV1Q.mjs.map +0 -1
  108. package/dist/ts-morph-BvE8TMhv.cjs +0 -114
  109. package/dist/tsconfig-BjkktvB9.cjs +0 -198
  110. package/dist/tsconfig-DoV1dUYg.mjs +0 -155
  111. package/dist/tsconfig-DoV1dUYg.mjs.map +0 -1
  112. package/dist/types-9O-s0Fpu.d.mts +0 -4
  113. package/dist/types-9O-s0Fpu.d.mts.map +0 -1
  114. package/dist/types-DerAvFjs.d.cts +0 -4
  115. package/dist/types-DerAvFjs.d.cts.map +0 -1
  116. package/dist/typescript/index.cjs +0 -13
  117. package/dist/typescript/index.d.cts +0 -106
  118. package/dist/typescript/index.d.cts.map +0 -1
  119. package/dist/typescript/index.d.mts +0 -106
  120. package/dist/typescript/index.d.mts.map +0 -1
  121. package/dist/typescript/index.mjs +0 -4
  122. package/dist/utils.mjs.map +0 -1
  123. package/dist/virtual-BNy8T32w.cjs +0 -548
  124. package/dist/virtual-PaZGNIrj.mjs +0 -513
  125. package/dist/virtual-PaZGNIrj.mjs.map +0 -1
@@ -1,548 +0,0 @@
1
- const require_chunk = require('./chunk-AIJqnxB6.cjs');
2
- const require_utils = require('./utils.cjs');
3
- let _stryke_fs_exists = require("@stryke/fs/exists");
4
- let _stryke_fs_helpers = require("@stryke/fs/helpers");
5
- let _stryke_fs_list_files = require("@stryke/fs/list-files");
6
- let _stryke_path_append = require("@stryke/path/append");
7
- let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
8
- let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
9
- let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
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");
15
- let node_fs = require("node:fs");
16
- let node_fs_promises = require("node:fs/promises");
17
- let node_path = require("node:path");
18
-
19
- //#region src/storage/base.ts
20
- /**
21
- * Abstract base class for storage adapters, providing a template for storage operations.
22
- */
23
- var BaseStorageAdapter = class {
24
- /**
25
- * Indicates whether the storage adapter has been disposed.
26
- */
27
- #isDisposed = false;
28
- /**
29
- * Configuration options for the storage adapter.
30
- */
31
- options;
32
- /**
33
- * The storage preset for the adapter.
34
- *
35
- * @remarks
36
- * This can be used as an alternate way to identify the type of storage being used.
37
- */
38
- preset = null;
39
- /**
40
- * Constructor for the BaseStorageAdapter.
41
- *
42
- * @param context - The Powerlines context.
43
- * @param options - Configuration options for the storage adapter.
44
- */
45
- constructor(context, options = { base: "/" }) {
46
- this.context = context;
47
- this.options = options;
48
- this.options.base = (0, node_path.resolve)(options.base);
49
- this.options.isReadOnly = !!options.isReadOnly;
50
- }
51
- /**
52
- * Asynchronously checks if a key exists in the storage.
53
- *
54
- * @param key - The key to check for existence.
55
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
56
- */
57
- async exists(key) {
58
- return this.existsSync(key);
59
- }
60
- /**
61
- * Asynchronously retrieves the value associated with a given key.
62
- *
63
- * @param key - The key whose value is to be retrieved.
64
- * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
65
- */
66
- async get(key) {
67
- return this.getSync(key);
68
- }
69
- /**
70
- * Asynchronously sets the value for a given key.
71
- *
72
- * @param key - The key to set the value for.
73
- * @param value - The value to set.
74
- */
75
- async set(key, value) {
76
- if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) this.setSync(key, value);
77
- }
78
- /**
79
- * Synchronously creates a directory at the specified path.
80
- *
81
- * @param _ - The path of the directory to create.
82
- */
83
- mkdirSync(_) {}
84
- /**
85
- * Creates a directory at the specified path.
86
- *
87
- * @param dirPath - The path of the directory to create.
88
- */
89
- async mkdir(dirPath) {
90
- return Promise.resolve(this.mkdirSync(dirPath));
91
- }
92
- /**
93
- * Asynchronously removes a key from the storage.
94
- *
95
- * @param key - The key to remove.
96
- */
97
- async remove(key) {
98
- if (!this.isReadOnly && this.overwrite) this.removeSync(key);
99
- }
100
- /**
101
- * Synchronously removes all entries from the storage that match the provided base path.
102
- *
103
- * @param base - The base path to clear keys from.
104
- */
105
- clearSync(base) {
106
- if (!this.isReadOnly && this.overwrite) {
107
- const keys = this.listSync(base || this.options.base);
108
- if (!keys.length) return;
109
- keys.map((key) => this.removeSync(base && !key.startsWith(base) ? (0, _stryke_path_join.joinPaths)(base, key) : key));
110
- }
111
- }
112
- /**
113
- * Asynchronously removes all entries from the storage that match the provided base path.
114
- *
115
- * @param base - The base path to clear keys from.
116
- * @returns A promise that resolves when the operation is complete.
117
- */
118
- async clear(base) {
119
- if (!this.isReadOnly && this.overwrite) {
120
- const keys = await this.list(base || this.options.base);
121
- if (!keys.length) return;
122
- await Promise.all(keys.map(async (key) => this.remove(base && !key.startsWith(base) ? (0, _stryke_path_join.joinPaths)(base, key) : key)));
123
- }
124
- }
125
- /**
126
- * Asynchronously lists all keys under a given base path.
127
- *
128
- * @param base - The base path to list keys from.
129
- * @returns A promise that resolves to an array of keys under the specified base path.
130
- */
131
- async list(base) {
132
- return this.listSync(base);
133
- }
134
- /**
135
- * Synchronously checks if the given key is a directory.
136
- *
137
- * @param _ - The key to check.
138
- * @returns `true` if the key is a directory, otherwise `false`.
139
- */
140
- isDirectorySync(_) {
141
- return false;
142
- }
143
- /**
144
- * Checks if the given key is a directory.
145
- *
146
- * @param key - The key to check.
147
- * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
148
- */
149
- async isDirectory(key) {
150
- return Promise.resolve(this.isDirectorySync(key));
151
- }
152
- /**
153
- * Synchronously checks if the given key is a file.
154
- *
155
- * @param key - The key to check.
156
- * @returns `true` if the key is a file, otherwise `false`.
157
- */
158
- isFileSync(key) {
159
- return this.existsSync(key) && !this.isDirectorySync(key);
160
- }
161
- /**
162
- * Checks if the given key is a file.
163
- *
164
- * @param key - The key to check.
165
- * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
166
- */
167
- async isFile(key) {
168
- return Promise.resolve(this.isFileSync(key));
169
- }
170
- /**
171
- * Disposes of the storage adapter, releasing any held resources.
172
- *
173
- * @returns A promise that resolves when the disposal is complete.
174
- */
175
- dispose() {
176
- return Promise.resolve();
177
- }
178
- /**
179
- * Async dispose method to clean up resources.
180
- *
181
- * @returns A promise that resolves when disposal is complete.
182
- */
183
- async [Symbol.asyncDispose]() {
184
- return this._dispose();
185
- }
186
- /**
187
- * Determines if the storage adapter is read-only based on the provided options.
188
- *
189
- * @returns `true` if the storage adapter is read-only, otherwise `false`.
190
- */
191
- get isReadOnly() {
192
- return !!this.options.isReadOnly;
193
- }
194
- /**
195
- * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.
196
- *
197
- * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.
198
- */
199
- get overwrite() {
200
- return !this.isReadOnly && this.context.config.output.overwrite !== false;
201
- }
202
- /**
203
- * Resolves a given key to its full path within the storage adapter.
204
- *
205
- * @param key - The key to resolve.
206
- * @returns The resolved full path for the key.
207
- */
208
- resolve(key) {
209
- if (!key) return this.options.base;
210
- if (/\.\.:|\.\.$/.test(key)) throw new Error(`[${this.name}]: Invalid key: ${JSON.stringify(key)} provided to storage adapter.`);
211
- return (0, _stryke_path_append.appendPath)((0, _stryke_path_correct_path.correctPath)(key).replace(/:/g, "/"), this.options.base);
212
- }
213
- /**
214
- * Disposes of the storage adapter, releasing any held resources.
215
- *
216
- * @returns A promise that resolves when the disposal is complete.
217
- */
218
- async _dispose() {
219
- if (!this.#isDisposed) {
220
- await Promise.resolve(this.dispose());
221
- this.#isDisposed = true;
222
- }
223
- }
224
- };
225
-
226
- //#endregion
227
- //#region src/storage/helpers.ts
228
- /**
229
- * Checks if an error is a file system error.
230
- *
231
- * @param err - The error to check.
232
- * @returns `true` if the error is a file system error, otherwise `false`.
233
- */
234
- function isFileError(err) {
235
- return (0, _stryke_type_checks_is_error.isError)(err) && "code" in err && err.code;
236
- }
237
- /**
238
- * Ignores file not found errors.
239
- *
240
- * @param err - The error to check.
241
- * @returns `null` if the error is a file not found error, otherwise returns the error.
242
- */
243
- function ignoreNotfound(err) {
244
- return isFileError(err) && (err.code === "ENOENT" || err.code === "EISDIR" ? null : err);
245
- }
246
- /**
247
- * Ignores file exists errors.
248
- *
249
- * @param err - The error to check.
250
- * @returns `null` if the error is a file exists error, otherwise returns the error.
251
- */
252
- function ignoreExists(err) {
253
- return isFileError(err) && err.code === "EEXIST" ? null : err;
254
- }
255
-
256
- //#endregion
257
- //#region src/storage/file-system.ts
258
- /**
259
- * File system storage adapter implementation.
260
- */
261
- var FileSystemStorageAdapter = class extends BaseStorageAdapter {
262
- /**
263
- * A name identifying the storage adapter type.
264
- */
265
- name = "file-system";
266
- /**
267
- * The storage preset for the adapter.
268
- *
269
- * @remarks
270
- * This can be used as an alternate way to identify the type of storage being used.
271
- */
272
- preset = "fs";
273
- /**
274
- * Constructor for the FileSystemStorageAdapter.
275
- *
276
- * @param context - The Powerlines context.
277
- * @param options - Configuration options for the storage adapter.
278
- */
279
- constructor(context, options) {
280
- super(context, options);
281
- }
282
- /**
283
- * Synchronously checks if a key exists in the storage.
284
- *
285
- * @param key - The key to check for existence.
286
- * @returns Returns `true` if the key exists, otherwise `false`.
287
- */
288
- existsSync(key) {
289
- return (0, _stryke_fs_exists.existsSync)(this.resolve(key));
290
- }
291
- /**
292
- * Asynchronously checks if a key exists in the storage.
293
- *
294
- * @param key - The key to check for existence.
295
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
296
- */
297
- async exists(key) {
298
- return (0, _stryke_fs_exists.exists)(this.resolve(key));
299
- }
300
- /**
301
- * Synchronously retrieves the value associated with a given key.
302
- *
303
- * @param key - The key whose value is to be retrieved.
304
- * @returns The value associated with the key, or `null` if the key does not exist.
305
- */
306
- getSync(key) {
307
- return (0, _stryke_fs_read_file.readFileSync)(this.resolve(key));
308
- }
309
- /**
310
- * Asynchronously retrieves the value associated with a given key.
311
- *
312
- * @param key - The key whose value is to be retrieved.
313
- * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
314
- */
315
- async get(key) {
316
- return (0, _stryke_fs_read_file.readFile)(this.resolve(key));
317
- }
318
- /**
319
- * Synchronously sets the value for a given key.
320
- *
321
- * @param key - The key to set the value for.
322
- * @param value - The value to set.
323
- */
324
- setSync(key, value) {
325
- if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
326
- const existingValue = this.getSync(this.resolve(key));
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
- }
330
- /**
331
- * Asynchronously sets the value for a given key.
332
- *
333
- * @param key - The key to set the value for.
334
- * @param value - The value to set.
335
- */
336
- async set(key, value) {
337
- if (!this.isReadOnly) if (this.existsSync(this.resolve(key)) && !this.overwrite) {
338
- const existingValue = await this.get(this.resolve(key));
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
- }
342
- /**
343
- * Synchronously removes a key from the storage.
344
- *
345
- * @param key - The key to remove.
346
- */
347
- removeSync(key) {
348
- if (!this.isReadOnly && this.overwrite) try {
349
- return (0, node_fs.unlinkSync)(this.resolve(key));
350
- } catch (err) {
351
- return ignoreNotfound(err);
352
- }
353
- }
354
- /**
355
- * Asynchronously removes a key from the storage.
356
- *
357
- * @param key - The key to remove.
358
- */
359
- async remove(key) {
360
- if (!this.isReadOnly && this.overwrite) return (0, node_fs_promises.unlink)(this.resolve(key)).catch(ignoreNotfound);
361
- }
362
- /**
363
- * Synchronously creates a directory at the specified path.
364
- *
365
- * @param dirPath - The path of the directory to create.
366
- */
367
- mkdirSync(dirPath) {
368
- (0, _stryke_fs_helpers.createDirectorySync)(this.resolve(dirPath));
369
- }
370
- /**
371
- * Creates a directory at the specified path.
372
- *
373
- * @param dirPath - The path of the directory to create.
374
- */
375
- async mkdir(dirPath) {
376
- await (0, _stryke_fs_helpers.createDirectory)(this.resolve(dirPath));
377
- }
378
- /**
379
- * Lists all keys under a given base path synchronously.
380
- *
381
- * @param base - The base path to list keys from.
382
- * @returns An array of keys under the specified base path.
383
- */
384
- listSync(base) {
385
- try {
386
- return (0, _stryke_fs_list_files.listFilesSync)(this.resolve(base), { ignore: this.options.ignore });
387
- } catch (err) {
388
- return ignoreNotfound(err) ?? [];
389
- }
390
- }
391
- /**
392
- * Asynchronously lists all keys under a given base path.
393
- *
394
- * @param base - The base path to list keys from.
395
- * @returns A promise that resolves to an array of keys under the specified base path.
396
- */
397
- async list(base) {
398
- return (0, _stryke_fs_list_files.listFiles)(this.resolve(base), { ignore: this.options.ignore }).catch(ignoreNotfound).then((r) => r || []);
399
- }
400
- /**
401
- * Synchronously checks if the given key is a directory.
402
- *
403
- * @param key - The key to check.
404
- * @returns `true` if the key is a directory, otherwise `false`.
405
- */
406
- isDirectorySync(key) {
407
- return (0, _stryke_fs_is_file.isDirectory)(this.resolve(key));
408
- }
409
- /**
410
- * Synchronously checks if the given key is a file.
411
- *
412
- * @param key - The key to check.
413
- * @returns `true` if the key is a file, otherwise `false`.
414
- */
415
- isFileSync(key) {
416
- return (0, _stryke_fs_is_file.isFile)(this.resolve(key));
417
- }
418
- };
419
-
420
- //#endregion
421
- //#region src/storage/virtual.ts
422
- /**
423
- * Virtual/in-memory storage adapter implementation.
424
- */
425
- var VirtualStorageAdapter = class extends BaseStorageAdapter {
426
- /**
427
- * A name identifying the storage adapter type.
428
- */
429
- name = "virtual";
430
- /**
431
- * The storage preset for the adapter.
432
- *
433
- * @remarks
434
- * This can be used as an alternate way to identify the type of storage being used.
435
- */
436
- preset = "virtual";
437
- /**
438
- * In-memory data storage.
439
- */
440
- data = /* @__PURE__ */ new Map();
441
- /**
442
- * Constructor for the VirtualStorageAdapter.
443
- *
444
- * @param context - The Powerlines context.
445
- * @param options - Configuration options for the storage adapter.
446
- */
447
- constructor(context, options) {
448
- super(context, options);
449
- }
450
- /**
451
- * Synchronously checks if a key exists in the storage.
452
- *
453
- * @param key - The key to check for existence.
454
- * @returns Returns `true` if the key exists, otherwise `false`.
455
- */
456
- existsSync(key) {
457
- return this.data.has(this.resolve(key));
458
- }
459
- /**
460
- * Synchronously retrieves the value associated with a given key.
461
- *
462
- * @param key - The key whose value is to be retrieved.
463
- * @returns The value associated with the key, or `null` if the key does not exist.
464
- */
465
- getSync(key) {
466
- return this.data.get(this.resolve(key)) ?? null;
467
- }
468
- /**
469
- * Synchronously sets the value for a given key.
470
- *
471
- * @param key - The key to set the value for.
472
- * @param value - The value to set.
473
- */
474
- setSync(key, value) {
475
- if (!this.isReadOnly && (!this.existsSync(key) || this.overwrite)) this.data.set(this.resolve(key), value);
476
- }
477
- /**
478
- * Synchronously removes a key from the storage.
479
- *
480
- * @param key - The key to remove.
481
- */
482
- removeSync(key) {
483
- if (!this.isReadOnly && this.overwrite) this.data.delete(this.resolve(key));
484
- }
485
- /**
486
- * Lists all keys under a given base path synchronously.
487
- *
488
- * @param base - The base path to list keys from.
489
- * @returns An array of keys under the specified base path.
490
- */
491
- listSync(base) {
492
- return [...this.data.keys().filter((key) => !base ? true : (0, _stryke_path_is_parent_path.isParentPath)(key, this.resolve(base)))];
493
- }
494
- /**
495
- * Disposes of the storage adapter, releasing any held resources.
496
- *
497
- * @returns A promise that resolves when the disposal is complete.
498
- */
499
- async dispose() {
500
- return this.clear();
501
- }
502
- /**
503
- * Determines if the storage adapter should overwrite existing keys based on the provided options and context configuration.
504
- *
505
- * @returns `true` if the storage adapter should overwrite existing keys, otherwise `false`.
506
- */
507
- get overwrite() {
508
- return !this.isReadOnly;
509
- }
510
- };
511
-
512
- //#endregion
513
- Object.defineProperty(exports, 'BaseStorageAdapter', {
514
- enumerable: true,
515
- get: function () {
516
- return BaseStorageAdapter;
517
- }
518
- });
519
- Object.defineProperty(exports, 'FileSystemStorageAdapter', {
520
- enumerable: true,
521
- get: function () {
522
- return FileSystemStorageAdapter;
523
- }
524
- });
525
- Object.defineProperty(exports, 'VirtualStorageAdapter', {
526
- enumerable: true,
527
- get: function () {
528
- return VirtualStorageAdapter;
529
- }
530
- });
531
- Object.defineProperty(exports, 'ignoreExists', {
532
- enumerable: true,
533
- get: function () {
534
- return ignoreExists;
535
- }
536
- });
537
- Object.defineProperty(exports, 'ignoreNotfound', {
538
- enumerable: true,
539
- get: function () {
540
- return ignoreNotfound;
541
- }
542
- });
543
- Object.defineProperty(exports, 'isFileError', {
544
- enumerable: true,
545
- get: function () {
546
- return isFileError;
547
- }
548
- });