@xfe-repo/mini-utils 0.0.5 → 0.0.6

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.
@@ -17,7 +17,6 @@ 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"));
21
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
21
  // If the importer is in node compatibility mode or this is not an ESM
23
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -63,49 +62,22 @@ module.exports = __toCommonJS(appJSBridge_exports);
63
62
  // src/env.ts
64
63
  var import_taro2 = __toESM(require("@tarojs/taro"));
65
64
 
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
-
75
65
  // src/storage.h5.ts
76
66
  var import_js_cookie = __toESM(require("js-cookie"));
77
67
  function getLocalData(name) {
78
68
  return import_js_cookie.default.get(name) || "";
79
69
  }
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
- }
88
70
 
89
71
  // src/storage.weapp.ts
90
72
  var import_taro = __toESM(require("@tarojs/taro"));
91
73
  function getLocalData2(name) {
92
74
  return import_taro.default.getStorageSync(name);
93
75
  }
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
- }
101
76
 
102
77
  // src/storage.ts
103
- __reExport(storage_exports, require("query-string"));
104
78
  var platform = process.env.TARO_ENV || "weapp";
105
79
  var isWeapp = platform === "weapp";
106
80
  var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
107
- var setLocalData3 = isWeapp ? setLocalData2 : setLocalData;
108
- var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
109
81
 
110
82
  // src/env.ts
111
83
  var ENV = import_taro2.default.getEnv().toLocaleLowerCase();
package/dist/env.js CHANGED
@@ -17,7 +17,6 @@ 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"));
21
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
21
  // If the importer is in node compatibility mode or this is not an ESM
23
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -47,49 +46,22 @@ __export(env_exports, {
47
46
  module.exports = __toCommonJS(env_exports);
48
47
  var import_taro2 = __toESM(require("@tarojs/taro"));
49
48
 
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
-
59
49
  // src/storage.h5.ts
60
50
  var import_js_cookie = __toESM(require("js-cookie"));
61
51
  function getLocalData(name) {
62
52
  return import_js_cookie.default.get(name) || "";
63
53
  }
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
- }
72
54
 
73
55
  // src/storage.weapp.ts
74
56
  var import_taro = __toESM(require("@tarojs/taro"));
75
57
  function getLocalData2(name) {
76
58
  return import_taro.default.getStorageSync(name);
77
59
  }
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
- }
85
60
 
86
61
  // src/storage.ts
87
- __reExport(storage_exports, require("query-string"));
88
62
  var platform = process.env.TARO_ENV || "weapp";
89
63
  var isWeapp = platform === "weapp";
90
64
  var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
91
- var setLocalData3 = isWeapp ? setLocalData2 : setLocalData;
92
- var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
93
65
 
94
66
  // src/env.ts
95
67
  var ENV = import_taro2.default.getEnv().toLocaleLowerCase();
package/dist/storage.d.ts CHANGED
@@ -1,6 +1,5 @@
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 'query-string';
4
3
 
5
4
  declare const platform: string;
6
5
  declare const getLocalData: typeof getLocalData$1;
package/dist/storage.js CHANGED
@@ -17,7 +17,6 @@ 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"));
21
20
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
21
  // If the importer is in node compatibility mode or this is not an ESM
23
22
  // file that has been converted to a CommonJS file using a Babel-
@@ -66,7 +65,6 @@ function removeLocalData2(key) {
66
65
  }
67
66
 
68
67
  // src/storage.ts
69
- __reExport(storage_exports, require("query-string"), module.exports);
70
68
  var platform = process.env.TARO_ENV || "weapp";
71
69
  var isWeapp = platform === "weapp";
72
70
  var getLocalData3 = isWeapp ? getLocalData2 : getLocalData;
@@ -77,6 +75,5 @@ var removeLocalData3 = isWeapp ? removeLocalData2 : removeLocalData;
77
75
  getLocalData,
78
76
  platform,
79
77
  removeLocalData,
80
- setLocalData,
81
- ...require("query-string")
78
+ setLocalData
82
79
  });
package/dist/tools.d.ts CHANGED
@@ -2,6 +2,6 @@ type InGetQuery = {
2
2
  decode?: boolean;
3
3
  parse?: boolean;
4
4
  };
5
- declare const getQuery: <P extends Partial<Record<string, string | number>>>(params?: InGetQuery) => P;
5
+ declare const getQuery: <P extends Partial<Record<string, string>>>(params?: InGetQuery) => P;
6
6
 
7
7
  export { type InGetQuery, getQuery };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xfe-repo/mini-utils",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "sideEffects": false,
5
5
  "module": "dist/*.js",
6
6
  "types": "types/*.d.ts",
@@ -20,7 +20,6 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "query-string": "^7.1.3",
24
23
  "js-cookie": "^3.0.5",
25
24
  "@tarojs/taro": "4.0.8",
26
25
  "compare-versions": "^6.1.1"