@powerlines/plugin-vite 0.14.122 → 0.14.124

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 (141) hide show
  1. package/dist/helpers/index.cjs +3 -2
  2. package/dist/helpers/index.d.cts +3 -1
  3. package/dist/helpers/index.d.mts +3 -1
  4. package/dist/helpers/index.mjs +2 -1
  5. package/dist/helpers/unplugin.cjs +2 -11
  6. package/dist/helpers/unplugin.d.cts +2 -6
  7. package/dist/helpers/unplugin.d.mts +2 -6
  8. package/dist/helpers/unplugin.mjs +1 -9
  9. package/dist/helpers-CmEjzAn_.mjs +1 -0
  10. package/dist/helpers-LF26RHol.cjs +0 -0
  11. package/dist/index-BR1oNnaF.d.cts +1 -0
  12. package/dist/index-DEHBdV_z.d.mts +1 -0
  13. package/dist/index-_wQ5ClJU.d.cts +1 -0
  14. package/dist/index-vkGVyY9v.d.mts +1 -0
  15. package/dist/index.cjs +170 -9
  16. package/dist/index.d.cts +4 -3
  17. package/dist/index.d.mts +5 -5
  18. package/dist/index.mjs +165 -3
  19. package/dist/plugin-Dc12T6ZF.d.mts +1960 -0
  20. package/dist/plugin-jZ9N9Mz-.mjs +1 -0
  21. package/dist/plugin-pBKbb5K9.cjs +0 -0
  22. package/dist/plugin-vkCGh5de.d.cts +1957 -0
  23. package/dist/types/index.cjs +2 -0
  24. package/dist/types/index.d.cts +2 -1
  25. package/dist/types/index.d.mts +2 -1
  26. package/dist/types/index.mjs +3 -0
  27. package/dist/types/internal.d.cts +191 -3
  28. package/dist/types/internal.d.mts +191 -3
  29. package/dist/types/plugin.cjs +1 -0
  30. package/dist/types/plugin.d.cts +1 -12
  31. package/dist/types/plugin.d.mts +1 -12
  32. package/dist/types/plugin.mjs +2 -0
  33. package/dist/types-BtDR9wb1.mjs +1 -0
  34. package/dist/types-o3zWarRp.cjs +0 -0
  35. package/dist/unplugin-B3TcDD6I.mjs +4617 -0
  36. package/dist/unplugin-Bv2agFkI.cjs +4661 -0
  37. package/dist/unplugin-D_zrAqRh.d.mts +7 -0
  38. package/dist/unplugin-F1UAxbOS.d.cts +7 -0
  39. package/package.json +5 -5
  40. package/dist/_virtual/rolldown_runtime.cjs +0 -29
  41. package/dist/powerlines/schemas/fs.cjs +0 -226
  42. package/dist/powerlines/schemas/fs.mjs +0 -224
  43. package/dist/powerlines/src/api.cjs +0 -580
  44. package/dist/powerlines/src/api.mjs +0 -578
  45. package/dist/powerlines/src/internal/babel/module-resolver-plugin.cjs +0 -86
  46. package/dist/powerlines/src/internal/babel/module-resolver-plugin.mjs +0 -84
  47. package/dist/powerlines/src/internal/helpers/environment.cjs +0 -52
  48. package/dist/powerlines/src/internal/helpers/environment.mjs +0 -48
  49. package/dist/powerlines/src/internal/helpers/generate-types.cjs +0 -51
  50. package/dist/powerlines/src/internal/helpers/generate-types.mjs +0 -49
  51. package/dist/powerlines/src/internal/helpers/hooks.cjs +0 -63
  52. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -48
  53. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -50
  54. package/dist/powerlines/src/internal/helpers/hooks.mjs +0 -61
  55. package/dist/powerlines/src/internal/helpers/install-dependencies.cjs +0 -25
  56. package/dist/powerlines/src/internal/helpers/install-dependencies.mjs +0 -24
  57. package/dist/powerlines/src/internal/helpers/install.cjs +0 -37
  58. package/dist/powerlines/src/internal/helpers/install.mjs +0 -36
  59. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.cjs +0 -98
  60. package/dist/powerlines/src/internal/helpers/resolve-tsconfig.mjs +0 -94
  61. package/dist/powerlines/src/internal/helpers/resolver.cjs +0 -43
  62. package/dist/powerlines/src/internal/helpers/resolver.mjs +0 -41
  63. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  64. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  65. package/dist/powerlines/src/lib/build/vite.cjs +0 -74
  66. package/dist/powerlines/src/lib/build/vite.mjs +0 -71
  67. package/dist/powerlines/src/lib/config-file.cjs +0 -79
  68. package/dist/powerlines/src/lib/config-file.mjs +0 -76
  69. package/dist/powerlines/src/lib/contexts/api-context.cjs +0 -184
  70. package/dist/powerlines/src/lib/contexts/api-context.mjs +0 -182
  71. package/dist/powerlines/src/lib/contexts/context.cjs +0 -931
  72. package/dist/powerlines/src/lib/contexts/context.mjs +0 -929
  73. package/dist/powerlines/src/lib/contexts/environment-context.cjs +0 -160
  74. package/dist/powerlines/src/lib/contexts/environment-context.mjs +0 -159
  75. package/dist/powerlines/src/lib/contexts/plugin-context.cjs +0 -75
  76. package/dist/powerlines/src/lib/contexts/plugin-context.mjs +0 -74
  77. package/dist/powerlines/src/lib/entry.cjs +0 -69
  78. package/dist/powerlines/src/lib/entry.mjs +0 -67
  79. package/dist/powerlines/src/lib/fs/helpers.cjs +0 -85
  80. package/dist/powerlines/src/lib/fs/helpers.mjs +0 -81
  81. package/dist/powerlines/src/lib/fs/storage/base.cjs +0 -196
  82. package/dist/powerlines/src/lib/fs/storage/base.mjs +0 -195
  83. package/dist/powerlines/src/lib/fs/storage/file-system.cjs +0 -170
  84. package/dist/powerlines/src/lib/fs/storage/file-system.mjs +0 -169
  85. package/dist/powerlines/src/lib/fs/storage/virtual.cjs +0 -88
  86. package/dist/powerlines/src/lib/fs/storage/virtual.mjs +0 -87
  87. package/dist/powerlines/src/lib/fs/vfs.cjs +0 -830
  88. package/dist/powerlines/src/lib/fs/vfs.mjs +0 -828
  89. package/dist/powerlines/src/lib/logger.cjs +0 -58
  90. package/dist/powerlines/src/lib/logger.mjs +0 -55
  91. package/dist/powerlines/src/lib/typescript/ts-morph.cjs +0 -104
  92. package/dist/powerlines/src/lib/typescript/ts-morph.mjs +0 -102
  93. package/dist/powerlines/src/lib/typescript/tsconfig.cjs +0 -149
  94. package/dist/powerlines/src/lib/typescript/tsconfig.mjs +0 -144
  95. package/dist/powerlines/src/lib/unplugin/factory.cjs +0 -6
  96. package/dist/powerlines/src/lib/unplugin/factory.mjs +0 -8
  97. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -17
  98. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -16
  99. package/dist/powerlines/src/lib/unplugin/index.cjs +0 -3
  100. package/dist/powerlines/src/lib/unplugin/index.mjs +0 -5
  101. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -128
  102. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -127
  103. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  104. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  105. package/dist/powerlines/src/lib/utilities/meta.cjs +0 -45
  106. package/dist/powerlines/src/lib/utilities/meta.mjs +0 -41
  107. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -22
  108. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -21
  109. package/dist/powerlines/src/plugin-utils/helpers.cjs +0 -148
  110. package/dist/powerlines/src/plugin-utils/helpers.mjs +0 -138
  111. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -36
  112. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -35
  113. package/dist/powerlines/src/types/api.d.cts +0 -104
  114. package/dist/powerlines/src/types/api.d.mts +0 -104
  115. package/dist/powerlines/src/types/babel.d.mts +0 -4
  116. package/dist/powerlines/src/types/build.cjs +0 -15
  117. package/dist/powerlines/src/types/build.d.cts +0 -154
  118. package/dist/powerlines/src/types/build.d.mts +0 -154
  119. package/dist/powerlines/src/types/build.mjs +0 -14
  120. package/dist/powerlines/src/types/commands.cjs +0 -16
  121. package/dist/powerlines/src/types/commands.d.cts +0 -8
  122. package/dist/powerlines/src/types/commands.d.mts +0 -9
  123. package/dist/powerlines/src/types/commands.mjs +0 -15
  124. package/dist/powerlines/src/types/config.d.cts +0 -416
  125. package/dist/powerlines/src/types/config.d.mts +0 -418
  126. package/dist/powerlines/src/types/context.d.cts +0 -514
  127. package/dist/powerlines/src/types/context.d.mts +0 -514
  128. package/dist/powerlines/src/types/fs.d.cts +0 -486
  129. package/dist/powerlines/src/types/fs.d.mts +0 -486
  130. package/dist/powerlines/src/types/hooks.d.cts +0 -30
  131. package/dist/powerlines/src/types/hooks.d.mts +0 -30
  132. package/dist/powerlines/src/types/internal.d.cts +0 -58
  133. package/dist/powerlines/src/types/internal.d.mts +0 -58
  134. package/dist/powerlines/src/types/plugin.cjs +0 -32
  135. package/dist/powerlines/src/types/plugin.d.cts +0 -234
  136. package/dist/powerlines/src/types/plugin.d.mts +0 -234
  137. package/dist/powerlines/src/types/plugin.mjs +0 -31
  138. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  139. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  140. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  141. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
@@ -1,170 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_helpers = require('../helpers.cjs');
3
- const require_base = require('./base.cjs');
4
- let __stryke_fs_is_file = require("@stryke/fs/is-file");
5
- let __stryke_fs_list_files = require("@stryke/fs/list-files");
6
- let __stryke_fs_helpers = require("@stryke/fs/helpers");
7
- let __stryke_fs_exists = require("@stryke/fs/exists");
8
- let __stryke_fs_read_file = require("@stryke/fs/read-file");
9
- let __stryke_fs_write_file = require("@stryke/fs/write-file");
10
- let node_fs = require("node:fs");
11
- let node_fs_promises = require("node:fs/promises");
12
-
13
- //#region ../powerlines/src/lib/fs/storage/file-system.ts
14
- /**
15
- * File system storage adapter implementation.
16
- */
17
- var FileSystemStorageAdapter = class extends require_base.BaseStorageAdapter {
18
- /**
19
- * A name identifying the storage adapter type.
20
- */
21
- name = "file-system";
22
- /**
23
- * The storage preset for the adapter.
24
- *
25
- * @remarks
26
- * This can be used as an alternate way to identify the type of storage being used.
27
- */
28
- preset = "fs";
29
- /**
30
- * Constructor for the FileSystemStorageAdapter.
31
- *
32
- * @param options - Configuration options for the storage adapter.
33
- */
34
- constructor(options) {
35
- super(options);
36
- }
37
- /**
38
- * Synchronously checks if a key exists in the storage.
39
- *
40
- * @param key - The key to check for existence.
41
- * @returns Returns `true` if the key exists, otherwise `false`.
42
- */
43
- existsSync(key) {
44
- return (0, __stryke_fs_exists.existsSync)(this.resolve(key));
45
- }
46
- /**
47
- * Asynchronously checks if a key exists in the storage.
48
- *
49
- * @param key - The key to check for existence.
50
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
51
- */
52
- async exists(key) {
53
- return (0, __stryke_fs_exists.exists)(this.resolve(key));
54
- }
55
- /**
56
- * Synchronously retrieves the value associated with a given key.
57
- *
58
- * @param key - The key whose value is to be retrieved.
59
- * @returns The value associated with the key, or `null` if the key does not exist.
60
- */
61
- getSync(key) {
62
- return (0, __stryke_fs_read_file.readFileSync)(this.resolve(key));
63
- }
64
- /**
65
- * Asynchronously retrieves the value associated with a given key.
66
- *
67
- * @param key - The key whose value is to be retrieved.
68
- * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
69
- */
70
- async get(key) {
71
- return (0, __stryke_fs_read_file.readFile)(this.resolve(key));
72
- }
73
- /**
74
- * Synchronously sets the value for a given key.
75
- *
76
- * @param key - The key to set the value for.
77
- * @param value - The value to set.
78
- */
79
- setSync(key, value) {
80
- if (!this.options.isReadOnly) return (0, __stryke_fs_write_file.writeFileSync)(this.resolve(key), value);
81
- }
82
- /**
83
- * Asynchronously sets the value for a given key.
84
- *
85
- * @param key - The key to set the value for.
86
- * @param value - The value to set.
87
- */
88
- async set(key, value) {
89
- if (!this.options.isReadOnly) return (0, __stryke_fs_write_file.writeFile)(this.resolve(key), value);
90
- }
91
- /**
92
- * Synchronously removes a key from the storage.
93
- *
94
- * @param key - The key to remove.
95
- */
96
- removeSync(key) {
97
- if (!this.options.isReadOnly) try {
98
- return (0, node_fs.unlinkSync)(this.resolve(key));
99
- } catch (err) {
100
- return require_helpers.ignoreNotfound(err);
101
- }
102
- }
103
- /**
104
- * Asynchronously removes a key from the storage.
105
- *
106
- * @param key - The key to remove.
107
- */
108
- async remove(key) {
109
- if (!this.options.isReadOnly) return (0, node_fs_promises.unlink)(this.resolve(key)).catch(require_helpers.ignoreNotfound);
110
- }
111
- /**
112
- * Synchronously creates a directory at the specified path.
113
- *
114
- * @param dirPath - The path of the directory to create.
115
- */
116
- mkdirSync(dirPath) {
117
- (0, __stryke_fs_helpers.createDirectorySync)(this.resolve(dirPath));
118
- }
119
- /**
120
- * Creates a directory at the specified path.
121
- *
122
- * @param dirPath - The path of the directory to create.
123
- */
124
- async mkdir(dirPath) {
125
- await (0, __stryke_fs_helpers.createDirectory)(this.resolve(dirPath));
126
- }
127
- /**
128
- * Lists all keys under a given base path synchronously.
129
- *
130
- * @param base - The base path to list keys from.
131
- * @returns An array of keys under the specified base path.
132
- */
133
- listSync(base) {
134
- try {
135
- return (0, __stryke_fs_list_files.listFilesSync)(this.resolve(base), { ignore: this.options.ignore });
136
- } catch (err) {
137
- return require_helpers.ignoreNotfound(err) ?? [];
138
- }
139
- }
140
- /**
141
- * Asynchronously lists all keys under a given base path.
142
- *
143
- * @param base - The base path to list keys from.
144
- * @returns A promise that resolves to an array of keys under the specified base path.
145
- */
146
- async list(base) {
147
- return (0, __stryke_fs_list_files.listFiles)(this.resolve(base), { ignore: this.options.ignore }).catch(require_helpers.ignoreNotfound).then((r) => r || []);
148
- }
149
- /**
150
- * Synchronously checks if the given key is a directory.
151
- *
152
- * @param key - The key to check.
153
- * @returns `true` if the key is a directory, otherwise `false`.
154
- */
155
- isDirectorySync(key) {
156
- return (0, __stryke_fs_is_file.isDirectory)(this.resolve(key));
157
- }
158
- /**
159
- * Synchronously checks if the given key is a file.
160
- *
161
- * @param key - The key to check.
162
- * @returns `true` if the key is a file, otherwise `false`.
163
- */
164
- isFileSync(key) {
165
- return !(0, __stryke_fs_is_file.isFile)(this.resolve(key));
166
- }
167
- };
168
-
169
- //#endregion
170
- exports.FileSystemStorageAdapter = FileSystemStorageAdapter;
@@ -1,169 +0,0 @@
1
- import { ignoreNotfound } from "../helpers.mjs";
2
- import { BaseStorageAdapter } from "./base.mjs";
3
- import { isDirectory, isFile } from "@stryke/fs/is-file";
4
- import { listFiles, listFilesSync } from "@stryke/fs/list-files";
5
- import { createDirectory, createDirectorySync } from "@stryke/fs/helpers";
6
- import { exists, existsSync } from "@stryke/fs/exists";
7
- import { readFile, readFileSync } from "@stryke/fs/read-file";
8
- import { writeFile, writeFileSync } from "@stryke/fs/write-file";
9
- import { unlinkSync } from "node:fs";
10
- import { unlink } from "node:fs/promises";
11
-
12
- //#region ../powerlines/src/lib/fs/storage/file-system.ts
13
- /**
14
- * File system storage adapter implementation.
15
- */
16
- var FileSystemStorageAdapter = class extends BaseStorageAdapter {
17
- /**
18
- * A name identifying the storage adapter type.
19
- */
20
- name = "file-system";
21
- /**
22
- * The storage preset for the adapter.
23
- *
24
- * @remarks
25
- * This can be used as an alternate way to identify the type of storage being used.
26
- */
27
- preset = "fs";
28
- /**
29
- * Constructor for the FileSystemStorageAdapter.
30
- *
31
- * @param options - Configuration options for the storage adapter.
32
- */
33
- constructor(options) {
34
- super(options);
35
- }
36
- /**
37
- * Synchronously checks if a key exists in the storage.
38
- *
39
- * @param key - The key to check for existence.
40
- * @returns Returns `true` if the key exists, otherwise `false`.
41
- */
42
- existsSync(key) {
43
- return existsSync(this.resolve(key));
44
- }
45
- /**
46
- * Asynchronously checks if a key exists in the storage.
47
- *
48
- * @param key - The key to check for existence.
49
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
50
- */
51
- async exists(key) {
52
- return exists(this.resolve(key));
53
- }
54
- /**
55
- * Synchronously retrieves the value associated with a given key.
56
- *
57
- * @param key - The key whose value is to be retrieved.
58
- * @returns The value associated with the key, or `null` if the key does not exist.
59
- */
60
- getSync(key) {
61
- return readFileSync(this.resolve(key));
62
- }
63
- /**
64
- * Asynchronously retrieves the value associated with a given key.
65
- *
66
- * @param key - The key whose value is to be retrieved.
67
- * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.
68
- */
69
- async get(key) {
70
- return readFile(this.resolve(key));
71
- }
72
- /**
73
- * Synchronously sets the value for a given key.
74
- *
75
- * @param key - The key to set the value for.
76
- * @param value - The value to set.
77
- */
78
- setSync(key, value) {
79
- if (!this.options.isReadOnly) return writeFileSync(this.resolve(key), value);
80
- }
81
- /**
82
- * Asynchronously sets the value for a given key.
83
- *
84
- * @param key - The key to set the value for.
85
- * @param value - The value to set.
86
- */
87
- async set(key, value) {
88
- if (!this.options.isReadOnly) return writeFile(this.resolve(key), value);
89
- }
90
- /**
91
- * Synchronously removes a key from the storage.
92
- *
93
- * @param key - The key to remove.
94
- */
95
- removeSync(key) {
96
- if (!this.options.isReadOnly) try {
97
- return unlinkSync(this.resolve(key));
98
- } catch (err) {
99
- return ignoreNotfound(err);
100
- }
101
- }
102
- /**
103
- * Asynchronously removes a key from the storage.
104
- *
105
- * @param key - The key to remove.
106
- */
107
- async remove(key) {
108
- if (!this.options.isReadOnly) return unlink(this.resolve(key)).catch(ignoreNotfound);
109
- }
110
- /**
111
- * Synchronously creates a directory at the specified path.
112
- *
113
- * @param dirPath - The path of the directory to create.
114
- */
115
- mkdirSync(dirPath) {
116
- createDirectorySync(this.resolve(dirPath));
117
- }
118
- /**
119
- * Creates a directory at the specified path.
120
- *
121
- * @param dirPath - The path of the directory to create.
122
- */
123
- async mkdir(dirPath) {
124
- await createDirectory(this.resolve(dirPath));
125
- }
126
- /**
127
- * Lists all keys under a given base path synchronously.
128
- *
129
- * @param base - The base path to list keys from.
130
- * @returns An array of keys under the specified base path.
131
- */
132
- listSync(base) {
133
- try {
134
- return listFilesSync(this.resolve(base), { ignore: this.options.ignore });
135
- } catch (err) {
136
- return ignoreNotfound(err) ?? [];
137
- }
138
- }
139
- /**
140
- * Asynchronously lists all keys under a given base path.
141
- *
142
- * @param base - The base path to list keys from.
143
- * @returns A promise that resolves to an array of keys under the specified base path.
144
- */
145
- async list(base) {
146
- return listFiles(this.resolve(base), { ignore: this.options.ignore }).catch(ignoreNotfound).then((r) => r || []);
147
- }
148
- /**
149
- * Synchronously checks if the given key is a directory.
150
- *
151
- * @param key - The key to check.
152
- * @returns `true` if the key is a directory, otherwise `false`.
153
- */
154
- isDirectorySync(key) {
155
- return isDirectory(this.resolve(key));
156
- }
157
- /**
158
- * Synchronously checks if the given key is a file.
159
- *
160
- * @param key - The key to check.
161
- * @returns `true` if the key is a file, otherwise `false`.
162
- */
163
- isFileSync(key) {
164
- return !isFile(this.resolve(key));
165
- }
166
- };
167
-
168
- //#endregion
169
- export { FileSystemStorageAdapter };
@@ -1,88 +0,0 @@
1
- const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_base = require('./base.cjs');
3
- let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
4
-
5
- //#region ../powerlines/src/lib/fs/storage/virtual.ts
6
- /**
7
- * Virtual/in-memory storage adapter implementation.
8
- */
9
- var VirtualStorageAdapter = class extends require_base.BaseStorageAdapter {
10
- /**
11
- * A name identifying the storage adapter type.
12
- */
13
- name = "virtual";
14
- /**
15
- * The storage preset for the adapter.
16
- *
17
- * @remarks
18
- * This can be used as an alternate way to identify the type of storage being used.
19
- */
20
- preset = "virtual";
21
- /**
22
- * In-memory data storage.
23
- */
24
- data = /* @__PURE__ */ new Map();
25
- /**
26
- * Constructor for the VirtualStorageAdapter.
27
- *
28
- * @param options - Configuration options for the storage adapter.
29
- */
30
- constructor(options) {
31
- super(options);
32
- }
33
- /**
34
- * Synchronously checks if a key exists in the storage.
35
- *
36
- * @param key - The key to check for existence.
37
- * @returns Returns `true` if the key exists, otherwise `false`.
38
- */
39
- existsSync(key) {
40
- return this.data.has(this.resolve(key));
41
- }
42
- /**
43
- * Synchronously retrieves the value associated with a given key.
44
- *
45
- * @param key - The key whose value is to be retrieved.
46
- * @returns The value associated with the key, or `null` if the key does not exist.
47
- */
48
- getSync(key) {
49
- return this.data.get(this.resolve(key)) ?? null;
50
- }
51
- /**
52
- * Synchronously sets the value for a given key.
53
- *
54
- * @param key - The key to set the value for.
55
- * @param value - The value to set.
56
- */
57
- setSync(key, value) {
58
- if (!this.options.isReadOnly) this.data.set(this.resolve(key), value);
59
- }
60
- /**
61
- * Synchronously removes a key from the storage.
62
- *
63
- * @param key - The key to remove.
64
- */
65
- removeSync(key) {
66
- if (!this.options.isReadOnly) this.data.delete(this.resolve(key));
67
- }
68
- /**
69
- * Lists all keys under a given base path synchronously.
70
- *
71
- * @param base - The base path to list keys from.
72
- * @returns An array of keys under the specified base path.
73
- */
74
- listSync(base) {
75
- return [...this.data.keys().filter((key) => !base ? true : (0, __stryke_path_is_parent_path.isParentPath)(key, this.resolve(base)))];
76
- }
77
- /**
78
- * Disposes of the storage adapter, releasing any held resources.
79
- *
80
- * @returns A promise that resolves when the disposal is complete.
81
- */
82
- async dispose() {
83
- return this.clear();
84
- }
85
- };
86
-
87
- //#endregion
88
- exports.VirtualStorageAdapter = VirtualStorageAdapter;
@@ -1,87 +0,0 @@
1
- import { BaseStorageAdapter } from "./base.mjs";
2
- import { isParentPath } from "@stryke/path/is-parent-path";
3
-
4
- //#region ../powerlines/src/lib/fs/storage/virtual.ts
5
- /**
6
- * Virtual/in-memory storage adapter implementation.
7
- */
8
- var VirtualStorageAdapter = class extends BaseStorageAdapter {
9
- /**
10
- * A name identifying the storage adapter type.
11
- */
12
- name = "virtual";
13
- /**
14
- * The storage preset for the adapter.
15
- *
16
- * @remarks
17
- * This can be used as an alternate way to identify the type of storage being used.
18
- */
19
- preset = "virtual";
20
- /**
21
- * In-memory data storage.
22
- */
23
- data = /* @__PURE__ */ new Map();
24
- /**
25
- * Constructor for the VirtualStorageAdapter.
26
- *
27
- * @param options - Configuration options for the storage adapter.
28
- */
29
- constructor(options) {
30
- super(options);
31
- }
32
- /**
33
- * Synchronously checks if a key exists in the storage.
34
- *
35
- * @param key - The key to check for existence.
36
- * @returns Returns `true` if the key exists, otherwise `false`.
37
- */
38
- existsSync(key) {
39
- return this.data.has(this.resolve(key));
40
- }
41
- /**
42
- * Synchronously retrieves the value associated with a given key.
43
- *
44
- * @param key - The key whose value is to be retrieved.
45
- * @returns The value associated with the key, or `null` if the key does not exist.
46
- */
47
- getSync(key) {
48
- return this.data.get(this.resolve(key)) ?? null;
49
- }
50
- /**
51
- * Synchronously sets the value for a given key.
52
- *
53
- * @param key - The key to set the value for.
54
- * @param value - The value to set.
55
- */
56
- setSync(key, value) {
57
- if (!this.options.isReadOnly) this.data.set(this.resolve(key), value);
58
- }
59
- /**
60
- * Synchronously removes a key from the storage.
61
- *
62
- * @param key - The key to remove.
63
- */
64
- removeSync(key) {
65
- if (!this.options.isReadOnly) this.data.delete(this.resolve(key));
66
- }
67
- /**
68
- * Lists all keys under a given base path synchronously.
69
- *
70
- * @param base - The base path to list keys from.
71
- * @returns An array of keys under the specified base path.
72
- */
73
- listSync(base) {
74
- return [...this.data.keys().filter((key) => !base ? true : isParentPath(key, this.resolve(base)))];
75
- }
76
- /**
77
- * Disposes of the storage adapter, releasing any held resources.
78
- *
79
- * @returns A promise that resolves when the disposal is complete.
80
- */
81
- async dispose() {
82
- return this.clear();
83
- }
84
- };
85
-
86
- //#endregion
87
- export { VirtualStorageAdapter };