@weapp-tailwindcss/runtime 0.1.5 → 0.1.6-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.cjs CHANGED
@@ -1,6 +1,6 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
2
  let clsx = require("clsx");
2
3
  let _weapp_core_escape = require("@weapp-core/escape");
3
-
4
4
  //#region src/transformers.ts
5
5
  const identity = (value) => value;
6
6
  function isConfig(value) {
@@ -43,12 +43,12 @@ function resolveTransformers(options) {
43
43
  unescape: unescapeEnabled ? (value) => (0, _weapp_core_escape.unescape)(value, unescapeOptions) : identity
44
44
  };
45
45
  }
46
-
47
46
  //#endregion
48
47
  //#region src/create-runtime.ts
49
48
  const CACHE_LIMIT = 256;
49
+ const UNESCAPE_RE = /u[0-9a-f]{3,}/i;
50
50
  function shouldUnescape(value) {
51
- return value.includes("_") || /u[0-9a-f]{3,}/i.test(value);
51
+ return value.includes("_") || UNESCAPE_RE.test(value);
52
52
  }
53
53
  function wrapClassAggregator(fn, transformers, prepareValue, restoreValue) {
54
54
  const cache = /* @__PURE__ */ new Map();
@@ -99,7 +99,6 @@ function createRuntimeFactory(options) {
99
99
  };
100
100
  };
101
101
  }
102
-
103
102
  //#endregion
104
103
  //#region src/rpx-length.ts
105
104
  const DEFAULT_PREFIXES = [
@@ -109,8 +108,9 @@ const DEFAULT_PREFIXES = [
109
108
  "outline",
110
109
  "ring"
111
110
  ];
111
+ const ESCAPE_REGEXP_RE = /[.*+?^${}()|[\]\\]/g;
112
112
  function escapeRegexp(value) {
113
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
113
+ return value.replace(ESCAPE_REGEXP_RE, "\\$&");
114
114
  }
115
115
  function createRpxLengthTransform(prefixes = DEFAULT_PREFIXES) {
116
116
  const arbitraryRegexps = prefixes.map((prefix) => new RegExp(`${prefix}-\\[(\\d+(?:\\.\\d+)?)rpx\\]`, "g"));
@@ -155,16 +155,11 @@ function createRpxLengthTransform(prefixes = DEFAULT_PREFIXES) {
155
155
  restoreValue
156
156
  };
157
157
  }
158
-
159
- //#endregion
160
- //#region src/index.ts
161
- const weappTwIgnoreImpl = String.raw;
162
- const weappTwIgnore = weappTwIgnoreImpl;
163
-
158
+ const weappTwIgnore = String.raw;
164
159
  //#endregion
165
160
  exports.clsx = clsx.clsx;
166
161
  exports.createRpxLengthTransform = createRpxLengthTransform;
167
162
  exports.createRuntimeFactory = createRuntimeFactory;
168
163
  exports.identity = identity;
169
164
  exports.resolveTransformers = resolveTransformers;
170
- exports.weappTwIgnore = weappTwIgnore;
165
+ exports.weappTwIgnore = weappTwIgnore;
package/dist/index.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import { clsx, clsx as clsxFn } from "clsx";
2
2
  import { MappingChars2String, escape, unescape } from "@weapp-core/escape";
3
-
4
3
  //#region src/transformers.ts
5
4
  const identity = (value) => value;
6
5
  function isConfig(value) {
@@ -43,12 +42,12 @@ function resolveTransformers(options) {
43
42
  unescape: unescapeEnabled ? (value) => unescape(value, unescapeOptions) : identity
44
43
  };
45
44
  }
46
-
47
45
  //#endregion
48
46
  //#region src/create-runtime.ts
49
47
  const CACHE_LIMIT = 256;
48
+ const UNESCAPE_RE = /u[0-9a-f]{3,}/i;
50
49
  function shouldUnescape(value) {
51
- return value.includes("_") || /u[0-9a-f]{3,}/i.test(value);
50
+ return value.includes("_") || UNESCAPE_RE.test(value);
52
51
  }
53
52
  function wrapClassAggregator(fn, transformers, prepareValue, restoreValue) {
54
53
  const cache = /* @__PURE__ */ new Map();
@@ -99,7 +98,6 @@ function createRuntimeFactory(options) {
99
98
  };
100
99
  };
101
100
  }
102
-
103
101
  //#endregion
104
102
  //#region src/rpx-length.ts
105
103
  const DEFAULT_PREFIXES = [
@@ -109,8 +107,9 @@ const DEFAULT_PREFIXES = [
109
107
  "outline",
110
108
  "ring"
111
109
  ];
110
+ const ESCAPE_REGEXP_RE = /[.*+?^${}()|[\]\\]/g;
112
111
  function escapeRegexp(value) {
113
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
112
+ return value.replace(ESCAPE_REGEXP_RE, "\\$&");
114
113
  }
115
114
  function createRpxLengthTransform(prefixes = DEFAULT_PREFIXES) {
116
115
  const arbitraryRegexps = prefixes.map((prefix) => new RegExp(`${prefix}-\\[(\\d+(?:\\.\\d+)?)rpx\\]`, "g"));
@@ -155,11 +154,6 @@ function createRpxLengthTransform(prefixes = DEFAULT_PREFIXES) {
155
154
  restoreValue
156
155
  };
157
156
  }
158
-
157
+ const weappTwIgnore = String.raw;
159
158
  //#endregion
160
- //#region src/index.ts
161
- const weappTwIgnoreImpl = String.raw;
162
- const weappTwIgnore = weappTwIgnoreImpl;
163
-
164
- //#endregion
165
- export { clsxFn as clsx, createRpxLengthTransform, createRuntimeFactory, identity, resolveTransformers, weappTwIgnore };
159
+ export { clsxFn as clsx, createRpxLengthTransform, createRuntimeFactory, identity, resolveTransformers, weappTwIgnore };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/runtime",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.6-next.0",
5
5
  "description": "Shared runtime helpers (transformers, clsx wrappers, metadata) for weapp-tailwindcss 在小程序运行时的适配层。",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "access": "public"
47
47
  },
48
48
  "dependencies": {
49
- "@weapp-core/escape": "^7.0.0",
49
+ "@weapp-core/escape": "^8.0.0",
50
50
  "clsx": "^2.1.1"
51
51
  },
52
52
  "scripts": {
@@ -54,6 +54,7 @@
54
54
  "build": "tsdown",
55
55
  "test": "vitest run",
56
56
  "test:dev": "vitest",
57
+ "tsd": "tsd",
57
58
  "release": "pnpm publish",
58
59
  "lint": "eslint .",
59
60
  "lint:fix": "eslint . --fix"