@adviser/cement 0.2.28 → 0.2.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. package/{base-sys-abstraction-C9WW3w57.d.cts → base-sys-abstraction-BkEiLHl0.d.ts} +8 -4
  2. package/{base-sys-abstraction-C9WW3w57.d.ts → base-sys-abstraction-Qj7pkY1N.d.cts} +8 -4
  3. package/{chunk-OXD3YZZ7.js → chunk-7KFVMTOS.js} +3 -47
  4. package/chunk-7KFVMTOS.js.map +1 -0
  5. package/{chunk-P5RXA4C4.js → chunk-GES3MUGV.js} +24 -27
  6. package/{chunk-LCPYQVWT.js.map → chunk-GES3MUGV.js.map} +1 -1
  7. package/{chunk-YDIUMYIE.js → chunk-Q65HLCNL.js} +8 -7
  8. package/chunk-Q65HLCNL.js.map +1 -0
  9. package/{chunk-DPIL5UIL.js → chunk-WMMUXBDX.js} +6 -2
  10. package/chunk-WMMUXBDX.js.map +1 -0
  11. package/{index-Dhb2fQiw.d.cts → index-Q3phXzYr.d.cts} +2 -21
  12. package/{index-CcsGcehs.d.ts → index-tIGZMHTc.d.ts} +2 -21
  13. package/index.cjs +264 -7343
  14. package/index.cjs.map +1 -1
  15. package/index.d.cts +72 -12
  16. package/index.d.ts +72 -12
  17. package/index.js +217 -7265
  18. package/index.js.map +1 -1
  19. package/node/index.cjs +220 -39
  20. package/node/index.cjs.map +1 -1
  21. package/node/index.d.cts +22 -4
  22. package/node/index.d.ts +22 -4
  23. package/node/index.js +201 -25
  24. package/node/index.js.map +1 -1
  25. package/package.json +23 -12
  26. package/src/LICENSE +201 -0
  27. package/src/README.md +39 -0
  28. package/src/base-sys-abstraction.test.ts +95 -0
  29. package/src/base-sys-abstraction.ts +242 -0
  30. package/src/bin2text.test.ts +59 -0
  31. package/src/bin2text.ts +47 -0
  32. package/src/crypto.test.ts +15 -0
  33. package/src/crypto.ts +125 -0
  34. package/src/file-service.ts +24 -0
  35. package/src/future.test.ts +32 -0
  36. package/src/future.ts +27 -0
  37. package/src/index.ts +22 -0
  38. package/src/jsr.json +20 -0
  39. package/src/log-level-impl.ts +87 -0
  40. package/src/log-writer-impl.ts +58 -0
  41. package/src/logger-impl.ts +498 -0
  42. package/src/logger.test.ts +1132 -0
  43. package/src/logger.ts +208 -0
  44. package/src/node/deno-file-service.ts +92 -0
  45. package/src/node/deno-sys-abstraction.ts +133 -0
  46. package/src/node/index.ts +4 -0
  47. package/src/node/mock-file-service.ts +45 -0
  48. package/src/node/node-file-service.ts +91 -0
  49. package/src/node/node-sys-abstraction.ts +121 -0
  50. package/src/option.ts +60 -0
  51. package/src/resolve-once.test.ts +321 -0
  52. package/src/resolve-once.ts +179 -0
  53. package/src/result.test.ts +102 -0
  54. package/src/result.ts +165 -0
  55. package/src/runtime.ts +36 -0
  56. package/src/sys-abstraction.ts +53 -0
  57. package/src/sys-env.test.ts +53 -0
  58. package/src/sys-env.ts +216 -0
  59. package/src/test/log-write-stream.ts +95 -0
  60. package/src/test/mock-logger.ts +40 -0
  61. package/src/time.ts +20 -0
  62. package/src/tracer.test.ts +314 -0
  63. package/src/tracer.ts +222 -0
  64. package/src/txt-en-decoder.ts +21 -0
  65. package/src/uri.test.ts +155 -0
  66. package/src/uri.ts +421 -0
  67. package/src/utils/console-write-stream.ts +72 -0
  68. package/src/utils/fanout-write-stream.ts +32 -0
  69. package/src/utils/index.ts +6 -0
  70. package/src/utils/rebuffer.ts +75 -0
  71. package/src/utils/stream-map.ts +67 -0
  72. package/src/utils/stream2string.ts +47 -0
  73. package/src/utils/string2stream.ts +14 -0
  74. package/src/version.ts +3 -0
  75. package/src/web/index.ts +1 -0
  76. package/src/web/web-sys-abstraction.ts +80 -0
  77. package/ts/base-sys-abstraction.d.ts +84 -0
  78. package/ts/base-sys-abstraction.d.ts.map +1 -0
  79. package/ts/base-sys-abstraction.js +178 -0
  80. package/ts/base-sys-abstraction.js.map +1 -0
  81. package/ts/base-sys-abstraction.test.d.ts +2 -0
  82. package/ts/base-sys-abstraction.test.d.ts.map +1 -0
  83. package/ts/base-sys-abstraction.test.js +82 -0
  84. package/ts/base-sys-abstraction.test.js.map +1 -0
  85. package/ts/bin2text.d.ts +3 -0
  86. package/ts/bin2text.d.ts.map +1 -0
  87. package/ts/bin2text.js +43 -0
  88. package/ts/bin2text.js.map +1 -0
  89. package/ts/bin2text.test.d.ts +2 -0
  90. package/ts/bin2text.test.d.ts.map +1 -0
  91. package/ts/bin2text.test.js +51 -0
  92. package/ts/bin2text.test.js.map +1 -0
  93. package/ts/crypto.d.ts +76 -0
  94. package/ts/crypto.d.ts.map +1 -0
  95. package/ts/crypto.js +22 -0
  96. package/ts/crypto.js.map +1 -0
  97. package/ts/crypto.test.d.ts +2 -0
  98. package/ts/crypto.test.d.ts.map +1 -0
  99. package/ts/crypto.test.js +14 -0
  100. package/ts/crypto.test.js.map +1 -0
  101. package/ts/file-service.d.ts +17 -0
  102. package/ts/file-service.d.ts.map +1 -0
  103. package/ts/file-service.js +2 -0
  104. package/ts/file-service.js.map +1 -0
  105. package/ts/future.d.ts +8 -0
  106. package/ts/future.d.ts.map +1 -0
  107. package/ts/future.js +38 -0
  108. package/ts/future.js.map +1 -0
  109. package/ts/future.test.d.ts +2 -0
  110. package/ts/future.test.d.ts.map +1 -0
  111. package/ts/future.test.js +28 -0
  112. package/ts/future.test.js.map +1 -0
  113. package/ts/index.d.ts +23 -0
  114. package/ts/index.d.ts.map +1 -0
  115. package/ts/index.js +23 -0
  116. package/ts/index.js.map +1 -0
  117. package/ts/log-level-impl.d.ts +14 -0
  118. package/ts/log-level-impl.d.ts.map +1 -0
  119. package/ts/log-level-impl.js +72 -0
  120. package/ts/log-level-impl.js.map +1 -0
  121. package/ts/log-writer-impl.d.ts +10 -0
  122. package/ts/log-writer-impl.d.ts.map +1 -0
  123. package/ts/log-writer-impl.js +45 -0
  124. package/ts/log-writer-impl.js.map +1 -0
  125. package/ts/logger-impl.d.ts +71 -0
  126. package/ts/logger-impl.d.ts.map +1 -0
  127. package/ts/logger-impl.js +412 -0
  128. package/ts/logger-impl.js.map +1 -0
  129. package/ts/logger.d.ts +84 -0
  130. package/ts/logger.d.ts.map +1 -0
  131. package/ts/logger.js +114 -0
  132. package/ts/logger.js.map +1 -0
  133. package/ts/logger.test.d.ts +2 -0
  134. package/ts/logger.test.d.ts.map +1 -0
  135. package/ts/logger.test.js +1023 -0
  136. package/ts/logger.test.js.map +1 -0
  137. package/ts/node/deno-file-service.d.ts +17 -0
  138. package/ts/node/deno-file-service.d.ts.map +1 -0
  139. package/ts/node/deno-file-service.js +65 -0
  140. package/ts/node/deno-file-service.js.map +1 -0
  141. package/ts/node/deno-sys-abstraction.d.ts +22 -0
  142. package/ts/node/deno-sys-abstraction.d.ts.map +1 -0
  143. package/ts/node/deno-sys-abstraction.js +101 -0
  144. package/ts/node/deno-sys-abstraction.js.map +1 -0
  145. package/ts/node/index.d.ts +5 -0
  146. package/ts/node/index.d.ts.map +1 -0
  147. package/ts/node/index.js +5 -0
  148. package/ts/node/index.js.map +1 -0
  149. package/ts/node/mock-file-service.d.ts +11 -0
  150. package/ts/node/mock-file-service.d.ts.map +1 -0
  151. package/ts/node/mock-file-service.js +34 -0
  152. package/ts/node/mock-file-service.js.map +1 -0
  153. package/ts/node/mock-file-service.test.d.ts +2 -0
  154. package/ts/node/mock-file-service.test.d.ts.map +1 -0
  155. package/ts/node/mock-file-service.test.js +31 -0
  156. package/ts/node/mock-file-service.test.js.map +1 -0
  157. package/ts/node/node-file-service.d.ts +16 -0
  158. package/ts/node/node-file-service.d.ts.map +1 -0
  159. package/ts/node/node-file-service.js +71 -0
  160. package/ts/node/node-file-service.js.map +1 -0
  161. package/ts/node/node-sys-abstraction.d.ts +22 -0
  162. package/ts/node/node-sys-abstraction.d.ts.map +1 -0
  163. package/ts/node/node-sys-abstraction.js +99 -0
  164. package/ts/node/node-sys-abstraction.js.map +1 -0
  165. package/ts/node/node-sys-abstraction.test.d.ts +2 -0
  166. package/ts/node/node-sys-abstraction.test.d.ts.map +1 -0
  167. package/ts/node/node-sys-abstraction.test.js +87 -0
  168. package/ts/node/node-sys-abstraction.test.js.map +1 -0
  169. package/ts/option.d.ts +25 -0
  170. package/ts/option.d.ts.map +1 -0
  171. package/ts/option.js +47 -0
  172. package/ts/option.js.map +1 -0
  173. package/ts/resolve-once.d.ts +46 -0
  174. package/ts/resolve-once.d.ts.map +1 -0
  175. package/ts/resolve-once.js +152 -0
  176. package/ts/resolve-once.js.map +1 -0
  177. package/ts/resolve-once.test.d.ts +2 -0
  178. package/ts/resolve-once.test.d.ts.map +1 -0
  179. package/ts/resolve-once.test.js +283 -0
  180. package/ts/resolve-once.test.js.map +1 -0
  181. package/ts/result.d.ts +34 -0
  182. package/ts/result.d.ts.map +1 -0
  183. package/ts/result.js +85 -0
  184. package/ts/result.js.map +1 -0
  185. package/ts/result.test.d.ts +2 -0
  186. package/ts/result.test.d.ts.map +1 -0
  187. package/ts/result.test.js +79 -0
  188. package/ts/result.test.js.map +1 -0
  189. package/ts/runtime.d.ts +8 -0
  190. package/ts/runtime.d.ts.map +1 -0
  191. package/ts/runtime.js +26 -0
  192. package/ts/runtime.js.map +1 -0
  193. package/ts/sys-abstraction.d.ts +36 -0
  194. package/ts/sys-abstraction.d.ts.map +1 -0
  195. package/ts/sys-abstraction.js +31 -0
  196. package/ts/sys-abstraction.js.map +1 -0
  197. package/ts/sys-env.d.ts +48 -0
  198. package/ts/sys-env.d.ts.map +1 -0
  199. package/ts/sys-env.js +176 -0
  200. package/ts/sys-env.js.map +1 -0
  201. package/ts/sys-env.test.d.ts +2 -0
  202. package/ts/sys-env.test.d.ts.map +1 -0
  203. package/ts/sys-env.test.js +51 -0
  204. package/ts/sys-env.test.js.map +1 -0
  205. package/ts/test/log-write-stream.d.ts +27 -0
  206. package/ts/test/log-write-stream.d.ts.map +1 -0
  207. package/ts/test/log-write-stream.js +74 -0
  208. package/ts/test/log-write-stream.js.map +1 -0
  209. package/ts/test/mock-logger.d.ts +14 -0
  210. package/ts/test/mock-logger.d.ts.map +1 -0
  211. package/ts/test/mock-logger.js +29 -0
  212. package/ts/test/mock-logger.js.map +1 -0
  213. package/ts/test/mock-logger.test.d.ts +2 -0
  214. package/ts/test/mock-logger.test.d.ts.map +1 -0
  215. package/ts/test/mock-logger.test.js +63 -0
  216. package/ts/test/mock-logger.test.js.map +1 -0
  217. package/ts/test/test-exit-handler.d.ts +2 -0
  218. package/ts/test/test-exit-handler.d.ts.map +1 -0
  219. package/ts/test/test-exit-handler.js +57 -0
  220. package/ts/test/test-exit-handler.js.map +1 -0
  221. package/ts/time.d.ts +13 -0
  222. package/ts/time.d.ts.map +1 -0
  223. package/ts/time.js +14 -0
  224. package/ts/time.js.map +1 -0
  225. package/ts/tracer.d.ts +59 -0
  226. package/ts/tracer.d.ts.map +1 -0
  227. package/ts/tracer.js +148 -0
  228. package/ts/tracer.js.map +1 -0
  229. package/ts/tracer.test.d.ts +2 -0
  230. package/ts/tracer.test.d.ts.map +1 -0
  231. package/ts/tracer.test.js +311 -0
  232. package/ts/tracer.test.js.map +1 -0
  233. package/ts/txt-en-decoder.d.ts +10 -0
  234. package/ts/txt-en-decoder.d.ts.map +1 -0
  235. package/ts/txt-en-decoder.js +15 -0
  236. package/ts/txt-en-decoder.js.map +1 -0
  237. package/ts/uri.d.ts +67 -0
  238. package/ts/uri.d.ts.map +1 -0
  239. package/ts/uri.js +283 -0
  240. package/ts/uri.js.map +1 -0
  241. package/ts/uri.test.d.ts +2 -0
  242. package/ts/uri.test.d.ts.map +1 -0
  243. package/ts/uri.test.js +119 -0
  244. package/ts/uri.test.js.map +1 -0
  245. package/ts/utils/console-write-stream.d.ts +21 -0
  246. package/ts/utils/console-write-stream.d.ts.map +1 -0
  247. package/ts/utils/console-write-stream.js +62 -0
  248. package/ts/utils/console-write-stream.js.map +1 -0
  249. package/ts/utils/fanout-write-stream.d.ts +12 -0
  250. package/ts/utils/fanout-write-stream.d.ts.map +1 -0
  251. package/ts/utils/fanout-write-stream.js +24 -0
  252. package/ts/utils/fanout-write-stream.js.map +1 -0
  253. package/ts/utils/index.d.ts +7 -0
  254. package/ts/utils/index.d.ts.map +1 -0
  255. package/ts/utils/index.js +7 -0
  256. package/ts/utils/index.js.map +1 -0
  257. package/ts/utils/rebuffer.d.ts +3 -0
  258. package/ts/utils/rebuffer.d.ts.map +1 -0
  259. package/ts/utils/rebuffer.js +60 -0
  260. package/ts/utils/rebuffer.js.map +1 -0
  261. package/ts/utils/rebuffer.test.d.ts +2 -0
  262. package/ts/utils/rebuffer.test.d.ts.map +1 -0
  263. package/ts/utils/rebuffer.test.js +77 -0
  264. package/ts/utils/rebuffer.test.js.map +1 -0
  265. package/ts/utils/stream-map.d.ts +9 -0
  266. package/ts/utils/stream-map.d.ts.map +1 -0
  267. package/ts/utils/stream-map.js +62 -0
  268. package/ts/utils/stream-map.js.map +1 -0
  269. package/ts/utils/stream-map.test.d.ts +2 -0
  270. package/ts/utils/stream-map.test.d.ts.map +1 -0
  271. package/ts/utils/stream-map.test.js +87 -0
  272. package/ts/utils/stream-map.test.js.map +1 -0
  273. package/ts/utils/stream-test-helper.d.ts +17 -0
  274. package/ts/utils/stream-test-helper.d.ts.map +1 -0
  275. package/ts/utils/stream-test-helper.js +37 -0
  276. package/ts/utils/stream-test-helper.js.map +1 -0
  277. package/ts/utils/stream2string.d.ts +3 -0
  278. package/ts/utils/stream2string.d.ts.map +1 -0
  279. package/ts/utils/stream2string.js +48 -0
  280. package/ts/utils/stream2string.js.map +1 -0
  281. package/ts/utils/stream2string.test.d.ts +2 -0
  282. package/ts/utils/stream2string.test.d.ts.map +1 -0
  283. package/ts/utils/stream2string.test.js +29 -0
  284. package/ts/utils/stream2string.test.js.map +1 -0
  285. package/ts/utils/string2stream.d.ts +4 -0
  286. package/ts/utils/string2stream.d.ts.map +1 -0
  287. package/ts/utils/string2stream.js +13 -0
  288. package/ts/utils/string2stream.js.map +1 -0
  289. package/ts/utils/string2stream.test.d.ts +2 -0
  290. package/ts/utils/string2stream.test.d.ts.map +1 -0
  291. package/ts/utils/string2stream.test.js +6 -0
  292. package/ts/utils/string2stream.test.js.map +1 -0
  293. package/ts/version.d.ts +2 -0
  294. package/ts/version.d.ts.map +1 -0
  295. package/ts/version.js +4 -0
  296. package/ts/version.js.map +1 -0
  297. package/ts/web/index.d.ts +2 -0
  298. package/ts/web/index.d.ts.map +1 -0
  299. package/ts/web/index.js +2 -0
  300. package/ts/web/index.js.map +1 -0
  301. package/ts/web/web-sys-abstraction.d.ts +4 -0
  302. package/ts/web/web-sys-abstraction.d.ts.map +1 -0
  303. package/ts/web/web-sys-abstraction.js +64 -0
  304. package/ts/web/web-sys-abstraction.js.map +1 -0
  305. package/utils/index.cjs +0 -42
  306. package/utils/index.cjs.map +1 -1
  307. package/utils/index.d.cts +1 -2
  308. package/utils/index.d.ts +1 -2
  309. package/utils/index.js +2 -7
  310. package/web/index.cjs +25 -7
  311. package/web/index.cjs.map +1 -1
  312. package/web/index.d.cts +2 -1
  313. package/web/index.d.ts +2 -1
  314. package/web/index.js +3 -3
  315. package/chunk-DPIL5UIL.js.map +0 -1
  316. package/chunk-LCPYQVWT.js +0 -21
  317. package/chunk-OXD3YZZ7.js.map +0 -1
  318. package/chunk-P5RXA4C4.js.map +0 -1
  319. package/chunk-YDIUMYIE.js.map +0 -1
package/node/index.d.cts CHANGED
@@ -1,10 +1,9 @@
1
+ import { F as FileService, N as NamedWritableStream, q as ExitService, p as ExitHandler, c as SystemService, f as Env, V as VoidFunc, W as WrapperSysAbstractionParams, S as SysAbstraction } from '../base-sys-abstraction-Qj7pkY1N.cjs';
1
2
  import { T as TxtEnDecoder } from '../txt-en-decoder-CZYJUju2.cjs';
2
- import { F as FileService, N as NamedWritableStream, q as ExitService, p as ExitHandler, b as SystemService, e as Env, V as VoidFunc, W as WrapperSysAbstractionParams, S as SysAbstraction } from '../base-sys-abstraction-C9WW3w57.cjs';
3
3
 
4
4
  declare class NodeFileService implements FileService {
5
5
  readonly baseDir: string;
6
6
  constructor(baseDir?: string);
7
- nodeImport(fname: string): string;
8
7
  readFileString(fname: string): Promise<string>;
9
8
  dirname(fname: string): string;
10
9
  basename(fname: string): string;
@@ -16,7 +15,7 @@ declare class NodeFileService implements FileService {
16
15
  create(fname: string): Promise<NamedWritableStream>;
17
16
  }
18
17
 
19
- declare class ExitServiceImpl implements ExitService {
18
+ declare class NodeExitServiceImpl implements ExitService {
20
19
  constructor();
21
20
  _exitHandlers: ExitHandler[];
22
21
  injectExitHandlers(hdls: ExitHandler[]): void;
@@ -35,6 +34,25 @@ declare class NodeSystemService implements SystemService {
35
34
  }
36
35
  declare function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
37
36
 
37
+ declare class DenoExitServiceImpl implements ExitService {
38
+ constructor();
39
+ _exitHandlers: ExitHandler[];
40
+ injectExitHandlers(hdls: ExitHandler[]): void;
41
+ invoked: boolean;
42
+ readonly _handleExit: () => Promise<void>;
43
+ exit(code: number): void;
44
+ }
45
+ declare class DenoSystemService implements SystemService {
46
+ static readonly _exitHandlers: ExitHandler[];
47
+ readonly _exitService: ExitService;
48
+ constructor();
49
+ Env(): Env;
50
+ Args(): string[];
51
+ OnExit(hdl: VoidFunc): VoidFunc;
52
+ Exit(code: number): void;
53
+ }
54
+ declare function DenoSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
55
+
38
56
  interface FileCollector {
39
57
  readonly name: string;
40
58
  content: string;
@@ -44,4 +62,4 @@ declare class MockFileService extends NodeFileService {
44
62
  create(fname: string): Promise<NamedWritableStream>;
45
63
  }
46
64
 
47
- export { ExitServiceImpl, type FileCollector, MockFileService, NodeFileService, NodeSysAbstraction, NodeSystemService };
65
+ export { DenoExitServiceImpl, DenoSysAbstraction, DenoSystemService, type FileCollector, MockFileService, NodeExitServiceImpl, NodeFileService, NodeSysAbstraction, NodeSystemService };
package/node/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
+ import { F as FileService, N as NamedWritableStream, q as ExitService, p as ExitHandler, c as SystemService, f as Env, V as VoidFunc, W as WrapperSysAbstractionParams, S as SysAbstraction } from '../base-sys-abstraction-BkEiLHl0.js';
1
2
  import { T as TxtEnDecoder } from '../txt-en-decoder-CZYJUju2.js';
2
- import { F as FileService, N as NamedWritableStream, q as ExitService, p as ExitHandler, b as SystemService, e as Env, V as VoidFunc, W as WrapperSysAbstractionParams, S as SysAbstraction } from '../base-sys-abstraction-C9WW3w57.js';
3
3
 
4
4
  declare class NodeFileService implements FileService {
5
5
  readonly baseDir: string;
6
6
  constructor(baseDir?: string);
7
- nodeImport(fname: string): string;
8
7
  readFileString(fname: string): Promise<string>;
9
8
  dirname(fname: string): string;
10
9
  basename(fname: string): string;
@@ -16,7 +15,7 @@ declare class NodeFileService implements FileService {
16
15
  create(fname: string): Promise<NamedWritableStream>;
17
16
  }
18
17
 
19
- declare class ExitServiceImpl implements ExitService {
18
+ declare class NodeExitServiceImpl implements ExitService {
20
19
  constructor();
21
20
  _exitHandlers: ExitHandler[];
22
21
  injectExitHandlers(hdls: ExitHandler[]): void;
@@ -35,6 +34,25 @@ declare class NodeSystemService implements SystemService {
35
34
  }
36
35
  declare function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
37
36
 
37
+ declare class DenoExitServiceImpl implements ExitService {
38
+ constructor();
39
+ _exitHandlers: ExitHandler[];
40
+ injectExitHandlers(hdls: ExitHandler[]): void;
41
+ invoked: boolean;
42
+ readonly _handleExit: () => Promise<void>;
43
+ exit(code: number): void;
44
+ }
45
+ declare class DenoSystemService implements SystemService {
46
+ static readonly _exitHandlers: ExitHandler[];
47
+ readonly _exitService: ExitService;
48
+ constructor();
49
+ Env(): Env;
50
+ Args(): string[];
51
+ OnExit(hdl: VoidFunc): VoidFunc;
52
+ Exit(code: number): void;
53
+ }
54
+ declare function DenoSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction;
55
+
38
56
  interface FileCollector {
39
57
  readonly name: string;
40
58
  content: string;
@@ -44,4 +62,4 @@ declare class MockFileService extends NodeFileService {
44
62
  create(fname: string): Promise<NamedWritableStream>;
45
63
  }
46
64
 
47
- export { ExitServiceImpl, type FileCollector, MockFileService, NodeFileService, NodeSysAbstraction, NodeSystemService };
65
+ export { DenoExitServiceImpl, DenoSysAbstraction, DenoSystemService, type FileCollector, MockFileService, NodeExitServiceImpl, NodeFileService, NodeSysAbstraction, NodeSystemService };
package/node/index.js CHANGED
@@ -1,27 +1,28 @@
1
- import {
2
- Utf8EnDecoderSingleton
3
- } from "../chunk-LCPYQVWT.js";
4
1
  import {
5
2
  BaseSysAbstraction,
6
3
  WrapperSysAbstraction,
7
4
  envFactory
8
- } from "../chunk-YDIUMYIE.js";
9
- import "../chunk-P5RXA4C4.js";
5
+ } from "../chunk-Q65HLCNL.js";
6
+ import {
7
+ Utf8EnDecoderSingleton
8
+ } from "../chunk-GES3MUGV.js";
10
9
 
11
10
  // src/node/node-file-service.ts
12
11
  import path from "node:path";
13
12
  import fs from "node:fs";
13
+ import process from "node:process";
14
14
  var NodeFileService = class {
15
15
  constructor(baseDir = process.cwd()) {
16
16
  this.baseDir = this.abs(baseDir);
17
17
  }
18
- nodeImport(fname) {
19
- if (path.isAbsolute(fname)) {
20
- return fname;
21
- } else {
22
- return "./" + path.normalize(fname);
23
- }
24
- }
18
+ // nodeImport(fname: string): string {
19
+ // // console.log('nodeImport:'+ fname);
20
+ // if (path.isAbsolute(fname)) {
21
+ // return fname;
22
+ // } else {
23
+ // return "./" + path.normalize(fname);
24
+ // }
25
+ // }
25
26
  readFileString(fname) {
26
27
  return fs.promises.readFile(fname, { encoding: "utf-8" });
27
28
  }
@@ -85,7 +86,8 @@ var NodeFileService = class {
85
86
  };
86
87
 
87
88
  // src/node/node-sys-abstraction.ts
88
- var ExitServiceImpl = class {
89
+ import process2 from "node:process";
90
+ var NodeExitServiceImpl = class {
89
91
  constructor() {
90
92
  this._exitHandlers = [];
91
93
  this.invoked = false;
@@ -104,25 +106,25 @@ var ExitServiceImpl = class {
104
106
  }
105
107
  }
106
108
  };
107
- process.on("unhandledRejection", (reason, p) => {
109
+ process2.on("unhandledRejection", (reason, p) => {
108
110
  this.exit(19);
109
111
  });
110
- process.on("uncaughtException", (error) => {
112
+ process2.on("uncaughtException", (error) => {
111
113
  this.exit(18);
112
114
  });
113
- process.on("close", () => {
115
+ process2.on("close", () => {
114
116
  this.exit(0);
115
117
  });
116
- process.on("exit", () => {
118
+ process2.on("exit", () => {
117
119
  this.exit(0);
118
120
  });
119
- process.on("SIGQUIT", () => {
121
+ process2.on("SIGQUIT", () => {
120
122
  this.exit(3);
121
123
  });
122
- process.on("SIGINT", () => {
124
+ process2.on("SIGINT", () => {
123
125
  this.exit(2);
124
126
  });
125
- process.on("SIGTERM", () => {
127
+ process2.on("SIGTERM", () => {
126
128
  this.exit(9);
127
129
  });
128
130
  }
@@ -131,23 +133,23 @@ var ExitServiceImpl = class {
131
133
  }
132
134
  exit(code) {
133
135
  this._handleExit().then(() => {
134
- process.exit(code);
136
+ process2.exit(code);
135
137
  }).catch((err) => {
136
138
  console.error("ExitService: failed to handle exit", err);
137
- process.exit(code);
139
+ process2.exit(code);
138
140
  });
139
141
  }
140
142
  };
141
143
  var _NodeSystemService = class _NodeSystemService {
142
144
  constructor() {
143
- this._exitService = new ExitServiceImpl();
145
+ this._exitService = new NodeExitServiceImpl();
144
146
  this._exitService.injectExitHandlers(_NodeSystemService._exitHandlers);
145
147
  }
146
148
  Env() {
147
149
  return envFactory();
148
150
  }
149
151
  Args() {
150
- return process.argv;
152
+ return process2.argv;
151
153
  }
152
154
  OnExit(hdl) {
153
155
  const id = crypto.randomUUID();
@@ -169,6 +171,7 @@ var my = void 0;
169
171
  function NodeSysAbstraction(param) {
170
172
  if (!my) {
171
173
  my = new BaseSysAbstraction({
174
+ TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
172
175
  FileSystem: new NodeFileService(),
173
176
  SystemService: new NodeSystemService()
174
177
  });
@@ -176,6 +179,176 @@ function NodeSysAbstraction(param) {
176
179
  return new WrapperSysAbstraction(my, param);
177
180
  }
178
181
 
182
+ // src/node/deno-sys-abstraction.ts
183
+ import * as process3 from "node:process";
184
+
185
+ // src/node/deno-file-service.ts
186
+ import * as path2 from "node:path";
187
+ var Deno = globalThis.Deno;
188
+ var DenoFileService = class {
189
+ constructor(baseDir = Deno.cwd(), txtEnde = Utf8EnDecoderSingleton()) {
190
+ this.baseDir = this.abs(baseDir);
191
+ this.txtEnde = txtEnde;
192
+ }
193
+ // nodeImport(fname: string): string {
194
+ // // console.log('nodeImport:'+ fname);
195
+ // if (path.isAbsolute(fname)) {
196
+ // return fname;
197
+ // } else {
198
+ // return "./" + path.normalize(fname);
199
+ // }
200
+ // }
201
+ async readFileString(fname) {
202
+ return this.txtEnde.decode(await Deno.readFile(fname));
203
+ }
204
+ dirname(fname) {
205
+ return path2.dirname(fname);
206
+ }
207
+ basename(fname) {
208
+ return path2.basename(fname);
209
+ }
210
+ join(...paths) {
211
+ return path2.join(...paths);
212
+ }
213
+ relative(from, to) {
214
+ if (to === void 0) {
215
+ to = from;
216
+ from = Deno.cwd();
217
+ }
218
+ const ret = path2.relative(from, to);
219
+ return ret;
220
+ }
221
+ abs(fname) {
222
+ if (path2.isAbsolute(fname)) {
223
+ return fname;
224
+ } else {
225
+ const cwd = Deno.cwd();
226
+ return path2.resolve(cwd, fname);
227
+ }
228
+ }
229
+ isAbsolute(fname) {
230
+ return path2.isAbsolute(fname);
231
+ }
232
+ async writeFileString(fname, content, ende = Utf8EnDecoderSingleton()) {
233
+ const o = await this.create(fname);
234
+ const wr = o.stream.getWriter();
235
+ await wr.write(ende.encode(content));
236
+ await wr.close();
237
+ }
238
+ async create(fname) {
239
+ let oName = fname;
240
+ if (!path2.isAbsolute(fname)) {
241
+ oName = this.abs(fname);
242
+ }
243
+ const base = path2.dirname(oName);
244
+ await Deno.mkdir(base, { recursive: true });
245
+ const out = await Deno.open(oName, {
246
+ write: true,
247
+ create: true,
248
+ truncate: true
249
+ });
250
+ return {
251
+ name: oName,
252
+ stream: out
253
+ };
254
+ }
255
+ };
256
+
257
+ // src/node/deno-sys-abstraction.ts
258
+ var Deno2 = globalThis.Deno;
259
+ var DenoExitServiceImpl = class {
260
+ constructor() {
261
+ this._exitHandlers = [];
262
+ this.invoked = false;
263
+ this._handleExit = async () => {
264
+ if (this.invoked) {
265
+ return;
266
+ }
267
+ this.invoked = true;
268
+ for (const h of this._exitHandlers) {
269
+ try {
270
+ const ret = h.hdl();
271
+ if (typeof ret.then === "function") {
272
+ await ret;
273
+ }
274
+ } finally {
275
+ }
276
+ }
277
+ };
278
+ globalThis.addEventListener("unhandledrejection", (e) => {
279
+ e.preventDefault();
280
+ this.exit(19);
281
+ });
282
+ globalThis.addEventListener("error", () => {
283
+ this.exit(19);
284
+ });
285
+ globalThis.addEventListener("uncaughtException", () => {
286
+ this.exit(19);
287
+ });
288
+ globalThis.addEventListener("unload", () => {
289
+ this.exit(0);
290
+ });
291
+ Deno2.addSignalListener("SIGQUIT", () => {
292
+ this.exit(3);
293
+ });
294
+ Deno2.addSignalListener("SIGINT", () => {
295
+ this.exit(2);
296
+ });
297
+ Deno2.addSignalListener("SIGTERM", () => {
298
+ this.exit(9);
299
+ });
300
+ }
301
+ injectExitHandlers(hdls) {
302
+ this._exitHandlers = hdls;
303
+ }
304
+ exit(code) {
305
+ this._handleExit().then(() => {
306
+ Deno2.exit(code);
307
+ }).catch((err) => {
308
+ console.error("ExitService: failed to handle exit", err);
309
+ Deno2.exit(code);
310
+ });
311
+ }
312
+ };
313
+ var _DenoSystemService = class _DenoSystemService {
314
+ constructor() {
315
+ this._exitService = new DenoExitServiceImpl();
316
+ this._exitService.injectExitHandlers(_DenoSystemService._exitHandlers);
317
+ }
318
+ Env() {
319
+ return envFactory();
320
+ }
321
+ Args() {
322
+ return process3.argv;
323
+ }
324
+ OnExit(hdl) {
325
+ const id = crypto.randomUUID();
326
+ _DenoSystemService._exitHandlers.push({ hdl, id });
327
+ return () => {
328
+ const idx = _DenoSystemService._exitHandlers.findIndex((h) => h.id === id);
329
+ if (idx >= 0) {
330
+ _DenoSystemService._exitHandlers.splice(idx, 1);
331
+ }
332
+ };
333
+ }
334
+ Exit(code) {
335
+ this._exitService.exit(code);
336
+ }
337
+ };
338
+ _DenoSystemService._exitHandlers = [];
339
+ var DenoSystemService = _DenoSystemService;
340
+ var my2 = void 0;
341
+ function DenoSysAbstraction(param) {
342
+ if (!my2) {
343
+ my2 = new BaseSysAbstraction({
344
+ TxtEnDecoder: (param == null ? void 0 : param.TxtEnDecoder) || Utf8EnDecoderSingleton(),
345
+ FileSystem: new DenoFileService(),
346
+ SystemService: new DenoSystemService()
347
+ });
348
+ }
349
+ return new WrapperSysAbstraction(my2, param);
350
+ }
351
+
179
352
  // src/node/mock-file-service.ts
180
353
  var MockFileService = class extends NodeFileService {
181
354
  constructor() {
@@ -213,8 +386,11 @@ var MockFileService = class extends NodeFileService {
213
386
  }
214
387
  };
215
388
  export {
216
- ExitServiceImpl,
389
+ DenoExitServiceImpl,
390
+ DenoSysAbstraction,
391
+ DenoSystemService,
217
392
  MockFileService,
393
+ NodeExitServiceImpl,
218
394
  NodeFileService,
219
395
  NodeSysAbstraction,
220
396
  NodeSystemService
package/node/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/node/node-file-service.ts","../../../src/node/node-sys-abstraction.ts","../../../src/node/mock-file-service.ts"],"sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs\";\nimport { FileService, NamedWritableStream } from \"../file-service\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder\";\n\nexport class NodeFileService implements FileService {\n readonly baseDir: string;\n constructor(baseDir: string = process.cwd()) {\n this.baseDir = this.abs(baseDir);\n }\n\n nodeImport(fname: string): string {\n // console.log('nodeImport:'+ fname);\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n return \"./\" + path.normalize(fname);\n }\n }\n\n readFileString(fname: string): Promise<string> {\n return fs.promises.readFile(fname, { encoding: \"utf-8\" });\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = process.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = process.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await fs.promises.mkdir(base, { recursive: true });\n const out = fs.createWriteStream(oName);\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk) {\n out.write(chunk);\n },\n close() {\n out.close();\n },\n abort() {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction\";\nimport { NodeFileService } from \"./node-file-service\";\nimport { envFactory } from \"../sys-env\";\n\nexport class ExitServiceImpl implements ExitService {\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"unhandledRejection\", (reason: string, p: Promise<unknown>) => {\n this.exit(19);\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"uncaughtException\", (error: Error) => {\n this.exit(18);\n });\n process.on(\"close\", () => {\n this.exit(0);\n });\n process.on(\"exit\", () => {\n this.exit(0);\n });\n process.on(\"SIGQUIT\", () => {\n this.exit(3);\n });\n process.on(\"SIGINT\", () => {\n this.exit(2);\n });\n process.on(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n process.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n process.exit(code);\n });\n }\n}\n\nexport class NodeSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new ExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);\n }\n\n Env() {\n return envFactory();\n }\n\n Args() {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n NodeSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n NodeSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n FileSystem: new NodeFileService(),\n SystemService: new NodeSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { NamedWritableStream } from \"../file-service\";\nimport { NodeFileService } from \"./node-file-service\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = await this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk) {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close() {\n // do nothing\n },\n abort() {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AAIR,IAAM,kBAAN,MAA6C;AAAA,EAElD,YAAY,UAAkB,QAAQ,IAAI,GAAG;AAC3C,SAAK,UAAU,KAAK,IAAI,OAAO;AAAA,EACjC;AAAA,EAEA,WAAW,OAAuB;AAEhC,QAAI,KAAK,WAAW,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT,OAAO;AACL,aAAO,OAAO,KAAK,UAAU,KAAK;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,eAAe,OAAgC;AAC7C,WAAO,GAAG,SAAS,SAAS,OAAO,EAAE,UAAU,QAAQ,CAAC;AAAA,EAC1D;AAAA,EAEA,QAAQ,OAAuB;AAC7B,WAAO,KAAK,QAAQ,KAAK;AAAA,EAC3B;AAAA,EACA,SAAS,OAAuB;AAC9B,WAAO,KAAK,SAAS,KAAK;AAAA,EAC5B;AAAA,EAEA,QAAQ,OAAyB;AAC/B,WAAO,KAAK,KAAK,GAAG,KAAK;AAAA,EAC3B;AAAA,EAEA,SAAS,MAAc,IAAqB;AAC1C,QAAI,OAAO,QAAW;AACpB,WAAK;AAC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AU,QAAQ,OAAO,KAAK;AAAA,QAChD;AAAA,QACA,QAAQ;AAAA,QAER;AAAA,QACA,QAAQ;AACN,gBAAM,IAAI,MAAM,iBAAiB;AAAA,QACnC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/node/node-file-service.ts","../../../src/node/node-sys-abstraction.ts","../../../src/node/deno-sys-abstraction.ts","../../../src/node/deno-file-service.ts","../../../src/node/mock-file-service.ts"],"sourcesContent":["import path from \"node:path\";\nimport fs from \"node:fs\";\nimport process from \"node:process\";\nimport { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\n\nexport class NodeFileService implements FileService {\n readonly baseDir: string;\n constructor(baseDir: string = process.cwd()) {\n this.baseDir = this.abs(baseDir);\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n readFileString(fname: string): Promise<string> {\n return fs.promises.readFile(fname, { encoding: \"utf-8\" });\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = process.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = process.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende: TxtEnDecoder = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await fs.promises.mkdir(base, { recursive: true });\n const out = fs.createWriteStream(oName);\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n out.write(chunk);\n },\n close(): void {\n out.close();\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport process from \"node:process\";\n\nexport class NodeExitServiceImpl implements ExitService {\n constructor() {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"unhandledRejection\", (reason: string, p: Promise<unknown>) => {\n this.exit(19);\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n process.on(\"uncaughtException\", (error: Error) => {\n this.exit(18);\n });\n process.on(\"close\", () => {\n this.exit(0);\n });\n process.on(\"exit\", () => {\n this.exit(0);\n });\n process.on(\"SIGQUIT\", () => {\n this.exit(3);\n });\n process.on(\"SIGINT\", () => {\n this.exit(2);\n });\n process.on(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n process.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n process.exit(code);\n });\n }\n}\n\nexport class NodeSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new NodeExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(NodeSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n NodeSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = NodeSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n NodeSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new NodeFileService(),\n SystemService: new NodeSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { SysAbstraction, SystemService, VoidFunc } from \"../sys-abstraction.js\";\nimport {\n BaseSysAbstraction,\n ExitHandler,\n ExitService,\n WrapperSysAbstraction,\n WrapperSysAbstractionParams,\n} from \"../base-sys-abstraction.js\";\nimport { Env, envFactory } from \"../sys-env.js\";\nimport { Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as process from \"node:process\";\nimport { DenoFileService } from \"./deno-file-service.js\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n addSignalListener(sig: string, hdl: () => void): void;\n exit(code?: number): void;\n};\n\nexport class DenoExitServiceImpl implements ExitService {\n constructor() {\n globalThis.addEventListener(\"unhandledrejection\", (e) => {\n e.preventDefault();\n this.exit(19);\n });\n globalThis.addEventListener(\"error\", () => {\n this.exit(19);\n });\n globalThis.addEventListener(\"uncaughtException\", () => {\n this.exit(19);\n });\n\n // process.on(\"close\", () => {\n // this.exit(0);\n // });\n globalThis.addEventListener(\"unload\", () => {\n this.exit(0);\n // console.log('goodbye!');\n });\n\n // process.on(\"exit\", () => {\n // });\n Deno.addSignalListener(\"SIGQUIT\", () => {\n this.exit(3);\n });\n Deno.addSignalListener(\"SIGINT\", () => {\n this.exit(2);\n });\n Deno.addSignalListener(\"SIGTERM\", () => {\n this.exit(9);\n });\n }\n _exitHandlers: ExitHandler[] = [];\n injectExitHandlers(hdls: ExitHandler[]): void {\n // console.log(\"ExitService: injecting exit handlers\", hdls)\n this._exitHandlers = hdls;\n }\n invoked = false;\n readonly _handleExit = async (): Promise<void> => {\n if (this.invoked) {\n // console.error(\"ExitService: already invoked\");\n return;\n }\n this.invoked = true;\n for (const h of this._exitHandlers) {\n try {\n // console.log(`ExitService: calling handler ${h.id}`)\n const ret = h.hdl();\n // console.log(`ExitService: called handler ${h.id}`, ret)\n if (typeof (ret as Promise<void>).then === \"function\") {\n await ret;\n }\n } finally {\n // ignore\n }\n }\n };\n\n exit(code: number): void {\n // console.log(\"ExitService: exit called\", code)\n this._handleExit()\n .then(() => {\n Deno.exit(code);\n })\n .catch((err) => {\n // eslint-disable-next-line no-console\n console.error(\"ExitService: failed to handle exit\", err);\n Deno.exit(code);\n });\n }\n}\n\nexport class DenoSystemService implements SystemService {\n static readonly _exitHandlers: ExitHandler[] = [];\n readonly _exitService: ExitService = new DenoExitServiceImpl();\n constructor() {\n this._exitService.injectExitHandlers(DenoSystemService._exitHandlers);\n }\n\n Env(): Env {\n return envFactory();\n }\n\n Args(): string[] {\n return process.argv;\n }\n\n OnExit(hdl: VoidFunc): VoidFunc {\n const id = crypto.randomUUID();\n DenoSystemService._exitHandlers.push({ hdl, id });\n return () => {\n const idx = DenoSystemService._exitHandlers.findIndex((h) => h.id === id);\n if (idx >= 0) {\n DenoSystemService._exitHandlers.splice(idx, 1);\n }\n };\n }\n\n Exit(code: number): void {\n this._exitService.exit(code);\n }\n}\n\nlet my: BaseSysAbstraction | undefined = undefined;\nexport function DenoSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {\n if (!my) {\n my = new BaseSysAbstraction({\n TxtEnDecoder: param?.TxtEnDecoder || Utf8EnDecoderSingleton(),\n FileSystem: new DenoFileService(),\n SystemService: new DenoSystemService(),\n });\n }\n return new WrapperSysAbstraction(my, param);\n}\n","import { FileService, NamedWritableStream } from \"../file-service.js\";\nimport { TxtEnDecoder, Utf8EnDecoderSingleton } from \"../txt-en-decoder.js\";\nimport * as path from \"node:path\";\n\nconst Deno = (globalThis as unknown as { Deno: unknown }).Deno as {\n cwd(): string;\n readFile(fname: string): Promise<Uint8Array>;\n mkdir(base: string, options: { recursive: boolean }): Promise<void>;\n open(fname: string, options: { write: boolean; create: boolean; truncate: boolean }): Promise<WritableStream>;\n};\n\nexport class DenoFileService implements FileService {\n readonly baseDir: string;\n readonly txtEnde: TxtEnDecoder;\n constructor(baseDir: string = Deno.cwd(), txtEnde: TxtEnDecoder = Utf8EnDecoderSingleton()) {\n this.baseDir = this.abs(baseDir);\n this.txtEnde = txtEnde;\n }\n\n // nodeImport(fname: string): string {\n // // console.log('nodeImport:'+ fname);\n // if (path.isAbsolute(fname)) {\n // return fname;\n // } else {\n // return \"./\" + path.normalize(fname);\n // }\n // }\n\n async readFileString(fname: string): Promise<string> {\n return this.txtEnde.decode(await Deno.readFile(fname));\n }\n\n dirname(fname: string): string {\n return path.dirname(fname);\n }\n basename(fname: string): string {\n return path.basename(fname);\n }\n\n join(...paths: string[]): string {\n return path.join(...paths);\n }\n\n relative(from: string, to?: string): string {\n if (to === undefined) {\n to = from;\n from = Deno.cwd();\n }\n const ret = path.relative(from, to);\n // console.log('relative:'+ from + \" -> \" + to + \"= \" + ret);\n return ret;\n }\n\n abs(fname: string): string {\n if (path.isAbsolute(fname)) {\n return fname;\n } else {\n const cwd = Deno.cwd();\n return path.resolve(cwd, fname);\n }\n }\n\n isAbsolute(fname: string): boolean {\n return path.isAbsolute(fname);\n }\n\n async writeFileString(fname: string, content: string, ende = Utf8EnDecoderSingleton()): Promise<void> {\n const o = await this.create(fname);\n const wr = o.stream.getWriter();\n await wr.write(ende.encode(content));\n await wr.close();\n }\n\n async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!path.isAbsolute(fname)) {\n oName = this.abs(fname);\n }\n\n const base = path.dirname(oName);\n await Deno.mkdir(base, { recursive: true });\n const out = await Deno.open(oName, {\n write: true,\n create: true,\n truncate: true,\n });\n return {\n name: oName,\n stream: out,\n };\n }\n}\n","import { NamedWritableStream } from \"../file-service.js\";\nimport { NodeFileService } from \"./node-file-service.js\";\n\nexport interface FileCollector {\n readonly name: string;\n content: string;\n}\n\nexport class MockFileService extends NodeFileService {\n readonly files = {} as Record<string, FileCollector>;\n\n // override abs(fname: string): string {\n // return this.join(\"/mock/\", fname);\n // }\n\n override async create(fname: string): Promise<NamedWritableStream> {\n let oName = fname;\n if (!this.isAbsolute(fname)) {\n oName = await this.abs(fname);\n }\n\n const fc = {\n name: oName,\n content: \"\",\n };\n this.files[oName] = fc;\n this.files[fname] = fc;\n const decoder = new TextDecoder();\n\n return {\n name: oName,\n stream: new WritableStream<Uint8Array>({\n write(chunk): void {\n fc.content = fc.content + decoder.decode(chunk);\n },\n close(): void {\n // do nothing\n },\n abort(): void {\n throw new Error(\"not implemented\");\n },\n }),\n };\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,aAAa;AAIb,IAAM,kBAAN,MAA6C;AAAA,EAElD,YAAY,UAAkB,QAAQ,IAAI,GAAG;AAC3C,SAAK,UAAU,KAAK,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,MAC1B,eAAc,+BAAO,iBAAgB,uBAAuB;AAAA,MAC5D,YAAY,IAAI,gBAAgB;AAAA,MAChC,eAAe,IAAI,kBAAkB;AAAA,IACvC,CAAC;AAAA,EACH;AACA,SAAO,IAAI,sBAAsBA,KAAI,KAAK;AAC5C;;;AE5HO,IAAM,kBAAN,cAA8B,gBAAgB;AAAA,EAA9C;AAAA;AACL,SAAS,QAAQ,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,MAAe,OAAO,OAA6C;AACjE,QAAI,QAAQ;AACZ,QAAI,CAAC,KAAK,WAAW,KAAK,GAAG;AAC3B,cAAQ,MAAM,KAAK,IAAI,KAAK;AAAA,IAC9B;AAEA,UAAM,KAAK;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AACA,SAAK,MAAM,KAAK,IAAI;AACpB,SAAK,MAAM,KAAK,IAAI;AACpB,UAAM,UAAU,IAAI,YAAY;AAEhC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,QAAQ,IAAI,eAA2B;AAAA,QACrC,MAAM,OAAa;AACjB,aAAG,UAAU,GAAG,UAAU,QAAQ,OAAO,KAAK;AAAA,QAChD;AAAA,QACA,QAAc;AAAA,QAEd;AAAA,QACA,QAAc;AACZ,gBAAM,IAAI,MAAM,iBAAiB;AAAA,QACnC;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":["process","process","path","Deno","my"]}
package/package.json CHANGED
@@ -1,29 +1,34 @@
1
1
  {
2
2
  "name": "@adviser/cement",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
4
4
  "description": "better try/catch/finally handling",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "exports": {
8
8
  ".": {
9
+ "types": "./index.d.ts",
9
10
  "require": "./index.cjs",
10
- "import": "./index.js",
11
- "types": "./index.d.ts"
11
+ "import": "./index.js"
12
12
  },
13
13
  "./web": {
14
+ "types": "./web/index.d.ts",
14
15
  "require": "./web/index.cjs",
15
- "import": "./web/index.js",
16
- "types": "./web/index.d.ts"
16
+ "import": "./web/index.js"
17
17
  },
18
18
  "./utils": {
19
+ "types": "./utils/index.d.ts",
19
20
  "require": "./utils/index.cjs",
20
- "import": "./utils/index.js",
21
- "types": "./utils/index.d.ts"
21
+ "import": "./utils/index.js"
22
22
  },
23
23
  "./node": {
24
+ "types": "./node/index.d.ts",
24
25
  "require": "./node/index.cjs",
25
- "import": "./node/index.js",
26
- "types": "./node/index.d.ts"
26
+ "import": "./node/index.js"
27
+ },
28
+ "./deno": {
29
+ "types": "./node/index.d.ts",
30
+ "require": "./node/index.cjs",
31
+ "import": "./node/index.js"
27
32
  }
28
33
  },
29
34
  "keywords": [],
@@ -33,21 +38,25 @@
33
38
  "url": "https://github.com/mabels/cement/issues"
34
39
  },
35
40
  "homepage": "https://github.com/mabels/cement#readme",
41
+ "dependencies": {
42
+ "ts-essentials": "^10.0.2",
43
+ "yaml": "^2.5.1"
44
+ },
36
45
  "devDependencies": {
37
46
  "@types/node": "^22.0.0",
38
47
  "@typescript-eslint/eslint-plugin": "^8.2.0",
39
48
  "@typescript-eslint/parser": "^8.3.0",
40
49
  "@vitest/browser": "^2.0.5",
50
+ "esbuild-plugin-replace": "^1.4.0",
51
+ "esbuild-plugin-resolve": "^2.0.0",
41
52
  "eslint": "^9.8.0",
42
53
  "prettier": "^3.2.5",
43
- "ts-essentials": "^10.0.2",
44
54
  "tsup": "^8.1.0",
45
55
  "tsx": "^4.16.0",
46
56
  "typescript": "^5.5.0",
47
57
  "typescript-eslint": "^8.2.0",
48
58
  "vite-tsconfig-paths": "^5.0.1",
49
59
  "vitest": "^2.0.5",
50
- "yaml": "^2.5.1",
51
60
  "webdriverio": "^9.0.7"
52
61
  },
53
62
  "engines": {
@@ -57,10 +66,12 @@
57
66
  "clean": "rm -rf dist node_modules",
58
67
  "build": "pnpm run build:tsc; pnpm run build:js",
59
68
  "build:tsc": "tsc",
69
+ "xbuild:js": "tsup",
60
70
  "build:js": "tsup --out-dir dist/pkg src/index.ts src/*/index.ts --sourcemap --format cjs,esm --dts --clean --external node:fs --external node:path",
61
71
  "test": "pnpm run test:js",
72
+ "test:deno": "deno run --allow-net --allow-write --allow-run --allow-sys --allow-ffi --allow-read --allow-env ./node_modules/vitest/vitest.mjs --run --project node",
62
73
  "test:js": "vitest --run",
63
- "pubdir": "pnpm run build; rm -rf pubdir ; mkdir -p pubdir; cp -pr ../.gitignore package.json ../README.md ../LICENSE pubdir/; cd dist/pkg ; cp -pr . ../../pubdir/",
74
+ "pubdir": "bash ./prepare-pubdir.sh",
64
75
  "presmoke": "pnpm run pubdir ; cd pubdir ; pnpm pack",
65
76
  "smoke": "cd smoke; rm -f package.json; pnpm init ; pnpm install -f ../pubdir/adviser-cement-*.tgz; npx tsx ./smoke.ts; deno run --allow-read ./smoke.ts",
66
77
  "lint": "eslint .",