@xfe-repo/mini-utils 0.0.1 → 0.0.2
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/appJSBridge.js +28 -0
- package/dist/env.js +28 -0
- package/dist/storage.d.ts +1 -0
- package/dist/storage.js +4 -1
- package/package.json +7 -3
package/dist/appJSBridge.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -62,22 +63,49 @@ module.exports = __toCommonJS(appJSBridge_exports);
|
|
|
62
63
|
// src/env.ts
|
|
63
64
|
var import_taro2 = __toESM(require("@tarojs/taro"));
|
|
64
65
|
|
|
66
|
+
// src/storage.ts
|
|
67
|
+
var storage_exports = {};
|
|
68
|
+
__export(storage_exports, {
|
|
69
|
+
getLocalData: () => getLocalData3,
|
|
70
|
+
platform: () => platform,
|
|
71
|
+
removeLocalData: () => removeLocalData3,
|
|
72
|
+
setLocalData: () => setLocalData3
|
|
73
|
+
});
|
|
74
|
+
|
|
65
75
|
// src/storage.h5.ts
|
|
66
76
|
var import_js_cookie = __toESM(require("js-cookie"));
|
|
67
77
|
function getLocalData(name) {
|
|
68
78
|
return import_js_cookie.default.get(name) || "";
|
|
69
79
|
}
|
|
80
|
+
function setLocalData(params) {
|
|
81
|
+
const { key, data, expireDays = 365 } = params;
|
|
82
|
+
const expires = new Date(Date.now() + expireDays * 24 * 60 * 60 * 1e3);
|
|
83
|
+
import_js_cookie.default.set(key, data, { expires });
|
|
84
|
+
}
|
|
85
|
+
function removeLocalData(key) {
|
|
86
|
+
setLocalData({ key, data: "", expireDays: -1 });
|
|
87
|
+
}
|
|
70
88
|
|
|
71
89
|
// src/storage.weapp.ts
|
|
72
90
|
var import_taro = __toESM(require("@tarojs/taro"));
|
|
73
91
|
function getLocalData2(name) {
|
|
74
92
|
return import_taro.default.getStorageSync(name);
|
|
75
93
|
}
|
|
94
|
+
function setLocalData2(params) {
|
|
95
|
+
const { key, data } = params;
|
|
96
|
+
import_taro.default.setStorageSync(key, data);
|
|
97
|
+
}
|
|
98
|
+
function removeLocalData2(key) {
|
|
99
|
+
import_taro.default.removeStorageSync(key);
|
|
100
|
+
}
|
|
76
101
|
|
|
77
102
|
// src/storage.ts
|
|
103
|
+
__reExport(storage_exports, require("querystring"));
|
|
78
104
|
var platform = process.env.TARO_ENV || "weapp";
|
|
79
105
|
var isWeapp = platform === "weapp";
|
|
80
106
|
var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
|
|
107
|
+
var setLocalData3 = isWeapp ? setLocalData2 : setLocalData;
|
|
108
|
+
var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
|
|
81
109
|
|
|
82
110
|
// src/env.ts
|
|
83
111
|
var ENV = import_taro2.default.getEnv().toLocaleLowerCase();
|
package/dist/env.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -46,22 +47,49 @@ __export(env_exports, {
|
|
|
46
47
|
module.exports = __toCommonJS(env_exports);
|
|
47
48
|
var import_taro2 = __toESM(require("@tarojs/taro"));
|
|
48
49
|
|
|
50
|
+
// src/storage.ts
|
|
51
|
+
var storage_exports = {};
|
|
52
|
+
__export(storage_exports, {
|
|
53
|
+
getLocalData: () => getLocalData3,
|
|
54
|
+
platform: () => platform,
|
|
55
|
+
removeLocalData: () => removeLocalData3,
|
|
56
|
+
setLocalData: () => setLocalData3
|
|
57
|
+
});
|
|
58
|
+
|
|
49
59
|
// src/storage.h5.ts
|
|
50
60
|
var import_js_cookie = __toESM(require("js-cookie"));
|
|
51
61
|
function getLocalData(name) {
|
|
52
62
|
return import_js_cookie.default.get(name) || "";
|
|
53
63
|
}
|
|
64
|
+
function setLocalData(params) {
|
|
65
|
+
const { key, data, expireDays = 365 } = params;
|
|
66
|
+
const expires = new Date(Date.now() + expireDays * 24 * 60 * 60 * 1e3);
|
|
67
|
+
import_js_cookie.default.set(key, data, { expires });
|
|
68
|
+
}
|
|
69
|
+
function removeLocalData(key) {
|
|
70
|
+
setLocalData({ key, data: "", expireDays: -1 });
|
|
71
|
+
}
|
|
54
72
|
|
|
55
73
|
// src/storage.weapp.ts
|
|
56
74
|
var import_taro = __toESM(require("@tarojs/taro"));
|
|
57
75
|
function getLocalData2(name) {
|
|
58
76
|
return import_taro.default.getStorageSync(name);
|
|
59
77
|
}
|
|
78
|
+
function setLocalData2(params) {
|
|
79
|
+
const { key, data } = params;
|
|
80
|
+
import_taro.default.setStorageSync(key, data);
|
|
81
|
+
}
|
|
82
|
+
function removeLocalData2(key) {
|
|
83
|
+
import_taro.default.removeStorageSync(key);
|
|
84
|
+
}
|
|
60
85
|
|
|
61
86
|
// src/storage.ts
|
|
87
|
+
__reExport(storage_exports, require("querystring"));
|
|
62
88
|
var platform = process.env.TARO_ENV || "weapp";
|
|
63
89
|
var isWeapp = platform === "weapp";
|
|
64
90
|
var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
|
|
91
|
+
var setLocalData3 = isWeapp ? setLocalData2 : setLocalData;
|
|
92
|
+
var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
|
|
65
93
|
|
|
66
94
|
// src/env.ts
|
|
67
95
|
var ENV = import_taro2.default.getEnv().toLocaleLowerCase();
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { setLocalData as setLocalData$1 } from './storage.h5.js';
|
|
2
2
|
import { getLocalData as getLocalData$1, removeLocalData as removeLocalData$1 } from './storage.weapp.js';
|
|
3
|
+
export * from 'querystring';
|
|
3
4
|
|
|
4
5
|
declare const platform: string;
|
|
5
6
|
declare const getLocalData: typeof getLocalData$1;
|
package/dist/storage.js
CHANGED
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -65,6 +66,7 @@ function removeLocalData2(key) {
|
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
// src/storage.ts
|
|
69
|
+
__reExport(storage_exports, require("querystring"), module.exports);
|
|
68
70
|
var platform = process.env.TARO_ENV || "weapp";
|
|
69
71
|
var isWeapp = platform === "weapp";
|
|
70
72
|
var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
|
|
@@ -75,5 +77,6 @@ var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
|
|
|
75
77
|
getLocalData,
|
|
76
78
|
platform,
|
|
77
79
|
removeLocalData,
|
|
78
|
-
setLocalData
|
|
80
|
+
setLocalData,
|
|
81
|
+
...require("querystring")
|
|
79
82
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xfe-repo/mini-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"module": "dist/*.js",
|
|
6
6
|
"types": "types/*.d.ts",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
+
"query-string": "^7.1.3",
|
|
23
24
|
"js-cookie": "^3.0.5",
|
|
24
25
|
"@tarojs/taro": "4.0.8",
|
|
25
26
|
"compare-versions": "^6.1.1"
|
|
@@ -27,8 +28,11 @@
|
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"@types/js-cookie": "^3.0.6",
|
|
29
30
|
"@types/node": "^20.10.3",
|
|
30
|
-
"@xfe-repo/
|
|
31
|
-
"@xfe-repo/
|
|
31
|
+
"@xfe-repo/eslint-config": "0.0.5",
|
|
32
|
+
"@xfe-repo/typescript-config": "0.0.6"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://registry.npmjs.org/"
|
|
32
36
|
},
|
|
33
37
|
"scripts": {
|
|
34
38
|
"build": "tsup",
|