weapp-tailwindcss 2.7.0 → 2.7.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/dist/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/js/handlers.d.ts +2 -1
- package/dist/{options-5a3070c1.mjs → options-8805cf56.mjs} +30 -4
- package/dist/{options-7a4ffa6a.js → options-b7411c31.js} +30 -4
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -2
package/dist/cli.js
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/gulp.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var stream = require('node:stream');
|
|
6
|
-
var options = require('./options-
|
|
6
|
+
var options = require('./options-b7411c31.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('magic-string');
|
|
9
9
|
require('./replace.js');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import stream from 'node:stream';
|
|
2
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
2
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-8805cf56.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import 'magic-string';
|
|
5
5
|
import './replace.mjs';
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var vite = require('./vite.js');
|
|
|
7
7
|
var gulp = require('./gulp.js');
|
|
8
8
|
require('node:path');
|
|
9
9
|
require('node:fs');
|
|
10
|
-
require('./options-
|
|
10
|
+
require('./options-b7411c31.js');
|
|
11
11
|
require('micromatch');
|
|
12
12
|
require('magic-string');
|
|
13
13
|
require('./replace.js');
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
|
3
3
|
export { createPlugins } from './gulp.mjs';
|
|
4
4
|
import 'node:path';
|
|
5
5
|
import 'node:fs';
|
|
6
|
-
import './options-
|
|
6
|
+
import './options-8805cf56.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
8
|
import 'magic-string';
|
|
9
9
|
import './replace.mjs';
|
package/dist/js/handlers.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { StringLiteral, TemplateElement } from '@babel/types';
|
|
2
2
|
import MagicString from 'magic-string';
|
|
3
3
|
import type { IJsHandlerOptions } from "../types";
|
|
4
|
+
export declare function jsStringEscape(str: unknown): string;
|
|
4
5
|
export declare function regenerateHandleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions): string;
|
|
5
|
-
export declare function replaceHandleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions, ms: MagicString, offset?: number): string;
|
|
6
|
+
export declare function replaceHandleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions, ms: MagicString, offset?: number, needEscaped?: boolean): string;
|
|
@@ -26,6 +26,32 @@ const splitCode = (code, allowDoubleQuotes = false) => {
|
|
|
26
26
|
return code.split(splitter).filter((element) => isValidSelector(element));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
function jsStringEscape(str) {
|
|
30
|
+
return ('' + str).replaceAll(/[\n\r"'\\\u2028\u2029]/g, (character) => {
|
|
31
|
+
switch (character) {
|
|
32
|
+
case '"':
|
|
33
|
+
case "'":
|
|
34
|
+
case '\\': {
|
|
35
|
+
return '\\' + character;
|
|
36
|
+
}
|
|
37
|
+
case '\n': {
|
|
38
|
+
return '\\n';
|
|
39
|
+
}
|
|
40
|
+
case '\r': {
|
|
41
|
+
return '\\r';
|
|
42
|
+
}
|
|
43
|
+
case '\u2028': {
|
|
44
|
+
return '\\u2028';
|
|
45
|
+
}
|
|
46
|
+
case '\u2029': {
|
|
47
|
+
return '\\u2029';
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
return character;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
29
55
|
function regenerateHandleValue(str, node, options) {
|
|
30
56
|
var _a;
|
|
31
57
|
const set = options.classNameSet;
|
|
@@ -53,7 +79,7 @@ function regenerateHandleValue(str, node, options) {
|
|
|
53
79
|
}
|
|
54
80
|
return rawStr;
|
|
55
81
|
}
|
|
56
|
-
function replaceHandleValue(str, node, options, ms, offset =
|
|
82
|
+
function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = false) {
|
|
57
83
|
var _a;
|
|
58
84
|
const set = options.classNameSet;
|
|
59
85
|
const escapeMap = options.escapeMap;
|
|
@@ -82,7 +108,7 @@ function replaceHandleValue(str, node, options, ms, offset = 1) {
|
|
|
82
108
|
const start = node.start + offset;
|
|
83
109
|
const end = node.end - offset;
|
|
84
110
|
if (start < end) {
|
|
85
|
-
ms.update(node.start + offset, node.end - offset, rawStr);
|
|
111
|
+
ms.update(node.start + offset, node.end - offset, needEscaped ? jsStringEscape(rawStr) : rawStr);
|
|
86
112
|
}
|
|
87
113
|
}
|
|
88
114
|
return rawStr;
|
|
@@ -101,13 +127,13 @@ function jsHandler(rawSource, options) {
|
|
|
101
127
|
StringLiteral: {
|
|
102
128
|
enter(p) {
|
|
103
129
|
const n = p.node;
|
|
104
|
-
replaceHandleValue(n.value, n, options, ms);
|
|
130
|
+
replaceHandleValue(n.value, n, options, ms, 1, true);
|
|
105
131
|
}
|
|
106
132
|
},
|
|
107
133
|
TemplateElement: {
|
|
108
134
|
enter(p) {
|
|
109
135
|
const n = p.node;
|
|
110
|
-
replaceHandleValue(n.value.raw, n, options, ms, 0);
|
|
136
|
+
replaceHandleValue(n.value.raw, n, options, ms, 0, false);
|
|
111
137
|
}
|
|
112
138
|
},
|
|
113
139
|
CallExpression: {
|
|
@@ -57,6 +57,32 @@ const splitCode = (code, allowDoubleQuotes = false) => {
|
|
|
57
57
|
return code.split(splitter).filter((element) => isValidSelector(element));
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
function jsStringEscape(str) {
|
|
61
|
+
return ('' + str).replaceAll(/[\n\r"'\\\u2028\u2029]/g, (character) => {
|
|
62
|
+
switch (character) {
|
|
63
|
+
case '"':
|
|
64
|
+
case "'":
|
|
65
|
+
case '\\': {
|
|
66
|
+
return '\\' + character;
|
|
67
|
+
}
|
|
68
|
+
case '\n': {
|
|
69
|
+
return '\\n';
|
|
70
|
+
}
|
|
71
|
+
case '\r': {
|
|
72
|
+
return '\\r';
|
|
73
|
+
}
|
|
74
|
+
case '\u2028': {
|
|
75
|
+
return '\\u2028';
|
|
76
|
+
}
|
|
77
|
+
case '\u2029': {
|
|
78
|
+
return '\\u2029';
|
|
79
|
+
}
|
|
80
|
+
default: {
|
|
81
|
+
return character;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
60
86
|
function regenerateHandleValue(str, node, options) {
|
|
61
87
|
var _a;
|
|
62
88
|
const set = options.classNameSet;
|
|
@@ -84,7 +110,7 @@ function regenerateHandleValue(str, node, options) {
|
|
|
84
110
|
}
|
|
85
111
|
return rawStr;
|
|
86
112
|
}
|
|
87
|
-
function replaceHandleValue(str, node, options, ms, offset =
|
|
113
|
+
function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = false) {
|
|
88
114
|
var _a;
|
|
89
115
|
const set = options.classNameSet;
|
|
90
116
|
const escapeMap = options.escapeMap;
|
|
@@ -113,7 +139,7 @@ function replaceHandleValue(str, node, options, ms, offset = 1) {
|
|
|
113
139
|
const start = node.start + offset;
|
|
114
140
|
const end = node.end - offset;
|
|
115
141
|
if (start < end) {
|
|
116
|
-
ms.update(node.start + offset, node.end - offset, rawStr);
|
|
142
|
+
ms.update(node.start + offset, node.end - offset, needEscaped ? jsStringEscape(rawStr) : rawStr);
|
|
117
143
|
}
|
|
118
144
|
}
|
|
119
145
|
return rawStr;
|
|
@@ -132,13 +158,13 @@ function jsHandler(rawSource, options) {
|
|
|
132
158
|
StringLiteral: {
|
|
133
159
|
enter(p) {
|
|
134
160
|
const n = p.node;
|
|
135
|
-
replaceHandleValue(n.value, n, options, ms);
|
|
161
|
+
replaceHandleValue(n.value, n, options, ms, 1, true);
|
|
136
162
|
}
|
|
137
163
|
},
|
|
138
164
|
TemplateElement: {
|
|
139
165
|
enter(p) {
|
|
140
166
|
const n = p.node;
|
|
141
|
-
replaceHandleValue(n.value.raw, n, options, ms, 0);
|
|
167
|
+
replaceHandleValue(n.value.raw, n, options, ms, 0, false);
|
|
142
168
|
}
|
|
143
169
|
},
|
|
144
170
|
CallExpression: {
|
package/dist/vite.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-b7411c31.js');
|
|
6
6
|
var postcss = require('./postcss-4e99a8e8.js');
|
|
7
7
|
var defaults = require('./defaults-344ba6d9.js');
|
|
8
8
|
require('micromatch');
|
package/dist/vite.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-8805cf56.mjs';
|
|
2
2
|
import { v as vitePluginName } from './postcss-a551ddc0.mjs';
|
|
3
3
|
import { g as getGroupedEntries } from './defaults-0743f523.mjs';
|
|
4
4
|
import 'micromatch';
|
package/dist/webpack.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var path = require('node:path');
|
|
6
6
|
var fs = require('node:fs');
|
|
7
|
-
var options = require('./options-
|
|
7
|
+
var options = require('./options-b7411c31.js');
|
|
8
8
|
var postcss = require('./postcss-4e99a8e8.js');
|
|
9
9
|
var defaults = require('./defaults-344ba6d9.js');
|
|
10
10
|
require('micromatch');
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import { g as getOptions, a as createTailwindcssPatcher } from './options-
|
|
3
|
+
import { g as getOptions, a as createTailwindcssPatcher } from './options-8805cf56.mjs';
|
|
4
4
|
import { a as pluginName } from './postcss-a551ddc0.mjs';
|
|
5
5
|
import { g as getGroupedEntries } from './defaults-0743f523.mjs';
|
|
6
6
|
import 'micromatch';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "把tailwindcss jit引擎,带给小程序开发者们\nbring tailwindcss jit engine to our miniprogram developers!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -196,7 +196,10 @@
|
|
|
196
196
|
"semver": "^7.5.4",
|
|
197
197
|
"tailwindcss-patch": "^2.0.4"
|
|
198
198
|
},
|
|
199
|
-
"packageManager": "pnpm@8.6.
|
|
199
|
+
"packageManager": "pnpm@8.6.11",
|
|
200
|
+
"engines": {
|
|
201
|
+
"node": ">=16.6.0"
|
|
202
|
+
},
|
|
200
203
|
"scripts": {
|
|
201
204
|
"dev": "yarn clean && yarn dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
|
|
202
205
|
"build": "yarn clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && yarn dts",
|