@sigx/lynx-storage 0.1.2 → 0.4.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/README.md CHANGED
@@ -8,14 +8,7 @@ Persistent key-value storage for sigx-lynx. `UserDefaults` on iOS, `SharedPrefer
8
8
  pnpm add @sigx/lynx-storage
9
9
  ```
10
10
 
11
- ```ts
12
- // sigx.lynx.config.ts
13
- export default defineLynxConfig({
14
- modules: ['@sigx/lynx-storage'],
15
- });
16
- ```
17
-
18
- No special permissions on either platform.
11
+ `sigx prebuild` auto-discovers the package via its `signalx-module.json` and links the native module. No special permissions on either platform.
19
12
 
20
13
  ## Usage
21
14
 
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { Storage } from './storage.js';
1
+ export { Storage } from './storage';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,26 @@
1
- export { Storage } from './storage.js';
1
+ import { callAsync as e, callSync as t, isModuleAvailable as n } from "@sigx/lynx-core";
2
+ //#region src/storage.ts
3
+ var r = "Storage", i = {
4
+ setItem(e, n) {
5
+ t(r, "setItem", e, n);
6
+ },
7
+ getItem(t) {
8
+ return e(r, "getItem", t);
9
+ },
10
+ removeItem(e) {
11
+ t(r, "removeItem", e);
12
+ },
13
+ clear() {
14
+ t(r, "clear");
15
+ },
16
+ getAllKeys() {
17
+ return e(r, "getAllKeys");
18
+ },
19
+ isAvailable() {
20
+ return n(r);
21
+ }
22
+ };
23
+ //#endregion
24
+ export { i as Storage };
25
+
2
26
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/storage.ts"],"sourcesContent":["import { callSync, callAsync, isModuleAvailable } from '@sigx/lynx-core';\n\nconst MODULE = 'Storage';\n\n/**\n * Persistent key-value storage APIs.\n *\n * @example\n * ```ts\n * import { Storage } from '@sigx/lynx-storage';\n *\n * Storage.setItem('user', JSON.stringify({ name: 'Alice' }));\n * const user = await Storage.getItem('user');\n * ```\n */\nexport const Storage = {\n setItem(key: string, value: string): void {\n callSync(MODULE, 'setItem', key, value);\n },\n\n getItem(key: string): Promise<string | null> {\n return callAsync<string | null>(MODULE, 'getItem', key);\n },\n\n removeItem(key: string): void {\n callSync(MODULE, 'removeItem', key);\n },\n\n clear(): void {\n callSync(MODULE, 'clear');\n },\n\n getAllKeys(): Promise<string[]> {\n return callAsync<string[]>(MODULE, 'getAllKeys');\n },\n\n isAvailable(): boolean {\n return isModuleAvailable(MODULE);\n },\n} as const;\n"],"mappings":";;AAEA,IAAM,IAAS,WAaF,IAAU;CACnB,QAAQ,GAAa,GAAqB;EACtC,EAAS,GAAQ,WAAW,GAAK,EAAM;;CAG3C,QAAQ,GAAqC;EACzC,OAAO,EAAyB,GAAQ,WAAW,EAAI;;CAG3D,WAAW,GAAmB;EAC1B,EAAS,GAAQ,cAAc,EAAI;;CAGvC,QAAc;EACV,EAAS,GAAQ,QAAQ;;CAG7B,aAAgC;EAC5B,OAAO,EAAoB,GAAQ,aAAa;;CAGpD,cAAuB;EACnB,OAAO,EAAkB,EAAO;;CAEvC"}
package/dist/storage.d.ts CHANGED
@@ -10,11 +10,11 @@
10
10
  * ```
11
11
  */
12
12
  export declare const Storage: {
13
- readonly setItem: (key: string, value: string) => void;
14
- readonly getItem: (key: string) => Promise<string | null>;
15
- readonly removeItem: (key: string) => void;
16
- readonly clear: () => void;
17
- readonly getAllKeys: () => Promise<string[]>;
18
- readonly isAvailable: () => boolean;
13
+ setItem(key: string, value: string): void;
14
+ getItem(key: string): Promise<string | null>;
15
+ removeItem(key: string): void;
16
+ clear(): void;
17
+ getAllKeys(): Promise<string[]>;
18
+ isAvailable(): boolean;
19
19
  };
20
20
  //# sourceMappingURL=storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO;4BACH,MAAM,SAAS,MAAM,KAAG,IAAI;4BAI5B,MAAM,KAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;+BAI5B,MAAM,KAAG,IAAI;0BAIpB,IAAI;+BAIC,OAAO,CAAC,MAAM,EAAE,CAAC;gCAIhB,OAAO;CAGhB,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO;IAChB,OAAO,MAAM,MAAM,SAAS,MAAM,GAAG,IAAI;IAIzC,OAAO,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAI5C,UAAU,MAAM,MAAM,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;IAIb,UAAU,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B,WAAW,IAAI,OAAO;CAGhB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigx/lynx-storage",
3
- "version": "0.1.2",
3
+ "version": "0.4.0",
4
4
  "description": "Persistent key-value storage for sigx-lynx",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,19 +10,20 @@
10
10
  "import": "./dist/index.js",
11
11
  "types": "./dist/index.d.ts"
12
12
  },
13
- "./sigx-module.json": "./sigx-module.json"
13
+ "./signalx-module.json": "./signalx-module.json"
14
14
  },
15
15
  "files": [
16
16
  "dist",
17
17
  "ios",
18
18
  "android",
19
- "sigx-module.json"
19
+ "signalx-module.json"
20
20
  ],
21
21
  "dependencies": {
22
- "@sigx/lynx-core": "^0.1.4"
22
+ "@sigx/lynx-core": "^0.4.0"
23
23
  },
24
24
  "devDependencies": {
25
- "typescript": "^6.0.3"
25
+ "typescript": "^6.0.3",
26
+ "@sigx/vite": "^0.4.3"
26
27
  },
27
28
  "author": "Andreas Ekdahl",
28
29
  "license": "MIT",
@@ -48,7 +49,7 @@
48
49
  "storage"
49
50
  ],
50
51
  "scripts": {
51
- "build": "tsc",
52
- "dev": "tsc --watch"
52
+ "build": "vite build && tsgo --emitDeclarationOnly",
53
+ "dev": "vite build --watch"
53
54
  }
54
55
  }
package/dist/storage.js DELETED
@@ -1,34 +0,0 @@
1
- import { callSync, callAsync, isModuleAvailable } from '@sigx/lynx-core';
2
- const MODULE = 'Storage';
3
- /**
4
- * Persistent key-value storage APIs.
5
- *
6
- * @example
7
- * ```ts
8
- * import { Storage } from '@sigx/lynx-storage';
9
- *
10
- * Storage.setItem('user', JSON.stringify({ name: 'Alice' }));
11
- * const user = await Storage.getItem('user');
12
- * ```
13
- */
14
- export const Storage = {
15
- setItem(key, value) {
16
- callSync(MODULE, 'setItem', key, value);
17
- },
18
- getItem(key) {
19
- return callAsync(MODULE, 'getItem', key);
20
- },
21
- removeItem(key) {
22
- callSync(MODULE, 'removeItem', key);
23
- },
24
- clear() {
25
- callSync(MODULE, 'clear');
26
- },
27
- getAllKeys() {
28
- return callAsync(MODULE, 'getAllKeys');
29
- },
30
- isAvailable() {
31
- return isModuleAvailable(MODULE);
32
- },
33
- };
34
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzE,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,OAAO,CAAC,GAAW,EAAE,KAAa;QAC9B,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,CAAC,GAAW;QACf,OAAO,SAAS,CAAgB,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;IAC5D,CAAC;IAED,UAAU,CAAC,GAAW;QAClB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;IAED,KAAK;QACD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,UAAU;QACN,OAAO,SAAS,CAAW,MAAM,EAAE,YAAY,CAAC,CAAC;IACrD,CAAC;IAED,WAAW;QACP,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACK,CAAC"}
File without changes