@weapp-tailwindcss/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 +21 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +512 -0
- package/dist/index.mjs +493 -0
- package/package.json +40 -0
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.d.mts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as defu from 'defu';
|
|
2
|
+
export { defu } from 'defu';
|
|
3
|
+
export { default as getValue } from 'get-value';
|
|
4
|
+
export { default as setValue } from 'set-value';
|
|
5
|
+
|
|
6
|
+
declare function isRegexp(value: unknown): boolean;
|
|
7
|
+
declare function isMap(value: unknown): boolean;
|
|
8
|
+
declare function regExpTest(arr: (string | RegExp)[], str: string): boolean;
|
|
9
|
+
declare function noop(): void;
|
|
10
|
+
declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
|
|
11
|
+
declare function removeExt(file: string): string;
|
|
12
|
+
declare const defuOverrideArray: <Source extends {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
[x: number]: any;
|
|
15
|
+
[x: symbol]: any;
|
|
16
|
+
}, Defaults extends Array<{
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
[x: number]: any;
|
|
19
|
+
[x: symbol]: any;
|
|
20
|
+
} | (number | boolean | any[] | Record<never, any> | null | undefined)>>(source: Source, ...defaults: Defaults) => defu.Defu<Source, Defaults>;
|
|
21
|
+
|
|
22
|
+
export { defuOverrideArray, groupBy, isMap, isRegexp, noop, regExpTest, removeExt };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as defu from 'defu';
|
|
2
|
+
export { defu } from 'defu';
|
|
3
|
+
export { default as getValue } from 'get-value';
|
|
4
|
+
export { default as setValue } from 'set-value';
|
|
5
|
+
|
|
6
|
+
declare function isRegexp(value: unknown): boolean;
|
|
7
|
+
declare function isMap(value: unknown): boolean;
|
|
8
|
+
declare function regExpTest(arr: (string | RegExp)[], str: string): boolean;
|
|
9
|
+
declare function noop(): void;
|
|
10
|
+
declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
|
|
11
|
+
declare function removeExt(file: string): string;
|
|
12
|
+
declare const defuOverrideArray: <Source extends {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
[x: number]: any;
|
|
15
|
+
[x: symbol]: any;
|
|
16
|
+
}, Defaults extends Array<{
|
|
17
|
+
[x: string]: any;
|
|
18
|
+
[x: number]: any;
|
|
19
|
+
[x: symbol]: any;
|
|
20
|
+
} | (number | boolean | any[] | Record<never, any> | null | undefined)>>(source: Source, ...defaults: Defaults) => defu.Defu<Source, Defaults>;
|
|
21
|
+
|
|
22
|
+
export { defuOverrideArray, groupBy, isMap, isRegexp, noop, regExpTest, removeExt };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,512 @@
|
|
|
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.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js
|
|
37
|
+
var init_cjs_shims = __esm({
|
|
38
|
+
"../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.7.0/node_modules/tsup/assets/cjs_shims.js"() {
|
|
39
|
+
"use strict";
|
|
40
|
+
}
|
|
41
|
+
});
|
|
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 isObject(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 isObject = require_isobject();
|
|
60
|
+
module2.exports = function(target, path, options) {
|
|
61
|
+
if (!isObject(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 isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
145
|
+
var require_is_primitive = __commonJS({
|
|
146
|
+
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports2, module2) {
|
|
147
|
+
"use strict";
|
|
148
|
+
init_cjs_shims();
|
|
149
|
+
module2.exports = function isPrimitive(val) {
|
|
150
|
+
if (typeof val === "object") {
|
|
151
|
+
return val === null;
|
|
152
|
+
}
|
|
153
|
+
return typeof val !== "function";
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
159
|
+
var require_is_plain_object = __commonJS({
|
|
160
|
+
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports2, module2) {
|
|
161
|
+
"use strict";
|
|
162
|
+
init_cjs_shims();
|
|
163
|
+
var isObject = require_isobject();
|
|
164
|
+
function isObjectObject(o) {
|
|
165
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
166
|
+
}
|
|
167
|
+
module2.exports = function isPlainObject2(o) {
|
|
168
|
+
var ctor, prot;
|
|
169
|
+
if (isObjectObject(o) === false) return false;
|
|
170
|
+
ctor = o.constructor;
|
|
171
|
+
if (typeof ctor !== "function") return false;
|
|
172
|
+
prot = ctor.prototype;
|
|
173
|
+
if (isObjectObject(prot) === false) return false;
|
|
174
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
return true;
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
183
|
+
var require_set_value = __commonJS({
|
|
184
|
+
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports2, module2) {
|
|
185
|
+
"use strict";
|
|
186
|
+
init_cjs_shims();
|
|
187
|
+
var { deleteProperty } = Reflect;
|
|
188
|
+
var isPrimitive = require_is_primitive();
|
|
189
|
+
var isPlainObject2 = require_is_plain_object();
|
|
190
|
+
var isObject = (value) => {
|
|
191
|
+
return typeof value === "object" && value !== null || typeof value === "function";
|
|
192
|
+
};
|
|
193
|
+
var isUnsafeKey = (key) => {
|
|
194
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
195
|
+
};
|
|
196
|
+
var validateKey = (key) => {
|
|
197
|
+
if (!isPrimitive(key)) {
|
|
198
|
+
throw new TypeError("Object keys must be strings or symbols");
|
|
199
|
+
}
|
|
200
|
+
if (isUnsafeKey(key)) {
|
|
201
|
+
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
var toStringKey = (input) => {
|
|
205
|
+
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
206
|
+
};
|
|
207
|
+
var createMemoKey = (input, options) => {
|
|
208
|
+
if (typeof input !== "string" || !options) return input;
|
|
209
|
+
let key = input + ";";
|
|
210
|
+
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
211
|
+
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
212
|
+
if (options.split !== void 0) key += `split=${options.split};`;
|
|
213
|
+
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
214
|
+
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
215
|
+
return key;
|
|
216
|
+
};
|
|
217
|
+
var memoize = (input, options, fn) => {
|
|
218
|
+
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
219
|
+
validateKey(key);
|
|
220
|
+
const value = setValue2.cache.get(key) || fn();
|
|
221
|
+
setValue2.cache.set(key, value);
|
|
222
|
+
return value;
|
|
223
|
+
};
|
|
224
|
+
var splitString = (input, options = {}) => {
|
|
225
|
+
const sep = options.separator || ".";
|
|
226
|
+
const preserve = sep === "/" ? false : options.preservePaths;
|
|
227
|
+
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
228
|
+
return [input];
|
|
229
|
+
}
|
|
230
|
+
const parts = [];
|
|
231
|
+
let part = "";
|
|
232
|
+
const push = (part2) => {
|
|
233
|
+
let number;
|
|
234
|
+
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
235
|
+
parts.push(number);
|
|
236
|
+
} else {
|
|
237
|
+
parts.push(part2);
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
for (let i = 0; i < input.length; i++) {
|
|
241
|
+
const value = input[i];
|
|
242
|
+
if (value === "\\") {
|
|
243
|
+
part += input[++i];
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (value === sep) {
|
|
247
|
+
push(part);
|
|
248
|
+
part = "";
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
part += value;
|
|
252
|
+
}
|
|
253
|
+
if (part) {
|
|
254
|
+
push(part);
|
|
255
|
+
}
|
|
256
|
+
return parts;
|
|
257
|
+
};
|
|
258
|
+
var split = (input, options) => {
|
|
259
|
+
if (options && typeof options.split === "function") return options.split(input);
|
|
260
|
+
if (typeof input === "symbol") return [input];
|
|
261
|
+
if (Array.isArray(input)) return input;
|
|
262
|
+
return memoize(input, options, () => splitString(input, options));
|
|
263
|
+
};
|
|
264
|
+
var assignProp = (obj, prop, value, options) => {
|
|
265
|
+
validateKey(prop);
|
|
266
|
+
if (value === void 0) {
|
|
267
|
+
deleteProperty(obj, prop);
|
|
268
|
+
} else if (options && options.merge) {
|
|
269
|
+
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
270
|
+
if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
|
|
271
|
+
obj[prop] = merge(obj[prop], value);
|
|
272
|
+
} else {
|
|
273
|
+
obj[prop] = value;
|
|
274
|
+
}
|
|
275
|
+
} else {
|
|
276
|
+
obj[prop] = value;
|
|
277
|
+
}
|
|
278
|
+
return obj;
|
|
279
|
+
};
|
|
280
|
+
var setValue2 = (target, path, value, options) => {
|
|
281
|
+
if (!path || !isObject(target)) return target;
|
|
282
|
+
const keys = split(path, options);
|
|
283
|
+
let obj = target;
|
|
284
|
+
for (let i = 0; i < keys.length; i++) {
|
|
285
|
+
const key = keys[i];
|
|
286
|
+
const next = keys[i + 1];
|
|
287
|
+
validateKey(key);
|
|
288
|
+
if (next === void 0) {
|
|
289
|
+
assignProp(obj, key, value, options);
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
293
|
+
obj = obj[key] = [];
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (!isObject(obj[key])) {
|
|
297
|
+
obj[key] = {};
|
|
298
|
+
}
|
|
299
|
+
obj = obj[key];
|
|
300
|
+
}
|
|
301
|
+
return target;
|
|
302
|
+
};
|
|
303
|
+
setValue2.split = split;
|
|
304
|
+
setValue2.cache = /* @__PURE__ */ new Map();
|
|
305
|
+
setValue2.clear = () => {
|
|
306
|
+
setValue2.cache = /* @__PURE__ */ new Map();
|
|
307
|
+
};
|
|
308
|
+
module2.exports = setValue2;
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// src/index.ts
|
|
313
|
+
var src_exports = {};
|
|
314
|
+
__export(src_exports, {
|
|
315
|
+
defu: () => defu,
|
|
316
|
+
defuOverrideArray: () => defuOverrideArray,
|
|
317
|
+
getValue: () => import_get_value.default,
|
|
318
|
+
groupBy: () => groupBy,
|
|
319
|
+
isMap: () => isMap,
|
|
320
|
+
isRegexp: () => isRegexp,
|
|
321
|
+
noop: () => noop,
|
|
322
|
+
regExpTest: () => regExpTest,
|
|
323
|
+
removeExt: () => removeExt,
|
|
324
|
+
setValue: () => import_set_value.default
|
|
325
|
+
});
|
|
326
|
+
module.exports = __toCommonJS(src_exports);
|
|
327
|
+
init_cjs_shims();
|
|
328
|
+
|
|
329
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
330
|
+
init_cjs_shims();
|
|
331
|
+
function isPlainObject(value) {
|
|
332
|
+
if (value === null || typeof value !== "object") {
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
const prototype = Object.getPrototypeOf(value);
|
|
336
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
if (Symbol.iterator in value) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
if (Symbol.toStringTag in value) {
|
|
343
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
344
|
+
}
|
|
345
|
+
return true;
|
|
346
|
+
}
|
|
347
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
348
|
+
if (!isPlainObject(defaults)) {
|
|
349
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
350
|
+
}
|
|
351
|
+
const object = Object.assign({}, defaults);
|
|
352
|
+
for (const key in baseObject) {
|
|
353
|
+
if (key === "__proto__" || key === "constructor") {
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
const value = baseObject[key];
|
|
357
|
+
if (value === null || value === void 0) {
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
364
|
+
object[key] = [...value, ...object[key]];
|
|
365
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
366
|
+
object[key] = _defu(
|
|
367
|
+
value,
|
|
368
|
+
object[key],
|
|
369
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
370
|
+
merger
|
|
371
|
+
);
|
|
372
|
+
} else {
|
|
373
|
+
object[key] = value;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return object;
|
|
377
|
+
}
|
|
378
|
+
function createDefu(merger) {
|
|
379
|
+
return (...arguments_) => (
|
|
380
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
381
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
382
|
+
);
|
|
383
|
+
}
|
|
384
|
+
var defu = createDefu();
|
|
385
|
+
var defuFn = createDefu((object, key, currentValue) => {
|
|
386
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
387
|
+
object[key] = currentValue(object[key]);
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
392
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
393
|
+
object[key] = currentValue(object[key]);
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
// src/index.ts
|
|
399
|
+
var import_get_value = __toESM(require_get_value());
|
|
400
|
+
var import_set_value = __toESM(require_set_value());
|
|
401
|
+
function isRegexp(value) {
|
|
402
|
+
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
403
|
+
}
|
|
404
|
+
function isMap(value) {
|
|
405
|
+
return Object.prototype.toString.call(value) === "[object Map]";
|
|
406
|
+
}
|
|
407
|
+
function regExpTest(arr, str) {
|
|
408
|
+
if (!Array.isArray(arr)) {
|
|
409
|
+
throw new TypeError("paramater 'arr' should be an Array of Regexp | String");
|
|
410
|
+
}
|
|
411
|
+
for (const item of arr) {
|
|
412
|
+
if (typeof item === "string") {
|
|
413
|
+
if (str.includes(item)) {
|
|
414
|
+
return true;
|
|
415
|
+
}
|
|
416
|
+
} else if (isRegexp(item)) {
|
|
417
|
+
item.lastIndex = 0;
|
|
418
|
+
if (item.test(str)) {
|
|
419
|
+
return true;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return false;
|
|
424
|
+
}
|
|
425
|
+
function noop() {
|
|
426
|
+
}
|
|
427
|
+
function groupBy(arr, cb) {
|
|
428
|
+
if (!Array.isArray(arr)) {
|
|
429
|
+
throw new TypeError("expected an array for first argument");
|
|
430
|
+
}
|
|
431
|
+
if (typeof cb !== "function") {
|
|
432
|
+
throw new TypeError("expected a function for second argument");
|
|
433
|
+
}
|
|
434
|
+
const result = {};
|
|
435
|
+
for (const item of arr) {
|
|
436
|
+
const bucketCategory = cb(item);
|
|
437
|
+
const bucket = result[bucketCategory];
|
|
438
|
+
if (Array.isArray(bucket)) {
|
|
439
|
+
result[bucketCategory].push(item);
|
|
440
|
+
} else {
|
|
441
|
+
result[bucketCategory] = [item];
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
return result;
|
|
445
|
+
}
|
|
446
|
+
function removeExt(file) {
|
|
447
|
+
if (!file) {
|
|
448
|
+
return file;
|
|
449
|
+
}
|
|
450
|
+
return file.replace(/\.[^./]*$/, "");
|
|
451
|
+
}
|
|
452
|
+
var defuOverrideArray = createDefu((obj, key, value) => {
|
|
453
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
454
|
+
obj[key] = value;
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
459
|
+
0 && (module.exports = {
|
|
460
|
+
defu,
|
|
461
|
+
defuOverrideArray,
|
|
462
|
+
getValue,
|
|
463
|
+
groupBy,
|
|
464
|
+
isMap,
|
|
465
|
+
isRegexp,
|
|
466
|
+
noop,
|
|
467
|
+
regExpTest,
|
|
468
|
+
removeExt,
|
|
469
|
+
setValue
|
|
470
|
+
});
|
|
471
|
+
/*! Bundled license information:
|
|
472
|
+
|
|
473
|
+
isobject/index.js:
|
|
474
|
+
(*!
|
|
475
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
476
|
+
*
|
|
477
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
478
|
+
* Released under the MIT License.
|
|
479
|
+
*)
|
|
480
|
+
|
|
481
|
+
get-value/index.js:
|
|
482
|
+
(*!
|
|
483
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
484
|
+
*
|
|
485
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
486
|
+
* Released under the MIT License.
|
|
487
|
+
*)
|
|
488
|
+
|
|
489
|
+
is-primitive/index.js:
|
|
490
|
+
(*!
|
|
491
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
492
|
+
*
|
|
493
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
494
|
+
* Released under the MIT License.
|
|
495
|
+
*)
|
|
496
|
+
|
|
497
|
+
is-plain-object/index.js:
|
|
498
|
+
(*!
|
|
499
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
500
|
+
*
|
|
501
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
502
|
+
* Released under the MIT License.
|
|
503
|
+
*)
|
|
504
|
+
|
|
505
|
+
set-value/index.js:
|
|
506
|
+
(*!
|
|
507
|
+
* set-value <https://github.com/jonschlinkert/set-value>
|
|
508
|
+
*
|
|
509
|
+
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
510
|
+
* Released under the MIT License.
|
|
511
|
+
*)
|
|
512
|
+
*/
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
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.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js
|
|
31
|
+
var init_esm_shims = __esm({
|
|
32
|
+
"../../node_modules/.pnpm/tsup@8.3.5_jiti@2.4.2_postcss@8.4.49_tsx@4.19.2_typescript@5.7.2_yaml@2.7.0/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
|
+
"use strict";
|
|
34
|
+
}
|
|
35
|
+
});
|
|
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 isObject(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 isObject = require_isobject();
|
|
54
|
+
module.exports = function(target, path, options) {
|
|
55
|
+
if (!isObject(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 isObject(val) || Array.isArray(val) || typeof val === "function";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
|
|
139
|
+
var require_is_primitive = __commonJS({
|
|
140
|
+
"../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
|
|
141
|
+
"use strict";
|
|
142
|
+
init_esm_shims();
|
|
143
|
+
module.exports = function isPrimitive(val) {
|
|
144
|
+
if (typeof val === "object") {
|
|
145
|
+
return val === null;
|
|
146
|
+
}
|
|
147
|
+
return typeof val !== "function";
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
|
|
153
|
+
var require_is_plain_object = __commonJS({
|
|
154
|
+
"../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
|
|
155
|
+
"use strict";
|
|
156
|
+
init_esm_shims();
|
|
157
|
+
var isObject = require_isobject();
|
|
158
|
+
function isObjectObject(o) {
|
|
159
|
+
return isObject(o) === true && Object.prototype.toString.call(o) === "[object Object]";
|
|
160
|
+
}
|
|
161
|
+
module.exports = function isPlainObject2(o) {
|
|
162
|
+
var ctor, prot;
|
|
163
|
+
if (isObjectObject(o) === false) return false;
|
|
164
|
+
ctor = o.constructor;
|
|
165
|
+
if (typeof ctor !== "function") return false;
|
|
166
|
+
prot = ctor.prototype;
|
|
167
|
+
if (isObjectObject(prot) === false) return false;
|
|
168
|
+
if (prot.hasOwnProperty("isPrototypeOf") === false) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
|
|
177
|
+
var require_set_value = __commonJS({
|
|
178
|
+
"../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports, module) {
|
|
179
|
+
"use strict";
|
|
180
|
+
init_esm_shims();
|
|
181
|
+
var { deleteProperty } = Reflect;
|
|
182
|
+
var isPrimitive = require_is_primitive();
|
|
183
|
+
var isPlainObject2 = require_is_plain_object();
|
|
184
|
+
var isObject = (value) => {
|
|
185
|
+
return typeof value === "object" && value !== null || typeof value === "function";
|
|
186
|
+
};
|
|
187
|
+
var isUnsafeKey = (key) => {
|
|
188
|
+
return key === "__proto__" || key === "constructor" || key === "prototype";
|
|
189
|
+
};
|
|
190
|
+
var validateKey = (key) => {
|
|
191
|
+
if (!isPrimitive(key)) {
|
|
192
|
+
throw new TypeError("Object keys must be strings or symbols");
|
|
193
|
+
}
|
|
194
|
+
if (isUnsafeKey(key)) {
|
|
195
|
+
throw new Error(`Cannot set unsafe key: "${key}"`);
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var toStringKey = (input) => {
|
|
199
|
+
return Array.isArray(input) ? input.flat().map(String).join(",") : input;
|
|
200
|
+
};
|
|
201
|
+
var createMemoKey = (input, options) => {
|
|
202
|
+
if (typeof input !== "string" || !options) return input;
|
|
203
|
+
let key = input + ";";
|
|
204
|
+
if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
|
|
205
|
+
if (options.separator !== void 0) key += `separator=${options.separator};`;
|
|
206
|
+
if (options.split !== void 0) key += `split=${options.split};`;
|
|
207
|
+
if (options.merge !== void 0) key += `merge=${options.merge};`;
|
|
208
|
+
if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
|
|
209
|
+
return key;
|
|
210
|
+
};
|
|
211
|
+
var memoize = (input, options, fn) => {
|
|
212
|
+
const key = toStringKey(options ? createMemoKey(input, options) : input);
|
|
213
|
+
validateKey(key);
|
|
214
|
+
const value = setValue2.cache.get(key) || fn();
|
|
215
|
+
setValue2.cache.set(key, value);
|
|
216
|
+
return value;
|
|
217
|
+
};
|
|
218
|
+
var splitString = (input, options = {}) => {
|
|
219
|
+
const sep = options.separator || ".";
|
|
220
|
+
const preserve = sep === "/" ? false : options.preservePaths;
|
|
221
|
+
if (typeof input === "string" && preserve !== false && /\//.test(input)) {
|
|
222
|
+
return [input];
|
|
223
|
+
}
|
|
224
|
+
const parts = [];
|
|
225
|
+
let part = "";
|
|
226
|
+
const push = (part2) => {
|
|
227
|
+
let number;
|
|
228
|
+
if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
|
|
229
|
+
parts.push(number);
|
|
230
|
+
} else {
|
|
231
|
+
parts.push(part2);
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
for (let i = 0; i < input.length; i++) {
|
|
235
|
+
const value = input[i];
|
|
236
|
+
if (value === "\\") {
|
|
237
|
+
part += input[++i];
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
if (value === sep) {
|
|
241
|
+
push(part);
|
|
242
|
+
part = "";
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
part += value;
|
|
246
|
+
}
|
|
247
|
+
if (part) {
|
|
248
|
+
push(part);
|
|
249
|
+
}
|
|
250
|
+
return parts;
|
|
251
|
+
};
|
|
252
|
+
var split = (input, options) => {
|
|
253
|
+
if (options && typeof options.split === "function") return options.split(input);
|
|
254
|
+
if (typeof input === "symbol") return [input];
|
|
255
|
+
if (Array.isArray(input)) return input;
|
|
256
|
+
return memoize(input, options, () => splitString(input, options));
|
|
257
|
+
};
|
|
258
|
+
var assignProp = (obj, prop, value, options) => {
|
|
259
|
+
validateKey(prop);
|
|
260
|
+
if (value === void 0) {
|
|
261
|
+
deleteProperty(obj, prop);
|
|
262
|
+
} else if (options && options.merge) {
|
|
263
|
+
const merge = options.merge === "function" ? options.merge : Object.assign;
|
|
264
|
+
if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
|
|
265
|
+
obj[prop] = merge(obj[prop], value);
|
|
266
|
+
} else {
|
|
267
|
+
obj[prop] = value;
|
|
268
|
+
}
|
|
269
|
+
} else {
|
|
270
|
+
obj[prop] = value;
|
|
271
|
+
}
|
|
272
|
+
return obj;
|
|
273
|
+
};
|
|
274
|
+
var setValue2 = (target, path, value, options) => {
|
|
275
|
+
if (!path || !isObject(target)) return target;
|
|
276
|
+
const keys = split(path, options);
|
|
277
|
+
let obj = target;
|
|
278
|
+
for (let i = 0; i < keys.length; i++) {
|
|
279
|
+
const key = keys[i];
|
|
280
|
+
const next = keys[i + 1];
|
|
281
|
+
validateKey(key);
|
|
282
|
+
if (next === void 0) {
|
|
283
|
+
assignProp(obj, key, value, options);
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
286
|
+
if (typeof next === "number" && !Array.isArray(obj[key])) {
|
|
287
|
+
obj = obj[key] = [];
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (!isObject(obj[key])) {
|
|
291
|
+
obj[key] = {};
|
|
292
|
+
}
|
|
293
|
+
obj = obj[key];
|
|
294
|
+
}
|
|
295
|
+
return target;
|
|
296
|
+
};
|
|
297
|
+
setValue2.split = split;
|
|
298
|
+
setValue2.cache = /* @__PURE__ */ new Map();
|
|
299
|
+
setValue2.clear = () => {
|
|
300
|
+
setValue2.cache = /* @__PURE__ */ new Map();
|
|
301
|
+
};
|
|
302
|
+
module.exports = setValue2;
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// src/index.ts
|
|
307
|
+
init_esm_shims();
|
|
308
|
+
|
|
309
|
+
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
310
|
+
init_esm_shims();
|
|
311
|
+
function isPlainObject(value) {
|
|
312
|
+
if (value === null || typeof value !== "object") {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
const prototype = Object.getPrototypeOf(value);
|
|
316
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
if (Symbol.iterator in value) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
if (Symbol.toStringTag in value) {
|
|
323
|
+
return Object.prototype.toString.call(value) === "[object Module]";
|
|
324
|
+
}
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
328
|
+
if (!isPlainObject(defaults)) {
|
|
329
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
330
|
+
}
|
|
331
|
+
const object = Object.assign({}, defaults);
|
|
332
|
+
for (const key in baseObject) {
|
|
333
|
+
if (key === "__proto__" || key === "constructor") {
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
const value = baseObject[key];
|
|
337
|
+
if (value === null || value === void 0) {
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
344
|
+
object[key] = [...value, ...object[key]];
|
|
345
|
+
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
346
|
+
object[key] = _defu(
|
|
347
|
+
value,
|
|
348
|
+
object[key],
|
|
349
|
+
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
350
|
+
merger
|
|
351
|
+
);
|
|
352
|
+
} else {
|
|
353
|
+
object[key] = value;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return object;
|
|
357
|
+
}
|
|
358
|
+
function createDefu(merger) {
|
|
359
|
+
return (...arguments_) => (
|
|
360
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
361
|
+
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
var defu = createDefu();
|
|
365
|
+
var defuFn = createDefu((object, key, currentValue) => {
|
|
366
|
+
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
367
|
+
object[key] = currentValue(object[key]);
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
372
|
+
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
373
|
+
object[key] = currentValue(object[key]);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
// src/index.ts
|
|
379
|
+
var import_get_value = __toESM(require_get_value());
|
|
380
|
+
var import_set_value = __toESM(require_set_value());
|
|
381
|
+
function isRegexp(value) {
|
|
382
|
+
return Object.prototype.toString.call(value) === "[object RegExp]";
|
|
383
|
+
}
|
|
384
|
+
function isMap(value) {
|
|
385
|
+
return Object.prototype.toString.call(value) === "[object Map]";
|
|
386
|
+
}
|
|
387
|
+
function regExpTest(arr, str) {
|
|
388
|
+
if (!Array.isArray(arr)) {
|
|
389
|
+
throw new TypeError("paramater 'arr' should be an Array of Regexp | String");
|
|
390
|
+
}
|
|
391
|
+
for (const item of arr) {
|
|
392
|
+
if (typeof item === "string") {
|
|
393
|
+
if (str.includes(item)) {
|
|
394
|
+
return true;
|
|
395
|
+
}
|
|
396
|
+
} else if (isRegexp(item)) {
|
|
397
|
+
item.lastIndex = 0;
|
|
398
|
+
if (item.test(str)) {
|
|
399
|
+
return true;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
function noop() {
|
|
406
|
+
}
|
|
407
|
+
function groupBy(arr, cb) {
|
|
408
|
+
if (!Array.isArray(arr)) {
|
|
409
|
+
throw new TypeError("expected an array for first argument");
|
|
410
|
+
}
|
|
411
|
+
if (typeof cb !== "function") {
|
|
412
|
+
throw new TypeError("expected a function for second argument");
|
|
413
|
+
}
|
|
414
|
+
const result = {};
|
|
415
|
+
for (const item of arr) {
|
|
416
|
+
const bucketCategory = cb(item);
|
|
417
|
+
const bucket = result[bucketCategory];
|
|
418
|
+
if (Array.isArray(bucket)) {
|
|
419
|
+
result[bucketCategory].push(item);
|
|
420
|
+
} else {
|
|
421
|
+
result[bucketCategory] = [item];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
function removeExt(file) {
|
|
427
|
+
if (!file) {
|
|
428
|
+
return file;
|
|
429
|
+
}
|
|
430
|
+
return file.replace(/\.[^./]*$/, "");
|
|
431
|
+
}
|
|
432
|
+
var defuOverrideArray = createDefu((obj, key, value) => {
|
|
433
|
+
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
434
|
+
obj[key] = value;
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
var export_getValue = import_get_value.default;
|
|
439
|
+
var export_setValue = import_set_value.default;
|
|
440
|
+
export {
|
|
441
|
+
defu,
|
|
442
|
+
defuOverrideArray,
|
|
443
|
+
export_getValue as getValue,
|
|
444
|
+
groupBy,
|
|
445
|
+
isMap,
|
|
446
|
+
isRegexp,
|
|
447
|
+
noop,
|
|
448
|
+
regExpTest,
|
|
449
|
+
removeExt,
|
|
450
|
+
export_setValue as setValue
|
|
451
|
+
};
|
|
452
|
+
/*! Bundled license information:
|
|
453
|
+
|
|
454
|
+
isobject/index.js:
|
|
455
|
+
(*!
|
|
456
|
+
* isobject <https://github.com/jonschlinkert/isobject>
|
|
457
|
+
*
|
|
458
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
459
|
+
* Released under the MIT License.
|
|
460
|
+
*)
|
|
461
|
+
|
|
462
|
+
get-value/index.js:
|
|
463
|
+
(*!
|
|
464
|
+
* get-value <https://github.com/jonschlinkert/get-value>
|
|
465
|
+
*
|
|
466
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
467
|
+
* Released under the MIT License.
|
|
468
|
+
*)
|
|
469
|
+
|
|
470
|
+
is-primitive/index.js:
|
|
471
|
+
(*!
|
|
472
|
+
* is-primitive <https://github.com/jonschlinkert/is-primitive>
|
|
473
|
+
*
|
|
474
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
475
|
+
* Released under the MIT License.
|
|
476
|
+
*)
|
|
477
|
+
|
|
478
|
+
is-plain-object/index.js:
|
|
479
|
+
(*!
|
|
480
|
+
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
481
|
+
*
|
|
482
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
483
|
+
* Released under the MIT License.
|
|
484
|
+
*)
|
|
485
|
+
|
|
486
|
+
set-value/index.js:
|
|
487
|
+
(*!
|
|
488
|
+
* set-value <https://github.com/jonschlinkert/set-value>
|
|
489
|
+
*
|
|
490
|
+
* Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
|
|
491
|
+
* Released under the MIT License.
|
|
492
|
+
*)
|
|
493
|
+
*/
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@weapp-tailwindcss/shared",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"description": "@weapp-tailwindcss/shared",
|
|
5
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/sonofmagic/monorepo-template.git",
|
|
10
|
+
"directory": "packages/bar"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/sonofmagic/monorepo-template/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.mjs",
|
|
21
|
+
"require": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"dev": "tsup --watch --sourcemap",
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"test": "vitest run",
|
|
32
|
+
"test:dev": "vitest",
|
|
33
|
+
"release": "pnpm publish",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix"
|
|
36
|
+
},
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"module": "./dist/index.mjs",
|
|
39
|
+
"types": "./dist/index.d.ts"
|
|
40
|
+
}
|