@adviser/cement 0.0.0-jsr-t1 → 0.0.0
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/index.cjs +24 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +3 -1
- package/index.d.ts +3 -1
- package/index.js +22 -1
- package/index.js.map +1 -1
- package/package.json +14 -14
- package/src/index.ts +1 -0
- package/src/jsr.json +6 -8
- package/src/node/mock-file-service.test.ts +31 -0
- package/src/node/node-sys-abstraction.test.ts +100 -0
- package/src/refcounted.test.ts +42 -0
- package/src/refcounted.ts +23 -0
- package/src/test/mock-logger.test.ts +67 -0
- package/src/utils/rebuffer.test.ts +92 -0
- package/src/utils/stream-map.test.ts +106 -0
- package/src/utils/stream2string.test.ts +39 -0
- package/src/utils/string2stream.test.ts +6 -0
- package/ts/index.d.ts +1 -0
- package/ts/index.d.ts.map +1 -1
- package/ts/index.js +1 -0
- package/ts/index.js.map +1 -1
- package/ts/node/node-sys-abstraction.test.js +2 -6
- package/ts/node/node-sys-abstraction.test.js.map +1 -1
- package/ts/refcounted.d.ts +2 -0
- package/ts/refcounted.d.ts.map +1 -0
- package/ts/refcounted.js +19 -0
- package/ts/refcounted.js.map +1 -0
- package/ts/refcounted.test.d.ts +2 -0
- package/ts/refcounted.test.d.ts.map +1 -0
- package/ts/refcounted.test.js +39 -0
- package/ts/refcounted.test.js.map +1 -0
- /package/{ts → src}/LICENSE +0 -0
- /package/{ts → src}/README.md +0 -0
package/index.cjs
CHANGED
@@ -146,7 +146,8 @@ __export(src_exports, {
|
|
146
146
|
removeSelfRef: () => removeSelfRef,
|
147
147
|
runtimeFn: () => runtimeFn,
|
148
148
|
toCryptoRuntime: () => toCryptoRuntime,
|
149
|
-
utils: () => utils_exports
|
149
|
+
utils: () => utils_exports,
|
150
|
+
wrapRefcounted: () => wrapRefcounted
|
150
151
|
});
|
151
152
|
module.exports = __toCommonJS(src_exports);
|
152
153
|
|
@@ -2329,6 +2330,26 @@ var VERSION = Object.keys({
|
|
2329
2330
|
__packageVersion__: "xxxx"
|
2330
2331
|
})[0];
|
2331
2332
|
|
2333
|
+
// src/refcounted.ts
|
2334
|
+
function wrapRefcounted(t, method) {
|
2335
|
+
const my2 = t;
|
2336
|
+
my2.__refcounted = (my2.__refcounted || 0) + 1;
|
2337
|
+
if (my2.__refcounted === 1) {
|
2338
|
+
my2.__unrefcounted = my2[method];
|
2339
|
+
const mRec = my2;
|
2340
|
+
mRec[method] = function() {
|
2341
|
+
this.__refcounted--;
|
2342
|
+
if (this.__refcounted === 0) {
|
2343
|
+
this.__unrefcounted();
|
2344
|
+
}
|
2345
|
+
if (this.__refcounted < 0) {
|
2346
|
+
throw new Error("already closed");
|
2347
|
+
}
|
2348
|
+
};
|
2349
|
+
}
|
2350
|
+
return t;
|
2351
|
+
}
|
2352
|
+
|
2332
2353
|
// src/utils/index.ts
|
2333
2354
|
var utils_exports = {};
|
2334
2355
|
__export(utils_exports, {
|
@@ -2588,6 +2609,7 @@ function uint8array2stream(str) {
|
|
2588
2609
|
removeSelfRef,
|
2589
2610
|
runtimeFn,
|
2590
2611
|
toCryptoRuntime,
|
2591
|
-
utils
|
2612
|
+
utils,
|
2613
|
+
wrapRefcounted
|
2592
2614
|
});
|
2593
2615
|
//# sourceMappingURL=index.cjs.map
|