@adviser/cement 0.3.7 → 0.3.9
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-WS7lNbFm.d.cts → base-sys-abstraction-4Vw4QGaI.d.cts} +2 -2
- package/{base-sys-abstraction-Cqb4snul.d.ts → base-sys-abstraction-8v83VyEU.d.ts} +2 -2
- package/cf/index.cjs +16 -7
- package/cf/index.cjs.map +1 -1
- package/cf/index.d.cts +3 -3
- package/cf/index.d.ts +3 -3
- package/cf/index.js +5 -5
- package/cf/index.js.map +1 -1
- package/{chunk-BVZ6HD34.js → chunk-A57BAYWU.js} +7 -7
- package/{chunk-BVZ6HD34.js.map → chunk-A57BAYWU.js.map} +1 -1
- package/{chunk-SCFB6I2C.js → chunk-EQMNXZ4G.js} +12 -3
- package/chunk-EQMNXZ4G.js.map +1 -0
- package/{chunk-K5TIGJ6I.js → chunk-OMB3WMYS.js} +5 -5
- package/chunk-OMB3WMYS.js.map +1 -0
- package/{chunk-LNS2K5WL.js → chunk-PNTCDKAB.js} +7 -7
- package/chunk-PNTCDKAB.js.map +1 -0
- package/{chunk-H5JLIMWA.js → chunk-W53WEZWY.js} +4 -4
- package/{chunk-H5JLIMWA.js.map → chunk-W53WEZWY.js.map} +1 -1
- package/deno/index.cjs +18 -9
- package/deno/index.cjs.map +1 -1
- package/deno/index.d.cts +3 -3
- package/deno/index.d.ts +3 -3
- package/deno/index.js +6 -6
- package/deno/index.js.map +1 -1
- package/{get-params-result-CXYbMEcV.d.ts → get-params-result-C2cbgB78.d.cts} +2 -2
- package/{get-params-result-CXYbMEcV.d.cts → get-params-result-C2cbgB78.d.ts} +2 -2
- package/{index-BeXMFEyF.d.ts → index-CbOCsgzP.d.ts} +2 -2
- package/{index-C6hvxtE7.d.cts → index-Dpc3oVOD.d.cts} +1 -1
- package/{index-BH1SIYUK.d.cts → index-EnKo_jNv.d.cts} +2 -2
- package/{index-BQMIP01w.d.ts → index-MWn9Xel9.d.ts} +1 -1
- package/index.cjs +26 -17
- package/index.cjs.map +1 -1
- package/index.d.cts +12 -11
- package/index.d.ts +12 -11
- package/index.js +12 -12
- package/index.js.map +1 -1
- package/metafile-cjs.json +1 -1
- package/metafile-esm.json +1 -1
- package/node/index.cjs +17 -8
- package/node/index.cjs.map +1 -1
- package/node/index.d.cts +3 -3
- package/node/index.d.ts +3 -3
- package/node/index.js +5 -5
- package/node/index.js.map +1 -1
- package/package.json +2 -2
- package/src/cf/cf-sys-abstraction.ts +2 -2
- package/src/deno/deno-file-service.ts +3 -3
- package/src/deno/deno-sys-abstraction.ts +2 -2
- package/src/json-en-decoder.ts +9 -9
- package/src/jsr.json +1 -1
- package/src/logger-impl.ts +2 -2
- package/src/node/node-file-service.ts +2 -2
- package/src/node/node-sys-abstraction.ts +2 -2
- package/src/resolve-once.ts +12 -1
- package/src/test/log-write-stream.ts +2 -2
- package/src/txt-en-decoder.ts +5 -5
- package/src/utils/string2stream.ts +2 -2
- package/src/web/web-sys-abstraction.ts +2 -2
- package/{sys-abstraction-B-0XMe9V.d.cts → sys-abstraction-3OXhCVsu.d.cts} +1 -1
- package/{sys-abstraction-CZa-VyNs.d.ts → sys-abstraction-DXeSUn9x.d.ts} +1 -1
- package/test/index.cjs +18 -9
- package/test/index.cjs.map +1 -1
- package/test/index.d.cts +3 -3
- package/test/index.d.ts +3 -3
- package/test/index.js +4 -4
- package/ts/src/cf/cf-sys-abstraction.js +2 -2
- package/ts/src/cf/cf-sys-abstraction.js.map +1 -1
- package/ts/src/deno/deno-file-service.d.ts.map +1 -1
- package/ts/src/deno/deno-file-service.js +3 -3
- package/ts/src/deno/deno-file-service.js.map +1 -1
- package/ts/src/deno/deno-sys-abstraction.js +2 -2
- package/ts/src/deno/deno-sys-abstraction.js.map +1 -1
- package/ts/src/json-en-decoder.d.ts +2 -2
- package/ts/src/json-en-decoder.d.ts.map +1 -1
- package/ts/src/json-en-decoder.js +6 -6
- package/ts/src/json-en-decoder.js.map +1 -1
- package/ts/src/logger-impl.d.ts.map +1 -1
- package/ts/src/logger-impl.js +2 -2
- package/ts/src/logger-impl.js.map +1 -1
- package/ts/src/node/node-file-service.d.ts.map +1 -1
- package/ts/src/node/node-file-service.js +2 -2
- package/ts/src/node/node-file-service.js.map +1 -1
- package/ts/src/node/node-sys-abstraction.js +2 -2
- package/ts/src/node/node-sys-abstraction.js.map +1 -1
- package/ts/src/resolve-once.d.ts +1 -0
- package/ts/src/resolve-once.d.ts.map +1 -1
- package/ts/src/resolve-once.js +11 -1
- package/ts/src/resolve-once.js.map +1 -1
- package/ts/src/resolve-once.test.js +26 -0
- package/ts/src/resolve-once.test.js.map +1 -1
- package/ts/src/test/log-write-stream.d.ts.map +1 -1
- package/ts/src/test/log-write-stream.js +2 -2
- package/ts/src/test/log-write-stream.js.map +1 -1
- package/ts/src/txt-en-decoder.d.ts +1 -1
- package/ts/src/txt-en-decoder.d.ts.map +1 -1
- package/ts/src/txt-en-decoder.js +5 -5
- package/ts/src/txt-en-decoder.js.map +1 -1
- package/ts/src/txt-en-decoder.test.js +3 -15
- package/ts/src/txt-en-decoder.test.js.map +1 -1
- package/ts/src/utils/string2stream.d.ts.map +1 -1
- package/ts/src/utils/string2stream.js +2 -2
- package/ts/src/utils/string2stream.js.map +1 -1
- package/ts/src/web/web-sys-abstraction.js +2 -2
- package/ts/src/web/web-sys-abstraction.js.map +1 -1
- package/utils/index.cjs +6 -6
- package/utils/index.cjs.map +1 -1
- package/utils/index.d.cts +2 -2
- package/utils/index.d.ts +2 -2
- package/utils/index.js +2 -2
- package/web/index.cjs +16 -7
- package/web/index.cjs.map +1 -1
- package/web/index.d.cts +3 -3
- package/web/index.d.ts +3 -3
- package/web/index.js +3 -3
- package/chunk-K5TIGJ6I.js.map +0 -1
- package/chunk-LNS2K5WL.js.map +0 -1
- package/chunk-SCFB6I2C.js.map +0 -1
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
3
3
|
import process from "node:process";
|
4
4
|
import { FileService, NamedWritableStream } from "../file-service.js";
|
5
|
-
import { TxtEnDecoder,
|
5
|
+
import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
|
6
6
|
|
7
7
|
export class NodeFileService implements FileService {
|
8
8
|
readonly baseDir: string;
|
@@ -57,7 +57,7 @@ export class NodeFileService implements FileService {
|
|
57
57
|
return path.isAbsolute(fname);
|
58
58
|
}
|
59
59
|
|
60
|
-
async writeFileString(fname: string, content: string, ende: TxtEnDecoder =
|
60
|
+
async writeFileString(fname: string, content: string, ende: TxtEnDecoder = TxtEnDecoderSingleton()): Promise<void> {
|
61
61
|
const o = await this.create(fname);
|
62
62
|
const wr = o.stream.getWriter();
|
63
63
|
await wr.write(ende.encode(content));
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
} from "../base-sys-abstraction.js";
|
9
9
|
import { NodeFileService } from "./node-file-service.js";
|
10
10
|
import { Env, envFactory } from "../sys-env.js";
|
11
|
-
import {
|
11
|
+
import { TxtEnDecoderSingleton } from "../txt-en-decoder.js";
|
12
12
|
import process from "node:process";
|
13
13
|
|
14
14
|
export class NodeExitServiceImpl implements ExitService {
|
@@ -112,7 +112,7 @@ let my: BaseSysAbstraction | undefined = undefined;
|
|
112
112
|
export function NodeSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {
|
113
113
|
if (!my) {
|
114
114
|
my = new BaseSysAbstraction({
|
115
|
-
TxtEnDecoder: param?.TxtEnDecoder ||
|
115
|
+
TxtEnDecoder: param?.TxtEnDecoder || TxtEnDecoderSingleton(),
|
116
116
|
FileSystem: new NodeFileService(),
|
117
117
|
SystemService: new NodeSystemService(),
|
118
118
|
});
|
package/src/resolve-once.ts
CHANGED
@@ -47,6 +47,7 @@ export class ResolveOnce<T, CTX = void> {
|
|
47
47
|
_onceValue?: T;
|
48
48
|
_onceError?: Error;
|
49
49
|
_isPromise = false;
|
50
|
+
_inProgress?: Future<T>;
|
50
51
|
|
51
52
|
readonly ctx: CTX;
|
52
53
|
|
@@ -63,7 +64,15 @@ export class ResolveOnce<T, CTX = void> {
|
|
63
64
|
this._onceOk = false;
|
64
65
|
this._onceValue = undefined;
|
65
66
|
this._onceError = undefined;
|
66
|
-
this.
|
67
|
+
if (this._inProgress) {
|
68
|
+
const idx = this._onceFutures.findIndex((f) => f === this._inProgress);
|
69
|
+
if (idx >= 0) {
|
70
|
+
// leave the current in progress future
|
71
|
+
this._onceFutures.push(...this._onceFutures.splice(2).slice(1));
|
72
|
+
}
|
73
|
+
} else {
|
74
|
+
this._onceFutures.length = 0;
|
75
|
+
}
|
67
76
|
}
|
68
77
|
|
69
78
|
// T extends Option<infer U> ? U : T
|
@@ -110,6 +119,7 @@ export class ResolveOnce<T, CTX = void> {
|
|
110
119
|
}
|
111
120
|
this._onceFutures.length = 0;
|
112
121
|
};
|
122
|
+
this._inProgress = future;
|
113
123
|
try {
|
114
124
|
const ret = fn(this.ctx);
|
115
125
|
if (typeof (ret as Promise<T>).then === "function") {
|
@@ -121,6 +131,7 @@ export class ResolveOnce<T, CTX = void> {
|
|
121
131
|
} catch (e) {
|
122
132
|
catchFn(e as Error);
|
123
133
|
}
|
134
|
+
this._inProgress = undefined;
|
124
135
|
}
|
125
136
|
if (this._isPromise) {
|
126
137
|
return future.asPromise() as unknown as R;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FanoutWriteStream } from "../utils/fanout-write-stream.js";
|
2
2
|
import { Future } from "../future.js";
|
3
|
-
import { TxtEnDecoder,
|
3
|
+
import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
|
4
4
|
|
5
5
|
export class LogWriteStream implements WritableStreamDefaultWriter<Uint8Array> {
|
6
6
|
private readonly _bufferArr: Uint8Array[];
|
@@ -42,7 +42,7 @@ export class LogCollector implements WritableStream<Uint8Array> {
|
|
42
42
|
|
43
43
|
constructor(pass?: WritableStreamDefaultWriter<Uint8Array>, txtEnDe?: TxtEnDecoder) {
|
44
44
|
this._pass = pass;
|
45
|
-
this._txtEnDe = txtEnDe ||
|
45
|
+
this._txtEnDe = txtEnDe || TxtEnDecoderSingleton();
|
46
46
|
}
|
47
47
|
|
48
48
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
package/src/txt-en-decoder.ts
CHANGED
@@ -10,7 +10,7 @@ export interface TxtEnDecoder {
|
|
10
10
|
asyncDecode(input: AsyncToEnDecoder): Promise<string>;
|
11
11
|
}
|
12
12
|
|
13
|
-
class
|
13
|
+
class TxtOps implements TxtEnDecoder {
|
14
14
|
readonly encoder = new TextEncoder();
|
15
15
|
readonly decoder = new TextDecoder();
|
16
16
|
|
@@ -43,8 +43,8 @@ class Utf8EnDecoder implements TxtEnDecoder {
|
|
43
43
|
}
|
44
44
|
}
|
45
45
|
|
46
|
-
let
|
47
|
-
export function
|
48
|
-
|
49
|
-
return
|
46
|
+
let txtEnDecoder: TxtEnDecoder;
|
47
|
+
export function TxtEnDecoderSingleton(): TxtEnDecoder {
|
48
|
+
txtEnDecoder = txtEnDecoder ?? new TxtOps();
|
49
|
+
return txtEnDecoder;
|
50
50
|
}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { TxtEnDecoder,
|
1
|
+
import { TxtEnDecoder, TxtEnDecoderSingleton } from "../txt-en-decoder.js";
|
2
2
|
|
3
|
-
export function string2stream(str: string, ende: TxtEnDecoder =
|
3
|
+
export function string2stream(str: string, ende: TxtEnDecoder = TxtEnDecoderSingleton()): ReadableStream<Uint8Array> {
|
4
4
|
return uint8array2stream(ende.encode(str));
|
5
5
|
}
|
6
6
|
|
@@ -2,7 +2,7 @@ import { BaseSysAbstraction, WrapperSysAbstraction, WrapperSysAbstractionParams
|
|
2
2
|
import { FileService, NamedWritableStream } from "../file-service.js";
|
3
3
|
import { SysAbstraction, SystemService, VoidFunc } from "../sys-abstraction.js";
|
4
4
|
import { Env, envFactory } from "../sys-env.js";
|
5
|
-
import {
|
5
|
+
import { TxtEnDecoderSingleton } from "../txt-en-decoder.js";
|
6
6
|
|
7
7
|
export class WebFileService implements FileService {
|
8
8
|
get baseDir(): string {
|
@@ -71,7 +71,7 @@ let my: BaseSysAbstraction | undefined = undefined;
|
|
71
71
|
export function WebSysAbstraction(param?: WrapperSysAbstractionParams): SysAbstraction {
|
72
72
|
if (!my) {
|
73
73
|
my = new BaseSysAbstraction({
|
74
|
-
TxtEnDecoder: param?.TxtEnDecoder ||
|
74
|
+
TxtEnDecoder: param?.TxtEnDecoder || TxtEnDecoderSingleton(),
|
75
75
|
FileSystem: new WebFileService(),
|
76
76
|
SystemService: new WebSystemService(),
|
77
77
|
});
|
package/test/index.cjs
CHANGED
@@ -218,7 +218,7 @@ function coerceIntoUint8(raw) {
|
|
218
218
|
}
|
219
219
|
|
220
220
|
// src/txt-en-decoder.ts
|
221
|
-
var
|
221
|
+
var TxtOps = class {
|
222
222
|
constructor() {
|
223
223
|
this.encoder = new TextEncoder();
|
224
224
|
this.decoder = new TextDecoder();
|
@@ -249,10 +249,10 @@ var Utf8EnDecoder = class {
|
|
249
249
|
return this.decode(resolved);
|
250
250
|
}
|
251
251
|
};
|
252
|
-
var
|
253
|
-
function
|
254
|
-
|
255
|
-
return
|
252
|
+
var txtEnDecoder;
|
253
|
+
function TxtEnDecoderSingleton() {
|
254
|
+
txtEnDecoder = txtEnDecoder != null ? txtEnDecoder : new TxtOps();
|
255
|
+
return txtEnDecoder;
|
256
256
|
}
|
257
257
|
|
258
258
|
// src/test/log-write-stream.ts
|
@@ -286,7 +286,7 @@ var LogCollector = class {
|
|
286
286
|
this.locked = false;
|
287
287
|
this._bufferArr = [];
|
288
288
|
this._pass = pass;
|
289
|
-
this._txtEnDe = txtEnDe ||
|
289
|
+
this._txtEnDe = txtEnDe || TxtEnDecoderSingleton();
|
290
290
|
}
|
291
291
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
292
292
|
abort(reason) {
|
@@ -850,7 +850,14 @@ var ResolveOnce = class {
|
|
850
850
|
this._onceOk = false;
|
851
851
|
this._onceValue = void 0;
|
852
852
|
this._onceError = void 0;
|
853
|
-
this.
|
853
|
+
if (this._inProgress) {
|
854
|
+
const idx = this._onceFutures.findIndex((f) => f === this._inProgress);
|
855
|
+
if (idx >= 0) {
|
856
|
+
this._onceFutures.push(...this._onceFutures.splice(2).slice(1));
|
857
|
+
}
|
858
|
+
} else {
|
859
|
+
this._onceFutures.length = 0;
|
860
|
+
}
|
854
861
|
}
|
855
862
|
// T extends Option<infer U> ? U : T
|
856
863
|
once(fn) {
|
@@ -893,6 +900,7 @@ var ResolveOnce = class {
|
|
893
900
|
}
|
894
901
|
this._onceFutures.length = 0;
|
895
902
|
};
|
903
|
+
this._inProgress = future;
|
896
904
|
try {
|
897
905
|
const ret = fn(this.ctx);
|
898
906
|
if (typeof ret.then === "function") {
|
@@ -904,6 +912,7 @@ var ResolveOnce = class {
|
|
904
912
|
} catch (e) {
|
905
913
|
catchFn(e);
|
906
914
|
}
|
915
|
+
this._inProgress = void 0;
|
907
916
|
}
|
908
917
|
if (this._isPromise) {
|
909
918
|
return future.asPromise();
|
@@ -1411,7 +1420,7 @@ var my = void 0;
|
|
1411
1420
|
function WebSysAbstraction(param2) {
|
1412
1421
|
if (!my) {
|
1413
1422
|
my = new BaseSysAbstraction({
|
1414
|
-
TxtEnDecoder: (param2 == null ? void 0 : param2.TxtEnDecoder) ||
|
1423
|
+
TxtEnDecoder: (param2 == null ? void 0 : param2.TxtEnDecoder) || TxtEnDecoderSingleton(),
|
1415
1424
|
FileSystem: new WebFileService(),
|
1416
1425
|
SystemService: new WebSystemService()
|
1417
1426
|
});
|
@@ -2170,7 +2179,7 @@ var LoggerImpl = class _LoggerImpl {
|
|
2170
2179
|
this._sys = params.sys;
|
2171
2180
|
}
|
2172
2181
|
if (!params.txtEnDe) {
|
2173
|
-
this._txtEnDe =
|
2182
|
+
this._txtEnDe = TxtEnDecoderSingleton();
|
2174
2183
|
} else {
|
2175
2184
|
this._txtEnDe = params.txtEnDe;
|
2176
2185
|
}
|