@weapp-core/shared 1.0.1 → 1.0.3
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 +1 -1
- package/dist/index.cjs +121 -118
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +120 -118
- package/package.json +13 -2
package/LICENSE
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,114 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
));
|
|
34
34
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
35
|
|
|
36
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
36
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.2.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js
|
|
37
37
|
var init_cjs_shims = __esm({
|
|
38
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.3.0_jiti@2.2.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
39
|
"use strict";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
+
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
44
|
+
var require_isobject = __commonJS({
|
|
45
|
+
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports2, module2) {
|
|
46
|
+
"use strict";
|
|
47
|
+
init_cjs_shims();
|
|
48
|
+
module2.exports = function isObject2(val) {
|
|
49
|
+
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
55
|
+
var require_get_value = __commonJS({
|
|
56
|
+
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
|
|
57
|
+
"use strict";
|
|
58
|
+
init_cjs_shims();
|
|
59
|
+
var isObject2 = require_isobject();
|
|
60
|
+
module2.exports = function(target, path, options) {
|
|
61
|
+
if (!isObject2(options)) {
|
|
62
|
+
options = { default: options };
|
|
63
|
+
}
|
|
64
|
+
if (!isValidObject(target)) {
|
|
65
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
66
|
+
}
|
|
67
|
+
if (typeof path === "number") {
|
|
68
|
+
path = String(path);
|
|
69
|
+
}
|
|
70
|
+
const isArray = Array.isArray(path);
|
|
71
|
+
const isString = typeof path === "string";
|
|
72
|
+
const splitChar = options.separator || ".";
|
|
73
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
74
|
+
if (!isString && !isArray) {
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
77
|
+
if (isString && path in target) {
|
|
78
|
+
return isValid(path, target, options) ? target[path] : options.default;
|
|
79
|
+
}
|
|
80
|
+
let segs = isArray ? path : split(path, splitChar, options);
|
|
81
|
+
let len = segs.length;
|
|
82
|
+
let idx = 0;
|
|
83
|
+
do {
|
|
84
|
+
let prop = segs[idx];
|
|
85
|
+
if (typeof prop === "number") {
|
|
86
|
+
prop = String(prop);
|
|
87
|
+
}
|
|
88
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
89
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
90
|
+
}
|
|
91
|
+
if (prop in target) {
|
|
92
|
+
if (!isValid(prop, target, options)) {
|
|
93
|
+
return options.default;
|
|
94
|
+
}
|
|
95
|
+
target = target[prop];
|
|
96
|
+
} else {
|
|
97
|
+
let hasProp = false;
|
|
98
|
+
let n = idx + 1;
|
|
99
|
+
while (n < len) {
|
|
100
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
101
|
+
if (hasProp = prop in target) {
|
|
102
|
+
if (!isValid(prop, target, options)) {
|
|
103
|
+
return options.default;
|
|
104
|
+
}
|
|
105
|
+
target = target[prop];
|
|
106
|
+
idx = n - 1;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!hasProp) {
|
|
111
|
+
return options.default;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
} while (++idx < len && isValidObject(target));
|
|
115
|
+
if (idx === len) {
|
|
116
|
+
return target;
|
|
117
|
+
}
|
|
118
|
+
return options.default;
|
|
119
|
+
};
|
|
120
|
+
function join(segs, joinChar, options) {
|
|
121
|
+
if (typeof options.join === "function") {
|
|
122
|
+
return options.join(segs);
|
|
123
|
+
}
|
|
124
|
+
return segs[0] + joinChar + segs[1];
|
|
125
|
+
}
|
|
126
|
+
function split(path, splitChar, options) {
|
|
127
|
+
if (typeof options.split === "function") {
|
|
128
|
+
return options.split(path);
|
|
129
|
+
}
|
|
130
|
+
return path.split(splitChar);
|
|
131
|
+
}
|
|
132
|
+
function isValid(key, target, options) {
|
|
133
|
+
if (typeof options.isValid === "function") {
|
|
134
|
+
return options.isValid(key, target);
|
|
135
|
+
}
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
function isValidObject(val) {
|
|
139
|
+
return isObject2(val) || Array.isArray(val) || typeof val === "function";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
43
144
|
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
44
145
|
var require_is_primitive = __commonJS({
|
|
45
146
|
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
|
|
@@ -54,17 +155,6 @@ var require_is_primitive = __commonJS({
|
|
|
54
155
|
}
|
|
55
156
|
});
|
|
56
157
|
|
|
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 isObject2(val) {
|
|
63
|
-
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
158
|
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
69
159
|
var require_is_plain_object = __commonJS({
|
|
70
160
|
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
@@ -219,96 +309,6 @@ var require_set_value = __commonJS({
|
|
|
219
309
|
}
|
|
220
310
|
});
|
|
221
311
|
|
|
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 isObject2 = require_isobject();
|
|
228
|
-
module2.exports = function(target, path, options) {
|
|
229
|
-
if (!isObject2(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 isObject2(val) || Array.isArray(val) || typeof val === "function";
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
|
|
312
312
|
// src/index.ts
|
|
313
313
|
var src_exports = {};
|
|
314
314
|
__export(src_exports, {
|
|
@@ -319,6 +319,7 @@ __export(src_exports, {
|
|
|
319
319
|
escapeStringRegexp: () => escapeStringRegexp,
|
|
320
320
|
get: () => import_get_value.default,
|
|
321
321
|
isObject: () => isObject,
|
|
322
|
+
objectHash: () => import_object_hash.default,
|
|
322
323
|
removeExtension: () => removeExtension,
|
|
323
324
|
set: () => import_set_value.default
|
|
324
325
|
});
|
|
@@ -396,8 +397,9 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
396
397
|
});
|
|
397
398
|
|
|
398
399
|
// src/index.ts
|
|
399
|
-
var
|
|
400
|
+
var import_object_hash = __toESM(require("object-hash"), 1);
|
|
400
401
|
var import_get_value = __toESM(require_get_value(), 1);
|
|
402
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
401
403
|
function escapeStringRegexp(str) {
|
|
402
404
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
403
405
|
}
|
|
@@ -432,24 +434,33 @@ function isObject(x) {
|
|
|
432
434
|
escapeStringRegexp,
|
|
433
435
|
get,
|
|
434
436
|
isObject,
|
|
437
|
+
objectHash,
|
|
435
438
|
removeExtension,
|
|
436
439
|
set
|
|
437
440
|
});
|
|
438
441
|
/*! Bundled license information:
|
|
439
442
|
|
|
440
|
-
|
|
443
|
+
isobject/index.js:
|
|
441
444
|
(*!
|
|
442
|
-
*
|
|
445
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
443
446
|
*
|
|
444
|
-
* Copyright (c) 2014-
|
|
447
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
445
448
|
* Released under the MIT License.
|
|
446
449
|
*)
|
|
447
450
|
|
|
448
|
-
|
|
451
|
+
get-value/index.js:
|
|
449
452
|
(*!
|
|
450
|
-
*
|
|
453
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
451
454
|
*
|
|
452
|
-
* Copyright (c) 2014-
|
|
455
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
456
|
+
* Released under the MIT License.
|
|
457
|
+
*)
|
|
458
|
+
|
|
459
|
+
is-primitive/index.js:
|
|
460
|
+
(*!
|
|
461
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
462
|
+
*
|
|
463
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
453
464
|
* Released under the MIT License.
|
|
454
465
|
*)
|
|
455
466
|
|
|
@@ -468,12 +479,4 @@ set-value/index.js:
|
|
|
468
479
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
469
480
|
* Released under the MIT License.
|
|
470
481
|
*)
|
|
471
|
-
|
|
472
|
-
get-value/index.js:
|
|
473
|
-
(*!
|
|
474
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
475
|
-
*
|
|
476
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
477
|
-
* Released under the MIT License.
|
|
478
|
-
*)
|
|
479
482
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as defu from 'defu';
|
|
2
2
|
export { default as defu } from 'defu';
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as objectHash } from 'object-hash';
|
|
4
4
|
export { default as get } from 'get-value';
|
|
5
|
+
export { default as set } from 'set-value';
|
|
5
6
|
|
|
6
7
|
declare function escapeStringRegexp(str: string): string;
|
|
7
8
|
declare function removeExtension(file: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as defu from 'defu';
|
|
2
2
|
export { default as defu } from 'defu';
|
|
3
|
-
export { default as
|
|
3
|
+
export { default as objectHash } from 'object-hash';
|
|
4
4
|
export { default as get } from 'get-value';
|
|
5
|
+
export { default as set } from 'set-value';
|
|
5
6
|
|
|
6
7
|
declare function escapeStringRegexp(str: string): string;
|
|
7
8
|
declare function removeExtension(file: string): string;
|
package/dist/index.js
CHANGED
|
@@ -27,13 +27,114 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
mod
|
|
28
28
|
));
|
|
29
29
|
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
30
|
+
// ../../node_modules/.pnpm/tsup@8.3.0_jiti@2.2.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/esm_shims.js
|
|
31
31
|
var init_esm_shims = __esm({
|
|
32
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
32
|
+
"../../node_modules/.pnpm/tsup@8.3.0_jiti@2.2.1_postcss@8.4.47_tsx@4.19.1_typescript@5.6.2_yaml@2.5.1/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
33
|
"use strict";
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
+
// ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
|
|
38
|
+
var require_isobject = __commonJS({
|
|
39
|
+
"../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
|
|
40
|
+
"use strict";
|
|
41
|
+
init_esm_shims();
|
|
42
|
+
module.exports = function isObject2(val) {
|
|
43
|
+
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
49
|
+
var require_get_value = __commonJS({
|
|
50
|
+
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports, module) {
|
|
51
|
+
"use strict";
|
|
52
|
+
init_esm_shims();
|
|
53
|
+
var isObject2 = require_isobject();
|
|
54
|
+
module.exports = function(target, path, options) {
|
|
55
|
+
if (!isObject2(options)) {
|
|
56
|
+
options = { default: options };
|
|
57
|
+
}
|
|
58
|
+
if (!isValidObject(target)) {
|
|
59
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
60
|
+
}
|
|
61
|
+
if (typeof path === "number") {
|
|
62
|
+
path = String(path);
|
|
63
|
+
}
|
|
64
|
+
const isArray = Array.isArray(path);
|
|
65
|
+
const isString = typeof path === "string";
|
|
66
|
+
const splitChar = options.separator || ".";
|
|
67
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
68
|
+
if (!isString && !isArray) {
|
|
69
|
+
return target;
|
|
70
|
+
}
|
|
71
|
+
if (isString && path in target) {
|
|
72
|
+
return isValid(path, target, options) ? target[path] : options.default;
|
|
73
|
+
}
|
|
74
|
+
let segs = isArray ? path : split(path, splitChar, options);
|
|
75
|
+
let len = segs.length;
|
|
76
|
+
let idx = 0;
|
|
77
|
+
do {
|
|
78
|
+
let prop = segs[idx];
|
|
79
|
+
if (typeof prop === "number") {
|
|
80
|
+
prop = String(prop);
|
|
81
|
+
}
|
|
82
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
83
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
84
|
+
}
|
|
85
|
+
if (prop in target) {
|
|
86
|
+
if (!isValid(prop, target, options)) {
|
|
87
|
+
return options.default;
|
|
88
|
+
}
|
|
89
|
+
target = target[prop];
|
|
90
|
+
} else {
|
|
91
|
+
let hasProp = false;
|
|
92
|
+
let n = idx + 1;
|
|
93
|
+
while (n < len) {
|
|
94
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
95
|
+
if (hasProp = prop in target) {
|
|
96
|
+
if (!isValid(prop, target, options)) {
|
|
97
|
+
return options.default;
|
|
98
|
+
}
|
|
99
|
+
target = target[prop];
|
|
100
|
+
idx = n - 1;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
if (!hasProp) {
|
|
105
|
+
return options.default;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
} while (++idx < len && isValidObject(target));
|
|
109
|
+
if (idx === len) {
|
|
110
|
+
return target;
|
|
111
|
+
}
|
|
112
|
+
return options.default;
|
|
113
|
+
};
|
|
114
|
+
function join(segs, joinChar, options) {
|
|
115
|
+
if (typeof options.join === "function") {
|
|
116
|
+
return options.join(segs);
|
|
117
|
+
}
|
|
118
|
+
return segs[0] + joinChar + segs[1];
|
|
119
|
+
}
|
|
120
|
+
function split(path, splitChar, options) {
|
|
121
|
+
if (typeof options.split === "function") {
|
|
122
|
+
return options.split(path);
|
|
123
|
+
}
|
|
124
|
+
return path.split(splitChar);
|
|
125
|
+
}
|
|
126
|
+
function isValid(key, target, options) {
|
|
127
|
+
if (typeof options.isValid === "function") {
|
|
128
|
+
return options.isValid(key, target);
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
function isValidObject(val) {
|
|
133
|
+
return isObject2(val) || Array.isArray(val) || typeof val === "function";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
37
138
|
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
38
139
|
var require_is_primitive = __commonJS({
|
|
39
140
|
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
|
|
@@ -48,17 +149,6 @@ var require_is_primitive = __commonJS({
|
|
|
48
149
|
}
|
|
49
150
|
});
|
|
50
151
|
|
|
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 isObject2(val) {
|
|
57
|
-
return val != null && typeof val === "object" && Array.isArray(val) === false;
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
152
|
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
63
153
|
var require_is_plain_object = __commonJS({
|
|
64
154
|
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
|
|
@@ -213,96 +303,6 @@ var require_set_value = __commonJS({
|
|
|
213
303
|
}
|
|
214
304
|
});
|
|
215
305
|
|
|
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 isObject2 = require_isobject();
|
|
222
|
-
module.exports = function(target, path, options) {
|
|
223
|
-
if (!isObject2(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 isObject2(val) || Array.isArray(val) || typeof val === "function";
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
306
|
// src/index.ts
|
|
307
307
|
init_esm_shims();
|
|
308
308
|
import { extname } from "node:path";
|
|
@@ -377,8 +377,9 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
377
377
|
});
|
|
378
378
|
|
|
379
379
|
// src/index.ts
|
|
380
|
-
var import_set_value = __toESM(require_set_value(), 1);
|
|
381
380
|
var import_get_value = __toESM(require_get_value(), 1);
|
|
381
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
382
|
+
import objectHash from "object-hash";
|
|
382
383
|
function escapeStringRegexp(str) {
|
|
383
384
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
384
385
|
}
|
|
@@ -414,24 +415,33 @@ export {
|
|
|
414
415
|
escapeStringRegexp,
|
|
415
416
|
export_get as get,
|
|
416
417
|
isObject,
|
|
418
|
+
objectHash,
|
|
417
419
|
removeExtension,
|
|
418
420
|
export_set as set
|
|
419
421
|
};
|
|
420
422
|
/*! Bundled license information:
|
|
421
423
|
|
|
422
|
-
|
|
424
|
+
isobject/index.js:
|
|
423
425
|
(*!
|
|
424
|
-
*
|
|
426
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
425
427
|
*
|
|
426
|
-
* Copyright (c) 2014-
|
|
428
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
427
429
|
* Released under the MIT License.
|
|
428
430
|
*)
|
|
429
431
|
|
|
430
|
-
|
|
432
|
+
get-value/index.js:
|
|
431
433
|
(*!
|
|
432
|
-
*
|
|
434
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
433
435
|
*
|
|
434
|
-
* Copyright (c) 2014-
|
|
436
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
437
|
+
* Released under the MIT License.
|
|
438
|
+
*)
|
|
439
|
+
|
|
440
|
+
is-primitive/index.js:
|
|
441
|
+
(*!
|
|
442
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
443
|
+
*
|
|
444
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
435
445
|
* Released under the MIT License.
|
|
436
446
|
*)
|
|
437
447
|
|
|
@@ -450,12 +460,4 @@ set-value/index.js:
|
|
|
450
460
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
451
461
|
* Released under the MIT License.
|
|
452
462
|
*)
|
|
453
|
-
|
|
454
|
-
get-value/index.js:
|
|
455
|
-
(*!
|
|
456
|
-
* get-value <https://github.com/jonschlinkert/get-value>
|
|
457
|
-
*
|
|
458
|
-
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
459
|
-
* Released under the MIT License.
|
|
460
|
-
*)
|
|
461
463
|
*/
|
package/package.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-core/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.3",
|
|
5
5
|
"description": "@weapp-core/shared",
|
|
6
|
-
"author": "
|
|
6
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/weapp-vite/weapp-vite.git",
|
|
11
|
+
"directory": "@weapp-core/shared"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
15
|
+
},
|
|
8
16
|
"keywords": [],
|
|
9
17
|
"sideEffects": false,
|
|
10
18
|
"exports": {
|
|
@@ -20,6 +28,9 @@
|
|
|
20
28
|
"files": [
|
|
21
29
|
"dist"
|
|
22
30
|
],
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"object-hash": "^3.0.0"
|
|
33
|
+
},
|
|
23
34
|
"scripts": {
|
|
24
35
|
"dev": "tsup --watch --sourcemap",
|
|
25
36
|
"build": "tsup",
|