@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 CHANGED
@@ -15,7 +15,6 @@
15
15
 
16
16
  ![star](https://badgen.net/github/stars/sonofmagic/weapp-tailwindcss)
17
17
  ![dm0](https://badgen.net/npm/dm/weapp-tailwindcss)
18
- ![dm1](https://badgen.net/npm/dm/weapp-tailwindcss-webpack-plugin)
19
18
  ![license](https://badgen.net/npm/license/weapp-tailwindcss)
20
19
  [![test](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
21
20
  [![codecov](https://codecov.io/gh/sonofmagic/weapp-tailwindcss/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
@@ -55,12 +54,12 @@
55
54
 
56
55
  ## 版本对应
57
56
 
58
- 目前,`weapp-tailwindcss` 的 `4.x` 版本
57
+ 目前,`weapp-tailwindcss` 的 `5.x` 版本
59
58
 
60
- - 支持最新版本的 `tailwindcss v4` 和 `v3` 还有 `v2 jit` 版本。
61
- - 支持 `webpack5`,`webpack4`, `vite` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
59
+ - 支持最新版本的 `tailwindcss v4` 和 `v3`。
60
+ - 支持 `webpack5`、`vite`、`rspack`、`rollup`、`rolldown` 和 `gulp` 这些打包工具,也支持纯 `Nodejs` API 的方式,集成到你自己的构建工具中。
62
61
 
63
- > 如果你还在使用 `tailwindcss@2` 版本,那你应该使用从 `weapp-tailwindcss/webpack4` 导出的本插件的 `postcss7` `webpack4` 版本。另外请确保你的 `nodejs` 版本 `>=16.6.0`。目前低于 `16` 的长期维护版本(`偶数版本`) 都已经结束了生命周期,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
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
+ });
@@ -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 };
@@ -1,39 +1,32 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk5F5YENBWjs = require('./chunk-5F5YENBW.js');
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
- return validateFilterRE.test(selector);
5
+ return validateFilterRE.test(selector);
13
6
  }
14
- var splitCacheDefault = /* @__PURE__ */ new Map();
15
- var splitCacheAllowQuotes = /* @__PURE__ */ new Map();
16
- var SPLIT_CACHE_LIMIT = 8192;
17
- var SPLITTER_DEFAULT = /\s+|"/;
18
- var SPLITTER_ALLOW_QUOTES = /\s+/;
19
- var ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
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
- const cache = allowDoubleQuotes ? splitCacheAllowQuotes : splitCacheDefault;
22
- const cached = cache.get(code);
23
- if (cached) {
24
- return cached;
25
- }
26
- const normalized = code.includes("\\") ? code.replace(ESCAPED_WHITESPACE_RE, " ") : code;
27
- const splitter = allowDoubleQuotes ? SPLITTER_ALLOW_QUOTES : SPLITTER_DEFAULT;
28
- const result = normalized.split(splitter).filter((element) => isValidSelector(element));
29
- if (cache.size >= SPLIT_CACHE_LIMIT) {
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;
@@ -1,39 +1,29 @@
1
- import {
2
- init_esm_shims
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
- return validateFilterRE.test(selector);
4
+ return validateFilterRE.test(selector);
13
5
  }
14
- var splitCacheDefault = /* @__PURE__ */ new Map();
15
- var splitCacheAllowQuotes = /* @__PURE__ */ new Map();
16
- var SPLIT_CACHE_LIMIT = 8192;
17
- var SPLITTER_DEFAULT = /\s+|"/;
18
- var SPLITTER_ALLOW_QUOTES = /\s+/;
19
- var ESCAPED_WHITESPACE_RE = /\\[nrt]/g;
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
- const cache = allowDoubleQuotes ? splitCacheAllowQuotes : splitCacheDefault;
22
- const cached = cache.get(code);
23
- if (cached) {
24
- return cached;
25
- }
26
- const normalized = code.includes("\\") ? code.replace(ESCAPED_WHITESPACE_RE, " ") : code;
27
- const splitter = allowDoubleQuotes ? SPLITTER_ALLOW_QUOTES : SPLITTER_DEFAULT;
28
- const result = normalized.split(splitter).filter((element) => isValidSelector(element));
29
- if (cache.size >= SPLIT_CACHE_LIMIT) {
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
- export {
36
- isValidSelector,
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 'defu';
2
- export { defu } from 'defu';
3
- export { default as getValue } from 'get-value';
4
- export { default as setValue } from 'set-value';
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
- exact?: boolean;
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: <Source extends {
21
- [x: string]: any;
22
- [x: number]: any;
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 };