@weapp-core/shared 1.0.0 → 1.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/LICENSE +1 -1
- package/dist/index.cjs +496 -114
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +503 -115
- package/package.json +13 -4
package/LICENSE
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -33,24 +33,389 @@ 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/
|
|
44
|
-
var
|
|
45
|
-
"../../node_modules/.pnpm/
|
|
43
|
+
// ../../node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js
|
|
44
|
+
var require_object_hash = __commonJS({
|
|
45
|
+
"../../node_modules/.pnpm/object-hash@3.0.0/node_modules/object-hash/index.js"(exports2, module2) {
|
|
46
46
|
"use strict";
|
|
47
47
|
init_cjs_shims();
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
var crypto = require("crypto");
|
|
49
|
+
exports2 = module2.exports = objectHash2;
|
|
50
|
+
function objectHash2(object, options) {
|
|
51
|
+
options = applyDefaults(object, options);
|
|
52
|
+
return hash(object, options);
|
|
53
|
+
}
|
|
54
|
+
exports2.sha1 = function(object) {
|
|
55
|
+
return objectHash2(object);
|
|
56
|
+
};
|
|
57
|
+
exports2.keys = function(object) {
|
|
58
|
+
return objectHash2(object, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
|
|
59
|
+
};
|
|
60
|
+
exports2.MD5 = function(object) {
|
|
61
|
+
return objectHash2(object, { algorithm: "md5", encoding: "hex" });
|
|
62
|
+
};
|
|
63
|
+
exports2.keysMD5 = function(object) {
|
|
64
|
+
return objectHash2(object, { algorithm: "md5", encoding: "hex", excludeValues: true });
|
|
65
|
+
};
|
|
66
|
+
var hashes = crypto.getHashes ? crypto.getHashes().slice() : ["sha1", "md5"];
|
|
67
|
+
hashes.push("passthrough");
|
|
68
|
+
var encodings = ["buffer", "hex", "binary", "base64"];
|
|
69
|
+
function applyDefaults(object, sourceOptions) {
|
|
70
|
+
sourceOptions = sourceOptions || {};
|
|
71
|
+
var options = {};
|
|
72
|
+
options.algorithm = sourceOptions.algorithm || "sha1";
|
|
73
|
+
options.encoding = sourceOptions.encoding || "hex";
|
|
74
|
+
options.excludeValues = sourceOptions.excludeValues ? true : false;
|
|
75
|
+
options.algorithm = options.algorithm.toLowerCase();
|
|
76
|
+
options.encoding = options.encoding.toLowerCase();
|
|
77
|
+
options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true;
|
|
78
|
+
options.respectType = sourceOptions.respectType === false ? false : true;
|
|
79
|
+
options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true;
|
|
80
|
+
options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true;
|
|
81
|
+
options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true;
|
|
82
|
+
options.unorderedSets = sourceOptions.unorderedSets === false ? false : true;
|
|
83
|
+
options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true;
|
|
84
|
+
options.replacer = sourceOptions.replacer || void 0;
|
|
85
|
+
options.excludeKeys = sourceOptions.excludeKeys || void 0;
|
|
86
|
+
if (typeof object === "undefined") {
|
|
87
|
+
throw new Error("Object argument required.");
|
|
51
88
|
}
|
|
52
|
-
|
|
89
|
+
for (var i = 0; i < hashes.length; ++i) {
|
|
90
|
+
if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) {
|
|
91
|
+
options.algorithm = hashes[i];
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (hashes.indexOf(options.algorithm) === -1) {
|
|
95
|
+
throw new Error('Algorithm "' + options.algorithm + '" not supported. supported values: ' + hashes.join(", "));
|
|
96
|
+
}
|
|
97
|
+
if (encodings.indexOf(options.encoding) === -1 && options.algorithm !== "passthrough") {
|
|
98
|
+
throw new Error('Encoding "' + options.encoding + '" not supported. supported values: ' + encodings.join(", "));
|
|
99
|
+
}
|
|
100
|
+
return options;
|
|
101
|
+
}
|
|
102
|
+
function isNativeFunction(f) {
|
|
103
|
+
if (typeof f !== "function") {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i;
|
|
107
|
+
return exp.exec(Function.prototype.toString.call(f)) != null;
|
|
108
|
+
}
|
|
109
|
+
function hash(object, options) {
|
|
110
|
+
var hashingStream;
|
|
111
|
+
if (options.algorithm !== "passthrough") {
|
|
112
|
+
hashingStream = crypto.createHash(options.algorithm);
|
|
113
|
+
} else {
|
|
114
|
+
hashingStream = new PassThrough();
|
|
115
|
+
}
|
|
116
|
+
if (typeof hashingStream.write === "undefined") {
|
|
117
|
+
hashingStream.write = hashingStream.update;
|
|
118
|
+
hashingStream.end = hashingStream.update;
|
|
119
|
+
}
|
|
120
|
+
var hasher = typeHasher(options, hashingStream);
|
|
121
|
+
hasher.dispatch(object);
|
|
122
|
+
if (!hashingStream.update) {
|
|
123
|
+
hashingStream.end("");
|
|
124
|
+
}
|
|
125
|
+
if (hashingStream.digest) {
|
|
126
|
+
return hashingStream.digest(options.encoding === "buffer" ? void 0 : options.encoding);
|
|
127
|
+
}
|
|
128
|
+
var buf = hashingStream.read();
|
|
129
|
+
if (options.encoding === "buffer") {
|
|
130
|
+
return buf;
|
|
131
|
+
}
|
|
132
|
+
return buf.toString(options.encoding);
|
|
133
|
+
}
|
|
134
|
+
exports2.writeToStream = function(object, options, stream) {
|
|
135
|
+
if (typeof stream === "undefined") {
|
|
136
|
+
stream = options;
|
|
137
|
+
options = {};
|
|
138
|
+
}
|
|
139
|
+
options = applyDefaults(object, options);
|
|
140
|
+
return typeHasher(options, stream).dispatch(object);
|
|
53
141
|
};
|
|
142
|
+
function typeHasher(options, writeTo, context) {
|
|
143
|
+
context = context || [];
|
|
144
|
+
var write = function(str) {
|
|
145
|
+
if (writeTo.update) {
|
|
146
|
+
return writeTo.update(str, "utf8");
|
|
147
|
+
} else {
|
|
148
|
+
return writeTo.write(str, "utf8");
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return {
|
|
152
|
+
dispatch: function(value) {
|
|
153
|
+
if (options.replacer) {
|
|
154
|
+
value = options.replacer(value);
|
|
155
|
+
}
|
|
156
|
+
var type = typeof value;
|
|
157
|
+
if (value === null) {
|
|
158
|
+
type = "null";
|
|
159
|
+
}
|
|
160
|
+
return this["_" + type](value);
|
|
161
|
+
},
|
|
162
|
+
_object: function(object) {
|
|
163
|
+
var pattern = /\[object (.*)\]/i;
|
|
164
|
+
var objString = Object.prototype.toString.call(object);
|
|
165
|
+
var objType = pattern.exec(objString);
|
|
166
|
+
if (!objType) {
|
|
167
|
+
objType = "unknown:[" + objString + "]";
|
|
168
|
+
} else {
|
|
169
|
+
objType = objType[1];
|
|
170
|
+
}
|
|
171
|
+
objType = objType.toLowerCase();
|
|
172
|
+
var objectNumber = null;
|
|
173
|
+
if ((objectNumber = context.indexOf(object)) >= 0) {
|
|
174
|
+
return this.dispatch("[CIRCULAR:" + objectNumber + "]");
|
|
175
|
+
} else {
|
|
176
|
+
context.push(object);
|
|
177
|
+
}
|
|
178
|
+
if (typeof Buffer !== "undefined" && Buffer.isBuffer && Buffer.isBuffer(object)) {
|
|
179
|
+
write("buffer:");
|
|
180
|
+
return write(object);
|
|
181
|
+
}
|
|
182
|
+
if (objType !== "object" && objType !== "function" && objType !== "asyncfunction") {
|
|
183
|
+
if (this["_" + objType]) {
|
|
184
|
+
this["_" + objType](object);
|
|
185
|
+
} else if (options.ignoreUnknown) {
|
|
186
|
+
return write("[" + objType + "]");
|
|
187
|
+
} else {
|
|
188
|
+
throw new Error('Unknown object type "' + objType + '"');
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
var keys = Object.keys(object);
|
|
192
|
+
if (options.unorderedObjects) {
|
|
193
|
+
keys = keys.sort();
|
|
194
|
+
}
|
|
195
|
+
if (options.respectType !== false && !isNativeFunction(object)) {
|
|
196
|
+
keys.splice(0, 0, "prototype", "__proto__", "constructor");
|
|
197
|
+
}
|
|
198
|
+
if (options.excludeKeys) {
|
|
199
|
+
keys = keys.filter(function(key) {
|
|
200
|
+
return !options.excludeKeys(key);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
write("object:" + keys.length + ":");
|
|
204
|
+
var self = this;
|
|
205
|
+
return keys.forEach(function(key) {
|
|
206
|
+
self.dispatch(key);
|
|
207
|
+
write(":");
|
|
208
|
+
if (!options.excludeValues) {
|
|
209
|
+
self.dispatch(object[key]);
|
|
210
|
+
}
|
|
211
|
+
write(",");
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
_array: function(arr, unordered) {
|
|
216
|
+
unordered = typeof unordered !== "undefined" ? unordered : options.unorderedArrays !== false;
|
|
217
|
+
var self = this;
|
|
218
|
+
write("array:" + arr.length + ":");
|
|
219
|
+
if (!unordered || arr.length <= 1) {
|
|
220
|
+
return arr.forEach(function(entry) {
|
|
221
|
+
return self.dispatch(entry);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
var contextAdditions = [];
|
|
225
|
+
var entries = arr.map(function(entry) {
|
|
226
|
+
var strm = new PassThrough();
|
|
227
|
+
var localContext = context.slice();
|
|
228
|
+
var hasher = typeHasher(options, strm, localContext);
|
|
229
|
+
hasher.dispatch(entry);
|
|
230
|
+
contextAdditions = contextAdditions.concat(localContext.slice(context.length));
|
|
231
|
+
return strm.read().toString();
|
|
232
|
+
});
|
|
233
|
+
context = context.concat(contextAdditions);
|
|
234
|
+
entries.sort();
|
|
235
|
+
return this._array(entries, false);
|
|
236
|
+
},
|
|
237
|
+
_date: function(date) {
|
|
238
|
+
return write("date:" + date.toJSON());
|
|
239
|
+
},
|
|
240
|
+
_symbol: function(sym) {
|
|
241
|
+
return write("symbol:" + sym.toString());
|
|
242
|
+
},
|
|
243
|
+
_error: function(err) {
|
|
244
|
+
return write("error:" + err.toString());
|
|
245
|
+
},
|
|
246
|
+
_boolean: function(bool) {
|
|
247
|
+
return write("bool:" + bool.toString());
|
|
248
|
+
},
|
|
249
|
+
_string: function(string) {
|
|
250
|
+
write("string:" + string.length + ":");
|
|
251
|
+
write(string.toString());
|
|
252
|
+
},
|
|
253
|
+
_function: function(fn) {
|
|
254
|
+
write("fn:");
|
|
255
|
+
if (isNativeFunction(fn)) {
|
|
256
|
+
this.dispatch("[native]");
|
|
257
|
+
} else {
|
|
258
|
+
this.dispatch(fn.toString());
|
|
259
|
+
}
|
|
260
|
+
if (options.respectFunctionNames !== false) {
|
|
261
|
+
this.dispatch("function-name:" + String(fn.name));
|
|
262
|
+
}
|
|
263
|
+
if (options.respectFunctionProperties) {
|
|
264
|
+
this._object(fn);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
_number: function(number) {
|
|
268
|
+
return write("number:" + number.toString());
|
|
269
|
+
},
|
|
270
|
+
_xml: function(xml) {
|
|
271
|
+
return write("xml:" + xml.toString());
|
|
272
|
+
},
|
|
273
|
+
_null: function() {
|
|
274
|
+
return write("Null");
|
|
275
|
+
},
|
|
276
|
+
_undefined: function() {
|
|
277
|
+
return write("Undefined");
|
|
278
|
+
},
|
|
279
|
+
_regexp: function(regex) {
|
|
280
|
+
return write("regex:" + regex.toString());
|
|
281
|
+
},
|
|
282
|
+
_uint8array: function(arr) {
|
|
283
|
+
write("uint8array:");
|
|
284
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
285
|
+
},
|
|
286
|
+
_uint8clampedarray: function(arr) {
|
|
287
|
+
write("uint8clampedarray:");
|
|
288
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
289
|
+
},
|
|
290
|
+
_int8array: function(arr) {
|
|
291
|
+
write("int8array:");
|
|
292
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
293
|
+
},
|
|
294
|
+
_uint16array: function(arr) {
|
|
295
|
+
write("uint16array:");
|
|
296
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
297
|
+
},
|
|
298
|
+
_int16array: function(arr) {
|
|
299
|
+
write("int16array:");
|
|
300
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
301
|
+
},
|
|
302
|
+
_uint32array: function(arr) {
|
|
303
|
+
write("uint32array:");
|
|
304
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
305
|
+
},
|
|
306
|
+
_int32array: function(arr) {
|
|
307
|
+
write("int32array:");
|
|
308
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
309
|
+
},
|
|
310
|
+
_float32array: function(arr) {
|
|
311
|
+
write("float32array:");
|
|
312
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
313
|
+
},
|
|
314
|
+
_float64array: function(arr) {
|
|
315
|
+
write("float64array:");
|
|
316
|
+
return this.dispatch(Array.prototype.slice.call(arr));
|
|
317
|
+
},
|
|
318
|
+
_arraybuffer: function(arr) {
|
|
319
|
+
write("arraybuffer:");
|
|
320
|
+
return this.dispatch(new Uint8Array(arr));
|
|
321
|
+
},
|
|
322
|
+
_url: function(url) {
|
|
323
|
+
return write("url:" + url.toString(), "utf8");
|
|
324
|
+
},
|
|
325
|
+
_map: function(map) {
|
|
326
|
+
write("map:");
|
|
327
|
+
var arr = Array.from(map);
|
|
328
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
329
|
+
},
|
|
330
|
+
_set: function(set) {
|
|
331
|
+
write("set:");
|
|
332
|
+
var arr = Array.from(set);
|
|
333
|
+
return this._array(arr, options.unorderedSets !== false);
|
|
334
|
+
},
|
|
335
|
+
_file: function(file) {
|
|
336
|
+
write("file:");
|
|
337
|
+
return this.dispatch([file.name, file.size, file.type, file.lastModfied]);
|
|
338
|
+
},
|
|
339
|
+
_blob: function() {
|
|
340
|
+
if (options.ignoreUnknown) {
|
|
341
|
+
return write("[blob]");
|
|
342
|
+
}
|
|
343
|
+
throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n');
|
|
344
|
+
},
|
|
345
|
+
_domwindow: function() {
|
|
346
|
+
return write("domwindow");
|
|
347
|
+
},
|
|
348
|
+
_bigint: function(number) {
|
|
349
|
+
return write("bigint:" + number.toString());
|
|
350
|
+
},
|
|
351
|
+
/* Node.js standard native objects */
|
|
352
|
+
_process: function() {
|
|
353
|
+
return write("process");
|
|
354
|
+
},
|
|
355
|
+
_timer: function() {
|
|
356
|
+
return write("timer");
|
|
357
|
+
},
|
|
358
|
+
_pipe: function() {
|
|
359
|
+
return write("pipe");
|
|
360
|
+
},
|
|
361
|
+
_tcp: function() {
|
|
362
|
+
return write("tcp");
|
|
363
|
+
},
|
|
364
|
+
_udp: function() {
|
|
365
|
+
return write("udp");
|
|
366
|
+
},
|
|
367
|
+
_tty: function() {
|
|
368
|
+
return write("tty");
|
|
369
|
+
},
|
|
370
|
+
_statwatcher: function() {
|
|
371
|
+
return write("statwatcher");
|
|
372
|
+
},
|
|
373
|
+
_securecontext: function() {
|
|
374
|
+
return write("securecontext");
|
|
375
|
+
},
|
|
376
|
+
_connection: function() {
|
|
377
|
+
return write("connection");
|
|
378
|
+
},
|
|
379
|
+
_zlib: function() {
|
|
380
|
+
return write("zlib");
|
|
381
|
+
},
|
|
382
|
+
_context: function() {
|
|
383
|
+
return write("context");
|
|
384
|
+
},
|
|
385
|
+
_nodescript: function() {
|
|
386
|
+
return write("nodescript");
|
|
387
|
+
},
|
|
388
|
+
_httpparser: function() {
|
|
389
|
+
return write("httpparser");
|
|
390
|
+
},
|
|
391
|
+
_dataview: function() {
|
|
392
|
+
return write("dataview");
|
|
393
|
+
},
|
|
394
|
+
_signal: function() {
|
|
395
|
+
return write("signal");
|
|
396
|
+
},
|
|
397
|
+
_fsevent: function() {
|
|
398
|
+
return write("fsevent");
|
|
399
|
+
},
|
|
400
|
+
_tlswrap: function() {
|
|
401
|
+
return write("tlswrap");
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function PassThrough() {
|
|
406
|
+
return {
|
|
407
|
+
buf: "",
|
|
408
|
+
write: function(b) {
|
|
409
|
+
this.buf += b;
|
|
410
|
+
},
|
|
411
|
+
end: function(b) {
|
|
412
|
+
this.buf += b;
|
|
413
|
+
},
|
|
414
|
+
read: function() {
|
|
415
|
+
return this.buf;
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}
|
|
54
419
|
}
|
|
55
420
|
});
|
|
56
421
|
|
|
@@ -65,6 +430,110 @@ var require_isobject = __commonJS({
|
|
|
65
430
|
}
|
|
66
431
|
});
|
|
67
432
|
|
|
433
|
+
// ../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js
|
|
434
|
+
var require_get_value = __commonJS({
|
|
435
|
+
"../../node_modules/.pnpm/get-value@3.0.1/node_modules/get-value/index.js"(exports2, module2) {
|
|
436
|
+
"use strict";
|
|
437
|
+
init_cjs_shims();
|
|
438
|
+
var isObject2 = require_isobject();
|
|
439
|
+
module2.exports = function(target, path, options) {
|
|
440
|
+
if (!isObject2(options)) {
|
|
441
|
+
options = { default: options };
|
|
442
|
+
}
|
|
443
|
+
if (!isValidObject(target)) {
|
|
444
|
+
return typeof options.default !== "undefined" ? options.default : target;
|
|
445
|
+
}
|
|
446
|
+
if (typeof path === "number") {
|
|
447
|
+
path = String(path);
|
|
448
|
+
}
|
|
449
|
+
const isArray = Array.isArray(path);
|
|
450
|
+
const isString = typeof path === "string";
|
|
451
|
+
const splitChar = options.separator || ".";
|
|
452
|
+
const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
|
|
453
|
+
if (!isString && !isArray) {
|
|
454
|
+
return target;
|
|
455
|
+
}
|
|
456
|
+
if (isString && path in target) {
|
|
457
|
+
return isValid(path, target, options) ? target[path] : options.default;
|
|
458
|
+
}
|
|
459
|
+
let segs = isArray ? path : split(path, splitChar, options);
|
|
460
|
+
let len = segs.length;
|
|
461
|
+
let idx = 0;
|
|
462
|
+
do {
|
|
463
|
+
let prop = segs[idx];
|
|
464
|
+
if (typeof prop === "number") {
|
|
465
|
+
prop = String(prop);
|
|
466
|
+
}
|
|
467
|
+
while (prop && prop.slice(-1) === "\\") {
|
|
468
|
+
prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
|
|
469
|
+
}
|
|
470
|
+
if (prop in target) {
|
|
471
|
+
if (!isValid(prop, target, options)) {
|
|
472
|
+
return options.default;
|
|
473
|
+
}
|
|
474
|
+
target = target[prop];
|
|
475
|
+
} else {
|
|
476
|
+
let hasProp = false;
|
|
477
|
+
let n = idx + 1;
|
|
478
|
+
while (n < len) {
|
|
479
|
+
prop = join([prop, segs[n++]], joinChar, options);
|
|
480
|
+
if (hasProp = prop in target) {
|
|
481
|
+
if (!isValid(prop, target, options)) {
|
|
482
|
+
return options.default;
|
|
483
|
+
}
|
|
484
|
+
target = target[prop];
|
|
485
|
+
idx = n - 1;
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (!hasProp) {
|
|
490
|
+
return options.default;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
} while (++idx < len && isValidObject(target));
|
|
494
|
+
if (idx === len) {
|
|
495
|
+
return target;
|
|
496
|
+
}
|
|
497
|
+
return options.default;
|
|
498
|
+
};
|
|
499
|
+
function join(segs, joinChar, options) {
|
|
500
|
+
if (typeof options.join === "function") {
|
|
501
|
+
return options.join(segs);
|
|
502
|
+
}
|
|
503
|
+
return segs[0] + joinChar + segs[1];
|
|
504
|
+
}
|
|
505
|
+
function split(path, splitChar, options) {
|
|
506
|
+
if (typeof options.split === "function") {
|
|
507
|
+
return options.split(path);
|
|
508
|
+
}
|
|
509
|
+
return path.split(splitChar);
|
|
510
|
+
}
|
|
511
|
+
function isValid(key, target, options) {
|
|
512
|
+
if (typeof options.isValid === "function") {
|
|
513
|
+
return options.isValid(key, target);
|
|
514
|
+
}
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
function isValidObject(val) {
|
|
518
|
+
return isObject2(val) || Array.isArray(val) || typeof val === "function";
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
524
|
+
var require_is_primitive = __commonJS({
|
|
525
|
+
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
|
|
526
|
+
"use strict";
|
|
527
|
+
init_cjs_shims();
|
|
528
|
+
module2.exports = function isPrimitive(val) {
|
|
529
|
+
if (typeof val === "object") {
|
|
530
|
+
return val === null;
|
|
531
|
+
}
|
|
532
|
+
return typeof val !== "function";
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
68
537
|
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
69
538
|
var require_is_plain_object = __commonJS({
|
|
70
539
|
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
@@ -219,96 +688,6 @@ var require_set_value = __commonJS({
|
|
|
219
688
|
}
|
|
220
689
|
});
|
|
221
690
|
|
|
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
691
|
// src/index.ts
|
|
313
692
|
var src_exports = {};
|
|
314
693
|
__export(src_exports, {
|
|
@@ -319,6 +698,7 @@ __export(src_exports, {
|
|
|
319
698
|
escapeStringRegexp: () => escapeStringRegexp,
|
|
320
699
|
get: () => import_get_value.default,
|
|
321
700
|
isObject: () => isObject,
|
|
701
|
+
objectHash: () => import_object_hash.default,
|
|
322
702
|
removeExtension: () => removeExtension,
|
|
323
703
|
set: () => import_set_value.default
|
|
324
704
|
});
|
|
@@ -396,8 +776,9 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
396
776
|
});
|
|
397
777
|
|
|
398
778
|
// src/index.ts
|
|
399
|
-
var
|
|
779
|
+
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
400
780
|
var import_get_value = __toESM(require_get_value(), 1);
|
|
781
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
401
782
|
function escapeStringRegexp(str) {
|
|
402
783
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
403
784
|
}
|
|
@@ -432,24 +813,33 @@ function isObject(x) {
|
|
|
432
813
|
escapeStringRegexp,
|
|
433
814
|
get,
|
|
434
815
|
isObject,
|
|
816
|
+
objectHash,
|
|
435
817
|
removeExtension,
|
|
436
818
|
set
|
|
437
819
|
});
|
|
438
820
|
/*! Bundled license information:
|
|
439
821
|
|
|
440
|
-
|
|
822
|
+
isobject/index.js:
|
|
441
823
|
(*!
|
|
442
|
-
*
|
|
824
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
443
825
|
*
|
|
444
|
-
* Copyright (c) 2014-
|
|
826
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
445
827
|
* Released under the MIT License.
|
|
446
828
|
*)
|
|
447
829
|
|
|
448
|
-
|
|
830
|
+
get-value/index.js:
|
|
449
831
|
(*!
|
|
450
|
-
*
|
|
832
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
451
833
|
*
|
|
452
|
-
* Copyright (c) 2014-
|
|
834
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
835
|
+
* Released under the MIT License.
|
|
836
|
+
*)
|
|
837
|
+
|
|
838
|
+
is-primitive/index.js:
|
|
839
|
+
(*!
|
|
840
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
841
|
+
*
|
|
842
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
453
843
|
* Released under the MIT License.
|
|
454
844
|
*)
|
|
455
845
|
|
|
@@ -468,12 +858,4 @@ set-value/index.js:
|
|
|
468
858
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
469
859
|
* Released under the MIT License.
|
|
470
860
|
*)
|
|
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
861
|
*/
|
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;
|