@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/README.md +4 -5
- package/dist/chunk-8l464Juk.js +28 -0
- package/dist/extractors.d.ts +3 -2
- package/dist/extractors.js +28 -35
- package/dist/extractors.mjs +25 -35
- package/dist/index.d.ts +9 -16
- package/dist/index.js +75 -477
- package/dist/index.mjs +51 -477
- package/dist/node.d.ts +4 -3
- package/dist/node.js +464 -24
- package/dist/node.mjs +460 -24
- package/package.json +8 -3
- package/dist/chunk-5F5YENBW.js +0 -41
- package/dist/chunk-7QA6IUZF.mjs +0 -43
- package/dist/extractors.d.mts +0 -5
- package/dist/index.d.mts +0 -30
- package/dist/node.d.mts +0 -6
package/README.md
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|

|
|
17
17
|

|
|
18
|
-

|
|
19
18
|

|
|
20
19
|
[](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
|
|
21
20
|
[](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
|
|
@@ -55,12 +54,12 @@
|
|
|
55
54
|
|
|
56
55
|
## 版本对应
|
|
57
56
|
|
|
58
|
-
目前,`weapp-tailwindcss` 的 `
|
|
57
|
+
目前,`weapp-tailwindcss` 的 `5.x` 版本
|
|
59
58
|
|
|
60
|
-
- 支持最新版本的 `tailwindcss v4` 和 `v3
|
|
61
|
-
- 支持 `webpack5
|
|
59
|
+
- 支持最新版本的 `tailwindcss v4` 和 `v3`。
|
|
60
|
+
- 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
|
|
62
61
|
|
|
63
|
-
>
|
|
62
|
+
> `weapp-tailwindcss@5` 面向 Tailwind CSS v3/v4 和现代构建链路,不再内置 Webpack4、PostCSS7、Tailwind CSS v2 兼容入口。`weapp-tailwindcss@5` 需要 `nodejs` 版本 `^20.19.0 || >=22.12.0`,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
|
|
64
63
|
|
|
65
64
|
## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
|
|
66
65
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "__toESM", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return __toESM;
|
|
27
|
+
}
|
|
28
|
+
});
|
package/dist/extractors.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
//#region src/extractors/split.d.ts
|
|
1
2
|
declare const validateFilterRE: RegExp;
|
|
2
3
|
declare function isValidSelector(selector?: string): selector is string;
|
|
3
4
|
declare function splitCode(code: string, allowDoubleQuotes?: boolean): string[];
|
|
4
|
-
|
|
5
|
-
export { isValidSelector, splitCode, validateFilterRE };
|
|
5
|
+
//#endregion
|
|
6
|
+
export { isValidSelector, splitCode, validateFilterRE };
|
package/dist/extractors.js
CHANGED
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// src/extractors/index.ts
|
|
6
|
-
_chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
|
|
7
|
-
|
|
8
|
-
// src/extractors/split.ts
|
|
9
|
-
_chunk5F5YENBWjs.init_cjs_shims.call(void 0, );
|
|
10
|
-
var validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/extractors/split.ts
|
|
3
|
+
const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
11
4
|
function isValidSelector(selector = "") {
|
|
12
|
-
|
|
5
|
+
return validateFilterRE.test(selector);
|
|
13
6
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
/**
|
|
8
|
+
* splitCode 结果缓存,避免对相同字符串重复分割和过滤。
|
|
9
|
+
* 使用两个独立缓存分别对应 allowDoubleQuotes 的两种取值。
|
|
10
|
+
*/
|
|
11
|
+
const splitCacheDefault = /* @__PURE__ */ new Map();
|
|
12
|
+
const splitCacheAllowQuotes = /* @__PURE__ */ new Map();
|
|
13
|
+
const SPLIT_CACHE_LIMIT = 8192;
|
|
14
|
+
/** 预编译的分割正则,避免每次调用都创建 */
|
|
15
|
+
const SPLITTER_DEFAULT = /\s+|"/;
|
|
16
|
+
const SPLITTER_ALLOW_QUOTES = /\s+/;
|
|
17
|
+
const ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
|
|
20
18
|
function splitCode(code, allowDoubleQuotes = false) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
cache.clear();
|
|
31
|
-
}
|
|
32
|
-
cache.set(code, result);
|
|
33
|
-
return result;
|
|
19
|
+
const cache = allowDoubleQuotes ? splitCacheAllowQuotes : splitCacheDefault;
|
|
20
|
+
const cached = cache.get(code);
|
|
21
|
+
if (cached) return cached;
|
|
22
|
+
const normalized = code.includes("\\") ? code.replace(ESCAPED_WHITESPACE_RE, " ") : code;
|
|
23
|
+
const splitter = allowDoubleQuotes ? SPLITTER_ALLOW_QUOTES : SPLITTER_DEFAULT;
|
|
24
|
+
const result = normalized.split(splitter).filter((element) => isValidSelector(element));
|
|
25
|
+
if (cache.size >= SPLIT_CACHE_LIMIT) cache.clear();
|
|
26
|
+
cache.set(code, result);
|
|
27
|
+
return result;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
exports.isValidSelector = isValidSelector; exports.splitCode = splitCode; exports.validateFilterRE = validateFilterRE;
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.isValidSelector = isValidSelector;
|
|
31
|
+
exports.splitCode = splitCode;
|
|
32
|
+
exports.validateFilterRE = validateFilterRE;
|
package/dist/extractors.mjs
CHANGED
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
} from "./chunk-7QA6IUZF.mjs";
|
|
4
|
-
|
|
5
|
-
// src/extractors/index.ts
|
|
6
|
-
init_esm_shims();
|
|
7
|
-
|
|
8
|
-
// src/extractors/split.ts
|
|
9
|
-
init_esm_shims();
|
|
10
|
-
var validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
1
|
+
//#region src/extractors/split.ts
|
|
2
|
+
const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
|
|
11
3
|
function isValidSelector(selector = "") {
|
|
12
|
-
|
|
4
|
+
return validateFilterRE.test(selector);
|
|
13
5
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
/**
|
|
7
|
+
* splitCode 结果缓存,避免对相同字符串重复分割和过滤。
|
|
8
|
+
* 使用两个独立缓存分别对应 allowDoubleQuotes 的两种取值。
|
|
9
|
+
*/
|
|
10
|
+
const splitCacheDefault = /* @__PURE__ */ new Map();
|
|
11
|
+
const splitCacheAllowQuotes = /* @__PURE__ */ new Map();
|
|
12
|
+
const SPLIT_CACHE_LIMIT = 8192;
|
|
13
|
+
/** 预编译的分割正则,避免每次调用都创建 */
|
|
14
|
+
const SPLITTER_DEFAULT = /\s+|"/;
|
|
15
|
+
const SPLITTER_ALLOW_QUOTES = /\s+/;
|
|
16
|
+
const ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
|
|
20
17
|
function splitCode(code, allowDoubleQuotes = false) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
cache.clear();
|
|
31
|
-
}
|
|
32
|
-
cache.set(code, result);
|
|
33
|
-
return result;
|
|
18
|
+
const cache = allowDoubleQuotes ? splitCacheAllowQuotes : splitCacheDefault;
|
|
19
|
+
const cached = cache.get(code);
|
|
20
|
+
if (cached) return cached;
|
|
21
|
+
const normalized = code.includes("\\") ? code.replace(ESCAPED_WHITESPACE_RE, " ") : code;
|
|
22
|
+
const splitter = allowDoubleQuotes ? SPLITTER_ALLOW_QUOTES : SPLITTER_DEFAULT;
|
|
23
|
+
const result = normalized.split(splitter).filter((element) => isValidSelector(element));
|
|
24
|
+
if (cache.size >= SPLIT_CACHE_LIMIT) cache.clear();
|
|
25
|
+
cache.set(code, result);
|
|
26
|
+
return result;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
splitCode,
|
|
38
|
-
validateFilterRE
|
|
39
|
-
};
|
|
28
|
+
//#endregion
|
|
29
|
+
export { isValidSelector, splitCode, validateFilterRE };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import * as defu from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as _$defu from "defu";
|
|
2
|
+
import { defu } from "defu";
|
|
3
|
+
import getValue from "get-value";
|
|
4
|
+
import setValue from "set-value";
|
|
5
5
|
|
|
6
|
+
//#region src/index.d.ts
|
|
6
7
|
declare function isRegexp(value: unknown): value is RegExp;
|
|
7
8
|
declare function isMap<T = unknown, K = unknown>(value: unknown): value is Map<T, K>;
|
|
8
9
|
declare function isHttp(target: string): boolean;
|
|
@@ -12,19 +13,11 @@ declare function ensurePosix(value: string): string;
|
|
|
12
13
|
declare function normalizeRoot(root: string): string;
|
|
13
14
|
declare function normalizeRelativeImport(target: string): string;
|
|
14
15
|
declare function regExpTest(arr: (string | RegExp)[], str: string, options?: {
|
|
15
|
-
|
|
16
|
+
exact?: boolean;
|
|
16
17
|
}): boolean;
|
|
17
18
|
declare function noop(): void;
|
|
18
19
|
declare function groupBy<T>(arr: T[], cb: (arg: T) => string): Record<string, T[]>;
|
|
19
20
|
declare function removeExt(file: string): string;
|
|
20
|
-
declare const defuOverrideArray:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[x: symbol]: any;
|
|
24
|
-
}, Defaults extends Array<{
|
|
25
|
-
[x: string]: any;
|
|
26
|
-
[x: number]: any;
|
|
27
|
-
[x: symbol]: any;
|
|
28
|
-
} | (number | boolean | any[] | Record<never, any> | null | undefined)>>(source: Source, ...defaults: Defaults) => defu.Defu<Source, Defaults>;
|
|
29
|
-
|
|
30
|
-
export { cleanUrl, defuOverrideArray, ensurePosix, groupBy, isHttp, isMap, isRegexp, noop, normalizeRelativeImport, normalizeRoot, regExpTest, removeExt, toArray };
|
|
21
|
+
declare const defuOverrideArray: _$defu.DefuFn;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { cleanUrl, defu, defuOverrideArray, ensurePosix, getValue, groupBy, isHttp, isMap, isRegexp, noop, normalizeRelativeImport, normalizeRoot, regExpTest, removeExt, setValue, toArray };
|