@adviser/cement 0.2.30 → 0.2.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. package/index.cjs +142 -36
  2. package/index.cjs.map +1 -1
  3. package/index.d.cts +26 -4
  4. package/index.d.ts +26 -4
  5. package/index.js +140 -33
  6. package/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/src/index.ts +0 -1
  9. package/src/jsr.json +1 -1
  10. package/src/logger-impl.ts +3 -1
  11. package/src/logger.ts +1 -0
  12. package/src/uri.ts +117 -9
  13. package/src/utils/stripper.ts +59 -0
  14. package/ts/index.d.ts +0 -1
  15. package/ts/index.d.ts.map +1 -1
  16. package/ts/index.js +0 -1
  17. package/ts/index.js.map +1 -1
  18. package/ts/logger-impl.d.ts.map +1 -1
  19. package/ts/logger-impl.js +3 -1
  20. package/ts/logger-impl.js.map +1 -1
  21. package/ts/logger.d.ts +1 -0
  22. package/ts/logger.d.ts.map +1 -1
  23. package/ts/logger.test.js +14 -0
  24. package/ts/logger.test.js.map +1 -1
  25. package/ts/uri.d.ts +23 -1
  26. package/ts/uri.d.ts.map +1 -1
  27. package/ts/uri.js +81 -10
  28. package/ts/uri.js.map +1 -1
  29. package/ts/uri.test.js +85 -0
  30. package/ts/uri.test.js.map +1 -1
  31. package/ts/utils/stripper.d.ts +3 -0
  32. package/ts/utils/stripper.d.ts.map +1 -0
  33. package/ts/utils/stripper.js +56 -0
  34. package/ts/utils/stripper.js.map +1 -0
  35. package/ts/utils/stripper.test.d.ts +2 -0
  36. package/ts/utils/stripper.test.d.ts.map +1 -0
  37. package/ts/utils/stripper.test.js +97 -0
  38. package/ts/utils/stripper.test.js.map +1 -0
  39. package/src/refcounted.ts +0 -23
  40. package/ts/refcounted.d.ts +0 -2
  41. package/ts/refcounted.d.ts.map +0 -1
  42. package/ts/refcounted.js +0 -19
  43. package/ts/refcounted.js.map +0 -1
  44. package/ts/refcounted.test.d.ts +0 -2
  45. package/ts/refcounted.test.d.ts.map +0 -1
  46. package/ts/refcounted.test.js +0 -39
  47. package/ts/refcounted.test.js.map +0 -1
package/ts/refcounted.js DELETED
@@ -1,19 +0,0 @@
1
- export function wrapRefcounted(t, method) {
2
- const my = t;
3
- my.__refcounted = (my.__refcounted || 0) + 1;
4
- if (my.__refcounted === 1) {
5
- my.__unrefcounted = my[method];
6
- const mRec = my;
7
- mRec[method] = function () {
8
- this.__refcounted--;
9
- if (this.__refcounted === 0) {
10
- this.__unrefcounted();
11
- }
12
- if (this.__refcounted < 0) {
13
- throw new Error("already closed");
14
- }
15
- };
16
- }
17
- return t;
18
- }
19
- //# sourceMappingURL=refcounted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refcounted.js","sourceRoot":"","sources":["../../src/refcounted.ts"],"names":[],"mappings":"AAKA,MAAM,UAAU,cAAc,CAAsB,CAAI,EAAE,MAAS;IACjE,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,EAAE,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,EAAE,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;QAC1B,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;QAC/B,MAAM,IAAI,GAAG,EAAgC,CAAC;QAC9C,IAAI,CAAC,MAAM,CAAC,GAAG;YACb,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,IAAI,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC;YACD,IAAI,IAAI,CAAC,YAAY,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=refcounted.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refcounted.test.d.ts","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":""}
@@ -1,39 +0,0 @@
1
- import { wrapRefcounted } from "./refcounted.js";
2
- class RealInstance {
3
- constructor(x) {
4
- this.isOpen = true;
5
- this.x = x;
6
- }
7
- wurst() {
8
- return this.x++;
9
- }
10
- close() {
11
- if (!this.isOpen) {
12
- throw new Error("already closed");
13
- }
14
- this.isOpen = false;
15
- }
16
- }
17
- it("simple", () => {
18
- const obj = wrapRefcounted(new RealInstance(42), "close");
19
- expect(obj.wurst()).toBe(42);
20
- obj.close();
21
- expect(() => obj.close()).toThrowError("already closed");
22
- });
23
- it("nested", () => {
24
- const ri = new RealInstance(42);
25
- const obj1 = wrapRefcounted(ri, "close");
26
- const obj2 = wrapRefcounted(ri, "close");
27
- expect(obj1).toBe(obj2);
28
- expect(obj1.wurst()).toBe(42);
29
- expect(obj2.wurst()).toBe(43);
30
- obj2.close();
31
- expect(obj2.isOpen).toBe(true);
32
- expect(obj2.wurst()).toBe(44);
33
- expect(obj1.wurst()).toBe(45);
34
- obj1.close();
35
- expect(obj1.wurst()).toBe(46);
36
- expect(obj2.isOpen).toBe(false);
37
- expect(() => obj2.close()).toThrowError("already closed");
38
- });
39
- //# sourceMappingURL=refcounted.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"refcounted.test.js","sourceRoot":"","sources":["../../src/refcounted.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,YAAY;IAGhB,YAAY,CAAS;QADrB,WAAM,GAAG,IAAI,CAAC;QAEZ,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,CAAC,EAAE,CAAC;IAClB,CAAC;IACD,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,gBAAgB,C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