@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.
Files changed (96) hide show
  1. package/{base-sys-abstraction-CR_Z-Ceg.d.ts → base-sys-abstraction-B-PcaG0B.d.ts} +1 -1
  2. package/{base-sys-abstraction-DWtPI7Kg.d.cts → base-sys-abstraction-CLlfCI2Q.d.cts} +1 -1
  3. package/cf/index.cjs +100 -273
  4. package/cf/index.cjs.map +1 -1
  5. package/cf/index.d.cts +3 -16
  6. package/cf/index.d.ts +3 -16
  7. package/cf/index.js +39 -6
  8. package/cf/index.js.map +1 -1
  9. package/{chunk-R2EEZNZN.js → chunk-5GJADB3C.js} +8 -6
  10. package/{chunk-R2EEZNZN.js.map → chunk-5GJADB3C.js.map} +1 -1
  11. package/chunk-MFC4AD5O.js +88 -0
  12. package/chunk-MFC4AD5O.js.map +1 -0
  13. package/{chunk-DZPKZQIT.js → chunk-OQ4NGEJR.js} +58 -502
  14. package/chunk-OQ4NGEJR.js.map +1 -0
  15. package/deno/index.cjs +86 -165
  16. package/deno/index.cjs.map +1 -1
  17. package/deno/index.d.cts +3 -23
  18. package/deno/index.d.ts +3 -23
  19. package/deno/index.js +174 -8
  20. package/deno/index.js.map +1 -1
  21. package/{index-BfZxTAe_.d.cts → index-CI2cJ0-W.d.cts} +1 -1
  22. package/{index-CfSl8Gmj.d.ts → index-ChpAZoUE.d.ts} +1 -1
  23. package/index.cjs +102 -265
  24. package/index.cjs.map +1 -1
  25. package/index.d.cts +5 -5
  26. package/index.d.ts +5 -5
  27. package/index.js +7 -6
  28. package/index.js.map +1 -1
  29. package/node/index.cjs +55 -134
  30. package/node/index.cjs.map +1 -1
  31. package/node/index.d.cts +3 -16
  32. package/node/index.d.ts +3 -16
  33. package/node/index.js +179 -8
  34. package/node/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/src/cf/cf-env-actions.ts +53 -0
  37. package/src/cf/cf-sys-abstraction.ts +1 -45
  38. package/src/deno/deno-env-actions.ts +57 -0
  39. package/src/deno/deno-sys-abstraction.ts +1 -57
  40. package/src/jsr.json +1 -1
  41. package/src/node/node-env-actions.ts +45 -0
  42. package/src/node/node-sys-abstraction.ts +1 -45
  43. package/src/sys-env.ts +4 -4
  44. package/src/web/web-env-actions.ts +41 -0
  45. package/src/web/web-sys-abstraction.ts +1 -41
  46. package/{sys-abstraction-GNnBj2sz.d.cts → sys-abstraction-Coxu8BjZ.d.cts} +1 -1
  47. package/{sys-abstraction-GNnBj2sz.d.ts → sys-abstraction-Coxu8BjZ.d.ts} +1 -1
  48. package/test/index.cjs +72 -235
  49. package/test/index.cjs.map +1 -1
  50. package/test/index.d.cts +2 -2
  51. package/test/index.d.ts +2 -2
  52. package/test/index.js +3 -2
  53. package/ts/cf/cf-env-actions.d.ts +16 -0
  54. package/ts/cf/cf-env-actions.d.ts.map +1 -0
  55. package/ts/cf/cf-env-actions.js +51 -0
  56. package/ts/cf/cf-env-actions.js.map +1 -0
  57. package/ts/cf/cf-sys-abstraction.d.ts +1 -14
  58. package/ts/cf/cf-sys-abstraction.d.ts.map +1 -1
  59. package/ts/cf/cf-sys-abstraction.js +0 -42
  60. package/ts/cf/cf-sys-abstraction.js.map +1 -1
  61. package/ts/crypto.test.js +8 -1
  62. package/ts/crypto.test.js.map +1 -1
  63. package/ts/deno/deno-env-actions.d.ts +23 -0
  64. package/ts/deno/deno-env-actions.d.ts.map +1 -0
  65. package/ts/deno/deno-env-actions.js +46 -0
  66. package/ts/deno/deno-env-actions.js.map +1 -0
  67. package/ts/deno/deno-sys-abstraction.d.ts +1 -22
  68. package/ts/deno/deno-sys-abstraction.d.ts.map +1 -1
  69. package/ts/deno/deno-sys-abstraction.js +0 -45
  70. package/ts/deno/deno-sys-abstraction.js.map +1 -1
  71. package/ts/node/node-env-actions.d.ts +15 -0
  72. package/ts/node/node-env-actions.d.ts.map +1 -0
  73. package/ts/node/node-env-actions.js +44 -0
  74. package/ts/node/node-env-actions.js.map +1 -0
  75. package/ts/node/node-sys-abstraction.d.ts +1 -14
  76. package/ts/node/node-sys-abstraction.d.ts.map +1 -1
  77. package/ts/node/node-sys-abstraction.js +0 -43
  78. package/ts/node/node-sys-abstraction.js.map +1 -1
  79. package/ts/sys-env.js +4 -4
  80. package/ts/sys-env.js.map +1 -1
  81. package/ts/sys-env.test.js +2 -2
  82. package/ts/sys-env.test.js.map +1 -1
  83. package/ts/web/web-env-actions.d.ts +14 -0
  84. package/ts/web/web-env-actions.d.ts.map +1 -0
  85. package/ts/web/web-env-actions.js +35 -0
  86. package/ts/web/web-env-actions.js.map +1 -0
  87. package/ts/web/web-sys-abstraction.d.ts +0 -13
  88. package/ts/web/web-sys-abstraction.d.ts.map +1 -1
  89. package/ts/web/web-sys-abstraction.js +0 -34
  90. package/ts/web/web-sys-abstraction.js.map +1 -1
  91. package/web/index.cjs +63 -238
  92. package/web/index.cjs.map +1 -1
  93. package/web/index.d.cts +3 -15
  94. package/web/index.d.ts +3 -15
  95. package/web/index.js +2 -3
  96. package/chunk-DZPKZQIT.js.map +0 -1
package/test/index.cjs CHANGED
@@ -80,8 +80,8 @@ var Future = class {
80
80
  __privateAdd(this, _rejectFn, () => {
81
81
  throw new Error("This Promise is not working as expected.");
82
82
  });
83
- __privateSet(this, _promise, new Promise((resolve2, reject) => {
84
- __privateSet(this, _resolveFn, resolve2);
83
+ __privateSet(this, _promise, new Promise((resolve, reject) => {
84
+ __privateSet(this, _resolveFn, resolve);
85
85
  __privateSet(this, _rejectFn, reject);
86
86
  }));
87
87
  }
@@ -513,9 +513,9 @@ var SysTime = class extends Time {
513
513
  return /* @__PURE__ */ new Date();
514
514
  }
515
515
  Sleep(duration) {
516
- return new Promise((resolve2) => {
516
+ return new Promise((resolve) => {
517
517
  setTimeout(() => {
518
- resolve2();
518
+ resolve();
519
519
  }, duration);
520
520
  });
521
521
  }
@@ -842,12 +842,7 @@ function runtimeFn() {
842
842
  };
843
843
  }
844
844
 
845
- // src/deno/deno-file-service.ts
846
- var path = __toESM(require("path"), 1);
847
- var Deno = globalThis.Deno;
848
-
849
- // src/deno/deno-sys-abstraction.ts
850
- var Deno2 = globalThis.Deno;
845
+ // src/deno/deno-env-actions.ts
851
846
  var once = new ResolveOnce();
852
847
  var _deno;
853
848
  var _DenoEnvActions = class _DenoEnvActions {
@@ -887,95 +882,8 @@ var _DenoEnvActions = class _DenoEnvActions {
887
882
  };
888
883
  _deno = new WeakMap();
889
884
  var DenoEnvActions = _DenoEnvActions;
890
- var DenoExitServiceImpl = class {
891
- constructor() {
892
- this._exitHandlers = [];
893
- this.invoked = false;
894
- this._handleExit = async () => {
895
- if (this.invoked) {
896
- return;
897
- }
898
- this.invoked = true;
899
- for (const h of this._exitHandlers) {
900
- try {
901
- const ret = h.hdl();
902
- if (typeof ret.then === "function") {
903
- await ret;
904
- }
905
- } finally {
906
- }
907
- }
908
- };
909
- globalThis.addEventListener("unhandledrejection", (e) => {
910
- e.preventDefault();
911
- this.exit(19);
912
- });
913
- globalThis.addEventListener("error", () => {
914
- this.exit(19);
915
- });
916
- globalThis.addEventListener("uncaughtException", () => {
917
- this.exit(19);
918
- });
919
- globalThis.addEventListener("unload", () => {
920
- this.exit(0);
921
- });
922
- Deno2.addSignalListener("SIGQUIT", () => {
923
- this.exit(3);
924
- });
925
- Deno2.addSignalListener("SIGINT", () => {
926
- this.exit(2);
927
- });
928
- Deno2.addSignalListener("SIGTERM", () => {
929
- this.exit(9);
930
- });
931
- }
932
- injectExitHandlers(hdls) {
933
- this._exitHandlers = hdls;
934
- }
935
- exit(code) {
936
- this._handleExit().then(() => {
937
- Deno2.exit(code);
938
- }).catch((err) => {
939
- console.error("ExitService: failed to handle exit", err);
940
- Deno2.exit(code);
941
- });
942
- }
943
- };
944
- var _DenoSystemService = class _DenoSystemService {
945
- constructor() {
946
- this._exitService = new DenoExitServiceImpl();
947
- this._exitService.injectExitHandlers(_DenoSystemService._exitHandlers);
948
- }
949
- Env() {
950
- return envFactory();
951
- }
952
- Args() {
953
- return Deno2.args;
954
- }
955
- OnExit(hdl) {
956
- const id = crypto.randomUUID();
957
- _DenoSystemService._exitHandlers.push({ hdl, id });
958
- return () => {
959
- const idx = _DenoSystemService._exitHandlers.findIndex((h) => h.id === id);
960
- if (idx >= 0) {
961
- _DenoSystemService._exitHandlers.splice(idx, 1);
962
- }
963
- };
964
- }
965
- Exit(code) {
966
- this._exitService.exit(code);
967
- }
968
- };
969
- _DenoSystemService._exitHandlers = [];
970
- var DenoSystemService = _DenoSystemService;
971
885
 
972
- // src/node/node-file-service.ts
973
- var import_node_path = __toESM(require("path"), 1);
974
- var import_node_fs = __toESM(require("fs"), 1);
975
- var import_node_process = __toESM(require("process"), 1);
976
-
977
- // src/node/node-sys-abstraction.ts
978
- var import_node_process2 = __toESM(require("process"), 1);
886
+ // src/node/node-env-actions.ts
979
887
  var once2 = new ResolveOnce();
980
888
  var _node;
981
889
  var _NodeEnvActions = class _NodeEnvActions {
@@ -1013,111 +921,73 @@ var _NodeEnvActions = class _NodeEnvActions {
1013
921
  };
1014
922
  _node = new WeakMap();
1015
923
  var NodeEnvActions = _NodeEnvActions;
1016
- var NodeExitServiceImpl = class {
1017
- constructor() {
1018
- this._exitHandlers = [];
1019
- this.invoked = false;
1020
- this._handleExit = async () => {
1021
- if (this.invoked) {
1022
- return;
1023
- }
1024
- this.invoked = true;
1025
- for (const h of this._exitHandlers) {
1026
- try {
1027
- const ret = h.hdl();
1028
- if (typeof ret.then === "function") {
1029
- await ret;
1030
- }
1031
- } finally {
1032
- }
1033
- }
1034
- };
1035
- import_node_process2.default.on("unhandledRejection", (reason, p) => {
1036
- this.exit(19);
1037
- });
1038
- import_node_process2.default.on("uncaughtException", (error) => {
1039
- this.exit(18);
1040
- });
1041
- import_node_process2.default.on("close", () => {
1042
- this.exit(0);
1043
- });
1044
- import_node_process2.default.on("exit", () => {
1045
- this.exit(0);
1046
- });
1047
- import_node_process2.default.on("SIGQUIT", () => {
1048
- this.exit(3);
1049
- });
1050
- import_node_process2.default.on("SIGINT", () => {
1051
- this.exit(2);
1052
- });
1053
- import_node_process2.default.on("SIGTERM", () => {
1054
- this.exit(9);
1055
- });
924
+
925
+ // src/web/web-env-actions.ts
926
+ var once3 = new ResolveOnce();
927
+ var BrowserEnvActions = class _BrowserEnvActions {
928
+ constructor(opts) {
929
+ this.env = /* @__PURE__ */ new Map();
930
+ this.opts = opts;
1056
931
  }
1057
- injectExitHandlers(hdls) {
1058
- this._exitHandlers = hdls;
932
+ static new(opts) {
933
+ return once3.once(() => new _BrowserEnvActions(opts));
1059
934
  }
1060
- exit(code) {
1061
- this._handleExit().then(() => {
1062
- import_node_process2.default.exit(code);
1063
- }).catch((err) => {
1064
- console.error("ExitService: failed to handle exit", err);
1065
- import_node_process2.default.exit(code);
1066
- });
935
+ get(key2) {
936
+ return this.env.get(key2);
1067
937
  }
1068
- };
1069
- var _NodeSystemService = class _NodeSystemService {
1070
- constructor() {
1071
- this._exitService = new NodeExitServiceImpl();
1072
- this._exitService.injectExitHandlers(_NodeSystemService._exitHandlers);
938
+ set(key2, value) {
939
+ if (value) {
940
+ this.env.set(key2, value);
941
+ }
1073
942
  }
1074
- Env() {
1075
- return envFactory();
943
+ delete(key2) {
944
+ this.env.delete(key2);
1076
945
  }
1077
- Args() {
1078
- return import_node_process2.default.argv;
946
+ keys() {
947
+ return Array.from(this.env.keys());
1079
948
  }
1080
- OnExit(hdl) {
1081
- const id = crypto.randomUUID();
1082
- _NodeSystemService._exitHandlers.push({ hdl, id });
1083
- return () => {
1084
- const idx = _NodeSystemService._exitHandlers.findIndex((h) => h.id === id);
1085
- if (idx >= 0) {
1086
- _NodeSystemService._exitHandlers.splice(idx, 1);
1087
- }
1088
- };
949
+ active() {
950
+ return true;
1089
951
  }
1090
- Exit(code) {
1091
- this._exitService.exit(code);
952
+ register(env) {
953
+ const sym = Symbol.for(this.opts.symbol || "CP_ENV");
954
+ const browser = globalThis;
955
+ browser[sym] = env;
956
+ return env;
1092
957
  }
1093
958
  };
1094
- _NodeSystemService._exitHandlers = [];
1095
- var NodeSystemService = _NodeSystemService;
1096
959
 
1097
- // src/cf/cf-sys-abstraction.ts
1098
- var once3 = new ResolveOnce();
960
+ // src/cf/cf-env-actions.ts
961
+ var once4 = new ResolveOnce();
1099
962
  var CFEnvActions = class _CFEnvActions {
963
+ constructor(env) {
964
+ this.injectOnRegister = {};
965
+ this.cfEnv = new Map(Object.entries(env.presetEnv || {}));
966
+ }
1100
967
  static new(opts) {
1101
- return once3.once(() => new _CFEnvActions(opts));
968
+ return once4.once(() => new _CFEnvActions(opts));
1102
969
  }
1103
970
  static inject(o) {
1104
- var _a;
1105
971
  const env = _CFEnvActions.new({});
1106
972
  for (const key2 in o) {
1107
973
  const value = o[key2];
1108
974
  if (typeof value === "string") {
1109
- (_a = env.env) == null ? void 0 : _a.set(key2, value);
975
+ if (env.env) {
976
+ env.env.set(key2, value);
977
+ } else {
978
+ env.injectOnRegister[key2] = value;
979
+ }
1110
980
  }
1111
981
  }
1112
982
  }
1113
- constructor(env) {
1114
- this.cfEnv = new Map(Object.entries(env.presetEnv || {}));
1115
- }
1116
983
  active() {
1117
984
  return runtimeFn().isCFWorker;
1118
985
  }
1119
986
  register(env) {
1120
987
  this.env = env;
988
+ for (const key2 in this.injectOnRegister) {
989
+ env.set(key2, this.injectOnRegister[key2]);
990
+ }
1121
991
  return env;
1122
992
  }
1123
993
  get(key2) {
@@ -1151,12 +1021,12 @@ function envFactory(opts = {}) {
1151
1021
  }
1152
1022
  return _envFactories.get(found.id).once(() => {
1153
1023
  const action = found.fn(opts);
1154
- const ret = new EnvImpl2(action, opts);
1024
+ const ret = new EnvImpl(action, opts);
1155
1025
  action.register(ret);
1156
1026
  return ret;
1157
1027
  });
1158
1028
  }
1159
- var EnvImpl2 = class {
1029
+ var EnvImpl = class {
1160
1030
  constructor(map, opts = {}) {
1161
1031
  this._onSet = [];
1162
1032
  this._map = map;
@@ -1225,39 +1095,6 @@ var EnvImpl2 = class {
1225
1095
  };
1226
1096
 
1227
1097
  // src/web/web-sys-abstraction.ts
1228
- var once4 = new ResolveOnce();
1229
- var BrowserEnvActions = class _BrowserEnvActions {
1230
- constructor(opts) {
1231
- this.env = /* @__PURE__ */ new Map();
1232
- this.opts = opts;
1233
- }
1234
- static new(opts) {
1235
- return once4.once(() => new _BrowserEnvActions(opts));
1236
- }
1237
- get(key2) {
1238
- return this.env.get(key2);
1239
- }
1240
- set(key2, value) {
1241
- if (value) {
1242
- this.env.set(key2, value);
1243
- }
1244
- }
1245
- delete(key2) {
1246
- this.env.delete(key2);
1247
- }
1248
- keys() {
1249
- return Array.from(this.env.keys());
1250
- }
1251
- active() {
1252
- return true;
1253
- }
1254
- register(env) {
1255
- const sym = Symbol.for(this.opts.symbol || "CP_ENV");
1256
- const browser = globalThis;
1257
- browser[sym] = env;
1258
- return env;
1259
- }
1260
- };
1261
1098
  var WebFileService = class {
1262
1099
  get baseDir() {
1263
1100
  throw new Error("basedir-Method not implemented.");
@@ -1468,23 +1305,23 @@ var Path = class {
1468
1305
  this.parts.push(part);
1469
1306
  }
1470
1307
  };
1471
- function splitPath(path3) {
1308
+ function splitPath(path) {
1472
1309
  const p = new Path();
1473
- if (path3 === "") {
1310
+ if (path === "") {
1474
1311
  return p;
1475
1312
  }
1476
- for (let count = 0; path3.length; count++) {
1477
- if (path3.match(/^\/+/)) {
1313
+ for (let count = 0; path.length; count++) {
1314
+ if (path.match(/^\/+/)) {
1478
1315
  if (count === 0) {
1479
1316
  p.add(3 /* Root */);
1480
1317
  } else {
1481
1318
  p.add(1 /* Slash */);
1482
1319
  }
1483
- path3 = path3.replace(/^\/+/, "");
1320
+ path = path.replace(/^\/+/, "");
1484
1321
  } else {
1485
- const part = path3.replace(/\/.*$/, "");
1322
+ const part = path.replace(/\/.*$/, "");
1486
1323
  p.add(part);
1487
- path3 = path3.replace(/^[^/]+/, "");
1324
+ path = path.replace(/^[^/]+/, "");
1488
1325
  }
1489
1326
  }
1490
1327
  return p;
@@ -1493,29 +1330,29 @@ function pathJoin(...paths) {
1493
1330
  let prev = "";
1494
1331
  const res = [];
1495
1332
  for (let i = 0; i < paths.length; i++) {
1496
- const path3 = paths[i];
1497
- if (path3 === "") {
1333
+ const path = paths[i];
1334
+ if (path === "") {
1498
1335
  continue;
1499
1336
  }
1500
- if (!(prev.endsWith("/") || path3.startsWith("/"))) {
1337
+ if (!(prev.endsWith("/") || path.startsWith("/"))) {
1501
1338
  if (prev !== "") {
1502
1339
  res.push("/");
1503
1340
  }
1504
- res.push(path3);
1341
+ res.push(path);
1505
1342
  } else {
1506
- res.push(path3);
1343
+ res.push(path);
1507
1344
  }
1508
- prev = path3;
1345
+ prev = path;
1509
1346
  }
1510
1347
  return res.join("");
1511
1348
  }
1512
- function relativePath(path3, relative2) {
1513
- const relativeParts = splitPath(relative2);
1349
+ function relativePath(path, relative) {
1350
+ const relativeParts = splitPath(relative);
1514
1351
  let result;
1515
1352
  if (relativeParts.parts[0] === 3 /* Root */) {
1516
- result = relative2;
1353
+ result = relative;
1517
1354
  } else {
1518
- result = pathJoin(path3, relative2);
1355
+ result = pathJoin(path, relative);
1519
1356
  }
1520
1357
  const unoptPath = splitPath(result);
1521
1358
  const out = [];
@@ -1567,12 +1404,12 @@ function stripper(strip, obj) {
1567
1404
  });
1568
1405
  return localStripper(void 0, restrips, obj);
1569
1406
  }
1570
- function localStripper(path3, restrips, obj) {
1407
+ function localStripper(path, restrips, obj) {
1571
1408
  if (typeof obj !== "object" || obj === null) {
1572
1409
  return obj;
1573
1410
  }
1574
1411
  if (Array.isArray(obj)) {
1575
- return obj.map((i) => localStripper(path3, restrips, i));
1412
+ return obj.map((i) => localStripper(path, restrips, i));
1576
1413
  }
1577
1414
  const ret = { ...obj };
1578
1415
  const matcher = (key2, nextPath) => {
@@ -1586,8 +1423,8 @@ function localStripper(path3, restrips, obj) {
1586
1423
  for (const key2 in ret) {
1587
1424
  if (Object.prototype.hasOwnProperty.call(ret, key2)) {
1588
1425
  let nextPath;
1589
- if (path3) {
1590
- nextPath = [path3, key2].join(".");
1426
+ if (path) {
1427
+ nextPath = [path, key2].join(".");
1591
1428
  } else {
1592
1429
  nextPath = key2;
1593
1430
  }
@@ -2468,8 +2305,8 @@ var LoggerImpl = class _LoggerImpl {
2468
2305
  return this.Uint64(key2, value);
2469
2306
  }
2470
2307
  async Flush() {
2471
- return new Promise((resolve2) => {
2472
- this._logWriter._flush(void 0, resolve2);
2308
+ return new Promise((resolve) => {
2309
+ this._logWriter._flush(void 0, resolve);
2473
2310
  });
2474
2311
  }
2475
2312
  With() {