elit 3.6.6 → 3.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/dist/build.cjs +421 -331
- package/dist/build.d.ts +1 -19
- package/dist/build.js +420 -330
- package/dist/build.mjs +420 -330
- package/dist/chokidar.cjs +219 -182
- package/dist/chokidar.d.ts +25 -10
- package/dist/chokidar.js +217 -182
- package/dist/chokidar.mjs +218 -183
- package/dist/cli.cjs +22439 -21563
- package/dist/cli.d.ts +19 -37
- package/dist/cli.mjs +24113 -23252
- package/dist/config.cjs +357 -350
- package/dist/config.d.ts +17 -245
- package/dist/config.js +520 -515
- package/dist/config.mjs +346 -341
- package/dist/contracts-BeW9k0yZ.d.ts +54 -0
- package/dist/contracts-D7KIS-TK.d.ts +36 -0
- package/dist/coverage.cjs +448 -485
- package/dist/coverage.d.ts +13 -62
- package/dist/coverage.js +447 -484
- package/dist/coverage.mjs +447 -484
- package/dist/database.cjs +819 -828
- package/dist/database.d.ts +8 -24
- package/dist/database.js +818 -829
- package/dist/database.mjs +818 -829
- package/dist/desktop-auto-render.cjs +1700 -1523
- package/dist/desktop-auto-render.d.ts +4 -12
- package/dist/desktop-auto-render.js +1695 -1518
- package/dist/desktop-auto-render.mjs +1696 -1519
- package/dist/desktop.cjs +3 -1
- package/dist/desktop.d.ts +4 -1
- package/dist/desktop.js +1 -1
- package/dist/desktop.mjs +1 -1
- package/dist/dev-build.cjs +830 -0
- package/dist/dev-build.d.ts +53 -0
- package/dist/dev-build.js +3318 -0
- package/dist/dev-build.mjs +797 -0
- package/dist/dom.cjs +717 -591
- package/dist/dom.d.ts +2 -17
- package/dist/dom.js +714 -588
- package/dist/dom.mjs +716 -590
- package/dist/el.cjs +62 -52
- package/dist/el.d.ts +5 -12
- package/dist/el.js +60 -52
- package/dist/el.mjs +60 -52
- package/dist/fs.cjs +72 -63
- package/dist/fs.d.ts +22 -19
- package/dist/fs.js +71 -62
- package/dist/fs.mjs +71 -62
- package/dist/hmr.cjs +40 -14
- package/dist/hmr.d.ts +11 -23
- package/dist/hmr.js +38 -14
- package/dist/hmr.mjs +38 -14
- package/dist/http.cjs +251 -99
- package/dist/http.d.ts +38 -104
- package/dist/http.js +249 -99
- package/dist/http.mjs +249 -99
- package/dist/https.cjs +524 -228
- package/dist/https.d.ts +44 -36
- package/dist/https.js +520 -226
- package/dist/https.mjs +522 -228
- package/dist/index.cjs +7502 -7691
- package/dist/index.d.ts +6 -3
- package/dist/index.js +7486 -7677
- package/dist/index.mjs +7497 -7687
- package/dist/mime-types.cjs +10 -4
- package/dist/mime-types.d.ts +8 -11
- package/dist/mime-types.js +9 -3
- package/dist/mime-types.mjs +9 -3
- package/dist/native.cjs +8616 -8870
- package/dist/native.d.ts +7 -10
- package/dist/native.js +8682 -8936
- package/dist/native.mjs +8615 -8869
- package/dist/path.cjs +83 -77
- package/dist/path.d.ts +29 -29
- package/dist/path.js +82 -76
- package/dist/path.mjs +82 -76
- package/dist/pm.cjs +3300 -0
- package/dist/pm.d.ts +256 -0
- package/dist/pm.js +5638 -0
- package/dist/pm.mjs +3196 -0
- package/dist/preview-build.cjs +712 -0
- package/dist/preview-build.d.ts +59 -0
- package/dist/preview-build.js +3194 -0
- package/dist/preview-build.mjs +676 -0
- package/dist/render-context.cjs +13 -2
- package/dist/render-context.d.ts +9 -34
- package/dist/render-context.js +11 -2
- package/dist/render-context.mjs +11 -2
- package/dist/router.cjs +787 -646
- package/dist/router.d.ts +8 -14
- package/dist/router.js +786 -645
- package/dist/router.mjs +786 -645
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/server.cjs +3254 -2684
- package/dist/server.d.ts +47 -5
- package/dist/server.js +3427 -2859
- package/dist/server.mjs +3397 -2829
- package/dist/smtp-server.cjs +16 -3
- package/dist/smtp-server.d.ts +12 -26
- package/dist/smtp-server.js +18 -5
- package/dist/smtp-server.mjs +16 -3
- package/dist/state-DvEkDehk.d.ts +195 -0
- package/dist/state.cjs +768 -659
- package/dist/state.d.ts +11 -71
- package/dist/state.js +760 -651
- package/dist/state.mjs +767 -658
- package/dist/style.cjs +1011 -968
- package/dist/style.d.ts +13 -127
- package/dist/style.js +1009 -970
- package/dist/style.mjs +1011 -971
- package/dist/test-reporter.cjs +332 -316
- package/dist/test-reporter.d.ts +28 -33
- package/dist/test-reporter.js +328 -312
- package/dist/test-reporter.mjs +328 -312
- package/dist/test-runtime.cjs +927 -968
- package/dist/test-runtime.d.ts +24 -99
- package/dist/test-runtime.js +922 -965
- package/dist/test-runtime.mjs +922 -965
- package/dist/test.cjs +4428 -4273
- package/dist/test.d.ts +2 -8
- package/dist/test.js +4307 -4154
- package/dist/test.mjs +4419 -4267
- package/dist/types-BONVzPtp.d.ts +59 -0
- package/dist/types-BR4wMiVx.d.ts +32 -0
- package/dist/types-C4gKykuG.d.ts +23 -0
- package/dist/types-CIhpN1-K.d.ts +64 -0
- package/dist/types-Ckj8md_j.d.ts +84 -0
- package/dist/types-CpjQTAkX.d.ts +24 -0
- package/dist/types-D0LjrYjS.d.ts +14 -0
- package/dist/types-DAisuVr5.d.ts +75 -0
- package/dist/types-tJn88E1N.d.ts +242 -0
- package/dist/types.d.ts +50 -237
- package/dist/universal.cjs +1 -1
- package/dist/universal.d.ts +1 -7
- package/dist/universal.js +1 -1
- package/dist/universal.mjs +1 -1
- package/dist/websocket-XfyK23zD.d.ts +119 -0
- package/dist/ws.cjs +129 -108
- package/dist/ws.d.ts +21 -131
- package/dist/ws.js +128 -109
- package/dist/ws.mjs +128 -109
- package/dist/wss.cjs +757 -479
- package/dist/wss.d.ts +31 -28
- package/dist/wss.js +755 -479
- package/dist/wss.mjs +758 -482
- package/package.json +8 -1
- package/vendor/epaint-0.31.1/src/image.rs +418 -0
- package/dist/server-uMQvZAll.d.ts +0 -458
package/dist/fs.cjs
CHANGED
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/fs.ts
|
|
20
|
+
// src/server/fs/index.ts
|
|
21
21
|
var fs_exports = {};
|
|
22
22
|
__export(fs_exports, {
|
|
23
23
|
appendFile: () => appendFile,
|
|
@@ -50,7 +50,7 @@ __export(fs_exports, {
|
|
|
50
50
|
});
|
|
51
51
|
module.exports = __toCommonJS(fs_exports);
|
|
52
52
|
|
|
53
|
-
// src/runtime.ts
|
|
53
|
+
// src/shares/runtime.ts
|
|
54
54
|
var runtime = (() => {
|
|
55
55
|
if (typeof Deno !== "undefined") return "deno";
|
|
56
56
|
if (typeof Bun !== "undefined") return "bun";
|
|
@@ -60,7 +60,15 @@ var isNode = runtime === "node";
|
|
|
60
60
|
var isBun = runtime === "bun";
|
|
61
61
|
var isDeno = runtime === "deno";
|
|
62
62
|
|
|
63
|
-
// src/fs.ts
|
|
63
|
+
// src/server/fs/node-modules.ts
|
|
64
|
+
var fs;
|
|
65
|
+
var fsPromises;
|
|
66
|
+
if (isNode || isBun) {
|
|
67
|
+
fs = require("fs");
|
|
68
|
+
fsPromises = require("fs/promises");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/server/fs/utils.ts
|
|
64
72
|
function parseOptions(options, defaultValue) {
|
|
65
73
|
return typeof options === "string" ? { encoding: options } : options || defaultValue;
|
|
66
74
|
}
|
|
@@ -79,6 +87,18 @@ function dataToUint8Array(data) {
|
|
|
79
87
|
}
|
|
80
88
|
return data;
|
|
81
89
|
}
|
|
90
|
+
function createDirentFromDenoEntry(entry) {
|
|
91
|
+
return {
|
|
92
|
+
name: entry.name,
|
|
93
|
+
isFile: () => entry.isFile,
|
|
94
|
+
isDirectory: () => entry.isDirectory,
|
|
95
|
+
isBlockDevice: () => false,
|
|
96
|
+
isCharacterDevice: () => false,
|
|
97
|
+
isSymbolicLink: () => entry.isSymlink || false,
|
|
98
|
+
isFIFO: () => false,
|
|
99
|
+
isSocket: () => false
|
|
100
|
+
};
|
|
101
|
+
}
|
|
82
102
|
function processDenoEntries(iterator, withFileTypes) {
|
|
83
103
|
const entries = [];
|
|
84
104
|
for (const entry of iterator) {
|
|
@@ -101,12 +121,37 @@ async function processDenoEntriesAsync(iterator, withFileTypes) {
|
|
|
101
121
|
}
|
|
102
122
|
return entries;
|
|
103
123
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
function createStatsFromDenoFileInfo(info) {
|
|
125
|
+
return {
|
|
126
|
+
isFile: () => info.isFile,
|
|
127
|
+
isDirectory: () => info.isDirectory,
|
|
128
|
+
isBlockDevice: () => false,
|
|
129
|
+
isCharacterDevice: () => false,
|
|
130
|
+
isSymbolicLink: () => info.isSymlink || false,
|
|
131
|
+
isFIFO: () => false,
|
|
132
|
+
isSocket: () => false,
|
|
133
|
+
dev: info.dev || 0,
|
|
134
|
+
ino: info.ino || 0,
|
|
135
|
+
mode: info.mode || 0,
|
|
136
|
+
nlink: info.nlink || 1,
|
|
137
|
+
uid: info.uid || 0,
|
|
138
|
+
gid: info.gid || 0,
|
|
139
|
+
rdev: 0,
|
|
140
|
+
size: info.size,
|
|
141
|
+
blksize: info.blksize || 4096,
|
|
142
|
+
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
143
|
+
atimeMs: info.atime?.getTime() || Date.now(),
|
|
144
|
+
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
145
|
+
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
146
|
+
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
147
|
+
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
148
|
+
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
149
|
+
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
150
|
+
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
151
|
+
};
|
|
109
152
|
}
|
|
153
|
+
|
|
154
|
+
// src/server/fs/file-ops.ts
|
|
110
155
|
async function readFile(path, options) {
|
|
111
156
|
const opts = parseOptions(options, {});
|
|
112
157
|
if (isNode || isBun) {
|
|
@@ -147,28 +192,27 @@ async function appendFile(path, data, options) {
|
|
|
147
192
|
const opts = parseOptions(options, {});
|
|
148
193
|
if (isNode) {
|
|
149
194
|
return fsPromises.appendFile(path, data, opts);
|
|
195
|
+
}
|
|
196
|
+
if (await exists(path)) {
|
|
197
|
+
const existing = await readFile(path);
|
|
198
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
199
|
+
await writeFile(path, combined, opts);
|
|
150
200
|
} else {
|
|
151
|
-
|
|
152
|
-
const existing = await readFile(path);
|
|
153
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
154
|
-
await writeFile(path, combined, opts);
|
|
155
|
-
} else {
|
|
156
|
-
await writeFile(path, data, opts);
|
|
157
|
-
}
|
|
201
|
+
await writeFile(path, data, opts);
|
|
158
202
|
}
|
|
159
203
|
}
|
|
160
204
|
function appendFileSync(path, data, options) {
|
|
161
205
|
const opts = parseOptions(options, {});
|
|
162
206
|
if (isNode) {
|
|
163
207
|
fs.appendFileSync(path, data, opts);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (existsSync(path)) {
|
|
211
|
+
const existing = readFileSync(path);
|
|
212
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
213
|
+
writeFileSync(path, combined, opts);
|
|
164
214
|
} else {
|
|
165
|
-
|
|
166
|
-
const existing = readFileSync(path);
|
|
167
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
168
|
-
writeFileSync(path, combined, opts);
|
|
169
|
-
} else {
|
|
170
|
-
writeFileSync(path, data, opts);
|
|
171
|
-
}
|
|
215
|
+
writeFileSync(path, data, opts);
|
|
172
216
|
}
|
|
173
217
|
}
|
|
174
218
|
async function exists(path) {
|
|
@@ -205,6 +249,8 @@ function statSync(path) {
|
|
|
205
249
|
}
|
|
206
250
|
throw new Error("Unsupported runtime");
|
|
207
251
|
}
|
|
252
|
+
|
|
253
|
+
// src/server/fs/directory-ops.ts
|
|
208
254
|
async function mkdir(path, options) {
|
|
209
255
|
const opts = typeof options === "number" ? { mode: options } : options || {};
|
|
210
256
|
if (isNode || isBun) {
|
|
@@ -267,6 +313,8 @@ function rmdirSync(path, options) {
|
|
|
267
313
|
Deno.removeSync(path, { recursive: options?.recursive });
|
|
268
314
|
}
|
|
269
315
|
}
|
|
316
|
+
|
|
317
|
+
// src/server/fs/path-ops.ts
|
|
270
318
|
async function rename(oldPath, newPath) {
|
|
271
319
|
if (isNode || isBun) {
|
|
272
320
|
return fsPromises.rename(oldPath, newPath);
|
|
@@ -311,47 +359,8 @@ function realpathSync(path, options) {
|
|
|
311
359
|
}
|
|
312
360
|
return path;
|
|
313
361
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
isFile: () => info.isFile,
|
|
317
|
-
isDirectory: () => info.isDirectory,
|
|
318
|
-
isBlockDevice: () => false,
|
|
319
|
-
isCharacterDevice: () => false,
|
|
320
|
-
isSymbolicLink: () => info.isSymlink || false,
|
|
321
|
-
isFIFO: () => false,
|
|
322
|
-
isSocket: () => false,
|
|
323
|
-
dev: info.dev || 0,
|
|
324
|
-
ino: info.ino || 0,
|
|
325
|
-
mode: info.mode || 0,
|
|
326
|
-
nlink: info.nlink || 1,
|
|
327
|
-
uid: info.uid || 0,
|
|
328
|
-
gid: info.gid || 0,
|
|
329
|
-
rdev: 0,
|
|
330
|
-
size: info.size,
|
|
331
|
-
blksize: info.blksize || 4096,
|
|
332
|
-
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
333
|
-
atimeMs: info.atime?.getTime() || Date.now(),
|
|
334
|
-
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
335
|
-
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
336
|
-
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
337
|
-
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
338
|
-
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
339
|
-
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
340
|
-
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
function createDirentFromDenoEntry(entry) {
|
|
344
|
-
return {
|
|
345
|
-
name: entry.name,
|
|
346
|
-
isFile: () => entry.isFile,
|
|
347
|
-
isDirectory: () => entry.isDirectory,
|
|
348
|
-
isBlockDevice: () => false,
|
|
349
|
-
isCharacterDevice: () => false,
|
|
350
|
-
isSymbolicLink: () => entry.isSymlink || false,
|
|
351
|
-
isFIFO: () => false,
|
|
352
|
-
isSocket: () => false
|
|
353
|
-
};
|
|
354
|
-
}
|
|
362
|
+
|
|
363
|
+
// src/server/fs/index.ts
|
|
355
364
|
function getRuntime() {
|
|
356
365
|
return runtime;
|
|
357
366
|
}
|
package/dist/fs.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File System module with unified API across runtimes
|
|
3
|
-
* Compatible with Node.js 'fs' module API
|
|
4
|
-
* - Node.js: uses 'fs' module
|
|
5
|
-
* - Bun: uses Bun.file() and native APIs
|
|
6
|
-
* - Deno: uses Deno.readFile(), etc.
|
|
7
|
-
*/
|
|
8
1
|
/**
|
|
9
2
|
* File encoding types
|
|
10
3
|
*/
|
|
@@ -84,6 +77,7 @@ interface Dirent {
|
|
|
84
77
|
isFIFO(): boolean;
|
|
85
78
|
isSocket(): boolean;
|
|
86
79
|
}
|
|
80
|
+
|
|
87
81
|
/**
|
|
88
82
|
* Read file (async)
|
|
89
83
|
*/
|
|
@@ -124,6 +118,10 @@ declare function stat(path: string): Promise<Stats>;
|
|
|
124
118
|
* Get file stats (sync)
|
|
125
119
|
*/
|
|
126
120
|
declare function statSync(path: string): Stats;
|
|
121
|
+
|
|
122
|
+
type RemoveDirectoryOptions = {
|
|
123
|
+
recursive?: boolean;
|
|
124
|
+
};
|
|
127
125
|
/**
|
|
128
126
|
* Create directory (async)
|
|
129
127
|
*/
|
|
@@ -151,15 +149,15 @@ declare function unlinkSync(path: string): void;
|
|
|
151
149
|
/**
|
|
152
150
|
* Remove directory (async)
|
|
153
151
|
*/
|
|
154
|
-
declare function rmdir(path: string, options?:
|
|
155
|
-
recursive?: boolean;
|
|
156
|
-
}): Promise<void>;
|
|
152
|
+
declare function rmdir(path: string, options?: RemoveDirectoryOptions): Promise<void>;
|
|
157
153
|
/**
|
|
158
154
|
* Remove directory (sync)
|
|
159
155
|
*/
|
|
160
|
-
declare function rmdirSync(path: string, options?:
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
declare function rmdirSync(path: string, options?: RemoveDirectoryOptions): void;
|
|
157
|
+
|
|
158
|
+
type RealpathOptions = {
|
|
159
|
+
encoding?: BufferEncoding;
|
|
160
|
+
};
|
|
163
161
|
/**
|
|
164
162
|
* Rename/move file (async)
|
|
165
163
|
*/
|
|
@@ -179,15 +177,20 @@ declare function copyFileSync(src: string, dest: string, flags?: number): void;
|
|
|
179
177
|
/**
|
|
180
178
|
* Resolve pathname to absolute path (async)
|
|
181
179
|
*/
|
|
182
|
-
declare function realpath(path: string, options?:
|
|
183
|
-
encoding?: BufferEncoding;
|
|
184
|
-
}): Promise<string>;
|
|
180
|
+
declare function realpath(path: string, options?: RealpathOptions): Promise<string>;
|
|
185
181
|
/**
|
|
186
182
|
* Resolve pathname to absolute path (sync)
|
|
187
183
|
*/
|
|
188
|
-
declare function realpathSync(path: string, options?:
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
declare function realpathSync(path: string, options?: RealpathOptions): string;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* File System module with unified API across runtimes
|
|
188
|
+
* Compatible with Node.js 'fs' module API
|
|
189
|
+
* - Node.js: uses 'fs' module
|
|
190
|
+
* - Bun: uses Bun.file() and native APIs
|
|
191
|
+
* - Deno: uses Deno.readFile(), etc.
|
|
192
|
+
*/
|
|
193
|
+
|
|
191
194
|
/**
|
|
192
195
|
* Get current runtime
|
|
193
196
|
*/
|
package/dist/fs.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
8
8
|
});
|
|
9
9
|
|
|
10
|
-
// src/runtime.ts
|
|
10
|
+
// src/shares/runtime.ts
|
|
11
11
|
var runtime = (() => {
|
|
12
12
|
if (typeof Deno !== "undefined") return "deno";
|
|
13
13
|
if (typeof Bun !== "undefined") return "bun";
|
|
@@ -17,7 +17,15 @@
|
|
|
17
17
|
var isBun = runtime === "bun";
|
|
18
18
|
var isDeno = runtime === "deno";
|
|
19
19
|
|
|
20
|
-
// src/fs.ts
|
|
20
|
+
// src/server/fs/node-modules.ts
|
|
21
|
+
var fs;
|
|
22
|
+
var fsPromises;
|
|
23
|
+
if (isNode || isBun) {
|
|
24
|
+
fs = __require("fs");
|
|
25
|
+
fsPromises = __require("fs/promises");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/server/fs/utils.ts
|
|
21
29
|
function parseOptions(options, defaultValue) {
|
|
22
30
|
return typeof options === "string" ? { encoding: options } : options || defaultValue;
|
|
23
31
|
}
|
|
@@ -36,6 +44,18 @@
|
|
|
36
44
|
}
|
|
37
45
|
return data;
|
|
38
46
|
}
|
|
47
|
+
function createDirentFromDenoEntry(entry) {
|
|
48
|
+
return {
|
|
49
|
+
name: entry.name,
|
|
50
|
+
isFile: () => entry.isFile,
|
|
51
|
+
isDirectory: () => entry.isDirectory,
|
|
52
|
+
isBlockDevice: () => false,
|
|
53
|
+
isCharacterDevice: () => false,
|
|
54
|
+
isSymbolicLink: () => entry.isSymlink || false,
|
|
55
|
+
isFIFO: () => false,
|
|
56
|
+
isSocket: () => false
|
|
57
|
+
};
|
|
58
|
+
}
|
|
39
59
|
function processDenoEntries(iterator, withFileTypes) {
|
|
40
60
|
const entries = [];
|
|
41
61
|
for (const entry of iterator) {
|
|
@@ -58,12 +78,37 @@
|
|
|
58
78
|
}
|
|
59
79
|
return entries;
|
|
60
80
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
function createStatsFromDenoFileInfo(info) {
|
|
82
|
+
return {
|
|
83
|
+
isFile: () => info.isFile,
|
|
84
|
+
isDirectory: () => info.isDirectory,
|
|
85
|
+
isBlockDevice: () => false,
|
|
86
|
+
isCharacterDevice: () => false,
|
|
87
|
+
isSymbolicLink: () => info.isSymlink || false,
|
|
88
|
+
isFIFO: () => false,
|
|
89
|
+
isSocket: () => false,
|
|
90
|
+
dev: info.dev || 0,
|
|
91
|
+
ino: info.ino || 0,
|
|
92
|
+
mode: info.mode || 0,
|
|
93
|
+
nlink: info.nlink || 1,
|
|
94
|
+
uid: info.uid || 0,
|
|
95
|
+
gid: info.gid || 0,
|
|
96
|
+
rdev: 0,
|
|
97
|
+
size: info.size,
|
|
98
|
+
blksize: info.blksize || 4096,
|
|
99
|
+
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
100
|
+
atimeMs: info.atime?.getTime() || Date.now(),
|
|
101
|
+
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
102
|
+
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
103
|
+
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
104
|
+
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
105
|
+
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
106
|
+
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
107
|
+
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
108
|
+
};
|
|
66
109
|
}
|
|
110
|
+
|
|
111
|
+
// src/server/fs/file-ops.ts
|
|
67
112
|
async function readFile(path, options) {
|
|
68
113
|
const opts = parseOptions(options, {});
|
|
69
114
|
if (isNode || isBun) {
|
|
@@ -104,28 +149,27 @@
|
|
|
104
149
|
const opts = parseOptions(options, {});
|
|
105
150
|
if (isNode) {
|
|
106
151
|
return fsPromises.appendFile(path, data, opts);
|
|
152
|
+
}
|
|
153
|
+
if (await exists(path)) {
|
|
154
|
+
const existing = await readFile(path);
|
|
155
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
156
|
+
await writeFile(path, combined, opts);
|
|
107
157
|
} else {
|
|
108
|
-
|
|
109
|
-
const existing = await readFile(path);
|
|
110
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
111
|
-
await writeFile(path, combined, opts);
|
|
112
|
-
} else {
|
|
113
|
-
await writeFile(path, data, opts);
|
|
114
|
-
}
|
|
158
|
+
await writeFile(path, data, opts);
|
|
115
159
|
}
|
|
116
160
|
}
|
|
117
161
|
function appendFileSync(path, data, options) {
|
|
118
162
|
const opts = parseOptions(options, {});
|
|
119
163
|
if (isNode) {
|
|
120
164
|
fs.appendFileSync(path, data, opts);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (existsSync(path)) {
|
|
168
|
+
const existing = readFileSync(path);
|
|
169
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
170
|
+
writeFileSync(path, combined, opts);
|
|
121
171
|
} else {
|
|
122
|
-
|
|
123
|
-
const existing = readFileSync(path);
|
|
124
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
125
|
-
writeFileSync(path, combined, opts);
|
|
126
|
-
} else {
|
|
127
|
-
writeFileSync(path, data, opts);
|
|
128
|
-
}
|
|
172
|
+
writeFileSync(path, data, opts);
|
|
129
173
|
}
|
|
130
174
|
}
|
|
131
175
|
async function exists(path) {
|
|
@@ -162,6 +206,8 @@
|
|
|
162
206
|
}
|
|
163
207
|
throw new Error("Unsupported runtime");
|
|
164
208
|
}
|
|
209
|
+
|
|
210
|
+
// src/server/fs/directory-ops.ts
|
|
165
211
|
async function mkdir(path, options) {
|
|
166
212
|
const opts = typeof options === "number" ? { mode: options } : options || {};
|
|
167
213
|
if (isNode || isBun) {
|
|
@@ -224,6 +270,8 @@
|
|
|
224
270
|
Deno.removeSync(path, { recursive: options?.recursive });
|
|
225
271
|
}
|
|
226
272
|
}
|
|
273
|
+
|
|
274
|
+
// src/server/fs/path-ops.ts
|
|
227
275
|
async function rename(oldPath, newPath) {
|
|
228
276
|
if (isNode || isBun) {
|
|
229
277
|
return fsPromises.rename(oldPath, newPath);
|
|
@@ -268,47 +316,8 @@
|
|
|
268
316
|
}
|
|
269
317
|
return path;
|
|
270
318
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
isFile: () => info.isFile,
|
|
274
|
-
isDirectory: () => info.isDirectory,
|
|
275
|
-
isBlockDevice: () => false,
|
|
276
|
-
isCharacterDevice: () => false,
|
|
277
|
-
isSymbolicLink: () => info.isSymlink || false,
|
|
278
|
-
isFIFO: () => false,
|
|
279
|
-
isSocket: () => false,
|
|
280
|
-
dev: info.dev || 0,
|
|
281
|
-
ino: info.ino || 0,
|
|
282
|
-
mode: info.mode || 0,
|
|
283
|
-
nlink: info.nlink || 1,
|
|
284
|
-
uid: info.uid || 0,
|
|
285
|
-
gid: info.gid || 0,
|
|
286
|
-
rdev: 0,
|
|
287
|
-
size: info.size,
|
|
288
|
-
blksize: info.blksize || 4096,
|
|
289
|
-
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
290
|
-
atimeMs: info.atime?.getTime() || Date.now(),
|
|
291
|
-
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
292
|
-
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
293
|
-
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
294
|
-
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
295
|
-
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
296
|
-
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
297
|
-
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
function createDirentFromDenoEntry(entry) {
|
|
301
|
-
return {
|
|
302
|
-
name: entry.name,
|
|
303
|
-
isFile: () => entry.isFile,
|
|
304
|
-
isDirectory: () => entry.isDirectory,
|
|
305
|
-
isBlockDevice: () => false,
|
|
306
|
-
isCharacterDevice: () => false,
|
|
307
|
-
isSymbolicLink: () => entry.isSymlink || false,
|
|
308
|
-
isFIFO: () => false,
|
|
309
|
-
isSocket: () => false
|
|
310
|
-
};
|
|
311
|
-
}
|
|
319
|
+
|
|
320
|
+
// src/server/fs/index.ts
|
|
312
321
|
function getRuntime() {
|
|
313
322
|
return runtime;
|
|
314
323
|
}
|
package/dist/fs.mjs
CHANGED
|
@@ -6,7 +6,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
-
// src/runtime.ts
|
|
9
|
+
// src/shares/runtime.ts
|
|
10
10
|
var runtime = (() => {
|
|
11
11
|
if (typeof Deno !== "undefined") return "deno";
|
|
12
12
|
if (typeof Bun !== "undefined") return "bun";
|
|
@@ -16,7 +16,15 @@ var isNode = runtime === "node";
|
|
|
16
16
|
var isBun = runtime === "bun";
|
|
17
17
|
var isDeno = runtime === "deno";
|
|
18
18
|
|
|
19
|
-
// src/fs.ts
|
|
19
|
+
// src/server/fs/node-modules.ts
|
|
20
|
+
var fs;
|
|
21
|
+
var fsPromises;
|
|
22
|
+
if (isNode || isBun) {
|
|
23
|
+
fs = __require("fs");
|
|
24
|
+
fsPromises = __require("fs/promises");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/server/fs/utils.ts
|
|
20
28
|
function parseOptions(options, defaultValue) {
|
|
21
29
|
return typeof options === "string" ? { encoding: options } : options || defaultValue;
|
|
22
30
|
}
|
|
@@ -35,6 +43,18 @@ function dataToUint8Array(data) {
|
|
|
35
43
|
}
|
|
36
44
|
return data;
|
|
37
45
|
}
|
|
46
|
+
function createDirentFromDenoEntry(entry) {
|
|
47
|
+
return {
|
|
48
|
+
name: entry.name,
|
|
49
|
+
isFile: () => entry.isFile,
|
|
50
|
+
isDirectory: () => entry.isDirectory,
|
|
51
|
+
isBlockDevice: () => false,
|
|
52
|
+
isCharacterDevice: () => false,
|
|
53
|
+
isSymbolicLink: () => entry.isSymlink || false,
|
|
54
|
+
isFIFO: () => false,
|
|
55
|
+
isSocket: () => false
|
|
56
|
+
};
|
|
57
|
+
}
|
|
38
58
|
function processDenoEntries(iterator, withFileTypes) {
|
|
39
59
|
const entries = [];
|
|
40
60
|
for (const entry of iterator) {
|
|
@@ -57,12 +77,37 @@ async function processDenoEntriesAsync(iterator, withFileTypes) {
|
|
|
57
77
|
}
|
|
58
78
|
return entries;
|
|
59
79
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
80
|
+
function createStatsFromDenoFileInfo(info) {
|
|
81
|
+
return {
|
|
82
|
+
isFile: () => info.isFile,
|
|
83
|
+
isDirectory: () => info.isDirectory,
|
|
84
|
+
isBlockDevice: () => false,
|
|
85
|
+
isCharacterDevice: () => false,
|
|
86
|
+
isSymbolicLink: () => info.isSymlink || false,
|
|
87
|
+
isFIFO: () => false,
|
|
88
|
+
isSocket: () => false,
|
|
89
|
+
dev: info.dev || 0,
|
|
90
|
+
ino: info.ino || 0,
|
|
91
|
+
mode: info.mode || 0,
|
|
92
|
+
nlink: info.nlink || 1,
|
|
93
|
+
uid: info.uid || 0,
|
|
94
|
+
gid: info.gid || 0,
|
|
95
|
+
rdev: 0,
|
|
96
|
+
size: info.size,
|
|
97
|
+
blksize: info.blksize || 4096,
|
|
98
|
+
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
99
|
+
atimeMs: info.atime?.getTime() || Date.now(),
|
|
100
|
+
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
101
|
+
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
102
|
+
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
103
|
+
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
104
|
+
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
105
|
+
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
106
|
+
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
107
|
+
};
|
|
65
108
|
}
|
|
109
|
+
|
|
110
|
+
// src/server/fs/file-ops.ts
|
|
66
111
|
async function readFile(path, options) {
|
|
67
112
|
const opts = parseOptions(options, {});
|
|
68
113
|
if (isNode || isBun) {
|
|
@@ -103,28 +148,27 @@ async function appendFile(path, data, options) {
|
|
|
103
148
|
const opts = parseOptions(options, {});
|
|
104
149
|
if (isNode) {
|
|
105
150
|
return fsPromises.appendFile(path, data, opts);
|
|
151
|
+
}
|
|
152
|
+
if (await exists(path)) {
|
|
153
|
+
const existing = await readFile(path);
|
|
154
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
155
|
+
await writeFile(path, combined, opts);
|
|
106
156
|
} else {
|
|
107
|
-
|
|
108
|
-
const existing = await readFile(path);
|
|
109
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
110
|
-
await writeFile(path, combined, opts);
|
|
111
|
-
} else {
|
|
112
|
-
await writeFile(path, data, opts);
|
|
113
|
-
}
|
|
157
|
+
await writeFile(path, data, opts);
|
|
114
158
|
}
|
|
115
159
|
}
|
|
116
160
|
function appendFileSync(path, data, options) {
|
|
117
161
|
const opts = parseOptions(options, {});
|
|
118
162
|
if (isNode) {
|
|
119
163
|
fs.appendFileSync(path, data, opts);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (existsSync(path)) {
|
|
167
|
+
const existing = readFileSync(path);
|
|
168
|
+
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
169
|
+
writeFileSync(path, combined, opts);
|
|
120
170
|
} else {
|
|
121
|
-
|
|
122
|
-
const existing = readFileSync(path);
|
|
123
|
-
const combined = Buffer.isBuffer(existing) ? Buffer.concat([existing, Buffer.isBuffer(data) ? data : Buffer.from(data)]) : existing + (Buffer.isBuffer(data) ? data.toString() : data);
|
|
124
|
-
writeFileSync(path, combined, opts);
|
|
125
|
-
} else {
|
|
126
|
-
writeFileSync(path, data, opts);
|
|
127
|
-
}
|
|
171
|
+
writeFileSync(path, data, opts);
|
|
128
172
|
}
|
|
129
173
|
}
|
|
130
174
|
async function exists(path) {
|
|
@@ -161,6 +205,8 @@ function statSync(path) {
|
|
|
161
205
|
}
|
|
162
206
|
throw new Error("Unsupported runtime");
|
|
163
207
|
}
|
|
208
|
+
|
|
209
|
+
// src/server/fs/directory-ops.ts
|
|
164
210
|
async function mkdir(path, options) {
|
|
165
211
|
const opts = typeof options === "number" ? { mode: options } : options || {};
|
|
166
212
|
if (isNode || isBun) {
|
|
@@ -223,6 +269,8 @@ function rmdirSync(path, options) {
|
|
|
223
269
|
Deno.removeSync(path, { recursive: options?.recursive });
|
|
224
270
|
}
|
|
225
271
|
}
|
|
272
|
+
|
|
273
|
+
// src/server/fs/path-ops.ts
|
|
226
274
|
async function rename(oldPath, newPath) {
|
|
227
275
|
if (isNode || isBun) {
|
|
228
276
|
return fsPromises.rename(oldPath, newPath);
|
|
@@ -267,47 +315,8 @@ function realpathSync(path, options) {
|
|
|
267
315
|
}
|
|
268
316
|
return path;
|
|
269
317
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
isFile: () => info.isFile,
|
|
273
|
-
isDirectory: () => info.isDirectory,
|
|
274
|
-
isBlockDevice: () => false,
|
|
275
|
-
isCharacterDevice: () => false,
|
|
276
|
-
isSymbolicLink: () => info.isSymlink || false,
|
|
277
|
-
isFIFO: () => false,
|
|
278
|
-
isSocket: () => false,
|
|
279
|
-
dev: info.dev || 0,
|
|
280
|
-
ino: info.ino || 0,
|
|
281
|
-
mode: info.mode || 0,
|
|
282
|
-
nlink: info.nlink || 1,
|
|
283
|
-
uid: info.uid || 0,
|
|
284
|
-
gid: info.gid || 0,
|
|
285
|
-
rdev: 0,
|
|
286
|
-
size: info.size,
|
|
287
|
-
blksize: info.blksize || 4096,
|
|
288
|
-
blocks: info.blocks || Math.ceil(info.size / 512),
|
|
289
|
-
atimeMs: info.atime?.getTime() || Date.now(),
|
|
290
|
-
mtimeMs: info.mtime?.getTime() || Date.now(),
|
|
291
|
-
ctimeMs: info.birthtime?.getTime() || Date.now(),
|
|
292
|
-
birthtimeMs: info.birthtime?.getTime() || Date.now(),
|
|
293
|
-
atime: info.atime || /* @__PURE__ */ new Date(),
|
|
294
|
-
mtime: info.mtime || /* @__PURE__ */ new Date(),
|
|
295
|
-
ctime: info.birthtime || /* @__PURE__ */ new Date(),
|
|
296
|
-
birthtime: info.birthtime || /* @__PURE__ */ new Date()
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function createDirentFromDenoEntry(entry) {
|
|
300
|
-
return {
|
|
301
|
-
name: entry.name,
|
|
302
|
-
isFile: () => entry.isFile,
|
|
303
|
-
isDirectory: () => entry.isDirectory,
|
|
304
|
-
isBlockDevice: () => false,
|
|
305
|
-
isCharacterDevice: () => false,
|
|
306
|
-
isSymbolicLink: () => entry.isSymlink || false,
|
|
307
|
-
isFIFO: () => false,
|
|
308
|
-
isSocket: () => false
|
|
309
|
-
};
|
|
310
|
-
}
|
|
318
|
+
|
|
319
|
+
// src/server/fs/index.ts
|
|
311
320
|
function getRuntime() {
|
|
312
321
|
return runtime;
|
|
313
322
|
}
|