@weapp-core/shared 1.0.1 → 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 +10 -2
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
|
@@ -4,10 +4,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
8
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
9
|
+
}) : x)(function(x) {
|
|
10
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
11
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
|
+
});
|
|
7
13
|
var __esm = (fn, res) => function __init() {
|
|
8
14
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
15
|
};
|
|
10
|
-
var __commonJS = (cb, mod) => function
|
|
16
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
11
17
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
18
|
};
|
|
13
19
|
var __copyProps = (to, from, except, desc) => {
|
|
@@ -27,24 +33,389 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
33
|
mod
|
|
28
34
|
));
|
|
29
35
|
|
|
30
|
-
// ../../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/esm_shims.js
|
|
31
37
|
var init_esm_shims = __esm({
|
|
32
|
-
"../../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/esm_shims.js"() {
|
|
33
39
|
"use strict";
|
|
34
40
|
}
|
|
35
41
|
});
|
|
36
42
|
|
|
37
|
-
// ../../node_modules/.pnpm/
|
|
38
|
-
var
|
|
39
|
-
"../../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"(exports, module) {
|
|
40
46
|
"use strict";
|
|
41
47
|
init_esm_shims();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
48
|
+
var crypto = __require("crypto");
|
|
49
|
+
exports = module.exports = objectHash2;
|
|
50
|
+
function objectHash2(object, options) {
|
|
51
|
+
options = applyDefaults(object, options);
|
|
52
|
+
return hash(object, options);
|
|
53
|
+
}
|
|
54
|
+
exports.sha1 = function(object) {
|
|
55
|
+
return objectHash2(object);
|
|
56
|
+
};
|
|
57
|
+
exports.keys = function(object) {
|
|
58
|
+
return objectHash2(object, { excludeValues: true, algorithm: "sha1", encoding: "hex" });
|
|
59
|
+
};
|
|
60
|
+
exports.MD5 = function(object) {
|
|
61
|
+
return objectHash2(object, { algorithm: "md5", encoding: "hex" });
|
|
62
|
+
};
|
|
63
|
+
exports.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.");
|
|
45
88
|
}
|
|
46
|
-
|
|
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
|
+
exports.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);
|
|
47
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
|
+
}
|
|
48
419
|
}
|
|
49
420
|
});
|
|
50
421
|
|
|
@@ -59,6 +430,110 @@ var require_isobject = __commonJS({
|
|
|
59
430
|
}
|
|
60
431
|
});
|
|
61
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"(exports, module) {
|
|
436
|
+
"use strict";
|
|
437
|
+
init_esm_shims();
|
|
438
|
+
var isObject2 = require_isobject();
|
|
439
|
+
module.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"(exports, module) {
|
|
526
|
+
"use strict";
|
|
527
|
+
init_esm_shims();
|
|
528
|
+
module.exports = function isPrimitive(val) {
|
|
529
|
+
if (typeof val === "object") {
|
|
530
|
+
return val === null;
|
|
531
|
+
}
|
|
532
|
+
return typeof val !== "function";
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
|
|
62
537
|
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
63
538
|
var require_is_plain_object = __commonJS({
|
|
64
539
|
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
|
|
@@ -213,96 +688,6 @@ var require_set_value = __commonJS({
|
|
|
213
688
|
}
|
|
214
689
|
});
|
|
215
690
|
|
|
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
691
|
// src/index.ts
|
|
307
692
|
init_esm_shims();
|
|
308
693
|
import { extname } from "node:path";
|
|
@@ -377,8 +762,9 @@ var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
|
377
762
|
});
|
|
378
763
|
|
|
379
764
|
// src/index.ts
|
|
380
|
-
var
|
|
765
|
+
var import_object_hash = __toESM(require_object_hash(), 1);
|
|
381
766
|
var import_get_value = __toESM(require_get_value(), 1);
|
|
767
|
+
var import_set_value = __toESM(require_set_value(), 1);
|
|
382
768
|
function escapeStringRegexp(str) {
|
|
383
769
|
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
|
384
770
|
}
|
|
@@ -405,6 +791,7 @@ function isObject(x) {
|
|
|
405
791
|
return typeof x === "object" && x !== null;
|
|
406
792
|
}
|
|
407
793
|
var export_get = import_get_value.default;
|
|
794
|
+
var export_objectHash = import_object_hash.default;
|
|
408
795
|
var export_set = import_set_value.default;
|
|
409
796
|
export {
|
|
410
797
|
addExtension,
|
|
@@ -414,24 +801,33 @@ export {
|
|
|
414
801
|
escapeStringRegexp,
|
|
415
802
|
export_get as get,
|
|
416
803
|
isObject,
|
|
804
|
+
export_objectHash as objectHash,
|
|
417
805
|
removeExtension,
|
|
418
806
|
export_set as set
|
|
419
807
|
};
|
|
420
808
|
/*! Bundled license information:
|
|
421
809
|
|
|
422
|
-
|
|
810
|
+
isobject/index.js:
|
|
423
811
|
(*!
|
|
424
|
-
*
|
|
812
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
425
813
|
*
|
|
426
|
-
* Copyright (c) 2014-
|
|
814
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
427
815
|
* Released under the MIT License.
|
|
428
816
|
*)
|
|
429
817
|
|
|
430
|
-
|
|
818
|
+
get-value/index.js:
|
|
431
819
|
(*!
|
|
432
|
-
*
|
|
820
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
433
821
|
*
|
|
434
|
-
* Copyright (c) 2014-
|
|
822
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
823
|
+
* Released under the MIT License.
|
|
824
|
+
*)
|
|
825
|
+
|
|
826
|
+
is-primitive/index.js:
|
|
827
|
+
(*!
|
|
828
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
829
|
+
*
|
|
830
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
435
831
|
* Released under the MIT License.
|
|
436
832
|
*)
|
|
437
833
|
|
|
@@ -450,12 +846,4 @@ set-value/index.js:
|
|
|
450
846
|
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
451
847
|
* Released under the MIT License.
|
|
452
848
|
*)
|
|
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
849
|
*/
|