@gera2ld/common-node 0.0.1

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/cgi.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export interface ICGIConfig {
2
+ cgiDir: string;
3
+ runnerMap: Record<string, string[]>;
4
+ env: Record<string, string>;
5
+ timeout: number;
6
+ disallowedPattern: {
7
+ test: (str: string) => boolean;
8
+ };
9
+ }
10
+ export declare const defaultConfig: ICGIConfig;
11
+ export declare function createCGIHandler(overrideConfig: Partial<ICGIConfig>, options?: {
12
+ log?: (str: string) => void;
13
+ }): (request: Request) => Promise<Response>;
package/dist/cli.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ import { type SpawnOptions } from 'node:child_process';
2
+ export interface ICommandOutput {
3
+ success: boolean;
4
+ code: number | null;
5
+ signal: string | null;
6
+ stdout: () => Promise<Uint8Array>;
7
+ stderr: () => Promise<Uint8Array>;
8
+ }
9
+ export declare class CommandError extends Error {
10
+ output: ICommandOutput;
11
+ constructor(output: ICommandOutput);
12
+ }
13
+ type StdioValue = 'inherit' | 'ignore' | 'pipe';
14
+ type StdioTuple = [StdioValue, StdioValue, StdioValue];
15
+ export declare function runCommand(args: string[], commandOptions?: SpawnOptions & {
16
+ stdio?: StdioTuple;
17
+ }, extraOptions?: {
18
+ ensureSuccess?: boolean;
19
+ stdin?: Uint8Array | ArrayBuffer | string;
20
+ buffer?: 'stdout' | 'stderr' | boolean;
21
+ }): Promise<ICommandOutput>;
22
+ export declare function readStdIn(): Promise<NonSharedBuffer | undefined>;
23
+ export {};
package/dist/env.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export declare function ensureEnv(key: string): string;
2
+ export declare function ensureEnvs(keys: string[]): Record<string, string>;
@@ -0,0 +1,5 @@
1
+ export * from './cgi';
2
+ export * from './cli';
3
+ export * from './env';
4
+ export * from './kv';
5
+ export * from './sqlite-common';
package/dist/index.js ADDED
@@ -0,0 +1,415 @@
1
+ import { spawn as D } from "node:child_process";
2
+ import { stat as A, mkdir as v, readFile as q, writeFile as U, readdir as S, rm as P, access as L, rename as $ } from "node:fs/promises";
3
+ import { resolve as C, extname as z, dirname as g, normalize as K, join as d } from "node:path";
4
+ import R from "node:process";
5
+ import { Readable as E } from "node:stream";
6
+ import { buffer as k } from "node:stream/consumers";
7
+ import { isatty as O } from "node:tty";
8
+ function W(r) {
9
+ return new TextEncoder().encode(r);
10
+ }
11
+ function b() {
12
+ const r = {
13
+ status: "pending"
14
+ };
15
+ return r.promise = new Promise((t, e) => {
16
+ r.resolve = t, r.reject = e;
17
+ }), r.promise.then(
18
+ () => {
19
+ r.status = "resolved";
20
+ },
21
+ () => {
22
+ r.status = "rejected";
23
+ }
24
+ ), r;
25
+ }
26
+ const x = new Uint8Array([13, 10]);
27
+ class J {
28
+ buffer = new Uint8Array(0);
29
+ requests = [];
30
+ isClosed = !1;
31
+ read(t = 8192) {
32
+ const e = b();
33
+ return this.requests.push({
34
+ deferred: e,
35
+ handle: () => {
36
+ const s = Math.min(t, this.buffer.length), a = this.buffer.subarray(0, s);
37
+ return this.buffer = this.buffer.subarray(s), e.resolve(a), !0;
38
+ }
39
+ }), this.processBuffer(), e.promise;
40
+ }
41
+ readExact(t) {
42
+ const e = b();
43
+ return this.requests.push({
44
+ deferred: e,
45
+ handle: () => {
46
+ if (t > this.buffer.length) return !1;
47
+ const s = this.buffer.subarray(0, t);
48
+ return this.buffer = this.buffer.subarray(t), e.resolve(s), !0;
49
+ }
50
+ }), this.processBuffer(), e.promise;
51
+ }
52
+ readUntil(t = x) {
53
+ typeof t == "string" && (t = W(t));
54
+ const e = b();
55
+ return this.requests.push({
56
+ deferred: e,
57
+ handle: () => {
58
+ const s = G(this.buffer, t);
59
+ if (s < 0) return !1;
60
+ const a = s + t.length, n = this.buffer.subarray(0, a);
61
+ return this.buffer = this.buffer.subarray(a), e.resolve(n), !0;
62
+ }
63
+ }), this.processBuffer(), e.promise;
64
+ }
65
+ feed(t) {
66
+ if (this.isClosed) throw new Error("Buffer is closed");
67
+ this.buffer = V(this.buffer, t), this.processBuffer();
68
+ }
69
+ close() {
70
+ this.isClosed = !0, this.processBuffer();
71
+ }
72
+ processBuffer() {
73
+ for (; this.requests.length; ) {
74
+ const t = this.requests[0];
75
+ if (!t.handle())
76
+ if (this.isClosed)
77
+ t.deferred.reject(new Error("Buffer is closed"));
78
+ else break;
79
+ this.requests.shift();
80
+ }
81
+ }
82
+ }
83
+ function V(r, t) {
84
+ const e = new Uint8Array(r.length + t.length);
85
+ return e.set(r, 0), e.set(t, r.length), e;
86
+ }
87
+ function G(r, t) {
88
+ if (!t.length) return 0;
89
+ for (let e = 0; e <= r.length - t.length; e += 1) {
90
+ let s;
91
+ for (s = 0; s < t.length && r[e + s] === t[s]; s += 1)
92
+ ;
93
+ if (s === t.length) return e;
94
+ }
95
+ return -1;
96
+ }
97
+ const Q = {
98
+ cgiDir: R.env.CGI_DIR || "cgi",
99
+ runnerMap: {
100
+ ".js": ["node"],
101
+ ".sh": ["bash"]
102
+ },
103
+ env: {},
104
+ timeout: 1e4,
105
+ // Do not allow directories or files starting with `.` or `_`
106
+ disallowedPattern: /\/[._]/
107
+ };
108
+ function it(r, t) {
109
+ return async function(s) {
110
+ const a = new URL(s.url), n = "." + C(a.pathname), i = {
111
+ ...Q,
112
+ ...r
113
+ };
114
+ if (i.disallowedPattern.test(n))
115
+ return new Response(null, { status: 403 });
116
+ const o = C(i.cgiDir, n);
117
+ try {
118
+ await A(o);
119
+ } catch {
120
+ return new Response(null, { status: 404 });
121
+ }
122
+ const u = i.runnerMap[z(o)];
123
+ try {
124
+ if (!u) throw new Error("Unsupported command");
125
+ t?.log?.(`Run hook: ${n}`);
126
+ const [f, ...w] = [...u, o], c = D(f, w, {
127
+ cwd: g(o),
128
+ env: {
129
+ ...R.env,
130
+ ...i.env,
131
+ HTTP_METHOD: s.method,
132
+ HTTP_URL: s.url,
133
+ HTTP_HEADERS: [...s.headers.entries()].map((l) => `${l[0]}: ${l[1]}`).join(`
134
+ `)
135
+ },
136
+ stdio: ["pipe", "pipe", "inherit"],
137
+ timeout: i.timeout
138
+ });
139
+ s.body ? E.fromWeb(s.body).pipe(c.stdin) : c.stdin.end();
140
+ let y = !1;
141
+ const h = new J(), N = h.readUntil(`
142
+
143
+ `).finally(() => {
144
+ y = !0;
145
+ });
146
+ for await (const l of c.stdout)
147
+ if (h.feed(l), y) break;
148
+ y || h.close();
149
+ const B = await N, M = JSON.parse(new TextDecoder().decode(B)), { status: m, ...j } = M;
150
+ let p = m ? +m : 200;
151
+ if (isNaN(p) || p < 100 || p > 999)
152
+ throw new Error(`Invalid status code: ${m}`);
153
+ c.exitCode && (console.error("Script exit code:", c.exitCode), p = 500);
154
+ const F = E.toWeb(
155
+ E.from(
156
+ (async function* () {
157
+ for (; ; ) {
158
+ const l = await h.read();
159
+ if (!l.length) break;
160
+ yield l;
161
+ }
162
+ for await (const l of c.stdout)
163
+ yield l;
164
+ })()
165
+ )
166
+ );
167
+ return new Response(F, {
168
+ status: p,
169
+ headers: j
170
+ });
171
+ } catch (f) {
172
+ return t?.log?.(`Error: ${f}`), new Response("Internal server error", {
173
+ status: 500
174
+ });
175
+ }
176
+ };
177
+ }
178
+ class X extends Error {
179
+ constructor(t) {
180
+ super(`Command exit code: ${t.code}`), this.output = t;
181
+ }
182
+ }
183
+ async function ot(r, t, e) {
184
+ const s = e?.ensureSuccess ?? !0, a = [
185
+ ...t?.stdio || ["ignore", "inherit", "inherit"]
186
+ ];
187
+ e?.stdin && (a[0] = "pipe"), e?.buffer && (e.buffer !== "stderr" && (a[1] = "pipe"), e.buffer !== "stdout" && (a[2] = "pipe"));
188
+ const n = D(r[0], r.slice(1), {
189
+ ...t,
190
+ stdio: a
191
+ });
192
+ if (e?.stdin && n.stdin) {
193
+ const c = typeof e.stdin == "string" ? new TextEncoder().encode(e.stdin) : e.stdin instanceof ArrayBuffer ? new Uint8Array(e.stdin) : e.stdin;
194
+ n.stdin.write(c), n.stdin.end();
195
+ }
196
+ const i = n.stdout && k(n.stdout), o = n.stderr && k(n.stderr), u = await new Promise(
197
+ (c) => n.on("exit", (y, h) => {
198
+ c({ code: y, signal: h });
199
+ })
200
+ ), f = !u.code && !u.signal, w = {
201
+ success: f,
202
+ code: u.code,
203
+ signal: u.signal,
204
+ async stdout() {
205
+ if (!i) throw new Error("stdout is not available");
206
+ return i;
207
+ },
208
+ async stderr() {
209
+ if (!o) throw new Error("stderr is not available");
210
+ return o;
211
+ }
212
+ };
213
+ if (s && !f)
214
+ throw new X(w);
215
+ return w;
216
+ }
217
+ async function ct() {
218
+ return O(process.stdin.fd) ? void 0 : await k(process.stdin);
219
+ }
220
+ function _(r) {
221
+ const t = R.env[r];
222
+ if (!t)
223
+ throw new Error(`Missing environment variable: ${r}`);
224
+ return t;
225
+ }
226
+ function ut(r) {
227
+ const t = {}, e = [];
228
+ for (const s of r)
229
+ try {
230
+ const a = _(s);
231
+ t[s] = a;
232
+ } catch {
233
+ e.push(s);
234
+ }
235
+ if (e.length)
236
+ throw new Error(`Missing environment variables: ${e.join(", ")}`);
237
+ return t;
238
+ }
239
+ class T {
240
+ constructor(t, e) {
241
+ this.root = t, this.options = { ...T.defaultOptions, ...e };
242
+ }
243
+ static defaultOptions = {
244
+ pathToKey: (t) => t.endsWith(".txt") ? t.slice(0, -4) : void 0,
245
+ keyToPath: (t) => t + ".txt"
246
+ };
247
+ static async open(t = ".", e) {
248
+ return await v(t, { recursive: !0 }), new T(t, e);
249
+ }
250
+ options;
251
+ normalizeKey(t) {
252
+ const e = K("./" + this.options.keyToPath(t)).replaceAll(
253
+ "\\",
254
+ "/"
255
+ );
256
+ if (e.startsWith(".")) throw new Error("Invalid key");
257
+ return e;
258
+ }
259
+ async get(t) {
260
+ const e = d(this.root, this.normalizeKey(t));
261
+ try {
262
+ return await q(e, "utf8");
263
+ } catch {
264
+ }
265
+ }
266
+ async set(t, e) {
267
+ const s = d(this.root, this.normalizeKey(t));
268
+ await v(g(s), { recursive: !0 }), await U(s, e);
269
+ }
270
+ async *loadDir(t) {
271
+ const e = d(this.root, t);
272
+ for (const s of await S(e)) {
273
+ const a = d(e, s), n = await A(a), i = d(t, s);
274
+ if (n.isDirectory())
275
+ yield* this.loadDir(i);
276
+ else {
277
+ const o = this.options.pathToKey(i);
278
+ o && (yield o);
279
+ }
280
+ }
281
+ }
282
+ async keys() {
283
+ const t = [];
284
+ for await (const e of this.loadDir(""))
285
+ t.push(e);
286
+ return t;
287
+ }
288
+ async removeEmptyDirs(t) {
289
+ const e = [this.root, ...t.split("/")];
290
+ for (e.pop(); e.length > 1; ) {
291
+ const s = d(...e);
292
+ if ((await S(s)).length) break;
293
+ await P(s);
294
+ }
295
+ }
296
+ async del(t) {
297
+ const e = this.normalizeKey(t), s = d(this.root, e);
298
+ await P(s), await this.removeEmptyDirs(e);
299
+ }
300
+ async rename(t, e) {
301
+ const s = this.normalizeKey(t), a = this.normalizeKey(e), n = d(this.root, s), i = d(this.root, a);
302
+ await L(n), await v(g(i), { recursive: !0 }), await $(n, i);
303
+ }
304
+ async all() {
305
+ const t = [];
306
+ for await (const e of this.loadDir(""))
307
+ t.push({
308
+ key: e,
309
+ value: await this.get(e) || ""
310
+ });
311
+ return t;
312
+ }
313
+ }
314
+ class I {
315
+ constructor(t, e = {}) {
316
+ this.path = t, this.data = e;
317
+ }
318
+ static async open(t = "kv.json") {
319
+ const e = new I(t);
320
+ return await e.load(), e;
321
+ }
322
+ async load() {
323
+ let t;
324
+ try {
325
+ t = JSON.parse(await q(this.path, "utf8"));
326
+ } catch {
327
+ }
328
+ t ||= {}, this.data = t;
329
+ }
330
+ async dump() {
331
+ await U(this.path, JSON.stringify(this.data));
332
+ }
333
+ async get(t) {
334
+ return this.data[t];
335
+ }
336
+ async set(t, e) {
337
+ this.data[t] = e, await this.dump();
338
+ }
339
+ async keys() {
340
+ return Object.keys(this.data);
341
+ }
342
+ async del(t) {
343
+ delete this.data[t], await this.dump();
344
+ }
345
+ async rename(t, e) {
346
+ this.data[e] = this.data[t], delete this.data[t], await this.dump();
347
+ }
348
+ async all() {
349
+ return Object.entries(this.data).map(([t, e]) => ({ key: t, value: e }));
350
+ }
351
+ }
352
+ const Y = `
353
+ CREATE TABLE IF NOT EXISTS kv (
354
+ key VARCHAR UNIQUE,
355
+ value VARCHAR
356
+ );
357
+ `;
358
+ class H {
359
+ constructor(t) {
360
+ this.adapter = t, t.exec(Y);
361
+ }
362
+ static async open(t) {
363
+ return new H(t);
364
+ }
365
+ async get(t) {
366
+ return this.adapter.queryRow(
367
+ "SELECT value FROM kv WHERE key=?1",
368
+ t
369
+ )?.value;
370
+ }
371
+ async set(t, e) {
372
+ this.adapter.queryRow(
373
+ "INSERT INTO kv(key, value) VALUES(?1, ?2) ON CONFLICT(key) DO UPDATE SET value=?2",
374
+ t,
375
+ e
376
+ );
377
+ }
378
+ async keys() {
379
+ return this.adapter.queryRows("SELECT key FROM kv").map((e) => e.key);
380
+ }
381
+ async del(t) {
382
+ this.adapter.queryRow("DELETE FROM kv WHERE key=?", t);
383
+ }
384
+ async rename(t, e) {
385
+ this.adapter.queryRow("UPDATE kv SET key=?1 WHERE key=?2", e, t);
386
+ }
387
+ async all() {
388
+ return this.adapter.queryRows(
389
+ "SELECT key, value FROM kv"
390
+ );
391
+ }
392
+ }
393
+ function lt(r) {
394
+ return function(e) {
395
+ const { sql: s, params: a, type: n } = {
396
+ sql: e.sql,
397
+ params: e.params ?? [],
398
+ type: e.type ?? "values"
399
+ }, i = r(), u = i.prepare(s)[n === "values" ? "values" : "all"](...a);
400
+ return i.destroy(), u;
401
+ };
402
+ }
403
+ export {
404
+ X as CommandError,
405
+ T as KvFile,
406
+ I as KvJson,
407
+ H as KvSqlite,
408
+ it as createCGIHandler,
409
+ Q as defaultConfig,
410
+ _ as ensureEnv,
411
+ ut as ensureEnvs,
412
+ lt as getSqlHandler,
413
+ ct as readStdIn,
414
+ ot as runCommand
415
+ };
@@ -0,0 +1,24 @@
1
+ import type { IKvStorage } from './types.ts';
2
+ export interface IKvFileOptions {
3
+ pathToKey: (relPath: string) => string | undefined;
4
+ keyToPath: (key: string) => string;
5
+ }
6
+ export declare class KvFile implements IKvStorage {
7
+ private root;
8
+ static defaultOptions: IKvFileOptions;
9
+ static open(root?: string, options?: Partial<IKvFileOptions>): Promise<KvFile>;
10
+ options: IKvFileOptions;
11
+ constructor(root: string, options?: Partial<IKvFileOptions>);
12
+ private normalizeKey;
13
+ get(key: string): Promise<string | undefined>;
14
+ set(key: string, value: string): Promise<void>;
15
+ private loadDir;
16
+ keys(): Promise<string[]>;
17
+ private removeEmptyDirs;
18
+ del(key: string): Promise<void>;
19
+ rename(keyFrom: string, keyTo: string): Promise<void>;
20
+ all(): Promise<{
21
+ key: string;
22
+ value: string;
23
+ }[]>;
24
+ }
@@ -0,0 +1,4 @@
1
+ export * from './file';
2
+ export * from './json';
3
+ export * from './sqlite';
4
+ export * from './types';
@@ -0,0 +1,18 @@
1
+ import type { IKvStorage } from './types.ts';
2
+ export declare class KvJson implements IKvStorage {
3
+ private path;
4
+ private data;
5
+ static open(path?: string): Promise<KvJson>;
6
+ constructor(path: string, data?: Record<string, string>);
7
+ load(): Promise<void>;
8
+ dump(): Promise<void>;
9
+ get(key: string): Promise<string>;
10
+ set(key: string, value: string): Promise<void>;
11
+ keys(): Promise<string[]>;
12
+ del(key: string): Promise<void>;
13
+ rename(keyFrom: string, keyTo: string): Promise<void>;
14
+ all(): Promise<{
15
+ key: string;
16
+ value: string;
17
+ }[]>;
18
+ }
@@ -0,0 +1,16 @@
1
+ import type { ISqliteAdapter } from '../sqlite-common';
2
+ import type { IKvStorage } from './types';
3
+ export declare class KvSqlite implements IKvStorage {
4
+ private adapter;
5
+ static open(adapter: ISqliteAdapter): Promise<KvSqlite>;
6
+ constructor(adapter: ISqliteAdapter);
7
+ get(key: string): Promise<string | undefined>;
8
+ set(key: string, value: string): Promise<void>;
9
+ keys(): Promise<string[]>;
10
+ del(key: string): Promise<void>;
11
+ rename(key: string, to: string): Promise<void>;
12
+ all(): Promise<{
13
+ key: string;
14
+ value: string;
15
+ }[]>;
16
+ }
@@ -0,0 +1,11 @@
1
+ export interface IKvStorage {
2
+ get(key: string): Promise<string | undefined>;
3
+ set(key: string, value: string): Promise<void>;
4
+ keys(): Promise<string[]>;
5
+ del(key: string): Promise<void>;
6
+ rename(keyFrom: string, keyTo: string): Promise<void>;
7
+ all(): Promise<Array<{
8
+ key: string;
9
+ value: string;
10
+ }>>;
11
+ }
@@ -0,0 +1 @@
1
+ export * from './sqlite/adapter.ts';
@@ -0,0 +1,47 @@
1
+ import { DatabaseSync as s } from "node:sqlite";
2
+ class a {
3
+ constructor(e) {
4
+ this.statement = e;
5
+ }
6
+ get(...e) {
7
+ return this.statement.get(...e) || void 0;
8
+ }
9
+ all(...e) {
10
+ return this.statement.all(...e);
11
+ }
12
+ values(...e) {
13
+ return this.all(...e).map((t) => Object.values(t));
14
+ }
15
+ }
16
+ class i {
17
+ db;
18
+ constructor(e, t) {
19
+ this.db = new s(e, t);
20
+ }
21
+ exec(e) {
22
+ if (!this.db) throw new Error("Database is closed");
23
+ this.db.exec(e);
24
+ }
25
+ transaction(e) {
26
+ throw new Error("Not supported in Node.js");
27
+ }
28
+ prepare(e) {
29
+ if (!this.db) throw new Error("Database is closed");
30
+ return new a(this.db.prepare(e));
31
+ }
32
+ queryRow(e, ...t) {
33
+ return this.prepare(e).get(...t);
34
+ }
35
+ queryRows(e, ...t) {
36
+ return this.prepare(e).all(...t);
37
+ }
38
+ queryValues(e, ...t) {
39
+ return this.prepare(e).values(...t);
40
+ }
41
+ destroy() {
42
+ this.db?.close();
43
+ }
44
+ }
45
+ export {
46
+ i as SqliteAdapter
47
+ };
@@ -0,0 +1,23 @@
1
+ import { StatementSync } from 'node:sqlite';
2
+ import type { ISqliteAdapter, ISqliteStatement } from '../../sqlite-common/types';
3
+ declare class SqliteStatement<T extends object> implements ISqliteStatement<T> {
4
+ private statement;
5
+ constructor(statement: StatementSync);
6
+ get(...params: any[]): T | undefined;
7
+ all(...params: any[]): T[];
8
+ values(...params: any[]): any[][];
9
+ }
10
+ export declare class SqliteAdapter implements ISqliteAdapter {
11
+ private db;
12
+ constructor(path: string, options?: {
13
+ readOnly?: boolean;
14
+ });
15
+ exec(sql: string): void;
16
+ transaction(_cb: () => void): void;
17
+ prepare<T extends object>(sql: string): SqliteStatement<T>;
18
+ queryRow<T extends object>(sql: string, ...params: any[]): T | undefined;
19
+ queryRows<T extends object>(sql: string, ...params: any[]): T[];
20
+ queryValues(sql: string, ...params: any[]): any[][];
21
+ destroy(): void;
22
+ }
23
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ISqliteAdapter } from './types';
2
+ export interface ISqlQueryOptions {
3
+ sql: string;
4
+ params?: any[] | null;
5
+ type?: 'values' | 'object' | null;
6
+ }
7
+ export declare function getSqlHandler(factory: () => ISqliteAdapter): (options: ISqlQueryOptions) => object[];
@@ -0,0 +1,2 @@
1
+ export * from './handler.ts';
2
+ export * from './types.ts';
@@ -0,0 +1,15 @@
1
+ export type IPrimaryData = string | number | bigint | boolean | Uint8Array;
2
+ export interface ISqliteStatement<T> {
3
+ get(...params: any[]): T | undefined;
4
+ all(...params: any[]): T[];
5
+ values(...params: any[]): IPrimaryData[][];
6
+ }
7
+ export interface ISqliteAdapter {
8
+ exec(sql: string): void;
9
+ transaction(cb: () => void): void;
10
+ prepare<T extends object>(sql: string): ISqliteStatement<T>;
11
+ queryRow<T extends object>(sql: string, ...params: any[]): T | undefined;
12
+ queryRows<T extends object>(sql: string, ...params: any[]): T[];
13
+ queryValues(sql: string, ...params: any[]): IPrimaryData[][];
14
+ destroy(): void;
15
+ }
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@gera2ld/common-node",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "import": "./dist/index.js",
8
+ "types": "./dist/index.d.ts"
9
+ },
10
+ "./node": {
11
+ "import": "./dist/node/index.js",
12
+ "types": "./dist/node/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "registry": "https://registry.npmjs.org/"
21
+ },
22
+ "devDependencies": {
23
+ "@gera2ld/common": "^0.0.1"
24
+ },
25
+ "scripts": {
26
+ "clean": "del-cli dist tsconfig.tsbuildinfo",
27
+ "build:types": "tsc",
28
+ "build:js": "vite build",
29
+ "build": "pnpm clean && pnpm /^build:/"
30
+ }
31
+ }