@adviser/cement 0.3.17 → 0.3.18

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.
Files changed (58) hide show
  1. package/cf/index.cjs +28 -25
  2. package/cf/index.cjs.map +1 -1
  3. package/cf/index.js +2 -2
  4. package/{chunk-JELISEAH.js → chunk-ERFPFVXB.js} +2 -2
  5. package/{chunk-ZWI2F6RL.js → chunk-NYHENJUJ.js} +60 -27
  6. package/chunk-NYHENJUJ.js.map +1 -0
  7. package/{chunk-ZYKVQZJH.js → chunk-RQKI6UPM.js} +3 -3
  8. package/deno/index.cjs +28 -25
  9. package/deno/index.cjs.map +1 -1
  10. package/deno/index.js +1 -1
  11. package/index.cjs +61 -27
  12. package/index.cjs.map +1 -1
  13. package/index.d.cts +21 -9
  14. package/index.d.ts +21 -9
  15. package/index.js +7 -5
  16. package/index.js.map +1 -1
  17. package/metafile-cjs.json +1 -1
  18. package/metafile-esm.json +1 -1
  19. package/node/index.cjs +28 -25
  20. package/node/index.cjs.map +1 -1
  21. package/node/index.js +1 -1
  22. package/package.json +1 -1
  23. package/src/index.ts +1 -1
  24. package/src/jsr.json +1 -1
  25. package/src/{lru-cache.ts → lru-map-set.ts} +68 -27
  26. package/src/resolve-once.ts +4 -4
  27. package/test/index.cjs +28 -25
  28. package/test/index.cjs.map +1 -1
  29. package/test/index.js +3 -3
  30. package/ts/src/index.d.ts +1 -1
  31. package/ts/src/index.d.ts.map +1 -1
  32. package/ts/src/index.js +1 -1
  33. package/ts/src/index.js.map +1 -1
  34. package/ts/src/lru-map-set.d.ts +32 -0
  35. package/ts/src/lru-map-set.d.ts.map +1 -0
  36. package/ts/src/lru-map-set.js +114 -0
  37. package/ts/src/lru-map-set.js.map +1 -0
  38. package/ts/src/lru-map-set.test.d.ts +2 -0
  39. package/ts/src/lru-map-set.test.d.ts.map +1 -0
  40. package/ts/src/{lru-cache.test.js → lru-map-set.test.js} +15 -15
  41. package/ts/src/lru-map-set.test.js.map +1 -0
  42. package/ts/src/resolve-once.d.ts +3 -3
  43. package/ts/src/resolve-once.d.ts.map +1 -1
  44. package/ts/src/resolve-once.js +2 -2
  45. package/ts/src/resolve-once.js.map +1 -1
  46. package/web/index.cjs +28 -25
  47. package/web/index.cjs.map +1 -1
  48. package/web/index.js +2 -2
  49. package/chunk-ZWI2F6RL.js.map +0 -1
  50. package/ts/src/lru-cache.d.ts +0 -20
  51. package/ts/src/lru-cache.d.ts.map +0 -1
  52. package/ts/src/lru-cache.js +0 -82
  53. package/ts/src/lru-cache.js.map +0 -1
  54. package/ts/src/lru-cache.test.d.ts +0 -2
  55. package/ts/src/lru-cache.test.d.ts.map +0 -1
  56. package/ts/src/lru-cache.test.js.map +0 -1
  57. /package/{chunk-JELISEAH.js.map → chunk-ERFPFVXB.js.map} +0 -0
  58. /package/{chunk-ZYKVQZJH.js.map → chunk-RQKI6UPM.js.map} +0 -0
package/test/index.cjs CHANGED
@@ -865,31 +865,31 @@ var WrapperSysAbstraction = class {
865
865
  }
866
866
  };
867
867
 
868
- // src/lru-cache.ts
869
- var LRUCache = class {
868
+ // src/lru-map-set.ts
869
+ var LRUMap = class {
870
870
  constructor(c = {}) {
871
- this._cache = /* @__PURE__ */ new Map();
871
+ this._map = /* @__PURE__ */ new Map();
872
872
  this.param = {
873
873
  maxEntries: c.maxEntries || 100,
874
874
  maxAge: c.maxAge || 0
875
875
  };
876
876
  }
877
877
  touch(key) {
878
- if (!this._cache.has(key)) {
878
+ if (!this._map.has(key)) {
879
879
  throw new Error(`key not found in cache: ${key}`);
880
880
  }
881
- const value = this._cache.get(key);
882
- this._cache.delete(key);
883
- this._cache.set(key, value);
881
+ const value = this._map.get(key);
882
+ this._map.delete(key);
883
+ this._map.set(key, value);
884
884
  return value;
885
885
  }
886
886
  setParam(param2 = {}) {
887
887
  if (typeof param2.maxEntries === "number") {
888
888
  this.param.maxEntries = param2.maxEntries;
889
- if (param2.maxEntries > 0 && this._cache.size > param2.maxEntries) {
889
+ if (param2.maxEntries > 0 && this._map.size > param2.maxEntries) {
890
890
  const toDelete = [];
891
- let cacheSize = this._cache.size;
892
- for (const key of this._cache.keys()) {
891
+ let cacheSize = this._map.size;
892
+ for (const key of this._map.keys()) {
893
893
  if (cacheSize > param2.maxEntries) {
894
894
  toDelete.push(key);
895
895
  cacheSize--;
@@ -898,15 +898,18 @@ var LRUCache = class {
898
898
  }
899
899
  }
900
900
  for (const key of toDelete) {
901
- this._cache.delete(key);
901
+ this._map.delete(key);
902
902
  }
903
903
  }
904
904
  }
905
905
  }
906
+ has(key) {
907
+ return this._map.has(key);
908
+ }
906
909
  get size() {
907
- return this._cache.size;
910
+ return this._map.size;
908
911
  }
909
- async getPut(key, createFN) {
912
+ async getSet(key, createFN) {
910
913
  const val = this.get(key);
911
914
  if (val) {
912
915
  return val;
@@ -917,31 +920,31 @@ var LRUCache = class {
917
920
  }
918
921
  }
919
922
  get(key) {
920
- if (this._cache.has(key)) {
923
+ if (this._map.has(key)) {
921
924
  return this.touch(key);
922
925
  }
923
- return this._cache.get(key);
926
+ return this._map.get(key);
924
927
  }
925
928
  set(key, value) {
926
- this._cache.delete(key);
927
- if (this.param.maxEntries > 0 && this._cache.size >= this.param.maxEntries) {
928
- this._cache.delete(this._cache.keys().next().value);
929
- this._cache.set(key, value);
929
+ this._map.delete(key);
930
+ if (this.param.maxEntries > 0 && this._map.size >= this.param.maxEntries) {
931
+ this._map.delete(this._map.keys().next().value);
932
+ this._map.set(key, value);
930
933
  } else {
931
- this._cache.set(key, value);
934
+ this._map.set(key, value);
932
935
  }
933
936
  }
934
937
  delete(key) {
935
- this._cache.delete(key);
938
+ this._map.delete(key);
936
939
  }
937
940
  clear() {
938
- this._cache.clear();
941
+ this._map.clear();
939
942
  }
940
943
  forEach(callbackfn) {
941
- this._cache.forEach(callbackfn);
944
+ this._map.forEach(callbackfn);
942
945
  }
943
946
  entries() {
944
- return this._cache.entries();
947
+ return this._map.entries();
945
948
  }
946
949
  // *entries(): IterableIterator<[T, K]> {
947
950
  // for (const x of this._cache.entries()) {
@@ -1052,7 +1055,7 @@ var Keyed = class {
1052
1055
  constructor(factory, params) {
1053
1056
  var _a;
1054
1057
  this.factory = factory;
1055
- this._map = new LRUCache((_a = params == null ? void 0 : params.lru) != null ? _a : { maxEntries: -1 });
1058
+ this._map = new LRUMap((_a = params == null ? void 0 : params.lru) != null ? _a : { maxEntries: -1 });
1056
1059
  }
1057
1060
  setParam(params) {
1058
1061
  this._map.setParam(params.lru);