@batijs/cli 0.0.476 → 0.0.477
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/dist/boilerplates/@batijs/auth0/files/$.env.js +6 -5
- package/dist/boilerplates/@batijs/auth0/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/auth0/files/$wrangler.toml.js +32 -0
- package/dist/boilerplates/@batijs/authjs/files/$package.json.js +7 -6
- package/dist/boilerplates/@batijs/authjs/files/server/authjs-handler.ts +42 -35
- package/dist/boilerplates/@batijs/authjs/types/server/authjs-handler.d.ts +8 -3
- package/dist/boilerplates/@batijs/aws/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +10 -10
- package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/biome/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +17 -26
- package/dist/boilerplates/@batijs/cloudflare/files/cloudflare-entry.ts +5 -0
- package/dist/boilerplates/@batijs/cloudflare/files/wrangler.toml +3 -2
- package/dist/boilerplates/@batijs/cloudflare/types/cloudflare-entry.d.ts +2 -0
- package/dist/boilerplates/@batijs/compiled/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/d1/files/$README.md.js +4 -4
- package/dist/boilerplates/@batijs/d1/files/$package.json.js +8 -8
- package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/d1/files/database/d1/helpers.ts +3 -11
- package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/drizzle/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +8 -8
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +8 -8
- package/dist/boilerplates/@batijs/eslint/types/eslint.config.d.ts +1 -1
- package/dist/boilerplates/@batijs/express/files/$package.json.js +16 -29
- package/dist/boilerplates/@batijs/express/files/server/entry.ts +45 -0
- package/dist/boilerplates/@batijs/express/types/server/entry.d.ts +3 -0
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +18 -32
- package/dist/boilerplates/@batijs/fastify/files/server/entry.ts +52 -0
- package/dist/boilerplates/@batijs/fastify/types/server/entry.d.ts +4 -0
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +21 -32
- package/dist/boilerplates/@batijs/h3/files/server/entry.ts +45 -0
- package/dist/boilerplates/@batijs/{express/types/express-entry.d.ts → h3/types/server/entry.d.ts} +1 -1
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +23 -40
- package/dist/boilerplates/@batijs/hono/files/entry_aws_lambda.ts +2 -9
- package/dist/boilerplates/@batijs/hono/files/server/entry.ts +53 -0
- package/dist/boilerplates/@batijs/hono/types/server/entry.d.ts +4 -0
- package/dist/boilerplates/@batijs/mantine/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/mantine/files/$package.json.js +12 -12
- package/dist/boilerplates/@batijs/photon/files/$README.md.js +29 -0
- package/dist/boilerplates/@batijs/photon/files/$package.json.js +109 -0
- package/dist/boilerplates/@batijs/photon/files/+photon.ts +7 -0
- package/dist/boilerplates/@batijs/photon/types/+photon.d.ts +4 -0
- package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +3 -3
- package/dist/boilerplates/@batijs/prettier/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/prisma/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/prisma/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/react/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/react/files/$package.json.js +16 -15
- package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/react/files/pages/+config.ts +6 -1
- package/dist/boilerplates/@batijs/react/types/pages/+config.d.ts +63 -2
- package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +10 -10
- package/dist/boilerplates/@batijs/sentry/files/$.env.js +4 -4
- package/dist/boilerplates/@batijs/sentry/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/sentry/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +7 -7
- package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +9 -9
- package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/shared/files/$README.md.js +9 -9
- package/dist/boilerplates/@batijs/shared/files/package.json +3 -3
- package/dist/boilerplates/@batijs/shared/files/vite.config.ts +1 -20
- package/dist/boilerplates/@batijs/shared-db/files/server/db-middleware.ts +21 -15
- package/dist/boilerplates/@batijs/shared-db/types/server/db-middleware.d.ts +2 -2
- package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +8 -14
- package/dist/boilerplates/@batijs/shared-server/files/server/create-todo-handler.ts +33 -34
- package/dist/boilerplates/@batijs/shared-server/types/server/create-todo-handler.d.ts +3 -4
- package/dist/boilerplates/@batijs/solid/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +11 -10
- package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +6 -1
- package/dist/boilerplates/@batijs/solid/types/pages/+config.d.ts +70 -2
- package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +4 -3
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +7 -7
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +9 -9
- package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +9 -9
- package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/server/telefunc-handler.ts +34 -27
- package/dist/boilerplates/@batijs/telefunc/types/server/telefunc-handler.d.ts +2 -2
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +9 -9
- package/dist/boilerplates/@batijs/trpc/files/server/trpc-handler.ts +26 -18
- package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +6 -1
- package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +1 -1
- package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/ts-rest/files/server/ts-rest-handler.ts +21 -14
- package/dist/boilerplates/@batijs/ts-rest/types/server/ts-rest-handler.d.ts +2 -2
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +8 -9
- package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +15 -14
- package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +6 -6
- package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +6 -1
- package/dist/boilerplates/@batijs/vue/types/pages/+config.d.ts +1 -2
- package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +8 -8
- package/dist/boilerplates/boilerplates.json +20 -0
- package/dist/{chunk-2SZ4N3E5.js → chunk-KGXTM3D3.js} +83539 -83181
- package/dist/index.js +720 -659
- package/dist/jiti-ZW3ADF2F-7XIEJQMO.js +2982 -0
- package/dist/src-5HGZFBZ3-KQZBBJSW.js +468 -0
- package/package.json +10 -10
- package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +0 -19
- package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +0 -34
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +0 -102
- package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +0 -140
- package/dist/boilerplates/@batijs/fastify/types/fastify-entry.d.ts +0 -3
- package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +0 -144
- package/dist/boilerplates/@batijs/h3/types/h3-entry.d.ts +0 -4
- package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +0 -36
- package/dist/boilerplates/@batijs/hono/files/hono-entry.node.ts +0 -31
- package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +0 -74
- package/dist/boilerplates/@batijs/hono/types/hono-entry.d.ts +0 -6
- package/dist/boilerplates/@batijs/hono/types/hono-entry.node.d.ts +0 -1
- package/dist/boilerplates/@batijs/shared-server/files/server/vike-handler.ts +0 -20
- package/dist/boilerplates/@batijs/shared-server/types/server/vike-handler.d.ts +0 -2
- package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +0 -19
- package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +0 -27
- package/dist/jiti-W5Y5D52V-VBLACVBV.js +0 -30587
- package/dist/src-UAKFXUB2-DFO2P37K.js +0 -417
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as createRequire_BATI_CLI } from 'module';
|
|
3
|
-
const require = createRequire_BATI_CLI(import.meta.url);
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
n
|
|
7
|
-
} from "./chunk-IAWYWZSL.js";
|
|
8
|
-
import "./chunk-DHZ7AZKP.js";
|
|
9
|
-
|
|
10
|
-
// ../core/dist/src-UAKFXUB2.js
|
|
11
|
-
import { createRequire as BATI_core_createRequire } from "module";
|
|
12
|
-
import { fileURLToPath as BATI_fileURLToPath } from "url";
|
|
13
|
-
import { dirname as BATI_dirname } from "path";
|
|
14
|
-
import w from "path";
|
|
15
|
-
import V from "fs/promises";
|
|
16
|
-
import { fileURLToPath as d } from "url";
|
|
17
|
-
var require2 = BATI_core_createRequire(import.meta.url);
|
|
18
|
-
var __filename = BATI_fileURLToPath(import.meta.url);
|
|
19
|
-
var __dirname = BATI_dirname(__filename);
|
|
20
|
-
function i(s) {
|
|
21
|
-
if (!s || !(s instanceof URL) && typeof s != "string") throw new TypeError("Path must be a non-empty string or URL.");
|
|
22
|
-
}
|
|
23
|
-
function U(s) {
|
|
24
|
-
if (typeof s != "string" && !(s instanceof ArrayBuffer) && !ArrayBuffer.isView(s)) throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.");
|
|
25
|
-
}
|
|
26
|
-
function N(s) {
|
|
27
|
-
if (s instanceof Uint8Array) return s;
|
|
28
|
-
if (typeof s == "string") return z.encode(s);
|
|
29
|
-
if (s instanceof ArrayBuffer) return new Uint8Array(s);
|
|
30
|
-
if (ArrayBuffer.isView(s)) {
|
|
31
|
-
let t = s.buffer.slice(s.byteOffset, s.byteOffset + s.byteLength);
|
|
32
|
-
return new Uint8Array(t);
|
|
33
|
-
}
|
|
34
|
-
throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
|
|
35
|
-
}
|
|
36
|
-
var M;
|
|
37
|
-
var z;
|
|
38
|
-
var E;
|
|
39
|
-
var T;
|
|
40
|
-
var A;
|
|
41
|
-
var g;
|
|
42
|
-
var l;
|
|
43
|
-
var O = n(() => {
|
|
44
|
-
"use strict";
|
|
45
|
-
M = new TextDecoder(), z = new TextEncoder(), E = class extends Error {
|
|
46
|
-
constructor(t) {
|
|
47
|
-
super(`Method "${t}" does not exist on impl.`);
|
|
48
|
-
}
|
|
49
|
-
}, T = class extends Error {
|
|
50
|
-
constructor(t) {
|
|
51
|
-
super(`Method "${t}" is not supported on this impl.`);
|
|
52
|
-
}
|
|
53
|
-
}, A = class extends Error {
|
|
54
|
-
constructor() {
|
|
55
|
-
super("Implementation already set.");
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
g = class {
|
|
59
|
-
type;
|
|
60
|
-
data;
|
|
61
|
-
timestamp = Date.now();
|
|
62
|
-
constructor(t, e) {
|
|
63
|
-
this.type = t, this.data = e;
|
|
64
|
-
}
|
|
65
|
-
}, l = class {
|
|
66
|
-
#t;
|
|
67
|
-
#e;
|
|
68
|
-
#i = /* @__PURE__ */ new Map();
|
|
69
|
-
constructor({ impl: t }) {
|
|
70
|
-
this.#t = t, this.#e = t;
|
|
71
|
-
}
|
|
72
|
-
#s(t, ...e) {
|
|
73
|
-
for (let r of this.#i.values()) r.push(new g("call", { methodName: t, args: e }));
|
|
74
|
-
}
|
|
75
|
-
logStart(t) {
|
|
76
|
-
if (!t || typeof t != "string") throw new TypeError("Log name must be a non-empty string.");
|
|
77
|
-
if (this.#i.has(t)) throw new Error(`Log "${t}" already exists.`);
|
|
78
|
-
this.#i.set(t, []);
|
|
79
|
-
}
|
|
80
|
-
logEnd(t) {
|
|
81
|
-
if (this.#i.has(t)) {
|
|
82
|
-
let e = this.#i.get(t);
|
|
83
|
-
return this.#i.delete(t), e;
|
|
84
|
-
}
|
|
85
|
-
throw new Error(`Log "${t}" does not exist.`);
|
|
86
|
-
}
|
|
87
|
-
isBaseImpl() {
|
|
88
|
-
return this.#e === this.#t;
|
|
89
|
-
}
|
|
90
|
-
setImpl(t) {
|
|
91
|
-
if (this.#s("implSet", t), this.#e !== this.#t) throw new A();
|
|
92
|
-
this.#e = t;
|
|
93
|
-
}
|
|
94
|
-
resetImpl() {
|
|
95
|
-
this.#s("implReset"), this.#e = this.#t;
|
|
96
|
-
}
|
|
97
|
-
#n(t) {
|
|
98
|
-
if (typeof this.#e[t] != "function") throw new E(t);
|
|
99
|
-
}
|
|
100
|
-
#o(t, e) {
|
|
101
|
-
if (typeof this.#e[t] != "function") throw new T(e);
|
|
102
|
-
}
|
|
103
|
-
#r(t, ...e) {
|
|
104
|
-
return this.#s(t, ...e), this.#n(t), this.#e[t](...e);
|
|
105
|
-
}
|
|
106
|
-
#c(t, ...e) {
|
|
107
|
-
return this.#n(t), this.#e[t](...e);
|
|
108
|
-
}
|
|
109
|
-
#a(t, e, ...r) {
|
|
110
|
-
return this.#s(e, ...r), this.#o(t, e), this.#e[t](...r);
|
|
111
|
-
}
|
|
112
|
-
async text(t) {
|
|
113
|
-
i(t);
|
|
114
|
-
let e = await this.#a("bytes", "text", t);
|
|
115
|
-
return e ? M.decode(e) : void 0;
|
|
116
|
-
}
|
|
117
|
-
async json(t) {
|
|
118
|
-
i(t);
|
|
119
|
-
let e = await this.#a("bytes", "json", t);
|
|
120
|
-
return e ? JSON.parse(M.decode(e)) : void 0;
|
|
121
|
-
}
|
|
122
|
-
async arrayBuffer(t) {
|
|
123
|
-
return i(t), (await this.#a("bytes", "arrayBuffer", t))?.buffer;
|
|
124
|
-
}
|
|
125
|
-
async bytes(t) {
|
|
126
|
-
return i(t), this.#r("bytes", t);
|
|
127
|
-
}
|
|
128
|
-
async write(t, e) {
|
|
129
|
-
i(t), U(e), this.#s("write", t, e);
|
|
130
|
-
let r = N(e);
|
|
131
|
-
return this.#c("write", t, r);
|
|
132
|
-
}
|
|
133
|
-
async append(t, e) {
|
|
134
|
-
i(t), U(e), this.#s("append", t, e);
|
|
135
|
-
let r = N(e);
|
|
136
|
-
return this.#c("append", t, r);
|
|
137
|
-
}
|
|
138
|
-
async isFile(t) {
|
|
139
|
-
return i(t), this.#r("isFile", t);
|
|
140
|
-
}
|
|
141
|
-
async isDirectory(t) {
|
|
142
|
-
return i(t), this.#r("isDirectory", t);
|
|
143
|
-
}
|
|
144
|
-
async createDirectory(t) {
|
|
145
|
-
return i(t), this.#r("createDirectory", t);
|
|
146
|
-
}
|
|
147
|
-
async delete(t) {
|
|
148
|
-
return i(t), this.#r("delete", t);
|
|
149
|
-
}
|
|
150
|
-
async deleteAll(t) {
|
|
151
|
-
return i(t), this.#r("deleteAll", t);
|
|
152
|
-
}
|
|
153
|
-
async *list(t) {
|
|
154
|
-
i(t), yield* await this.#r("list", t);
|
|
155
|
-
}
|
|
156
|
-
async *walk(t, { directoryFilter: e = () => true, entryFilter: r = () => true } = {}) {
|
|
157
|
-
i(t), this.#s("walk", t, { directoryFilter: e, entryFilter: r });
|
|
158
|
-
let n2 = async function* (o, { directoryFilter: c, entryFilter: f, parentPath: L = "", depth: S = 1 }) {
|
|
159
|
-
let v;
|
|
160
|
-
try {
|
|
161
|
-
v = await this.#c("list", o);
|
|
162
|
-
} catch (a) {
|
|
163
|
-
if (a.code === "ENOENT") return;
|
|
164
|
-
throw a;
|
|
165
|
-
}
|
|
166
|
-
for await (let a of v) {
|
|
167
|
-
let u = { path: a.name, depth: S, ...a };
|
|
168
|
-
L && (u.path = `${L}/${u.path}`);
|
|
169
|
-
let p = f(u);
|
|
170
|
-
if (p.then && (p = await p), p && (yield u), a.isDirectory) {
|
|
171
|
-
let y = c(u);
|
|
172
|
-
if (y.then && (y = await y), !y) continue;
|
|
173
|
-
let j = o instanceof URL ? new URL(a.name, o.href.endsWith("/") ? o.href : `${o.href}/`) : `${o.endsWith("/") ? o : `${o}/`}${a.name}`;
|
|
174
|
-
yield* n2(j, { directoryFilter: c, entryFilter: f, parentPath: u.path, depth: S + 1 });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}.bind(this);
|
|
178
|
-
yield* n2(t, { directoryFilter: e, entryFilter: r });
|
|
179
|
-
}
|
|
180
|
-
async size(t) {
|
|
181
|
-
return i(t), this.#r("size", t);
|
|
182
|
-
}
|
|
183
|
-
async lastModified(t) {
|
|
184
|
-
return i(t), this.#r("lastModified", t);
|
|
185
|
-
}
|
|
186
|
-
async copy(t, e) {
|
|
187
|
-
return i(t), i(e), this.#r("copy", t, e);
|
|
188
|
-
}
|
|
189
|
-
async copyAll(t, e) {
|
|
190
|
-
return i(t), i(e), this.#r("copyAll", t, e);
|
|
191
|
-
}
|
|
192
|
-
async move(t, e) {
|
|
193
|
-
return i(t), i(e), this.#r("move", t, e);
|
|
194
|
-
}
|
|
195
|
-
async moveAll(t, e) {
|
|
196
|
-
return i(t), i(e), this.#r("moveAll", t, e);
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
});
|
|
200
|
-
var F = n(() => {
|
|
201
|
-
"use strict";
|
|
202
|
-
});
|
|
203
|
-
var $ = n(() => {
|
|
204
|
-
"use strict";
|
|
205
|
-
});
|
|
206
|
-
var x = n(() => {
|
|
207
|
-
"use strict";
|
|
208
|
-
O();
|
|
209
|
-
F();
|
|
210
|
-
$();
|
|
211
|
-
});
|
|
212
|
-
function W(s, t) {
|
|
213
|
-
let e = Date.now() - s.lastAttempt, r = Math.max(s.lastAttempt - s.timestamp, 1), n2 = Math.min(r * 1.2, t);
|
|
214
|
-
return e >= n2;
|
|
215
|
-
}
|
|
216
|
-
function _(s, t) {
|
|
217
|
-
return s.age > t;
|
|
218
|
-
}
|
|
219
|
-
var b;
|
|
220
|
-
var m;
|
|
221
|
-
var B = n(() => {
|
|
222
|
-
"use strict";
|
|
223
|
-
b = class {
|
|
224
|
-
id = Math.random().toString(36).slice(2);
|
|
225
|
-
fn;
|
|
226
|
-
error;
|
|
227
|
-
timestamp = Date.now();
|
|
228
|
-
lastAttempt = this.timestamp;
|
|
229
|
-
resolve;
|
|
230
|
-
reject;
|
|
231
|
-
signal;
|
|
232
|
-
constructor(t, e, r, n2, o) {
|
|
233
|
-
this.fn = t, this.error = e, this.timestamp = Date.now(), this.lastAttempt = Date.now(), this.resolve = r, this.reject = n2, this.signal = o;
|
|
234
|
-
}
|
|
235
|
-
get age() {
|
|
236
|
-
return Date.now() - this.timestamp;
|
|
237
|
-
}
|
|
238
|
-
}, m = class {
|
|
239
|
-
#t = [];
|
|
240
|
-
#e;
|
|
241
|
-
#i;
|
|
242
|
-
#s;
|
|
243
|
-
#n;
|
|
244
|
-
constructor(t, { timeout: e = 6e4, maxDelay: r = 100 } = {}) {
|
|
245
|
-
if (typeof t != "function") throw new Error("Missing function to check errors");
|
|
246
|
-
this.#n = t, this.#e = e, this.#i = r;
|
|
247
|
-
}
|
|
248
|
-
retry(t, { signal: e } = {}) {
|
|
249
|
-
e?.throwIfAborted();
|
|
250
|
-
let r;
|
|
251
|
-
try {
|
|
252
|
-
r = t();
|
|
253
|
-
} catch (n2) {
|
|
254
|
-
return Promise.reject(new Error(`Synchronous error: ${n2.message}`, { cause: n2 }));
|
|
255
|
-
}
|
|
256
|
-
return !r || typeof r.then != "function" ? Promise.reject(new Error("Result is not a promise.")) : Promise.resolve(r).catch((n2) => {
|
|
257
|
-
if (!this.#n(n2)) throw n2;
|
|
258
|
-
return new Promise((o, c) => {
|
|
259
|
-
this.#t.push(new b(t, n2, o, c, e)), e?.addEventListener("abort", () => {
|
|
260
|
-
c(e.reason);
|
|
261
|
-
}), this.#o();
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
#o() {
|
|
266
|
-
clearTimeout(this.#s), this.#s = void 0;
|
|
267
|
-
let t = this.#t.shift();
|
|
268
|
-
if (!t) return;
|
|
269
|
-
let e = () => {
|
|
270
|
-
this.#s = setTimeout(() => this.#o(), 0);
|
|
271
|
-
};
|
|
272
|
-
if (_(t, this.#e)) {
|
|
273
|
-
t.reject(t.error), e();
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
if (!W(t, this.#i)) {
|
|
277
|
-
this.#t.push(t), e();
|
|
278
|
-
return;
|
|
279
|
-
}
|
|
280
|
-
t.lastAttempt = Date.now(), Promise.resolve(t.fn()).then((r) => t.resolve(r)).catch((r) => {
|
|
281
|
-
if (!this.#n(r)) {
|
|
282
|
-
t.reject(r);
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
t.lastAttempt = Date.now(), this.#t.push(t);
|
|
286
|
-
}).finally(() => this.#o());
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
});
|
|
290
|
-
var Y;
|
|
291
|
-
var D;
|
|
292
|
-
var R;
|
|
293
|
-
var I;
|
|
294
|
-
var nt;
|
|
295
|
-
var k = n(() => {
|
|
296
|
-
"use strict";
|
|
297
|
-
x();
|
|
298
|
-
B();
|
|
299
|
-
Y = /* @__PURE__ */ new Set(["ENFILE", "EMFILE"]), D = class {
|
|
300
|
-
name;
|
|
301
|
-
isFile;
|
|
302
|
-
isDirectory;
|
|
303
|
-
isSymlink;
|
|
304
|
-
constructor(t) {
|
|
305
|
-
this.name = t.name, this.isFile = t.isFile(), this.isDirectory = t.isDirectory(), this.isSymlink = t.isSymbolicLink();
|
|
306
|
-
}
|
|
307
|
-
}, R = class {
|
|
308
|
-
#t;
|
|
309
|
-
#e;
|
|
310
|
-
constructor({ fsp: t = V } = {}) {
|
|
311
|
-
this.#t = t, this.#e = new m((e) => Y.has(e.code));
|
|
312
|
-
}
|
|
313
|
-
bytes(t) {
|
|
314
|
-
return this.#e.retry(() => this.#t.readFile(t)).then((e) => new Uint8Array(e.buffer)).catch((e) => {
|
|
315
|
-
if (e.code !== "ENOENT") throw e;
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
async write(t, e) {
|
|
319
|
-
let r = Buffer.from(e);
|
|
320
|
-
return this.#e.retry(() => this.#t.writeFile(t, r)).catch((n2) => {
|
|
321
|
-
if (n2.code === "ENOENT") {
|
|
322
|
-
let o = w.dirname(t instanceof URL ? d(t) : t);
|
|
323
|
-
return this.#t.mkdir(o, { recursive: true }).then(() => this.#t.writeFile(t, r));
|
|
324
|
-
}
|
|
325
|
-
throw n2;
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
async append(t, e) {
|
|
329
|
-
let r = Buffer.from(e);
|
|
330
|
-
return this.#e.retry(() => this.#t.appendFile(t, r)).catch((n2) => {
|
|
331
|
-
if (n2.code === "ENOENT") {
|
|
332
|
-
let o = w.dirname(t instanceof URL ? d(t) : t);
|
|
333
|
-
return this.#t.mkdir(o, { recursive: true }).then(() => this.#t.appendFile(t, r));
|
|
334
|
-
}
|
|
335
|
-
throw n2;
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
isFile(t) {
|
|
339
|
-
return this.#t.stat(t).then((e) => e.isFile()).catch((e) => {
|
|
340
|
-
if (e.code === "ENOENT") return false;
|
|
341
|
-
throw e;
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
isDirectory(t) {
|
|
345
|
-
return this.#t.stat(t).then((e) => e.isDirectory()).catch((e) => {
|
|
346
|
-
if (e.code === "ENOENT") return false;
|
|
347
|
-
throw e;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
async createDirectory(t) {
|
|
351
|
-
await this.#t.mkdir(t, { recursive: true });
|
|
352
|
-
}
|
|
353
|
-
delete(t) {
|
|
354
|
-
return this.#t.rm(t).then(() => true).catch((e) => {
|
|
355
|
-
if (e.code === "ERR_FS_EISDIR") return this.#t.rmdir(t).then(() => true);
|
|
356
|
-
if (e.code === "ENOENT") return false;
|
|
357
|
-
throw e;
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
deleteAll(t) {
|
|
361
|
-
return this.#t.rm(t, { recursive: true }).then(() => true).catch((e) => {
|
|
362
|
-
if (e.code === "ENOENT") return false;
|
|
363
|
-
throw e;
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
async *list(t) {
|
|
367
|
-
let e = await this.#t.readdir(t, { withFileTypes: true });
|
|
368
|
-
for (let r of e) yield new D(r);
|
|
369
|
-
}
|
|
370
|
-
size(t) {
|
|
371
|
-
return this.#t.stat(t).then((e) => e.size).catch((e) => {
|
|
372
|
-
if (e.code !== "ENOENT") throw e;
|
|
373
|
-
});
|
|
374
|
-
}
|
|
375
|
-
lastModified(t) {
|
|
376
|
-
return this.#t.stat(t).then((e) => e.mtime).catch((e) => {
|
|
377
|
-
if (e.code !== "ENOENT") throw e;
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
copy(t, e) {
|
|
381
|
-
return this.#t.copyFile(t, e);
|
|
382
|
-
}
|
|
383
|
-
async copyAll(t, e) {
|
|
384
|
-
if (await this.isFile(t)) return this.copy(t, e);
|
|
385
|
-
let r = t instanceof URL ? d(t) : t, n2 = e instanceof URL ? d(e) : e;
|
|
386
|
-
await this.createDirectory(e);
|
|
387
|
-
for await (let o of this.list(t)) {
|
|
388
|
-
let c = w.join(r, o.name), f = w.join(n2, o.name);
|
|
389
|
-
o.isDirectory ? await this.copyAll(c, f) : await this.copy(c, f);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
move(t, e) {
|
|
393
|
-
return this.#t.stat(t).then((r) => {
|
|
394
|
-
if (r.isDirectory()) throw new Error(`EISDIR: illegal operation on a directory, move '${t}' -> '${e}'`);
|
|
395
|
-
return this.#t.rename(t, e);
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
async moveAll(t, e) {
|
|
399
|
-
return this.#t.rename(t, e);
|
|
400
|
-
}
|
|
401
|
-
}, I = class extends l {
|
|
402
|
-
constructor({ fsp: t } = {}) {
|
|
403
|
-
super({ impl: new R({ fsp: t }) });
|
|
404
|
-
}
|
|
405
|
-
}, nt = new I();
|
|
406
|
-
});
|
|
407
|
-
var K = n(() => {
|
|
408
|
-
k();
|
|
409
|
-
x();
|
|
410
|
-
});
|
|
411
|
-
K();
|
|
412
|
-
export {
|
|
413
|
-
l as Hfs,
|
|
414
|
-
I as NodeHfs,
|
|
415
|
-
R as NodeHfsImpl,
|
|
416
|
-
nt as hfs
|
|
417
|
-
};
|