@adviser/cement 0.2.29 → 0.2.30
Sign up to get free protection for your applications and to get access to all the features.
- 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 +4 -2
- package/src/refcounted.ts +23 -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/src/base-sys-abstraction.test.ts +0 -95
- package/src/bin2text.test.ts +0 -59
- package/src/crypto.test.ts +0 -15
- package/src/future.test.ts +0 -32
- package/src/logger.test.ts +0 -1132
- package/src/resolve-once.test.ts +0 -321
- package/src/result.test.ts +0 -102
- package/src/sys-env.test.ts +0 -53
- package/src/tracer.test.ts +0 -314
- package/src/uri.test.ts +0 -155
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
|