weapp-tailwindcss 3.7.0 → 3.8.0-alpha.1
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/README.md +1 -23
- package/dist/chunk-2STNBSVB.js +216 -0
- package/dist/chunk-35CYTBPM.js +26 -0
- package/dist/chunk-6FNC3XMI.js +45 -0
- package/dist/chunk-6Z776ZWK.js +43 -0
- package/dist/chunk-75EWCRQW.mjs +13 -0
- package/dist/chunk-AB467PG7.mjs +43 -0
- package/dist/chunk-AXBFBHS2.mjs +45 -0
- package/dist/chunk-EODGLB63.mjs +173 -0
- package/dist/chunk-FG63RW47.mjs +7106 -0
- package/dist/chunk-HBQASQKY.js +13 -0
- package/dist/chunk-IETFIAKJ.js +152 -0
- package/dist/chunk-KE7J6XFD.mjs +537 -0
- package/dist/chunk-LQN2VTMU.js +537 -0
- package/dist/chunk-LWRZXI5T.js +1003 -0
- package/dist/chunk-MUJ65IQ3.mjs +26 -0
- package/dist/chunk-MWTUP5KG.mjs +1003 -0
- package/dist/chunk-NLFQ7XRK.mjs +152 -0
- package/dist/chunk-QEEWOML6.mjs +216 -0
- package/dist/chunk-RFNUATFD.js +24 -0
- package/dist/chunk-U7O2XXYR.mjs +24 -0
- package/dist/chunk-VKSQ6BRD.mjs +27 -0
- package/dist/chunk-XSZXPWWL.js +27 -0
- package/dist/chunk-YSEHQ3FF.js +173 -0
- package/dist/chunk-YYT4NLHK.js +7109 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +23 -3400
- package/dist/cli.mjs +28 -3392
- package/dist/core.d.mts +27 -0
- package/dist/core.d.ts +23 -4
- package/dist/core.js +34 -56
- package/dist/core.mjs +36 -54
- package/dist/css-macro/postcss.d.mts +7 -0
- package/dist/css-macro/postcss.d.ts +5 -3
- package/dist/css-macro/postcss.js +54 -45
- package/dist/css-macro/postcss.mjs +54 -45
- package/dist/css-macro.d.mts +18 -0
- package/dist/css-macro.d.ts +18 -0
- package/dist/css-macro.js +40 -0
- package/dist/css-macro.mjs +38 -0
- package/dist/defaults.d.mts +16 -0
- package/dist/defaults.d.ts +16 -2
- package/dist/defaults.js +5 -9
- package/dist/defaults.mjs +8 -4
- package/dist/escape.d.mts +19 -0
- package/dist/escape.d.ts +19 -4
- package/dist/escape.js +11 -0
- package/dist/escape.mjs +11 -0
- package/dist/gulp.d.mts +26 -0
- package/dist/gulp.d.ts +26 -1
- package/dist/gulp.js +11 -36
- package/dist/gulp.mjs +14 -31
- package/dist/index-g4epDIUu.d.mts +534 -0
- package/dist/index-g4epDIUu.d.ts +534 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -4
- package/dist/index.js +22 -44
- package/dist/index.mjs +22 -34
- package/dist/postcss.d.mts +28 -0
- package/dist/postcss.d.ts +28 -1
- package/dist/postcss.js +9 -24
- package/dist/postcss.mjs +16 -8
- package/dist/replace.d.mts +22 -0
- package/dist/replace.d.ts +22 -3
- package/dist/replace.js +33 -50
- package/dist/replace.mjs +32 -25
- package/dist/shared-5ArEo9kL.d.mts +5 -0
- package/dist/shared-DI2Qz1ou.d.ts +5 -0
- package/dist/vite.d.mts +22 -0
- package/dist/vite.d.ts +22 -1
- package/dist/vite.js +11 -34
- package/dist/vite.mjs +14 -29
- package/dist/weapp-tw-runtime-loader.d.mts +7 -0
- package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
- package/dist/weapp-tw-runtime-loader.js +12 -12
- package/dist/weapp-tw-runtime-loader.mjs +12 -8
- package/dist/webpack.d.mts +26 -0
- package/dist/webpack.d.ts +26 -1
- package/dist/webpack.js +11 -35
- package/dist/webpack.mjs +14 -30
- package/dist/webpack4.d.mts +27 -0
- package/dist/webpack4.d.ts +27 -1
- package/dist/webpack4.js +204 -192
- package/dist/webpack4.mjs +210 -189
- package/package.json +29 -19
- package/dist/babel/index.d.ts +0 -5
- package/dist/bundlers/gulp/index.d.ts +0 -7
- package/dist/bundlers/vite/index.d.ts +0 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
- package/dist/bundlers/webpack/index.d.ts +0 -1
- package/dist/cache/index.d.ts +0 -31
- package/dist/constants-CFM1J-h1.js +0 -42
- package/dist/constants-Dy2Dd3Fz.mjs +0 -36
- package/dist/constants.d.ts +0 -7
- package/dist/css-macro/constants.d.ts +0 -14
- package/dist/css-macro/index.d.ts +0 -15
- package/dist/css-macro/index.js +0 -36
- package/dist/css-macro/index.mjs +0 -30
- package/dist/debug/index.d.ts +0 -2
- package/dist/defaults-5A8JI2hW.mjs +0 -139
- package/dist/defaults-CdqzSWsR.js +0 -145
- package/dist/defu-Cdz2PomB.js +0 -60
- package/dist/defu-n46TJT6t.mjs +0 -57
- package/dist/env.d.ts +0 -2
- package/dist/extractors/split.d.ts +0 -3
- package/dist/index-BEIjgKpF.mjs +0 -11
- package/dist/index-BF8k8rHr.mjs +0 -517
- package/dist/index-BTXkyxen.js +0 -136
- package/dist/index-C0QsyqD6.mjs +0 -134
- package/dist/index-ClSBbhnm.js +0 -130
- package/dist/index-DoMb0-xW.mjs +0 -124
- package/dist/index-HC-Qkn0i.js +0 -17
- package/dist/index-h2-ZMO3S.js +0 -530
- package/dist/init.d.ts +0 -34
- package/dist/js/ast-grep.d.ts +0 -1
- package/dist/js/babel.d.ts +0 -3
- package/dist/js/handlers.d.ts +0 -11
- package/dist/js/index.d.ts +0 -7
- package/dist/logger.d.ts +0 -1
- package/dist/mangle/index.d.ts +0 -8
- package/dist/npm.d.ts +0 -22
- package/dist/options-Bv-1GQJY.js +0 -891
- package/dist/options-yXyCFCtr.mjs +0 -858
- package/dist/options.d.ts +0 -2
- package/dist/postcss/cssVars.d.ts +0 -5
- package/dist/postcss/index.d.ts +0 -4
- package/dist/postcss/mp.d.ts +0 -8
- package/dist/postcss/plugins/ctx.d.ts +0 -6
- package/dist/postcss/plugins/index.d.ts +0 -7
- package/dist/postcss/plugins/post.d.ts +0 -5
- package/dist/postcss/plugins/pre.d.ts +0 -5
- package/dist/postcss/preflight.d.ts +0 -3
- package/dist/postcss/selectorParser.d.ts +0 -6
- package/dist/postcss/shared.d.ts +0 -3
- package/dist/postcss/symbols.d.ts +0 -1
- package/dist/reg.d.ts +0 -1
- package/dist/shared-COWjpokr.mjs +0 -25
- package/dist/shared-r_GpWheO.js +0 -28
- package/dist/tailwindcss/patcher.d.ts +0 -3
- package/dist/types.d.ts +0 -165
- package/dist/utils.d.ts +0 -18
- package/dist/v5-DwFXG7m_.js +0 -181
- package/dist/v5-N5BYJ5JY.mjs +0 -174
- package/dist/wxml/Tokenizer.d.ts +0 -31
- package/dist/wxml/index.d.ts +0 -2
- package/dist/wxml/shared.d.ts +0 -2
- package/dist/wxml/utils.d.ts +0 -10
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
const queryKey = 'weapp-tw-platform';
|
|
2
|
-
function createMediaQuery(value) {
|
|
3
|
-
return `@media (${queryKey}:"${value}"){&}`;
|
|
4
|
-
}
|
|
5
|
-
function createNegativeMediaQuery(value) {
|
|
6
|
-
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
7
|
-
}
|
|
8
|
-
function normalComment(text) {
|
|
9
|
-
if (typeof text === 'string') {
|
|
10
|
-
return text.replaceAll(/(?<!\\)_/g, ' ');
|
|
11
|
-
}
|
|
12
|
-
return text;
|
|
13
|
-
}
|
|
14
|
-
function ifdef(text) {
|
|
15
|
-
return {
|
|
16
|
-
start: `#ifdef ${normalComment(text)}`,
|
|
17
|
-
end: `#endif`,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function ifndef(text) {
|
|
21
|
-
return {
|
|
22
|
-
start: `#ifndef ${normalComment(text)}`,
|
|
23
|
-
end: `#endif`,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function matchCustomPropertyFromValue(str, cb) {
|
|
27
|
-
let arr;
|
|
28
|
-
let index = 0;
|
|
29
|
-
const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, 'g');
|
|
30
|
-
while ((arr = regex.exec(str)) !== null) {
|
|
31
|
-
cb(arr, index);
|
|
32
|
-
index++;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { createNegativeMediaQuery as a, ifdef as b, createMediaQuery as c, ifndef as i, matchCustomPropertyFromValue as m };
|
package/dist/constants.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export declare const runtimeAopLoader = "weapp-tw-runtime-aop-loader";
|
|
2
|
-
export declare const postcssPlugin = "postcss-weapp-tailwindcss-rename-plugin";
|
|
3
|
-
export declare const ManglePluginHooks = "ManglePluginHooks";
|
|
4
|
-
export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
|
|
5
|
-
export declare const pluginName = "weapp-tailwindcss-webpack-plugin";
|
|
6
|
-
export declare const vitePluginName = "vite-plugin-uni-app-weapp-tailwindcss-adaptor";
|
|
7
|
-
export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "18.17.0";
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const uniAppPlatform: string[];
|
|
2
|
-
export declare const queryKey = "weapp-tw-platform";
|
|
3
|
-
export declare function createMediaQuery(value: string): string;
|
|
4
|
-
export declare function createNegativeMediaQuery(value: string): string;
|
|
5
|
-
export declare function normalComment(text: string): string;
|
|
6
|
-
export declare function ifdef(text: string): {
|
|
7
|
-
start: string;
|
|
8
|
-
end: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function ifndef(text: string): {
|
|
11
|
-
start: string;
|
|
12
|
-
end: string;
|
|
13
|
-
};
|
|
14
|
-
export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface Options {
|
|
2
|
-
variantsMap?: Record<string, string | {
|
|
3
|
-
value: string;
|
|
4
|
-
negative?: boolean;
|
|
5
|
-
}>;
|
|
6
|
-
dynamic?: boolean;
|
|
7
|
-
}
|
|
8
|
-
declare const cssMacro: {
|
|
9
|
-
(options: Options): {
|
|
10
|
-
handler: import("tailwindcss/types/config").PluginCreator;
|
|
11
|
-
config?: Partial<import("tailwindcss/types/config").Config>;
|
|
12
|
-
};
|
|
13
|
-
__isOptionsFunction: true;
|
|
14
|
-
};
|
|
15
|
-
export default cssMacro;
|
package/dist/css-macro/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var plugin = require('tailwindcss/plugin');
|
|
4
|
-
var defu = require('../defu-Cdz2PomB.js');
|
|
5
|
-
var constants = require('../constants-CFM1J-h1.js');
|
|
6
|
-
|
|
7
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
|
-
|
|
9
|
-
var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
|
|
10
|
-
|
|
11
|
-
const cssMacro = plugin__default["default"].withOptions((options) => {
|
|
12
|
-
const { dynamic: dynamicMode, variantsMap } = defu.defu(options, {
|
|
13
|
-
dynamic: true,
|
|
14
|
-
variantsMap: {},
|
|
15
|
-
});
|
|
16
|
-
return ({ matchVariant, addVariant }) => {
|
|
17
|
-
if (dynamicMode) {
|
|
18
|
-
matchVariant('ifdef', (value) => {
|
|
19
|
-
return constants.createMediaQuery(value);
|
|
20
|
-
});
|
|
21
|
-
matchVariant('ifndef', (value) => {
|
|
22
|
-
return constants.createNegativeMediaQuery(value);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
26
|
-
if (typeof obj === 'string') {
|
|
27
|
-
addVariant(name, constants.createMediaQuery(obj));
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
addVariant(name, obj.negative ? constants.createNegativeMediaQuery(obj.value) : constants.createMediaQuery(obj.value));
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
module.exports = cssMacro;
|
package/dist/css-macro/index.mjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import plugin from 'tailwindcss/plugin';
|
|
2
|
-
import { d as defu } from '../defu-n46TJT6t.mjs';
|
|
3
|
-
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants-Dy2Dd3Fz.mjs';
|
|
4
|
-
|
|
5
|
-
const cssMacro = plugin.withOptions((options) => {
|
|
6
|
-
const { dynamic: dynamicMode, variantsMap } = defu(options, {
|
|
7
|
-
dynamic: true,
|
|
8
|
-
variantsMap: {},
|
|
9
|
-
});
|
|
10
|
-
return ({ matchVariant, addVariant }) => {
|
|
11
|
-
if (dynamicMode) {
|
|
12
|
-
matchVariant('ifdef', (value) => {
|
|
13
|
-
return createMediaQuery(value);
|
|
14
|
-
});
|
|
15
|
-
matchVariant('ifndef', (value) => {
|
|
16
|
-
return createNegativeMediaQuery(value);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
for (const [name, obj] of Object.entries(variantsMap)) {
|
|
20
|
-
if (typeof obj === 'string') {
|
|
21
|
-
addVariant(name, createMediaQuery(obj));
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
export { cssMacro as default };
|
package/dist/debug/index.d.ts
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import '@ast-core/escape';
|
|
2
|
-
import { SimpleMappingChars2String } from '@weapp-core/escape';
|
|
3
|
-
import { c as createDefu } from './defu-n46TJT6t.mjs';
|
|
4
|
-
|
|
5
|
-
function isMap(value) {
|
|
6
|
-
return Object.prototype.toString.call(value) === '[object Map]';
|
|
7
|
-
}
|
|
8
|
-
function noop() { }
|
|
9
|
-
function groupBy(arr, cb) {
|
|
10
|
-
if (!Array.isArray(arr)) {
|
|
11
|
-
throw new TypeError('expected an array for first argument');
|
|
12
|
-
}
|
|
13
|
-
if (typeof cb !== 'function') {
|
|
14
|
-
throw new TypeError('expected a function for second argument');
|
|
15
|
-
}
|
|
16
|
-
const result = {};
|
|
17
|
-
for (const item of arr) {
|
|
18
|
-
const bucketCategory = cb(item);
|
|
19
|
-
const bucket = result[bucketCategory];
|
|
20
|
-
if (Array.isArray(bucket)) {
|
|
21
|
-
result[bucketCategory].push(item);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
result[bucketCategory] = [item];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
function getGroupedEntries(entries, options) {
|
|
30
|
-
const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
|
|
31
|
-
const groupedEntries = groupBy(entries, ([file]) => {
|
|
32
|
-
if (cssMatcher(file)) {
|
|
33
|
-
return 'css';
|
|
34
|
-
}
|
|
35
|
-
else if (htmlMatcher(file)) {
|
|
36
|
-
return 'html';
|
|
37
|
-
}
|
|
38
|
-
else if (jsMatcher(file) || wxsMatcher(file)) {
|
|
39
|
-
return 'js';
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return 'other';
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return groupedEntries;
|
|
46
|
-
}
|
|
47
|
-
function removeExt(file) {
|
|
48
|
-
return file.replace(/\.[^./]+$/, '');
|
|
49
|
-
}
|
|
50
|
-
const defuOverrideArray = createDefu((obj, key, value) => {
|
|
51
|
-
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
52
|
-
obj[key] = value;
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const defaultOptions = {
|
|
58
|
-
cssMatcher: file => /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/.test(file),
|
|
59
|
-
htmlMatcher: file => /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/.test(file),
|
|
60
|
-
jsMatcher: (file) => {
|
|
61
|
-
if (file.includes('node_modules')) {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
return /.+\.[cm]?js?$/.test(file);
|
|
65
|
-
},
|
|
66
|
-
mainCssChunkMatcher: (file, appType) => {
|
|
67
|
-
switch (appType) {
|
|
68
|
-
case 'uni-app': {
|
|
69
|
-
return /^common\/main/.test(file);
|
|
70
|
-
}
|
|
71
|
-
case 'uni-app-vite': {
|
|
72
|
-
return file.startsWith('app') || /^common\/main/.test(file);
|
|
73
|
-
}
|
|
74
|
-
case 'mpx': {
|
|
75
|
-
return file.startsWith('app');
|
|
76
|
-
}
|
|
77
|
-
case 'taro': {
|
|
78
|
-
return file.startsWith('app');
|
|
79
|
-
}
|
|
80
|
-
case 'remax': {
|
|
81
|
-
return file.startsWith('app');
|
|
82
|
-
}
|
|
83
|
-
case 'rax': {
|
|
84
|
-
return file.startsWith('bundle');
|
|
85
|
-
}
|
|
86
|
-
case 'native': {
|
|
87
|
-
return file.startsWith('app');
|
|
88
|
-
}
|
|
89
|
-
case 'kbone': {
|
|
90
|
-
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
91
|
-
}
|
|
92
|
-
default: {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
wxsMatcher: () => {
|
|
98
|
-
return false;
|
|
99
|
-
},
|
|
100
|
-
cssPreflight: {
|
|
101
|
-
'box-sizing': 'border-box',
|
|
102
|
-
'border-width': '0',
|
|
103
|
-
'border-style': 'solid',
|
|
104
|
-
'border-color': 'currentColor',
|
|
105
|
-
},
|
|
106
|
-
disabled: false,
|
|
107
|
-
customRuleCallback: noop,
|
|
108
|
-
onLoad: noop,
|
|
109
|
-
onStart: noop,
|
|
110
|
-
onEnd: noop,
|
|
111
|
-
onUpdate: noop,
|
|
112
|
-
customAttributes: {},
|
|
113
|
-
customReplaceDictionary: SimpleMappingChars2String,
|
|
114
|
-
appType: undefined,
|
|
115
|
-
arbitraryValues: {
|
|
116
|
-
allowDoubleQuotes: false,
|
|
117
|
-
},
|
|
118
|
-
cssChildCombinatorReplaceValue: ['view'],
|
|
119
|
-
inlineWxs: false,
|
|
120
|
-
injectAdditionalCssVarScope: false,
|
|
121
|
-
jsPreserveClass: (keyword) => {
|
|
122
|
-
if (keyword === '*') {
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
126
|
-
},
|
|
127
|
-
disabledDefaultTemplateHandler: false,
|
|
128
|
-
cssSelectorReplacement: {
|
|
129
|
-
root: 'page',
|
|
130
|
-
universal: ['view', 'text'],
|
|
131
|
-
},
|
|
132
|
-
babelParserOptions: {
|
|
133
|
-
sourceType: 'unambiguous',
|
|
134
|
-
},
|
|
135
|
-
postcssOptions: {},
|
|
136
|
-
cssRemoveHoverPseudoClass: true,
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
export { defaultOptions as a, defuOverrideArray as d, getGroupedEntries as g, isMap as i, removeExt as r };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
require('@ast-core/escape');
|
|
4
|
-
var escape = require('@weapp-core/escape');
|
|
5
|
-
var defu = require('./defu-Cdz2PomB.js');
|
|
6
|
-
|
|
7
|
-
function isMap(value) {
|
|
8
|
-
return Object.prototype.toString.call(value) === '[object Map]';
|
|
9
|
-
}
|
|
10
|
-
function noop() { }
|
|
11
|
-
function groupBy(arr, cb) {
|
|
12
|
-
if (!Array.isArray(arr)) {
|
|
13
|
-
throw new TypeError('expected an array for first argument');
|
|
14
|
-
}
|
|
15
|
-
if (typeof cb !== 'function') {
|
|
16
|
-
throw new TypeError('expected a function for second argument');
|
|
17
|
-
}
|
|
18
|
-
const result = {};
|
|
19
|
-
for (const item of arr) {
|
|
20
|
-
const bucketCategory = cb(item);
|
|
21
|
-
const bucket = result[bucketCategory];
|
|
22
|
-
if (Array.isArray(bucket)) {
|
|
23
|
-
result[bucketCategory].push(item);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
result[bucketCategory] = [item];
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
30
|
-
}
|
|
31
|
-
function getGroupedEntries(entries, options) {
|
|
32
|
-
const { cssMatcher, htmlMatcher, jsMatcher, wxsMatcher } = options;
|
|
33
|
-
const groupedEntries = groupBy(entries, ([file]) => {
|
|
34
|
-
if (cssMatcher(file)) {
|
|
35
|
-
return 'css';
|
|
36
|
-
}
|
|
37
|
-
else if (htmlMatcher(file)) {
|
|
38
|
-
return 'html';
|
|
39
|
-
}
|
|
40
|
-
else if (jsMatcher(file) || wxsMatcher(file)) {
|
|
41
|
-
return 'js';
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return 'other';
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
return groupedEntries;
|
|
48
|
-
}
|
|
49
|
-
function removeExt(file) {
|
|
50
|
-
return file.replace(/\.[^./]+$/, '');
|
|
51
|
-
}
|
|
52
|
-
const defuOverrideArray = defu.createDefu((obj, key, value) => {
|
|
53
|
-
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const defaultOptions = {
|
|
60
|
-
cssMatcher: file => /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/.test(file),
|
|
61
|
-
htmlMatcher: file => /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/.test(file),
|
|
62
|
-
jsMatcher: (file) => {
|
|
63
|
-
if (file.includes('node_modules')) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
return /.+\.[cm]?js?$/.test(file);
|
|
67
|
-
},
|
|
68
|
-
mainCssChunkMatcher: (file, appType) => {
|
|
69
|
-
switch (appType) {
|
|
70
|
-
case 'uni-app': {
|
|
71
|
-
return /^common\/main/.test(file);
|
|
72
|
-
}
|
|
73
|
-
case 'uni-app-vite': {
|
|
74
|
-
return file.startsWith('app') || /^common\/main/.test(file);
|
|
75
|
-
}
|
|
76
|
-
case 'mpx': {
|
|
77
|
-
return file.startsWith('app');
|
|
78
|
-
}
|
|
79
|
-
case 'taro': {
|
|
80
|
-
return file.startsWith('app');
|
|
81
|
-
}
|
|
82
|
-
case 'remax': {
|
|
83
|
-
return file.startsWith('app');
|
|
84
|
-
}
|
|
85
|
-
case 'rax': {
|
|
86
|
-
return file.startsWith('bundle');
|
|
87
|
-
}
|
|
88
|
-
case 'native': {
|
|
89
|
-
return file.startsWith('app');
|
|
90
|
-
}
|
|
91
|
-
case 'kbone': {
|
|
92
|
-
return /^(?:common\/)?miniprogram-app/.test(file);
|
|
93
|
-
}
|
|
94
|
-
default: {
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
wxsMatcher: () => {
|
|
100
|
-
return false;
|
|
101
|
-
},
|
|
102
|
-
cssPreflight: {
|
|
103
|
-
'box-sizing': 'border-box',
|
|
104
|
-
'border-width': '0',
|
|
105
|
-
'border-style': 'solid',
|
|
106
|
-
'border-color': 'currentColor',
|
|
107
|
-
},
|
|
108
|
-
disabled: false,
|
|
109
|
-
customRuleCallback: noop,
|
|
110
|
-
onLoad: noop,
|
|
111
|
-
onStart: noop,
|
|
112
|
-
onEnd: noop,
|
|
113
|
-
onUpdate: noop,
|
|
114
|
-
customAttributes: {},
|
|
115
|
-
customReplaceDictionary: escape.SimpleMappingChars2String,
|
|
116
|
-
appType: undefined,
|
|
117
|
-
arbitraryValues: {
|
|
118
|
-
allowDoubleQuotes: false,
|
|
119
|
-
},
|
|
120
|
-
cssChildCombinatorReplaceValue: ['view'],
|
|
121
|
-
inlineWxs: false,
|
|
122
|
-
injectAdditionalCssVarScope: false,
|
|
123
|
-
jsPreserveClass: (keyword) => {
|
|
124
|
-
if (keyword === '*') {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
return false;
|
|
128
|
-
},
|
|
129
|
-
disabledDefaultTemplateHandler: false,
|
|
130
|
-
cssSelectorReplacement: {
|
|
131
|
-
root: 'page',
|
|
132
|
-
universal: ['view', 'text'],
|
|
133
|
-
},
|
|
134
|
-
babelParserOptions: {
|
|
135
|
-
sourceType: 'unambiguous',
|
|
136
|
-
},
|
|
137
|
-
postcssOptions: {},
|
|
138
|
-
cssRemoveHoverPseudoClass: true,
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
exports.defaultOptions = defaultOptions;
|
|
142
|
-
exports.defuOverrideArray = defuOverrideArray;
|
|
143
|
-
exports.getGroupedEntries = getGroupedEntries;
|
|
144
|
-
exports.isMap = isMap;
|
|
145
|
-
exports.removeExt = removeExt;
|
package/dist/defu-Cdz2PomB.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function isPlainObject(value) {
|
|
4
|
-
if (value === null || typeof value !== "object") {
|
|
5
|
-
return false;
|
|
6
|
-
}
|
|
7
|
-
const prototype = Object.getPrototypeOf(value);
|
|
8
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (Symbol.iterator in value) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
if (Symbol.toStringTag in value) {
|
|
15
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
16
|
-
}
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
21
|
-
if (!isPlainObject(defaults)) {
|
|
22
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
23
|
-
}
|
|
24
|
-
const object = Object.assign({}, defaults);
|
|
25
|
-
for (const key in baseObject) {
|
|
26
|
-
if (key === "__proto__" || key === "constructor") {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const value = baseObject[key];
|
|
30
|
-
if (value === null || value === void 0) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
37
|
-
object[key] = [...value, ...object[key]];
|
|
38
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
39
|
-
object[key] = _defu(
|
|
40
|
-
value,
|
|
41
|
-
object[key],
|
|
42
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
43
|
-
merger
|
|
44
|
-
);
|
|
45
|
-
} else {
|
|
46
|
-
object[key] = value;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return object;
|
|
50
|
-
}
|
|
51
|
-
function createDefu(merger) {
|
|
52
|
-
return (...arguments_) => (
|
|
53
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
54
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
const defu = createDefu();
|
|
58
|
-
|
|
59
|
-
exports.createDefu = createDefu;
|
|
60
|
-
exports.defu = defu;
|
package/dist/defu-n46TJT6t.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
function isPlainObject(value) {
|
|
2
|
-
if (value === null || typeof value !== "object") {
|
|
3
|
-
return false;
|
|
4
|
-
}
|
|
5
|
-
const prototype = Object.getPrototypeOf(value);
|
|
6
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
if (Symbol.iterator in value) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
if (Symbol.toStringTag in value) {
|
|
13
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
19
|
-
if (!isPlainObject(defaults)) {
|
|
20
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
21
|
-
}
|
|
22
|
-
const object = Object.assign({}, defaults);
|
|
23
|
-
for (const key in baseObject) {
|
|
24
|
-
if (key === "__proto__" || key === "constructor") {
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
const value = baseObject[key];
|
|
28
|
-
if (value === null || value === void 0) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
35
|
-
object[key] = [...value, ...object[key]];
|
|
36
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
37
|
-
object[key] = _defu(
|
|
38
|
-
value,
|
|
39
|
-
object[key],
|
|
40
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
41
|
-
merger
|
|
42
|
-
);
|
|
43
|
-
} else {
|
|
44
|
-
object[key] = value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return object;
|
|
48
|
-
}
|
|
49
|
-
function createDefu(merger) {
|
|
50
|
-
return (...arguments_) => (
|
|
51
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
52
|
-
arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
const defu = createDefu();
|
|
56
|
-
|
|
57
|
-
export { createDefu as c, defu as d };
|
package/dist/env.d.ts
DELETED
package/dist/index-BEIjgKpF.mjs
DELETED