@batijs/cli 0.0.293 → 0.0.294
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 +5 -5
- package/dist/boilerplates/@batijs/auth0/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/authjs/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/aws/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +7 -7
- 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 +5 -5
- package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/compiled/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/d1/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/d1/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +1 -1
- package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +5 -5
- 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 +3 -3
- package/dist/boilerplates/@batijs/edgedb/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/edgedb/files/$package.json.js +3 -3
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +8 -8
- package/dist/boilerplates/@batijs/express/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/firebase-auth/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/firebase-auth/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/lucia-auth/files/$.env.js +4 -4
- package/dist/boilerplates/@batijs/lucia-auth/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/lucia-auth/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/mantine/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/mantine/files/$package.json.js +6 -6
- package/dist/boilerplates/@batijs/prettier/files/$package.json.js +3 -3
- 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 +3 -3
- package/dist/boilerplates/@batijs/react/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/react/files/$package.json.js +9 -9
- 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-sentry/files/$package.json.js +5 -5
- 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 +4 -4
- 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 +5 -5
- 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 +1 -1
- package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/solid/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +4 -4
- 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-sentry/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +3 -3
- package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +3 -3
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +5 -5
- package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/trpc/types/server/trpc-handler.d.ts +1 -1
- package/dist/boilerplates/@batijs/trpc/types/trpc/client.d.ts +8 -8
- package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +4 -4
- package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +3 -3
- package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +5 -5
- package/dist/boilerplates/@batijs/vue/files/$README.md.js +3 -3
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +7 -7
- 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-sentry/files/$package.json.js +5 -5
- package/dist/{chunk-VJJDTBIT.js → chunk-K3LH2C5T.js} +69320 -69095
- package/dist/index.js +17 -17
- package/dist/src-ZXRHWERC-5GKONSS7.js +406 -0
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
consola
|
|
5
5
|
} from "./chunk-FWD3UPBV.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
LKr,
|
|
8
|
+
Qas,
|
|
9
|
+
dnt,
|
|
10
10
|
export_which,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "./chunk-
|
|
11
|
+
nys,
|
|
12
|
+
q8e
|
|
13
|
+
} from "./chunk-K3LH2C5T.js";
|
|
14
14
|
import "./chunk-LU7IBQI7.js";
|
|
15
15
|
|
|
16
16
|
// index.ts
|
|
@@ -34,8 +34,8 @@ async function mergeDts({
|
|
|
34
34
|
filepath,
|
|
35
35
|
meta
|
|
36
36
|
}) {
|
|
37
|
-
const previousAst =
|
|
38
|
-
const currentAst =
|
|
37
|
+
const previousAst = q8e(previousContent);
|
|
38
|
+
const currentAst = q8e(fileContent);
|
|
39
39
|
for (const imp of previousAst.imports.$items) {
|
|
40
40
|
currentAst.imports[imp.local] = imp;
|
|
41
41
|
}
|
|
@@ -52,7 +52,7 @@ async function mergeDts({
|
|
|
52
52
|
currentAst.$ast.body.splice(index, 0, node);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
const res = await
|
|
55
|
+
const res = await Qas(currentAst.generate().code, meta, {
|
|
56
56
|
filepath
|
|
57
57
|
});
|
|
58
58
|
return res.code;
|
|
@@ -63,7 +63,7 @@ async function executeOperationFile(op, {
|
|
|
63
63
|
}) {
|
|
64
64
|
const code = await readFile(op.sourceAbsolute, { encoding: "utf-8" });
|
|
65
65
|
const filepath = relative(op.source, op.sourceAbsolute);
|
|
66
|
-
const result = await
|
|
66
|
+
const result = await Qas(code, meta, {
|
|
67
67
|
filepath
|
|
68
68
|
});
|
|
69
69
|
let fileContent = result.code;
|
|
@@ -97,7 +97,7 @@ async function transformFileAfterExec(filepath, fileContent) {
|
|
|
97
97
|
case ".js":
|
|
98
98
|
case ".tsx":
|
|
99
99
|
case ".jsx":
|
|
100
|
-
return
|
|
100
|
+
return dnt(fileContent, {
|
|
101
101
|
filepath
|
|
102
102
|
});
|
|
103
103
|
case ".env":
|
|
@@ -2542,7 +2542,7 @@ var createDefaultQueryTester = function(query, options) {
|
|
|
2542
2542
|
// package.json
|
|
2543
2543
|
var package_default = {
|
|
2544
2544
|
name: "@batijs/cli",
|
|
2545
|
-
version: "0.0.
|
|
2545
|
+
version: "0.0.294",
|
|
2546
2546
|
type: "module",
|
|
2547
2547
|
scripts: {
|
|
2548
2548
|
"check-types": "tsc --noEmit",
|
|
@@ -2646,7 +2646,7 @@ Choose one of them, or simply remove selected Server`
|
|
|
2646
2646
|
var __filename = fileURLToPath(import.meta.url);
|
|
2647
2647
|
var __dirname = dirname(__filename);
|
|
2648
2648
|
var isWin2 = process.platform === "win32";
|
|
2649
|
-
var pm =
|
|
2649
|
+
var pm = nys();
|
|
2650
2650
|
function boilerplatesDir() {
|
|
2651
2651
|
if (existsSync2(join(__dirname, "boilerplates", "boilerplates.json"))) {
|
|
2652
2652
|
return join(__dirname, "boilerplates");
|
|
@@ -2680,10 +2680,10 @@ function findDescription(key) {
|
|
|
2680
2680
|
}
|
|
2681
2681
|
}
|
|
2682
2682
|
function printOK(dist, flags2) {
|
|
2683
|
-
const arrow0 =
|
|
2684
|
-
const book0 =
|
|
2685
|
-
const list3 =
|
|
2686
|
-
const cmd3 =
|
|
2683
|
+
const arrow0 = LKr("\u2192", blueBright);
|
|
2684
|
+
const book0 = LKr("\u{1F4DA}", blueBright);
|
|
2685
|
+
const list3 = LKr("-", void 0, 3);
|
|
2686
|
+
const cmd3 = LKr("$", gray, 3);
|
|
2687
2687
|
console.log(bold(`${green("\u2713")} Project created at ${cyan(dist)} with:`));
|
|
2688
2688
|
console.log(list3(green("Vike")));
|
|
2689
2689
|
for (const key of flags2) {
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
n
|
|
4
|
+
} from "./chunk-LU7IBQI7.js";
|
|
5
|
+
|
|
6
|
+
// ../core/dist/src-ZXRHWERC.js
|
|
7
|
+
import { createRequire } from "module";
|
|
8
|
+
import { fileURLToPath as BATI_fileURLToPath } from "node:url";
|
|
9
|
+
import { dirname as BATI_dirname } from "node:path";
|
|
10
|
+
import w from "node:path";
|
|
11
|
+
import _ from "node:fs/promises";
|
|
12
|
+
import { fileURLToPath as d } from "node:url";
|
|
13
|
+
var require2 = createRequire(import.meta.url);
|
|
14
|
+
var __filename = BATI_fileURLToPath(import.meta.url);
|
|
15
|
+
var __dirname = BATI_dirname(__filename);
|
|
16
|
+
function i(s) {
|
|
17
|
+
if (!s || !(s instanceof URL) && typeof s != "string") throw new TypeError("Path must be a non-empty string or URL.");
|
|
18
|
+
}
|
|
19
|
+
function M(s) {
|
|
20
|
+
if (typeof s != "string" && !(s instanceof ArrayBuffer) && !ArrayBuffer.isView(s)) throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.");
|
|
21
|
+
}
|
|
22
|
+
function U(s) {
|
|
23
|
+
if (s instanceof Uint8Array) return s;
|
|
24
|
+
if (typeof s == "string") return j.encode(s);
|
|
25
|
+
if (s instanceof ArrayBuffer) return new Uint8Array(s);
|
|
26
|
+
if (ArrayBuffer.isView(s)) {
|
|
27
|
+
let t = s.buffer.slice(s.byteOffset, s.byteOffset + s.byteLength);
|
|
28
|
+
return new Uint8Array(t);
|
|
29
|
+
}
|
|
30
|
+
throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.");
|
|
31
|
+
}
|
|
32
|
+
var v;
|
|
33
|
+
var j;
|
|
34
|
+
var E;
|
|
35
|
+
var T;
|
|
36
|
+
var A;
|
|
37
|
+
var g;
|
|
38
|
+
var u;
|
|
39
|
+
var F = n(() => {
|
|
40
|
+
"use strict";
|
|
41
|
+
v = new TextDecoder(), j = new TextEncoder(), E = class extends Error {
|
|
42
|
+
constructor(t) {
|
|
43
|
+
super(`Method "${t}" does not exist on impl.`);
|
|
44
|
+
}
|
|
45
|
+
}, T = class extends Error {
|
|
46
|
+
constructor(t) {
|
|
47
|
+
super(`Method "${t}" is not supported on this impl.`);
|
|
48
|
+
}
|
|
49
|
+
}, A = class extends Error {
|
|
50
|
+
constructor() {
|
|
51
|
+
super("Implementation already set.");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
g = class {
|
|
55
|
+
type;
|
|
56
|
+
data;
|
|
57
|
+
timestamp = Date.now();
|
|
58
|
+
constructor(t, e) {
|
|
59
|
+
this.type = t, this.data = e;
|
|
60
|
+
}
|
|
61
|
+
}, u = class {
|
|
62
|
+
#t;
|
|
63
|
+
#e;
|
|
64
|
+
#i = /* @__PURE__ */ new Map();
|
|
65
|
+
constructor({ impl: t }) {
|
|
66
|
+
this.#t = t, this.#e = t;
|
|
67
|
+
}
|
|
68
|
+
#s(t, ...e) {
|
|
69
|
+
for (let r of this.#i.values()) r.push(new g("call", { methodName: t, args: e }));
|
|
70
|
+
}
|
|
71
|
+
logStart(t) {
|
|
72
|
+
if (!t || typeof t != "string") throw new TypeError("Log name must be a non-empty string.");
|
|
73
|
+
if (this.#i.has(t)) throw new Error(`Log "${t}" already exists.`);
|
|
74
|
+
this.#i.set(t, []);
|
|
75
|
+
}
|
|
76
|
+
logEnd(t) {
|
|
77
|
+
if (this.#i.has(t)) {
|
|
78
|
+
let e = this.#i.get(t);
|
|
79
|
+
return this.#i.delete(t), e;
|
|
80
|
+
}
|
|
81
|
+
throw new Error(`Log "${t}" does not exist.`);
|
|
82
|
+
}
|
|
83
|
+
isBaseImpl() {
|
|
84
|
+
return this.#e === this.#t;
|
|
85
|
+
}
|
|
86
|
+
setImpl(t) {
|
|
87
|
+
if (this.#s("implSet", t), this.#e !== this.#t) throw new A();
|
|
88
|
+
this.#e = t;
|
|
89
|
+
}
|
|
90
|
+
resetImpl() {
|
|
91
|
+
this.#s("implReset"), this.#e = this.#t;
|
|
92
|
+
}
|
|
93
|
+
#n(t) {
|
|
94
|
+
if (typeof this.#e[t] != "function") throw new E(t);
|
|
95
|
+
}
|
|
96
|
+
#o(t, e) {
|
|
97
|
+
if (typeof this.#e[t] != "function") throw new T(e);
|
|
98
|
+
}
|
|
99
|
+
#r(t, ...e) {
|
|
100
|
+
return this.#s(t, ...e), this.#n(t), this.#e[t](...e);
|
|
101
|
+
}
|
|
102
|
+
#c(t, ...e) {
|
|
103
|
+
return this.#n(t), this.#e[t](...e);
|
|
104
|
+
}
|
|
105
|
+
#a(t, e, ...r) {
|
|
106
|
+
return this.#s(e, ...r), this.#o(t, e), this.#e[t](...r);
|
|
107
|
+
}
|
|
108
|
+
async text(t) {
|
|
109
|
+
i(t);
|
|
110
|
+
let e = await this.#a("bytes", "text", t);
|
|
111
|
+
return e ? v.decode(e) : void 0;
|
|
112
|
+
}
|
|
113
|
+
async json(t) {
|
|
114
|
+
i(t);
|
|
115
|
+
let e = await this.#a("bytes", "json", t);
|
|
116
|
+
return e ? JSON.parse(v.decode(e)) : void 0;
|
|
117
|
+
}
|
|
118
|
+
async arrayBuffer(t) {
|
|
119
|
+
return i(t), (await this.#a("bytes", "arrayBuffer", t))?.buffer;
|
|
120
|
+
}
|
|
121
|
+
async bytes(t) {
|
|
122
|
+
return i(t), this.#r("bytes", t);
|
|
123
|
+
}
|
|
124
|
+
async write(t, e) {
|
|
125
|
+
i(t), M(e), this.#s("write", t, e);
|
|
126
|
+
let r = U(e);
|
|
127
|
+
return this.#c("write", t, r);
|
|
128
|
+
}
|
|
129
|
+
async append(t, e) {
|
|
130
|
+
i(t), M(e), this.#s("append", t, e);
|
|
131
|
+
let r = U(e);
|
|
132
|
+
return this.#c("append", t, r);
|
|
133
|
+
}
|
|
134
|
+
async isFile(t) {
|
|
135
|
+
return i(t), this.#r("isFile", t);
|
|
136
|
+
}
|
|
137
|
+
async isDirectory(t) {
|
|
138
|
+
return i(t), this.#r("isDirectory", t);
|
|
139
|
+
}
|
|
140
|
+
async createDirectory(t) {
|
|
141
|
+
return i(t), this.#r("createDirectory", t);
|
|
142
|
+
}
|
|
143
|
+
async delete(t) {
|
|
144
|
+
return i(t), this.#r("delete", t);
|
|
145
|
+
}
|
|
146
|
+
async deleteAll(t) {
|
|
147
|
+
return i(t), this.#r("deleteAll", t);
|
|
148
|
+
}
|
|
149
|
+
async *list(t) {
|
|
150
|
+
i(t), yield* await this.#r("list", t);
|
|
151
|
+
}
|
|
152
|
+
async *walk(t, { directoryFilter: e = () => true, entryFilter: r = () => true } = {}) {
|
|
153
|
+
i(t), this.#s("walk", t, { directoryFilter: e, entryFilter: r });
|
|
154
|
+
let n2 = async function* (o, { directoryFilter: c, entryFilter: l, parentPath: L = "", depth: S = 1 }) {
|
|
155
|
+
for await (let f of this.#c("list", o)) {
|
|
156
|
+
let h = { path: f.name, depth: S, ...f };
|
|
157
|
+
L && (h.path = `${L}/${h.path}`);
|
|
158
|
+
let p = l(h);
|
|
159
|
+
if (p.then && (p = await p), p && (yield h), f.isDirectory) {
|
|
160
|
+
let y = c(h);
|
|
161
|
+
if (y.then && (y = await y), !y) continue;
|
|
162
|
+
let k = o instanceof URL ? new URL(f.name, o.href.endsWith("/") ? o.href : `${o.href}/`) : `${o.endsWith("/") ? o : `${o}/`}${f.name}`;
|
|
163
|
+
yield* n2(k, { directoryFilter: c, entryFilter: l, parentPath: h.path, depth: S + 1 });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}.bind(this);
|
|
167
|
+
yield* n2(t, { directoryFilter: e, entryFilter: r });
|
|
168
|
+
}
|
|
169
|
+
async size(t) {
|
|
170
|
+
return i(t), this.#r("size", t);
|
|
171
|
+
}
|
|
172
|
+
async lastModified(t) {
|
|
173
|
+
return i(t), this.#r("lastModified", t);
|
|
174
|
+
}
|
|
175
|
+
async copy(t, e) {
|
|
176
|
+
return i(t), i(e), this.#r("copy", t, e);
|
|
177
|
+
}
|
|
178
|
+
async copyAll(t, e) {
|
|
179
|
+
return i(t), i(e), this.#r("copyAll", t, e);
|
|
180
|
+
}
|
|
181
|
+
async move(t, e) {
|
|
182
|
+
return i(t), i(e), this.#r("move", t, e);
|
|
183
|
+
}
|
|
184
|
+
async moveAll(t, e) {
|
|
185
|
+
return i(t), i(e), this.#r("moveAll", t, e);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
});
|
|
189
|
+
var O = n(() => {
|
|
190
|
+
"use strict";
|
|
191
|
+
});
|
|
192
|
+
var $ = n(() => {
|
|
193
|
+
"use strict";
|
|
194
|
+
});
|
|
195
|
+
var x = n(() => {
|
|
196
|
+
"use strict";
|
|
197
|
+
F();
|
|
198
|
+
O();
|
|
199
|
+
$();
|
|
200
|
+
});
|
|
201
|
+
function z(s, t) {
|
|
202
|
+
let e = Date.now() - s.lastAttempt, r = Math.max(s.lastAttempt - s.timestamp, 1), n2 = Math.min(r * 1.2, t);
|
|
203
|
+
return e >= n2;
|
|
204
|
+
}
|
|
205
|
+
function W(s, t) {
|
|
206
|
+
return s.age > t;
|
|
207
|
+
}
|
|
208
|
+
var b;
|
|
209
|
+
var m;
|
|
210
|
+
var N = n(() => {
|
|
211
|
+
"use strict";
|
|
212
|
+
b = class {
|
|
213
|
+
id = Math.random().toString(36).slice(2);
|
|
214
|
+
fn;
|
|
215
|
+
error;
|
|
216
|
+
timestamp = Date.now();
|
|
217
|
+
lastAttempt = this.timestamp;
|
|
218
|
+
resolve;
|
|
219
|
+
reject;
|
|
220
|
+
signal;
|
|
221
|
+
constructor(t, e, r, n2, o) {
|
|
222
|
+
this.fn = t, this.error = e, this.timestamp = Date.now(), this.lastAttempt = Date.now(), this.resolve = r, this.reject = n2, this.signal = o;
|
|
223
|
+
}
|
|
224
|
+
get age() {
|
|
225
|
+
return Date.now() - this.timestamp;
|
|
226
|
+
}
|
|
227
|
+
}, m = class {
|
|
228
|
+
#t = [];
|
|
229
|
+
#e;
|
|
230
|
+
#i;
|
|
231
|
+
#s;
|
|
232
|
+
#n;
|
|
233
|
+
constructor(t, { timeout: e = 6e4, maxDelay: r = 100 } = {}) {
|
|
234
|
+
if (typeof t != "function") throw new Error("Missing function to check errors");
|
|
235
|
+
this.#n = t, this.#e = e, this.#i = r;
|
|
236
|
+
}
|
|
237
|
+
retry(t, { signal: e } = {}) {
|
|
238
|
+
e?.throwIfAborted();
|
|
239
|
+
let r;
|
|
240
|
+
try {
|
|
241
|
+
r = t();
|
|
242
|
+
} catch (n2) {
|
|
243
|
+
return Promise.reject(new Error(`Synchronous error: ${n2.message}`, { cause: n2 }));
|
|
244
|
+
}
|
|
245
|
+
return !r || typeof r.then != "function" ? Promise.reject(new Error("Result is not a promise.")) : Promise.resolve(r).catch((n2) => {
|
|
246
|
+
if (!this.#n(n2)) throw n2;
|
|
247
|
+
return new Promise((o, c) => {
|
|
248
|
+
this.#t.push(new b(t, n2, o, c, e)), e?.addEventListener("abort", () => {
|
|
249
|
+
c(e.reason);
|
|
250
|
+
}), this.#o();
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
#o() {
|
|
255
|
+
clearTimeout(this.#s), this.#s = void 0;
|
|
256
|
+
let t = this.#t.shift();
|
|
257
|
+
if (!t) return;
|
|
258
|
+
let e = () => {
|
|
259
|
+
this.#s = setTimeout(() => this.#o(), 0);
|
|
260
|
+
};
|
|
261
|
+
if (W(t, this.#e)) {
|
|
262
|
+
t.reject(t.error), e();
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
if (!z(t, this.#i)) {
|
|
266
|
+
this.#t.push(t), e();
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
t.lastAttempt = Date.now(), Promise.resolve(t.fn()).then((r) => t.resolve(r)).catch((r) => {
|
|
270
|
+
if (!this.#n(r)) {
|
|
271
|
+
t.reject(r);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
t.lastAttempt = Date.now(), this.#t.push(t);
|
|
275
|
+
}).finally(() => this.#o());
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
});
|
|
279
|
+
var V;
|
|
280
|
+
var D;
|
|
281
|
+
var R;
|
|
282
|
+
var I;
|
|
283
|
+
var it;
|
|
284
|
+
var B = n(() => {
|
|
285
|
+
"use strict";
|
|
286
|
+
x();
|
|
287
|
+
N();
|
|
288
|
+
V = /* @__PURE__ */ new Set(["ENFILE", "EMFILE"]), D = class {
|
|
289
|
+
name;
|
|
290
|
+
isFile;
|
|
291
|
+
isDirectory;
|
|
292
|
+
isSymlink;
|
|
293
|
+
constructor(t) {
|
|
294
|
+
this.name = t.name, this.isFile = t.isFile(), this.isDirectory = t.isDirectory(), this.isSymlink = t.isSymbolicLink();
|
|
295
|
+
}
|
|
296
|
+
}, R = class {
|
|
297
|
+
#t;
|
|
298
|
+
#e;
|
|
299
|
+
constructor({ fsp: t = _ } = {}) {
|
|
300
|
+
this.#t = t, this.#e = new m((e) => V.has(e.code));
|
|
301
|
+
}
|
|
302
|
+
bytes(t) {
|
|
303
|
+
return this.#e.retry(() => this.#t.readFile(t)).then((e) => new Uint8Array(e.buffer)).catch((e) => {
|
|
304
|
+
if (e.code !== "ENOENT") throw e;
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
async write(t, e) {
|
|
308
|
+
let r = Buffer.from(e);
|
|
309
|
+
return this.#e.retry(() => this.#t.writeFile(t, r)).catch((n2) => {
|
|
310
|
+
if (n2.code === "ENOENT") {
|
|
311
|
+
let o = w.dirname(t instanceof URL ? d(t) : t);
|
|
312
|
+
return this.#t.mkdir(o, { recursive: true }).then(() => this.#t.writeFile(t, r));
|
|
313
|
+
}
|
|
314
|
+
throw n2;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
async append(t, e) {
|
|
318
|
+
let r = Buffer.from(e);
|
|
319
|
+
return this.#e.retry(() => this.#t.appendFile(t, r)).catch((n2) => {
|
|
320
|
+
if (n2.code === "ENOENT") {
|
|
321
|
+
let o = w.dirname(t instanceof URL ? d(t) : t);
|
|
322
|
+
return this.#t.mkdir(o, { recursive: true }).then(() => this.#t.appendFile(t, r));
|
|
323
|
+
}
|
|
324
|
+
throw n2;
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
isFile(t) {
|
|
328
|
+
return this.#t.stat(t).then((e) => e.isFile()).catch((e) => {
|
|
329
|
+
if (e.code === "ENOENT") return false;
|
|
330
|
+
throw e;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
isDirectory(t) {
|
|
334
|
+
return this.#t.stat(t).then((e) => e.isDirectory()).catch((e) => {
|
|
335
|
+
if (e.code === "ENOENT") return false;
|
|
336
|
+
throw e;
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async createDirectory(t) {
|
|
340
|
+
await this.#t.mkdir(t, { recursive: true });
|
|
341
|
+
}
|
|
342
|
+
delete(t) {
|
|
343
|
+
return this.#t.rm(t).then(() => true).catch((e) => {
|
|
344
|
+
if (e.code === "ERR_FS_EISDIR") return this.#t.rmdir(t).then(() => true);
|
|
345
|
+
if (e.code === "ENOENT") return false;
|
|
346
|
+
throw e;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
deleteAll(t) {
|
|
350
|
+
return this.#t.rm(t, { recursive: true }).then(() => true).catch((e) => {
|
|
351
|
+
if (e.code === "ENOENT") return false;
|
|
352
|
+
throw e;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
async *list(t) {
|
|
356
|
+
let e = await this.#t.readdir(t, { withFileTypes: true });
|
|
357
|
+
for (let r of e) yield new D(r);
|
|
358
|
+
}
|
|
359
|
+
size(t) {
|
|
360
|
+
return this.#t.stat(t).then((e) => e.size).catch((e) => {
|
|
361
|
+
if (e.code !== "ENOENT") throw e;
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
lastModified(t) {
|
|
365
|
+
return this.#t.stat(t).then((e) => e.mtime).catch((e) => {
|
|
366
|
+
if (e.code !== "ENOENT") throw e;
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
copy(t, e) {
|
|
370
|
+
return this.#t.copyFile(t, e);
|
|
371
|
+
}
|
|
372
|
+
async copyAll(t, e) {
|
|
373
|
+
if (await this.isFile(t)) return this.copy(t, e);
|
|
374
|
+
let r = t instanceof URL ? d(t) : t, n2 = e instanceof URL ? d(e) : e;
|
|
375
|
+
await this.createDirectory(e);
|
|
376
|
+
for await (let o of this.list(t)) {
|
|
377
|
+
let c = w.join(r, o.name), l = w.join(n2, o.name);
|
|
378
|
+
o.isDirectory ? await this.copyAll(c, l) : await this.copy(c, l);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
move(t, e) {
|
|
382
|
+
return this.#t.stat(t).then((r) => {
|
|
383
|
+
if (r.isDirectory()) throw new Error(`EISDIR: illegal operation on a directory, move '${t}' -> '${e}'`);
|
|
384
|
+
return this.#t.rename(t, e);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
async moveAll(t, e) {
|
|
388
|
+
return this.#t.rename(t, e);
|
|
389
|
+
}
|
|
390
|
+
}, I = class extends u {
|
|
391
|
+
constructor({ fsp: t } = {}) {
|
|
392
|
+
super({ impl: new R({ fsp: t }) });
|
|
393
|
+
}
|
|
394
|
+
}, it = new I();
|
|
395
|
+
});
|
|
396
|
+
var Y = n(() => {
|
|
397
|
+
B();
|
|
398
|
+
x();
|
|
399
|
+
});
|
|
400
|
+
Y();
|
|
401
|
+
export {
|
|
402
|
+
u as Hfs,
|
|
403
|
+
I as NodeHfs,
|
|
404
|
+
R as NodeHfsImpl,
|
|
405
|
+
it as hfs
|
|
406
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@batijs/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.294",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"description": "Next-gen scaffolder. Get started with fully-functional apps, and choose any tool you want",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"typescript": "^5.6.2",
|
|
21
21
|
"unplugin-purge-polyfills": "^0.0.7",
|
|
22
22
|
"vite": "^5.4.8",
|
|
23
|
-
"@batijs/build": "0.0.
|
|
24
|
-
"@batijs/compile": "0.0.
|
|
23
|
+
"@batijs/build": "0.0.294",
|
|
24
|
+
"@batijs/compile": "0.0.294"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@batijs/core": "0.0.
|
|
28
|
-
"@batijs/features": "0.0.
|
|
27
|
+
"@batijs/core": "0.0.294",
|
|
28
|
+
"@batijs/features": "0.0.294"
|
|
29
29
|
},
|
|
30
30
|
"bin": "./dist/index.js",
|
|
31
31
|
"exports": {
|