@adviser/cement 0.3.2 → 0.3.4
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/{base-sys-abstraction-CR_Z-Ceg.d.ts → base-sys-abstraction-B-PcaG0B.d.ts} +1 -1
- package/{base-sys-abstraction-DWtPI7Kg.d.cts → base-sys-abstraction-CLlfCI2Q.d.cts} +1 -1
- package/cf/index.cjs +100 -273
- package/cf/index.cjs.map +1 -1
- package/cf/index.d.cts +3 -16
- package/cf/index.d.ts +3 -16
- package/cf/index.js +39 -6
- package/cf/index.js.map +1 -1
- package/{chunk-R2EEZNZN.js → chunk-5GJADB3C.js} +8 -6
- package/{chunk-R2EEZNZN.js.map → chunk-5GJADB3C.js.map} +1 -1
- package/chunk-MFC4AD5O.js +88 -0
- package/chunk-MFC4AD5O.js.map +1 -0
- package/{chunk-DZPKZQIT.js → chunk-OQ4NGEJR.js} +58 -502
- package/chunk-OQ4NGEJR.js.map +1 -0
- package/deno/index.cjs +86 -165
- package/deno/index.cjs.map +1 -1
- package/deno/index.d.cts +3 -23
- package/deno/index.d.ts +3 -23
- package/deno/index.js +174 -8
- package/deno/index.js.map +1 -1
- package/{index-BfZxTAe_.d.cts → index-CI2cJ0-W.d.cts} +1 -1
- package/{index-CfSl8Gmj.d.ts → index-ChpAZoUE.d.ts} +1 -1
- package/index.cjs +102 -265
- package/index.cjs.map +1 -1
- package/index.d.cts +5 -5
- package/index.d.ts +5 -5
- package/index.js +7 -6
- package/index.js.map +1 -1
- package/node/index.cjs +55 -134
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +3 -16
- package/node/index.d.ts +3 -16
- package/node/index.js +179 -8
- package/node/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cf/cf-env-actions.ts +53 -0
- package/src/cf/cf-sys-abstraction.ts +1 -45
- package/src/deno/deno-env-actions.ts +57 -0
- package/src/deno/deno-sys-abstraction.ts +1 -57
- package/src/jsr.json +1 -1
- package/src/node/node-env-actions.ts +45 -0
- package/src/node/node-sys-abstraction.ts +1 -45
- package/src/sys-env.ts +4 -4
- package/src/web/web-env-actions.ts +41 -0
- package/src/web/web-sys-abstraction.ts +1 -41
- package/{sys-abstraction-GNnBj2sz.d.cts → sys-abstraction-Coxu8BjZ.d.cts} +1 -1
- package/{sys-abstraction-GNnBj2sz.d.ts → sys-abstraction-Coxu8BjZ.d.ts} +1 -1
- package/test/index.cjs +72 -235
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +2 -2
- package/test/index.d.ts +2 -2
- package/test/index.js +3 -2
- package/ts/cf/cf-env-actions.d.ts +16 -0
- package/ts/cf/cf-env-actions.d.ts.map +1 -0
- package/ts/cf/cf-env-actions.js +51 -0
- package/ts/cf/cf-env-actions.js.map +1 -0
- package/ts/cf/cf-sys-abstraction.d.ts +1 -14
- package/ts/cf/cf-sys-abstraction.d.ts.map +1 -1
- package/ts/cf/cf-sys-abstraction.js +0 -42
- package/ts/cf/cf-sys-abstraction.js.map +1 -1
- package/ts/crypto.test.js +8 -1
- package/ts/crypto.test.js.map +1 -1
- package/ts/deno/deno-env-actions.d.ts +23 -0
- package/ts/deno/deno-env-actions.d.ts.map +1 -0
- package/ts/deno/deno-env-actions.js +46 -0
- package/ts/deno/deno-env-actions.js.map +1 -0
- package/ts/deno/deno-sys-abstraction.d.ts +1 -22
- package/ts/deno/deno-sys-abstraction.d.ts.map +1 -1
- package/ts/deno/deno-sys-abstraction.js +0 -45
- package/ts/deno/deno-sys-abstraction.js.map +1 -1
- package/ts/node/node-env-actions.d.ts +15 -0
- package/ts/node/node-env-actions.d.ts.map +1 -0
- package/ts/node/node-env-actions.js +44 -0
- package/ts/node/node-env-actions.js.map +1 -0
- package/ts/node/node-sys-abstraction.d.ts +1 -14
- package/ts/node/node-sys-abstraction.d.ts.map +1 -1
- package/ts/node/node-sys-abstraction.js +0 -43
- package/ts/node/node-sys-abstraction.js.map +1 -1
- package/ts/sys-env.js +4 -4
- package/ts/sys-env.js.map +1 -1
- package/ts/sys-env.test.js +2 -2
- package/ts/sys-env.test.js.map +1 -1
- package/ts/web/web-env-actions.d.ts +14 -0
- package/ts/web/web-env-actions.d.ts.map +1 -0
- package/ts/web/web-env-actions.js +35 -0
- package/ts/web/web-env-actions.js.map +1 -0
- package/ts/web/web-sys-abstraction.d.ts +0 -13
- package/ts/web/web-sys-abstraction.d.ts.map +1 -1
- package/ts/web/web-sys-abstraction.js +0 -34
- package/ts/web/web-sys-abstraction.js.map +1 -1
- package/web/index.cjs +63 -238
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +3 -15
- package/web/index.d.ts +3 -15
- package/web/index.js +2 -3
- package/chunk-DZPKZQIT.js.map +0 -1
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../../src/web/web-sys-abstraction.ts"],"sourcesContent":["import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams } from \"../base-sys-abstraction.js\";\nimport { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\n\nexport class WebFileService implements FileService {\n get baseDir(): string {\n throw new Error(\"basedir-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n create(fname: string): Promise<NamedWritableStream> {\n throw new Error(\"create-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n readFileString(fname: string): Promise<string> {\n throw new Error(\"readFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n writeFileString(fname: string, content: string): Promise<void> {\n throw new Error(\"writeFileString-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n abs(fname: string): string {\n throw new Error(\"abs-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n join(...paths: string[]): string {\n throw new Error(\"join-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n relative(from: string, to?: string | undefined): string {\n throw new Error(\"relative-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname(fname: string): string {\n throw new Error(\"dirname-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n basename(fname: string): string {\n throw new Error(\"basename-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n nodeImport(fname: string): string {\n throw new Error(\"nodeImport-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n isAbsolute(fname: string): boolean {\n throw new Error(\"isAbsolute-Method not implemented.\");\n }\n}\n\nclass WebSystemService implements SystemService {\n Env(): Env {\n return envFactory();\n }\n Args(): string[] {\n throw new Error(\"Args-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n OnExit(hdl: VoidFunc): VoidFunc {\n throw new Error(\"OnExit-Method not implemented.\");\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n Exit(code: number): void {\n throw new Error(\"Exit-Method not implemented.\");\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function WebSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new WebFileService(),\n SystemService: new WebSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n"],"mappings":";;;;;;;;;;AAMO,IAAM,iBAAN,MAA4C;AAAA,EACjD,IAAI,UAAkB;AACpB,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAAA;AAAA,EAEA,OAAO,OAA6C;AAClD,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AAAA;AAAA,EAEA,eAAe,OAAgC;AAC7C,UAAM,IAAI,MAAM,wCAAwC;AAAA,EAC1D;AAAA;AAAA,EAEA,gBAAgB,OAAe,SAAgC;AAC7D,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC3D;AAAA;AAAA,EAEA,IAAI,OAAuB;AACzB,UAAM,IAAI,MAAM,6BAA6B;AAAA,EAC/C;AAAA;AAAA,EAEA,QAAQ,OAAyB;AAC/B,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AAAA;AAAA,EAEA,SAAS,MAAc,IAAiC;AACtD,UAAM,IAAI,MAAM,kCAAkC;AAAA,EACpD;AAAA;AAAA,EAEA,QAAQ,OAAuB;AAC7B,UAAM,IAAI,MAAM,iCAAiC;AAAA,EACnD;AAAA;AAAA,EAEA,SAAS,OAAuB;AAC9B,UAAM,IAAI,MAAM,kCAAkC;AAAA,EACpD;AAAA;AAAA,EAEA,WAAW,OAAuB;AAChC,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AAAA;AAAA,EAEA,WAAW,OAAwB;AACjC,UAAM,IAAI,MAAM,oCAAoC;AAAA,EACtD;AACF;AAEA,IAAM,mBAAN,MAAgD;AAAA,EAC9C,MAAW;AACT,WAAO,WAAW;AAAA,EACpB;AAAA,EACA,OAAiB;AACf,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AAAA;AAAA,EAEA,OAAO,KAAyB;AAC9B,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AAAA;AAAA,EAEA,KAAK,MAAoB;AACvB,UAAM,IAAI,MAAM,8BAA8B;AAAA,EAChD;AACF;AAEA,IAAI,KAAqC;AAClC,SAAS,kBAAkB,OAAqD;AACrF,MAAI,CAAC,IAAI;AACP,SAAK,IAAI,mBAAmB;AAAA,MAC1B,eAAc,+BAAO,iBAAgB,uBAAuB;AAAA,MAC5D,YAAY,IAAI,eAAe;AAAA,MAC/B,eAAe,IAAI,iBAAiB;AAAA,IACtC,CAAC;AAAA,EACH;AACA,SAAO,IAAI,sBAAsB,IAAI,KAAK;AAC5C;","names":[]}
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import {
|
2
|
-
Utf8EnDecoderSingleton,
|
3
2
|
__privateAdd,
|
4
3
|
__privateGet,
|
5
4
|
__privateSet
|
@@ -58,9 +57,9 @@ var SysTime = class extends Time {
|
|
58
57
|
return /* @__PURE__ */ new Date();
|
59
58
|
}
|
60
59
|
Sleep(duration) {
|
61
|
-
return new Promise((
|
60
|
+
return new Promise((resolve) => {
|
62
61
|
setTimeout(() => {
|
63
|
-
|
62
|
+
resolve();
|
64
63
|
}, duration);
|
65
64
|
});
|
66
65
|
}
|
@@ -250,8 +249,8 @@ var Future = class {
|
|
250
249
|
__privateAdd(this, _rejectFn, () => {
|
251
250
|
throw new Error("This Promise is not working as expected.");
|
252
251
|
});
|
253
|
-
__privateSet(this, _promise, new Promise((
|
254
|
-
__privateSet(this, _resolveFn,
|
252
|
+
__privateSet(this, _promise, new Promise((resolve, reject) => {
|
253
|
+
__privateSet(this, _resolveFn, resolve);
|
255
254
|
__privateSet(this, _rejectFn, reject);
|
256
255
|
}));
|
257
256
|
}
|
@@ -447,159 +446,49 @@ function runtimeFn() {
|
|
447
446
|
};
|
448
447
|
}
|
449
448
|
|
450
|
-
// src/deno/deno-
|
451
|
-
|
452
|
-
var
|
453
|
-
var
|
454
|
-
constructor(
|
455
|
-
this
|
456
|
-
this.
|
457
|
-
}
|
458
|
-
// nodeImport(fname: string): string {
|
459
|
-
// // console.log('nodeImport:'+ fname);
|
460
|
-
// if (path.isAbsolute(fname)) {
|
461
|
-
// return fname;
|
462
|
-
// } else {
|
463
|
-
// return "./" + path.normalize(fname);
|
464
|
-
// }
|
465
|
-
// }
|
466
|
-
async readFileString(fname) {
|
467
|
-
return this.txtEnde.decode(await Deno.readFile(fname));
|
468
|
-
}
|
469
|
-
dirname(fname) {
|
470
|
-
return path.dirname(fname);
|
471
|
-
}
|
472
|
-
basename(fname) {
|
473
|
-
return path.basename(fname);
|
474
|
-
}
|
475
|
-
join(...paths) {
|
476
|
-
return path.join(...paths);
|
477
|
-
}
|
478
|
-
relative(from, to) {
|
479
|
-
if (to === void 0) {
|
480
|
-
to = from;
|
481
|
-
from = Deno.cwd();
|
482
|
-
}
|
483
|
-
const ret = path.relative(from, to);
|
484
|
-
return ret;
|
485
|
-
}
|
486
|
-
abs(fname) {
|
487
|
-
if (path.isAbsolute(fname)) {
|
488
|
-
return fname;
|
489
|
-
} else {
|
490
|
-
const cwd = Deno.cwd();
|
491
|
-
return path.resolve(cwd, fname);
|
492
|
-
}
|
493
|
-
}
|
494
|
-
isAbsolute(fname) {
|
495
|
-
return path.isAbsolute(fname);
|
449
|
+
// src/deno/deno-env-actions.ts
|
450
|
+
var once = new ResolveOnce();
|
451
|
+
var _deno;
|
452
|
+
var _DenoEnvActions = class _DenoEnvActions {
|
453
|
+
constructor(opts) {
|
454
|
+
__privateAdd(this, _deno, globalThis);
|
455
|
+
this.opts = opts;
|
496
456
|
}
|
497
|
-
|
498
|
-
|
499
|
-
const wr = o.stream.getWriter();
|
500
|
-
await wr.write(ende.encode(content));
|
501
|
-
await wr.close();
|
457
|
+
static new(opts) {
|
458
|
+
return once.once(() => new _DenoEnvActions(opts));
|
502
459
|
}
|
503
|
-
|
504
|
-
|
505
|
-
if (!path.isAbsolute(fname)) {
|
506
|
-
oName = this.abs(fname);
|
507
|
-
}
|
508
|
-
const base = path.dirname(oName);
|
509
|
-
await Deno.mkdir(base, { recursive: true });
|
510
|
-
const out = await Deno.open(oName, {
|
511
|
-
write: true,
|
512
|
-
create: true,
|
513
|
-
truncate: true
|
514
|
-
});
|
515
|
-
return {
|
516
|
-
name: oName,
|
517
|
-
stream: out
|
518
|
-
};
|
460
|
+
get _env() {
|
461
|
+
return __privateGet(this, _deno).Deno.env;
|
519
462
|
}
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
import path2 from "node:path";
|
524
|
-
import fs from "node:fs";
|
525
|
-
import process from "node:process";
|
526
|
-
var NodeFileService = class {
|
527
|
-
constructor(baseDir = process.cwd()) {
|
528
|
-
this.baseDir = this.abs(baseDir);
|
529
|
-
}
|
530
|
-
// nodeImport(fname: string): string {
|
531
|
-
// // console.log('nodeImport:'+ fname);
|
532
|
-
// if (path.isAbsolute(fname)) {
|
533
|
-
// return fname;
|
534
|
-
// } else {
|
535
|
-
// return "./" + path.normalize(fname);
|
536
|
-
// }
|
537
|
-
// }
|
538
|
-
readFileString(fname) {
|
539
|
-
return fs.promises.readFile(fname, { encoding: "utf-8" });
|
540
|
-
}
|
541
|
-
dirname(fname) {
|
542
|
-
return path2.dirname(fname);
|
543
|
-
}
|
544
|
-
basename(fname) {
|
545
|
-
return path2.basename(fname);
|
546
|
-
}
|
547
|
-
join(...paths) {
|
548
|
-
return path2.join(...paths);
|
549
|
-
}
|
550
|
-
relative(from, to) {
|
551
|
-
if (to === void 0) {
|
552
|
-
to = from;
|
553
|
-
from = process.cwd();
|
463
|
+
register(env) {
|
464
|
+
for (const key of env.keys()) {
|
465
|
+
this._env.set(key, env.get(key) || "");
|
554
466
|
}
|
555
|
-
|
556
|
-
return ret;
|
467
|
+
return env;
|
557
468
|
}
|
558
|
-
|
559
|
-
|
560
|
-
return fname;
|
561
|
-
} else {
|
562
|
-
const cwd = process.cwd();
|
563
|
-
return path2.resolve(cwd, fname);
|
564
|
-
}
|
469
|
+
active() {
|
470
|
+
return runtimeFn().isDeno;
|
565
471
|
}
|
566
|
-
|
567
|
-
return
|
472
|
+
keys() {
|
473
|
+
return Object.keys(this._env.toObject());
|
568
474
|
}
|
569
|
-
|
570
|
-
|
571
|
-
const wr = o.stream.getWriter();
|
572
|
-
await wr.write(ende.encode(content));
|
573
|
-
await wr.close();
|
475
|
+
get(key) {
|
476
|
+
return this._env.get(key);
|
574
477
|
}
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
oName = this.abs(fname);
|
478
|
+
set(key, value) {
|
479
|
+
if (value) {
|
480
|
+
this._env.set(key, value);
|
579
481
|
}
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
return {
|
584
|
-
name: oName,
|
585
|
-
stream: new WritableStream({
|
586
|
-
write(chunk) {
|
587
|
-
out.write(chunk);
|
588
|
-
},
|
589
|
-
close() {
|
590
|
-
out.close();
|
591
|
-
},
|
592
|
-
abort() {
|
593
|
-
throw new Error("not implemented");
|
594
|
-
}
|
595
|
-
})
|
596
|
-
};
|
482
|
+
}
|
483
|
+
delete(key) {
|
484
|
+
this._env.delete(key);
|
597
485
|
}
|
598
486
|
};
|
487
|
+
_deno = new WeakMap();
|
488
|
+
var DenoEnvActions = _DenoEnvActions;
|
599
489
|
|
600
|
-
// src/node/node-
|
601
|
-
|
602
|
-
var once = new ResolveOnce();
|
490
|
+
// src/node/node-env-actions.ts
|
491
|
+
var once2 = new ResolveOnce();
|
603
492
|
var _node;
|
604
493
|
var _NodeEnvActions = class _NodeEnvActions {
|
605
494
|
constructor(opts) {
|
@@ -608,7 +497,7 @@ var _NodeEnvActions = class _NodeEnvActions {
|
|
608
497
|
this.opts = opts;
|
609
498
|
}
|
610
499
|
static new(opts) {
|
611
|
-
return
|
500
|
+
return once2.once(() => new _NodeEnvActions(opts));
|
612
501
|
}
|
613
502
|
register(env) {
|
614
503
|
for (const key of env.keys()) {
|
@@ -636,107 +525,16 @@ var _NodeEnvActions = class _NodeEnvActions {
|
|
636
525
|
};
|
637
526
|
_node = new WeakMap();
|
638
527
|
var NodeEnvActions = _NodeEnvActions;
|
639
|
-
var NodeExitServiceImpl = class {
|
640
|
-
constructor() {
|
641
|
-
this._exitHandlers = [];
|
642
|
-
this.invoked = false;
|
643
|
-
this._handleExit = async () => {
|
644
|
-
if (this.invoked) {
|
645
|
-
return;
|
646
|
-
}
|
647
|
-
this.invoked = true;
|
648
|
-
for (const h of this._exitHandlers) {
|
649
|
-
try {
|
650
|
-
const ret = h.hdl();
|
651
|
-
if (typeof ret.then === "function") {
|
652
|
-
await ret;
|
653
|
-
}
|
654
|
-
} finally {
|
655
|
-
}
|
656
|
-
}
|
657
|
-
};
|
658
|
-
process2.on("unhandledRejection", (reason, p) => {
|
659
|
-
this.exit(19);
|
660
|
-
});
|
661
|
-
process2.on("uncaughtException", (error) => {
|
662
|
-
this.exit(18);
|
663
|
-
});
|
664
|
-
process2.on("close", () => {
|
665
|
-
this.exit(0);
|
666
|
-
});
|
667
|
-
process2.on("exit", () => {
|
668
|
-
this.exit(0);
|
669
|
-
});
|
670
|
-
process2.on("SIGQUIT", () => {
|
671
|
-
this.exit(3);
|
672
|
-
});
|
673
|
-
process2.on("SIGINT", () => {
|
674
|
-
this.exit(2);
|
675
|
-
});
|
676
|
-
process2.on("SIGTERM", () => {
|
677
|
-
this.exit(9);
|
678
|
-
});
|
679
|
-
}
|
680
|
-
injectExitHandlers(hdls) {
|
681
|
-
this._exitHandlers = hdls;
|
682
|
-
}
|
683
|
-
exit(code) {
|
684
|
-
this._handleExit().then(() => {
|
685
|
-
process2.exit(code);
|
686
|
-
}).catch((err) => {
|
687
|
-
console.error("ExitService: failed to handle exit", err);
|
688
|
-
process2.exit(code);
|
689
|
-
});
|
690
|
-
}
|
691
|
-
};
|
692
|
-
var _NodeSystemService = class _NodeSystemService {
|
693
|
-
constructor() {
|
694
|
-
this._exitService = new NodeExitServiceImpl();
|
695
|
-
this._exitService.injectExitHandlers(_NodeSystemService._exitHandlers);
|
696
|
-
}
|
697
|
-
Env() {
|
698
|
-
return envFactory();
|
699
|
-
}
|
700
|
-
Args() {
|
701
|
-
return process2.argv;
|
702
|
-
}
|
703
|
-
OnExit(hdl) {
|
704
|
-
const id = crypto.randomUUID();
|
705
|
-
_NodeSystemService._exitHandlers.push({ hdl, id });
|
706
|
-
return () => {
|
707
|
-
const idx = _NodeSystemService._exitHandlers.findIndex((h) => h.id === id);
|
708
|
-
if (idx >= 0) {
|
709
|
-
_NodeSystemService._exitHandlers.splice(idx, 1);
|
710
|
-
}
|
711
|
-
};
|
712
|
-
}
|
713
|
-
Exit(code) {
|
714
|
-
this._exitService.exit(code);
|
715
|
-
}
|
716
|
-
};
|
717
|
-
_NodeSystemService._exitHandlers = [];
|
718
|
-
var NodeSystemService = _NodeSystemService;
|
719
|
-
var my = void 0;
|
720
|
-
function NodeSysAbstraction(param) {
|
721
|
-
if (!my) {
|
722
|
-
my = new BaseSysAbstraction({
|
723
|
-
TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
|
724
|
-
FileSystem: new NodeFileService(),
|
725
|
-
SystemService: new NodeSystemService()
|
726
|
-
});
|
727
|
-
}
|
728
|
-
return new WrapperSysAbstraction(my, param);
|
729
|
-
}
|
730
528
|
|
731
|
-
// src/web/web-
|
732
|
-
var
|
529
|
+
// src/web/web-env-actions.ts
|
530
|
+
var once3 = new ResolveOnce();
|
733
531
|
var BrowserEnvActions = class _BrowserEnvActions {
|
734
532
|
constructor(opts) {
|
735
533
|
this.env = /* @__PURE__ */ new Map();
|
736
534
|
this.opts = opts;
|
737
535
|
}
|
738
536
|
static new(opts) {
|
739
|
-
return
|
537
|
+
return once3.once(() => new _BrowserEnvActions(opts));
|
740
538
|
}
|
741
539
|
get(key) {
|
742
540
|
return this.env.get(key);
|
@@ -762,103 +560,38 @@ var BrowserEnvActions = class _BrowserEnvActions {
|
|
762
560
|
return env;
|
763
561
|
}
|
764
562
|
};
|
765
|
-
var WebFileService = class {
|
766
|
-
get baseDir() {
|
767
|
-
throw new Error("basedir-Method not implemented.");
|
768
|
-
}
|
769
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
770
|
-
create(fname) {
|
771
|
-
throw new Error("create-Method not implemented.");
|
772
|
-
}
|
773
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
774
|
-
readFileString(fname) {
|
775
|
-
throw new Error("readFileString-Method not implemented.");
|
776
|
-
}
|
777
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
778
|
-
writeFileString(fname, content) {
|
779
|
-
throw new Error("writeFileString-Method not implemented.");
|
780
|
-
}
|
781
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
782
|
-
abs(fname) {
|
783
|
-
throw new Error("abs-Method not implemented.");
|
784
|
-
}
|
785
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
786
|
-
join(...paths) {
|
787
|
-
throw new Error("join-Method not implemented.");
|
788
|
-
}
|
789
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
790
|
-
relative(from, to) {
|
791
|
-
throw new Error("relative-Method not implemented.");
|
792
|
-
}
|
793
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
794
|
-
dirname(fname) {
|
795
|
-
throw new Error("dirname-Method not implemented.");
|
796
|
-
}
|
797
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
798
|
-
basename(fname) {
|
799
|
-
throw new Error("basename-Method not implemented.");
|
800
|
-
}
|
801
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
802
|
-
nodeImport(fname) {
|
803
|
-
throw new Error("nodeImport-Method not implemented.");
|
804
|
-
}
|
805
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
806
|
-
isAbsolute(fname) {
|
807
|
-
throw new Error("isAbsolute-Method not implemented.");
|
808
|
-
}
|
809
|
-
};
|
810
|
-
var WebSystemService = class {
|
811
|
-
Env() {
|
812
|
-
return envFactory();
|
813
|
-
}
|
814
|
-
Args() {
|
815
|
-
throw new Error("Args-Method not implemented.");
|
816
|
-
}
|
817
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
818
|
-
OnExit(hdl) {
|
819
|
-
throw new Error("OnExit-Method not implemented.");
|
820
|
-
}
|
821
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
822
|
-
Exit(code) {
|
823
|
-
throw new Error("Exit-Method not implemented.");
|
824
|
-
}
|
825
|
-
};
|
826
|
-
var my2 = void 0;
|
827
|
-
function WebSysAbstraction(param) {
|
828
|
-
if (!my2) {
|
829
|
-
my2 = new BaseSysAbstraction({
|
830
|
-
TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
|
831
|
-
FileSystem: new WebFileService(),
|
832
|
-
SystemService: new WebSystemService()
|
833
|
-
});
|
834
|
-
}
|
835
|
-
return new WrapperSysAbstraction(my2, param);
|
836
|
-
}
|
837
563
|
|
838
|
-
// src/cf/cf-
|
839
|
-
var
|
564
|
+
// src/cf/cf-env-actions.ts
|
565
|
+
var once4 = new ResolveOnce();
|
840
566
|
var CFEnvActions = class _CFEnvActions {
|
567
|
+
constructor(env) {
|
568
|
+
this.injectOnRegister = {};
|
569
|
+
this.cfEnv = new Map(Object.entries(env.presetEnv || {}));
|
570
|
+
}
|
841
571
|
static new(opts) {
|
842
|
-
return
|
572
|
+
return once4.once(() => new _CFEnvActions(opts));
|
843
573
|
}
|
844
574
|
static inject(o) {
|
845
|
-
var _a;
|
846
575
|
const env = _CFEnvActions.new({});
|
847
576
|
for (const key in o) {
|
848
577
|
const value = o[key];
|
849
578
|
if (typeof value === "string") {
|
850
|
-
(
|
579
|
+
if (env.env) {
|
580
|
+
env.env.set(key, value);
|
581
|
+
} else {
|
582
|
+
env.injectOnRegister[key] = value;
|
583
|
+
}
|
851
584
|
}
|
852
585
|
}
|
853
586
|
}
|
854
|
-
constructor(env) {
|
855
|
-
this.cfEnv = new Map(Object.entries(env.presetEnv || {}));
|
856
|
-
}
|
857
587
|
active() {
|
858
588
|
return runtimeFn().isCFWorker;
|
859
589
|
}
|
860
590
|
register(env) {
|
861
591
|
this.env = env;
|
592
|
+
for (const key in this.injectOnRegister) {
|
593
|
+
env.set(key, this.injectOnRegister[key]);
|
594
|
+
}
|
862
595
|
return env;
|
863
596
|
}
|
864
597
|
get(key) {
|
@@ -876,33 +609,6 @@ var CFEnvActions = class _CFEnvActions {
|
|
876
609
|
return Array.from(this.cfEnv.keys());
|
877
610
|
}
|
878
611
|
};
|
879
|
-
var CFSystemService = class {
|
880
|
-
Env() {
|
881
|
-
return envFactory();
|
882
|
-
}
|
883
|
-
Args() {
|
884
|
-
throw new Error("Args-Method not implemented.");
|
885
|
-
}
|
886
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
887
|
-
OnExit(hdl) {
|
888
|
-
throw new Error("OnExit-Method not implemented.");
|
889
|
-
}
|
890
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
891
|
-
Exit(code) {
|
892
|
-
throw new Error("Exit-Method not implemented.");
|
893
|
-
}
|
894
|
-
};
|
895
|
-
var my3 = void 0;
|
896
|
-
function CFSysAbstraction(param) {
|
897
|
-
if (!my3) {
|
898
|
-
my3 = new BaseSysAbstraction({
|
899
|
-
TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
|
900
|
-
FileSystem: new WebFileService(),
|
901
|
-
SystemService: new CFSystemService()
|
902
|
-
});
|
903
|
-
}
|
904
|
-
return new WrapperSysAbstraction(my3, param);
|
905
|
-
}
|
906
612
|
|
907
613
|
// src/sys-env.ts
|
908
614
|
var envActions = [
|
@@ -930,12 +636,12 @@ function envFactory(opts = {}) {
|
|
930
636
|
}
|
931
637
|
return _envFactories.get(found.id).once(() => {
|
932
638
|
const action = found.fn(opts);
|
933
|
-
const ret = new
|
639
|
+
const ret = new EnvImpl(action, opts);
|
934
640
|
action.register(ret);
|
935
641
|
return ret;
|
936
642
|
});
|
937
643
|
}
|
938
|
-
var
|
644
|
+
var EnvImpl = class {
|
939
645
|
constructor(map, opts = {}) {
|
940
646
|
this._onSet = [];
|
941
647
|
this._map = map;
|
@@ -1003,140 +709,6 @@ var EnvImpl2 = class {
|
|
1003
709
|
}
|
1004
710
|
};
|
1005
711
|
|
1006
|
-
// src/deno/deno-sys-abstraction.ts
|
1007
|
-
var Deno2 = globalThis.Deno;
|
1008
|
-
var once4 = new ResolveOnce();
|
1009
|
-
var _deno;
|
1010
|
-
var _DenoEnvActions = class _DenoEnvActions {
|
1011
|
-
constructor(opts) {
|
1012
|
-
__privateAdd(this, _deno, globalThis);
|
1013
|
-
this.opts = opts;
|
1014
|
-
}
|
1015
|
-
static new(opts) {
|
1016
|
-
return once4.once(() => new _DenoEnvActions(opts));
|
1017
|
-
}
|
1018
|
-
get _env() {
|
1019
|
-
return __privateGet(this, _deno).Deno.env;
|
1020
|
-
}
|
1021
|
-
register(env) {
|
1022
|
-
for (const key of env.keys()) {
|
1023
|
-
this._env.set(key, env.get(key) || "");
|
1024
|
-
}
|
1025
|
-
return env;
|
1026
|
-
}
|
1027
|
-
active() {
|
1028
|
-
return runtimeFn().isDeno;
|
1029
|
-
}
|
1030
|
-
keys() {
|
1031
|
-
return Object.keys(this._env.toObject());
|
1032
|
-
}
|
1033
|
-
get(key) {
|
1034
|
-
return this._env.get(key);
|
1035
|
-
}
|
1036
|
-
set(key, value) {
|
1037
|
-
if (value) {
|
1038
|
-
this._env.set(key, value);
|
1039
|
-
}
|
1040
|
-
}
|
1041
|
-
delete(key) {
|
1042
|
-
this._env.delete(key);
|
1043
|
-
}
|
1044
|
-
};
|
1045
|
-
_deno = new WeakMap();
|
1046
|
-
var DenoEnvActions = _DenoEnvActions;
|
1047
|
-
var DenoExitServiceImpl = class {
|
1048
|
-
constructor() {
|
1049
|
-
this._exitHandlers = [];
|
1050
|
-
this.invoked = false;
|
1051
|
-
this._handleExit = async () => {
|
1052
|
-
if (this.invoked) {
|
1053
|
-
return;
|
1054
|
-
}
|
1055
|
-
this.invoked = true;
|
1056
|
-
for (const h of this._exitHandlers) {
|
1057
|
-
try {
|
1058
|
-
const ret = h.hdl();
|
1059
|
-
if (typeof ret.then === "function") {
|
1060
|
-
await ret;
|
1061
|
-
}
|
1062
|
-
} finally {
|
1063
|
-
}
|
1064
|
-
}
|
1065
|
-
};
|
1066
|
-
globalThis.addEventListener("unhandledrejection", (e) => {
|
1067
|
-
e.preventDefault();
|
1068
|
-
this.exit(19);
|
1069
|
-
});
|
1070
|
-
globalThis.addEventListener("error", () => {
|
1071
|
-
this.exit(19);
|
1072
|
-
});
|
1073
|
-
globalThis.addEventListener("uncaughtException", () => {
|
1074
|
-
this.exit(19);
|
1075
|
-
});
|
1076
|
-
globalThis.addEventListener("unload", () => {
|
1077
|
-
this.exit(0);
|
1078
|
-
});
|
1079
|
-
Deno2.addSignalListener("SIGQUIT", () => {
|
1080
|
-
this.exit(3);
|
1081
|
-
});
|
1082
|
-
Deno2.addSignalListener("SIGINT", () => {
|
1083
|
-
this.exit(2);
|
1084
|
-
});
|
1085
|
-
Deno2.addSignalListener("SIGTERM", () => {
|
1086
|
-
this.exit(9);
|
1087
|
-
});
|
1088
|
-
}
|
1089
|
-
injectExitHandlers(hdls) {
|
1090
|
-
this._exitHandlers = hdls;
|
1091
|
-
}
|
1092
|
-
exit(code) {
|
1093
|
-
this._handleExit().then(() => {
|
1094
|
-
Deno2.exit(code);
|
1095
|
-
}).catch((err) => {
|
1096
|
-
console.error("ExitService: failed to handle exit", err);
|
1097
|
-
Deno2.exit(code);
|
1098
|
-
});
|
1099
|
-
}
|
1100
|
-
};
|
1101
|
-
var _DenoSystemService = class _DenoSystemService {
|
1102
|
-
constructor() {
|
1103
|
-
this._exitService = new DenoExitServiceImpl();
|
1104
|
-
this._exitService.injectExitHandlers(_DenoSystemService._exitHandlers);
|
1105
|
-
}
|
1106
|
-
Env() {
|
1107
|
-
return envFactory();
|
1108
|
-
}
|
1109
|
-
Args() {
|
1110
|
-
return Deno2.args;
|
1111
|
-
}
|
1112
|
-
OnExit(hdl) {
|
1113
|
-
const id = crypto.randomUUID();
|
1114
|
-
_DenoSystemService._exitHandlers.push({ hdl, id });
|
1115
|
-
return () => {
|
1116
|
-
const idx = _DenoSystemService._exitHandlers.findIndex((h) => h.id === id);
|
1117
|
-
if (idx >= 0) {
|
1118
|
-
_DenoSystemService._exitHandlers.splice(idx, 1);
|
1119
|
-
}
|
1120
|
-
};
|
1121
|
-
}
|
1122
|
-
Exit(code) {
|
1123
|
-
this._exitService.exit(code);
|
1124
|
-
}
|
1125
|
-
};
|
1126
|
-
_DenoSystemService._exitHandlers = [];
|
1127
|
-
var DenoSystemService = _DenoSystemService;
|
1128
|
-
var my4 = void 0;
|
1129
|
-
function DenoSysAbstraction(param) {
|
1130
|
-
if (!my4) {
|
1131
|
-
my4 = new BaseSysAbstraction({
|
1132
|
-
TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
|
1133
|
-
FileSystem: new DenoFileService(),
|
1134
|
-
SystemService: new DenoSystemService()
|
1135
|
-
});
|
1136
|
-
}
|
1137
|
-
return new WrapperSysAbstraction(my4, param);
|
1138
|
-
}
|
1139
|
-
|
1140
712
|
export {
|
1141
713
|
TimeMode,
|
1142
714
|
RandomMode,
|
@@ -1159,24 +731,8 @@ export {
|
|
1159
731
|
KeyedResolvOnce,
|
1160
732
|
KeyedResolvSeq,
|
1161
733
|
runtimeFn,
|
1162
|
-
DenoFileService,
|
1163
|
-
DenoEnvActions,
|
1164
|
-
DenoExitServiceImpl,
|
1165
|
-
DenoSystemService,
|
1166
|
-
DenoSysAbstraction,
|
1167
|
-
NodeFileService,
|
1168
|
-
NodeEnvActions,
|
1169
|
-
NodeExitServiceImpl,
|
1170
|
-
NodeSystemService,
|
1171
|
-
NodeSysAbstraction,
|
1172
|
-
CFEnvActions,
|
1173
|
-
CFSystemService,
|
1174
|
-
CFSysAbstraction,
|
1175
734
|
registerEnvAction,
|
1176
735
|
envFactory,
|
1177
|
-
|
1178
|
-
BrowserEnvActions,
|
1179
|
-
WebFileService,
|
1180
|
-
WebSysAbstraction
|
736
|
+
EnvImpl
|
1181
737
|
};
|
1182
|
-
//# sourceMappingURL=chunk-
|
738
|
+
//# sourceMappingURL=chunk-OQ4NGEJR.js.map
|