@weapp-tailwindcss/postcss 3.3.7 → 3.3.9
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/compat/mini-program-css/prune-generated.d.ts +3 -2
- package/dist/compat/uni-app-x-uvue.d.ts +1 -1
- package/dist/{directives-C7XTve1w.js → directives-DMB7AQE_.js} +616 -572
- package/dist/fingerprint.d.ts +3 -0
- package/dist/index.cjs +9 -3
- package/dist/index.js +7 -7
- package/dist/mp.d.ts +5 -1
- package/dist/{plugin-CRzZbcEf.js → plugin-BxhTytFU.js} +2 -2
- package/dist/{plugin-DwoAGHyN.cjs → plugin-CfrVcQt8.cjs} +1 -1
- package/dist/plugin.cjs +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugins/applyConfiguredCssCalc.d.ts +1 -1
- package/dist/plugins/applyConfiguredCssUnits.d.ts +4 -0
- package/dist/plugins/user-plugin-stage.d.ts +3 -0
- package/dist/processor-cache.d.ts +0 -1
- package/dist/{resolve-D-FbFBpF.js → resolve-Cb3XkcFk.js} +102 -99
- package/dist/{resolve-BFphwPip.cjs → resolve-DcV8mpsu.cjs} +727 -668
- package/dist/{rewrite-imports-Dk9TKKSF.js → rewrite-imports-Cx1wGYaN.js} +1 -1
- package/dist/syntax.cjs +94 -94
- package/dist/syntax.js +2 -2
- package/dist/{transform-DpFypcaN.cjs → transform-CmPPSR36.cjs} +384 -172
- package/dist/{transform-BGYgGeQj.js → transform-DhUndykm.js} +352 -176
- package/dist/transform.cjs +8 -2
- package/dist/transform.d.ts +4 -0
- package/dist/transform.js +6 -6
- package/dist/types.d.ts +10 -0
- package/dist/utils/css-calc-context.d.ts +12 -0
- package/dist/utils/css-custom-property.d.ts +14 -0
- package/dist/utils/deferred-css-source.d.ts +6 -0
- package/package.json +9 -8
|
@@ -3,7 +3,7 @@ import path from "node:path";
|
|
|
3
3
|
import { resolveProjectSourceFiles } from "@weapp-tailwindcss/engine";
|
|
4
4
|
import { DEFAULT_SOURCE_SCAN_EXTENSIONS, FULL_SOURCE_SCAN_EXTENSIONS, FULL_SOURCE_SCAN_EXTENSION_RE, FULL_SOURCE_SCAN_PATTERN, createSourceScanPattern, createSourceScanPattern as createSourceScanPattern$1, createSourceScanPlan, createTailwindSourceEntryMatcher, expandSourceEntries, isFileExcludedByTailwindSourceEntries, isFileMatchedByTailwindSourceEntries, normalizeGlobPattern, normalizeLegacyContentEntries, normalizeLegacyContentEntries as normalizeLegacyContentEntries$1, resolveSourceScanPath, resolveTailwindSourceEntry, resolveTailwindSourceEntry as resolveTailwindSourceEntry$1, sourcePathApi, toPosixPath } from "@weapp-tailwindcss/source-scan";
|
|
5
5
|
import { loadConfig } from "tailwindcss-config";
|
|
6
|
-
//#region ../../node_modules/.pnpm/@csstools+css-tokenizer@4.0.
|
|
6
|
+
//#region ../../node_modules/.pnpm/@csstools+css-tokenizer@4.0.2/node_modules/@csstools/css-tokenizer/dist/index.mjs
|
|
7
7
|
var ParseError = class extends Error {
|
|
8
8
|
sourceStart;
|
|
9
9
|
sourceEnd;
|
|
@@ -30,9 +30,12 @@ const e = {
|
|
|
30
30
|
};
|
|
31
31
|
"undefined" != typeof globalThis && "structuredClone" in globalThis;
|
|
32
32
|
function stringify(...e) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
if (!e || !e.length) return "";
|
|
34
|
+
let n;
|
|
35
|
+
n = Array.isArray(e) && Array.isArray(e[0]) && Array.isArray(e[0][0]) ? e[0] : e;
|
|
36
|
+
let t = "";
|
|
37
|
+
for (let e = 0; e < n.length; e++) t += n[e][1];
|
|
38
|
+
return t;
|
|
36
39
|
}
|
|
37
40
|
const t = 13;
|
|
38
41
|
const o = 45;
|
|
@@ -130,45 +133,45 @@ function tokenize(e, n) {
|
|
|
130
133
|
for (; !t.endOfFile();) o.push(t.nextToken());
|
|
131
134
|
return o.push(t.nextToken()), o;
|
|
132
135
|
}
|
|
133
|
-
function tokenizer(n,
|
|
134
|
-
const
|
|
136
|
+
function tokenizer(n, l) {
|
|
137
|
+
const C = n.css.valueOf(), f = n.unicodeRangesAllowed ?? !1;
|
|
135
138
|
let m = 0, h = 0, k = -1, P = !1;
|
|
136
|
-
const p =
|
|
139
|
+
const p = l?.onParseError ?? noop;
|
|
137
140
|
function consumeIdentSequence() {
|
|
138
141
|
const e = m;
|
|
139
142
|
for (;;) {
|
|
140
|
-
const e =
|
|
143
|
+
const e = C.charCodeAt(m);
|
|
141
144
|
if (e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === o || 95 === e) {
|
|
142
145
|
m += 1;
|
|
143
146
|
continue;
|
|
144
147
|
}
|
|
145
|
-
const n =
|
|
146
|
-
if (0 === n || n >= 55296 && n <= 57343 || n === s && !isNewLine(
|
|
148
|
+
const n = C.codePointAt(m) ?? -1;
|
|
149
|
+
if (0 === n || n >= 55296 && n <= 57343 || n === s && !isNewLine(C.codePointAt(m + 1) ?? -1)) break;
|
|
147
150
|
if (!isNonASCII_IdentCodePoint(n)) break;
|
|
148
151
|
m += +(n > 65535) + 1;
|
|
149
152
|
}
|
|
150
|
-
const n =
|
|
151
|
-
if (0 !== n && !(n >= 55296 && n <= 57343) && (n !== s || isNewLine(
|
|
153
|
+
const n = C.codePointAt(m) ?? -1;
|
|
154
|
+
if (0 !== n && !(n >= 55296 && n <= 57343) && (n !== s || isNewLine(C.codePointAt(m + 1) ?? -1))) return P = !0, k = m - 1, C.slice(e, m);
|
|
152
155
|
P = !1, m = e, k = -1;
|
|
153
156
|
let t = "";
|
|
154
157
|
for (;;) {
|
|
155
|
-
const e =
|
|
158
|
+
const e = C.codePointAt(m) ?? -1;
|
|
156
159
|
if (0 === e || isSurrogate(e)) t += String.fromCharCode(c), m += +(e > 65535) + 1, k = m - 1;
|
|
157
160
|
else if (e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === o || 95 === e || isNonASCII_IdentCodePoint(e)) t += e > 65535 ? String.fromCodePoint(e) : String.fromCharCode(e), m += +(e > 65535) + 1, k = m - 1;
|
|
158
161
|
else {
|
|
159
|
-
if (
|
|
162
|
+
if (C.codePointAt(m) !== s || isNewLine(C.codePointAt(m + 1) ?? -1)) return t;
|
|
160
163
|
m += 1, k = m - 1, t += String.fromCodePoint(consumeEscapedCodePoint());
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
}
|
|
164
167
|
function consumeEscapedCodePoint() {
|
|
165
|
-
const n =
|
|
168
|
+
const n = C.codePointAt(m);
|
|
166
169
|
if (void 0 === n) return p(new ParseError(e.UnexpectedEOFInEscapedCodePoint, h, k, ["4.3.7. Consume an escaped code point", "Unexpected EOF"])), c;
|
|
167
170
|
if (m += +(n > 65535) + 1, k = m - 1, isHexDigitCodePoint(n)) {
|
|
168
171
|
const e = [n];
|
|
169
172
|
let o;
|
|
170
|
-
for (; void 0 !== (o =
|
|
171
|
-
isWhitespace(
|
|
173
|
+
for (; void 0 !== (o = C.codePointAt(m)) && isHexDigitCodePoint(o) && e.length < 6;) e.push(o), m += 1, k = m - 1;
|
|
174
|
+
isWhitespace(C.codePointAt(m) ?? -1) && (C.codePointAt(m) === t && C.codePointAt(m + 1) === r && (m += 1), m += 1, k = m - 1);
|
|
172
175
|
const i = parseInt(String.fromCodePoint(...e), 16);
|
|
173
176
|
return 0 === i || isSurrogate(i) || i > 1114111 ? c : i;
|
|
174
177
|
}
|
|
@@ -176,33 +179,33 @@ function tokenizer(n, C) {
|
|
|
176
179
|
}
|
|
177
180
|
function consumeBadURL() {
|
|
178
181
|
for (;;) {
|
|
179
|
-
const e =
|
|
182
|
+
const e = C.codePointAt(m);
|
|
180
183
|
if (void 0 === e) return;
|
|
181
184
|
if (41 === e) return m += 1, void (k = m - 1);
|
|
182
|
-
e !== s || isNewLine(
|
|
185
|
+
e !== s || isNewLine(C.codePointAt(m + 1) ?? -1) ? (m += 1, k = m - 1) : (m += 1, k = m - 1, consumeEscapedCodePoint());
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
188
|
function consumeComment() {
|
|
186
189
|
for (m += 2, k = m - 1;;) {
|
|
187
|
-
const n =
|
|
190
|
+
const n = C.codePointAt(m);
|
|
188
191
|
if (void 0 === n) {
|
|
189
192
|
const n = [
|
|
190
193
|
u.Comment,
|
|
191
|
-
|
|
194
|
+
C.slice(h, k + 1),
|
|
192
195
|
h,
|
|
193
196
|
k,
|
|
194
197
|
void 0
|
|
195
198
|
];
|
|
196
199
|
return p(new ParseErrorWithToken(e.UnexpectedEOFInComment, h, k, ["4.3.2. Consume comments", "Unexpected EOF"], n)), n;
|
|
197
200
|
}
|
|
198
|
-
if (m += 1, k = m - 1, 42 === n && void 0 !==
|
|
201
|
+
if (m += 1, k = m - 1, 42 === n && void 0 !== C.codePointAt(m) && 47 === C.codePointAt(m)) {
|
|
199
202
|
m += 1, k = m - 1;
|
|
200
203
|
break;
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
return [
|
|
204
207
|
u.Comment,
|
|
205
|
-
|
|
208
|
+
C.slice(h, k + 1),
|
|
206
209
|
h,
|
|
207
210
|
k,
|
|
208
211
|
void 0
|
|
@@ -210,13 +213,13 @@ function tokenizer(n, C) {
|
|
|
210
213
|
}
|
|
211
214
|
function consumeStringToken() {
|
|
212
215
|
let n = "";
|
|
213
|
-
const o =
|
|
216
|
+
const o = C.codePointAt(m);
|
|
214
217
|
for (m += 1, k = m - 1;;) {
|
|
215
|
-
const i =
|
|
216
|
-
if (m >=
|
|
218
|
+
const i = C.charCodeAt(m);
|
|
219
|
+
if (m >= C.length) {
|
|
217
220
|
const t = [
|
|
218
221
|
u.String,
|
|
219
|
-
|
|
222
|
+
C.slice(h, k + 1),
|
|
220
223
|
h,
|
|
221
224
|
k,
|
|
222
225
|
{ value: n }
|
|
@@ -227,16 +230,16 @@ function tokenizer(n, C) {
|
|
|
227
230
|
m -= 1, k = m - 1;
|
|
228
231
|
const n = [
|
|
229
232
|
u.BadString,
|
|
230
|
-
|
|
233
|
+
C.slice(h, k + 1),
|
|
231
234
|
h,
|
|
232
235
|
k,
|
|
233
236
|
void 0
|
|
234
237
|
];
|
|
235
|
-
return p(new ParseErrorWithToken(e.UnexpectedNewLineInString, h,
|
|
238
|
+
return p(new ParseErrorWithToken(e.UnexpectedNewLineInString, h, C.codePointAt(m) === t && C.codePointAt(m + 1) === r ? k + 2 : k + 1, ["4.3.5. Consume a string token", "Unexpected newline"], n)), n;
|
|
236
239
|
}
|
|
237
240
|
if (i === o) return [
|
|
238
241
|
u.String,
|
|
239
|
-
|
|
242
|
+
C.slice(h, k + 1),
|
|
240
243
|
h,
|
|
241
244
|
k,
|
|
242
245
|
{ value: n }
|
|
@@ -244,7 +247,7 @@ function tokenizer(n, C) {
|
|
|
244
247
|
if (i !== s) if (0 !== i) if (i < 128) n += String.fromCharCode(i);
|
|
245
248
|
else {
|
|
246
249
|
if (i >= 55296 && i <= 57343) {
|
|
247
|
-
const e =
|
|
250
|
+
const e = C.codePointAt(m - 1) ?? -1;
|
|
248
251
|
e >= 65536 ? (n += String.fromCodePoint(e), m += 1, k = m - 1) : n += String.fromCharCode(c);
|
|
249
252
|
continue;
|
|
250
253
|
}
|
|
@@ -252,9 +255,9 @@ function tokenizer(n, C) {
|
|
|
252
255
|
}
|
|
253
256
|
else n += String.fromCharCode(c);
|
|
254
257
|
else {
|
|
255
|
-
if (void 0 ===
|
|
256
|
-
if (isNewLine(
|
|
257
|
-
|
|
258
|
+
if (void 0 === C.codePointAt(m)) continue;
|
|
259
|
+
if (isNewLine(C.codePointAt(m) ?? -1)) {
|
|
260
|
+
C.codePointAt(m) === t && C.codePointAt(m + 1) === r && (m += 1), m += 1, k = m - 1;
|
|
258
261
|
continue;
|
|
259
262
|
}
|
|
260
263
|
n += String.fromCodePoint(consumeEscapedCodePoint());
|
|
@@ -265,14 +268,14 @@ function tokenizer(n, C) {
|
|
|
265
268
|
m += 2, k = m - 1;
|
|
266
269
|
const e = [], n = [];
|
|
267
270
|
let t;
|
|
268
|
-
for (; void 0 !== (t =
|
|
269
|
-
for (; void 0 !== (t =
|
|
270
|
-
if (!n.length &&
|
|
271
|
+
for (; void 0 !== (t = C.codePointAt(m)) && e.length < 6 && isHexDigitCodePoint(t);) e.push(t), m += 1, k = m - 1;
|
|
272
|
+
for (; void 0 !== (t = C.codePointAt(m)) && e.length < 6 && 63 === t;) 0 === n.length && n.push(...e), e.push(48), n.push(70), m += 1, k = m - 1;
|
|
273
|
+
if (!n.length && C.codePointAt(m) === o && isHexDigitCodePoint(C.codePointAt(m + 1) ?? -1)) for (m += 1, k = m - 1; void 0 !== (t = C.codePointAt(m)) && n.length < 6 && isHexDigitCodePoint(t);) n.push(t), m += 1, k = m - 1;
|
|
271
274
|
if (!n.length) {
|
|
272
275
|
const n = parseInt(String.fromCodePoint(...e), 16);
|
|
273
276
|
return [
|
|
274
277
|
u.UnicodeRange,
|
|
275
|
-
|
|
278
|
+
C.slice(h, k + 1),
|
|
276
279
|
h,
|
|
277
280
|
k,
|
|
278
281
|
{
|
|
@@ -284,7 +287,7 @@ function tokenizer(n, C) {
|
|
|
284
287
|
const r = parseInt(String.fromCodePoint(...e), 16), i = parseInt(String.fromCodePoint(...n), 16);
|
|
285
288
|
return [
|
|
286
289
|
u.UnicodeRange,
|
|
287
|
-
|
|
290
|
+
C.slice(h, k + 1),
|
|
288
291
|
h,
|
|
289
292
|
k,
|
|
290
293
|
{
|
|
@@ -294,32 +297,32 @@ function tokenizer(n, C) {
|
|
|
294
297
|
];
|
|
295
298
|
}
|
|
296
299
|
function consumeUrlToken() {
|
|
297
|
-
for (; isWhitespace(
|
|
300
|
+
for (; isWhitespace(C.codePointAt(m) ?? -1);) m += 1, k = m - 1;
|
|
298
301
|
let n = "";
|
|
299
302
|
for (;;) {
|
|
300
|
-
if (void 0 ===
|
|
303
|
+
if (void 0 === C.codePointAt(m)) {
|
|
301
304
|
const t = [
|
|
302
305
|
u.URL,
|
|
303
|
-
|
|
306
|
+
C.slice(h, k + 1),
|
|
304
307
|
h,
|
|
305
308
|
k,
|
|
306
309
|
{ value: n }
|
|
307
310
|
];
|
|
308
311
|
return p(new ParseErrorWithToken(e.UnexpectedEOFInURL, h, k, ["4.3.6. Consume a url token", "Unexpected EOF"], t)), t;
|
|
309
312
|
}
|
|
310
|
-
if (41 ===
|
|
313
|
+
if (41 === C.codePointAt(m)) return m += 1, k = m - 1, [
|
|
311
314
|
u.URL,
|
|
312
|
-
|
|
315
|
+
C.slice(h, k + 1),
|
|
313
316
|
h,
|
|
314
317
|
k,
|
|
315
318
|
{ value: n }
|
|
316
319
|
];
|
|
317
|
-
if (isWhitespace(
|
|
318
|
-
for (m += 1, k = m - 1; isWhitespace(
|
|
319
|
-
if (void 0 ===
|
|
320
|
+
if (isWhitespace(C.codePointAt(m) ?? -1)) {
|
|
321
|
+
for (m += 1, k = m - 1; isWhitespace(C.codePointAt(m) ?? -1);) m += 1, k = m - 1;
|
|
322
|
+
if (void 0 === C.codePointAt(m)) {
|
|
320
323
|
const t = [
|
|
321
324
|
u.URL,
|
|
322
|
-
|
|
325
|
+
C.slice(h, k + 1),
|
|
323
326
|
h,
|
|
324
327
|
k,
|
|
325
328
|
{ value: n }
|
|
@@ -330,26 +333,26 @@ function tokenizer(n, C) {
|
|
|
330
333
|
"Unexpected EOF"
|
|
331
334
|
], t)), t;
|
|
332
335
|
}
|
|
333
|
-
return 41 ===
|
|
336
|
+
return 41 === C.codePointAt(m) ? (m += 1, k = m - 1, [
|
|
334
337
|
u.URL,
|
|
335
|
-
|
|
338
|
+
C.slice(h, k + 1),
|
|
336
339
|
h,
|
|
337
340
|
k,
|
|
338
341
|
{ value: n }
|
|
339
342
|
]) : (consumeBadURL(), [
|
|
340
343
|
u.BadURL,
|
|
341
|
-
|
|
344
|
+
C.slice(h, k + 1),
|
|
342
345
|
h,
|
|
343
346
|
k,
|
|
344
347
|
void 0
|
|
345
348
|
]);
|
|
346
349
|
}
|
|
347
|
-
const t =
|
|
350
|
+
const t = C.codePointAt(m);
|
|
348
351
|
if (34 === t || 39 === t || 40 === t || isNonPrintableCodePoint(t ?? -1)) {
|
|
349
352
|
consumeBadURL();
|
|
350
353
|
const n = [
|
|
351
354
|
u.BadURL,
|
|
352
|
-
|
|
355
|
+
C.slice(h, k + 1),
|
|
353
356
|
h,
|
|
354
357
|
k,
|
|
355
358
|
void 0
|
|
@@ -357,14 +360,14 @@ function tokenizer(n, C) {
|
|
|
357
360
|
return p(new ParseErrorWithToken(e.UnexpectedCharacterInURL, h, k, ["4.3.6. Consume a url token", "Unexpected U+0022 QUOTATION MARK (\"), U+0027 APOSTROPHE ('), U+0028 LEFT PARENTHESIS (() or non-printable code point"], n)), n;
|
|
358
361
|
}
|
|
359
362
|
if (t === s) {
|
|
360
|
-
if (t === s && !isNewLine(
|
|
363
|
+
if (t === s && !isNewLine(C.codePointAt(m + 1) ?? -1)) {
|
|
361
364
|
m += 1, k = m - 1, n += String.fromCodePoint(consumeEscapedCodePoint());
|
|
362
365
|
continue;
|
|
363
366
|
}
|
|
364
367
|
consumeBadURL();
|
|
365
368
|
const o = [
|
|
366
369
|
u.BadURL,
|
|
367
|
-
|
|
370
|
+
C.slice(h, k + 1),
|
|
368
371
|
h,
|
|
369
372
|
k,
|
|
370
373
|
void 0
|
|
@@ -381,28 +384,28 @@ function tokenizer(n, C) {
|
|
|
381
384
|
function consumeNumericToken() {
|
|
382
385
|
let e;
|
|
383
386
|
{
|
|
384
|
-
const n =
|
|
387
|
+
const n = C.charCodeAt(m);
|
|
385
388
|
n === o ? e = "-" : n === i && (e = "+");
|
|
386
389
|
}
|
|
387
390
|
let n = a.Integer;
|
|
388
|
-
const t =
|
|
391
|
+
const t = C.charCodeAt(m);
|
|
389
392
|
t !== i && t !== o || (m += 1);
|
|
390
|
-
let r =
|
|
391
|
-
for (; r >= 48 && r <= 57;) m += 1, r =
|
|
392
|
-
if (46 ===
|
|
393
|
-
const c =
|
|
393
|
+
let r = C.charCodeAt(m);
|
|
394
|
+
for (; r >= 48 && r <= 57;) m += 1, r = C.charCodeAt(m);
|
|
395
|
+
if (46 === C.charCodeAt(m) && C.charCodeAt(m + 1) >= 48 && C.charCodeAt(m + 1) <= 57) for (m += 2, n = a.Number, r = C.charCodeAt(m); r >= 48 && r <= 57;) m += 1, r = C.charCodeAt(m);
|
|
396
|
+
const c = C.charCodeAt(m);
|
|
394
397
|
if (101 === c || 69 === c) {
|
|
395
|
-
const e =
|
|
396
|
-
if (e >= 48 && e <= 57) for (m += 2, n = a.Number, r =
|
|
397
|
-
else if ((e === o || e === i) &&
|
|
398
|
+
const e = C.charCodeAt(m + 1);
|
|
399
|
+
if (e >= 48 && e <= 57) for (m += 2, n = a.Number, r = C.charCodeAt(m); r >= 48 && r <= 57;) m += 1, r = C.charCodeAt(m);
|
|
400
|
+
else if ((e === o || e === i) && C.charCodeAt(m + 2) >= 48 && C.charCodeAt(m + 2) <= 57) for (m += 3, n = a.Number, r = C.charCodeAt(m); r >= 48 && r <= 57;) m += 1, r = C.charCodeAt(m);
|
|
398
401
|
}
|
|
399
402
|
k = m - 1;
|
|
400
|
-
const s = parseFloat(
|
|
403
|
+
const s = parseFloat(C.slice(h, k + 1));
|
|
401
404
|
if (checkIfThreeCodePointsWouldStartAnIdentSequence()) {
|
|
402
405
|
const t = consumeIdentSequence();
|
|
403
406
|
return [
|
|
404
407
|
u.Dimension,
|
|
405
|
-
|
|
408
|
+
C.slice(h, k + 1),
|
|
406
409
|
h,
|
|
407
410
|
k,
|
|
408
411
|
{
|
|
@@ -413,9 +416,9 @@ function tokenizer(n, C) {
|
|
|
413
416
|
}
|
|
414
417
|
];
|
|
415
418
|
}
|
|
416
|
-
return 37 ===
|
|
419
|
+
return 37 === C.charCodeAt(m) ? (m += 1, k = m - 1, [
|
|
417
420
|
u.Percentage,
|
|
418
|
-
|
|
421
|
+
C.slice(h, k + 1),
|
|
419
422
|
h,
|
|
420
423
|
k,
|
|
421
424
|
{
|
|
@@ -424,7 +427,7 @@ function tokenizer(n, C) {
|
|
|
424
427
|
}
|
|
425
428
|
]) : [
|
|
426
429
|
u.Number,
|
|
427
|
-
|
|
430
|
+
C.slice(h, k + 1),
|
|
428
431
|
h,
|
|
429
432
|
k,
|
|
430
433
|
{
|
|
@@ -436,9 +439,9 @@ function tokenizer(n, C) {
|
|
|
436
439
|
}
|
|
437
440
|
function consumeIdentLikeToken() {
|
|
438
441
|
const e = consumeIdentSequence();
|
|
439
|
-
if (40 !==
|
|
442
|
+
if (40 !== C.charCodeAt(m)) return [
|
|
440
443
|
u.Ident,
|
|
441
|
-
P ? e :
|
|
444
|
+
P ? e : C.slice(h, k + 1),
|
|
442
445
|
h,
|
|
443
446
|
k,
|
|
444
447
|
{ value: e }
|
|
@@ -446,11 +449,11 @@ function tokenizer(n, C) {
|
|
|
446
449
|
if (!(3 !== e.length || 117 !== e.charCodeAt(0) && 85 !== e.charCodeAt(0) || 114 !== e.charCodeAt(1) && 82 !== e.charCodeAt(1) || 108 !== e.charCodeAt(2) && 76 !== e.charCodeAt(2))) {
|
|
447
450
|
m += 1, k = m - 1;
|
|
448
451
|
let n = 0;
|
|
449
|
-
for (; isWhitespace(
|
|
450
|
-
const t =
|
|
452
|
+
for (; isWhitespace(C.charCodeAt(m));) n += 1, m += 1, k = m - 1;
|
|
453
|
+
const t = C.charCodeAt(m);
|
|
451
454
|
return 34 === t || 39 === t ? (n > 0 && (m -= n, k = m - 1), [
|
|
452
455
|
u.Function,
|
|
453
|
-
|
|
456
|
+
C.slice(h, k + 1),
|
|
454
457
|
h,
|
|
455
458
|
k,
|
|
456
459
|
{ value: e }
|
|
@@ -458,7 +461,7 @@ function tokenizer(n, C) {
|
|
|
458
461
|
}
|
|
459
462
|
return m += 1, k = m - 1, [
|
|
460
463
|
u.Function,
|
|
461
|
-
|
|
464
|
+
C.slice(h, k + 1),
|
|
462
465
|
h,
|
|
463
466
|
k,
|
|
464
467
|
{ value: e }
|
|
@@ -466,14 +469,14 @@ function tokenizer(n, C) {
|
|
|
466
469
|
}
|
|
467
470
|
function consumeHashToken() {
|
|
468
471
|
m += 1, k = m - 1;
|
|
469
|
-
const e =
|
|
470
|
-
if (e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === o || 95 === e || isNonASCII_IdentCodePoint(e) || e === s && !isNewLine(
|
|
472
|
+
const e = C.charCodeAt(m);
|
|
473
|
+
if (e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || e === o || 95 === e || isNonASCII_IdentCodePoint(e) || e === s && !isNewLine(C.codePointAt(m + 1) ?? -1)) {
|
|
471
474
|
let e = d.Unrestricted;
|
|
472
475
|
checkIfThreeCodePointsWouldStartAnIdentSequence() && (e = d.ID);
|
|
473
476
|
const n = consumeIdentSequence();
|
|
474
477
|
return [
|
|
475
478
|
u.Hash,
|
|
476
|
-
|
|
479
|
+
C.slice(h, k + 1),
|
|
477
480
|
h,
|
|
478
481
|
k,
|
|
479
482
|
{
|
|
@@ -495,7 +498,7 @@ function tokenizer(n, C) {
|
|
|
495
498
|
const e = consumeIdentSequence();
|
|
496
499
|
return [
|
|
497
500
|
u.AtKeyword,
|
|
498
|
-
|
|
501
|
+
C.slice(h, k + 1),
|
|
499
502
|
h,
|
|
500
503
|
k,
|
|
501
504
|
{ value: e }
|
|
@@ -525,24 +528,24 @@ function tokenizer(n, C) {
|
|
|
525
528
|
], n)), n;
|
|
526
529
|
}
|
|
527
530
|
function checkIfThreeCodePointsWouldStartAnIdentSequence(e) {
|
|
528
|
-
const n = void 0 === e ?
|
|
529
|
-
return n === o ?
|
|
531
|
+
const n = void 0 === e ? C.charCodeAt(m) : e;
|
|
532
|
+
return n === o ? C.charCodeAt(m + 1) === o || !!isIdentStartCodePoint(C.charCodeAt(m + 1)) || C.charCodeAt(m + 1) === s && !isNewLine(C.charCodeAt(m + 2)) : !!isIdentStartCodePoint(n) || C.charCodeAt(m) === s && !isNewLine(C.charCodeAt(m + 1));
|
|
530
533
|
}
|
|
531
534
|
function checkIfThreeCodePointsWouldStartANumber(e) {
|
|
532
|
-
return e === i || e === o ?
|
|
535
|
+
return e === i || e === o ? C.charCodeAt(m + 1) >= 48 && C.charCodeAt(m + 1) <= 57 || 46 === C.charCodeAt(m + 1) && C.charCodeAt(m + 2) >= 48 && C.charCodeAt(m + 2) <= 57 : 46 === e ? C.charCodeAt(m + 1) >= 48 && C.charCodeAt(m + 1) <= 57 : e >= 48 && e <= 57;
|
|
533
536
|
}
|
|
534
537
|
return {
|
|
535
538
|
nextToken: function nextToken() {
|
|
536
|
-
if (h = m, k = -1, m >=
|
|
539
|
+
if (h = m, k = -1, m >= C.length) return [
|
|
537
540
|
u.EOF,
|
|
538
541
|
"",
|
|
539
542
|
-1,
|
|
540
543
|
-1,
|
|
541
544
|
void 0
|
|
542
545
|
];
|
|
543
|
-
const e =
|
|
544
|
-
if (47 === e && 42 ===
|
|
545
|
-
if (f && (117 === e || 85 === e) &&
|
|
546
|
+
const e = C.charCodeAt(m);
|
|
547
|
+
if (47 === e && 42 === C.charCodeAt(m + 1)) return consumeComment();
|
|
548
|
+
if (f && (117 === e || 85 === e) && C.codePointAt(m + 1) === i && (63 === C.codePointAt(m + 2) || isHexDigitCodePoint(C.codePointAt(m + 2) ?? -1))) return consumeUnicodeRangeToken();
|
|
546
549
|
if (isIdentStartCodePoint(e)) return consumeIdentLikeToken();
|
|
547
550
|
if ((n = e) >= 48 && n <= 57) return consumeNumericToken();
|
|
548
551
|
switch (e) {
|
|
@@ -615,10 +618,10 @@ function tokenizer(n, C) {
|
|
|
615
618
|
case i:
|
|
616
619
|
case 46: return checkIfThreeCodePointsWouldStartANumber(e) ? consumeNumericToken() : (m += 1, k = m - 1, [
|
|
617
620
|
u.Delim,
|
|
618
|
-
|
|
621
|
+
C[h],
|
|
619
622
|
h,
|
|
620
623
|
k,
|
|
621
|
-
{ value:
|
|
624
|
+
{ value: C[h] }
|
|
622
625
|
]);
|
|
623
626
|
case r:
|
|
624
627
|
case t:
|
|
@@ -626,18 +629,18 @@ function tokenizer(n, C) {
|
|
|
626
629
|
case 9:
|
|
627
630
|
case 32:
|
|
628
631
|
{
|
|
629
|
-
let e =
|
|
630
|
-
for (; 32 === e || e === r || 9 === e || e === t || 12 === e;) m += 1, e =
|
|
632
|
+
let e = C.charCodeAt(m);
|
|
633
|
+
for (; 32 === e || e === r || 9 === e || e === t || 12 === e;) m += 1, e = C.charCodeAt(m);
|
|
631
634
|
k = m - 1;
|
|
632
635
|
}
|
|
633
636
|
return [
|
|
634
637
|
u.Whitespace,
|
|
635
|
-
|
|
638
|
+
C.slice(h, k + 1),
|
|
636
639
|
h,
|
|
637
640
|
k,
|
|
638
641
|
void 0
|
|
639
642
|
];
|
|
640
|
-
case o: return checkIfThreeCodePointsWouldStartANumber(e) ? consumeNumericToken() :
|
|
643
|
+
case o: return checkIfThreeCodePointsWouldStartANumber(e) ? consumeNumericToken() : C.charCodeAt(m + 1) === o && 62 === C.charCodeAt(m + 2) ? (m += 3, k = m - 1, [
|
|
641
644
|
u.CDC,
|
|
642
645
|
"-->",
|
|
643
646
|
h,
|
|
@@ -650,7 +653,7 @@ function tokenizer(n, C) {
|
|
|
650
653
|
k,
|
|
651
654
|
{ value: "-" }
|
|
652
655
|
]);
|
|
653
|
-
case 60: return 33 ===
|
|
656
|
+
case 60: return 33 === C.charCodeAt(m + 1) && C.charCodeAt(m + 2) === o && C.charCodeAt(m + 3) === o ? (m += 4, k = m - 1, [
|
|
654
657
|
u.CDO,
|
|
655
658
|
"<!--",
|
|
656
659
|
h,
|
|
@@ -664,19 +667,19 @@ function tokenizer(n, C) {
|
|
|
664
667
|
{ value: "<" }
|
|
665
668
|
]);
|
|
666
669
|
case 64: return consumeAtKeywordToken();
|
|
667
|
-
case s: return e !== s || isNewLine(
|
|
670
|
+
case s: return e !== s || isNewLine(C.charCodeAt(m + 1)) ? consumeInvalidEscapeToken() : consumeIdentLikeToken();
|
|
668
671
|
default: return m += 1, k = m - 1, [
|
|
669
672
|
u.Delim,
|
|
670
|
-
|
|
673
|
+
C[h],
|
|
671
674
|
h,
|
|
672
675
|
k,
|
|
673
|
-
{ value:
|
|
676
|
+
{ value: C[h] }
|
|
674
677
|
];
|
|
675
678
|
}
|
|
676
679
|
var n;
|
|
677
680
|
},
|
|
678
681
|
endOfFile: function endOfFile() {
|
|
679
|
-
return m >=
|
|
682
|
+
return m >= C.length;
|
|
680
683
|
}
|
|
681
684
|
};
|
|
682
685
|
}
|
|
@@ -716,9 +719,9 @@ function insertEscapedCodePoint(e, n, t) {
|
|
|
716
719
|
}(a || (a = {})), function(e) {
|
|
717
720
|
e.Unrestricted = "unrestricted", e.ID = "id";
|
|
718
721
|
}(d || (d = {}));
|
|
719
|
-
const
|
|
722
|
+
const l = Object.values(u);
|
|
720
723
|
function isToken(e) {
|
|
721
|
-
return !!Array.isArray(e) && !(e.length < 4) && !!
|
|
724
|
+
return !!Array.isArray(e) && !(e.length < 4) && !!l.includes(e[0]) && "string" == typeof e[1] && "number" == typeof e[2] && "number" == typeof e[3];
|
|
722
725
|
}
|
|
723
726
|
function isTokenNumeric(e) {
|
|
724
727
|
if (!e) return !1;
|