@weapp-core/shared 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 ice breaker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __esm = (fn, res) => function __init() {
9
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
+ };
11
+ var __commonJS = (cb, mod) => function __require() {
12
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+
36
+ // ../../node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.40_tsx@4.16.2_typescript@5.4.5_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
37
+ var init_cjs_shims = __esm({
38
+ "../../node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.40_tsx@4.16.2_typescript@5.4.5_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js"() {
39
+ "use strict";
40
+ }
41
+ });
42
+
43
+ // ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
44
+ var require_is_primitive = __commonJS({
45
+ "../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
46
+ "use strict";
47
+ init_cjs_shims();
48
+ module2.exports = function isPrimitive(val) {
49
+ if (typeof val === "object") {
50
+ return val === null;
51
+ }
52
+ return typeof val !== "function";
53
+ };
54
+ }
55
+ });
56
+
57
+ // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
58
+ var require_isobject = __commonJS({
59
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
60
+ "use strict";
61
+ init_cjs_shims();
62
+ module2.exports = function isObject(val) {
63
+ return val != null && typeof val === "object" && Array.isArray(val) === false;
64
+ };
65
+ }
66
+ });
67
+
68
+ // ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
69
+ var require_is_plain_object = __commonJS({
70
+ "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
71
+ "use strict";
72
+ init_cjs_shims();
73
+ var isObject = require_isobject();
74
+ function isObjectObject(o) {
75
+ return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
76
+ }
77
+ module2.exports = function isPlainObject(o) {
78
+ var ctor, prot;
79
+ if (isObjectObject(o) === false) return false;
80
+ ctor = o.constructor;
81
+ if (typeof ctor !== "function") return false;
82
+ prot = ctor.prototype;
83
+ if (isObjectObject(prot) === false) return false;
84
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
85
+ return false;
86
+ }
87
+ return true;
88
+ };
89
+ }
90
+ });
91
+
92
+ // ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
93
+ var require_set_value = __commonJS({
94
+ "../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports2, module2) {
95
+ "use strict";
96
+ init_cjs_shims();
97
+ var { deleteProperty } = Reflect;
98
+ var isPrimitive = require_is_primitive();
99
+ var isPlainObject = require_is_plain_object();
100
+ var isObject = (value) => {
101
+ return typeof value === "object" && value !== null || typeof value === "function";
102
+ };
103
+ var isUnsafeKey = (key) => {
104
+ return key === "__proto__" || key === "constructor" || key === "prototype";
105
+ };
106
+ var validateKey = (key) => {
107
+ if (!isPrimitive(key)) {
108
+ throw new TypeError("Object keys must be strings or symbols");
109
+ }
110
+ if (isUnsafeKey(key)) {
111
+ throw new Error(`Cannot set unsafe key: "${key}"`);
112
+ }
113
+ };
114
+ var toStringKey = (input) => {
115
+ return Array.isArray(input) ? input.flat().map(String).join(",") : input;
116
+ };
117
+ var createMemoKey = (input, options) => {
118
+ if (typeof input !== "string" || !options) return input;
119
+ let key = input + ";";
120
+ if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
121
+ if (options.separator !== void 0) key += `separator=${options.separator};`;
122
+ if (options.split !== void 0) key += `split=${options.split};`;
123
+ if (options.merge !== void 0) key += `merge=${options.merge};`;
124
+ if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
125
+ return key;
126
+ };
127
+ var memoize = (input, options, fn) => {
128
+ const key = toStringKey(options ? createMemoKey(input, options) : input);
129
+ validateKey(key);
130
+ const value = setValue.cache.get(key) || fn();
131
+ setValue.cache.set(key, value);
132
+ return value;
133
+ };
134
+ var splitString = (input, options = {}) => {
135
+ const sep = options.separator || ".";
136
+ const preserve = sep === "/" ? false : options.preservePaths;
137
+ if (typeof input === "string" && preserve !== false && /\//.test(input)) {
138
+ return [input];
139
+ }
140
+ const parts = [];
141
+ let part = "";
142
+ const push = (part2) => {
143
+ let number;
144
+ if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
145
+ parts.push(number);
146
+ } else {
147
+ parts.push(part2);
148
+ }
149
+ };
150
+ for (let i = 0; i < input.length; i++) {
151
+ const value = input[i];
152
+ if (value === "\\") {
153
+ part += input[++i];
154
+ continue;
155
+ }
156
+ if (value === sep) {
157
+ push(part);
158
+ part = "";
159
+ continue;
160
+ }
161
+ part += value;
162
+ }
163
+ if (part) {
164
+ push(part);
165
+ }
166
+ return parts;
167
+ };
168
+ var split = (input, options) => {
169
+ if (options && typeof options.split === "function") return options.split(input);
170
+ if (typeof input === "symbol") return [input];
171
+ if (Array.isArray(input)) return input;
172
+ return memoize(input, options, () => splitString(input, options));
173
+ };
174
+ var assignProp = (obj, prop, value, options) => {
175
+ validateKey(prop);
176
+ if (value === void 0) {
177
+ deleteProperty(obj, prop);
178
+ } else if (options && options.merge) {
179
+ const merge = options.merge === "function" ? options.merge : Object.assign;
180
+ if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
181
+ obj[prop] = merge(obj[prop], value);
182
+ } else {
183
+ obj[prop] = value;
184
+ }
185
+ } else {
186
+ obj[prop] = value;
187
+ }
188
+ return obj;
189
+ };
190
+ var setValue = (target, path, value, options) => {
191
+ if (!path || !isObject(target)) return target;
192
+ const keys = split(path, options);
193
+ let obj = target;
194
+ for (let i = 0; i < keys.length; i++) {
195
+ const key = keys[i];
196
+ const next = keys[i + 1];
197
+ validateKey(key);
198
+ if (next === void 0) {
199
+ assignProp(obj, key, value, options);
200
+ break;
201
+ }
202
+ if (typeof next === "number" && !Array.isArray(obj[key])) {
203
+ obj = obj[key] = [];
204
+ continue;
205
+ }
206
+ if (!isObject(obj[key])) {
207
+ obj[key] = {};
208
+ }
209
+ obj = obj[key];
210
+ }
211
+ return target;
212
+ };
213
+ setValue.split = split;
214
+ setValue.cache = /* @__PURE__ */ new Map();
215
+ setValue.clear = () => {
216
+ setValue.cache = /* @__PURE__ */ new Map();
217
+ };
218
+ module2.exports = setValue;
219
+ }
220
+ });
221
+
222
+ // ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
223
+ var require_get_value = __commonJS({
224
+ "../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
225
+ "use strict";
226
+ init_cjs_shims();
227
+ var isObject = require_isobject();
228
+ module2.exports = function(target, path, options) {
229
+ if (!isObject(options)) {
230
+ options = { default: options };
231
+ }
232
+ if (!isValidObject(target)) {
233
+ return typeof options.default !== "undefined" ? options.default : target;
234
+ }
235
+ if (typeof path === "number") {
236
+ path = String(path);
237
+ }
238
+ const isArray = Array.isArray(path);
239
+ const isString = typeof path === "string";
240
+ const splitChar = options.separator || ".";
241
+ const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
242
+ if (!isString && !isArray) {
243
+ return target;
244
+ }
245
+ if (isString && path in target) {
246
+ return isValid(path, target, options) ? target[path] : options.default;
247
+ }
248
+ let segs = isArray ? path : split(path, splitChar, options);
249
+ let len = segs.length;
250
+ let idx = 0;
251
+ do {
252
+ let prop = segs[idx];
253
+ if (typeof prop === "number") {
254
+ prop = String(prop);
255
+ }
256
+ while (prop && prop.slice(-1) === "\\") {
257
+ prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
258
+ }
259
+ if (prop in target) {
260
+ if (!isValid(prop, target, options)) {
261
+ return options.default;
262
+ }
263
+ target = target[prop];
264
+ } else {
265
+ let hasProp = false;
266
+ let n = idx + 1;
267
+ while (n < len) {
268
+ prop = join([prop, segs[n++]], joinChar, options);
269
+ if (hasProp = prop in target) {
270
+ if (!isValid(prop, target, options)) {
271
+ return options.default;
272
+ }
273
+ target = target[prop];
274
+ idx = n - 1;
275
+ break;
276
+ }
277
+ }
278
+ if (!hasProp) {
279
+ return options.default;
280
+ }
281
+ }
282
+ } while (++idx < len && isValidObject(target));
283
+ if (idx === len) {
284
+ return target;
285
+ }
286
+ return options.default;
287
+ };
288
+ function join(segs, joinChar, options) {
289
+ if (typeof options.join === "function") {
290
+ return options.join(segs);
291
+ }
292
+ return segs[0] + joinChar + segs[1];
293
+ }
294
+ function split(path, splitChar, options) {
295
+ if (typeof options.split === "function") {
296
+ return options.split(path);
297
+ }
298
+ return path.split(splitChar);
299
+ }
300
+ function isValid(key, target, options) {
301
+ if (typeof options.isValid === "function") {
302
+ return options.isValid(key, target);
303
+ }
304
+ return true;
305
+ }
306
+ function isValidObject(val) {
307
+ return isObject(val) || Array.isArray(val) || typeof val === "function";
308
+ }
309
+ }
310
+ });
311
+
312
+ // src/index.ts
313
+ var src_exports = {};
314
+ __export(src_exports, {
315
+ get: () => import_get_value.default,
316
+ set: () => import_set_value.default
317
+ });
318
+ module.exports = __toCommonJS(src_exports);
319
+ init_cjs_shims();
320
+ var import_set_value = __toESM(require_set_value(), 1);
321
+ var import_get_value = __toESM(require_get_value(), 1);
322
+ // Annotate the CommonJS export names for ESM import in node:
323
+ 0 && (module.exports = {
324
+ get,
325
+ set
326
+ });
327
+ /*! Bundled license information:
328
+
329
+ is-primitive/index.js:
330
+ (*!
331
+ * is-primitive <https://github.com/jonschlinkert/is-primitive>
332
+ *
333
+ * Copyright (c) 2014-present, Jon Schlinkert.
334
+ * Released under the MIT License.
335
+ *)
336
+
337
+ isobject/index.js:
338
+ (*!
339
+ * isobject <https://github.com/jonschlinkert/isobject>
340
+ *
341
+ * Copyright (c) 2014-2017, Jon Schlinkert.
342
+ * Released under the MIT License.
343
+ *)
344
+
345
+ is-plain-object/index.js:
346
+ (*!
347
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
348
+ *
349
+ * Copyright (c) 2014-2017, Jon Schlinkert.
350
+ * Released under the MIT License.
351
+ *)
352
+
353
+ set-value/index.js:
354
+ (*!
355
+ * set-value <https://github.com/jonschlinkert/set-value>
356
+ *
357
+ * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
358
+ * Released under the MIT License.
359
+ *)
360
+
361
+ get-value/index.js:
362
+ (*!
363
+ * get-value <https://github.com/jonschlinkert/get-value>
364
+ *
365
+ * Copyright (c) 2014-2018, Jon Schlinkert.
366
+ * Released under the MIT License.
367
+ *)
368
+ */
@@ -0,0 +1,2 @@
1
+ export { default as set } from 'set-value';
2
+ export { default as get } from 'get-value';
@@ -0,0 +1,2 @@
1
+ export { default as set } from 'set-value';
2
+ export { default as get } from 'get-value';
package/dist/index.js ADDED
@@ -0,0 +1,357 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __esm = (fn, res) => function __init() {
8
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
9
+ };
10
+ var __commonJS = (cb, mod) => function __require() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+
30
+ // ../../node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.40_tsx@4.16.2_typescript@5.4.5_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js
31
+ var init_esm_shims = __esm({
32
+ "../../node_modules/.pnpm/tsup@8.2.3_jiti@1.21.6_postcss@8.4.40_tsx@4.16.2_typescript@5.4.5_yaml@2.5.0/node_modules/tsup/assets/esm_shims.js"() {
33
+ "use strict";
34
+ }
35
+ });
36
+
37
+ // ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
38
+ var require_is_primitive = __commonJS({
39
+ "../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
40
+ "use strict";
41
+ init_esm_shims();
42
+ module.exports = function isPrimitive(val) {
43
+ if (typeof val === "object") {
44
+ return val === null;
45
+ }
46
+ return typeof val !== "function";
47
+ };
48
+ }
49
+ });
50
+
51
+ // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
52
+ var require_isobject = __commonJS({
53
+ "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
54
+ "use strict";
55
+ init_esm_shims();
56
+ module.exports = function isObject(val) {
57
+ return val != null && typeof val === "object" && Array.isArray(val) === false;
58
+ };
59
+ }
60
+ });
61
+
62
+ // ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
63
+ var require_is_plain_object = __commonJS({
64
+ "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
65
+ "use strict";
66
+ init_esm_shims();
67
+ var isObject = require_isobject();
68
+ function isObjectObject(o) {
69
+ return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
70
+ }
71
+ module.exports = function isPlainObject(o) {
72
+ var ctor, prot;
73
+ if (isObjectObject(o) === false) return false;
74
+ ctor = o.constructor;
75
+ if (typeof ctor !== "function") return false;
76
+ prot = ctor.prototype;
77
+ if (isObjectObject(prot) === false) return false;
78
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
79
+ return false;
80
+ }
81
+ return true;
82
+ };
83
+ }
84
+ });
85
+
86
+ // ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
87
+ var require_set_value = __commonJS({
88
+ "../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports, module) {
89
+ "use strict";
90
+ init_esm_shims();
91
+ var { deleteProperty } = Reflect;
92
+ var isPrimitive = require_is_primitive();
93
+ var isPlainObject = require_is_plain_object();
94
+ var isObject = (value) => {
95
+ return typeof value === "object" && value !== null || typeof value === "function";
96
+ };
97
+ var isUnsafeKey = (key) => {
98
+ return key === "__proto__" || key === "constructor" || key === "prototype";
99
+ };
100
+ var validateKey = (key) => {
101
+ if (!isPrimitive(key)) {
102
+ throw new TypeError("Object keys must be strings or symbols");
103
+ }
104
+ if (isUnsafeKey(key)) {
105
+ throw new Error(`Cannot set unsafe key: "${key}"`);
106
+ }
107
+ };
108
+ var toStringKey = (input) => {
109
+ return Array.isArray(input) ? input.flat().map(String).join(",") : input;
110
+ };
111
+ var createMemoKey = (input, options) => {
112
+ if (typeof input !== "string" || !options) return input;
113
+ let key = input + ";";
114
+ if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
115
+ if (options.separator !== void 0) key += `separator=${options.separator};`;
116
+ if (options.split !== void 0) key += `split=${options.split};`;
117
+ if (options.merge !== void 0) key += `merge=${options.merge};`;
118
+ if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
119
+ return key;
120
+ };
121
+ var memoize = (input, options, fn) => {
122
+ const key = toStringKey(options ? createMemoKey(input, options) : input);
123
+ validateKey(key);
124
+ const value = setValue.cache.get(key) || fn();
125
+ setValue.cache.set(key, value);
126
+ return value;
127
+ };
128
+ var splitString = (input, options = {}) => {
129
+ const sep = options.separator || ".";
130
+ const preserve = sep === "/" ? false : options.preservePaths;
131
+ if (typeof input === "string" && preserve !== false && /\//.test(input)) {
132
+ return [input];
133
+ }
134
+ const parts = [];
135
+ let part = "";
136
+ const push = (part2) => {
137
+ let number;
138
+ if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
139
+ parts.push(number);
140
+ } else {
141
+ parts.push(part2);
142
+ }
143
+ };
144
+ for (let i = 0; i < input.length; i++) {
145
+ const value = input[i];
146
+ if (value === "\\") {
147
+ part += input[++i];
148
+ continue;
149
+ }
150
+ if (value === sep) {
151
+ push(part);
152
+ part = "";
153
+ continue;
154
+ }
155
+ part += value;
156
+ }
157
+ if (part) {
158
+ push(part);
159
+ }
160
+ return parts;
161
+ };
162
+ var split = (input, options) => {
163
+ if (options && typeof options.split === "function") return options.split(input);
164
+ if (typeof input === "symbol") return [input];
165
+ if (Array.isArray(input)) return input;
166
+ return memoize(input, options, () => splitString(input, options));
167
+ };
168
+ var assignProp = (obj, prop, value, options) => {
169
+ validateKey(prop);
170
+ if (value === void 0) {
171
+ deleteProperty(obj, prop);
172
+ } else if (options && options.merge) {
173
+ const merge = options.merge === "function" ? options.merge : Object.assign;
174
+ if (merge && isPlainObject(obj[prop]) && isPlainObject(value)) {
175
+ obj[prop] = merge(obj[prop], value);
176
+ } else {
177
+ obj[prop] = value;
178
+ }
179
+ } else {
180
+ obj[prop] = value;
181
+ }
182
+ return obj;
183
+ };
184
+ var setValue = (target, path, value, options) => {
185
+ if (!path || !isObject(target)) return target;
186
+ const keys = split(path, options);
187
+ let obj = target;
188
+ for (let i = 0; i < keys.length; i++) {
189
+ const key = keys[i];
190
+ const next = keys[i + 1];
191
+ validateKey(key);
192
+ if (next === void 0) {
193
+ assignProp(obj, key, value, options);
194
+ break;
195
+ }
196
+ if (typeof next === "number" && !Array.isArray(obj[key])) {
197
+ obj = obj[key] = [];
198
+ continue;
199
+ }
200
+ if (!isObject(obj[key])) {
201
+ obj[key] = {};
202
+ }
203
+ obj = obj[key];
204
+ }
205
+ return target;
206
+ };
207
+ setValue.split = split;
208
+ setValue.cache = /* @__PURE__ */ new Map();
209
+ setValue.clear = () => {
210
+ setValue.cache = /* @__PURE__ */ new Map();
211
+ };
212
+ module.exports = setValue;
213
+ }
214
+ });
215
+
216
+ // ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
217
+ var require_get_value = __commonJS({
218
+ "../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports, module) {
219
+ "use strict";
220
+ init_esm_shims();
221
+ var isObject = require_isobject();
222
+ module.exports = function(target, path, options) {
223
+ if (!isObject(options)) {
224
+ options = { default: options };
225
+ }
226
+ if (!isValidObject(target)) {
227
+ return typeof options.default !== "undefined" ? options.default : target;
228
+ }
229
+ if (typeof path === "number") {
230
+ path = String(path);
231
+ }
232
+ const isArray = Array.isArray(path);
233
+ const isString = typeof path === "string";
234
+ const splitChar = options.separator || ".";
235
+ const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
236
+ if (!isString && !isArray) {
237
+ return target;
238
+ }
239
+ if (isString && path in target) {
240
+ return isValid(path, target, options) ? target[path] : options.default;
241
+ }
242
+ let segs = isArray ? path : split(path, splitChar, options);
243
+ let len = segs.length;
244
+ let idx = 0;
245
+ do {
246
+ let prop = segs[idx];
247
+ if (typeof prop === "number") {
248
+ prop = String(prop);
249
+ }
250
+ while (prop && prop.slice(-1) === "\\") {
251
+ prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
252
+ }
253
+ if (prop in target) {
254
+ if (!isValid(prop, target, options)) {
255
+ return options.default;
256
+ }
257
+ target = target[prop];
258
+ } else {
259
+ let hasProp = false;
260
+ let n = idx + 1;
261
+ while (n < len) {
262
+ prop = join([prop, segs[n++]], joinChar, options);
263
+ if (hasProp = prop in target) {
264
+ if (!isValid(prop, target, options)) {
265
+ return options.default;
266
+ }
267
+ target = target[prop];
268
+ idx = n - 1;
269
+ break;
270
+ }
271
+ }
272
+ if (!hasProp) {
273
+ return options.default;
274
+ }
275
+ }
276
+ } while (++idx < len && isValidObject(target));
277
+ if (idx === len) {
278
+ return target;
279
+ }
280
+ return options.default;
281
+ };
282
+ function join(segs, joinChar, options) {
283
+ if (typeof options.join === "function") {
284
+ return options.join(segs);
285
+ }
286
+ return segs[0] + joinChar + segs[1];
287
+ }
288
+ function split(path, splitChar, options) {
289
+ if (typeof options.split === "function") {
290
+ return options.split(path);
291
+ }
292
+ return path.split(splitChar);
293
+ }
294
+ function isValid(key, target, options) {
295
+ if (typeof options.isValid === "function") {
296
+ return options.isValid(key, target);
297
+ }
298
+ return true;
299
+ }
300
+ function isValidObject(val) {
301
+ return isObject(val) || Array.isArray(val) || typeof val === "function";
302
+ }
303
+ }
304
+ });
305
+
306
+ // src/index.ts
307
+ init_esm_shims();
308
+ var import_set_value = __toESM(require_set_value(), 1);
309
+ var import_get_value = __toESM(require_get_value(), 1);
310
+ var export_get = import_get_value.default;
311
+ var export_set = import_set_value.default;
312
+ export {
313
+ export_get as get,
314
+ export_set as set
315
+ };
316
+ /*! Bundled license information:
317
+
318
+ is-primitive/index.js:
319
+ (*!
320
+ * is-primitive <https://github.com/jonschlinkert/is-primitive>
321
+ *
322
+ * Copyright (c) 2014-present, Jon Schlinkert.
323
+ * Released under the MIT License.
324
+ *)
325
+
326
+ isobject/index.js:
327
+ (*!
328
+ * isobject <https://github.com/jonschlinkert/isobject>
329
+ *
330
+ * Copyright (c) 2014-2017, Jon Schlinkert.
331
+ * Released under the MIT License.
332
+ *)
333
+
334
+ is-plain-object/index.js:
335
+ (*!
336
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
337
+ *
338
+ * Copyright (c) 2014-2017, Jon Schlinkert.
339
+ * Released under the MIT License.
340
+ *)
341
+
342
+ set-value/index.js:
343
+ (*!
344
+ * set-value <https://github.com/jonschlinkert/set-value>
345
+ *
346
+ * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
347
+ * Released under the MIT License.
348
+ *)
349
+
350
+ get-value/index.js:
351
+ (*!
352
+ * get-value <https://github.com/jonschlinkert/get-value>
353
+ *
354
+ * Copyright (c) 2014-2018, Jon Schlinkert.
355
+ * Released under the MIT License.
356
+ *)
357
+ */
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@weapp-core/shared",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "description": "@weapp-core/shared",
6
+ "author": "",
7
+ "license": "ISC",
8
+ "keywords": [],
9
+ "sideEffects": false,
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "dev": "tsup --watch --sourcemap",
22
+ "build": "tsup",
23
+ "test": "vitest run",
24
+ "test:dev": "vitest",
25
+ "release": "pnpm publish",
26
+ "lint": "eslint .",
27
+ "lint:fix": "eslint . --fix"
28
+ },
29
+ "main": "./dist/index.cjs",
30
+ "module": "./dist/index.js",
31
+ "types": "./dist/index.d.ts"
32
+ }