weapp-tailwindcss 5.0.0-next.24 → 5.0.0-next.26
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/auto-CqyEtds4.js +115 -0
- package/dist/auto-CsWz6lsU.mjs +78 -0
- package/dist/{bundle-state-CP_BWXfx.mjs → bundle-state-CWcrb3mH.mjs} +1 -2
- package/dist/{bundle-state-DXFq2nEo.js → bundle-state-uCtqRm0p.js} +2 -3
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/cli.js +167 -6
- package/dist/cli.mjs +166 -5
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +10 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -47
- package/dist/css-macro/postcss.mjs +2 -47
- package/dist/css-macro.js +15 -6
- package/dist/css-macro.mjs +15 -6
- package/dist/{defaults-C6sIKXgC.mjs → defaults-B-1EEhdL.mjs} +2 -1
- package/dist/{defaults-D3cFX6Cq.js → defaults-C10hYUch.js} +2 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-BcH28HU-.js → generator-BH6a0xuB.js} +1 -1
- package/dist/{generator-DdEgn8nG.mjs → generator-iI_265gt.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-Bux7viee.mjs → incremental-runtime-class-set-ECHyKwUL.mjs} +4 -16
- package/dist/{incremental-runtime-class-set-CWdfLHON.js → incremental-runtime-class-set-mY0v1k-Y.js} +4 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -4
- package/dist/index.mjs +6 -5
- package/dist/postcss-BwW8zO24.js +192 -0
- package/dist/postcss-BzaRjBL0.mjs +169 -0
- package/dist/{postcss-cD5PXmMU.js → postcss-DEEAZ8J5.js} +2 -2
- package/dist/{postcss-nk5bhdoV.mjs → postcss-DJoU--Z-.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BI8oBeUg.mjs +4692 -0
- package/dist/{precheck-DtYqujIx.js → precheck-DLJg0_pu.js} +2070 -34
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +19 -5
- package/dist/presets.mjs +18 -6
- package/dist/{source-candidates-B7wmEa-G.mjs → source-candidates-DkScNh9A.mjs} +1 -1
- package/dist/{source-candidates-lHtAHLQq.js → source-candidates-mfvC9gMc.js} +1 -1
- package/dist/{tailwindcss-BtUBeOes.js → tailwindcss-Cm93idme.js} +17 -26
- package/dist/{tailwindcss-DO-VVR5k.mjs → tailwindcss-DFa5Yes8.mjs} +17 -26
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +2 -1
- package/dist/types/user-defined-options/important.d.ts +3 -1
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{v3-engine-vHlppqaZ.js → v3-engine-CGsbY81C.js} +67 -19
- package/dist/{v3-engine-CXqgQZUc.mjs → v3-engine-CPJ9uGyr.mjs} +56 -20
- package/dist/{vite-BkNDGBZ2.js → vite-BM_ksf1q.js} +140 -21
- package/dist/{vite-BthAm8kt.mjs → vite-CqEF-Wx5.mjs} +140 -21
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +327 -73
- package/dist/weapp-tw-runtime-classset-loader.js +1 -4
- package/dist/{webpack-prCus5xn.js → webpack-CfcuDhQ8.js} +10 -7
- package/dist/{webpack-hPc8wUAi.mjs → webpack-D--XZMBB.mjs} +11 -8
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +14 -14
- package/dist/constants-BG12WAKw.mjs +0 -44
- package/dist/constants-BeeyfJ9k.js +0 -73
- package/dist/precheck-DreRGvYH.mjs +0 -2668
- /package/dist/{logger-EVNB9z7i.js → logger-Cdzl3p8j.js} +0 -0
- /package/dist/{logger-CZUxvJJD.mjs → logger-Dr7IvyH2.mjs} +0 -0
- /package/dist/{utils-CGBVVNm6.mjs → utils-B2SJgA1L.mjs} +0 -0
- /package/dist/{utils-4ODFyoqD.js → utils-CSA174-I.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_defaults = require("./defaults-
|
|
4
|
-
require("./utils-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
3
|
+
const require_defaults = require("./defaults-C10hYUch.js");
|
|
4
|
+
require("./utils-CSA174-I.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-Cm93idme.js");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_chunk.__toESM(node_path);
|
|
8
8
|
let node_process = require("node:process");
|
|
@@ -17,14 +17,12 @@ let _weapp_core_escape = require("@weapp-core/escape");
|
|
|
17
17
|
let _babel_traverse = require("@babel/traverse");
|
|
18
18
|
_babel_traverse = require_chunk.__toESM(_babel_traverse);
|
|
19
19
|
let _babel_parser = require("@babel/parser");
|
|
20
|
-
let _weapp_core_regex = require("@weapp-core/regex");
|
|
21
20
|
let magic_string = require("magic-string");
|
|
22
21
|
magic_string = require_chunk.__toESM(magic_string);
|
|
23
22
|
let _ast_core_escape = require("@ast-core/escape");
|
|
24
23
|
let _weapp_tailwindcss_shared_extractors = require("@weapp-tailwindcss/shared/extractors");
|
|
25
24
|
let _babel_types = require("@babel/types");
|
|
26
25
|
_babel_types = require_chunk.__toESM(_babel_types);
|
|
27
|
-
let htmlparser2 = require("htmlparser2");
|
|
28
26
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
29
27
|
//#region src/cache/index.ts
|
|
30
28
|
function isProcessResult(value) {
|
|
@@ -352,6 +350,23 @@ function logTailwindcssTarget(patcher, baseDir) {
|
|
|
352
350
|
_weapp_tailwindcss_logger.logger.debug("%s 解析 Tailwind CSS -> %s%s", label, displayPath, version);
|
|
353
351
|
}
|
|
354
352
|
//#endregion
|
|
353
|
+
//#region src/unocss/index.ts
|
|
354
|
+
function normalizeUnocssOptions(unocss) {
|
|
355
|
+
return require_v3_engine.resolveBooleanObjectOption(unocss, {});
|
|
356
|
+
}
|
|
357
|
+
function resolveUnocssBareArbitraryValues(arbitraryValues, unocss) {
|
|
358
|
+
const baseArbitraryValues = arbitraryValues ?? {};
|
|
359
|
+
const options = normalizeUnocssOptions(unocss);
|
|
360
|
+
if (!options) return baseArbitraryValues;
|
|
361
|
+
if (baseArbitraryValues.bareArbitraryValues !== void 0 && baseArbitraryValues.bareArbitraryValues !== false) return baseArbitraryValues;
|
|
362
|
+
const bareArbitraryValues = options.bareArbitraryValues ?? true;
|
|
363
|
+
if (bareArbitraryValues === false) return baseArbitraryValues;
|
|
364
|
+
return {
|
|
365
|
+
...baseArbitraryValues,
|
|
366
|
+
bareArbitraryValues
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
355
370
|
//#region src/context/compiler-context-cache.ts
|
|
356
371
|
const PAREN_CONTENT_RE = /\(([^)]+)\)/u;
|
|
357
372
|
const AT_LOCATION_RE = /at\s+(\S.*)$/u;
|
|
@@ -554,21 +569,18 @@ function toCustomAttributesEntities(customAttributes) {
|
|
|
554
569
|
return Object.entries(customAttributes);
|
|
555
570
|
}
|
|
556
571
|
//#endregion
|
|
557
|
-
//#region src/constants.ts
|
|
558
|
-
const pluginName = "weapp-tailwindcss";
|
|
559
|
-
const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
560
|
-
const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
561
|
-
"tailwind-merge": "@weapp-tailwindcss/merge",
|
|
562
|
-
"class-variance-authority": "@weapp-tailwindcss/cva",
|
|
563
|
-
"tailwind-variants": "@weapp-tailwindcss/variants"
|
|
564
|
-
};
|
|
565
|
-
//#endregion
|
|
566
572
|
//#region src/babel/index.ts
|
|
567
573
|
function _interopDefaultCompat(e) {
|
|
568
574
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
569
575
|
}
|
|
570
576
|
const traverse = _interopDefaultCompat(_babel_traverse.default);
|
|
571
577
|
//#endregion
|
|
578
|
+
//#region src/utils/regex.ts
|
|
579
|
+
function escapeStringRegexp(str) {
|
|
580
|
+
if (typeof str !== "string") throw new TypeError("Expected a string");
|
|
581
|
+
return str.replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&").replaceAll("-", "\\x2d");
|
|
582
|
+
}
|
|
583
|
+
//#endregion
|
|
572
584
|
//#region src/utils/nameMatcher.ts
|
|
573
585
|
const NEVER_MATCH_NAME$1 = () => false;
|
|
574
586
|
const GLOBAL_FLAG_REGEXP = /g/g;
|
|
@@ -580,7 +592,7 @@ function buildFuzzyMatcher(fuzzyStrings) {
|
|
|
580
592
|
return (value) => value.includes(needle);
|
|
581
593
|
}
|
|
582
594
|
const unique = [...new Set(fuzzyStrings)];
|
|
583
|
-
const pattern = new RegExp(unique.map(
|
|
595
|
+
const pattern = new RegExp(unique.map(escapeStringRegexp).join("|"));
|
|
584
596
|
return (value) => pattern.test(value);
|
|
585
597
|
}
|
|
586
598
|
function normaliseRegex(regex) {
|
|
@@ -2220,6 +2232,1994 @@ function generateCode(match, options = {}) {
|
|
|
2220
2232
|
}
|
|
2221
2233
|
}
|
|
2222
2234
|
//#endregion
|
|
2235
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode-codepoint.js
|
|
2236
|
+
const decodeMap = new Map([
|
|
2237
|
+
[0, 65533],
|
|
2238
|
+
[128, 8364],
|
|
2239
|
+
[130, 8218],
|
|
2240
|
+
[131, 402],
|
|
2241
|
+
[132, 8222],
|
|
2242
|
+
[133, 8230],
|
|
2243
|
+
[134, 8224],
|
|
2244
|
+
[135, 8225],
|
|
2245
|
+
[136, 710],
|
|
2246
|
+
[137, 8240],
|
|
2247
|
+
[138, 352],
|
|
2248
|
+
[139, 8249],
|
|
2249
|
+
[140, 338],
|
|
2250
|
+
[142, 381],
|
|
2251
|
+
[145, 8216],
|
|
2252
|
+
[146, 8217],
|
|
2253
|
+
[147, 8220],
|
|
2254
|
+
[148, 8221],
|
|
2255
|
+
[149, 8226],
|
|
2256
|
+
[150, 8211],
|
|
2257
|
+
[151, 8212],
|
|
2258
|
+
[152, 732],
|
|
2259
|
+
[153, 8482],
|
|
2260
|
+
[154, 353],
|
|
2261
|
+
[155, 8250],
|
|
2262
|
+
[156, 339],
|
|
2263
|
+
[158, 382],
|
|
2264
|
+
[159, 376]
|
|
2265
|
+
]);
|
|
2266
|
+
/**
|
|
2267
|
+
* Replace the given code point with a replacement character if it is a
|
|
2268
|
+
* surrogate or is outside the valid range. Otherwise return the code
|
|
2269
|
+
* point unchanged.
|
|
2270
|
+
* @param codePoint Unicode code point to convert.
|
|
2271
|
+
*/
|
|
2272
|
+
function replaceCodePoint(codePoint) {
|
|
2273
|
+
if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) return 65533;
|
|
2274
|
+
return decodeMap.get(codePoint) ?? codePoint;
|
|
2275
|
+
}
|
|
2276
|
+
//#endregion
|
|
2277
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/decode-shared.js
|
|
2278
|
+
/**
|
|
2279
|
+
* Shared base64 decode helper for generated decode data.
|
|
2280
|
+
* Assumes global atob is available.
|
|
2281
|
+
* @param input Input string to encode or decode.
|
|
2282
|
+
*/
|
|
2283
|
+
function decodeBase64(input) {
|
|
2284
|
+
const binary = atob(input);
|
|
2285
|
+
const evenLength = binary.length & -2;
|
|
2286
|
+
const out = new Uint16Array(evenLength / 2);
|
|
2287
|
+
for (let index = 0, outIndex = 0; index < evenLength; index += 2) {
|
|
2288
|
+
const lo = binary.charCodeAt(index);
|
|
2289
|
+
const hi = binary.charCodeAt(index + 1);
|
|
2290
|
+
out[outIndex++] = lo | hi << 8;
|
|
2291
|
+
}
|
|
2292
|
+
return out;
|
|
2293
|
+
}
|
|
2294
|
+
//#endregion
|
|
2295
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-html.js
|
|
2296
|
+
/** Packed HTML decode trie data. */
|
|
2297
|
+
const htmlDecodeTree = /* @__PURE__ */ decodeBase64("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12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QB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg");
|
|
2298
|
+
//#endregion
|
|
2299
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/generated/decode-data-xml.js
|
|
2300
|
+
/** Packed XML decode trie data. */
|
|
2301
|
+
const xmlDecodeTree = /* @__PURE__ */ decodeBase64("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");
|
|
2302
|
+
//#endregion
|
|
2303
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/internal/bin-trie-flags.js
|
|
2304
|
+
/**
|
|
2305
|
+
* Bit flags & masks for the binary trie encoding used for entity decoding.
|
|
2306
|
+
*
|
|
2307
|
+
* Bit layout (16 bits total):
|
|
2308
|
+
* 15..14 VALUE_LENGTH (+1 encoding; 0 => no value)
|
|
2309
|
+
* 13 FLAG13. If valueLength>0: semicolon required flag (implicit ';').
|
|
2310
|
+
* If valueLength==0: compact run flag.
|
|
2311
|
+
* 12..7 BRANCH_LENGTH Branch length (0 => single branch in 6..0 if jumpOffset==char) OR run length (when compact run)
|
|
2312
|
+
* 6..0 JUMP_TABLE Jump offset (jump table) OR single-branch char code OR first run char
|
|
2313
|
+
*/
|
|
2314
|
+
var BinTrieFlags;
|
|
2315
|
+
(function(BinTrieFlags) {
|
|
2316
|
+
BinTrieFlags[BinTrieFlags["VALUE_LENGTH"] = 49152] = "VALUE_LENGTH";
|
|
2317
|
+
BinTrieFlags[BinTrieFlags["FLAG13"] = 8192] = "FLAG13";
|
|
2318
|
+
BinTrieFlags[BinTrieFlags["BRANCH_LENGTH"] = 8064] = "BRANCH_LENGTH";
|
|
2319
|
+
BinTrieFlags[BinTrieFlags["JUMP_TABLE"] = 127] = "JUMP_TABLE";
|
|
2320
|
+
})(BinTrieFlags || (BinTrieFlags = {}));
|
|
2321
|
+
//#endregion
|
|
2322
|
+
//#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode.js
|
|
2323
|
+
var CharCodes$1;
|
|
2324
|
+
(function(CharCodes) {
|
|
2325
|
+
CharCodes[CharCodes["NUM"] = 35] = "NUM";
|
|
2326
|
+
CharCodes[CharCodes["SEMI"] = 59] = "SEMI";
|
|
2327
|
+
CharCodes[CharCodes["EQUALS"] = 61] = "EQUALS";
|
|
2328
|
+
CharCodes[CharCodes["ZERO"] = 48] = "ZERO";
|
|
2329
|
+
CharCodes[CharCodes["NINE"] = 57] = "NINE";
|
|
2330
|
+
CharCodes[CharCodes["LOWER_A"] = 97] = "LOWER_A";
|
|
2331
|
+
CharCodes[CharCodes["LOWER_F"] = 102] = "LOWER_F";
|
|
2332
|
+
CharCodes[CharCodes["LOWER_X"] = 120] = "LOWER_X";
|
|
2333
|
+
CharCodes[CharCodes["LOWER_Z"] = 122] = "LOWER_Z";
|
|
2334
|
+
CharCodes[CharCodes["UPPER_A"] = 65] = "UPPER_A";
|
|
2335
|
+
CharCodes[CharCodes["UPPER_F"] = 70] = "UPPER_F";
|
|
2336
|
+
CharCodes[CharCodes["UPPER_Z"] = 90] = "UPPER_Z";
|
|
2337
|
+
})(CharCodes$1 || (CharCodes$1 = {}));
|
|
2338
|
+
/** Bit that needs to be set to convert an upper case ASCII character to lower case */
|
|
2339
|
+
const TO_LOWER_BIT = 32;
|
|
2340
|
+
function isNumber(code) {
|
|
2341
|
+
return code >= CharCodes$1.ZERO && code <= CharCodes$1.NINE;
|
|
2342
|
+
}
|
|
2343
|
+
function isHexadecimalCharacter(code) {
|
|
2344
|
+
return code >= CharCodes$1.UPPER_A && code <= CharCodes$1.UPPER_F || code >= CharCodes$1.LOWER_A && code <= CharCodes$1.LOWER_F;
|
|
2345
|
+
}
|
|
2346
|
+
function isAsciiAlphaNumeric(code) {
|
|
2347
|
+
return code >= CharCodes$1.UPPER_A && code <= CharCodes$1.UPPER_Z || code >= CharCodes$1.LOWER_A && code <= CharCodes$1.LOWER_Z || isNumber(code);
|
|
2348
|
+
}
|
|
2349
|
+
/**
|
|
2350
|
+
* Checks if the given character is a valid end character for an entity in an attribute.
|
|
2351
|
+
*
|
|
2352
|
+
* Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
|
|
2353
|
+
* See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
|
|
2354
|
+
* @param code Code point to decode.
|
|
2355
|
+
*/
|
|
2356
|
+
function isEntityInAttributeInvalidEnd(code) {
|
|
2357
|
+
return code === CharCodes$1.EQUALS || isAsciiAlphaNumeric(code);
|
|
2358
|
+
}
|
|
2359
|
+
var EntityDecoderState;
|
|
2360
|
+
(function(EntityDecoderState) {
|
|
2361
|
+
EntityDecoderState[EntityDecoderState["EntityStart"] = 0] = "EntityStart";
|
|
2362
|
+
EntityDecoderState[EntityDecoderState["NumericStart"] = 1] = "NumericStart";
|
|
2363
|
+
EntityDecoderState[EntityDecoderState["NumericDecimal"] = 2] = "NumericDecimal";
|
|
2364
|
+
EntityDecoderState[EntityDecoderState["NumericHex"] = 3] = "NumericHex";
|
|
2365
|
+
EntityDecoderState[EntityDecoderState["NamedEntity"] = 4] = "NamedEntity";
|
|
2366
|
+
})(EntityDecoderState || (EntityDecoderState = {}));
|
|
2367
|
+
/**
|
|
2368
|
+
* Decoding mode for named entities.
|
|
2369
|
+
*/
|
|
2370
|
+
var DecodingMode;
|
|
2371
|
+
(function(DecodingMode) {
|
|
2372
|
+
/** Entities in text nodes that can end with any character. */
|
|
2373
|
+
DecodingMode[DecodingMode["Legacy"] = 0] = "Legacy";
|
|
2374
|
+
/** Only allow entities terminated with a semicolon. */
|
|
2375
|
+
DecodingMode[DecodingMode["Strict"] = 1] = "Strict";
|
|
2376
|
+
/** Entities in attributes have limitations on ending characters. */
|
|
2377
|
+
DecodingMode[DecodingMode["Attribute"] = 2] = "Attribute";
|
|
2378
|
+
})(DecodingMode || (DecodingMode = {}));
|
|
2379
|
+
/**
|
|
2380
|
+
* Token decoder with support of writing partial entities.
|
|
2381
|
+
*/
|
|
2382
|
+
var EntityDecoder = class {
|
|
2383
|
+
constructor(decodeTree, emitCodePoint, errors) {
|
|
2384
|
+
_defineProperty(this, "decodeTree", void 0);
|
|
2385
|
+
_defineProperty(this, "emitCodePoint", void 0);
|
|
2386
|
+
_defineProperty(this, "errors", void 0);
|
|
2387
|
+
_defineProperty(
|
|
2388
|
+
this,
|
|
2389
|
+
/** The current state of the decoder. */
|
|
2390
|
+
"state",
|
|
2391
|
+
EntityDecoderState.EntityStart
|
|
2392
|
+
);
|
|
2393
|
+
_defineProperty(
|
|
2394
|
+
this,
|
|
2395
|
+
/** Characters that were consumed while parsing an entity. */
|
|
2396
|
+
"consumed",
|
|
2397
|
+
1
|
|
2398
|
+
);
|
|
2399
|
+
_defineProperty(
|
|
2400
|
+
this,
|
|
2401
|
+
/**
|
|
2402
|
+
* The result of the entity.
|
|
2403
|
+
*
|
|
2404
|
+
* Either the result index of a numeric entity, or the codepoint of a
|
|
2405
|
+
* numeric entity.
|
|
2406
|
+
*/
|
|
2407
|
+
"result",
|
|
2408
|
+
0
|
|
2409
|
+
);
|
|
2410
|
+
_defineProperty(
|
|
2411
|
+
this,
|
|
2412
|
+
/** The current index in the decode tree. */
|
|
2413
|
+
"treeIndex",
|
|
2414
|
+
0
|
|
2415
|
+
);
|
|
2416
|
+
_defineProperty(
|
|
2417
|
+
this,
|
|
2418
|
+
/** The number of characters that were consumed in excess. */
|
|
2419
|
+
"excess",
|
|
2420
|
+
1
|
|
2421
|
+
);
|
|
2422
|
+
_defineProperty(
|
|
2423
|
+
this,
|
|
2424
|
+
/** The mode in which the decoder is operating. */
|
|
2425
|
+
"decodeMode",
|
|
2426
|
+
DecodingMode.Strict
|
|
2427
|
+
);
|
|
2428
|
+
_defineProperty(
|
|
2429
|
+
this,
|
|
2430
|
+
/** The number of characters that have been consumed in the current run. */
|
|
2431
|
+
"runConsumed",
|
|
2432
|
+
0
|
|
2433
|
+
);
|
|
2434
|
+
this.decodeTree = decodeTree;
|
|
2435
|
+
this.emitCodePoint = emitCodePoint;
|
|
2436
|
+
this.errors = errors;
|
|
2437
|
+
}
|
|
2438
|
+
/**
|
|
2439
|
+
* Resets the instance to make it reusable.
|
|
2440
|
+
* @param decodeMode Entity decoding mode to use.
|
|
2441
|
+
*/
|
|
2442
|
+
startEntity(decodeMode) {
|
|
2443
|
+
this.decodeMode = decodeMode;
|
|
2444
|
+
this.state = EntityDecoderState.EntityStart;
|
|
2445
|
+
this.result = 0;
|
|
2446
|
+
this.treeIndex = 0;
|
|
2447
|
+
this.excess = 1;
|
|
2448
|
+
this.consumed = 1;
|
|
2449
|
+
this.runConsumed = 0;
|
|
2450
|
+
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Write an entity to the decoder. This can be called multiple times with partial entities.
|
|
2453
|
+
* If the entity is incomplete, the decoder will return -1.
|
|
2454
|
+
*
|
|
2455
|
+
* Mirrors the implementation of `getDecoder`, but with the ability to stop decoding if the
|
|
2456
|
+
* entity is incomplete, and resume when the next string is written.
|
|
2457
|
+
* @param input The string containing the entity (or a continuation of the entity).
|
|
2458
|
+
* @param offset The offset at which the entity begins. Should be 0 if this is not the first call.
|
|
2459
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
2460
|
+
*/
|
|
2461
|
+
write(input, offset) {
|
|
2462
|
+
switch (this.state) {
|
|
2463
|
+
case EntityDecoderState.EntityStart:
|
|
2464
|
+
if (input.charCodeAt(offset) === CharCodes$1.NUM) {
|
|
2465
|
+
this.state = EntityDecoderState.NumericStart;
|
|
2466
|
+
this.consumed += 1;
|
|
2467
|
+
return this.stateNumericStart(input, offset + 1);
|
|
2468
|
+
}
|
|
2469
|
+
this.state = EntityDecoderState.NamedEntity;
|
|
2470
|
+
return this.stateNamedEntity(input, offset);
|
|
2471
|
+
case EntityDecoderState.NumericStart: return this.stateNumericStart(input, offset);
|
|
2472
|
+
case EntityDecoderState.NumericDecimal: return this.stateNumericDecimal(input, offset);
|
|
2473
|
+
case EntityDecoderState.NumericHex: return this.stateNumericHex(input, offset);
|
|
2474
|
+
case EntityDecoderState.NamedEntity: return this.stateNamedEntity(input, offset);
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Switches between the numeric decimal and hexadecimal states.
|
|
2479
|
+
*
|
|
2480
|
+
* Equivalent to the `Numeric character reference state` in the HTML spec.
|
|
2481
|
+
* @param input The string containing the entity (or a continuation of the entity).
|
|
2482
|
+
* @param offset The current offset.
|
|
2483
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
2484
|
+
*/
|
|
2485
|
+
stateNumericStart(input, offset) {
|
|
2486
|
+
if (offset >= input.length) return -1;
|
|
2487
|
+
if ((input.charCodeAt(offset) | TO_LOWER_BIT) === CharCodes$1.LOWER_X) {
|
|
2488
|
+
this.state = EntityDecoderState.NumericHex;
|
|
2489
|
+
this.consumed += 1;
|
|
2490
|
+
return this.stateNumericHex(input, offset + 1);
|
|
2491
|
+
}
|
|
2492
|
+
this.state = EntityDecoderState.NumericDecimal;
|
|
2493
|
+
return this.stateNumericDecimal(input, offset);
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Parses a hexadecimal numeric entity.
|
|
2497
|
+
*
|
|
2498
|
+
* Equivalent to the `Hexademical character reference state` in the HTML spec.
|
|
2499
|
+
* @param input The string containing the entity (or a continuation of the entity).
|
|
2500
|
+
* @param offset The current offset.
|
|
2501
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
2502
|
+
*/
|
|
2503
|
+
stateNumericHex(input, offset) {
|
|
2504
|
+
while (offset < input.length) {
|
|
2505
|
+
const char = input.charCodeAt(offset);
|
|
2506
|
+
if (isNumber(char) || isHexadecimalCharacter(char)) {
|
|
2507
|
+
const digit = char <= CharCodes$1.NINE ? char - CharCodes$1.ZERO : (char | TO_LOWER_BIT) - CharCodes$1.LOWER_A + 10;
|
|
2508
|
+
this.result = this.result * 16 + digit;
|
|
2509
|
+
this.consumed++;
|
|
2510
|
+
offset++;
|
|
2511
|
+
} else return this.emitNumericEntity(char, 3);
|
|
2512
|
+
}
|
|
2513
|
+
return -1;
|
|
2514
|
+
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Parses a decimal numeric entity.
|
|
2517
|
+
*
|
|
2518
|
+
* Equivalent to the `Decimal character reference state` in the HTML spec.
|
|
2519
|
+
* @param input The string containing the entity (or a continuation of the entity).
|
|
2520
|
+
* @param offset The current offset.
|
|
2521
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
2522
|
+
*/
|
|
2523
|
+
stateNumericDecimal(input, offset) {
|
|
2524
|
+
while (offset < input.length) {
|
|
2525
|
+
const char = input.charCodeAt(offset);
|
|
2526
|
+
if (isNumber(char)) {
|
|
2527
|
+
this.result = this.result * 10 + (char - CharCodes$1.ZERO);
|
|
2528
|
+
this.consumed++;
|
|
2529
|
+
offset++;
|
|
2530
|
+
} else return this.emitNumericEntity(char, 2);
|
|
2531
|
+
}
|
|
2532
|
+
return -1;
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Validate and emit a numeric entity.
|
|
2536
|
+
*
|
|
2537
|
+
* Implements the logic from the `Hexademical character reference start
|
|
2538
|
+
* state` and `Numeric character reference end state` in the HTML spec.
|
|
2539
|
+
* @param lastCp The last code point of the entity. Used to see if the
|
|
2540
|
+
* entity was terminated with a semicolon.
|
|
2541
|
+
* @param expectedLength The minimum number of characters that should be
|
|
2542
|
+
* consumed. Used to validate that at least one digit
|
|
2543
|
+
* was consumed.
|
|
2544
|
+
* @returns The number of characters that were consumed.
|
|
2545
|
+
*/
|
|
2546
|
+
emitNumericEntity(lastCp, expectedLength) {
|
|
2547
|
+
if (this.consumed <= expectedLength) {
|
|
2548
|
+
this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
2549
|
+
return 0;
|
|
2550
|
+
}
|
|
2551
|
+
if (lastCp === CharCodes$1.SEMI) this.consumed += 1;
|
|
2552
|
+
else if (this.decodeMode === DecodingMode.Strict) return 0;
|
|
2553
|
+
this.emitCodePoint(replaceCodePoint(this.result), this.consumed);
|
|
2554
|
+
if (this.errors) {
|
|
2555
|
+
if (lastCp !== CharCodes$1.SEMI) this.errors.missingSemicolonAfterCharacterReference();
|
|
2556
|
+
this.errors.validateNumericCharacterReference(this.result);
|
|
2557
|
+
}
|
|
2558
|
+
return this.consumed;
|
|
2559
|
+
}
|
|
2560
|
+
/**
|
|
2561
|
+
* Parses a named entity.
|
|
2562
|
+
*
|
|
2563
|
+
* Equivalent to the `Named character reference state` in the HTML spec.
|
|
2564
|
+
* @param input The string containing the entity (or a continuation of the entity).
|
|
2565
|
+
* @param offset The current offset.
|
|
2566
|
+
* @returns The number of characters that were consumed, or -1 if the entity is incomplete.
|
|
2567
|
+
*/
|
|
2568
|
+
stateNamedEntity(input, offset) {
|
|
2569
|
+
const { decodeTree } = this;
|
|
2570
|
+
let current = decodeTree[this.treeIndex];
|
|
2571
|
+
let valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
2572
|
+
while (offset < input.length) {
|
|
2573
|
+
if (valueLength === 0 && (current & BinTrieFlags.FLAG13) !== 0) {
|
|
2574
|
+
const runLength = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
|
|
2575
|
+
if (this.runConsumed === 0) {
|
|
2576
|
+
const firstChar = current & BinTrieFlags.JUMP_TABLE;
|
|
2577
|
+
if (input.charCodeAt(offset) !== firstChar) return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
|
|
2578
|
+
offset++;
|
|
2579
|
+
this.excess++;
|
|
2580
|
+
this.runConsumed++;
|
|
2581
|
+
}
|
|
2582
|
+
while (this.runConsumed < runLength) {
|
|
2583
|
+
if (offset >= input.length) return -1;
|
|
2584
|
+
const charIndexInPacked = this.runConsumed - 1;
|
|
2585
|
+
const packedWord = decodeTree[this.treeIndex + 1 + (charIndexInPacked >> 1)];
|
|
2586
|
+
const expectedChar = charIndexInPacked % 2 === 0 ? packedWord & 255 : packedWord >> 8 & 255;
|
|
2587
|
+
if (input.charCodeAt(offset) !== expectedChar) {
|
|
2588
|
+
this.runConsumed = 0;
|
|
2589
|
+
return this.result === 0 ? 0 : this.emitNotTerminatedNamedEntity();
|
|
2590
|
+
}
|
|
2591
|
+
offset++;
|
|
2592
|
+
this.excess++;
|
|
2593
|
+
this.runConsumed++;
|
|
2594
|
+
}
|
|
2595
|
+
this.runConsumed = 0;
|
|
2596
|
+
this.treeIndex += 1 + (runLength >> 1);
|
|
2597
|
+
current = decodeTree[this.treeIndex];
|
|
2598
|
+
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
2599
|
+
}
|
|
2600
|
+
if (offset >= input.length) break;
|
|
2601
|
+
const char = input.charCodeAt(offset);
|
|
2602
|
+
if (char === CharCodes$1.SEMI && valueLength !== 0 && (current & BinTrieFlags.FLAG13) !== 0) return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
|
2603
|
+
this.treeIndex = determineBranch(decodeTree, current, this.treeIndex + Math.max(1, valueLength), char);
|
|
2604
|
+
if (this.treeIndex < 0) return this.result === 0 || this.decodeMode === DecodingMode.Attribute && (valueLength === 0 || isEntityInAttributeInvalidEnd(char)) ? 0 : this.emitNotTerminatedNamedEntity();
|
|
2605
|
+
current = decodeTree[this.treeIndex];
|
|
2606
|
+
valueLength = (current & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
2607
|
+
if (valueLength !== 0) {
|
|
2608
|
+
if (char === CharCodes$1.SEMI) return this.emitNamedEntityData(this.treeIndex, valueLength, this.consumed + this.excess);
|
|
2609
|
+
if (this.decodeMode !== DecodingMode.Strict && (current & BinTrieFlags.FLAG13) === 0) {
|
|
2610
|
+
this.result = this.treeIndex;
|
|
2611
|
+
this.consumed += this.excess;
|
|
2612
|
+
this.excess = 0;
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
offset++;
|
|
2616
|
+
this.excess++;
|
|
2617
|
+
}
|
|
2618
|
+
return -1;
|
|
2619
|
+
}
|
|
2620
|
+
/**
|
|
2621
|
+
* Emit a named entity that was not terminated with a semicolon.
|
|
2622
|
+
* @returns The number of characters consumed.
|
|
2623
|
+
*/
|
|
2624
|
+
emitNotTerminatedNamedEntity() {
|
|
2625
|
+
const { result, decodeTree } = this;
|
|
2626
|
+
const valueLength = (decodeTree[result] & BinTrieFlags.VALUE_LENGTH) >> 14;
|
|
2627
|
+
this.emitNamedEntityData(result, valueLength, this.consumed);
|
|
2628
|
+
this.errors?.missingSemicolonAfterCharacterReference();
|
|
2629
|
+
return this.consumed;
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Emit a named entity.
|
|
2633
|
+
* @param result The index of the entity in the decode tree.
|
|
2634
|
+
* @param valueLength The number of bytes in the entity.
|
|
2635
|
+
* @param consumed The number of characters consumed.
|
|
2636
|
+
* @returns The number of characters consumed.
|
|
2637
|
+
*/
|
|
2638
|
+
emitNamedEntityData(result, valueLength, consumed) {
|
|
2639
|
+
const { decodeTree } = this;
|
|
2640
|
+
this.emitCodePoint(valueLength === 1 ? decodeTree[result] & ~(BinTrieFlags.VALUE_LENGTH | BinTrieFlags.FLAG13) : decodeTree[result + 1], consumed);
|
|
2641
|
+
if (valueLength === 3) this.emitCodePoint(decodeTree[result + 2], consumed);
|
|
2642
|
+
return consumed;
|
|
2643
|
+
}
|
|
2644
|
+
/**
|
|
2645
|
+
* Signal to the parser that the end of the input was reached.
|
|
2646
|
+
*
|
|
2647
|
+
* Remaining data will be emitted and relevant errors will be produced.
|
|
2648
|
+
* @returns The number of characters consumed.
|
|
2649
|
+
*/
|
|
2650
|
+
end() {
|
|
2651
|
+
switch (this.state) {
|
|
2652
|
+
case EntityDecoderState.NamedEntity: return this.result !== 0 && (this.decodeMode !== DecodingMode.Attribute || this.result === this.treeIndex) ? this.emitNotTerminatedNamedEntity() : 0;
|
|
2653
|
+
case EntityDecoderState.NumericDecimal: return this.emitNumericEntity(0, 2);
|
|
2654
|
+
case EntityDecoderState.NumericHex: return this.emitNumericEntity(0, 3);
|
|
2655
|
+
case EntityDecoderState.NumericStart:
|
|
2656
|
+
this.errors?.absenceOfDigitsInNumericCharacterReference(this.consumed);
|
|
2657
|
+
return 0;
|
|
2658
|
+
case EntityDecoderState.EntityStart: return 0;
|
|
2659
|
+
}
|
|
2660
|
+
}
|
|
2661
|
+
};
|
|
2662
|
+
/**
|
|
2663
|
+
* Determines the branch of the current node that is taken given the current
|
|
2664
|
+
* character. This function is used to traverse the trie.
|
|
2665
|
+
* @param decodeTree The trie.
|
|
2666
|
+
* @param current The current node.
|
|
2667
|
+
* @param nodeIndex Index immediately after the current node header.
|
|
2668
|
+
* @param char The current character.
|
|
2669
|
+
* @returns The index of the next node, or -1 if no branch is taken.
|
|
2670
|
+
*/
|
|
2671
|
+
function determineBranch(decodeTree, current, nodeIndex, char) {
|
|
2672
|
+
const branchCount = (current & BinTrieFlags.BRANCH_LENGTH) >> 7;
|
|
2673
|
+
const jumpOffset = current & BinTrieFlags.JUMP_TABLE;
|
|
2674
|
+
if (branchCount === 0) return jumpOffset !== 0 && char === jumpOffset ? nodeIndex : -1;
|
|
2675
|
+
if (jumpOffset) {
|
|
2676
|
+
const value = char - jumpOffset;
|
|
2677
|
+
return value < 0 || value >= branchCount ? -1 : decodeTree[nodeIndex + value] - 1;
|
|
2678
|
+
}
|
|
2679
|
+
const packedKeySlots = branchCount + 1 >> 1;
|
|
2680
|
+
let lo = 0;
|
|
2681
|
+
let hi = branchCount - 1;
|
|
2682
|
+
while (lo <= hi) {
|
|
2683
|
+
const mid = lo + hi >>> 1;
|
|
2684
|
+
const midKey = decodeTree[nodeIndex + (mid >> 1)] >> (mid & 1) * 8 & 255;
|
|
2685
|
+
if (midKey < char) lo = mid + 1;
|
|
2686
|
+
else if (midKey > char) hi = mid - 1;
|
|
2687
|
+
else return decodeTree[nodeIndex + packedKeySlots + mid];
|
|
2688
|
+
}
|
|
2689
|
+
return -1;
|
|
2690
|
+
}
|
|
2691
|
+
//#endregion
|
|
2692
|
+
//#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Tokenizer.js
|
|
2693
|
+
var CharCodes;
|
|
2694
|
+
(function(CharCodes) {
|
|
2695
|
+
CharCodes[CharCodes["Tab"] = 9] = "Tab";
|
|
2696
|
+
CharCodes[CharCodes["NewLine"] = 10] = "NewLine";
|
|
2697
|
+
CharCodes[CharCodes["FormFeed"] = 12] = "FormFeed";
|
|
2698
|
+
CharCodes[CharCodes["CarriageReturn"] = 13] = "CarriageReturn";
|
|
2699
|
+
CharCodes[CharCodes["Space"] = 32] = "Space";
|
|
2700
|
+
CharCodes[CharCodes["ExclamationMark"] = 33] = "ExclamationMark";
|
|
2701
|
+
CharCodes[CharCodes["Number"] = 35] = "Number";
|
|
2702
|
+
CharCodes[CharCodes["Amp"] = 38] = "Amp";
|
|
2703
|
+
CharCodes[CharCodes["SingleQuote"] = 39] = "SingleQuote";
|
|
2704
|
+
CharCodes[CharCodes["DoubleQuote"] = 34] = "DoubleQuote";
|
|
2705
|
+
CharCodes[CharCodes["Dash"] = 45] = "Dash";
|
|
2706
|
+
CharCodes[CharCodes["Slash"] = 47] = "Slash";
|
|
2707
|
+
CharCodes[CharCodes["Zero"] = 48] = "Zero";
|
|
2708
|
+
CharCodes[CharCodes["Nine"] = 57] = "Nine";
|
|
2709
|
+
CharCodes[CharCodes["Semi"] = 59] = "Semi";
|
|
2710
|
+
CharCodes[CharCodes["Lt"] = 60] = "Lt";
|
|
2711
|
+
CharCodes[CharCodes["Eq"] = 61] = "Eq";
|
|
2712
|
+
CharCodes[CharCodes["Gt"] = 62] = "Gt";
|
|
2713
|
+
CharCodes[CharCodes["Questionmark"] = 63] = "Questionmark";
|
|
2714
|
+
CharCodes[CharCodes["UpperA"] = 65] = "UpperA";
|
|
2715
|
+
CharCodes[CharCodes["LowerA"] = 97] = "LowerA";
|
|
2716
|
+
CharCodes[CharCodes["UpperF"] = 70] = "UpperF";
|
|
2717
|
+
CharCodes[CharCodes["LowerF"] = 102] = "LowerF";
|
|
2718
|
+
CharCodes[CharCodes["UpperZ"] = 90] = "UpperZ";
|
|
2719
|
+
CharCodes[CharCodes["LowerZ"] = 122] = "LowerZ";
|
|
2720
|
+
CharCodes[CharCodes["LowerX"] = 120] = "LowerX";
|
|
2721
|
+
CharCodes[CharCodes["OpeningSquareBracket"] = 91] = "OpeningSquareBracket";
|
|
2722
|
+
})(CharCodes || (CharCodes = {}));
|
|
2723
|
+
/** All the states the tokenizer can be in. */
|
|
2724
|
+
var State;
|
|
2725
|
+
(function(State) {
|
|
2726
|
+
State[State["Text"] = 1] = "Text";
|
|
2727
|
+
State[State["BeforeTagName"] = 2] = "BeforeTagName";
|
|
2728
|
+
State[State["InTagName"] = 3] = "InTagName";
|
|
2729
|
+
State[State["InSelfClosingTag"] = 4] = "InSelfClosingTag";
|
|
2730
|
+
State[State["BeforeClosingTagName"] = 5] = "BeforeClosingTagName";
|
|
2731
|
+
State[State["InClosingTagName"] = 6] = "InClosingTagName";
|
|
2732
|
+
State[State["AfterClosingTagName"] = 7] = "AfterClosingTagName";
|
|
2733
|
+
State[State["BeforeAttributeName"] = 8] = "BeforeAttributeName";
|
|
2734
|
+
State[State["InAttributeName"] = 9] = "InAttributeName";
|
|
2735
|
+
State[State["AfterAttributeName"] = 10] = "AfterAttributeName";
|
|
2736
|
+
State[State["BeforeAttributeValue"] = 11] = "BeforeAttributeValue";
|
|
2737
|
+
State[State["InAttributeValueDq"] = 12] = "InAttributeValueDq";
|
|
2738
|
+
State[State["InAttributeValueSq"] = 13] = "InAttributeValueSq";
|
|
2739
|
+
State[State["InAttributeValueNq"] = 14] = "InAttributeValueNq";
|
|
2740
|
+
State[State["BeforeDeclaration"] = 15] = "BeforeDeclaration";
|
|
2741
|
+
State[State["InDeclaration"] = 16] = "InDeclaration";
|
|
2742
|
+
State[State["InProcessingInstruction"] = 17] = "InProcessingInstruction";
|
|
2743
|
+
State[State["BeforeComment"] = 18] = "BeforeComment";
|
|
2744
|
+
State[State["CDATASequence"] = 19] = "CDATASequence";
|
|
2745
|
+
State[State["DeclarationSequence"] = 20] = "DeclarationSequence";
|
|
2746
|
+
State[State["InSpecialComment"] = 21] = "InSpecialComment";
|
|
2747
|
+
State[State["InCommentLike"] = 22] = "InCommentLike";
|
|
2748
|
+
State[State["SpecialStartSequence"] = 23] = "SpecialStartSequence";
|
|
2749
|
+
State[State["InSpecialTag"] = 24] = "InSpecialTag";
|
|
2750
|
+
State[State["InPlainText"] = 25] = "InPlainText";
|
|
2751
|
+
State[State["InEntity"] = 26] = "InEntity";
|
|
2752
|
+
})(State || (State = {}));
|
|
2753
|
+
function isWhitespace$1(c) {
|
|
2754
|
+
return c === CharCodes.Space || c === CharCodes.NewLine || c === CharCodes.Tab || c === CharCodes.FormFeed || c === CharCodes.CarriageReturn;
|
|
2755
|
+
}
|
|
2756
|
+
function isEndOfTagSection(c) {
|
|
2757
|
+
return c === CharCodes.Slash || c === CharCodes.Gt || isWhitespace$1(c);
|
|
2758
|
+
}
|
|
2759
|
+
function isASCIIAlpha(c) {
|
|
2760
|
+
return c >= CharCodes.LowerA && c <= CharCodes.LowerZ || c >= CharCodes.UpperA && c <= CharCodes.UpperZ;
|
|
2761
|
+
}
|
|
2762
|
+
/**
|
|
2763
|
+
* Quote style used for parsed attributes.
|
|
2764
|
+
*/
|
|
2765
|
+
var QuoteType;
|
|
2766
|
+
(function(QuoteType) {
|
|
2767
|
+
QuoteType[QuoteType["NoValue"] = 0] = "NoValue";
|
|
2768
|
+
QuoteType[QuoteType["Unquoted"] = 1] = "Unquoted";
|
|
2769
|
+
QuoteType[QuoteType["Single"] = 2] = "Single";
|
|
2770
|
+
QuoteType[QuoteType["Double"] = 3] = "Double";
|
|
2771
|
+
})(QuoteType || (QuoteType = {}));
|
|
2772
|
+
/**
|
|
2773
|
+
* Sequences used to match longer strings.
|
|
2774
|
+
*
|
|
2775
|
+
* We don't have `Script`, `Style`, or `Title` here. Instead, we re-use the *End
|
|
2776
|
+
* sequences with an increased offset.
|
|
2777
|
+
*/
|
|
2778
|
+
const Sequences = {
|
|
2779
|
+
Empty: new Uint8Array(0),
|
|
2780
|
+
Cdata: new Uint8Array([
|
|
2781
|
+
67,
|
|
2782
|
+
68,
|
|
2783
|
+
65,
|
|
2784
|
+
84,
|
|
2785
|
+
65,
|
|
2786
|
+
91
|
|
2787
|
+
]),
|
|
2788
|
+
CdataEnd: new Uint8Array([
|
|
2789
|
+
93,
|
|
2790
|
+
93,
|
|
2791
|
+
62
|
|
2792
|
+
]),
|
|
2793
|
+
CommentEnd: new Uint8Array([
|
|
2794
|
+
45,
|
|
2795
|
+
45,
|
|
2796
|
+
33,
|
|
2797
|
+
62
|
|
2798
|
+
]),
|
|
2799
|
+
Doctype: new Uint8Array([
|
|
2800
|
+
100,
|
|
2801
|
+
111,
|
|
2802
|
+
99,
|
|
2803
|
+
116,
|
|
2804
|
+
121,
|
|
2805
|
+
112,
|
|
2806
|
+
101
|
|
2807
|
+
]),
|
|
2808
|
+
IframeEnd: new Uint8Array([
|
|
2809
|
+
60,
|
|
2810
|
+
47,
|
|
2811
|
+
105,
|
|
2812
|
+
102,
|
|
2813
|
+
114,
|
|
2814
|
+
97,
|
|
2815
|
+
109,
|
|
2816
|
+
101
|
|
2817
|
+
]),
|
|
2818
|
+
NoembedEnd: new Uint8Array([
|
|
2819
|
+
60,
|
|
2820
|
+
47,
|
|
2821
|
+
110,
|
|
2822
|
+
111,
|
|
2823
|
+
101,
|
|
2824
|
+
109,
|
|
2825
|
+
98,
|
|
2826
|
+
101,
|
|
2827
|
+
100
|
|
2828
|
+
]),
|
|
2829
|
+
NoframesEnd: new Uint8Array([
|
|
2830
|
+
60,
|
|
2831
|
+
47,
|
|
2832
|
+
110,
|
|
2833
|
+
111,
|
|
2834
|
+
102,
|
|
2835
|
+
114,
|
|
2836
|
+
97,
|
|
2837
|
+
109,
|
|
2838
|
+
101,
|
|
2839
|
+
115
|
|
2840
|
+
]),
|
|
2841
|
+
Plaintext: new Uint8Array([
|
|
2842
|
+
60,
|
|
2843
|
+
47,
|
|
2844
|
+
112,
|
|
2845
|
+
108,
|
|
2846
|
+
97,
|
|
2847
|
+
105,
|
|
2848
|
+
110,
|
|
2849
|
+
116,
|
|
2850
|
+
101,
|
|
2851
|
+
120,
|
|
2852
|
+
116
|
|
2853
|
+
]),
|
|
2854
|
+
ScriptEnd: new Uint8Array([
|
|
2855
|
+
60,
|
|
2856
|
+
47,
|
|
2857
|
+
115,
|
|
2858
|
+
99,
|
|
2859
|
+
114,
|
|
2860
|
+
105,
|
|
2861
|
+
112,
|
|
2862
|
+
116
|
|
2863
|
+
]),
|
|
2864
|
+
StyleEnd: new Uint8Array([
|
|
2865
|
+
60,
|
|
2866
|
+
47,
|
|
2867
|
+
115,
|
|
2868
|
+
116,
|
|
2869
|
+
121,
|
|
2870
|
+
108,
|
|
2871
|
+
101
|
|
2872
|
+
]),
|
|
2873
|
+
TitleEnd: new Uint8Array([
|
|
2874
|
+
60,
|
|
2875
|
+
47,
|
|
2876
|
+
116,
|
|
2877
|
+
105,
|
|
2878
|
+
116,
|
|
2879
|
+
108,
|
|
2880
|
+
101
|
|
2881
|
+
]),
|
|
2882
|
+
TextareaEnd: new Uint8Array([
|
|
2883
|
+
60,
|
|
2884
|
+
47,
|
|
2885
|
+
116,
|
|
2886
|
+
101,
|
|
2887
|
+
120,
|
|
2888
|
+
116,
|
|
2889
|
+
97,
|
|
2890
|
+
114,
|
|
2891
|
+
101,
|
|
2892
|
+
97
|
|
2893
|
+
]),
|
|
2894
|
+
XmpEnd: new Uint8Array([
|
|
2895
|
+
60,
|
|
2896
|
+
47,
|
|
2897
|
+
120,
|
|
2898
|
+
109,
|
|
2899
|
+
112
|
|
2900
|
+
])
|
|
2901
|
+
};
|
|
2902
|
+
/**
|
|
2903
|
+
* Maps the first lowercase character of an HTML tag name to the sequence
|
|
2904
|
+
* used for special-tag detection. All sequences share a common layout
|
|
2905
|
+
* where index 2 is the first tag-name character, so matching always
|
|
2906
|
+
* continues from offset 3.
|
|
2907
|
+
*/
|
|
2908
|
+
const specialStartSequences = new Map([
|
|
2909
|
+
[Sequences.IframeEnd[2], Sequences.IframeEnd],
|
|
2910
|
+
[Sequences.NoembedEnd[2], Sequences.NoembedEnd],
|
|
2911
|
+
[Sequences.Plaintext[2], Sequences.Plaintext],
|
|
2912
|
+
[Sequences.ScriptEnd[2], Sequences.ScriptEnd],
|
|
2913
|
+
[Sequences.TitleEnd[2], Sequences.TitleEnd],
|
|
2914
|
+
[Sequences.XmpEnd[2], Sequences.XmpEnd]
|
|
2915
|
+
]);
|
|
2916
|
+
/**
|
|
2917
|
+
* Tokenizer implementation used by `Parser`.
|
|
2918
|
+
*/
|
|
2919
|
+
var Tokenizer$1 = class {
|
|
2920
|
+
constructor({ xmlMode = false, decodeEntities = true, recognizeSelfClosing = xmlMode }, cbs) {
|
|
2921
|
+
_defineProperty(this, "cbs", void 0);
|
|
2922
|
+
_defineProperty(
|
|
2923
|
+
this,
|
|
2924
|
+
/** The current state the tokenizer is in. */
|
|
2925
|
+
"state",
|
|
2926
|
+
State.Text
|
|
2927
|
+
);
|
|
2928
|
+
_defineProperty(
|
|
2929
|
+
this,
|
|
2930
|
+
/** The read buffer. */
|
|
2931
|
+
"buffer",
|
|
2932
|
+
""
|
|
2933
|
+
);
|
|
2934
|
+
_defineProperty(
|
|
2935
|
+
this,
|
|
2936
|
+
/** The beginning of the section that is currently being read. */
|
|
2937
|
+
"sectionStart",
|
|
2938
|
+
0
|
|
2939
|
+
);
|
|
2940
|
+
_defineProperty(
|
|
2941
|
+
this,
|
|
2942
|
+
/** The index within the buffer that we are currently looking at. */
|
|
2943
|
+
"index",
|
|
2944
|
+
0
|
|
2945
|
+
);
|
|
2946
|
+
_defineProperty(
|
|
2947
|
+
this,
|
|
2948
|
+
/** The start of the last entity. */
|
|
2949
|
+
"entityStart",
|
|
2950
|
+
0
|
|
2951
|
+
);
|
|
2952
|
+
_defineProperty(
|
|
2953
|
+
this,
|
|
2954
|
+
/** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
|
|
2955
|
+
"baseState",
|
|
2956
|
+
State.Text
|
|
2957
|
+
);
|
|
2958
|
+
_defineProperty(
|
|
2959
|
+
this,
|
|
2960
|
+
/** For special parsing behavior inside of script and style tags. */
|
|
2961
|
+
"isSpecial",
|
|
2962
|
+
false
|
|
2963
|
+
);
|
|
2964
|
+
_defineProperty(
|
|
2965
|
+
this,
|
|
2966
|
+
/** Indicates whether the tokenizer has been paused. */
|
|
2967
|
+
"running",
|
|
2968
|
+
true
|
|
2969
|
+
);
|
|
2970
|
+
_defineProperty(
|
|
2971
|
+
this,
|
|
2972
|
+
/** The offset of the current buffer. */
|
|
2973
|
+
"offset",
|
|
2974
|
+
0
|
|
2975
|
+
);
|
|
2976
|
+
_defineProperty(this, "xmlMode", void 0);
|
|
2977
|
+
_defineProperty(this, "decodeEntities", void 0);
|
|
2978
|
+
_defineProperty(this, "recognizeSelfClosing", void 0);
|
|
2979
|
+
_defineProperty(this, "entityDecoder", void 0);
|
|
2980
|
+
_defineProperty(this, "currentSequence", Sequences.Empty);
|
|
2981
|
+
_defineProperty(this, "sequenceIndex", 0);
|
|
2982
|
+
this.cbs = cbs;
|
|
2983
|
+
this.xmlMode = xmlMode;
|
|
2984
|
+
this.decodeEntities = decodeEntities;
|
|
2985
|
+
this.recognizeSelfClosing = recognizeSelfClosing;
|
|
2986
|
+
this.entityDecoder = new EntityDecoder(xmlMode ? xmlDecodeTree : htmlDecodeTree, (cp, consumed) => this.emitCodePoint(cp, consumed));
|
|
2987
|
+
}
|
|
2988
|
+
reset() {
|
|
2989
|
+
this.state = State.Text;
|
|
2990
|
+
this.buffer = "";
|
|
2991
|
+
this.sectionStart = 0;
|
|
2992
|
+
this.index = 0;
|
|
2993
|
+
this.baseState = State.Text;
|
|
2994
|
+
this.isSpecial = false;
|
|
2995
|
+
this.currentSequence = Sequences.Empty;
|
|
2996
|
+
this.sequenceIndex = 0;
|
|
2997
|
+
this.running = true;
|
|
2998
|
+
this.offset = 0;
|
|
2999
|
+
}
|
|
3000
|
+
write(chunk) {
|
|
3001
|
+
this.offset += this.buffer.length;
|
|
3002
|
+
this.buffer = chunk;
|
|
3003
|
+
this.parse();
|
|
3004
|
+
}
|
|
3005
|
+
end() {
|
|
3006
|
+
if (this.running) this.finish();
|
|
3007
|
+
}
|
|
3008
|
+
pause() {
|
|
3009
|
+
this.running = false;
|
|
3010
|
+
}
|
|
3011
|
+
resume() {
|
|
3012
|
+
this.running = true;
|
|
3013
|
+
if (this.index < this.buffer.length + this.offset) this.parse();
|
|
3014
|
+
}
|
|
3015
|
+
stateText(c) {
|
|
3016
|
+
if (c === CharCodes.Lt || !this.decodeEntities && this.fastForwardTo(CharCodes.Lt)) {
|
|
3017
|
+
if (this.index > this.sectionStart) this.cbs.ontext(this.sectionStart, this.index);
|
|
3018
|
+
this.state = State.BeforeTagName;
|
|
3019
|
+
this.sectionStart = this.index;
|
|
3020
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
|
|
3021
|
+
}
|
|
3022
|
+
enterTagBody() {
|
|
3023
|
+
if (this.currentSequence === Sequences.Plaintext) {
|
|
3024
|
+
this.currentSequence = Sequences.Empty;
|
|
3025
|
+
this.state = State.InPlainText;
|
|
3026
|
+
} else if (this.isSpecial) {
|
|
3027
|
+
this.state = State.InSpecialTag;
|
|
3028
|
+
this.sequenceIndex = 0;
|
|
3029
|
+
} else this.state = State.Text;
|
|
3030
|
+
}
|
|
3031
|
+
/**
|
|
3032
|
+
* Match the opening tag name against an HTML text-only tag sequence.
|
|
3033
|
+
*
|
|
3034
|
+
* Some tags share an initial prefix (`script`/`style`, `title`/`textarea`,
|
|
3035
|
+
* `noembed`/`noframes`), so we may switch to an alternate sequence at the
|
|
3036
|
+
* first distinguishing byte. On a successful full match we fall back to
|
|
3037
|
+
* the normal tag-name state; a later `>` will enter raw-text, RCDATA, or
|
|
3038
|
+
* plaintext mode based on `currentSequence` / `isSpecial`.
|
|
3039
|
+
* @param c Current character code point.
|
|
3040
|
+
*/
|
|
3041
|
+
stateSpecialStartSequence(c) {
|
|
3042
|
+
const lower = c | 32;
|
|
3043
|
+
if (this.sequenceIndex < this.currentSequence.length) {
|
|
3044
|
+
if (lower === this.currentSequence[this.sequenceIndex]) {
|
|
3045
|
+
this.sequenceIndex++;
|
|
3046
|
+
return;
|
|
3047
|
+
}
|
|
3048
|
+
if (this.sequenceIndex === 3) {
|
|
3049
|
+
if (this.currentSequence === Sequences.ScriptEnd && lower === Sequences.StyleEnd[3]) {
|
|
3050
|
+
this.currentSequence = Sequences.StyleEnd;
|
|
3051
|
+
this.sequenceIndex = 4;
|
|
3052
|
+
return;
|
|
3053
|
+
}
|
|
3054
|
+
if (this.currentSequence === Sequences.TitleEnd && lower === Sequences.TextareaEnd[3]) {
|
|
3055
|
+
this.currentSequence = Sequences.TextareaEnd;
|
|
3056
|
+
this.sequenceIndex = 4;
|
|
3057
|
+
return;
|
|
3058
|
+
}
|
|
3059
|
+
} else if (this.sequenceIndex === 4 && this.currentSequence === Sequences.NoembedEnd && lower === Sequences.NoframesEnd[4]) {
|
|
3060
|
+
this.currentSequence = Sequences.NoframesEnd;
|
|
3061
|
+
this.sequenceIndex = 5;
|
|
3062
|
+
return;
|
|
3063
|
+
}
|
|
3064
|
+
} else if (isEndOfTagSection(c)) {
|
|
3065
|
+
this.sequenceIndex = 0;
|
|
3066
|
+
this.state = State.InTagName;
|
|
3067
|
+
this.stateInTagName(c);
|
|
3068
|
+
return;
|
|
3069
|
+
}
|
|
3070
|
+
this.isSpecial = false;
|
|
3071
|
+
this.currentSequence = Sequences.Empty;
|
|
3072
|
+
this.sequenceIndex = 0;
|
|
3073
|
+
this.state = State.InTagName;
|
|
3074
|
+
this.stateInTagName(c);
|
|
3075
|
+
}
|
|
3076
|
+
stateCDATASequence(c) {
|
|
3077
|
+
if (c === Sequences.Cdata[this.sequenceIndex]) {
|
|
3078
|
+
if (++this.sequenceIndex === Sequences.Cdata.length) {
|
|
3079
|
+
this.state = State.InCommentLike;
|
|
3080
|
+
this.currentSequence = Sequences.CdataEnd;
|
|
3081
|
+
this.sequenceIndex = 0;
|
|
3082
|
+
this.sectionStart = this.index + 1;
|
|
3083
|
+
}
|
|
3084
|
+
} else {
|
|
3085
|
+
this.sequenceIndex = 0;
|
|
3086
|
+
if (this.xmlMode) {
|
|
3087
|
+
this.state = State.InDeclaration;
|
|
3088
|
+
this.stateInDeclaration(c);
|
|
3089
|
+
} else {
|
|
3090
|
+
this.state = State.InSpecialComment;
|
|
3091
|
+
this.stateInSpecialComment(c);
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
}
|
|
3095
|
+
/**
|
|
3096
|
+
* When we wait for one specific character, we can speed things up
|
|
3097
|
+
* by skipping through the buffer until we find it.
|
|
3098
|
+
* @param c Current character code point.
|
|
3099
|
+
* @returns Whether the character was found.
|
|
3100
|
+
*/
|
|
3101
|
+
fastForwardTo(c) {
|
|
3102
|
+
while (++this.index < this.buffer.length + this.offset) if (this.buffer.charCodeAt(this.index - this.offset) === c) return true;
|
|
3103
|
+
this.index = this.buffer.length + this.offset - 1;
|
|
3104
|
+
return false;
|
|
3105
|
+
}
|
|
3106
|
+
/**
|
|
3107
|
+
* Emit a comment token and return to the text state.
|
|
3108
|
+
* @param offset Number of characters in the end sequence that have already been matched.
|
|
3109
|
+
*/
|
|
3110
|
+
emitComment(offset) {
|
|
3111
|
+
this.cbs.oncomment(this.sectionStart, this.index, offset);
|
|
3112
|
+
this.sequenceIndex = 0;
|
|
3113
|
+
this.sectionStart = this.index + 1;
|
|
3114
|
+
this.state = State.Text;
|
|
3115
|
+
}
|
|
3116
|
+
/**
|
|
3117
|
+
* Comments and CDATA end with `-->` and `]]>`.
|
|
3118
|
+
*
|
|
3119
|
+
* Their common qualities are:
|
|
3120
|
+
* - Their end sequences have a distinct character they start with.
|
|
3121
|
+
* - That character is then repeated, so we have to check multiple repeats.
|
|
3122
|
+
* - All characters but the start character of the sequence can be skipped.
|
|
3123
|
+
* @param c Current character code point.
|
|
3124
|
+
*/
|
|
3125
|
+
stateInCommentLike(c) {
|
|
3126
|
+
if (!this.xmlMode && this.currentSequence === Sequences.CommentEnd && this.sequenceIndex <= 1 && this.index === this.sectionStart + this.sequenceIndex && c === CharCodes.Gt) this.emitComment(this.sequenceIndex);
|
|
3127
|
+
else if (this.currentSequence === Sequences.CommentEnd && this.sequenceIndex === 2 && c === CharCodes.Gt) this.emitComment(2);
|
|
3128
|
+
else if (this.currentSequence === Sequences.CommentEnd && this.sequenceIndex === this.currentSequence.length - 1 && c !== CharCodes.Gt) this.sequenceIndex = Number(c === CharCodes.Dash);
|
|
3129
|
+
else if (c === this.currentSequence[this.sequenceIndex]) {
|
|
3130
|
+
if (++this.sequenceIndex === this.currentSequence.length) {
|
|
3131
|
+
if (this.currentSequence === Sequences.CdataEnd) this.cbs.oncdata(this.sectionStart, this.index, 2);
|
|
3132
|
+
else this.cbs.oncomment(this.sectionStart, this.index, 3);
|
|
3133
|
+
this.sequenceIndex = 0;
|
|
3134
|
+
this.sectionStart = this.index + 1;
|
|
3135
|
+
this.state = State.Text;
|
|
3136
|
+
}
|
|
3137
|
+
} else if (this.sequenceIndex === 0) {
|
|
3138
|
+
if (this.fastForwardTo(this.currentSequence[0])) this.sequenceIndex = 1;
|
|
3139
|
+
} else if (c !== this.currentSequence[this.sequenceIndex - 1]) this.sequenceIndex = 0;
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
|
|
3143
|
+
*
|
|
3144
|
+
* XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
|
|
3145
|
+
* We allow anything that wouldn't end the tag.
|
|
3146
|
+
* @param c Current character code point.
|
|
3147
|
+
*/
|
|
3148
|
+
isTagStartChar(c) {
|
|
3149
|
+
return this.xmlMode ? !isEndOfTagSection(c) : isASCIIAlpha(c);
|
|
3150
|
+
}
|
|
3151
|
+
/**
|
|
3152
|
+
* Scan raw-text / RCDATA content for the matching end tag.
|
|
3153
|
+
*
|
|
3154
|
+
* For RCDATA tags (`<title>`, `<textarea>`) entities are decoded inline.
|
|
3155
|
+
* For raw-text tags (`<script>`, `<style>`, etc.) we fast-forward to `<`.
|
|
3156
|
+
* @param c Current character code point.
|
|
3157
|
+
*/
|
|
3158
|
+
stateInSpecialTag(c) {
|
|
3159
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
3160
|
+
if (isEndOfTagSection(c)) {
|
|
3161
|
+
const endOfText = this.index - this.currentSequence.length;
|
|
3162
|
+
if (this.sectionStart < endOfText) {
|
|
3163
|
+
const actualIndex = this.index;
|
|
3164
|
+
this.index = endOfText;
|
|
3165
|
+
this.cbs.ontext(this.sectionStart, endOfText);
|
|
3166
|
+
this.index = actualIndex;
|
|
3167
|
+
}
|
|
3168
|
+
this.isSpecial = false;
|
|
3169
|
+
this.sectionStart = endOfText + 2;
|
|
3170
|
+
this.stateInClosingTagName(c);
|
|
3171
|
+
return;
|
|
3172
|
+
}
|
|
3173
|
+
this.sequenceIndex = 0;
|
|
3174
|
+
}
|
|
3175
|
+
if ((c | 32) === this.currentSequence[this.sequenceIndex]) this.sequenceIndex += 1;
|
|
3176
|
+
else if (this.sequenceIndex === 0) {
|
|
3177
|
+
if (this.currentSequence === Sequences.TitleEnd || this.currentSequence === Sequences.TextareaEnd) {
|
|
3178
|
+
if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
|
|
3179
|
+
} else if (this.fastForwardTo(CharCodes.Lt)) this.sequenceIndex = 1;
|
|
3180
|
+
} else this.sequenceIndex = Number(c === CharCodes.Lt);
|
|
3181
|
+
}
|
|
3182
|
+
stateBeforeTagName(c) {
|
|
3183
|
+
if (c === CharCodes.ExclamationMark) {
|
|
3184
|
+
this.state = State.BeforeDeclaration;
|
|
3185
|
+
this.sectionStart = this.index + 1;
|
|
3186
|
+
} else if (c === CharCodes.Questionmark) if (this.xmlMode) {
|
|
3187
|
+
this.state = State.InProcessingInstruction;
|
|
3188
|
+
this.sequenceIndex = 0;
|
|
3189
|
+
this.sectionStart = this.index + 1;
|
|
3190
|
+
} else {
|
|
3191
|
+
this.state = State.InSpecialComment;
|
|
3192
|
+
this.sectionStart = this.index;
|
|
3193
|
+
}
|
|
3194
|
+
else if (this.isTagStartChar(c)) {
|
|
3195
|
+
this.sectionStart = this.index;
|
|
3196
|
+
const special = this.xmlMode || this.cbs.isInForeignContext?.() ? void 0 : specialStartSequences.get(c | 32);
|
|
3197
|
+
if (special === void 0) this.state = State.InTagName;
|
|
3198
|
+
else {
|
|
3199
|
+
this.isSpecial = true;
|
|
3200
|
+
this.currentSequence = special;
|
|
3201
|
+
this.sequenceIndex = 3;
|
|
3202
|
+
this.state = State.SpecialStartSequence;
|
|
3203
|
+
}
|
|
3204
|
+
} else if (c === CharCodes.Slash) this.state = State.BeforeClosingTagName;
|
|
3205
|
+
else {
|
|
3206
|
+
this.state = State.Text;
|
|
3207
|
+
this.stateText(c);
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
stateInTagName(c) {
|
|
3211
|
+
if (isEndOfTagSection(c)) {
|
|
3212
|
+
this.cbs.onopentagname(this.sectionStart, this.index);
|
|
3213
|
+
this.sectionStart = -1;
|
|
3214
|
+
this.state = State.BeforeAttributeName;
|
|
3215
|
+
this.stateBeforeAttributeName(c);
|
|
3216
|
+
}
|
|
3217
|
+
}
|
|
3218
|
+
stateBeforeClosingTagName(c) {
|
|
3219
|
+
if (isWhitespace$1(c)) if (this.xmlMode) {} else {
|
|
3220
|
+
this.state = State.InSpecialComment;
|
|
3221
|
+
this.sectionStart = this.index;
|
|
3222
|
+
}
|
|
3223
|
+
else if (c === CharCodes.Gt) {
|
|
3224
|
+
this.state = State.Text;
|
|
3225
|
+
if (!this.xmlMode) this.sectionStart = this.index + 1;
|
|
3226
|
+
} else {
|
|
3227
|
+
this.state = this.isTagStartChar(c) ? State.InClosingTagName : State.InSpecialComment;
|
|
3228
|
+
this.sectionStart = this.index;
|
|
3229
|
+
}
|
|
3230
|
+
}
|
|
3231
|
+
stateInClosingTagName(c) {
|
|
3232
|
+
if (isEndOfTagSection(c)) {
|
|
3233
|
+
this.cbs.onclosetag(this.sectionStart, this.index);
|
|
3234
|
+
this.sectionStart = -1;
|
|
3235
|
+
this.state = State.AfterClosingTagName;
|
|
3236
|
+
this.stateAfterClosingTagName(c);
|
|
3237
|
+
}
|
|
3238
|
+
}
|
|
3239
|
+
stateAfterClosingTagName(c) {
|
|
3240
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
3241
|
+
this.state = State.Text;
|
|
3242
|
+
this.sectionStart = this.index + 1;
|
|
3243
|
+
}
|
|
3244
|
+
}
|
|
3245
|
+
stateBeforeAttributeName(c) {
|
|
3246
|
+
if (c === CharCodes.Gt) {
|
|
3247
|
+
this.cbs.onopentagend(this.index);
|
|
3248
|
+
this.enterTagBody();
|
|
3249
|
+
this.sectionStart = this.index + 1;
|
|
3250
|
+
} else if (c === CharCodes.Slash) this.state = State.InSelfClosingTag;
|
|
3251
|
+
else if (!isWhitespace$1(c)) {
|
|
3252
|
+
this.state = State.InAttributeName;
|
|
3253
|
+
this.sectionStart = this.index;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
/**
|
|
3257
|
+
* Handle `/` before `>` in an opening tag.
|
|
3258
|
+
*
|
|
3259
|
+
* In HTML mode, text-only tags ignore the self-closing flag and still enter
|
|
3260
|
+
* their raw-text/RCDATA/plaintext state unless self-closing tags are being
|
|
3261
|
+
* recognized. In XML mode, or for ordinary tags, the tokenizer returns to
|
|
3262
|
+
* regular text parsing after emitting the self-closing callback.
|
|
3263
|
+
* @param c Current character code point.
|
|
3264
|
+
*/
|
|
3265
|
+
stateInSelfClosingTag(c) {
|
|
3266
|
+
if (c === CharCodes.Gt) {
|
|
3267
|
+
this.cbs.onselfclosingtag(this.index);
|
|
3268
|
+
this.sectionStart = this.index + 1;
|
|
3269
|
+
if (!this.recognizeSelfClosing) {
|
|
3270
|
+
this.enterTagBody();
|
|
3271
|
+
return;
|
|
3272
|
+
}
|
|
3273
|
+
this.state = State.Text;
|
|
3274
|
+
this.isSpecial = false;
|
|
3275
|
+
this.currentSequence = Sequences.Empty;
|
|
3276
|
+
} else if (!isWhitespace$1(c)) {
|
|
3277
|
+
this.state = State.BeforeAttributeName;
|
|
3278
|
+
this.stateBeforeAttributeName(c);
|
|
3279
|
+
}
|
|
3280
|
+
}
|
|
3281
|
+
stateInAttributeName(c) {
|
|
3282
|
+
if (c === CharCodes.Eq || isEndOfTagSection(c)) {
|
|
3283
|
+
this.cbs.onattribname(this.sectionStart, this.index);
|
|
3284
|
+
this.sectionStart = this.index;
|
|
3285
|
+
this.state = State.AfterAttributeName;
|
|
3286
|
+
this.stateAfterAttributeName(c);
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3289
|
+
stateAfterAttributeName(c) {
|
|
3290
|
+
if (c === CharCodes.Eq) this.state = State.BeforeAttributeValue;
|
|
3291
|
+
else if (c === CharCodes.Slash || c === CharCodes.Gt) {
|
|
3292
|
+
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
|
|
3293
|
+
this.sectionStart = -1;
|
|
3294
|
+
this.state = State.BeforeAttributeName;
|
|
3295
|
+
this.stateBeforeAttributeName(c);
|
|
3296
|
+
} else if (!isWhitespace$1(c)) {
|
|
3297
|
+
this.cbs.onattribend(QuoteType.NoValue, this.sectionStart);
|
|
3298
|
+
this.state = State.InAttributeName;
|
|
3299
|
+
this.sectionStart = this.index;
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
stateBeforeAttributeValue(c) {
|
|
3303
|
+
if (c === CharCodes.DoubleQuote) {
|
|
3304
|
+
this.state = State.InAttributeValueDq;
|
|
3305
|
+
this.sectionStart = this.index + 1;
|
|
3306
|
+
} else if (c === CharCodes.SingleQuote) {
|
|
3307
|
+
this.state = State.InAttributeValueSq;
|
|
3308
|
+
this.sectionStart = this.index + 1;
|
|
3309
|
+
} else if (!isWhitespace$1(c)) {
|
|
3310
|
+
this.sectionStart = this.index;
|
|
3311
|
+
this.state = State.InAttributeValueNq;
|
|
3312
|
+
this.stateInAttributeValueNoQuotes(c);
|
|
3313
|
+
}
|
|
3314
|
+
}
|
|
3315
|
+
handleInAttributeValue(c, quote) {
|
|
3316
|
+
if (c === quote || !this.decodeEntities && this.fastForwardTo(quote)) {
|
|
3317
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
3318
|
+
this.sectionStart = -1;
|
|
3319
|
+
this.cbs.onattribend(quote === CharCodes.DoubleQuote ? QuoteType.Double : QuoteType.Single, this.index + 1);
|
|
3320
|
+
this.state = State.BeforeAttributeName;
|
|
3321
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
|
|
3322
|
+
}
|
|
3323
|
+
stateInAttributeValueDoubleQuotes(c) {
|
|
3324
|
+
this.handleInAttributeValue(c, CharCodes.DoubleQuote);
|
|
3325
|
+
}
|
|
3326
|
+
stateInAttributeValueSingleQuotes(c) {
|
|
3327
|
+
this.handleInAttributeValue(c, CharCodes.SingleQuote);
|
|
3328
|
+
}
|
|
3329
|
+
stateInAttributeValueNoQuotes(c) {
|
|
3330
|
+
if (isWhitespace$1(c) || c === CharCodes.Gt) {
|
|
3331
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
3332
|
+
this.sectionStart = -1;
|
|
3333
|
+
this.cbs.onattribend(QuoteType.Unquoted, this.index);
|
|
3334
|
+
this.state = State.BeforeAttributeName;
|
|
3335
|
+
this.stateBeforeAttributeName(c);
|
|
3336
|
+
} else if (this.decodeEntities && c === CharCodes.Amp) this.startEntity();
|
|
3337
|
+
}
|
|
3338
|
+
/**
|
|
3339
|
+
* Distinguish between CDATA, declarations, HTML comments, and HTML bogus
|
|
3340
|
+
* comments after `<!`.
|
|
3341
|
+
*
|
|
3342
|
+
* In HTML mode, only real comments and doctypes stay on declaration paths;
|
|
3343
|
+
* everything else becomes a bogus comment terminated by the next `>`.
|
|
3344
|
+
* @param c Current character code point.
|
|
3345
|
+
*/
|
|
3346
|
+
stateBeforeDeclaration(c) {
|
|
3347
|
+
if (c === CharCodes.OpeningSquareBracket) {
|
|
3348
|
+
this.state = State.CDATASequence;
|
|
3349
|
+
this.sequenceIndex = 0;
|
|
3350
|
+
} else if (this.xmlMode) this.state = c === CharCodes.Dash ? State.BeforeComment : State.InDeclaration;
|
|
3351
|
+
else if ((c | 32) === Sequences.Doctype[0]) {
|
|
3352
|
+
this.state = State.DeclarationSequence;
|
|
3353
|
+
this.currentSequence = Sequences.Doctype;
|
|
3354
|
+
this.sequenceIndex = 1;
|
|
3355
|
+
} else if (c === CharCodes.Gt) {
|
|
3356
|
+
this.cbs.oncomment(this.sectionStart, this.index, 0);
|
|
3357
|
+
this.state = State.Text;
|
|
3358
|
+
this.sectionStart = this.index + 1;
|
|
3359
|
+
} else if (c === CharCodes.Dash) this.state = State.BeforeComment;
|
|
3360
|
+
else this.state = State.InSpecialComment;
|
|
3361
|
+
}
|
|
3362
|
+
/**
|
|
3363
|
+
* Continue matching `doctype` after `<!d`.
|
|
3364
|
+
*
|
|
3365
|
+
* A full `doctype` match stays on the declaration path; any other name falls
|
|
3366
|
+
* back to an HTML bogus comment, which matches browser behavior for
|
|
3367
|
+
* non-doctype `<!...>` constructs.
|
|
3368
|
+
* @param c Current character code point.
|
|
3369
|
+
*/
|
|
3370
|
+
stateDeclarationSequence(c) {
|
|
3371
|
+
if (this.sequenceIndex === this.currentSequence.length) {
|
|
3372
|
+
this.state = State.InDeclaration;
|
|
3373
|
+
this.stateInDeclaration(c);
|
|
3374
|
+
} else if ((c | 32) === this.currentSequence[this.sequenceIndex]) this.sequenceIndex += 1;
|
|
3375
|
+
else if (c === CharCodes.Gt) {
|
|
3376
|
+
this.cbs.oncomment(this.sectionStart, this.index, 0);
|
|
3377
|
+
this.state = State.Text;
|
|
3378
|
+
this.sectionStart = this.index + 1;
|
|
3379
|
+
} else this.state = State.InSpecialComment;
|
|
3380
|
+
}
|
|
3381
|
+
stateInDeclaration(c) {
|
|
3382
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
3383
|
+
this.cbs.ondeclaration(this.sectionStart, this.index);
|
|
3384
|
+
this.state = State.Text;
|
|
3385
|
+
this.sectionStart = this.index + 1;
|
|
3386
|
+
}
|
|
3387
|
+
}
|
|
3388
|
+
/**
|
|
3389
|
+
* XML processing instructions (`<?...?>`).
|
|
3390
|
+
*
|
|
3391
|
+
* In HTML mode `<?` is routed to `InSpecialComment` instead, so this
|
|
3392
|
+
* state is only reachable in XML mode.
|
|
3393
|
+
* @param c Current character code point.
|
|
3394
|
+
*/
|
|
3395
|
+
stateInProcessingInstruction(c) {
|
|
3396
|
+
if (c === CharCodes.Questionmark) this.sequenceIndex = 1;
|
|
3397
|
+
else if (c === CharCodes.Gt && this.sequenceIndex === 1) {
|
|
3398
|
+
this.cbs.onprocessinginstruction(this.sectionStart, this.index - 1);
|
|
3399
|
+
this.sequenceIndex = 0;
|
|
3400
|
+
this.state = State.Text;
|
|
3401
|
+
this.sectionStart = this.index + 1;
|
|
3402
|
+
} else this.sequenceIndex = Number(this.fastForwardTo(CharCodes.Questionmark));
|
|
3403
|
+
}
|
|
3404
|
+
stateBeforeComment(c) {
|
|
3405
|
+
if (c === CharCodes.Dash) {
|
|
3406
|
+
this.state = State.InCommentLike;
|
|
3407
|
+
this.currentSequence = Sequences.CommentEnd;
|
|
3408
|
+
this.sequenceIndex = 0;
|
|
3409
|
+
this.sectionStart = this.index + 1;
|
|
3410
|
+
} else if (this.xmlMode) this.state = State.InDeclaration;
|
|
3411
|
+
else if (c === CharCodes.Gt) {
|
|
3412
|
+
this.cbs.oncomment(this.sectionStart, this.index, 0);
|
|
3413
|
+
this.state = State.Text;
|
|
3414
|
+
this.sectionStart = this.index + 1;
|
|
3415
|
+
} else this.state = State.InSpecialComment;
|
|
3416
|
+
}
|
|
3417
|
+
stateInSpecialComment(c) {
|
|
3418
|
+
if (c === CharCodes.Gt || this.fastForwardTo(CharCodes.Gt)) {
|
|
3419
|
+
this.cbs.oncomment(this.sectionStart, this.index, 0);
|
|
3420
|
+
this.state = State.Text;
|
|
3421
|
+
this.sectionStart = this.index + 1;
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
startEntity() {
|
|
3425
|
+
this.baseState = this.state;
|
|
3426
|
+
this.state = State.InEntity;
|
|
3427
|
+
this.entityStart = this.index;
|
|
3428
|
+
this.entityDecoder.startEntity(this.xmlMode ? DecodingMode.Strict : this.baseState === State.Text || this.baseState === State.InSpecialTag ? DecodingMode.Legacy : DecodingMode.Attribute);
|
|
3429
|
+
}
|
|
3430
|
+
stateInEntity() {
|
|
3431
|
+
const indexInBuffer = this.index - this.offset;
|
|
3432
|
+
const length = this.entityDecoder.write(this.buffer, indexInBuffer);
|
|
3433
|
+
if (length >= 0) {
|
|
3434
|
+
this.state = this.baseState;
|
|
3435
|
+
if (length === 0) this.index -= 1;
|
|
3436
|
+
} else {
|
|
3437
|
+
if (indexInBuffer < this.buffer.length && this.buffer.charCodeAt(indexInBuffer) === CharCodes.Amp) {
|
|
3438
|
+
this.state = this.baseState;
|
|
3439
|
+
this.index -= 1;
|
|
3440
|
+
return;
|
|
3441
|
+
}
|
|
3442
|
+
this.index = this.offset + this.buffer.length - 1;
|
|
3443
|
+
}
|
|
3444
|
+
}
|
|
3445
|
+
/**
|
|
3446
|
+
* Remove data that has already been consumed from the buffer.
|
|
3447
|
+
*/
|
|
3448
|
+
cleanup() {
|
|
3449
|
+
if (this.running && this.sectionStart !== this.index) {
|
|
3450
|
+
if (this.state === State.Text || this.state === State.InPlainText || this.state === State.InSpecialTag && this.sequenceIndex === 0) {
|
|
3451
|
+
this.cbs.ontext(this.sectionStart, this.index);
|
|
3452
|
+
this.sectionStart = this.index;
|
|
3453
|
+
} else if (this.state === State.InAttributeValueDq || this.state === State.InAttributeValueSq || this.state === State.InAttributeValueNq) {
|
|
3454
|
+
this.cbs.onattribdata(this.sectionStart, this.index);
|
|
3455
|
+
this.sectionStart = this.index;
|
|
3456
|
+
}
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
shouldContinue() {
|
|
3460
|
+
return this.index < this.buffer.length + this.offset && this.running;
|
|
3461
|
+
}
|
|
3462
|
+
/**
|
|
3463
|
+
* Iterates through the buffer, calling the function corresponding to the current state.
|
|
3464
|
+
*
|
|
3465
|
+
* States that are more likely to be hit are higher up, as a performance improvement.
|
|
3466
|
+
*/
|
|
3467
|
+
parse() {
|
|
3468
|
+
while (this.shouldContinue()) {
|
|
3469
|
+
const c = this.buffer.charCodeAt(this.index - this.offset);
|
|
3470
|
+
switch (this.state) {
|
|
3471
|
+
case State.Text:
|
|
3472
|
+
this.stateText(c);
|
|
3473
|
+
break;
|
|
3474
|
+
case State.InPlainText:
|
|
3475
|
+
this.index = this.buffer.length + this.offset - 1;
|
|
3476
|
+
break;
|
|
3477
|
+
case State.SpecialStartSequence:
|
|
3478
|
+
this.stateSpecialStartSequence(c);
|
|
3479
|
+
break;
|
|
3480
|
+
case State.InSpecialTag:
|
|
3481
|
+
this.stateInSpecialTag(c);
|
|
3482
|
+
break;
|
|
3483
|
+
case State.CDATASequence:
|
|
3484
|
+
this.stateCDATASequence(c);
|
|
3485
|
+
break;
|
|
3486
|
+
case State.DeclarationSequence:
|
|
3487
|
+
this.stateDeclarationSequence(c);
|
|
3488
|
+
break;
|
|
3489
|
+
case State.InAttributeValueDq:
|
|
3490
|
+
this.stateInAttributeValueDoubleQuotes(c);
|
|
3491
|
+
break;
|
|
3492
|
+
case State.InAttributeName:
|
|
3493
|
+
this.stateInAttributeName(c);
|
|
3494
|
+
break;
|
|
3495
|
+
case State.InCommentLike:
|
|
3496
|
+
this.stateInCommentLike(c);
|
|
3497
|
+
break;
|
|
3498
|
+
case State.InSpecialComment:
|
|
3499
|
+
this.stateInSpecialComment(c);
|
|
3500
|
+
break;
|
|
3501
|
+
case State.BeforeAttributeName:
|
|
3502
|
+
this.stateBeforeAttributeName(c);
|
|
3503
|
+
break;
|
|
3504
|
+
case State.InTagName:
|
|
3505
|
+
this.stateInTagName(c);
|
|
3506
|
+
break;
|
|
3507
|
+
case State.InClosingTagName:
|
|
3508
|
+
this.stateInClosingTagName(c);
|
|
3509
|
+
break;
|
|
3510
|
+
case State.BeforeTagName:
|
|
3511
|
+
this.stateBeforeTagName(c);
|
|
3512
|
+
break;
|
|
3513
|
+
case State.AfterAttributeName:
|
|
3514
|
+
this.stateAfterAttributeName(c);
|
|
3515
|
+
break;
|
|
3516
|
+
case State.InAttributeValueSq:
|
|
3517
|
+
this.stateInAttributeValueSingleQuotes(c);
|
|
3518
|
+
break;
|
|
3519
|
+
case State.BeforeAttributeValue:
|
|
3520
|
+
this.stateBeforeAttributeValue(c);
|
|
3521
|
+
break;
|
|
3522
|
+
case State.BeforeClosingTagName:
|
|
3523
|
+
this.stateBeforeClosingTagName(c);
|
|
3524
|
+
break;
|
|
3525
|
+
case State.AfterClosingTagName:
|
|
3526
|
+
this.stateAfterClosingTagName(c);
|
|
3527
|
+
break;
|
|
3528
|
+
case State.InAttributeValueNq:
|
|
3529
|
+
this.stateInAttributeValueNoQuotes(c);
|
|
3530
|
+
break;
|
|
3531
|
+
case State.InSelfClosingTag:
|
|
3532
|
+
this.stateInSelfClosingTag(c);
|
|
3533
|
+
break;
|
|
3534
|
+
case State.InDeclaration:
|
|
3535
|
+
this.stateInDeclaration(c);
|
|
3536
|
+
break;
|
|
3537
|
+
case State.BeforeDeclaration:
|
|
3538
|
+
this.stateBeforeDeclaration(c);
|
|
3539
|
+
break;
|
|
3540
|
+
case State.BeforeComment:
|
|
3541
|
+
this.stateBeforeComment(c);
|
|
3542
|
+
break;
|
|
3543
|
+
case State.InProcessingInstruction:
|
|
3544
|
+
this.stateInProcessingInstruction(c);
|
|
3545
|
+
break;
|
|
3546
|
+
case State.InEntity:
|
|
3547
|
+
this.stateInEntity();
|
|
3548
|
+
break;
|
|
3549
|
+
}
|
|
3550
|
+
this.index++;
|
|
3551
|
+
}
|
|
3552
|
+
this.cleanup();
|
|
3553
|
+
}
|
|
3554
|
+
finish() {
|
|
3555
|
+
if (this.state === State.InEntity) {
|
|
3556
|
+
this.entityDecoder.end();
|
|
3557
|
+
this.state = this.baseState;
|
|
3558
|
+
}
|
|
3559
|
+
this.handleTrailingData();
|
|
3560
|
+
this.cbs.onend();
|
|
3561
|
+
}
|
|
3562
|
+
handleTrailingCommentLikeData(endIndex) {
|
|
3563
|
+
if (this.state !== State.InCommentLike) return false;
|
|
3564
|
+
if (this.currentSequence === Sequences.CdataEnd) if (this.xmlMode) {
|
|
3565
|
+
if (this.sectionStart < endIndex) this.cbs.oncdata(this.sectionStart, endIndex, 0);
|
|
3566
|
+
} else {
|
|
3567
|
+
const cdataStart = this.sectionStart - Sequences.Cdata.length - 1;
|
|
3568
|
+
this.cbs.oncomment(cdataStart, endIndex, 0);
|
|
3569
|
+
}
|
|
3570
|
+
else {
|
|
3571
|
+
const offset = this.xmlMode ? 0 : Math.min(this.sequenceIndex, Sequences.CommentEnd.length - 1);
|
|
3572
|
+
this.cbs.oncomment(this.sectionStart, endIndex, offset);
|
|
3573
|
+
}
|
|
3574
|
+
return true;
|
|
3575
|
+
}
|
|
3576
|
+
handleTrailingMarkupDeclaration(endIndex) {
|
|
3577
|
+
if (this.xmlMode) switch (this.state) {
|
|
3578
|
+
case State.InSpecialComment:
|
|
3579
|
+
case State.BeforeComment:
|
|
3580
|
+
case State.CDATASequence:
|
|
3581
|
+
case State.DeclarationSequence:
|
|
3582
|
+
case State.InDeclaration:
|
|
3583
|
+
this.cbs.ontext(this.sectionStart, endIndex);
|
|
3584
|
+
return true;
|
|
3585
|
+
default: return false;
|
|
3586
|
+
}
|
|
3587
|
+
switch (this.state) {
|
|
3588
|
+
case State.BeforeDeclaration:
|
|
3589
|
+
case State.InSpecialComment:
|
|
3590
|
+
case State.BeforeComment:
|
|
3591
|
+
case State.CDATASequence:
|
|
3592
|
+
this.cbs.oncomment(this.sectionStart, endIndex, 0);
|
|
3593
|
+
return true;
|
|
3594
|
+
case State.DeclarationSequence:
|
|
3595
|
+
if (this.sequenceIndex !== Sequences.Doctype.length) this.cbs.oncomment(this.sectionStart, endIndex, 0);
|
|
3596
|
+
return true;
|
|
3597
|
+
case State.InDeclaration: return true;
|
|
3598
|
+
default: return false;
|
|
3599
|
+
}
|
|
3600
|
+
}
|
|
3601
|
+
/** Handle any trailing data. */
|
|
3602
|
+
handleTrailingData() {
|
|
3603
|
+
const endIndex = this.buffer.length + this.offset;
|
|
3604
|
+
if (this.handleTrailingCommentLikeData(endIndex) || this.handleTrailingMarkupDeclaration(endIndex)) return;
|
|
3605
|
+
if (this.sectionStart >= endIndex) return;
|
|
3606
|
+
switch (this.state) {
|
|
3607
|
+
case State.InTagName:
|
|
3608
|
+
case State.BeforeAttributeName:
|
|
3609
|
+
case State.BeforeAttributeValue:
|
|
3610
|
+
case State.AfterAttributeName:
|
|
3611
|
+
case State.InAttributeName:
|
|
3612
|
+
case State.InAttributeValueSq:
|
|
3613
|
+
case State.InAttributeValueDq:
|
|
3614
|
+
case State.InAttributeValueNq:
|
|
3615
|
+
case State.InClosingTagName: break;
|
|
3616
|
+
default: this.cbs.ontext(this.sectionStart, endIndex);
|
|
3617
|
+
}
|
|
3618
|
+
}
|
|
3619
|
+
emitCodePoint(cp, consumed) {
|
|
3620
|
+
if (this.baseState !== State.Text && this.baseState !== State.InSpecialTag) {
|
|
3621
|
+
if (this.sectionStart < this.entityStart) this.cbs.onattribdata(this.sectionStart, this.entityStart);
|
|
3622
|
+
this.sectionStart = this.entityStart + consumed;
|
|
3623
|
+
this.index = this.sectionStart - 1;
|
|
3624
|
+
this.cbs.onattribentity(cp);
|
|
3625
|
+
} else {
|
|
3626
|
+
if (this.sectionStart < this.entityStart) this.cbs.ontext(this.sectionStart, this.entityStart);
|
|
3627
|
+
this.sectionStart = this.entityStart + consumed;
|
|
3628
|
+
this.index = this.sectionStart - 1;
|
|
3629
|
+
this.cbs.ontextentity(cp, this.sectionStart);
|
|
3630
|
+
}
|
|
3631
|
+
}
|
|
3632
|
+
};
|
|
3633
|
+
//#endregion
|
|
3634
|
+
//#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Parser.js
|
|
3635
|
+
const { fromCodePoint } = String;
|
|
3636
|
+
const formTags = new Set([
|
|
3637
|
+
"input",
|
|
3638
|
+
"option",
|
|
3639
|
+
"optgroup",
|
|
3640
|
+
"select",
|
|
3641
|
+
"button",
|
|
3642
|
+
"datalist",
|
|
3643
|
+
"textarea"
|
|
3644
|
+
]);
|
|
3645
|
+
const pTag = new Set(["p"]);
|
|
3646
|
+
const headingTags = new Set([
|
|
3647
|
+
"h1",
|
|
3648
|
+
"h2",
|
|
3649
|
+
"h3",
|
|
3650
|
+
"h4",
|
|
3651
|
+
"h5",
|
|
3652
|
+
"h6",
|
|
3653
|
+
"p"
|
|
3654
|
+
]);
|
|
3655
|
+
const tableSectionTags = new Set(["thead", "tbody"]);
|
|
3656
|
+
const ddtTags = new Set(["dd", "dt"]);
|
|
3657
|
+
const rtpTags = new Set(["rt", "rp"]);
|
|
3658
|
+
const openImpliesClose = new Map([
|
|
3659
|
+
["tr", new Set([
|
|
3660
|
+
"tr",
|
|
3661
|
+
"th",
|
|
3662
|
+
"td"
|
|
3663
|
+
])],
|
|
3664
|
+
["th", new Set(["th"])],
|
|
3665
|
+
["td", new Set([
|
|
3666
|
+
"thead",
|
|
3667
|
+
"th",
|
|
3668
|
+
"td"
|
|
3669
|
+
])],
|
|
3670
|
+
["body", new Set([
|
|
3671
|
+
"head",
|
|
3672
|
+
"link",
|
|
3673
|
+
"script"
|
|
3674
|
+
])],
|
|
3675
|
+
["a", new Set(["a"])],
|
|
3676
|
+
["li", new Set(["li"])],
|
|
3677
|
+
["p", pTag],
|
|
3678
|
+
["h1", headingTags],
|
|
3679
|
+
["h2", headingTags],
|
|
3680
|
+
["h3", headingTags],
|
|
3681
|
+
["h4", headingTags],
|
|
3682
|
+
["h5", headingTags],
|
|
3683
|
+
["h6", headingTags],
|
|
3684
|
+
["select", formTags],
|
|
3685
|
+
["input", formTags],
|
|
3686
|
+
["output", formTags],
|
|
3687
|
+
["button", formTags],
|
|
3688
|
+
["datalist", formTags],
|
|
3689
|
+
["textarea", formTags],
|
|
3690
|
+
["option", new Set(["option"])],
|
|
3691
|
+
["optgroup", new Set(["optgroup", "option"])],
|
|
3692
|
+
["dd", ddtTags],
|
|
3693
|
+
["dt", ddtTags],
|
|
3694
|
+
["address", pTag],
|
|
3695
|
+
["article", pTag],
|
|
3696
|
+
["aside", pTag],
|
|
3697
|
+
["blockquote", pTag],
|
|
3698
|
+
["details", pTag],
|
|
3699
|
+
["div", pTag],
|
|
3700
|
+
["dl", pTag],
|
|
3701
|
+
["fieldset", pTag],
|
|
3702
|
+
["figcaption", pTag],
|
|
3703
|
+
["figure", pTag],
|
|
3704
|
+
["footer", pTag],
|
|
3705
|
+
["form", pTag],
|
|
3706
|
+
["header", pTag],
|
|
3707
|
+
["hr", pTag],
|
|
3708
|
+
["main", pTag],
|
|
3709
|
+
["nav", pTag],
|
|
3710
|
+
["ol", pTag],
|
|
3711
|
+
["pre", pTag],
|
|
3712
|
+
["section", pTag],
|
|
3713
|
+
["table", pTag],
|
|
3714
|
+
["ul", pTag],
|
|
3715
|
+
["rt", rtpTags],
|
|
3716
|
+
["rp", rtpTags],
|
|
3717
|
+
["tbody", tableSectionTags],
|
|
3718
|
+
["tfoot", tableSectionTags]
|
|
3719
|
+
]);
|
|
3720
|
+
const DOCUMENT_TYPE = "doctype";
|
|
3721
|
+
const voidElements = new Set([
|
|
3722
|
+
"area",
|
|
3723
|
+
"base",
|
|
3724
|
+
"basefont",
|
|
3725
|
+
"br",
|
|
3726
|
+
"col",
|
|
3727
|
+
"command",
|
|
3728
|
+
"embed",
|
|
3729
|
+
"frame",
|
|
3730
|
+
"hr",
|
|
3731
|
+
"img",
|
|
3732
|
+
"input",
|
|
3733
|
+
"isindex",
|
|
3734
|
+
"keygen",
|
|
3735
|
+
"link",
|
|
3736
|
+
"meta",
|
|
3737
|
+
"param",
|
|
3738
|
+
"source",
|
|
3739
|
+
"track",
|
|
3740
|
+
"wbr"
|
|
3741
|
+
]);
|
|
3742
|
+
const foreignContextElements = new Set(["math", "svg"]);
|
|
3743
|
+
/**
|
|
3744
|
+
* Elements that can be used to integrate HTML content within foreign namespaces (e.g., SVG or MathML).
|
|
3745
|
+
*
|
|
3746
|
+
* Entries must use the SVG-adjusted casing (e.g. "foreignObject" not
|
|
3747
|
+
* "foreignobject") since they are compared against adjusted tag names.
|
|
3748
|
+
*/
|
|
3749
|
+
const htmlIntegrationElements = new Set([
|
|
3750
|
+
"mi",
|
|
3751
|
+
"mo",
|
|
3752
|
+
"mn",
|
|
3753
|
+
"ms",
|
|
3754
|
+
"mtext",
|
|
3755
|
+
"annotation-xml",
|
|
3756
|
+
"foreignObject",
|
|
3757
|
+
"desc",
|
|
3758
|
+
"title"
|
|
3759
|
+
]);
|
|
3760
|
+
const svgTagNameAdjustments = new Map([
|
|
3761
|
+
["altglyph", "altGlyph"],
|
|
3762
|
+
["altglyphdef", "altGlyphDef"],
|
|
3763
|
+
["altglyphitem", "altGlyphItem"],
|
|
3764
|
+
["animatecolor", "animateColor"],
|
|
3765
|
+
["animatemotion", "animateMotion"],
|
|
3766
|
+
["animatetransform", "animateTransform"],
|
|
3767
|
+
["clippath", "clipPath"],
|
|
3768
|
+
["feblend", "feBlend"],
|
|
3769
|
+
["fecolormatrix", "feColorMatrix"],
|
|
3770
|
+
["fecomponenttransfer", "feComponentTransfer"],
|
|
3771
|
+
["fecomposite", "feComposite"],
|
|
3772
|
+
["feconvolvematrix", "feConvolveMatrix"],
|
|
3773
|
+
["fediffuselighting", "feDiffuseLighting"],
|
|
3774
|
+
["fedisplacementmap", "feDisplacementMap"],
|
|
3775
|
+
["fedistantlight", "feDistantLight"],
|
|
3776
|
+
["fedropshadow", "feDropShadow"],
|
|
3777
|
+
["feflood", "feFlood"],
|
|
3778
|
+
["fefunca", "feFuncA"],
|
|
3779
|
+
["fefuncb", "feFuncB"],
|
|
3780
|
+
["fefuncg", "feFuncG"],
|
|
3781
|
+
["fefuncr", "feFuncR"],
|
|
3782
|
+
["fegaussianblur", "feGaussianBlur"],
|
|
3783
|
+
["feimage", "feImage"],
|
|
3784
|
+
["femerge", "feMerge"],
|
|
3785
|
+
["femergenode", "feMergeNode"],
|
|
3786
|
+
["femorphology", "feMorphology"],
|
|
3787
|
+
["feoffset", "feOffset"],
|
|
3788
|
+
["fepointlight", "fePointLight"],
|
|
3789
|
+
["fespecularlighting", "feSpecularLighting"],
|
|
3790
|
+
["fespotlight", "feSpotLight"],
|
|
3791
|
+
["fetile", "feTile"],
|
|
3792
|
+
["feturbulence", "feTurbulence"],
|
|
3793
|
+
["foreignobject", "foreignObject"],
|
|
3794
|
+
["glyphref", "glyphRef"],
|
|
3795
|
+
["lineargradient", "linearGradient"],
|
|
3796
|
+
["radialgradient", "radialGradient"],
|
|
3797
|
+
["textpath", "textPath"]
|
|
3798
|
+
]);
|
|
3799
|
+
var ForeignContext;
|
|
3800
|
+
(function(ForeignContext) {
|
|
3801
|
+
ForeignContext[ForeignContext["None"] = 0] = "None";
|
|
3802
|
+
ForeignContext[ForeignContext["Svg"] = 1] = "Svg";
|
|
3803
|
+
ForeignContext[ForeignContext["MathML"] = 2] = "MathML";
|
|
3804
|
+
})(ForeignContext || (ForeignContext = {}));
|
|
3805
|
+
const reNameEnd = /\s|\//;
|
|
3806
|
+
/**
|
|
3807
|
+
* Incremental parser implementation.
|
|
3808
|
+
*/
|
|
3809
|
+
var Parser = class {
|
|
3810
|
+
constructor(cbs, options = {}) {
|
|
3811
|
+
_defineProperty(this, "options", void 0);
|
|
3812
|
+
_defineProperty(
|
|
3813
|
+
this,
|
|
3814
|
+
/** The start index of the last event. */
|
|
3815
|
+
"startIndex",
|
|
3816
|
+
0
|
|
3817
|
+
);
|
|
3818
|
+
_defineProperty(
|
|
3819
|
+
this,
|
|
3820
|
+
/** The end index of the last event. */
|
|
3821
|
+
"endIndex",
|
|
3822
|
+
0
|
|
3823
|
+
);
|
|
3824
|
+
_defineProperty(
|
|
3825
|
+
this,
|
|
3826
|
+
/**
|
|
3827
|
+
* Store the start index of the current open tag,
|
|
3828
|
+
* so we can update the start index for attributes.
|
|
3829
|
+
*/
|
|
3830
|
+
"openTagStart",
|
|
3831
|
+
0
|
|
3832
|
+
);
|
|
3833
|
+
_defineProperty(this, "tagname", "");
|
|
3834
|
+
_defineProperty(this, "attribname", "");
|
|
3835
|
+
_defineProperty(this, "attribvalue", "");
|
|
3836
|
+
_defineProperty(this, "attribs", null);
|
|
3837
|
+
_defineProperty(this, "stack", []);
|
|
3838
|
+
_defineProperty(this, "foreignContext", void 0);
|
|
3839
|
+
_defineProperty(this, "cbs", void 0);
|
|
3840
|
+
_defineProperty(this, "lowerCaseTagNames", void 0);
|
|
3841
|
+
_defineProperty(this, "lowerCaseAttributeNames", void 0);
|
|
3842
|
+
_defineProperty(this, "recognizeSelfClosing", void 0);
|
|
3843
|
+
_defineProperty(
|
|
3844
|
+
this,
|
|
3845
|
+
/** We are parsing HTML. Inverse of the `xmlMode` option. */
|
|
3846
|
+
"htmlMode",
|
|
3847
|
+
void 0
|
|
3848
|
+
);
|
|
3849
|
+
_defineProperty(this, "tokenizer", void 0);
|
|
3850
|
+
_defineProperty(this, "buffers", []);
|
|
3851
|
+
_defineProperty(this, "bufferOffset", 0);
|
|
3852
|
+
_defineProperty(
|
|
3853
|
+
this,
|
|
3854
|
+
/** The index of the last written buffer. Used when resuming after a `pause()`. */
|
|
3855
|
+
"writeIndex",
|
|
3856
|
+
0
|
|
3857
|
+
);
|
|
3858
|
+
_defineProperty(
|
|
3859
|
+
this,
|
|
3860
|
+
/** Indicates whether the parser has finished running / `.end` has been called. */
|
|
3861
|
+
"ended",
|
|
3862
|
+
false
|
|
3863
|
+
);
|
|
3864
|
+
this.options = options;
|
|
3865
|
+
this.cbs = cbs ?? {};
|
|
3866
|
+
this.htmlMode = !this.options.xmlMode;
|
|
3867
|
+
this.lowerCaseTagNames = options.lowerCaseTags ?? this.htmlMode;
|
|
3868
|
+
this.lowerCaseAttributeNames = options.lowerCaseAttributeNames ?? this.htmlMode;
|
|
3869
|
+
this.recognizeSelfClosing = options.recognizeSelfClosing ?? !this.htmlMode;
|
|
3870
|
+
this.tokenizer = new (options.Tokenizer ?? Tokenizer$1)(this.options, this);
|
|
3871
|
+
this.foreignContext = [ForeignContext.None];
|
|
3872
|
+
this.cbs.onparserinit?.(this);
|
|
3873
|
+
}
|
|
3874
|
+
/**
|
|
3875
|
+
* @param start Start index for the current parser event.
|
|
3876
|
+
* @param endIndex End index for the current parser event.
|
|
3877
|
+
* @internal
|
|
3878
|
+
*/
|
|
3879
|
+
ontext(start, endIndex) {
|
|
3880
|
+
const data = this.getSlice(start, endIndex);
|
|
3881
|
+
this.endIndex = endIndex - 1;
|
|
3882
|
+
this.cbs.ontext?.(data);
|
|
3883
|
+
this.startIndex = endIndex;
|
|
3884
|
+
}
|
|
3885
|
+
/**
|
|
3886
|
+
* @param cp Current Unicode code point.
|
|
3887
|
+
* @param endIndex End index for the current parser event.
|
|
3888
|
+
* @internal
|
|
3889
|
+
*/
|
|
3890
|
+
ontextentity(cp, endIndex) {
|
|
3891
|
+
this.endIndex = endIndex - 1;
|
|
3892
|
+
this.cbs.ontext?.(fromCodePoint(cp));
|
|
3893
|
+
this.startIndex = endIndex;
|
|
3894
|
+
}
|
|
3895
|
+
/** @internal */
|
|
3896
|
+
isInForeignContext() {
|
|
3897
|
+
return this.foreignContext[0] !== ForeignContext.None;
|
|
3898
|
+
}
|
|
3899
|
+
/**
|
|
3900
|
+
* Checks if the current tag is a void element. Override this if you want
|
|
3901
|
+
* to specify your own additional void elements.
|
|
3902
|
+
* @param name Name of the pseudo selector.
|
|
3903
|
+
*/
|
|
3904
|
+
isVoidElement(name) {
|
|
3905
|
+
return this.htmlMode && voidElements.has(name);
|
|
3906
|
+
}
|
|
3907
|
+
/**
|
|
3908
|
+
* Read a tag name from the buffer.
|
|
3909
|
+
*
|
|
3910
|
+
* When `lowerCaseTagNames` is enabled (the default in HTML mode), the name
|
|
3911
|
+
* is lowercased and may be adjusted for SVG casing or the `image` → `img`
|
|
3912
|
+
* alias.
|
|
3913
|
+
* @param start Start index of the tag name in the buffer.
|
|
3914
|
+
* @param endIndex End index of the tag name in the buffer.
|
|
3915
|
+
*/
|
|
3916
|
+
readTagName(start, endIndex) {
|
|
3917
|
+
const name = this.lowerCaseTagNames ? this.getSlice(start, endIndex).toLowerCase() : this.getSlice(start, endIndex);
|
|
3918
|
+
if (!(this.lowerCaseTagNames && this.htmlMode)) return name;
|
|
3919
|
+
if (this.foreignContext[0] === ForeignContext.Svg) return svgTagNameAdjustments.get(name) ?? name;
|
|
3920
|
+
if (this.foreignContext.length > 1) {
|
|
3921
|
+
const adjusted = svgTagNameAdjustments.get(name);
|
|
3922
|
+
if (adjusted !== void 0 && this.stack.includes(adjusted)) return adjusted;
|
|
3923
|
+
}
|
|
3924
|
+
if (!this.isInForeignContext()) return name === "image" ? "img" : name;
|
|
3925
|
+
return name;
|
|
3926
|
+
}
|
|
3927
|
+
/**
|
|
3928
|
+
* @param start Start index for the current parser event.
|
|
3929
|
+
* @param endIndex End index for the current parser event.
|
|
3930
|
+
* @internal
|
|
3931
|
+
*/
|
|
3932
|
+
onopentagname(start, endIndex) {
|
|
3933
|
+
this.endIndex = endIndex;
|
|
3934
|
+
this.emitOpenTag(this.readTagName(start, endIndex));
|
|
3935
|
+
}
|
|
3936
|
+
emitOpenTag(name) {
|
|
3937
|
+
this.openTagStart = this.startIndex;
|
|
3938
|
+
this.tagname = name;
|
|
3939
|
+
if (this.htmlMode && name === "form" && this.stack.includes("form")) {
|
|
3940
|
+
this.tagname = "";
|
|
3941
|
+
return;
|
|
3942
|
+
}
|
|
3943
|
+
const impliesClose = this.htmlMode && openImpliesClose.get(name);
|
|
3944
|
+
if (impliesClose) while (this.stack.length > 0 && impliesClose.has(this.stack[0])) this.popElement(true);
|
|
3945
|
+
if (!this.isVoidElement(name)) {
|
|
3946
|
+
this.stack.unshift(name);
|
|
3947
|
+
if (this.htmlMode) {
|
|
3948
|
+
if (name === "svg") this.foreignContext.unshift(ForeignContext.Svg);
|
|
3949
|
+
else if (name === "math") this.foreignContext.unshift(ForeignContext.MathML);
|
|
3950
|
+
else if (htmlIntegrationElements.has(name)) this.foreignContext.unshift(ForeignContext.None);
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
this.cbs.onopentagname?.(name);
|
|
3954
|
+
if (this.cbs.onopentag) this.attribs = {};
|
|
3955
|
+
}
|
|
3956
|
+
endOpenTag(isImplied) {
|
|
3957
|
+
this.startIndex = this.openTagStart;
|
|
3958
|
+
if (this.attribs) {
|
|
3959
|
+
this.cbs.onopentag?.(this.tagname, this.attribs, isImplied);
|
|
3960
|
+
this.attribs = null;
|
|
3961
|
+
}
|
|
3962
|
+
if (this.cbs.onclosetag && this.isVoidElement(this.tagname)) this.cbs.onclosetag(this.tagname, true);
|
|
3963
|
+
this.tagname = "";
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* @param endIndex End index for the current parser event.
|
|
3967
|
+
* @internal
|
|
3968
|
+
*/
|
|
3969
|
+
onopentagend(endIndex) {
|
|
3970
|
+
this.endIndex = endIndex;
|
|
3971
|
+
this.endOpenTag(false);
|
|
3972
|
+
this.startIndex = endIndex + 1;
|
|
3973
|
+
}
|
|
3974
|
+
/**
|
|
3975
|
+
* @param start Start index for the current parser event.
|
|
3976
|
+
* @param endIndex End index for the current parser event.
|
|
3977
|
+
* @internal
|
|
3978
|
+
*/
|
|
3979
|
+
onclosetag(start, endIndex) {
|
|
3980
|
+
this.endIndex = endIndex;
|
|
3981
|
+
const name = this.readTagName(start, endIndex);
|
|
3982
|
+
if (!this.isVoidElement(name)) {
|
|
3983
|
+
const pos = this.stack.indexOf(name);
|
|
3984
|
+
if (pos !== -1) {
|
|
3985
|
+
for (let index = 0; index < pos; index++) this.popElement(true);
|
|
3986
|
+
this.popElement(false);
|
|
3987
|
+
} else if (this.htmlMode && name === "p") {
|
|
3988
|
+
this.emitOpenTag("p");
|
|
3989
|
+
this.closeCurrentTag(true);
|
|
3990
|
+
}
|
|
3991
|
+
} else if (this.htmlMode && name === "br") {
|
|
3992
|
+
this.cbs.onopentagname?.("br");
|
|
3993
|
+
this.cbs.onopentag?.("br", {}, true);
|
|
3994
|
+
this.cbs.onclosetag?.("br", false);
|
|
3995
|
+
}
|
|
3996
|
+
this.startIndex = endIndex + 1;
|
|
3997
|
+
}
|
|
3998
|
+
/**
|
|
3999
|
+
* @param endIndex End index for the current parser event.
|
|
4000
|
+
* @internal
|
|
4001
|
+
*/
|
|
4002
|
+
onselfclosingtag(endIndex) {
|
|
4003
|
+
this.endIndex = endIndex;
|
|
4004
|
+
if (this.recognizeSelfClosing || this.isInForeignContext()) {
|
|
4005
|
+
this.closeCurrentTag(false);
|
|
4006
|
+
this.startIndex = endIndex + 1;
|
|
4007
|
+
} else this.onopentagend(endIndex);
|
|
4008
|
+
}
|
|
4009
|
+
/**
|
|
4010
|
+
* Pop the top element off the stack, emit a close event, and maintain
|
|
4011
|
+
* the foreign context stack.
|
|
4012
|
+
* @param implied Whether this close is implied (not from an explicit end tag).
|
|
4013
|
+
*/
|
|
4014
|
+
popElement(implied) {
|
|
4015
|
+
const element = this.stack.shift();
|
|
4016
|
+
if (this.htmlMode && (foreignContextElements.has(element) || htmlIntegrationElements.has(element))) this.foreignContext.shift();
|
|
4017
|
+
this.cbs.onclosetag?.(element, implied);
|
|
4018
|
+
}
|
|
4019
|
+
closeCurrentTag(isOpenImplied) {
|
|
4020
|
+
const name = this.tagname;
|
|
4021
|
+
this.endOpenTag(isOpenImplied);
|
|
4022
|
+
if (this.stack[0] === name) this.popElement(!isOpenImplied);
|
|
4023
|
+
}
|
|
4024
|
+
/**
|
|
4025
|
+
* @param start Start index for the current parser event.
|
|
4026
|
+
* @param endIndex End index for the current parser event.
|
|
4027
|
+
* @internal
|
|
4028
|
+
*/
|
|
4029
|
+
onattribname(start, endIndex) {
|
|
4030
|
+
this.startIndex = start;
|
|
4031
|
+
const name = this.getSlice(start, endIndex);
|
|
4032
|
+
this.attribname = this.lowerCaseAttributeNames ? name.toLowerCase() : name;
|
|
4033
|
+
}
|
|
4034
|
+
/**
|
|
4035
|
+
* @param start Start index for the current parser event.
|
|
4036
|
+
* @param endIndex End index for the current parser event.
|
|
4037
|
+
* @internal
|
|
4038
|
+
*/
|
|
4039
|
+
onattribdata(start, endIndex) {
|
|
4040
|
+
this.attribvalue += this.getSlice(start, endIndex);
|
|
4041
|
+
}
|
|
4042
|
+
/**
|
|
4043
|
+
* @param cp Current Unicode code point.
|
|
4044
|
+
* @internal
|
|
4045
|
+
*/
|
|
4046
|
+
onattribentity(cp) {
|
|
4047
|
+
this.attribvalue += fromCodePoint(cp);
|
|
4048
|
+
}
|
|
4049
|
+
/**
|
|
4050
|
+
* @param quote Quote type used for the current attribute.
|
|
4051
|
+
* @param endIndex End index for the current parser event.
|
|
4052
|
+
* @internal
|
|
4053
|
+
*/
|
|
4054
|
+
onattribend(quote, endIndex) {
|
|
4055
|
+
this.endIndex = endIndex;
|
|
4056
|
+
this.cbs.onattribute?.(this.attribname, this.attribvalue, quote === QuoteType.Double ? "\"" : quote === QuoteType.Single ? "'" : quote === QuoteType.NoValue ? void 0 : null);
|
|
4057
|
+
if (this.attribs && !Object.hasOwn(this.attribs, this.attribname)) this.attribs[this.attribname] = this.attribvalue;
|
|
4058
|
+
this.attribvalue = "";
|
|
4059
|
+
}
|
|
4060
|
+
getInstructionName(value) {
|
|
4061
|
+
const index = value.search(reNameEnd);
|
|
4062
|
+
let name = index < 0 ? value : value.substr(0, index);
|
|
4063
|
+
if (this.lowerCaseTagNames) name = name.toLowerCase();
|
|
4064
|
+
return name;
|
|
4065
|
+
}
|
|
4066
|
+
/**
|
|
4067
|
+
* @param start Start index for the current parser event.
|
|
4068
|
+
* @param endIndex End index for the current parser event.
|
|
4069
|
+
* @internal
|
|
4070
|
+
*/
|
|
4071
|
+
ondeclaration(start, endIndex) {
|
|
4072
|
+
this.endIndex = endIndex;
|
|
4073
|
+
const value = this.getSlice(start, endIndex);
|
|
4074
|
+
if (this.cbs.onprocessinginstruction) {
|
|
4075
|
+
const name = this.htmlMode ? this.lowerCaseTagNames ? DOCUMENT_TYPE : value.slice(0, 7) : this.getInstructionName(value);
|
|
4076
|
+
this.cbs.onprocessinginstruction(`!${name}`, `!${value}`);
|
|
4077
|
+
}
|
|
4078
|
+
this.startIndex = endIndex + 1;
|
|
4079
|
+
}
|
|
4080
|
+
/**
|
|
4081
|
+
* @param start Start index for the current parser event.
|
|
4082
|
+
* @param endIndex End index for the current parser event.
|
|
4083
|
+
* @internal
|
|
4084
|
+
*/
|
|
4085
|
+
onprocessinginstruction(start, endIndex) {
|
|
4086
|
+
this.endIndex = endIndex;
|
|
4087
|
+
const value = this.getSlice(start, endIndex);
|
|
4088
|
+
if (this.cbs.onprocessinginstruction) {
|
|
4089
|
+
const name = this.getInstructionName(value);
|
|
4090
|
+
this.cbs.onprocessinginstruction(`?${name}`, `?${value}`);
|
|
4091
|
+
}
|
|
4092
|
+
this.startIndex = endIndex + 1;
|
|
4093
|
+
}
|
|
4094
|
+
/**
|
|
4095
|
+
* @param start Start index for the current parser event.
|
|
4096
|
+
* @param endIndex End index for the current parser event.
|
|
4097
|
+
* @param offset Offset applied when computing parser indices.
|
|
4098
|
+
* @internal
|
|
4099
|
+
*/
|
|
4100
|
+
oncomment(start, endIndex, offset) {
|
|
4101
|
+
this.endIndex = endIndex;
|
|
4102
|
+
this.cbs.oncomment?.(this.getSlice(start, endIndex - offset));
|
|
4103
|
+
this.cbs.oncommentend?.();
|
|
4104
|
+
this.startIndex = endIndex + 1;
|
|
4105
|
+
}
|
|
4106
|
+
/**
|
|
4107
|
+
* @param start Start index for the current parser event.
|
|
4108
|
+
* @param endIndex End index for the current parser event.
|
|
4109
|
+
* @param offset Offset applied when computing parser indices.
|
|
4110
|
+
* @internal
|
|
4111
|
+
*/
|
|
4112
|
+
oncdata(start, endIndex, offset) {
|
|
4113
|
+
this.endIndex = endIndex;
|
|
4114
|
+
const value = this.getSlice(start, endIndex - offset);
|
|
4115
|
+
if (!this.htmlMode || this.options.recognizeCDATA) {
|
|
4116
|
+
this.cbs.oncdatastart?.();
|
|
4117
|
+
this.cbs.ontext?.(value);
|
|
4118
|
+
this.cbs.oncdataend?.();
|
|
4119
|
+
} else if (this.isInForeignContext()) this.cbs.ontext?.(value);
|
|
4120
|
+
else {
|
|
4121
|
+
this.cbs.oncomment?.(`[CDATA[${value}]]`);
|
|
4122
|
+
this.cbs.oncommentend?.();
|
|
4123
|
+
}
|
|
4124
|
+
this.startIndex = endIndex + 1;
|
|
4125
|
+
}
|
|
4126
|
+
/** @internal */
|
|
4127
|
+
onend() {
|
|
4128
|
+
if (this.cbs.onclosetag) {
|
|
4129
|
+
this.endIndex = this.startIndex;
|
|
4130
|
+
for (let index = 0; index < this.stack.length; index++) this.cbs.onclosetag(this.stack[index], true);
|
|
4131
|
+
}
|
|
4132
|
+
this.cbs.onend?.();
|
|
4133
|
+
}
|
|
4134
|
+
/**
|
|
4135
|
+
* Resets the parser to a blank state, ready to parse a new HTML document
|
|
4136
|
+
*/
|
|
4137
|
+
reset() {
|
|
4138
|
+
this.cbs.onreset?.();
|
|
4139
|
+
this.tokenizer.reset();
|
|
4140
|
+
this.tagname = "";
|
|
4141
|
+
this.attribname = "";
|
|
4142
|
+
this.attribvalue = "";
|
|
4143
|
+
this.attribs = null;
|
|
4144
|
+
this.stack.length = 0;
|
|
4145
|
+
this.startIndex = 0;
|
|
4146
|
+
this.endIndex = 0;
|
|
4147
|
+
this.cbs.onparserinit?.(this);
|
|
4148
|
+
this.buffers.length = 0;
|
|
4149
|
+
this.foreignContext.length = 0;
|
|
4150
|
+
this.foreignContext.unshift(ForeignContext.None);
|
|
4151
|
+
this.bufferOffset = 0;
|
|
4152
|
+
this.writeIndex = 0;
|
|
4153
|
+
this.ended = false;
|
|
4154
|
+
}
|
|
4155
|
+
/**
|
|
4156
|
+
* Resets the parser, then parses a complete document and
|
|
4157
|
+
* pushes it to the handler.
|
|
4158
|
+
* @param data Document to parse.
|
|
4159
|
+
*/
|
|
4160
|
+
parseComplete(data) {
|
|
4161
|
+
this.reset();
|
|
4162
|
+
this.end(data);
|
|
4163
|
+
}
|
|
4164
|
+
getSlice(start, end) {
|
|
4165
|
+
if (start === end) return "";
|
|
4166
|
+
while (start - this.bufferOffset >= this.buffers[0].length) this.shiftBuffer();
|
|
4167
|
+
let slice = this.buffers[0].slice(start - this.bufferOffset, end - this.bufferOffset);
|
|
4168
|
+
while (end - this.bufferOffset > this.buffers[0].length) {
|
|
4169
|
+
this.shiftBuffer();
|
|
4170
|
+
slice += this.buffers[0].slice(0, end - this.bufferOffset);
|
|
4171
|
+
}
|
|
4172
|
+
return slice;
|
|
4173
|
+
}
|
|
4174
|
+
shiftBuffer() {
|
|
4175
|
+
this.bufferOffset += this.buffers[0].length;
|
|
4176
|
+
this.writeIndex--;
|
|
4177
|
+
this.buffers.shift();
|
|
4178
|
+
}
|
|
4179
|
+
/**
|
|
4180
|
+
* Parses a chunk of data and calls the corresponding callbacks.
|
|
4181
|
+
* @param chunk Chunk to parse.
|
|
4182
|
+
*/
|
|
4183
|
+
write(chunk) {
|
|
4184
|
+
if (this.ended) {
|
|
4185
|
+
this.cbs.onerror?.(/* @__PURE__ */ new Error(".write() after done!"));
|
|
4186
|
+
return;
|
|
4187
|
+
}
|
|
4188
|
+
this.buffers.push(chunk);
|
|
4189
|
+
if (this.tokenizer.running) {
|
|
4190
|
+
this.tokenizer.write(chunk);
|
|
4191
|
+
this.writeIndex++;
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
/**
|
|
4195
|
+
* Parses the end of the buffer and clears the stack, calls onend.
|
|
4196
|
+
* @param chunk Optional final chunk to parse.
|
|
4197
|
+
*/
|
|
4198
|
+
end(chunk) {
|
|
4199
|
+
if (this.ended) {
|
|
4200
|
+
this.cbs.onerror?.(/* @__PURE__ */ new Error(".end() after done!"));
|
|
4201
|
+
return;
|
|
4202
|
+
}
|
|
4203
|
+
if (chunk) this.write(chunk);
|
|
4204
|
+
this.ended = true;
|
|
4205
|
+
this.tokenizer.end();
|
|
4206
|
+
}
|
|
4207
|
+
/**
|
|
4208
|
+
* Pauses parsing. The parser won't emit events until `resume` is called.
|
|
4209
|
+
*/
|
|
4210
|
+
pause() {
|
|
4211
|
+
this.tokenizer.pause();
|
|
4212
|
+
}
|
|
4213
|
+
/**
|
|
4214
|
+
* Resumes parsing after `pause` was called.
|
|
4215
|
+
*/
|
|
4216
|
+
resume() {
|
|
4217
|
+
this.tokenizer.resume();
|
|
4218
|
+
while (this.tokenizer.running && this.writeIndex < this.buffers.length) this.tokenizer.write(this.buffers[this.writeIndex++]);
|
|
4219
|
+
if (this.ended) this.tokenizer.end();
|
|
4220
|
+
}
|
|
4221
|
+
};
|
|
4222
|
+
//#endregion
|
|
2223
4223
|
//#region src/wxml/whitespace.ts
|
|
2224
4224
|
const WHITESPACE_CODES = new Set([
|
|
2225
4225
|
9,
|
|
@@ -2454,7 +4454,7 @@ async function customTemplateHandler(rawSource, options, cachedMatcher) {
|
|
|
2454
4454
|
const lowerName = name.toLowerCase();
|
|
2455
4455
|
return lowerName === "class" || lowerName === "hover-class" || lowerName === "virtualhostclass";
|
|
2456
4456
|
}
|
|
2457
|
-
const parser = new
|
|
4457
|
+
const parser = new Parser({
|
|
2458
4458
|
onopentagname(name) {
|
|
2459
4459
|
tag = name;
|
|
2460
4460
|
},
|
|
@@ -2505,10 +4505,19 @@ function createTemplateHandler(options = {}) {
|
|
|
2505
4505
|
};
|
|
2506
4506
|
}
|
|
2507
4507
|
//#endregion
|
|
2508
|
-
//#region src/
|
|
4508
|
+
//#region src/constants.ts
|
|
4509
|
+
const pluginName = "weapp-tailwindcss";
|
|
4510
|
+
const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
4511
|
+
const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
|
|
4512
|
+
"tailwind-merge": "@weapp-tailwindcss/merge",
|
|
4513
|
+
"class-variance-authority": "@weapp-tailwindcss/cva",
|
|
4514
|
+
"tailwind-variants": "@weapp-tailwindcss/variants"
|
|
4515
|
+
};
|
|
4516
|
+
//#endregion
|
|
4517
|
+
//#region src/context/runtime-package-replacements.ts
|
|
2509
4518
|
function resolveRuntimePackageReplacements(option) {
|
|
2510
|
-
|
|
2511
|
-
|
|
4519
|
+
const mapping = require_v3_engine.resolveBooleanObjectOption(option, DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS);
|
|
4520
|
+
if (!mapping) return;
|
|
2512
4521
|
const normalized = {};
|
|
2513
4522
|
for (const [from, to] of Object.entries(mapping)) {
|
|
2514
4523
|
if (!from || typeof to !== "string" || to.length === 0) continue;
|
|
@@ -2516,29 +4525,43 @@ function resolveRuntimePackageReplacements(option) {
|
|
|
2516
4525
|
}
|
|
2517
4526
|
return Object.keys(normalized).length > 0 ? normalized : void 0;
|
|
2518
4527
|
}
|
|
4528
|
+
//#endregion
|
|
4529
|
+
//#region src/context/style-options.ts
|
|
4530
|
+
function resolveStyleOptionsFromContext(ctx) {
|
|
4531
|
+
const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(ctx.uniAppX);
|
|
4532
|
+
return {
|
|
4533
|
+
cssPreflight: ctx.cssPreflight,
|
|
4534
|
+
cssPreflightRange: ctx.cssPreflightRange,
|
|
4535
|
+
cssChildCombinatorReplaceValue: ctx.cssChildCombinatorReplaceValue,
|
|
4536
|
+
cssSelectorReplacement: ctx.cssSelectorReplacement,
|
|
4537
|
+
rem2rpx: ctx.rem2rpx,
|
|
4538
|
+
cssRemoveProperty: ctx.cssRemoveProperty,
|
|
4539
|
+
cssRemoveHoverPseudoClass: ctx.cssRemoveHoverPseudoClass,
|
|
4540
|
+
cssPresetEnv: ctx.cssPresetEnv,
|
|
4541
|
+
autoprefixer: ctx.autoprefixer,
|
|
4542
|
+
cssCalc: ctx.cssCalc,
|
|
4543
|
+
uniAppX: resolvedUniAppXOptions.enabled,
|
|
4544
|
+
platform: ctx.platform,
|
|
4545
|
+
px2rpx: ctx.px2rpx,
|
|
4546
|
+
unitsToPx: ctx.unitsToPx,
|
|
4547
|
+
unitConversion: ctx.unitConversion
|
|
4548
|
+
};
|
|
4549
|
+
}
|
|
4550
|
+
//#endregion
|
|
4551
|
+
//#region src/context/handlers.ts
|
|
2519
4552
|
function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
|
|
2520
|
-
const {
|
|
2521
|
-
const uniAppXEnabled = require_tailwindcss.isUniAppXEnabled(uniAppX);
|
|
4553
|
+
const { escapeMap, injectAdditionalCssVarScope, postcssOptions, uniAppX, arbitraryValues, jsPreserveClass, jsArbitraryValueFallback, babelParserOptions, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
|
|
2522
4554
|
const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(uniAppX);
|
|
4555
|
+
const styleOptions = resolveStyleOptionsFromContext(ctx);
|
|
4556
|
+
const uniAppXEnabled = styleOptions.uniAppX === true;
|
|
2523
4557
|
const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
|
|
2524
4558
|
const styleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
|
|
2525
|
-
|
|
2526
|
-
cssPreflightRange,
|
|
4559
|
+
...styleOptions,
|
|
2527
4560
|
escapeMap,
|
|
2528
|
-
cssChildCombinatorReplaceValue,
|
|
2529
4561
|
injectAdditionalCssVarScope,
|
|
2530
|
-
cssSelectorReplacement,
|
|
2531
|
-
rem2rpx,
|
|
2532
4562
|
postcssOptions,
|
|
2533
|
-
cssRemoveProperty,
|
|
2534
|
-
cssRemoveHoverPseudoClass,
|
|
2535
|
-
cssPresetEnv,
|
|
2536
|
-
autoprefixer,
|
|
2537
|
-
uniAppX: uniAppXEnabled,
|
|
2538
4563
|
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
2539
4564
|
cssCalc: cssCalcOptions,
|
|
2540
|
-
px2rpx,
|
|
2541
|
-
unitsToPx,
|
|
2542
4565
|
majorVersion: tailwindcssMajorVersion
|
|
2543
4566
|
});
|
|
2544
4567
|
const jsHandler = createJsHandler({
|
|
@@ -2609,6 +4632,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
|
|
|
2609
4632
|
}
|
|
2610
4633
|
function createInternalCompilerContext(opts) {
|
|
2611
4634
|
const ctx = (0, _weapp_tailwindcss_shared.defuOverrideArray)(opts, require_defaults.getDefaultOptions(), {});
|
|
4635
|
+
ctx.arbitraryValues = resolveUnocssBareArbitraryValues(ctx.arbitraryValues, ctx.unocss);
|
|
2612
4636
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
2613
4637
|
applyLoggerLevel(ctx.logLevel);
|
|
2614
4638
|
const twPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
|
|
@@ -2678,6 +4702,12 @@ Object.defineProperty(exports, "JsTokenUpdater", {
|
|
|
2678
4702
|
return JsTokenUpdater;
|
|
2679
4703
|
}
|
|
2680
4704
|
});
|
|
4705
|
+
Object.defineProperty(exports, "Parser", {
|
|
4706
|
+
enumerable: true,
|
|
4707
|
+
get: function() {
|
|
4708
|
+
return Parser;
|
|
4709
|
+
}
|
|
4710
|
+
});
|
|
2681
4711
|
Object.defineProperty(exports, "_defineProperty", {
|
|
2682
4712
|
enumerable: true,
|
|
2683
4713
|
get: function() {
|
|
@@ -2756,6 +4786,12 @@ Object.defineProperty(exports, "replaceWxml", {
|
|
|
2756
4786
|
return replaceWxml;
|
|
2757
4787
|
}
|
|
2758
4788
|
});
|
|
4789
|
+
Object.defineProperty(exports, "resolveStyleOptionsFromContext", {
|
|
4790
|
+
enumerable: true,
|
|
4791
|
+
get: function() {
|
|
4792
|
+
return resolveStyleOptionsFromContext;
|
|
4793
|
+
}
|
|
4794
|
+
});
|
|
2759
4795
|
Object.defineProperty(exports, "shouldSkipJsTransform", {
|
|
2760
4796
|
enumerable: true,
|
|
2761
4797
|
get: function() {
|