@weapp-tailwindcss/shared 1.1.3 → 2.0.0-next.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/dist/index.js CHANGED
@@ -1,500 +1,98 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
-
3
-
4
-
5
- var _chunk5F5YENBWjs = require('./chunk-5F5YENBW.js');
6
-
7
- // ../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js
8
- var require_is_primitive = _chunk5F5YENBWjs.__commonJS.call(void 0, {
9
- "../../node_modules/.pnpm/is-primitive@3.0.1/node_modules/is-primitive/index.js"(exports, module) {
10
- "use strict";
11
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
12
- module.exports = function isPrimitive(val) {
13
- if (typeof val === "object") {
14
- return val === null;
15
- }
16
- return typeof val !== "function";
17
- };
18
- }
19
- });
20
-
21
- // ../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js
22
- var require_isobject = _chunk5F5YENBWjs.__commonJS.call(void 0, {
23
- "../../node_modules/.pnpm/isobject@3.0.1/node_modules/isobject/index.js"(exports, module) {
24
- "use strict";
25
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
26
- module.exports = function isObject2(val) {
27
- return val != null && typeof val === "object" && Array.isArray(val) === false;
28
- };
29
- }
30
- });
31
-
32
- // ../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js
33
- var require_is_plain_object = _chunk5F5YENBWjs.__commonJS.call(void 0, {
34
- "../../node_modules/.pnpm/is-plain-object@2.0.4/node_modules/is-plain-object/index.js"(exports, module) {
35
- "use strict";
36
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
37
- var isObject2 = require_isobject();
38
- function isObjectObject(o) {
39
- return isObject2(o) === true && Object.prototype.toString.call(o) === "[object Object]";
40
- }
41
- module.exports = function isPlainObject2(o) {
42
- var ctor, prot;
43
- if (isObjectObject(o) === false) return false;
44
- ctor = o.constructor;
45
- if (typeof ctor !== "function") return false;
46
- prot = ctor.prototype;
47
- if (isObjectObject(prot) === false) return false;
48
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
49
- return false;
50
- }
51
- return true;
52
- };
53
- }
54
- });
55
-
56
- // ../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js
57
- var require_set_value = _chunk5F5YENBWjs.__commonJS.call(void 0, {
58
- "../../node_modules/.pnpm/set-value@4.1.0/node_modules/set-value/index.js"(exports, module) {
59
- "use strict";
60
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
61
- var { deleteProperty } = Reflect;
62
- var isPrimitive = require_is_primitive();
63
- var isPlainObject2 = require_is_plain_object();
64
- var isObject2 = (value) => {
65
- return typeof value === "object" && value !== null || typeof value === "function";
66
- };
67
- var isUnsafeKey = (key) => {
68
- return key === "__proto__" || key === "constructor" || key === "prototype";
69
- };
70
- var validateKey = (key) => {
71
- if (!isPrimitive(key)) {
72
- throw new TypeError("Object keys must be strings or symbols");
73
- }
74
- if (isUnsafeKey(key)) {
75
- throw new Error(`Cannot set unsafe key: "${key}"`);
76
- }
77
- };
78
- var toStringKey = (input) => {
79
- return Array.isArray(input) ? input.flat().map(String).join(",") : input;
80
- };
81
- var createMemoKey = (input, options) => {
82
- if (typeof input !== "string" || !options) return input;
83
- let key = input + ";";
84
- if (options.arrays !== void 0) key += `arrays=${options.arrays};`;
85
- if (options.separator !== void 0) key += `separator=${options.separator};`;
86
- if (options.split !== void 0) key += `split=${options.split};`;
87
- if (options.merge !== void 0) key += `merge=${options.merge};`;
88
- if (options.preservePaths !== void 0) key += `preservePaths=${options.preservePaths};`;
89
- return key;
90
- };
91
- var memoize = (input, options, fn) => {
92
- const key = toStringKey(options ? createMemoKey(input, options) : input);
93
- validateKey(key);
94
- const value = setValue2.cache.get(key) || fn();
95
- setValue2.cache.set(key, value);
96
- return value;
97
- };
98
- var splitString = (input, options = {}) => {
99
- const sep = options.separator || ".";
100
- const preserve = sep === "/" ? false : options.preservePaths;
101
- if (typeof input === "string" && preserve !== false && /\//.test(input)) {
102
- return [input];
103
- }
104
- const parts = [];
105
- let part = "";
106
- const push = (part2) => {
107
- let number;
108
- if (part2.trim() !== "" && Number.isInteger(number = Number(part2))) {
109
- parts.push(number);
110
- } else {
111
- parts.push(part2);
112
- }
113
- };
114
- for (let i = 0; i < input.length; i++) {
115
- const value = input[i];
116
- if (value === "\\") {
117
- part += input[++i];
118
- continue;
119
- }
120
- if (value === sep) {
121
- push(part);
122
- part = "";
123
- continue;
124
- }
125
- part += value;
126
- }
127
- if (part) {
128
- push(part);
129
- }
130
- return parts;
131
- };
132
- var split2 = (input, options) => {
133
- if (options && typeof options.split === "function") return options.split(input);
134
- if (typeof input === "symbol") return [input];
135
- if (Array.isArray(input)) return input;
136
- return memoize(input, options, () => splitString(input, options));
137
- };
138
- var assignProp = (obj, prop, value, options) => {
139
- validateKey(prop);
140
- if (value === void 0) {
141
- deleteProperty(obj, prop);
142
- } else if (options && options.merge) {
143
- const merge = options.merge === "function" ? options.merge : Object.assign;
144
- if (merge && isPlainObject2(obj[prop]) && isPlainObject2(value)) {
145
- obj[prop] = merge(obj[prop], value);
146
- } else {
147
- obj[prop] = value;
148
- }
149
- } else {
150
- obj[prop] = value;
151
- }
152
- return obj;
153
- };
154
- var setValue2 = (target, path, value, options) => {
155
- if (!path || !isObject2(target)) return target;
156
- const keys = split2(path, options);
157
- let obj = target;
158
- for (let i = 0; i < keys.length; i++) {
159
- const key = keys[i];
160
- const next = keys[i + 1];
161
- validateKey(key);
162
- if (next === void 0) {
163
- assignProp(obj, key, value, options);
164
- break;
165
- }
166
- if (typeof next === "number" && !Array.isArray(obj[key])) {
167
- obj = obj[key] = [];
168
- continue;
169
- }
170
- if (!isObject2(obj[key])) {
171
- obj[key] = {};
172
- }
173
- obj = obj[key];
174
- }
175
- return target;
176
- };
177
- setValue2.split = split2;
178
- setValue2.cache = /* @__PURE__ */ new Map();
179
- setValue2.clear = () => {
180
- setValue2.cache = /* @__PURE__ */ new Map();
181
- };
182
- module.exports = setValue2;
183
- }
184
- });
185
-
186
- // src/index.ts
187
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
188
-
189
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
190
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
191
- function isPlainObject(value) {
192
- if (value === null || typeof value !== "object") {
193
- return false;
194
- }
195
- const prototype = Object.getPrototypeOf(value);
196
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
197
- return false;
198
- }
199
- if (Symbol.iterator in value) {
200
- return false;
201
- }
202
- if (Symbol.toStringTag in value) {
203
- return Object.prototype.toString.call(value) === "[object Module]";
204
- }
205
- return true;
206
- }
207
- function _defu(baseObject, defaults, namespace = ".", merger) {
208
- if (!isPlainObject(defaults)) {
209
- return _defu(baseObject, {}, namespace, merger);
210
- }
211
- const object = Object.assign({}, defaults);
212
- for (const key in baseObject) {
213
- if (key === "__proto__" || key === "constructor") {
214
- continue;
215
- }
216
- const value = baseObject[key];
217
- if (value === null || value === void 0) {
218
- continue;
219
- }
220
- if (merger && merger(object, key, value, namespace)) {
221
- continue;
222
- }
223
- if (Array.isArray(value) && Array.isArray(object[key])) {
224
- object[key] = [...value, ...object[key]];
225
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
226
- object[key] = _defu(
227
- value,
228
- object[key],
229
- (namespace ? `${namespace}.` : "") + key.toString(),
230
- merger
231
- );
232
- } else {
233
- object[key] = value;
234
- }
235
- }
236
- return object;
237
- }
238
- function createDefu(merger) {
239
- return (...arguments_) => (
240
- // eslint-disable-next-line unicorn/no-array-reduce
241
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
242
- );
243
- }
244
- var defu = createDefu();
245
- var defuFn = createDefu((object, key, currentValue) => {
246
- if (object[key] !== void 0 && typeof currentValue === "function") {
247
- object[key] = currentValue(object[key]);
248
- return true;
249
- }
250
- });
251
- var defuArrayFn = createDefu((object, key, currentValue) => {
252
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
253
- object[key] = currentValue(object[key]);
254
- return true;
255
- }
256
- });
257
-
258
- // ../../node_modules/.pnpm/get-value@4.0.1/node_modules/get-value/dist/index.mjs
259
- _chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
260
- var __defProp = Object.defineProperty;
261
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
262
- var isObject = /* @__PURE__ */ __name((v) => v !== null && typeof v === "object", "isObject");
263
- var join = /* @__PURE__ */ __name((segs, joinChar, options) => {
264
- if (typeof options.join === "function") {
265
- return options.join(segs);
266
- }
267
- return segs[0] + joinChar + segs[1];
268
- }, "join");
269
- var split = /* @__PURE__ */ __name((path, splitChar, options) => {
270
- if (typeof options.split === "function") {
271
- return options.split(path);
272
- }
273
- return path.split(splitChar);
274
- }, "split");
275
- var isValid = /* @__PURE__ */ __name((key, target = {}, options) => {
276
- if (typeof _optionalChain([options, 'optionalAccess', _ => _.isValid]) === "function") {
277
- return options.isValid(key, target);
278
- }
279
- return true;
280
- }, "isValid");
281
- var isValidObject = /* @__PURE__ */ __name((v) => {
282
- return isObject(v) || typeof v === "function";
283
- }, "isValidObject");
284
- var getValue = /* @__PURE__ */ __name((target, path, options = {}) => {
285
- if (!isObject(options)) {
286
- options = { default: options };
287
- }
288
- if (!isValidObject(target)) {
289
- return typeof options.default !== "undefined" ? options.default : target;
290
- }
291
- if (typeof path === "number") {
292
- path = String(path);
293
- }
294
- const pathIsArray = Array.isArray(path);
295
- const pathIsString = typeof path === "string";
296
- const splitChar = options.separator || ".";
297
- const joinChar = options.joinChar || (typeof splitChar === "string" ? splitChar : ".");
298
- if (!pathIsString && !pathIsArray) {
299
- return target;
300
- }
301
- if (target[path] !== void 0) {
302
- return isValid(path, target, options) ? target[path] : options.default;
303
- }
304
- const segs = pathIsArray ? path : split(path, splitChar, options);
305
- const len = segs.length;
306
- let idx = 0;
307
- do {
308
- let prop = segs[idx];
309
- if (typeof prop !== "string") {
310
- prop = String(prop);
311
- }
312
- while (prop && prop.slice(-1) === "\\") {
313
- prop = join([prop.slice(0, -1), segs[++idx] || ""], joinChar, options);
314
- }
315
- if (target[prop] !== void 0) {
316
- if (!isValid(prop, target, options)) {
317
- return options.default;
318
- }
319
- target = target[prop];
320
- } else {
321
- let hasProp = false;
322
- let n = idx + 1;
323
- while (n < len) {
324
- prop = join([prop, segs[n++]], joinChar, options);
325
- if (hasProp = target[prop] !== void 0) {
326
- if (!isValid(prop, target, options)) {
327
- return options.default;
328
- }
329
- target = target[prop];
330
- idx = n - 1;
331
- break;
332
- }
333
- }
334
- if (!hasProp) {
335
- return options.default;
336
- }
337
- }
338
- } while (++idx < len && isValidObject(target));
339
- if (idx === len) {
340
- return target;
341
- }
342
- return options.default;
343
- }, "getValue");
344
- var index_default = getValue;
345
-
346
- // src/index.ts
347
- var import_set_value = _chunk5F5YENBWjs.__toESM.call(void 0, require_set_value());
348
- var HTTP_PATTERN = /^https?:\/\//i;
349
- var CLEAN_URL_REGEXP = /[?#].*$/;
350
- var BACKSLASH_RE = /\\/g;
351
- var LEADING_DOTS_SLASHES_RE = /^[./\\]+/;
352
- var MULTI_BACKSLASH_RE = /\\+/g;
353
- var REMOVE_EXT_RE = /\.[^./]*$/;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_chunk = require("./chunk-8l464Juk.js");
3
+ let defu = require("defu");
4
+ let get_value = require("get-value");
5
+ get_value = require_chunk.__toESM(get_value);
6
+ let set_value = require("set-value");
7
+ set_value = require_chunk.__toESM(set_value);
8
+ //#region src/index.ts
9
+ const HTTP_PATTERN = /^https?:\/\//i;
10
+ const CLEAN_URL_REGEXP = /[?#].*$/;
11
+ const BACKSLASH_RE = /\\/g;
12
+ const LEADING_DOTS_SLASHES_RE = /^[./\\]+/;
13
+ const MULTI_BACKSLASH_RE = /\\+/g;
14
+ const REMOVE_EXT_RE = /\.[^./]*$/;
354
15
  function isRegexp(value) {
355
- return value instanceof RegExp;
16
+ return value instanceof RegExp;
356
17
  }
357
18
  function isMap(value) {
358
- return value instanceof Map;
19
+ return value instanceof Map;
359
20
  }
360
21
  function isHttp(target) {
361
- return HTTP_PATTERN.test(target);
22
+ return HTTP_PATTERN.test(target);
362
23
  }
363
24
  function cleanUrl(url) {
364
- return url.replace(CLEAN_URL_REGEXP, "");
25
+ return url.replace(CLEAN_URL_REGEXP, "");
365
26
  }
366
27
  function toArray(value) {
367
- if (value == null) {
368
- return [];
369
- }
370
- return Array.isArray(value) ? value : [value];
28
+ if (value == null) return [];
29
+ return Array.isArray(value) ? value : [value];
371
30
  }
372
31
  function ensurePosix(value) {
373
- return value.replace(BACKSLASH_RE, "/");
32
+ return value.replace(BACKSLASH_RE, "/");
374
33
  }
375
34
  function normalizeRoot(root) {
376
- const trimmed = root.trim().replace(LEADING_DOTS_SLASHES_RE, "").replace(MULTI_BACKSLASH_RE, "/");
377
- return trimmed.endsWith("/") ? trimmed.slice(0, -1) : trimmed;
35
+ const trimmed = root.trim().replace(LEADING_DOTS_SLASHES_RE, "").replace(MULTI_BACKSLASH_RE, "/");
36
+ return trimmed.endsWith("/") ? trimmed.slice(0, -1) : trimmed;
378
37
  }
379
38
  function normalizeRelativeImport(target) {
380
- if (target.startsWith(".") || target.startsWith("/")) {
381
- return target;
382
- }
383
- return `./${target}`;
39
+ if (target.startsWith(".") || target.startsWith("/")) return target;
40
+ return `./${target}`;
384
41
  }
385
42
  function regExpTest(arr, str, options) {
386
- if (!Array.isArray(arr)) {
387
- throw new TypeError("paramater 'arr' should be an Array of Regexp | String");
388
- }
389
- for (const item of arr) {
390
- if (typeof item === "string") {
391
- if (_optionalChain([options, 'optionalAccess', _2 => _2.exact])) {
392
- if (str === item) {
393
- return true;
394
- }
395
- } else if (str.includes(item)) {
396
- return true;
397
- }
398
- } else if (isRegexp(item)) {
399
- item.lastIndex = 0;
400
- if (item.test(str)) {
401
- return true;
402
- }
403
- }
404
- }
405
- return false;
406
- }
407
- function noop() {
43
+ if (!Array.isArray(arr)) throw new TypeError("paramater 'arr' should be an Array of Regexp | String");
44
+ for (const item of arr) if (typeof item === "string") {
45
+ if (options?.exact) {
46
+ if (str === item) return true;
47
+ } else if (str.includes(item)) return true;
48
+ } else if (isRegexp(item)) {
49
+ item.lastIndex = 0;
50
+ if (item.test(str)) return true;
51
+ }
52
+ return false;
408
53
  }
54
+ function noop() {}
409
55
  function groupBy(arr, cb) {
410
- if (!Array.isArray(arr)) {
411
- throw new TypeError("expected an array for first argument");
412
- }
413
- if (typeof cb !== "function") {
414
- throw new TypeError("expected a function for second argument");
415
- }
416
- const result = /* @__PURE__ */ Object.create(null);
417
- for (const item of arr) {
418
- const bucketCategory = cb(item);
419
- const bucket = result[bucketCategory];
420
- if (Array.isArray(bucket)) {
421
- bucket.push(item);
422
- } else {
423
- result[bucketCategory] = [item];
424
- }
425
- }
426
- return result;
56
+ if (!Array.isArray(arr)) throw new TypeError("expected an array for first argument");
57
+ if (typeof cb !== "function") throw new TypeError("expected a function for second argument");
58
+ const result = Object.create(null);
59
+ for (const item of arr) {
60
+ const bucketCategory = cb(item);
61
+ const bucket = result[bucketCategory];
62
+ if (Array.isArray(bucket)) bucket.push(item);
63
+ else result[bucketCategory] = [item];
64
+ }
65
+ return result;
427
66
  }
428
67
  function removeExt(file) {
429
- if (!file) {
430
- return file;
431
- }
432
- return file.replace(REMOVE_EXT_RE, "");
68
+ if (!file) return file;
69
+ return file.replace(REMOVE_EXT_RE, "");
433
70
  }
434
- var defuOverrideArray = createDefu((obj, key, value) => {
435
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
436
- obj[key] = value;
437
- return true;
438
- }
71
+ const defuOverrideArray = (0, defu.createDefu)((obj, key, value) => {
72
+ if (Array.isArray(obj[key]) && Array.isArray(value)) {
73
+ obj[key] = value;
74
+ return true;
75
+ }
76
+ });
77
+ //#endregion
78
+ exports.cleanUrl = cleanUrl;
79
+ Object.defineProperty(exports, "defu", {
80
+ enumerable: true,
81
+ get: function() {
82
+ return defu.defu;
83
+ }
439
84
  });
440
- var export_setValue = import_set_value.default;
441
-
442
-
443
-
444
-
445
-
446
-
447
-
448
-
449
-
450
-
451
-
452
-
453
-
454
-
455
-
456
-
457
-
458
- exports.cleanUrl = cleanUrl; exports.defu = defu; exports.defuOverrideArray = defuOverrideArray; exports.ensurePosix = ensurePosix; exports.getValue = index_default; exports.groupBy = groupBy; exports.isHttp = isHttp; exports.isMap = isMap; exports.isRegexp = isRegexp; exports.noop = noop; exports.normalizeRelativeImport = normalizeRelativeImport; exports.normalizeRoot = normalizeRoot; exports.regExpTest = regExpTest; exports.removeExt = removeExt; exports.setValue = export_setValue; exports.toArray = toArray;
459
- /*! Bundled license information:
460
-
461
- is-primitive/index.js:
462
- (*!
463
- * is-primitive <https://github.com/jonschlinkert/is-primitive>
464
- *
465
- * Copyright (c) 2014-present, Jon Schlinkert.
466
- * Released under the MIT License.
467
- *)
468
-
469
- isobject/index.js:
470
- (*!
471
- * isobject <https://github.com/jonschlinkert/isobject>
472
- *
473
- * Copyright (c) 2014-2017, Jon Schlinkert.
474
- * Released under the MIT License.
475
- *)
476
-
477
- is-plain-object/index.js:
478
- (*!
479
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
480
- *
481
- * Copyright (c) 2014-2017, Jon Schlinkert.
482
- * Released under the MIT License.
483
- *)
484
-
485
- set-value/index.js:
486
- (*!
487
- * set-value <https://github.com/jonschlinkert/set-value>
488
- *
489
- * Copyright (c) Jon Schlinkert (https://github.com/jonschlinkert).
490
- * Released under the MIT License.
491
- *)
492
-
493
- get-value/dist/index.mjs:
494
- (*!
495
- * get-value <https://github.com/jonschlinkert/get-value>
496
- *
497
- * Copyright (c) 2014-present, Jon Schlinkert.
498
- * Released under the MIT License.
499
- *)
500
- */
85
+ exports.defuOverrideArray = defuOverrideArray;
86
+ exports.ensurePosix = ensurePosix;
87
+ exports.getValue = get_value.default;
88
+ exports.groupBy = groupBy;
89
+ exports.isHttp = isHttp;
90
+ exports.isMap = isMap;
91
+ exports.isRegexp = isRegexp;
92
+ exports.noop = noop;
93
+ exports.normalizeRelativeImport = normalizeRelativeImport;
94
+ exports.normalizeRoot = normalizeRoot;
95
+ exports.regExpTest = regExpTest;
96
+ exports.removeExt = removeExt;
97
+ exports.setValue = set_value.default;
98
+ exports.toArray = toArray;