@veryfront/ext-content-mdx 0.1.1186 → 0.1.1189

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 (163) hide show
  1. package/esm/_dnt.polyfills.d.ts +6 -6
  2. package/esm/_dnt.polyfills.d.ts.map +1 -1
  3. package/esm/deno.d.ts +18 -0
  4. package/esm/deno.js +30 -9
  5. package/esm/src/config/defaults.d.ts +31 -24
  6. package/esm/src/config/defaults.d.ts.map +1 -1
  7. package/esm/src/config/defaults.js +25 -18
  8. package/esm/src/errors/diagnostic-policy.d.ts +35 -0
  9. package/esm/src/errors/diagnostic-policy.d.ts.map +1 -0
  10. package/esm/src/errors/diagnostic-policy.js +100 -0
  11. package/esm/src/errors/error-registry/boundary.d.ts +2 -0
  12. package/esm/src/errors/error-registry/boundary.d.ts.map +1 -1
  13. package/esm/src/errors/error-registry/boundary.js +8 -0
  14. package/esm/src/errors/error-registry/config.d.ts.map +1 -1
  15. package/esm/src/errors/error-registry/config.js +3 -3
  16. package/esm/src/errors/error-registry/deploy.js +1 -1
  17. package/esm/src/errors/error-registry/server.d.ts +2 -0
  18. package/esm/src/errors/error-registry/server.d.ts.map +1 -1
  19. package/esm/src/errors/error-registry/server.js +8 -0
  20. package/esm/src/errors/error-registry-helpers.d.ts +11 -2
  21. package/esm/src/errors/error-registry-helpers.d.ts.map +1 -1
  22. package/esm/src/errors/error-registry-helpers.js +70 -1
  23. package/esm/src/errors/error-registry.d.ts +85 -73
  24. package/esm/src/errors/error-registry.d.ts.map +1 -1
  25. package/esm/src/errors/error-registry.js +2 -14
  26. package/esm/src/errors/types.d.ts +44 -5
  27. package/esm/src/errors/types.d.ts.map +1 -1
  28. package/esm/src/errors/types.js +148 -24
  29. package/esm/src/errors/veryfront-error.d.ts +25 -2
  30. package/esm/src/errors/veryfront-error.d.ts.map +1 -1
  31. package/esm/src/errors/veryfront-error.js +638 -28
  32. package/esm/src/observability/limits.d.ts +20 -0
  33. package/esm/src/observability/limits.d.ts.map +1 -0
  34. package/esm/src/observability/limits.js +19 -0
  35. package/esm/src/observability/telemetry-error.d.ts +22 -0
  36. package/esm/src/observability/telemetry-error.d.ts.map +1 -0
  37. package/esm/src/observability/telemetry-error.js +377 -0
  38. package/esm/src/observability/tracing/api-shim.d.ts +39 -0
  39. package/esm/src/observability/tracing/api-shim.d.ts.map +1 -1
  40. package/esm/src/observability/tracing/api-shim.js +196 -69
  41. package/esm/src/observability/tracing/context-callback.d.ts +14 -0
  42. package/esm/src/observability/tracing/context-callback.d.ts.map +1 -0
  43. package/esm/src/observability/tracing/context-callback.js +111 -0
  44. package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
  45. package/esm/src/observability/tracing/otlp-setup.js +190 -46
  46. package/esm/src/platform/adapters/base.d.ts +51 -7
  47. package/esm/src/platform/adapters/base.d.ts.map +1 -1
  48. package/esm/src/platform/adapters/base.js +4 -2
  49. package/esm/src/platform/adapters/bounded-file-read.d.ts +9 -0
  50. package/esm/src/platform/adapters/bounded-file-read.d.ts.map +1 -1
  51. package/esm/src/platform/adapters/bounded-file-read.js +11 -5
  52. package/esm/src/platform/adapters/file-snapshot-error.d.ts +2 -0
  53. package/esm/src/platform/adapters/file-snapshot-error.d.ts.map +1 -1
  54. package/esm/src/platform/adapters/file-snapshot-error.js +2 -0
  55. package/esm/src/platform/adapters/file-system-capabilities.d.ts +74 -0
  56. package/esm/src/platform/adapters/file-system-capabilities.d.ts.map +1 -0
  57. package/esm/src/platform/adapters/file-system-capabilities.js +508 -0
  58. package/esm/src/platform/adapters/native-file-system-provenance.d.ts +6 -0
  59. package/esm/src/platform/adapters/native-file-system-provenance.d.ts.map +1 -0
  60. package/esm/src/platform/adapters/native-file-system-provenance.js +15 -0
  61. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts +45 -0
  62. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.d.ts.map +1 -0
  63. package/esm/src/platform/adapters/runtime/deno/filesystem-adapter.js +291 -0
  64. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts +71 -0
  65. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.d.ts.map +1 -0
  66. package/esm/src/platform/adapters/runtime/shared/node-filesystem-adapter.js +471 -0
  67. package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts +16 -0
  68. package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts.map +1 -0
  69. package/esm/src/platform/adapters/runtime/shared/shared-watcher.js +140 -0
  70. package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts +2 -0
  71. package/esm/src/platform/adapters/runtime/shared/temp-dir.d.ts.map +1 -0
  72. package/esm/src/platform/adapters/runtime/shared/temp-dir.js +10 -0
  73. package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts +5 -0
  74. package/esm/src/platform/adapters/runtime/shared/watcher-queue.d.ts.map +1 -0
  75. package/esm/src/platform/adapters/runtime/shared/watcher-queue.js +75 -0
  76. package/esm/src/platform/compat/abort-signal.d.ts +20 -0
  77. package/esm/src/platform/compat/abort-signal.d.ts.map +1 -0
  78. package/esm/src/platform/compat/abort-signal.js +64 -0
  79. package/esm/src/platform/compat/constants.d.ts +2 -2
  80. package/esm/src/platform/compat/constants.d.ts.map +1 -1
  81. package/esm/src/platform/compat/constants.js +2 -2
  82. package/esm/src/platform/compat/error-introspection.d.ts +37 -0
  83. package/esm/src/platform/compat/error-introspection.d.ts.map +1 -0
  84. package/esm/src/platform/compat/error-introspection.js +258 -0
  85. package/esm/src/platform/compat/fs.d.ts +29 -8
  86. package/esm/src/platform/compat/fs.d.ts.map +1 -1
  87. package/esm/src/platform/compat/fs.js +123 -57
  88. package/esm/src/platform/compat/native-brand-checks.d.ts +14 -0
  89. package/esm/src/platform/compat/native-brand-checks.d.ts.map +1 -0
  90. package/esm/src/platform/compat/native-brand-checks.js +68 -0
  91. package/esm/src/platform/compat/not-found-error.d.ts +8 -3
  92. package/esm/src/platform/compat/not-found-error.d.ts.map +1 -1
  93. package/esm/src/platform/compat/not-found-error.js +164 -31
  94. package/esm/src/platform/compat/path/security.d.ts.map +1 -1
  95. package/esm/src/platform/compat/path/security.js +3 -5
  96. package/esm/src/platform/compat/process/command.d.ts +24 -1
  97. package/esm/src/platform/compat/process/command.d.ts.map +1 -1
  98. package/esm/src/platform/compat/process/command.js +393 -78
  99. package/esm/src/platform/compat/process/env.d.ts +11 -0
  100. package/esm/src/platform/compat/process/env.d.ts.map +1 -1
  101. package/esm/src/platform/compat/process/env.js +28 -38
  102. package/esm/src/platform/compat/process/global-error.d.ts +19 -0
  103. package/esm/src/platform/compat/process/global-error.d.ts.map +1 -0
  104. package/esm/src/platform/compat/process/global-error.js +57 -0
  105. package/esm/src/platform/compat/process/lifecycle.d.ts +10 -3
  106. package/esm/src/platform/compat/process/lifecycle.d.ts.map +1 -1
  107. package/esm/src/platform/compat/process/lifecycle.js +74 -23
  108. package/esm/src/platform/compat/process/project-env-contract.d.ts +19 -0
  109. package/esm/src/platform/compat/process/project-env-contract.d.ts.map +1 -0
  110. package/esm/src/platform/compat/process/project-env-contract.js +19 -0
  111. package/esm/src/platform/compat/runtime.d.ts +14 -5
  112. package/esm/src/platform/compat/runtime.d.ts.map +1 -1
  113. package/esm/src/platform/compat/runtime.js +34 -9
  114. package/esm/src/platform/compat/std/front-matter-yaml.d.ts +12 -0
  115. package/esm/src/platform/compat/std/front-matter-yaml.d.ts.map +1 -1
  116. package/esm/src/platform/compat/std/front-matter-yaml.js +35 -3
  117. package/esm/src/platform/compat/temp-directory-prefix.d.ts +8 -0
  118. package/esm/src/platform/compat/temp-directory-prefix.d.ts.map +1 -0
  119. package/esm/src/platform/compat/temp-directory-prefix.js +15 -0
  120. package/esm/src/utils/abort.d.ts +10 -0
  121. package/esm/src/utils/abort.d.ts.map +1 -0
  122. package/esm/src/utils/abort.js +35 -0
  123. package/esm/src/utils/constants/build.d.ts +3 -0
  124. package/esm/src/utils/constants/build.d.ts.map +1 -1
  125. package/esm/src/utils/constants/build.js +5 -1
  126. package/esm/src/utils/constants/cache.d.ts +21 -0
  127. package/esm/src/utils/constants/cache.d.ts.map +1 -1
  128. package/esm/src/utils/constants/cache.js +101 -39
  129. package/esm/src/utils/constants/css.d.ts +20 -0
  130. package/esm/src/utils/constants/css.d.ts.map +1 -0
  131. package/esm/src/utils/constants/css.js +19 -0
  132. package/esm/src/utils/constants/limits.d.ts +4 -0
  133. package/esm/src/utils/constants/limits.d.ts.map +1 -1
  134. package/esm/src/utils/constants/limits.js +4 -0
  135. package/esm/src/utils/constants/project-identity.d.ts +5 -0
  136. package/esm/src/utils/constants/project-identity.d.ts.map +1 -0
  137. package/esm/src/utils/constants/project-identity.js +4 -0
  138. package/esm/src/utils/constants/retry.d.ts +18 -0
  139. package/esm/src/utils/constants/retry.d.ts.map +1 -1
  140. package/esm/src/utils/constants/retry.js +18 -0
  141. package/esm/src/utils/constants/security.d.ts +4 -0
  142. package/esm/src/utils/constants/security.d.ts.map +1 -1
  143. package/esm/src/utils/constants/security.js +4 -0
  144. package/esm/src/utils/index.d.ts +3 -1
  145. package/esm/src/utils/index.d.ts.map +1 -1
  146. package/esm/src/utils/index.js +3 -1
  147. package/esm/src/utils/logger/core.d.ts +5 -0
  148. package/esm/src/utils/logger/core.d.ts.map +1 -1
  149. package/esm/src/utils/logger/core.js +67 -2
  150. package/esm/src/utils/logger/redact.d.ts +36 -13
  151. package/esm/src/utils/logger/redact.d.ts.map +1 -1
  152. package/esm/src/utils/logger/redact.js +573 -83
  153. package/esm/src/utils/parallel.d.ts.map +1 -1
  154. package/esm/src/utils/parallel.js +11 -1
  155. package/esm/src/utils/project-identity.d.ts +11 -0
  156. package/esm/src/utils/project-identity.d.ts.map +1 -0
  157. package/esm/src/utils/project-identity.js +69 -0
  158. package/esm/src/utils/version-constant.d.ts +1 -1
  159. package/esm/src/utils/version-constant.js +1 -1
  160. package/package.json +3 -3
  161. package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.d.ts +0 -33
  162. package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.d.ts.map +0 -1
  163. package/esm/src/platform/adapters/runtime/shared/native-file-capabilities.js +0 -205
@@ -0,0 +1,291 @@
1
+ import * as dntShim from "../../../../../_dnt.shims.js";
2
+ import { NOT_SUPPORTED } from "../../../../errors/error-registry/general.js";
3
+ import { createFileWatcher } from "../shared/watcher-queue.js";
4
+ import { resolve, sep } from "../../../compat/path/index.js";
5
+ import { validateTempDirectoryPrefix } from "../../../compat/temp-directory-prefix.js";
6
+ import { readBoundedFilePrefix, readFileWithinLimit, withFileHandle, } from "../../bounded-file-read.js";
7
+ import { markNativeFileSystemAdapter } from "../../native-file-system-provenance.js";
8
+ import { NodeCompatibleFileSystemAdapter, } from "../shared/node-filesystem-adapter.js";
9
+ function hasOwn(value, property) {
10
+ return Object.prototype.hasOwnProperty.call(value, property);
11
+ }
12
+ function getDenoCreateRuntime() {
13
+ const runtime = dntShim.dntGlobalThis.Deno;
14
+ return runtime && typeof runtime.open === "function" ? runtime : null;
15
+ }
16
+ async function createDenoFileBytesExclusive(runtime, path, content) {
17
+ await withFileHandle(() => runtime.open(path, { write: true, createNew: true }), async (file) => {
18
+ let offset = 0;
19
+ while (offset < content.byteLength) {
20
+ const written = await file.write(content.subarray(offset));
21
+ if (!Number.isSafeInteger(written) || written <= 0 ||
22
+ written > content.byteLength - offset) {
23
+ throw new Error("Deno createNew write made no forward progress");
24
+ }
25
+ offset += written;
26
+ }
27
+ }, "Filesystem exclusive create and handle cleanup both failed");
28
+ }
29
+ function assertDenoRuntime(method) {
30
+ if (typeof dntShim.Deno === "undefined") {
31
+ throw NOT_SUPPORTED.create({
32
+ detail: `DenoFileSystemAdapter.${method}() can only be used in Deno runtime`,
33
+ });
34
+ }
35
+ }
36
+ function toFileInfo(stat) {
37
+ return {
38
+ size: stat.size,
39
+ isFile: stat.isFile,
40
+ isDirectory: stat.isDirectory,
41
+ isSymlink: stat.isSymlink,
42
+ mtime: stat.mtime,
43
+ };
44
+ }
45
+ function toFileChangeKind(kind) {
46
+ switch (kind) {
47
+ case "create":
48
+ return "create";
49
+ case "modify":
50
+ return "modify";
51
+ case "remove":
52
+ return "delete";
53
+ default:
54
+ return "any";
55
+ }
56
+ }
57
+ function mapNativeWatchPath(path, roots) {
58
+ for (const root of roots) {
59
+ if (path === root.nativePath)
60
+ return root.exposedPath;
61
+ const prefix = root.nativePath.endsWith(sep) ? root.nativePath : `${root.nativePath}${sep}`;
62
+ if (path.startsWith(prefix)) {
63
+ const exposedPrefix = root.exposedPath.endsWith(sep)
64
+ ? root.exposedPath
65
+ : `${root.exposedPath}${sep}`;
66
+ return `${exposedPrefix}${path.slice(prefix.length)}`;
67
+ }
68
+ }
69
+ return path;
70
+ }
71
+ function createClosedWatcher() {
72
+ const doneResult = {
73
+ done: true,
74
+ value: undefined,
75
+ };
76
+ const iterator = {
77
+ next: () => Promise.resolve(doneResult),
78
+ return: () => Promise.resolve(doneResult),
79
+ };
80
+ const watcher = createFileWatcher(iterator, () => { });
81
+ watcher.ready = Promise.resolve();
82
+ watcher.done = Promise.resolve();
83
+ return watcher;
84
+ }
85
+ export class DenoFileSystemAdapter {
86
+ constructor(options = {}) {
87
+ const nodeCompatible = new NodeCompatibleFileSystemAdapter(undefined, options);
88
+ if (Object.hasOwn(nodeCompatible, "readFileSnapshotWithinLimit")) {
89
+ Object.defineProperty(this, "readFileSnapshotWithinLimit", {
90
+ value: nodeCompatible.readFileSnapshotWithinLimit,
91
+ enumerable: true,
92
+ });
93
+ }
94
+ const createRuntime = hasOwn(options, "denoCreateRuntime")
95
+ ? options.denoCreateRuntime
96
+ : getDenoCreateRuntime();
97
+ if (options.exclusiveCreate !== false && createRuntime) {
98
+ Object.defineProperty(this, "createFileBytesExclusive", {
99
+ value: (path, content) => createDenoFileBytesExclusive(createRuntime, path, content),
100
+ enumerable: true,
101
+ });
102
+ }
103
+ if (globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta) === DenoFileSystemAdapter) {
104
+ markNativeFileSystemAdapter(this);
105
+ }
106
+ }
107
+ async readFile(path) {
108
+ assertDenoRuntime("readFile");
109
+ return dntShim.Deno.readTextFile(path);
110
+ }
111
+ async readFileBytes(path) {
112
+ assertDenoRuntime("readFileBytes");
113
+ return dntShim.Deno.readFile(path);
114
+ }
115
+ async readFileBytesBounded(path, byteLimit) {
116
+ assertDenoRuntime("readFileBytesBounded");
117
+ return await readBoundedFilePrefix(async () => {
118
+ const file = await dntShim.Deno.open(path, { read: true });
119
+ return {
120
+ close: () => file.close(),
121
+ read: (buffer) => file.read(buffer),
122
+ };
123
+ }, byteLimit);
124
+ }
125
+ async readFileBytesWithinLimit(path, byteLimit) {
126
+ assertDenoRuntime("readFileBytesWithinLimit");
127
+ return await readFileWithinLimit(async () => {
128
+ const file = await dntShim.Deno.open(path, { read: true });
129
+ return {
130
+ close: () => file.close(),
131
+ read: (buffer) => file.read(buffer),
132
+ };
133
+ }, byteLimit);
134
+ }
135
+ async writeFile(path, content) {
136
+ assertDenoRuntime("writeFile");
137
+ await dntShim.Deno.writeTextFile(path, content);
138
+ }
139
+ async writeFileBytes(path, content) {
140
+ assertDenoRuntime("writeFileBytes");
141
+ await dntShim.Deno.writeFile(path, content);
142
+ }
143
+ async rename(from, to) {
144
+ assertDenoRuntime("rename");
145
+ await dntShim.Deno.rename(from, to);
146
+ }
147
+ async exists(path) {
148
+ assertDenoRuntime("exists");
149
+ try {
150
+ await dntShim.Deno.stat(path);
151
+ return true;
152
+ }
153
+ catch (error) {
154
+ if (error instanceof dntShim.Deno.errors.NotFound)
155
+ return false;
156
+ throw error;
157
+ }
158
+ }
159
+ async *readDir(path) {
160
+ assertDenoRuntime("readDir");
161
+ for await (const entry of dntShim.Deno.readDir(path)) {
162
+ yield {
163
+ name: entry.name,
164
+ isFile: entry.isFile,
165
+ isDirectory: entry.isDirectory,
166
+ isSymlink: entry.isSymlink,
167
+ };
168
+ }
169
+ }
170
+ async stat(path) {
171
+ assertDenoRuntime("stat");
172
+ return toFileInfo(await dntShim.Deno.stat(path));
173
+ }
174
+ async lstat(path) {
175
+ assertDenoRuntime("lstat");
176
+ return toFileInfo(await dntShim.Deno.lstat(path));
177
+ }
178
+ async realPath(path) {
179
+ assertDenoRuntime("realPath");
180
+ return await dntShim.Deno.realPath(path);
181
+ }
182
+ async mkdir(path, options) {
183
+ assertDenoRuntime("mkdir");
184
+ await dntShim.Deno.mkdir(path, options);
185
+ }
186
+ async remove(path, options) {
187
+ assertDenoRuntime("remove");
188
+ await dntShim.Deno.remove(path, options);
189
+ }
190
+ async makeTempDir(prefix) {
191
+ assertDenoRuntime("makeTempDir");
192
+ return dntShim.Deno.makeTempDir({ prefix: validateTempDirectoryPrefix(prefix) });
193
+ }
194
+ watch(paths, options) {
195
+ assertDenoRuntime("watch");
196
+ const signal = options?.signal;
197
+ if (signal?.aborted)
198
+ return createClosedWatcher();
199
+ const pathArray = Array.isArray(paths) ? paths : [paths];
200
+ const roots = pathArray
201
+ .map((path) => ({
202
+ nativePath: dntShim.Deno.realPathSync(path),
203
+ exposedPath: resolve(path),
204
+ }))
205
+ .sort((left, right) => right.nativePath.length - left.nativePath.length);
206
+ const nativeWatcher = dntShim.Deno.watchFs(pathArray, {
207
+ recursive: options?.recursive ?? true,
208
+ });
209
+ const nativeIterator = nativeWatcher[Symbol.asyncIterator]();
210
+ const doneResult = {
211
+ done: true,
212
+ value: undefined,
213
+ };
214
+ let closed = false;
215
+ let closeFailed = false;
216
+ let closeError;
217
+ let terminalFailed = false;
218
+ let terminalError;
219
+ let pendingNext;
220
+ let resolveClosed;
221
+ const closedSignal = new Promise((resolve) => {
222
+ resolveClosed = resolve;
223
+ });
224
+ const cleanup = () => {
225
+ if (closed)
226
+ return;
227
+ closed = true;
228
+ signal?.removeEventListener("abort", cleanup);
229
+ try {
230
+ nativeWatcher.close();
231
+ }
232
+ catch (error) {
233
+ closeFailed = true;
234
+ closeError = error;
235
+ }
236
+ resolveClosed();
237
+ };
238
+ const iterator = {
239
+ next() {
240
+ if (closed)
241
+ return Promise.resolve(doneResult);
242
+ if (pendingNext) {
243
+ return Promise.reject(new TypeError("FileWatcher does not support concurrent next() calls"));
244
+ }
245
+ const operation = nativeIterator.next().then((result) => {
246
+ if (result.done || closed) {
247
+ cleanup();
248
+ return doneResult;
249
+ }
250
+ return {
251
+ done: false,
252
+ value: {
253
+ kind: toFileChangeKind(result.value.kind),
254
+ paths: result.value.paths.map((path) => mapNativeWatchPath(path, roots)),
255
+ },
256
+ };
257
+ }, (error) => {
258
+ if (closed)
259
+ return doneResult;
260
+ terminalFailed = true;
261
+ terminalError = error;
262
+ cleanup();
263
+ throw error;
264
+ });
265
+ const tracked = operation.finally(() => {
266
+ if (pendingNext === tracked)
267
+ pendingNext = undefined;
268
+ });
269
+ pendingNext = tracked;
270
+ return tracked;
271
+ },
272
+ return() {
273
+ cleanup();
274
+ return Promise.resolve(doneResult);
275
+ },
276
+ };
277
+ signal?.addEventListener("abort", cleanup, { once: true });
278
+ const watcher = createFileWatcher(iterator, cleanup);
279
+ watcher.ready = Promise.resolve();
280
+ watcher.done = closedSignal.then(async () => {
281
+ const operation = pendingNext;
282
+ if (operation)
283
+ await operation.catch(() => undefined);
284
+ if (terminalFailed)
285
+ throw terminalError;
286
+ if (closeFailed)
287
+ throw closeError;
288
+ });
289
+ return watcher;
290
+ }
291
+ }
@@ -0,0 +1,71 @@
1
+ import type { DirEntry, FileInfo, FileSystemAdapter, FileWatcher, WatchOptions } from "../../base.js";
2
+ import { setupNodeFsWatcher } from "./shared-watcher.js";
3
+ export interface NodeFileSystemLogger {
4
+ error(message: string, context?: Record<string, unknown>): void;
5
+ debug(message: string, context?: Record<string, unknown>): void;
6
+ }
7
+ interface NodeFileSnapshotStat {
8
+ readonly dev: bigint;
9
+ readonly ino: bigint;
10
+ readonly size: bigint;
11
+ readonly mtimeNs: bigint;
12
+ readonly ctimeNs: bigint;
13
+ isFile(): boolean;
14
+ isSymbolicLink(): boolean;
15
+ }
16
+ interface NodeFileHandle {
17
+ stat(): Promise<NodeFileSnapshotStat>;
18
+ read(buffer: Uint8Array, offset: number, length: number, position: number): Promise<{
19
+ bytesRead: number;
20
+ }>;
21
+ writeFile(content: Uint8Array): Promise<void>;
22
+ close(): Promise<void>;
23
+ }
24
+ export interface NodeFileSystemOperations {
25
+ realpath(path: string): Promise<string>;
26
+ lstat(path: string): Promise<NodeFileSnapshotStat>;
27
+ open(path: string, flags: number | string): Promise<NodeFileHandle>;
28
+ }
29
+ export interface NodeFileSystemCapabilityOptions {
30
+ /** Test seam for runtime constants. An own undefined value means unavailable. */
31
+ readonly noFollow?: number;
32
+ /** Test seam for create-new primitive availability. */
33
+ readonly exclusiveCreate?: boolean;
34
+ /** Test seam for deterministic filesystem races and write failures. */
35
+ readonly operations?: Partial<NodeFileSystemOperations>;
36
+ }
37
+ /**
38
+ * Filesystem implementation shared by runtimes that provide Node-compatible
39
+ * `node:fs` APIs (currently Node.js and Bun).
40
+ */
41
+ export declare class NodeCompatibleFileSystemAdapter implements FileSystemAdapter {
42
+ private readonly logger;
43
+ constructor(logger?: NodeFileSystemLogger, options?: NodeFileSystemCapabilityOptions);
44
+ readFile(path: string): Promise<string>;
45
+ readFileBytes(path: string): Promise<Uint8Array>;
46
+ readFileBytesBounded(path: string, byteLimit: number): Promise<Uint8Array>;
47
+ readFileBytesWithinLimit(path: string, byteLimit: number): Promise<Uint8Array>;
48
+ writeFile(path: string, content: string): Promise<void>;
49
+ writeFileBytes(path: string, content: Uint8Array): Promise<void>;
50
+ rename(from: string, to: string): Promise<void>;
51
+ exists(path: string): Promise<boolean>;
52
+ readDir(path: string): AsyncIterable<DirEntry>;
53
+ stat(path: string): Promise<FileInfo>;
54
+ lstat(path: string): Promise<FileInfo>;
55
+ realPath(path: string): Promise<string>;
56
+ mkdir(path: string, options?: {
57
+ recursive?: boolean;
58
+ }): Promise<void>;
59
+ remove(path: string, options?: {
60
+ recursive?: boolean;
61
+ }): Promise<void>;
62
+ makeTempDir(prefix: string): Promise<string>;
63
+ protected setupWatcher(path: string, options: Parameters<typeof setupNodeFsWatcher>[1]): Promise<void>;
64
+ watch(paths: string | string[], options?: WatchOptions): FileWatcher;
65
+ }
66
+ export interface NodeCompatibleFileSystemAdapter {
67
+ readFileSnapshotWithinLimit?(path: string, containmentRoot: string, byteLimit: number): Promise<Uint8Array>;
68
+ createFileBytesExclusive?(path: string, content: Uint8Array): Promise<void>;
69
+ }
70
+ export {};
71
+ //# sourceMappingURL=node-filesystem-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-filesystem-adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/shared/node-filesystem-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EAER,QAAQ,EACR,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAA4C,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAcnG,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAChE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CACjE;AAUD,UAAU,oBAAoB;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,MAAM,IAAI,OAAO,CAAC;IAClB,cAAc,IAAI,OAAO,CAAC;CAC3B;AAED,UAAU,cAAc;IACtB,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACtC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