@flopflip/localstorage-cache 14.0.2 → 15.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/dist/index.cjs ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/cache.ts
2
+ var createCache = (options) => {
3
+ const cache = {
4
+ get(key) {
5
+ const cacheKey = [options.prefix, key].join("/");
6
+ const localStorageValue = localStorage.getItem(cacheKey);
7
+ return localStorageValue ? JSON.parse(localStorageValue) : null;
8
+ },
9
+ set(key, value) {
10
+ try {
11
+ const cacheKey = [options.prefix, key].join("/");
12
+ localStorage.setItem(cacheKey, JSON.stringify(value));
13
+ return true;
14
+ } catch (_error) {
15
+ return false;
16
+ }
17
+ },
18
+ unset(key) {
19
+ const cacheKey = [options.prefix, key].join("/");
20
+ localStorage.removeItem(cacheKey);
21
+ }
22
+ };
23
+ return cache;
24
+ };
25
+
26
+ // src/index.ts
27
+ var version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
28
+
29
+
30
+
31
+ exports.createCache = createCache; exports.version = version;
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/flopflip/flopflip/packages/localstorage-cache/dist/index.cjs","../src/cache.ts","../src/index.ts"],"names":[],"mappings":"AAAA;ACEA,IAAM,YAAA,EAAc,CAAC,OAAA,EAAA,GAA2B;AAC9C,EAAA,MAAM,MAAA,EAAgB;AAAA,IACpB,GAAA,CAAI,GAAA,EAAK;AACP,MAAA,MAAM,SAAA,EAAW,CAAC,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAE/C,MAAA,MAAM,kBAAA,EAAoB,YAAA,CAAa,OAAA,CAAQ,QAAQ,CAAA;AAEvD,MAAA,OAAO,kBAAA,EAAoB,IAAA,CAAK,KAAA,CAAM,iBAAiB,EAAA,EAAI,IAAA;AAAA,IAC7D,CAAA;AAAA,IACA,GAAA,CAAI,GAAA,EAAK,KAAA,EAAO;AACd,MAAA,IAAI;AACF,QAAA,MAAM,SAAA,EAAW,CAAC,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAE/C,QAAA,YAAA,CAAa,OAAA,CAAQ,QAAA,EAAU,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AAEpD,QAAA,OAAO,IAAA;AAAA,MACT,EAAA,MAAA,CAAS,MAAA,EAAQ;AACf,QAAA,OAAO,KAAA;AAAA,MACT;AAAA,IACF,CAAA;AAAA,IACA,KAAA,CAAM,GAAA,EAAK;AACT,MAAA,MAAM,SAAA,EAAW,CAAC,OAAA,CAAQ,MAAA,EAAQ,GAAG,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAE/C,MAAA,YAAA,CAAa,UAAA,CAAW,QAAQ,CAAA;AAAA,IAClC;AAAA,EACF,CAAA;AAEA,EAAA,OAAO,KAAA;AACT,CAAA;ADNA;AACA;AEzBA,IAAM,QAAA,EAAU,kCAAA;AF2BhB;AACE;AACA;AACF,6DAAC","file":"/home/runner/work/flopflip/flopflip/packages/localstorage-cache/dist/index.cjs","sourcesContent":[null,"import type { TCache, TCacheOptions } from '@flopflip/types';\n\nconst createCache = (options: TCacheOptions) => {\n const cache: TCache = {\n get(key) {\n const cacheKey = [options.prefix, key].join('/');\n\n const localStorageValue = localStorage.getItem(cacheKey);\n\n return localStorageValue ? JSON.parse(localStorageValue) : null;\n },\n set(key, value) {\n try {\n const cacheKey = [options.prefix, key].join('/');\n\n localStorage.setItem(cacheKey, JSON.stringify(value));\n\n return true;\n } catch (_error) {\n return false;\n }\n },\n unset(key) {\n const cacheKey = [options.prefix, key].join('/');\n\n localStorage.removeItem(cacheKey);\n },\n };\n\n return cache;\n};\n\nexport { createCache };\n","const version = '__@FLOPFLIP/VERSION_OF_RELEASE__';\n\nexport { createCache } from './cache';\nexport { version };\n"]}
@@ -0,0 +1,7 @@
1
+ import { TCacheOptions, TCache } from '@flopflip/types';
2
+
3
+ declare const createCache: (options: TCacheOptions) => TCache;
4
+
5
+ declare const version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
6
+
7
+ export { createCache, version };
@@ -0,0 +1,7 @@
1
+ import { TCacheOptions, TCache } from '@flopflip/types';
2
+
3
+ declare const createCache: (options: TCacheOptions) => TCache;
4
+
5
+ declare const version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
6
+
7
+ export { createCache, version };
@@ -1,13 +1,14 @@
1
- const createCache = options => {
1
+ // src/cache.ts
2
+ var createCache = (options) => {
2
3
  const cache = {
3
4
  get(key) {
4
- const cacheKey = [options.prefix, key].join('/');
5
+ const cacheKey = [options.prefix, key].join("/");
5
6
  const localStorageValue = localStorage.getItem(cacheKey);
6
7
  return localStorageValue ? JSON.parse(localStorageValue) : null;
7
8
  },
8
9
  set(key, value) {
9
10
  try {
10
- const cacheKey = [options.prefix, key].join('/');
11
+ const cacheKey = [options.prefix, key].join("/");
11
12
  localStorage.setItem(cacheKey, JSON.stringify(value));
12
13
  return true;
13
14
  } catch (_error) {
@@ -15,13 +16,17 @@ const createCache = options => {
15
16
  }
16
17
  },
17
18
  unset(key) {
18
- const cacheKey = [options.prefix, key].join('/');
19
+ const cacheKey = [options.prefix, key].join("/");
19
20
  localStorage.removeItem(cacheKey);
20
21
  }
21
22
  };
22
23
  return cache;
23
24
  };
24
25
 
25
- const version = "14.0.2";
26
-
27
- export { createCache as default, version };
26
+ // src/index.ts
27
+ var version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
28
+ export {
29
+ createCache,
30
+ version
31
+ };
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cache.ts","../src/index.ts"],"sourcesContent":["import type { TCache, TCacheOptions } from '@flopflip/types';\n\nconst createCache = (options: TCacheOptions) => {\n const cache: TCache = {\n get(key) {\n const cacheKey = [options.prefix, key].join('/');\n\n const localStorageValue = localStorage.getItem(cacheKey);\n\n return localStorageValue ? JSON.parse(localStorageValue) : null;\n },\n set(key, value) {\n try {\n const cacheKey = [options.prefix, key].join('/');\n\n localStorage.setItem(cacheKey, JSON.stringify(value));\n\n return true;\n } catch (_error) {\n return false;\n }\n },\n unset(key) {\n const cacheKey = [options.prefix, key].join('/');\n\n localStorage.removeItem(cacheKey);\n },\n };\n\n return cache;\n};\n\nexport { createCache };\n","const version = '__@FLOPFLIP/VERSION_OF_RELEASE__';\n\nexport { createCache } from './cache';\nexport { version };\n"],"mappings":";AAEA,IAAM,cAAc,CAAC,YAA2B;AAC9C,QAAM,QAAgB;AAAA,IACpB,IAAI,KAAK;AACP,YAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,EAAE,KAAK,GAAG;AAE/C,YAAM,oBAAoB,aAAa,QAAQ,QAAQ;AAEvD,aAAO,oBAAoB,KAAK,MAAM,iBAAiB,IAAI;AAAA,IAC7D;AAAA,IACA,IAAI,KAAK,OAAO;AACd,UAAI;AACF,cAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,EAAE,KAAK,GAAG;AAE/C,qBAAa,QAAQ,UAAU,KAAK,UAAU,KAAK,CAAC;AAEpD,eAAO;AAAA,MACT,SAAS,QAAQ;AACf,eAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,MAAM,KAAK;AACT,YAAM,WAAW,CAAC,QAAQ,QAAQ,GAAG,EAAE,KAAK,GAAG;AAE/C,mBAAa,WAAW,QAAQ;AAAA,IAClC;AAAA,EACF;AAEA,SAAO;AACT;;;AC9BA,IAAM,UAAU;","names":[]}
package/package.json CHANGED
@@ -1,9 +1,24 @@
1
1
  {
2
2
  "name": "@flopflip/localstorage-cache",
3
- "version": "14.0.2",
3
+ "version": "15.0.0",
4
4
  "description": "Localstorage cache for flipflop adapters",
5
- "main": "dist/flopflip-localstorage-cache.cjs.js",
6
- "module": "dist/flopflip-localstorage-cache.esm.js",
5
+ "sideEffects": false,
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.cjs"
11
+ }
12
+ },
13
+ "main": "./dist/index.js",
14
+ "typesVersions": {
15
+ "*": {
16
+ ".": [
17
+ "dist/*.d.ts",
18
+ "dist/*.d.cts"
19
+ ]
20
+ }
21
+ },
7
22
  "files": [
8
23
  "readme.md",
9
24
  "dist/**"
@@ -30,6 +45,17 @@
30
45
  "client"
31
46
  ],
32
47
  "dependencies": {
33
- "@flopflip/types": "14.0.2"
48
+ "@flopflip/types": "15.0.0"
49
+ },
50
+ "devDependencies": {
51
+ "tsup": "8.4.0",
52
+ "@flopflip/tsconfig": "15.0.0"
53
+ },
54
+ "scripts": {
55
+ "build": "rimraf dist && tsup",
56
+ "check-types": "tsc --noEmit",
57
+ "test": "vitest --run",
58
+ "test:watch": "vitest",
59
+ "dev": "tsup --watch --clean=false"
34
60
  }
35
61
  }
@@ -1,3 +0,0 @@
1
- import type { TCache, TCacheOptions } from '@flopflip/types';
2
- declare const createCache: (options: TCacheOptions) => TCache;
3
- export default createCache;
@@ -1,3 +0,0 @@
1
- declare const version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
2
- export { version };
3
- export { default } from "./cache.js";
@@ -1,3 +0,0 @@
1
- declare const version = "__@FLOPFLIP/VERSION_OF_RELEASE__";
2
- export { default } from "./cache/index.js";
3
- export { version };
@@ -1,3 +0,0 @@
1
- export * from "./declarations/src/index";
2
- export { default } from "./declarations/src/index";
3
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmxvcGZsaXAtbG9jYWxzdG9yYWdlLWNhY2hlLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi9kZWNsYXJhdGlvbnMvc3JjL2luZGV4LmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const createCache = options => {
6
- const cache = {
7
- get(key) {
8
- const cacheKey = [options.prefix, key].join('/');
9
- const localStorageValue = localStorage.getItem(cacheKey);
10
- return localStorageValue ? JSON.parse(localStorageValue) : null;
11
- },
12
- set(key, value) {
13
- try {
14
- const cacheKey = [options.prefix, key].join('/');
15
- localStorage.setItem(cacheKey, JSON.stringify(value));
16
- return true;
17
- } catch (_error) {
18
- return false;
19
- }
20
- },
21
- unset(key) {
22
- const cacheKey = [options.prefix, key].join('/');
23
- localStorage.removeItem(cacheKey);
24
- }
25
- };
26
- return cache;
27
- };
28
-
29
- const version = "14.0.2";
30
-
31
- exports["default"] = createCache;
32
- exports.version = version;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./flopflip-localstorage-cache.cjs.prod.js");
5
- } else {
6
- module.exports = require("./flopflip-localstorage-cache.cjs.dev.js");
7
- }
@@ -1,32 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const createCache = options => {
6
- const cache = {
7
- get(key) {
8
- const cacheKey = [options.prefix, key].join('/');
9
- const localStorageValue = localStorage.getItem(cacheKey);
10
- return localStorageValue ? JSON.parse(localStorageValue) : null;
11
- },
12
- set(key, value) {
13
- try {
14
- const cacheKey = [options.prefix, key].join('/');
15
- localStorage.setItem(cacheKey, JSON.stringify(value));
16
- return true;
17
- } catch (_error) {
18
- return false;
19
- }
20
- },
21
- unset(key) {
22
- const cacheKey = [options.prefix, key].join('/');
23
- localStorage.removeItem(cacheKey);
24
- }
25
- };
26
- return cache;
27
- };
28
-
29
- const version = "14.0.2";
30
-
31
- exports["default"] = createCache;
32
- exports.version = version;