@fkn/lib 0.9.0 → 0.9.2

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 (69) hide show
  1. package/account.cjs +1 -1
  2. package/account.js +1 -1
  3. package/{api-Bdzns9Sb.d.ts → api-BFqrrvzI.d.ts} +25 -0
  4. package/api-BwrS6P0x.cjs +1 -0
  5. package/api-CAZo3BT0.js +73 -0
  6. package/{background-Bgznrosz.cjs → background-DMESyLZ6.cjs} +1 -1
  7. package/{background-EwGRMga_.js → background-DxYR_JMs.js} +1 -1
  8. package/cloud/dgram.cjs +1 -1
  9. package/cloud/dgram.js +1 -1
  10. package/cloud/fs/promises.d.ts +1 -1
  11. package/cloud/fs.cjs +1 -1
  12. package/cloud/fs.d.ts +2 -2
  13. package/cloud/fs.js +1 -1
  14. package/cloud/net.cjs +1 -1
  15. package/cloud/net.d.ts +1 -1
  16. package/cloud/net.js +1 -1
  17. package/{cloud-Gs4fvw2S.cjs → cloud-BcpPsNs3.cjs} +1 -1
  18. package/{cloud-BPd7yisS.d.ts → cloud-CzMjj2Ne.d.ts} +3 -3
  19. package/{cloud-C-QB3sIK.js → cloud-DArHoBaw.js} +4 -4
  20. package/cloud.cjs +1 -1
  21. package/cloud.d.ts +3 -3
  22. package/cloud.js +4 -4
  23. package/{dgram-CKRbKVzG.js → dgram-C1yYxLEI.js} +1 -1
  24. package/{dgram-DcvdNkg6.cjs → dgram-pCNllfov.cjs} +1 -1
  25. package/dgram.cjs +1 -1
  26. package/dgram.d.ts +1 -1
  27. package/dgram.js +1 -1
  28. package/dns.cjs +1 -1
  29. package/dns.js +1 -1
  30. package/{extension-BeARgX1g.cjs → extension-CjJNj5Yl.cjs} +1 -1
  31. package/{extension-CgXBc_iM.js → extension-Qs02HPzR.js} +2 -2
  32. package/extension.cjs +1 -1
  33. package/extension.js +2 -2
  34. package/fs/promises.cjs +1 -1
  35. package/fs/promises.d.ts +2 -2
  36. package/fs/promises.js +1 -1
  37. package/fs-BrBsBqRz.cjs +1 -0
  38. package/{fs-B8A_hQbv.d.ts → fs-DTmSCXwa.d.ts} +1 -1
  39. package/fs-_59wCBU2.js +315 -0
  40. package/fs.cjs +1 -1
  41. package/fs.d.ts +3 -92
  42. package/fs.js +2 -2
  43. package/http.cjs +1 -1
  44. package/http.d.ts +1 -1
  45. package/http.js +1 -1
  46. package/index-BIZeEsNu.d.ts +139 -0
  47. package/{index-C6ZoDJg8.d.ts → index-CJ0vHTcS.d.ts} +5 -2
  48. package/index.cjs +1 -1
  49. package/index.d.ts +3 -3
  50. package/index.js +7 -7
  51. package/{net-BPpdNdpy.cjs → net-BOyLJ3mh.cjs} +1 -1
  52. package/{net-EaGR0bVe.d.ts → net-MbSFrO35.d.ts} +1 -1
  53. package/{net-BFYMbE4N.js → net-VAkfxAvn.js} +1 -1
  54. package/net.cjs +1 -1
  55. package/net.d.ts +1 -1
  56. package/net.js +1 -1
  57. package/opfs/promises.d.ts +1 -1
  58. package/opfs.d.ts +1 -1
  59. package/package.json +1 -1
  60. package/packages.cjs +1 -1
  61. package/packages.js +1 -1
  62. package/{proxy-CuuSsVoC.js → proxy-B3rliZN8.js} +2 -2
  63. package/{proxy-Bo-8GoRU.cjs → proxy-g2yknq7C.cjs} +1 -1
  64. package/{storage-ezLkqmQR.cjs → storage-C1BT8jwJ.cjs} +1 -1
  65. package/{storage-DMETg6sP.js → storage-InqJHrkf.js} +1 -1
  66. package/api--bnCFd4w.js +0 -67
  67. package/api-DD5v1qP9.cjs +0 -1
  68. package/fs-CP-81e-c.cjs +0 -1
  69. package/fs-DhPpGH0c.js +0 -82
package/fs-_59wCBU2.js ADDED
@@ -0,0 +1,315 @@
1
+ import { n as e } from "./rolldown-runtime-DF993M8W.js";
2
+ import { t } from "./node-fs-DKfokOlh.js";
3
+ import { i as n, n as r, o as i, s as a, u as o } from "./storage-InqJHrkf.js";
4
+ import { a as s, i as c, n as l, o as u, t as d } from "./opfs-7_GmzQ93.js";
5
+ //#region src/lib/fs/hybrid.ts
6
+ var f = /* @__PURE__ */ e({
7
+ adopt: () => F,
8
+ adoptable: () => I,
9
+ available: () => te,
10
+ list: () => ie,
11
+ onConflict: () => N,
12
+ pending: () => D,
13
+ pendingDeletes: () => O,
14
+ pull: () => ce,
15
+ readFile: () => ae,
16
+ remove: () => se,
17
+ replicating: () => k,
18
+ writeFile: () => oe
19
+ }), ee, p = async () => await (ee ??= d().catch(() => !1)) ? !0 : (ee = void 0, !1), m = () => r().catch(() => !1), te = async () => await p() || await m(), h = "fkn:fs:pending", g = "fkn:fs:pending-delete", _ = "fkn:fs:adopt-declined", v = !0, y = /* @__PURE__ */ new Map(), b = (e) => {
20
+ try {
21
+ let t = localStorage.getItem(e);
22
+ if (!t) return {};
23
+ let n = JSON.parse(t);
24
+ return Array.isArray(n) ? Object.fromEntries(n.filter((e) => typeof e == "string").map((e) => [e, null])) : n && typeof n == "object" ? n : {};
25
+ } catch {
26
+ return {};
27
+ }
28
+ }, x = (e, t) => {
29
+ try {
30
+ Object.keys(t).length ? localStorage.setItem(e, JSON.stringify(t)) : localStorage.removeItem(e);
31
+ } catch {}
32
+ }, S = () => b(h), C = (e) => {
33
+ let t = S();
34
+ e in t || (t[e] = y.get(e) ?? null, x(h, t));
35
+ }, w = (e) => {
36
+ let t = S();
37
+ e in t && (delete t[e], x(h, t));
38
+ }, T = () => b(g), ne = (e) => {
39
+ let t = T();
40
+ e in t || (t[e] = y.get(e) ?? null, x(g, t));
41
+ }, E = (e) => {
42
+ let t = T();
43
+ e in t && (delete t[e], x(g, t));
44
+ }, D = () => Object.keys(S()), O = () => Object.keys(T()), k = () => v, A = null, re = null, j = () => re ??= import("./api-CAZo3BT0.js").then((e) => e.n).then((e) => e.apiPromise), ie = async () => {
45
+ me();
46
+ let e = await m(), [t, r] = await Promise.all([p().then((e) => e ? l() : []).catch(() => []), e ? n().then((e) => ({
47
+ ok: !0,
48
+ entries: e
49
+ })).catch(() => ({
50
+ ok: !1,
51
+ entries: []
52
+ })) : Promise.resolve({
53
+ ok: !0,
54
+ entries: []
55
+ })]);
56
+ v = r.ok, r.ok && (y = new Map(r.entries.map((e) => [e.path, e.updatedAt])));
57
+ let i = /* @__PURE__ */ new Map(), a = (e) => {
58
+ let t = Date.parse(e.updatedAt ?? "");
59
+ return Number.isFinite(t) ? t : 0;
60
+ }, o = (e) => {
61
+ let t = i.get(e.path);
62
+ (!t || a(e) >= a(t)) && i.set(e.path, e);
63
+ };
64
+ for (let e of t) o(e);
65
+ for (let e of r.entries) o(e);
66
+ if (r.ok && e) {
67
+ pe(t, r.entries).catch(() => {});
68
+ let e = Object.keys(S()).length || Object.keys(T()).length;
69
+ e && !A ? A = P(!1).catch(() => {}).finally(() => {
70
+ A = null;
71
+ }) : e || R({
72
+ local: t,
73
+ remote: r.entries
74
+ }).catch(() => {});
75
+ }
76
+ return [...i.values()];
77
+ }, ae = async (e) => {
78
+ if (await p()) try {
79
+ return await c(e);
80
+ } catch (e) {
81
+ if (e?.name !== "NotFoundError") throw e;
82
+ }
83
+ let t = await i(e);
84
+ return await p() && u(e, t).catch(() => {}), t;
85
+ }, oe = async (e, t, n) => {
86
+ let r = t instanceof Blob ? t : new Blob([t], n?.contentType ? { type: n.contentType } : void 0);
87
+ if (await p()) {
88
+ if (await u(e, r, n), !await m()) return;
89
+ if (!v) {
90
+ C(e);
91
+ return;
92
+ }
93
+ o(e, r, n).then(() => w(e)).catch((t) => {
94
+ C(e), console.warn("fs: cloud replicate failed, queued for adopt()", t);
95
+ });
96
+ return;
97
+ }
98
+ if (await m()) return o(e, r, n);
99
+ throw Error("fs: no storage backend available");
100
+ }, se = async (e) => {
101
+ let t = [];
102
+ await p() && t.push(s(e).catch(() => {}));
103
+ let n = await m();
104
+ if (n && t.push(a(e).then(() => E(e)).catch((t) => {
105
+ ne(e), console.warn("fs: cloud delete failed, queued for retry", t);
106
+ })), !t.length) throw Error("fs: no storage backend available");
107
+ n && w(e), await Promise.all(t);
108
+ }, ce = async (e) => {
109
+ let t = await i(e);
110
+ return await p() && await u(e, t), t;
111
+ }, M = null, N = (e) => (M = e, () => {
112
+ M === e && (M = null);
113
+ }), le = async (e) => (await j()).cloud.fs.promptConflict({
114
+ path: e.path,
115
+ local: e.local,
116
+ cloud: e.cloud
117
+ }).catch(() => null), ue = async (e) => {
118
+ if (M) try {
119
+ return await M(e);
120
+ } catch {
121
+ return null;
122
+ }
123
+ return le(e);
124
+ }, P = async (e) => {
125
+ let t = {
126
+ uploaded: [],
127
+ kept: [],
128
+ resolved: [],
129
+ unresolved: [],
130
+ deleted: [],
131
+ failed: []
132
+ };
133
+ if (!await m()) throw Error("fs: this needs a signed-in account");
134
+ if (!await p()) return t;
135
+ let [r, s] = await Promise.all([l(), n()]), d = new Map(s.map((e) => [e.path, e])), f = S();
136
+ for (let [e, n] of Object.entries(T())) {
137
+ let i = d.get(e);
138
+ if (!i) {
139
+ E(e);
140
+ continue;
141
+ }
142
+ if (r.some((t) => t.path === e)) {
143
+ E(e);
144
+ continue;
145
+ }
146
+ if (i.updatedAt !== n) {
147
+ E(e);
148
+ continue;
149
+ }
150
+ try {
151
+ await a(e), E(e), t.deleted.push(e);
152
+ } catch (n) {
153
+ t.failed.push({
154
+ path: e,
155
+ error: n instanceof Error ? n.message : String(n)
156
+ });
157
+ }
158
+ }
159
+ for (let n of r) {
160
+ let r = d.get(n.path), a = n.path in f;
161
+ if (!a && (r || !e)) {
162
+ r && t.kept.push(n.path);
163
+ continue;
164
+ }
165
+ if (a && r && r.updatedAt !== f[n.path]) {
166
+ let e = await ue({
167
+ path: n.path,
168
+ local: {
169
+ size: n.size,
170
+ updatedAt: n.updatedAt
171
+ },
172
+ cloud: {
173
+ size: r.size,
174
+ updatedAt: r.updatedAt
175
+ },
176
+ readLocal: () => c(n.path),
177
+ readCloud: () => i(n.path)
178
+ });
179
+ if (!e) {
180
+ t.unresolved.push(n.path);
181
+ continue;
182
+ }
183
+ try {
184
+ if (e === "cloud") await u(n.path, await i(n.path));
185
+ else {
186
+ let t = e === "local" ? await c(n.path) : e.merged;
187
+ await o(n.path, t, n.contentType ? { contentType: n.contentType } : void 0), e !== "local" && await u(n.path, t);
188
+ }
189
+ w(n.path), t.resolved.push({
190
+ path: n.path,
191
+ choice: e === "local" || e === "cloud" ? e : "merged"
192
+ });
193
+ } catch (e) {
194
+ if (e?.code === "FKN_E2E_LOCKED") throw e;
195
+ t.failed.push({
196
+ path: n.path,
197
+ error: e instanceof Error ? e.message : String(e)
198
+ });
199
+ }
200
+ continue;
201
+ }
202
+ try {
203
+ let e = await c(n.path);
204
+ await o(n.path, e, n.contentType ? { contentType: n.contentType } : void 0), w(n.path), t.uploaded.push(n.path);
205
+ } catch (e) {
206
+ if (C(n.path), e?.code === "FKN_E2E_LOCKED") throw e;
207
+ t.failed.push({
208
+ path: n.path,
209
+ error: e instanceof Error ? e.message : String(e)
210
+ });
211
+ }
212
+ }
213
+ return t;
214
+ }, F = () => P(!0), I = async () => {
215
+ if (!await m() || !await p()) return {
216
+ paths: [],
217
+ bytes: 0
218
+ };
219
+ let [e, t] = await Promise.all([l(), n()]), r = new Set(t.map((e) => e.path)), i = e.filter((e) => !r.has(e.path));
220
+ return {
221
+ paths: i.map((e) => e.path),
222
+ bytes: i.reduce((e, t) => e + t.size, 0)
223
+ };
224
+ }, de = () => new Set(Object.keys(b(_))), fe = (e) => {
225
+ let t = b(_);
226
+ for (let n of e) t[n] = null;
227
+ x(_, t);
228
+ }, L = null, R = (e) => L || (L = (async () => {
229
+ if (!await m()) return;
230
+ let t = e ?? (await p() ? {
231
+ local: await l(),
232
+ remote: await n()
233
+ } : null);
234
+ if (!t) return;
235
+ let r = new Set(t.remote.map((e) => e.path)), i = de(), a = t.local.filter((e) => !r.has(e.path) && !i.has(e.path));
236
+ if (!a.length) return;
237
+ let o = await j(), s = a.reduce((e, t) => e + t.size, 0);
238
+ if (!await o.cloud.fs.promptAdopt({
239
+ files: a.length,
240
+ bytes: s
241
+ }).catch(() => !1)) {
242
+ fe(a.map((e) => e.path));
243
+ return;
244
+ }
245
+ await F();
246
+ })().catch(() => {}).finally(() => {
247
+ L = null;
248
+ }), L), pe = async (e, t) => {
249
+ let n = new Set(t.map((e) => e.path)), r = e.filter((e) => !n.has(e.path)), i = await j(), a = async () => {
250
+ await F().catch(() => {});
251
+ let e = await I().catch(() => ({
252
+ paths: [],
253
+ bytes: 0
254
+ }));
255
+ await i.cloud.fs.setAdoptSource({
256
+ files: e.paths.length,
257
+ bytes: e.bytes
258
+ }, a).catch(() => {});
259
+ };
260
+ await i.cloud.fs.setAdoptSource({
261
+ files: r.length,
262
+ bytes: r.reduce((e, t) => e + t.size, 0)
263
+ }, a);
264
+ }, z = !1, me = () => {
265
+ z || typeof window > "u" || (z = !0, import("./account.js").then((e) => e.onChange(() => {
266
+ R().catch(() => {});
267
+ })).catch(() => {}));
268
+ }, he = /* @__PURE__ */ e({
269
+ adopt: () => J,
270
+ adoptable: () => Y,
271
+ appendFile: () => Ee,
272
+ appendFileSync: () => W,
273
+ available: () => V,
274
+ default: () => Le,
275
+ exists: () => Ne,
276
+ existsSync: () => G,
277
+ flush: () => Fe,
278
+ lstatSync: () => _e,
279
+ mkdir: () => ke,
280
+ mkdirSync: () => ye,
281
+ mount: () => K,
282
+ onConflict: () => $,
283
+ pending: () => X,
284
+ pendingDeletes: () => Z,
285
+ promises: () => Pe,
286
+ pull: () => q,
287
+ readFile: () => we,
288
+ readFileSync: () => H,
289
+ readdir: () => Oe,
290
+ readdirSync: () => ve,
291
+ remount: () => Ie,
292
+ rename: () => Me,
293
+ renameSync: () => Ce,
294
+ replicating: () => Q,
295
+ rm: () => Ae,
296
+ rmSync: () => be,
297
+ rmdirSync: () => xe,
298
+ stat: () => De,
299
+ statSync: () => ge,
300
+ unlink: () => je,
301
+ unlinkSync: () => Se,
302
+ writeFile: () => Te,
303
+ writeFileSync: () => U
304
+ }), B = t(f, { memfs: !0 }), { available: V, readFileSync: H, writeFileSync: U, appendFileSync: W, existsSync: G, statSync: ge, lstatSync: _e, readdirSync: ve, mkdirSync: ye, rmSync: be, rmdirSync: xe, unlinkSync: Se, renameSync: Ce, readFile: we, writeFile: Te, appendFile: Ee, stat: De, readdir: Oe, mkdir: ke, rm: Ae, unlink: je, rename: Me, exists: Ne, promises: Pe, mount: K, flush: Fe, remount: Ie } = B, q = ce, J = F, Y = I, X = D, Z = O, Q = k, $ = N, Le = {
305
+ ...B,
306
+ pull: q,
307
+ adopt: J,
308
+ adoptable: Y,
309
+ pending: X,
310
+ pendingDeletes: Z,
311
+ replicating: Q,
312
+ onConflict: $
313
+ };
314
+ //#endregion
315
+ export { xe as A, ve as C, Q as D, Ce as E, Te as F, U as I, ge as M, je as N, Ae as O, Se as P, Oe as S, Me as T, Z as _, V as a, we as b, Fe as c, _e as d, ke as f, X as g, $ as h, W as i, De as j, be as k, Le as l, K as m, Y as n, Ne as o, ye as p, Ee as r, G as s, J as t, he as u, Pe as v, Ie as w, H as x, q as y };
package/fs.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-CP-81e-c.cjs");exports.appendFile=e.t,exports.appendFileSync=e.n,exports.available=e.r,exports.default=e.s,exports.exists=e.i,exports.existsSync=e.a,exports.flush=e.o,exports.lstatSync=e.l,exports.mkdir=e.u,exports.mkdirSync=e.d,exports.mount=e.f,exports.promises=e.p,exports.pull=e.m,exports.readFile=e.h,exports.readFileSync=e.g,exports.readdir=e._,exports.readdirSync=e.v,exports.remount=e.y,exports.rename=e.b,exports.renameSync=e.x,exports.rm=e.S,exports.rmSync=e.C,exports.rmdirSync=e.w,exports.stat=e.T,exports.statSync=e.E,exports.unlink=e.D,exports.unlinkSync=e.O,exports.writeFile=e.k,exports.writeFileSync=e.A;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./fs-BrBsBqRz.cjs");exports.adopt=e.t,exports.adoptable=e.n,exports.appendFile=e.r,exports.appendFileSync=e.i,exports.available=e.a,exports.default=e.l,exports.exists=e.o,exports.existsSync=e.s,exports.flush=e.c,exports.lstatSync=e.d,exports.mkdir=e.f,exports.mkdirSync=e.p,exports.mount=e.m,exports.onConflict=e.h,exports.pending=e.g,exports.pendingDeletes=e._,exports.promises=e.v,exports.pull=e.y,exports.readFile=e.b,exports.readFileSync=e.x,exports.readdir=e.S,exports.readdirSync=e.C,exports.remount=e.w,exports.rename=e.T,exports.renameSync=e.E,exports.replicating=e.D,exports.rm=e.O,exports.rmSync=e.k,exports.rmdirSync=e.A,exports.stat=e.j,exports.statSync=e.M,exports.unlink=e.N,exports.unlinkSync=e.P,exports.writeFile=e.F,exports.writeFileSync=e.I;
package/fs.d.ts CHANGED
@@ -1,92 +1,3 @@
1
- import { a as WriteData, i as Stats, n as MakeOptions, o as WriteOptions, r as ReadOptions, t as Callback } from "./index-C6ZoDJg8.js";
2
-
3
- //#region src/lib/fs/index.d.ts
4
- declare namespace index_d_exports {
5
- export { Stats, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, promises, pull, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
6
- }
7
- declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
8
- recursive?: boolean;
9
- force?: boolean;
10
- }) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
11
- recursive?: boolean;
12
- }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
13
- recursive?: boolean;
14
- force?: boolean;
15
- } | Callback<void>, b?: Callback<void>) => void, unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void, exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void, promises: {
16
- readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
17
- writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
18
- appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
19
- stat: (path: import("node:fs").PathLike) => Promise<Stats>;
20
- lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
21
- readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
22
- mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
23
- rm: (path: import("node:fs").PathLike, options?: {
24
- recursive?: boolean;
25
- force?: boolean;
26
- }) => Promise<void>;
27
- rmdir: (path: import("node:fs").PathLike, options?: {
28
- recursive?: boolean;
29
- }) => Promise<void>;
30
- unlink: (path: import("node:fs").PathLike) => Promise<void>;
31
- rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
32
- access: (path: import("node:fs").PathLike) => Promise<void>;
33
- }, mount: () => Promise<void>, flush: () => Promise<void>, remount: () => Promise<void>;
34
- declare const pull: (path: string) => Promise<Blob>;
35
- declare const _default: {
36
- available: () => Promise<boolean>;
37
- readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string;
38
- writeFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
39
- appendFileSync: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => void;
40
- existsSync: (path: import("node:fs").PathLike) => boolean;
41
- statSync: (path: import("node:fs").PathLike) => Stats;
42
- lstatSync: (path: import("node:fs").PathLike) => Stats;
43
- readdirSync: (path: import("node:fs").PathLike) => string[];
44
- mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void;
45
- rmSync: (path: import("node:fs").PathLike, options?: {
46
- recursive?: boolean;
47
- force?: boolean;
48
- }) => void;
49
- rmdirSync: (path: import("node:fs").PathLike, options?: {
50
- recursive?: boolean;
51
- }) => void;
52
- unlinkSync: (path: import("node:fs").PathLike) => void;
53
- renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void;
54
- readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void;
55
- writeFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
56
- appendFile: (path: import("node:fs").PathLike, data: WriteData, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
57
- stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void;
58
- readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void;
59
- mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void;
60
- rm: (path: import("node:fs").PathLike, a: {
61
- recursive?: boolean;
62
- force?: boolean;
63
- } | Callback<void>, b?: Callback<void>) => void;
64
- unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void;
65
- rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void;
66
- exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void;
67
- promises: {
68
- readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
69
- writeFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
70
- appendFile: (path: import("node:fs").PathLike, data: WriteData, options?: WriteOptions) => Promise<void>;
71
- stat: (path: import("node:fs").PathLike) => Promise<Stats>;
72
- lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
73
- readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
74
- mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
75
- rm: (path: import("node:fs").PathLike, options?: {
76
- recursive?: boolean;
77
- force?: boolean;
78
- }) => Promise<void>;
79
- rmdir: (path: import("node:fs").PathLike, options?: {
80
- recursive?: boolean;
81
- }) => Promise<void>;
82
- unlink: (path: import("node:fs").PathLike) => Promise<void>;
83
- rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
84
- access: (path: import("node:fs").PathLike) => Promise<void>;
85
- };
86
- mount: () => Promise<void>;
87
- flush: () => Promise<void>;
88
- remount: () => Promise<void>;
89
- pull: (path: string) => Promise<Blob>;
90
- };
91
- //#endregion
92
- export { type Stats, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, promises, pull, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, rm, rmSync, rmdirSync, stat, statSync, index_d_exports as t, unlink, unlinkSync, writeFile, writeFileSync };
1
+ import { a as Stats } from "./index-CJ0vHTcS.js";
2
+ import { A as rmdirSync, B as ConflictSide, C as readdirSync, D as replicating, E as renameSync, F as writeFile, I as writeFileSync, L as AdoptSummary, M as statSync, N as unlink, O as rm, P as unlinkSync, R as ConflictChoice, S as readdir, T as rename, V as FileConflict, _ as pendingDeletes, a as appendFileSync, b as readFile, c as existsSync, d as lstatSync, f as mkdir, g as pending, h as onConflict, i as appendFile, j as stat, k as rmSync, l as flush, m as mount, n as adopt, o as available, p as mkdirSync, r as adoptable, s as exists, t as _default, v as promises, w as remount, x as readFileSync, y as pull, z as ConflictResolver } from "./index-BIZeEsNu.js";
3
+ export { type AdoptSummary, type ConflictChoice, type ConflictResolver, type ConflictSide, type FileConflict, type Stats, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
package/fs.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as v, o as y, p as b, r as x, s as S, t as C, u as w, v as T, w as E, x as D, y as O } from "./fs-DhPpGH0c.js";
2
- export { C as appendFile, v as appendFileSync, x as available, S as default, m as exists, c as existsSync, y as flush, g as lstatSync, w as mkdir, u as mkdirSync, d as mount, b as promises, _ as pull, p as readFile, f as readFileSync, s as readdir, T as readdirSync, O as remount, l as rename, D as renameSync, a as rm, t as rmSync, E as rmdirSync, o as stat, r as statSync, n as unlink, i as unlinkSync, h as writeFile, e as writeFileSync };
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, M as o, N as s, O as c, P as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as _, g as v, h as y, i as b, j as x, k as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, v as j, w as M, x as N, y as P } from "./fs-_59wCBU2.js";
2
+ export { A as adopt, T as adoptable, O as appendFile, b as appendFileSync, p as available, C as default, E as exists, k as existsSync, h as flush, g as lstatSync, _ as mkdir, D as mkdirSync, w as mount, y as onConflict, v as pending, f as pendingDeletes, j as promises, P as pull, m as readFile, N as readFileSync, u as readdir, t as readdirSync, M as remount, d as rename, r as renameSync, n as replicating, c as rm, S as rmSync, e as rmdirSync, x as stat, o as statSync, s as unlink, l as unlinkSync, i as writeFile, a as writeFileSync };
package/http.cjs CHANGED
@@ -1,4 +1,4 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-Doa5O59j.cjs"),t=require("./net-BPpdNdpy.cjs");let n=require("buffer"),r=require("stream");var i=e.n({Agent:()=>T,ClientRequest:()=>S,HTTPParser:()=>g,IncomingMessage:()=>v,METHODS:()=>o,STATUS_CODES:()=>s,Server:()=>w,ServerResponse:()=>b,_default:()=>A,createServer:()=>k,default:()=>A,get:()=>O,globalAgent:()=>E,request:()=>D}),a=new TextDecoder(`latin1`),o=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),s={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},c=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),l=13,u=10,d=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,f=(e,t)=>(e.code=t,e),p=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},m=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===l&&e[n+1]===u)return n;return-1},h=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===l&&e[t+1]===u&&e[t+2]===l&&e[t+3]===u)return t;return-1},g=class{mode;handlers;buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=p(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=h(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=a.decode(e).split(`\r
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./rolldown-runtime-Doa5O59j.cjs"),t=require("./net-BOyLJ3mh.cjs");let n=require("buffer"),r=require("stream");var i=e.n({Agent:()=>T,ClientRequest:()=>S,HTTPParser:()=>g,IncomingMessage:()=>v,METHODS:()=>o,STATUS_CODES:()=>s,Server:()=>w,ServerResponse:()=>b,_default:()=>A,createServer:()=>k,default:()=>A,get:()=>O,globalAgent:()=>E,request:()=>D}),a=new TextDecoder(`latin1`),o=`ACL.BIND.CHECKOUT.CONNECT.COPY.DELETE.GET.HEAD.LINK.LOCK.M-SEARCH.MERGE.MKACTIVITY.MKCALENDAR.MKCOL.MOVE.NOTIFY.OPTIONS.PATCH.POST.PROPFIND.PROPPATCH.PURGE.PUT.REBIND.REPORT.SEARCH.SOURCE.SUBSCRIBE.TRACE.UNBIND.UNLINK.UNLOCK.UNSUBSCRIBE`.split(`.`),s={100:`Continue`,101:`Switching Protocols`,102:`Processing`,103:`Early Hints`,200:`OK`,201:`Created`,202:`Accepted`,203:`Non-Authoritative Information`,204:`No Content`,205:`Reset Content`,206:`Partial Content`,207:`Multi-Status`,208:`Already Reported`,226:`IM Used`,300:`Multiple Choices`,301:`Moved Permanently`,302:`Found`,303:`See Other`,304:`Not Modified`,305:`Use Proxy`,307:`Temporary Redirect`,308:`Permanent Redirect`,400:`Bad Request`,401:`Unauthorized`,402:`Payment Required`,403:`Forbidden`,404:`Not Found`,405:`Method Not Allowed`,406:`Not Acceptable`,407:`Proxy Authentication Required`,408:`Request Timeout`,409:`Conflict`,410:`Gone`,411:`Length Required`,412:`Precondition Failed`,413:`Payload Too Large`,414:`URI Too Long`,415:`Unsupported Media Type`,416:`Range Not Satisfiable`,417:`Expectation Failed`,418:`I'm a Teapot`,421:`Misdirected Request`,422:`Unprocessable Entity`,423:`Locked`,424:`Failed Dependency`,425:`Too Early`,426:`Upgrade Required`,428:`Precondition Required`,429:`Too Many Requests`,431:`Request Header Fields Too Large`,451:`Unavailable For Legal Reasons`,500:`Internal Server Error`,501:`Not Implemented`,502:`Bad Gateway`,503:`Service Unavailable`,504:`Gateway Timeout`,505:`HTTP Version Not Supported`,506:`Variant Also Negotiates`,507:`Insufficient Storage`,508:`Loop Detected`,509:`Bandwidth Limit Exceeded`,510:`Not Extended`,511:`Network Authentication Required`},c=new Set([`content-type`,`content-length`,`user-agent`,`referer`,`host`,`authorization`,`proxy-authorization`,`if-modified-since`,`if-unmodified-since`,`from`,`location`,`max-forwards`,`retry-after`,`etag`,`last-modified`,`server`,`age`,`expires`]),l=13,u=10,d=/^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/,f=(e,t)=>(e.code=t,e),p=(e,t)=>{if(e.length===0)return t;if(t.length===0)return e;let n=new Uint8Array(e.length+t.length);return n.set(e,0),n.set(t,e.length),n},m=(e,t)=>{for(let n=t;n+1<e.length;n++)if(e[n]===l&&e[n+1]===u)return n;return-1},h=e=>{for(let t=0;t+3<e.length;t++)if(e[t]===l&&e[t+1]===u&&e[t+2]===l&&e[t+3]===u)return t;return-1},g=class{mode;handlers;buf=new Uint8Array;state=`HEAD`;framing=`none`;bodyRemaining=0;chunkState=`size`;skipBody=!1;constructor(e,t){this.mode=e,this.handlers=t}execute(e){this.buf=p(this.buf,e);let t=!0;for(;t;)if(t=!1,this.state===`HEAD`){let e=h(this.buf);if(e===-1)return;let n=this.buf.subarray(0,e);this.buf=this.buf.subarray(e+4);let r=this.parseHead(n);this.handlers.onHeaders(r),this.setupBody(r),this.framing===`none`?(this.handlers.onComplete(),this.reset(),t=this.buf.length>0):(this.state=`BODY`,t=!0)}else this.consumeBody()&&(this.handlers.onComplete(),this.reset(),t=this.buf.length>0)}finish(){this.state===`BODY`&&this.framing===`eof`&&(this.handlers.onComplete(),this.reset())}reset(){this.state=`HEAD`,this.framing=`none`,this.bodyRemaining=0,this.chunkState=`size`,this.skipBody=!1}parseHead(e){let t=a.decode(e).split(`\r
2
2
  `),n=t.shift()??``,r=[];for(let e of t)(e.startsWith(` `)||e.startsWith(` `))&&r.length>0?r[r.length-1]+=` `+e.trim():r.push(e);let i=[],o={};for(let e of r){if(!e)continue;let t=e.indexOf(`:`);if(t===-1)continue;let n=e.slice(0,t).trim(),r=e.slice(t+1).trim();i.push(n,r),this.addHeader(o,n,r)}let s={httpVersionMajor:1,httpVersionMinor:1,httpVersion:`1.1`,headers:o,rawHeaders:i};if(this.mode===`request`){let[e,t,r]=n.split(` `);s.method=(e??`GET`).toUpperCase(),s.url=t??`/`,this.applyVersion(s,r)}else{let e=n.indexOf(` `),t=n.slice(0,e),r=n.slice(e+1),i=r.indexOf(` `),a=i===-1?r:r.slice(0,i);s.statusCode=parseInt(a,10)||0,s.statusMessage=i===-1?``:r.slice(i+1),this.applyVersion(s,t)}return s}applyVersion(e,t){let n=/HTTP\/(\d)\.(\d)/i.exec(t??``);n&&(e.httpVersionMajor=parseInt(n[1],10),e.httpVersionMinor=parseInt(n[2],10),e.httpVersion=`${e.httpVersionMajor}.${e.httpVersionMinor}`)}addHeader(e,t,n){let r=t.toLowerCase();if(r===`set-cookie`){let t=e[`set-cookie`];Array.isArray(t)?t.push(n):e[`set-cookie`]=[n];return}let i=e[r];i===void 0?e[r]=n:c.has(r)||(e[r]=`${i}, ${n}`)}setupBody(e){if(this.skipBody){this.framing=`none`;return}let t=e.headers[`transfer-encoding`];if(typeof t==`string`&&t.toLowerCase().includes(`chunked`)){this.framing=`chunked`,this.chunkState=`size`;return}let n=e.headers[`content-length`];if(typeof n==`string`&&n!==``){let e=parseInt(n,10);e>0?(this.framing=`length`,this.bodyRemaining=e):this.framing=`none`;return}if(this.mode===`response`){let t=e.statusCode??0;t>=100&&t<200||t===204||t===304?this.framing=`none`:this.framing=`eof`}else this.framing=`none`}consumeBody(){if(this.framing===`length`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);return this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0}return this.framing===`eof`?(this.buf.length>0&&(this.handlers.onBody(this.buf),this.buf=new Uint8Array),!1):this.framing===`chunked`?this.consumeChunked():!0}consumeChunked(){for(;;)if(this.chunkState===`size`){let e=m(this.buf,0);if(e===-1)return!1;let t=a.decode(this.buf.subarray(0,e)),n=parseInt(t.split(`;`)[0].trim(),16);if(this.buf=this.buf.subarray(e+2),Number.isNaN(n))return!0;n===0?this.chunkState=`trailer`:(this.bodyRemaining=n,this.chunkState=`data`)}else if(this.chunkState===`data`){if(this.buf.length===0)return!1;let e=Math.min(this.bodyRemaining,this.buf.length);this.handlers.onBody(this.buf.subarray(0,e)),this.buf=this.buf.subarray(e),this.bodyRemaining-=e,this.bodyRemaining===0&&(this.chunkState=`dataCRLF`)}else if(this.chunkState===`dataCRLF`){if(this.buf.length<2)return!1;this.buf=this.buf.subarray(2),this.chunkState=`size`}else{let e=m(this.buf,0);if(e===-1)return!1;let t=e===0;if(this.buf=this.buf.subarray(e+2),t)return!0}}},_=(e,t)=>n.Buffer.isBuffer(e)?e:typeof e==`string`?n.Buffer.from(e,t??`utf8`):e instanceof Uint8Array?n.Buffer.from(e):e instanceof ArrayBuffer?n.Buffer.from(new Uint8Array(e)):n.Buffer.from(String(e)),v=class extends r.Stream.Readable{httpVersion=`1.1`;httpVersionMajor=1;httpVersionMinor=1;headers={};rawHeaders=[];trailers={};rawTrailers=[];method;url;statusCode;statusMessage;complete=!1;socket;constructor(e){super(),this.socket=e}get connection(){return this.socket}_applyHead(e){this.httpVersion=e.httpVersion,this.httpVersionMajor=e.httpVersionMajor,this.httpVersionMinor=e.httpVersionMinor,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.method=e.method,this.url=e.url,this.statusCode=e.statusCode,this.statusMessage=e.statusMessage}_read(){}setTimeout(e,t){return this.socket.setTimeout(e,t),this}},y=class extends r.Stream.Writable{_headerStore=new Map;headersSent=!1;chunkedEncoding=!1;finished=!1;_bodyWritten=!1;setHeader(e,t){if(this.headersSent)throw f(Error(`Cannot set headers after they are sent to the client`),`ERR_HTTP_HEADERS_SENT`);if(typeof e!=`string`||!d.test(e))throw f(TypeError(`Header name must be a valid HTTP token [${JSON.stringify(String(e))}]`),`ERR_INVALID_HTTP_TOKEN`);if(t===void 0)throw f(TypeError(`Invalid value "undefined" for header "${e}"`),`ERR_HTTP_INVALID_HEADER_VALUE`);return this._headerStore.set(e.toLowerCase(),[e,Array.isArray(t)?[...t]:t]),this}getHeader(e){return this._headerStore.get(e.toLowerCase())?.[1]}getHeaderNames(){return[...this._headerStore.values()].map(([e])=>e)}getHeaders(){let e={};for(let[t,n]of this._headerStore.values())e[t]=n;return e}hasHeader(e){return this._headerStore.has(e.toLowerCase())}removeHeader(e){if(this.headersSent)throw Error(`Cannot remove headers after they are sent to the client`);this._headerStore.delete(e.toLowerCase())}_storeHeader(e){let t=this.hasHeader(`content-length`),n=this.getHeader(`transfer-encoding`);typeof n==`string`&&n.toLowerCase().includes(`chunked`)?this.chunkedEncoding=!0:!t&&this._shouldSendBody()&&(this.chunkedEncoding=!0,this.setHeader(`Transfer-Encoding`,`chunked`));let r=e+`\r
3
3
  `;for(let[e,t]of this._headerStore.values())if(Array.isArray(t))for(let n of t)r+=`${e}: ${n}\r\n`;else r+=`${e}: ${t}\r\n`;return r+=`\r
4
4
  `,r}_writeToSocket(e,t){if(!this.socket){t(Error(`Socket is not available`));return}this.socket.write(e,t)}write(e,t,n){return this._bodyWritten=!0,super.write(e,t,n)}_write(e,t,r){let i=_(e),a=[];if(this.headersSent||=(this._implicitHeader(),a.push(n.Buffer.from(this._headBlock,`latin1`)),!0),this.chunkedEncoding?i.length>0&&(a.push(n.Buffer.from(`${i.length.toString(16)}\r\n`,`latin1`)),a.push(i),a.push(n.Buffer.from(`\r
package/http.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Socket, t as Server$1 } from "./net-EaGR0bVe.js";
1
+ import { n as Socket, t as Server$1 } from "./net-MbSFrO35.js";
2
2
  import { Buffer } from "buffer";
3
3
  import { Stream } from "stream";
4
4
  import { IncomingHttpHeaders, OutgoingHttpHeaders, RequestOptions } from "http";
package/http.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as e } from "./rolldown-runtime-DF993M8W.js";
2
- import { n as t, t as n } from "./net-BFYMbE4N.js";
2
+ import { n as t, t as n } from "./net-VAkfxAvn.js";
3
3
  import { Buffer as r } from "buffer";
4
4
  import { Stream as i } from "stream";
5
5
  //#region src/lib/webvpn/http.ts
@@ -0,0 +1,139 @@
1
+ import { a as Stats, i as ReadOptions, n as Callback, o as WriteData$1, r as MakeOptions, s as WriteOptions, t as WriteData } from "./index-CJ0vHTcS.js";
2
+
3
+ //#region src/lib/fs/hybrid.d.ts
4
+ type AdoptSummary = {
5
+ uploaded: string[];
6
+ kept: string[];
7
+ resolved: {
8
+ path: string;
9
+ choice: 'local' | 'cloud' | 'merged';
10
+ }[];
11
+ unresolved: string[];
12
+ deleted: string[];
13
+ failed: {
14
+ path: string;
15
+ error: string;
16
+ }[];
17
+ };
18
+ type ConflictSide = {
19
+ size: number;
20
+ updatedAt: string | null;
21
+ };
22
+ type FileConflict = {
23
+ path: string;
24
+ local: ConflictSide;
25
+ cloud: ConflictSide;
26
+ readLocal: () => Promise<Blob>;
27
+ readCloud: () => Promise<Blob>;
28
+ };
29
+ type ConflictChoice = 'local' | 'cloud' | {
30
+ merged: WriteData;
31
+ } | null;
32
+ type ConflictResolver = (conflict: FileConflict) => Promise<ConflictChoice> | ConflictChoice;
33
+ declare namespace index_d_exports {
34
+ export { AdoptSummary, ConflictChoice, ConflictResolver, ConflictSide, FileConflict, Stats, adopt, adoptable, appendFile, appendFileSync, available, _default as default, exists, existsSync, flush, lstatSync, mkdir, mkdirSync, mount, onConflict, pending, pendingDeletes, promises, pull, readFile, readFileSync, readdir, readdirSync, remount, rename, renameSync, replicating, rm, rmSync, rmdirSync, stat, statSync, unlink, unlinkSync, writeFile, writeFileSync };
35
+ }
36
+ declare const available: () => Promise<boolean>, readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string, writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void, appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void, existsSync: (path: import("node:fs").PathLike) => boolean, statSync: (path: import("node:fs").PathLike) => Stats, lstatSync: (path: import("node:fs").PathLike) => Stats, readdirSync: (path: import("node:fs").PathLike) => string[], mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void, rmSync: (path: import("node:fs").PathLike, options?: {
37
+ recursive?: boolean;
38
+ force?: boolean;
39
+ }) => void, rmdirSync: (path: import("node:fs").PathLike, options?: {
40
+ recursive?: boolean;
41
+ }) => void, unlinkSync: (path: import("node:fs").PathLike) => void, renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void, readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void, writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void, stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void, readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void, mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void, rm: (path: import("node:fs").PathLike, a: {
42
+ recursive?: boolean;
43
+ force?: boolean;
44
+ } | Callback<void>, b?: Callback<void>) => void, unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void, rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void, exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void, promises: {
45
+ readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
46
+ writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
47
+ appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
48
+ stat: (path: import("node:fs").PathLike) => Promise<Stats>;
49
+ lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
50
+ readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
51
+ mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
52
+ rm: (path: import("node:fs").PathLike, options?: {
53
+ recursive?: boolean;
54
+ force?: boolean;
55
+ }) => Promise<void>;
56
+ rmdir: (path: import("node:fs").PathLike, options?: {
57
+ recursive?: boolean;
58
+ }) => Promise<void>;
59
+ unlink: (path: import("node:fs").PathLike) => Promise<void>;
60
+ rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
61
+ access: (path: import("node:fs").PathLike) => Promise<void>;
62
+ }, mount: () => Promise<void>, flush: () => Promise<void>, remount: () => Promise<void>;
63
+ declare const pull: (path: string) => Promise<Blob>;
64
+ declare const adopt: () => Promise<AdoptSummary>;
65
+ declare const adoptable: () => Promise<{
66
+ paths: string[];
67
+ bytes: number;
68
+ }>;
69
+ declare const pending: () => string[];
70
+ declare const pendingDeletes: () => string[];
71
+ declare const replicating: () => boolean;
72
+ declare const onConflict: (next: ConflictResolver) => (() => void);
73
+ declare const _default: {
74
+ available: () => Promise<boolean>;
75
+ readFileSync: (path: import("node:fs").PathLike, options?: ReadOptions) => Buffer | string;
76
+ writeFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
77
+ appendFileSync: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => void;
78
+ existsSync: (path: import("node:fs").PathLike) => boolean;
79
+ statSync: (path: import("node:fs").PathLike) => Stats;
80
+ lstatSync: (path: import("node:fs").PathLike) => Stats;
81
+ readdirSync: (path: import("node:fs").PathLike) => string[];
82
+ mkdirSync: (path: import("node:fs").PathLike, options?: MakeOptions) => void;
83
+ rmSync: (path: import("node:fs").PathLike, options?: {
84
+ recursive?: boolean;
85
+ force?: boolean;
86
+ }) => void;
87
+ rmdirSync: (path: import("node:fs").PathLike, options?: {
88
+ recursive?: boolean;
89
+ }) => void;
90
+ unlinkSync: (path: import("node:fs").PathLike) => void;
91
+ renameSync: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => void;
92
+ readFile: (path: import("node:fs").PathLike, a: ReadOptions | Callback<Buffer | string>, b?: Callback<Buffer | string>) => void;
93
+ writeFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
94
+ appendFile: (path: import("node:fs").PathLike, data: WriteData$1, a: WriteOptions | Callback<void>, b?: Callback<void>) => void;
95
+ stat: (path: import("node:fs").PathLike, callback: Callback<Stats>) => void;
96
+ readdir: (path: import("node:fs").PathLike, a: unknown, b?: Callback<string[]>) => void;
97
+ mkdir: (path: import("node:fs").PathLike, a: MakeOptions | Callback<void>, b?: Callback<void>) => void;
98
+ rm: (path: import("node:fs").PathLike, a: {
99
+ recursive?: boolean;
100
+ force?: boolean;
101
+ } | Callback<void>, b?: Callback<void>) => void;
102
+ unlink: (path: import("node:fs").PathLike, callback: Callback<void>) => void;
103
+ rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike, callback: Callback<void>) => void;
104
+ exists: (path: import("node:fs").PathLike, callback: (exists: boolean) => void) => void;
105
+ promises: {
106
+ readFile: (path: import("node:fs").PathLike, options?: ReadOptions) => Promise<Buffer | string>;
107
+ writeFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
108
+ appendFile: (path: import("node:fs").PathLike, data: WriteData$1, options?: WriteOptions) => Promise<void>;
109
+ stat: (path: import("node:fs").PathLike) => Promise<Stats>;
110
+ lstat: (path: import("node:fs").PathLike) => Promise<Stats>;
111
+ readdir: (path: import("node:fs").PathLike) => Promise<string[]>;
112
+ mkdir: (path: import("node:fs").PathLike, options?: MakeOptions) => Promise<void>;
113
+ rm: (path: import("node:fs").PathLike, options?: {
114
+ recursive?: boolean;
115
+ force?: boolean;
116
+ }) => Promise<void>;
117
+ rmdir: (path: import("node:fs").PathLike, options?: {
118
+ recursive?: boolean;
119
+ }) => Promise<void>;
120
+ unlink: (path: import("node:fs").PathLike) => Promise<void>;
121
+ rename: (from: import("node:fs").PathLike, to: import("node:fs").PathLike) => Promise<void>;
122
+ access: (path: import("node:fs").PathLike) => Promise<void>;
123
+ };
124
+ mount: () => Promise<void>;
125
+ flush: () => Promise<void>;
126
+ remount: () => Promise<void>;
127
+ pull: (path: string) => Promise<Blob>;
128
+ adopt: () => Promise<AdoptSummary>;
129
+ adoptable: () => Promise<{
130
+ paths: string[];
131
+ bytes: number;
132
+ }>;
133
+ pending: () => string[];
134
+ pendingDeletes: () => string[];
135
+ replicating: () => boolean;
136
+ onConflict: (next: ConflictResolver) => (() => void);
137
+ };
138
+ //#endregion
139
+ export { rmdirSync as A, ConflictSide as B, readdirSync as C, replicating as D, renameSync as E, writeFile as F, writeFileSync as I, AdoptSummary as L, statSync as M, unlink as N, rm as O, unlinkSync as P, ConflictChoice as R, readdir as S, rename as T, FileConflict as V, pendingDeletes as _, appendFileSync as a, readFile as b, existsSync as c, lstatSync as d, mkdir as f, pending as g, onConflict as h, appendFile as i, stat as j, rmSync as k, flush as l, mount as m, adopt as n, available as o, mkdirSync as p, adoptable as r, exists as s, _default as t, index_d_exports as u, promises as v, remount as w, readFileSync as x, pull as y, ConflictResolver as z };
@@ -11,7 +11,7 @@ type WriteOptions = BufferEncoding | {
11
11
  flag?: string;
12
12
  contentType?: string;
13
13
  } | null | undefined;
14
- type WriteData = string | Uint8Array | ArrayBuffer | DataView;
14
+ type WriteData$1 = string | Uint8Array | ArrayBuffer | DataView;
15
15
  type MakeOptions = {
16
16
  recursive?: boolean;
17
17
  } | number | null | undefined;
@@ -28,4 +28,7 @@ type Stats = {
28
28
  isSymbolicLink: () => boolean;
29
29
  };
30
30
  //#endregion
31
- export { WriteData as a, Stats as i, MakeOptions as n, WriteOptions as o, ReadOptions as r, Callback as t };
31
+ //#region src/lib/fs/types.d.ts
32
+ type WriteData = Blob | ArrayBuffer | Uint8Array | string;
33
+ //#endregion
34
+ export { Stats as a, ReadOptions as i, Callback as n, WriteData$1 as o, MakeOptions as r, WriteOptions as s, WriteData as t };