cloudstructs 0.9.19 → 0.9.21
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/.jsii +4 -4
- package/assets/slack-textract/detect.lambda/index.js +21 -10
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/dmarc/index.js +1 -1
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/mjml-template/index.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-app/manifest.js +1 -1
- package/lib/slack-app/slack-app.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +1 -1
- package/lib/ssl-server-test/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/index.js +1 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@babel/runtime/helpers/esm/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/esm/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/helpers/superPropGet.js +4 -4
- package/node_modules/@babel/runtime/helpers/superPropSet.js +2 -2
- package/node_modules/@babel/runtime/package.json +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@slack/logger/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@slack/logger/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@slack/logger/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@slack/logger/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@slack/logger/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@slack/logger/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +4 -3
- package/node_modules/@slack/logger/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@slack/logger/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@slack/logger/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@slack/logger/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@slack/logger/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@slack/logger/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@slack/logger/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@slack/logger/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@slack/logger/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@slack/logger/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@slack/logger/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.d.ts +36 -4
- package/node_modules/@slack/web-api/dist/WebClient.d.ts.map +1 -1
- package/node_modules/@slack/web-api/dist/WebClient.js +23 -10
- package/node_modules/@slack/web-api/dist/WebClient.js.map +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@slack/web-api/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +4 -3
- package/node_modules/@slack/web-api/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@slack/web-api/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@slack/web-api/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@slack/web-api/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@slack/web-api/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@slack/web-api/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@slack/web-api/package.json +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/cacheable-request/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/cacheable-request/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/cacheable-request/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/cacheable-request/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/cacheable-request/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/cacheable-request/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/keyv/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/keyv/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/keyv/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/keyv/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/keyv/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/keyv/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/keyv/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/keyv/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/keyv/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/keyv/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/keyv/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/keyv/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/keyv/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/keyv/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/keyv/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/keyv/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/keyv/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/assert.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/indexable.d.ts +23 -0
- package/node_modules/@types/responselike/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/node_modules/@types/responselike/node_modules/@types/node/crypto.d.ts +10 -9
- package/node_modules/@types/responselike/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/fs/promises.d.ts +15 -4
- package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/globals.d.ts +17 -48
- package/node_modules/@types/responselike/node_modules/@types/node/http.d.ts +37 -0
- package/node_modules/@types/responselike/node_modules/@types/node/index.d.ts +8 -10
- package/node_modules/@types/responselike/node_modules/@types/node/module.d.ts +91 -0
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +4 -3
- package/node_modules/@types/responselike/node_modules/@types/node/perf_hooks.d.ts +24 -0
- package/node_modules/@types/responselike/node_modules/@types/node/readline/promises.d.ts +14 -2
- package/node_modules/@types/responselike/node_modules/@types/node/readline.d.ts +58 -9
- package/node_modules/@types/responselike/node_modules/@types/node/stream/promises.d.ts +8 -1
- package/node_modules/@types/responselike/node_modules/@types/node/stream/web.d.ts +5 -2
- package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/test.d.ts +36 -5
- package/node_modules/@types/responselike/node_modules/@types/node/timers/promises.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/tls.d.ts +6 -0
- package/node_modules/@types/responselike/node_modules/@types/node/ts5.6/index.d.ts +8 -10
- package/node_modules/@types/responselike/node_modules/@types/node/url.d.ts +7 -4
- package/node_modules/@types/responselike/node_modules/@types/node/util.d.ts +80 -10
- package/node_modules/@types/responselike/node_modules/@types/node/vm.d.ts +81 -27
- package/node_modules/@types/responselike/node_modules/@types/node/worker_threads.d.ts +1 -1
- package/node_modules/cross-spawn/README.md +3 -10
- package/node_modules/cross-spawn/lib/enoent.js +1 -1
- package/node_modules/cross-spawn/lib/util/escape.js +4 -2
- package/node_modules/cross-spawn/package.json +1 -1
- package/node_modules/form-data/Readme.md +4 -4
- package/node_modules/form-data/lib/form_data.js +1 -1
- package/node_modules/form-data/package.json +9 -6
- package/node_modules/parse5/dist/cjs/common/doctype.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/doctype.js +2 -4
- package/node_modules/parse5/dist/cjs/common/error-codes.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/error-codes.js +1 -2
- package/node_modules/parse5/dist/cjs/common/foreign-content.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/foreign-content.js +7 -9
- package/node_modules/parse5/dist/cjs/common/html.d.ts +32 -31
- package/node_modules/parse5/dist/cjs/common/html.js +41 -42
- package/node_modules/parse5/dist/cjs/common/token.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/common/token.js +3 -4
- package/node_modules/parse5/dist/cjs/common/unicode.d.ts +1 -8
- package/node_modules/parse5/dist/cjs/common/unicode.js +7 -14
- package/node_modules/parse5/dist/cjs/index.d.ts +15 -4
- package/node_modules/parse5/dist/cjs/index.js +3 -6
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/parser/formatting-element-list.js +1 -2
- package/node_modules/parse5/dist/cjs/parser/index.d.ts +72 -8
- package/node_modules/parse5/dist/cjs/parser/index.js +81 -9
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.d.ts +2 -2
- package/node_modules/parse5/dist/cjs/parser/open-element-stack.js +95 -87
- package/node_modules/parse5/dist/cjs/serializer/index.d.ts +1 -2
- package/node_modules/parse5/dist/cjs/serializer/index.js +8 -9
- package/node_modules/parse5/dist/cjs/tokenizer/index.d.ts +130 -131
- package/node_modules/parse5/dist/cjs/tokenizer/index.js +87 -281
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.d.ts +3 -4
- package/node_modules/parse5/dist/cjs/tokenizer/preprocessor.js +8 -7
- package/node_modules/parse5/dist/cjs/tree-adapters/default.d.ts +0 -1
- package/node_modules/parse5/dist/cjs/tree-adapters/default.js +9 -10
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.d.ts +7 -2
- package/node_modules/parse5/dist/cjs/tree-adapters/interface.js +0 -1
- package/node_modules/parse5/dist/common/doctype.d.ts +0 -1
- package/node_modules/parse5/dist/common/doctype.js +0 -1
- package/node_modules/parse5/dist/common/error-codes.d.ts +0 -1
- package/node_modules/parse5/dist/common/error-codes.js +1 -2
- package/node_modules/parse5/dist/common/foreign-content.d.ts +0 -1
- package/node_modules/parse5/dist/common/foreign-content.js +0 -2
- package/node_modules/parse5/dist/common/html.d.ts +32 -31
- package/node_modules/parse5/dist/common/html.js +38 -38
- package/node_modules/parse5/dist/common/token.d.ts +0 -1
- package/node_modules/parse5/dist/common/token.js +1 -2
- package/node_modules/parse5/dist/common/unicode.d.ts +1 -8
- package/node_modules/parse5/dist/common/unicode.js +1 -8
- package/node_modules/parse5/dist/index.d.ts +15 -4
- package/node_modules/parse5/dist/index.js +0 -3
- package/node_modules/parse5/dist/parser/formatting-element-list.d.ts +0 -1
- package/node_modules/parse5/dist/parser/formatting-element-list.js +1 -2
- package/node_modules/parse5/dist/parser/index.d.ts +72 -8
- package/node_modules/parse5/dist/parser/index.js +82 -10
- package/node_modules/parse5/dist/parser/open-element-stack.d.ts +2 -2
- package/node_modules/parse5/dist/parser/open-element-stack.js +96 -88
- package/node_modules/parse5/dist/serializer/index.d.ts +1 -2
- package/node_modules/parse5/dist/serializer/index.js +6 -6
- package/node_modules/parse5/dist/tokenizer/index.d.ts +130 -131
- package/node_modules/parse5/dist/tokenizer/index.js +88 -282
- package/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +3 -4
- package/node_modules/parse5/dist/tokenizer/preprocessor.js +8 -7
- package/node_modules/parse5/dist/tree-adapters/default.d.ts +0 -1
- package/node_modules/parse5/dist/tree-adapters/default.js +9 -10
- package/node_modules/parse5/dist/tree-adapters/interface.d.ts +7 -2
- package/node_modules/parse5/dist/tree-adapters/interface.js +0 -1
- package/node_modules/parse5/package.json +4 -4
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/cjs/index.d.ts +1 -2
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/cjs/index.js +11 -12
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/index.d.ts +1 -2
- package/node_modules/parse5-htmlparser2-tree-adapter/dist/index.js +9 -10
- package/node_modules/parse5-htmlparser2-tree-adapter/package.json +7 -6
- package/package.json +21 -20
- package/node_modules/@slack/logger/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/keyv/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/@types/responselike/node_modules/@types/node/globals.global.d.ts +0 -1
- package/node_modules/form-data/README.md.bak +0 -358
|
@@ -7,36 +7,6 @@ const token_js_1 = require("../common/token.js");
|
|
|
7
7
|
const decode_js_1 = require("entities/lib/decode.js");
|
|
8
8
|
const error_codes_js_1 = require("../common/error-codes.js");
|
|
9
9
|
const html_js_1 = require("../common/html.js");
|
|
10
|
-
//C1 Unicode control character reference replacements
|
|
11
|
-
const C1_CONTROLS_REFERENCE_REPLACEMENTS = new Map([
|
|
12
|
-
[0x80, 8364],
|
|
13
|
-
[0x82, 8218],
|
|
14
|
-
[0x83, 402],
|
|
15
|
-
[0x84, 8222],
|
|
16
|
-
[0x85, 8230],
|
|
17
|
-
[0x86, 8224],
|
|
18
|
-
[0x87, 8225],
|
|
19
|
-
[0x88, 710],
|
|
20
|
-
[0x89, 8240],
|
|
21
|
-
[0x8a, 352],
|
|
22
|
-
[0x8b, 8249],
|
|
23
|
-
[0x8c, 338],
|
|
24
|
-
[0x8e, 381],
|
|
25
|
-
[0x91, 8216],
|
|
26
|
-
[0x92, 8217],
|
|
27
|
-
[0x93, 8220],
|
|
28
|
-
[0x94, 8221],
|
|
29
|
-
[0x95, 8226],
|
|
30
|
-
[0x96, 8211],
|
|
31
|
-
[0x97, 8212],
|
|
32
|
-
[0x98, 732],
|
|
33
|
-
[0x99, 8482],
|
|
34
|
-
[0x9a, 353],
|
|
35
|
-
[0x9b, 8250],
|
|
36
|
-
[0x9c, 339],
|
|
37
|
-
[0x9e, 382],
|
|
38
|
-
[0x9f, 376],
|
|
39
|
-
]);
|
|
40
10
|
//States
|
|
41
11
|
var State;
|
|
42
12
|
(function (State) {
|
|
@@ -112,13 +82,7 @@ var State;
|
|
|
112
82
|
State[State["CDATA_SECTION_BRACKET"] = 69] = "CDATA_SECTION_BRACKET";
|
|
113
83
|
State[State["CDATA_SECTION_END"] = 70] = "CDATA_SECTION_END";
|
|
114
84
|
State[State["CHARACTER_REFERENCE"] = 71] = "CHARACTER_REFERENCE";
|
|
115
|
-
State[State["
|
|
116
|
-
State[State["AMBIGUOUS_AMPERSAND"] = 73] = "AMBIGUOUS_AMPERSAND";
|
|
117
|
-
State[State["NUMERIC_CHARACTER_REFERENCE"] = 74] = "NUMERIC_CHARACTER_REFERENCE";
|
|
118
|
-
State[State["HEXADEMICAL_CHARACTER_REFERENCE_START"] = 75] = "HEXADEMICAL_CHARACTER_REFERENCE_START";
|
|
119
|
-
State[State["HEXADEMICAL_CHARACTER_REFERENCE"] = 76] = "HEXADEMICAL_CHARACTER_REFERENCE";
|
|
120
|
-
State[State["DECIMAL_CHARACTER_REFERENCE"] = 77] = "DECIMAL_CHARACTER_REFERENCE";
|
|
121
|
-
State[State["NUMERIC_CHARACTER_REFERENCE_END"] = 78] = "NUMERIC_CHARACTER_REFERENCE_END";
|
|
85
|
+
State[State["AMBIGUOUS_AMPERSAND"] = 72] = "AMBIGUOUS_AMPERSAND";
|
|
122
86
|
})(State || (State = {}));
|
|
123
87
|
//Tokenizer initial states for different modes
|
|
124
88
|
exports.TokenizerMode = {
|
|
@@ -148,27 +112,33 @@ function isAsciiLetter(cp) {
|
|
|
148
112
|
function isAsciiAlphaNumeric(cp) {
|
|
149
113
|
return isAsciiLetter(cp) || isAsciiDigit(cp);
|
|
150
114
|
}
|
|
151
|
-
function isAsciiUpperHexDigit(cp) {
|
|
152
|
-
return cp >= unicode_js_1.CODE_POINTS.LATIN_CAPITAL_A && cp <= unicode_js_1.CODE_POINTS.LATIN_CAPITAL_F;
|
|
153
|
-
}
|
|
154
|
-
function isAsciiLowerHexDigit(cp) {
|
|
155
|
-
return cp >= unicode_js_1.CODE_POINTS.LATIN_SMALL_A && cp <= unicode_js_1.CODE_POINTS.LATIN_SMALL_F;
|
|
156
|
-
}
|
|
157
|
-
function isAsciiHexDigit(cp) {
|
|
158
|
-
return isAsciiDigit(cp) || isAsciiUpperHexDigit(cp) || isAsciiLowerHexDigit(cp);
|
|
159
|
-
}
|
|
160
115
|
function toAsciiLower(cp) {
|
|
161
116
|
return cp + 32;
|
|
162
117
|
}
|
|
163
118
|
function isWhitespace(cp) {
|
|
164
119
|
return cp === unicode_js_1.CODE_POINTS.SPACE || cp === unicode_js_1.CODE_POINTS.LINE_FEED || cp === unicode_js_1.CODE_POINTS.TABULATION || cp === unicode_js_1.CODE_POINTS.FORM_FEED;
|
|
165
120
|
}
|
|
166
|
-
function isEntityInAttributeInvalidEnd(nextCp) {
|
|
167
|
-
return nextCp === unicode_js_1.CODE_POINTS.EQUALS_SIGN || isAsciiAlphaNumeric(nextCp);
|
|
168
|
-
}
|
|
169
121
|
function isScriptDataDoubleEscapeSequenceEnd(cp) {
|
|
170
122
|
return isWhitespace(cp) || cp === unicode_js_1.CODE_POINTS.SOLIDUS || cp === unicode_js_1.CODE_POINTS.GREATER_THAN_SIGN;
|
|
171
123
|
}
|
|
124
|
+
function getErrorForNumericCharacterReference(code) {
|
|
125
|
+
if (code === unicode_js_1.CODE_POINTS.NULL) {
|
|
126
|
+
return error_codes_js_1.ERR.nullCharacterReference;
|
|
127
|
+
}
|
|
128
|
+
else if (code > 1114111) {
|
|
129
|
+
return error_codes_js_1.ERR.characterReferenceOutsideUnicodeRange;
|
|
130
|
+
}
|
|
131
|
+
else if ((0, unicode_js_1.isSurrogate)(code)) {
|
|
132
|
+
return error_codes_js_1.ERR.surrogateCharacterReference;
|
|
133
|
+
}
|
|
134
|
+
else if ((0, unicode_js_1.isUndefinedCodePoint)(code)) {
|
|
135
|
+
return error_codes_js_1.ERR.noncharacterCharacterReference;
|
|
136
|
+
}
|
|
137
|
+
else if ((0, unicode_js_1.isControlCodePoint)(code) || code === unicode_js_1.CODE_POINTS.CARRIAGE_RETURN) {
|
|
138
|
+
return error_codes_js_1.ERR.controlCharacterReference;
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
172
142
|
//Tokenizer
|
|
173
143
|
class Tokenizer {
|
|
174
144
|
constructor(options, handler) {
|
|
@@ -188,18 +158,38 @@ class Tokenizer {
|
|
|
188
158
|
this.active = false;
|
|
189
159
|
this.state = State.DATA;
|
|
190
160
|
this.returnState = State.DATA;
|
|
191
|
-
this.
|
|
161
|
+
this.entityStartPos = 0;
|
|
192
162
|
this.consumedAfterSnapshot = -1;
|
|
193
163
|
this.currentCharacterToken = null;
|
|
194
164
|
this.currentToken = null;
|
|
195
165
|
this.currentAttr = { name: '', value: '' };
|
|
196
166
|
this.preprocessor = new preprocessor_js_1.Preprocessor(handler);
|
|
197
167
|
this.currentLocation = this.getCurrentLocation(-1);
|
|
168
|
+
this.entityDecoder = new decode_js_1.EntityDecoder(decode_js_1.htmlDecodeTree, (cp, consumed) => {
|
|
169
|
+
// Note: Set `pos` _before_ flushing, as flushing might drop
|
|
170
|
+
// the current chunk and invalidate `entityStartPos`.
|
|
171
|
+
this.preprocessor.pos = this.entityStartPos + consumed - 1;
|
|
172
|
+
this._flushCodePointConsumedAsCharacterReference(cp);
|
|
173
|
+
}, handler.onParseError
|
|
174
|
+
? {
|
|
175
|
+
missingSemicolonAfterCharacterReference: () => {
|
|
176
|
+
this._err(error_codes_js_1.ERR.missingSemicolonAfterCharacterReference, 1);
|
|
177
|
+
},
|
|
178
|
+
absenceOfDigitsInNumericCharacterReference: (consumed) => {
|
|
179
|
+
this._err(error_codes_js_1.ERR.absenceOfDigitsInNumericCharacterReference, this.entityStartPos - this.preprocessor.pos + consumed);
|
|
180
|
+
},
|
|
181
|
+
validateNumericCharacterReference: (code) => {
|
|
182
|
+
const error = getErrorForNumericCharacterReference(code);
|
|
183
|
+
if (error)
|
|
184
|
+
this._err(error, 1);
|
|
185
|
+
},
|
|
186
|
+
}
|
|
187
|
+
: undefined);
|
|
198
188
|
}
|
|
199
189
|
//Errors
|
|
200
|
-
_err(code) {
|
|
190
|
+
_err(code, cpOffset = 0) {
|
|
201
191
|
var _a, _b;
|
|
202
|
-
(_b = (_a = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a, this.preprocessor.getError(code));
|
|
192
|
+
(_b = (_a = this.handler).onParseError) === null || _b === void 0 ? void 0 : _b.call(_a, this.preprocessor.getError(code, cpOffset));
|
|
203
193
|
}
|
|
204
194
|
// NOTE: `offset` may never run across line boundaries.
|
|
205
195
|
getCurrentLocation(offset) {
|
|
@@ -261,7 +251,8 @@ class Tokenizer {
|
|
|
261
251
|
//Hibernation
|
|
262
252
|
_ensureHibernation() {
|
|
263
253
|
if (this.preprocessor.endOfChunkHit) {
|
|
264
|
-
this.
|
|
254
|
+
this.preprocessor.retreat(this.consumedAfterSnapshot);
|
|
255
|
+
this.consumedAfterSnapshot = 0;
|
|
265
256
|
this.active = false;
|
|
266
257
|
return true;
|
|
267
258
|
}
|
|
@@ -272,14 +263,6 @@ class Tokenizer {
|
|
|
272
263
|
this.consumedAfterSnapshot++;
|
|
273
264
|
return this.preprocessor.advance();
|
|
274
265
|
}
|
|
275
|
-
_unconsume(count) {
|
|
276
|
-
this.consumedAfterSnapshot -= count;
|
|
277
|
-
this.preprocessor.retreat(count);
|
|
278
|
-
}
|
|
279
|
-
_reconsumeInState(state, cp) {
|
|
280
|
-
this.state = state;
|
|
281
|
-
this._callState(cp);
|
|
282
|
-
}
|
|
283
266
|
_advanceBy(count) {
|
|
284
267
|
this.consumedAfterSnapshot += count;
|
|
285
268
|
for (let i = 0; i < count; i++) {
|
|
@@ -451,7 +434,7 @@ class Tokenizer {
|
|
|
451
434
|
this.active = false;
|
|
452
435
|
}
|
|
453
436
|
//Characters emission
|
|
454
|
-
//OPTIMIZATION: specification uses only one type of character
|
|
437
|
+
//OPTIMIZATION: The specification uses only one type of character token (one token per character).
|
|
455
438
|
//This causes a huge memory overhead and a lot of unnecessary parser loops. parse5 uses 3 groups of characters.
|
|
456
439
|
//If we have a sequence of characters that belong to the same group, the parser can process it
|
|
457
440
|
//as a single solid character token.
|
|
@@ -461,15 +444,15 @@ class Tokenizer {
|
|
|
461
444
|
//3)TokenType.CHARACTER - any character sequence which don't belong to groups 1 and 2 (e.g. 'abcdef1234@@#$%^')
|
|
462
445
|
_appendCharToCurrentCharacterToken(type, ch) {
|
|
463
446
|
if (this.currentCharacterToken) {
|
|
464
|
-
if (this.currentCharacterToken.type
|
|
447
|
+
if (this.currentCharacterToken.type === type) {
|
|
448
|
+
this.currentCharacterToken.chars += ch;
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
else {
|
|
465
452
|
this.currentLocation = this.getCurrentLocation(0);
|
|
466
453
|
this._emitCurrentCharacterToken(this.currentLocation);
|
|
467
454
|
this.preprocessor.dropParsedChunk();
|
|
468
455
|
}
|
|
469
|
-
else {
|
|
470
|
-
this.currentCharacterToken.chars += ch;
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
456
|
}
|
|
474
457
|
this._createCharacterToken(type, ch);
|
|
475
458
|
}
|
|
@@ -487,59 +470,11 @@ class Tokenizer {
|
|
|
487
470
|
this._appendCharToCurrentCharacterToken(token_js_1.TokenType.CHARACTER, ch);
|
|
488
471
|
}
|
|
489
472
|
// Character reference helpers
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
i = (0, decode_js_1.determineBranch)(decode_js_1.htmlDecodeTree, current, i + 1, cp);
|
|
496
|
-
if (i < 0)
|
|
497
|
-
break;
|
|
498
|
-
excess += 1;
|
|
499
|
-
current = decode_js_1.htmlDecodeTree[i];
|
|
500
|
-
const masked = current & decode_js_1.BinTrieFlags.VALUE_LENGTH;
|
|
501
|
-
// If the branch is a value, store it and continue
|
|
502
|
-
if (masked) {
|
|
503
|
-
// The mask is the number of bytes of the value, including the current byte.
|
|
504
|
-
const valueLength = (masked >> 14) - 1;
|
|
505
|
-
// Attribute values that aren't terminated properly aren't parsed, and shouldn't lead to a parser error.
|
|
506
|
-
// See the example in https://html.spec.whatwg.org/multipage/parsing.html#named-character-reference-state
|
|
507
|
-
if (cp !== unicode_js_1.CODE_POINTS.SEMICOLON &&
|
|
508
|
-
this._isCharacterReferenceInAttribute() &&
|
|
509
|
-
isEntityInAttributeInvalidEnd(this.preprocessor.peek(1))) {
|
|
510
|
-
//NOTE: we don't flush all consumed code points here, and instead switch back to the original state after
|
|
511
|
-
//emitting an ampersand. This is fine, as alphanumeric characters won't be parsed differently in attributes.
|
|
512
|
-
result = [unicode_js_1.CODE_POINTS.AMPERSAND];
|
|
513
|
-
// Skip over the value.
|
|
514
|
-
i += valueLength;
|
|
515
|
-
}
|
|
516
|
-
else {
|
|
517
|
-
// If this is a surrogate pair, consume the next two bytes.
|
|
518
|
-
result =
|
|
519
|
-
valueLength === 0
|
|
520
|
-
? [decode_js_1.htmlDecodeTree[i] & ~decode_js_1.BinTrieFlags.VALUE_LENGTH]
|
|
521
|
-
: valueLength === 1
|
|
522
|
-
? [decode_js_1.htmlDecodeTree[++i]]
|
|
523
|
-
: [decode_js_1.htmlDecodeTree[++i], decode_js_1.htmlDecodeTree[++i]];
|
|
524
|
-
excess = 0;
|
|
525
|
-
withoutSemicolon = cp !== unicode_js_1.CODE_POINTS.SEMICOLON;
|
|
526
|
-
}
|
|
527
|
-
if (valueLength === 0) {
|
|
528
|
-
// If the value is zero-length, we're done.
|
|
529
|
-
this._consume();
|
|
530
|
-
break;
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
this._unconsume(excess);
|
|
535
|
-
if (withoutSemicolon && !this.preprocessor.endOfChunkHit) {
|
|
536
|
-
this._err(error_codes_js_1.ERR.missingSemicolonAfterCharacterReference);
|
|
537
|
-
}
|
|
538
|
-
// We want to emit the error above on the code point after the entity.
|
|
539
|
-
// We always consume one code point too many in the loop, and we wait to
|
|
540
|
-
// unconsume it until after the error is emitted.
|
|
541
|
-
this._unconsume(1);
|
|
542
|
-
return result;
|
|
473
|
+
_startCharacterReference() {
|
|
474
|
+
this.returnState = this.state;
|
|
475
|
+
this.state = State.CHARACTER_REFERENCE;
|
|
476
|
+
this.entityStartPos = this.preprocessor.pos;
|
|
477
|
+
this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute() ? decode_js_1.DecodingMode.Attribute : decode_js_1.DecodingMode.Legacy);
|
|
543
478
|
}
|
|
544
479
|
_isCharacterReferenceInAttribute() {
|
|
545
480
|
return (this.returnState === State.ATTRIBUTE_VALUE_DOUBLE_QUOTED ||
|
|
@@ -842,37 +777,13 @@ class Tokenizer {
|
|
|
842
777
|
break;
|
|
843
778
|
}
|
|
844
779
|
case State.CHARACTER_REFERENCE: {
|
|
845
|
-
this._stateCharacterReference(
|
|
846
|
-
break;
|
|
847
|
-
}
|
|
848
|
-
case State.NAMED_CHARACTER_REFERENCE: {
|
|
849
|
-
this._stateNamedCharacterReference(cp);
|
|
780
|
+
this._stateCharacterReference();
|
|
850
781
|
break;
|
|
851
782
|
}
|
|
852
783
|
case State.AMBIGUOUS_AMPERSAND: {
|
|
853
784
|
this._stateAmbiguousAmpersand(cp);
|
|
854
785
|
break;
|
|
855
786
|
}
|
|
856
|
-
case State.NUMERIC_CHARACTER_REFERENCE: {
|
|
857
|
-
this._stateNumericCharacterReference(cp);
|
|
858
|
-
break;
|
|
859
|
-
}
|
|
860
|
-
case State.HEXADEMICAL_CHARACTER_REFERENCE_START: {
|
|
861
|
-
this._stateHexademicalCharacterReferenceStart(cp);
|
|
862
|
-
break;
|
|
863
|
-
}
|
|
864
|
-
case State.HEXADEMICAL_CHARACTER_REFERENCE: {
|
|
865
|
-
this._stateHexademicalCharacterReference(cp);
|
|
866
|
-
break;
|
|
867
|
-
}
|
|
868
|
-
case State.DECIMAL_CHARACTER_REFERENCE: {
|
|
869
|
-
this._stateDecimalCharacterReference(cp);
|
|
870
|
-
break;
|
|
871
|
-
}
|
|
872
|
-
case State.NUMERIC_CHARACTER_REFERENCE_END: {
|
|
873
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
874
|
-
break;
|
|
875
|
-
}
|
|
876
787
|
default: {
|
|
877
788
|
throw new Error('Unknown state');
|
|
878
789
|
}
|
|
@@ -888,8 +799,7 @@ class Tokenizer {
|
|
|
888
799
|
break;
|
|
889
800
|
}
|
|
890
801
|
case unicode_js_1.CODE_POINTS.AMPERSAND: {
|
|
891
|
-
this.
|
|
892
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
802
|
+
this._startCharacterReference();
|
|
893
803
|
break;
|
|
894
804
|
}
|
|
895
805
|
case unicode_js_1.CODE_POINTS.NULL: {
|
|
@@ -911,8 +821,7 @@ class Tokenizer {
|
|
|
911
821
|
_stateRcdata(cp) {
|
|
912
822
|
switch (cp) {
|
|
913
823
|
case unicode_js_1.CODE_POINTS.AMPERSAND: {
|
|
914
|
-
this.
|
|
915
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
824
|
+
this._startCharacterReference();
|
|
916
825
|
break;
|
|
917
826
|
}
|
|
918
827
|
case unicode_js_1.CODE_POINTS.LESS_THAN_SIGN: {
|
|
@@ -1681,8 +1590,7 @@ class Tokenizer {
|
|
|
1681
1590
|
break;
|
|
1682
1591
|
}
|
|
1683
1592
|
case unicode_js_1.CODE_POINTS.AMPERSAND: {
|
|
1684
|
-
this.
|
|
1685
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
1593
|
+
this._startCharacterReference();
|
|
1686
1594
|
break;
|
|
1687
1595
|
}
|
|
1688
1596
|
case unicode_js_1.CODE_POINTS.NULL: {
|
|
@@ -1709,8 +1617,7 @@ class Tokenizer {
|
|
|
1709
1617
|
break;
|
|
1710
1618
|
}
|
|
1711
1619
|
case unicode_js_1.CODE_POINTS.AMPERSAND: {
|
|
1712
|
-
this.
|
|
1713
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
1620
|
+
this._startCharacterReference();
|
|
1714
1621
|
break;
|
|
1715
1622
|
}
|
|
1716
1623
|
case unicode_js_1.CODE_POINTS.NULL: {
|
|
@@ -1741,8 +1648,7 @@ class Tokenizer {
|
|
|
1741
1648
|
break;
|
|
1742
1649
|
}
|
|
1743
1650
|
case unicode_js_1.CODE_POINTS.AMPERSAND: {
|
|
1744
|
-
this.
|
|
1745
|
-
this.state = State.CHARACTER_REFERENCE;
|
|
1651
|
+
this._startCharacterReference();
|
|
1746
1652
|
break;
|
|
1747
1653
|
}
|
|
1748
1654
|
case unicode_js_1.CODE_POINTS.GREATER_THAN_SIGN: {
|
|
@@ -2759,37 +2665,35 @@ class Tokenizer {
|
|
|
2759
2665
|
}
|
|
2760
2666
|
// Character reference state
|
|
2761
2667
|
//------------------------------------------------------------------
|
|
2762
|
-
_stateCharacterReference(
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2668
|
+
_stateCharacterReference() {
|
|
2669
|
+
let length = this.entityDecoder.write(this.preprocessor.html, this.preprocessor.pos);
|
|
2670
|
+
if (length < 0) {
|
|
2671
|
+
if (this.preprocessor.lastChunkWritten) {
|
|
2672
|
+
length = this.entityDecoder.end();
|
|
2673
|
+
}
|
|
2674
|
+
else {
|
|
2675
|
+
// Wait for the rest of the entity.
|
|
2676
|
+
this.active = false;
|
|
2677
|
+
// Mark the entire buffer as read.
|
|
2678
|
+
this.preprocessor.pos = this.preprocessor.html.length - 1;
|
|
2679
|
+
this.consumedAfterSnapshot = 0;
|
|
2680
|
+
this.preprocessor.endOfChunkHit = true;
|
|
2681
|
+
return;
|
|
2682
|
+
}
|
|
2769
2683
|
}
|
|
2770
|
-
|
|
2684
|
+
if (length === 0) {
|
|
2685
|
+
// This was not a valid entity. Go back to the beginning, and
|
|
2686
|
+
// figure out what to do.
|
|
2687
|
+
this.preprocessor.pos = this.entityStartPos;
|
|
2771
2688
|
this._flushCodePointConsumedAsCharacterReference(unicode_js_1.CODE_POINTS.AMPERSAND);
|
|
2772
|
-
this.
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
//------------------------------------------------------------------
|
|
2777
|
-
_stateNamedCharacterReference(cp) {
|
|
2778
|
-
const matchResult = this._matchNamedCharacterReference(cp);
|
|
2779
|
-
//NOTE: Matching can be abrupted by hibernation. In that case, match
|
|
2780
|
-
//results are no longer valid and we will need to start over.
|
|
2781
|
-
if (this._ensureHibernation()) {
|
|
2782
|
-
// Stay in the state, try again.
|
|
2783
|
-
}
|
|
2784
|
-
else if (matchResult) {
|
|
2785
|
-
for (let i = 0; i < matchResult.length; i++) {
|
|
2786
|
-
this._flushCodePointConsumedAsCharacterReference(matchResult[i]);
|
|
2787
|
-
}
|
|
2788
|
-
this.state = this.returnState;
|
|
2689
|
+
this.state =
|
|
2690
|
+
!this._isCharacterReferenceInAttribute() && isAsciiAlphaNumeric(this.preprocessor.peek(1))
|
|
2691
|
+
? State.AMBIGUOUS_AMPERSAND
|
|
2692
|
+
: this.returnState;
|
|
2789
2693
|
}
|
|
2790
2694
|
else {
|
|
2791
|
-
|
|
2792
|
-
this.state =
|
|
2695
|
+
// We successfully parsed an entity. Switch to the return state.
|
|
2696
|
+
this.state = this.returnState;
|
|
2793
2697
|
}
|
|
2794
2698
|
}
|
|
2795
2699
|
// Ambiguos ampersand state
|
|
@@ -2802,107 +2706,9 @@ class Tokenizer {
|
|
|
2802
2706
|
if (cp === unicode_js_1.CODE_POINTS.SEMICOLON) {
|
|
2803
2707
|
this._err(error_codes_js_1.ERR.unknownNamedCharacterReference);
|
|
2804
2708
|
}
|
|
2805
|
-
this._reconsumeInState(this.returnState, cp);
|
|
2806
|
-
}
|
|
2807
|
-
}
|
|
2808
|
-
// Numeric character reference state
|
|
2809
|
-
//------------------------------------------------------------------
|
|
2810
|
-
_stateNumericCharacterReference(cp) {
|
|
2811
|
-
this.charRefCode = 0;
|
|
2812
|
-
if (cp === unicode_js_1.CODE_POINTS.LATIN_SMALL_X || cp === unicode_js_1.CODE_POINTS.LATIN_CAPITAL_X) {
|
|
2813
|
-
this.state = State.HEXADEMICAL_CHARACTER_REFERENCE_START;
|
|
2814
|
-
}
|
|
2815
|
-
// Inlined decimal character reference start state
|
|
2816
|
-
else if (isAsciiDigit(cp)) {
|
|
2817
|
-
this.state = State.DECIMAL_CHARACTER_REFERENCE;
|
|
2818
|
-
this._stateDecimalCharacterReference(cp);
|
|
2819
|
-
}
|
|
2820
|
-
else {
|
|
2821
|
-
this._err(error_codes_js_1.ERR.absenceOfDigitsInNumericCharacterReference);
|
|
2822
|
-
this._flushCodePointConsumedAsCharacterReference(unicode_js_1.CODE_POINTS.AMPERSAND);
|
|
2823
|
-
this._flushCodePointConsumedAsCharacterReference(unicode_js_1.CODE_POINTS.NUMBER_SIGN);
|
|
2824
|
-
this._reconsumeInState(this.returnState, cp);
|
|
2825
|
-
}
|
|
2826
|
-
}
|
|
2827
|
-
// Hexademical character reference start state
|
|
2828
|
-
//------------------------------------------------------------------
|
|
2829
|
-
_stateHexademicalCharacterReferenceStart(cp) {
|
|
2830
|
-
if (isAsciiHexDigit(cp)) {
|
|
2831
|
-
this.state = State.HEXADEMICAL_CHARACTER_REFERENCE;
|
|
2832
|
-
this._stateHexademicalCharacterReference(cp);
|
|
2833
|
-
}
|
|
2834
|
-
else {
|
|
2835
|
-
this._err(error_codes_js_1.ERR.absenceOfDigitsInNumericCharacterReference);
|
|
2836
|
-
this._flushCodePointConsumedAsCharacterReference(unicode_js_1.CODE_POINTS.AMPERSAND);
|
|
2837
|
-
this._flushCodePointConsumedAsCharacterReference(unicode_js_1.CODE_POINTS.NUMBER_SIGN);
|
|
2838
|
-
this._unconsume(2);
|
|
2839
2709
|
this.state = this.returnState;
|
|
2710
|
+
this._callState(cp);
|
|
2840
2711
|
}
|
|
2841
2712
|
}
|
|
2842
|
-
// Hexademical character reference state
|
|
2843
|
-
//------------------------------------------------------------------
|
|
2844
|
-
_stateHexademicalCharacterReference(cp) {
|
|
2845
|
-
if (isAsciiUpperHexDigit(cp)) {
|
|
2846
|
-
this.charRefCode = this.charRefCode * 16 + cp - 0x37;
|
|
2847
|
-
}
|
|
2848
|
-
else if (isAsciiLowerHexDigit(cp)) {
|
|
2849
|
-
this.charRefCode = this.charRefCode * 16 + cp - 0x57;
|
|
2850
|
-
}
|
|
2851
|
-
else if (isAsciiDigit(cp)) {
|
|
2852
|
-
this.charRefCode = this.charRefCode * 16 + cp - 0x30;
|
|
2853
|
-
}
|
|
2854
|
-
else if (cp === unicode_js_1.CODE_POINTS.SEMICOLON) {
|
|
2855
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
2856
|
-
}
|
|
2857
|
-
else {
|
|
2858
|
-
this._err(error_codes_js_1.ERR.missingSemicolonAfterCharacterReference);
|
|
2859
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
2860
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
// Decimal character reference state
|
|
2864
|
-
//------------------------------------------------------------------
|
|
2865
|
-
_stateDecimalCharacterReference(cp) {
|
|
2866
|
-
if (isAsciiDigit(cp)) {
|
|
2867
|
-
this.charRefCode = this.charRefCode * 10 + cp - 0x30;
|
|
2868
|
-
}
|
|
2869
|
-
else if (cp === unicode_js_1.CODE_POINTS.SEMICOLON) {
|
|
2870
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
2871
|
-
}
|
|
2872
|
-
else {
|
|
2873
|
-
this._err(error_codes_js_1.ERR.missingSemicolonAfterCharacterReference);
|
|
2874
|
-
this.state = State.NUMERIC_CHARACTER_REFERENCE_END;
|
|
2875
|
-
this._stateNumericCharacterReferenceEnd(cp);
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
// Numeric character reference end state
|
|
2879
|
-
//------------------------------------------------------------------
|
|
2880
|
-
_stateNumericCharacterReferenceEnd(cp) {
|
|
2881
|
-
if (this.charRefCode === unicode_js_1.CODE_POINTS.NULL) {
|
|
2882
|
-
this._err(error_codes_js_1.ERR.nullCharacterReference);
|
|
2883
|
-
this.charRefCode = unicode_js_1.CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
2884
|
-
}
|
|
2885
|
-
else if (this.charRefCode > 1114111) {
|
|
2886
|
-
this._err(error_codes_js_1.ERR.characterReferenceOutsideUnicodeRange);
|
|
2887
|
-
this.charRefCode = unicode_js_1.CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
2888
|
-
}
|
|
2889
|
-
else if ((0, unicode_js_1.isSurrogate)(this.charRefCode)) {
|
|
2890
|
-
this._err(error_codes_js_1.ERR.surrogateCharacterReference);
|
|
2891
|
-
this.charRefCode = unicode_js_1.CODE_POINTS.REPLACEMENT_CHARACTER;
|
|
2892
|
-
}
|
|
2893
|
-
else if ((0, unicode_js_1.isUndefinedCodePoint)(this.charRefCode)) {
|
|
2894
|
-
this._err(error_codes_js_1.ERR.noncharacterCharacterReference);
|
|
2895
|
-
}
|
|
2896
|
-
else if ((0, unicode_js_1.isControlCodePoint)(this.charRefCode) || this.charRefCode === unicode_js_1.CODE_POINTS.CARRIAGE_RETURN) {
|
|
2897
|
-
this._err(error_codes_js_1.ERR.controlCharacterReference);
|
|
2898
|
-
const replacement = C1_CONTROLS_REFERENCE_REPLACEMENTS.get(this.charRefCode);
|
|
2899
|
-
if (replacement !== undefined) {
|
|
2900
|
-
this.charRefCode = replacement;
|
|
2901
|
-
}
|
|
2902
|
-
}
|
|
2903
|
-
this._flushCodePointConsumedAsCharacterReference(this.charRefCode);
|
|
2904
|
-
this._reconsumeInState(this.returnState, cp);
|
|
2905
|
-
}
|
|
2906
2713
|
}
|
|
2907
2714
|
exports.Tokenizer = Tokenizer;
|
|
2908
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -2,11 +2,11 @@ import { ERR, type ParserError, type ParserErrorHandler } from '../common/error-
|
|
|
2
2
|
export declare class Preprocessor {
|
|
3
3
|
private handler;
|
|
4
4
|
html: string;
|
|
5
|
-
|
|
5
|
+
pos: number;
|
|
6
6
|
private lastGapPos;
|
|
7
7
|
private gapStack;
|
|
8
8
|
private skipNextNewLine;
|
|
9
|
-
|
|
9
|
+
lastChunkWritten: boolean;
|
|
10
10
|
endOfChunkHit: boolean;
|
|
11
11
|
bufferWaterline: number;
|
|
12
12
|
private isEol;
|
|
@@ -19,7 +19,7 @@ export declare class Preprocessor {
|
|
|
19
19
|
/** The column on the current line. If we just saw a gap (eg. a surrogate pair), return the index before. */
|
|
20
20
|
get col(): number;
|
|
21
21
|
get offset(): number;
|
|
22
|
-
getError(code: ERR): ParserError;
|
|
22
|
+
getError(code: ERR, cpOffset: number): ParserError;
|
|
23
23
|
private lastErrOffset;
|
|
24
24
|
private _err;
|
|
25
25
|
private _addGap;
|
|
@@ -34,4 +34,3 @@ export declare class Preprocessor {
|
|
|
34
34
|
private _checkForProblematicCharacters;
|
|
35
35
|
retreat(count: number): void;
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=preprocessor.d.ts.map
|
|
@@ -34,22 +34,24 @@ class Preprocessor {
|
|
|
34
34
|
get offset() {
|
|
35
35
|
return this.droppedBufferSize + this.pos;
|
|
36
36
|
}
|
|
37
|
-
getError(code) {
|
|
37
|
+
getError(code, cpOffset) {
|
|
38
38
|
const { line, col, offset } = this;
|
|
39
|
+
const startCol = col + cpOffset;
|
|
40
|
+
const startOffset = offset + cpOffset;
|
|
39
41
|
return {
|
|
40
42
|
code,
|
|
41
43
|
startLine: line,
|
|
42
44
|
endLine: line,
|
|
43
|
-
startCol
|
|
44
|
-
endCol:
|
|
45
|
-
startOffset
|
|
46
|
-
endOffset:
|
|
45
|
+
startCol,
|
|
46
|
+
endCol: startCol,
|
|
47
|
+
startOffset,
|
|
48
|
+
endOffset: startOffset,
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
51
|
_err(code) {
|
|
50
52
|
if (this.handler.onParseError && this.lastErrOffset !== this.offset) {
|
|
51
53
|
this.lastErrOffset = this.offset;
|
|
52
|
-
this.handler.onParseError(this.getError(code));
|
|
54
|
+
this.handler.onParseError(this.getError(code, 0));
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
_addGap() {
|
|
@@ -196,4 +198,3 @@ class Preprocessor {
|
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
exports.Preprocessor = Preprocessor;
|
|
199
|
-
//# sourceMappingURL=preprocessor.js.map
|
|
@@ -82,4 +82,3 @@ export type ChildNode = Element | Template | CommentNode | TextNode | DocumentTy
|
|
|
82
82
|
export type Node = ParentNode | ChildNode;
|
|
83
83
|
export type DefaultTreeAdapterMap = TreeAdapterTypeMap<Node, ParentNode, ChildNode, Document, DocumentFragment, Element, CommentNode, TextNode, Template, DocumentType>;
|
|
84
84
|
export declare const defaultTreeAdapter: TreeAdapter<DefaultTreeAdapterMap>;
|
|
85
|
-
//# sourceMappingURL=default.d.ts.map
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultTreeAdapter = void 0;
|
|
4
4
|
const html_js_1 = require("../common/html.js");
|
|
5
|
-
function createTextNode(value) {
|
|
6
|
-
return {
|
|
7
|
-
nodeName: '#text',
|
|
8
|
-
value,
|
|
9
|
-
parentNode: null,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
5
|
exports.defaultTreeAdapter = {
|
|
13
6
|
//Node construction
|
|
14
7
|
createDocument() {
|
|
@@ -41,6 +34,13 @@ exports.defaultTreeAdapter = {
|
|
|
41
34
|
parentNode: null,
|
|
42
35
|
};
|
|
43
36
|
},
|
|
37
|
+
createTextNode(value) {
|
|
38
|
+
return {
|
|
39
|
+
nodeName: '#text',
|
|
40
|
+
value,
|
|
41
|
+
parentNode: null,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
44
|
//Tree mutation
|
|
45
45
|
appendChild(parentNode, newNode) {
|
|
46
46
|
parentNode.childNodes.push(newNode);
|
|
@@ -96,7 +96,7 @@ exports.defaultTreeAdapter = {
|
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
exports.defaultTreeAdapter.appendChild(parentNode, createTextNode(text));
|
|
99
|
+
exports.defaultTreeAdapter.appendChild(parentNode, exports.defaultTreeAdapter.createTextNode(text));
|
|
100
100
|
},
|
|
101
101
|
insertTextBefore(parentNode, text, referenceNode) {
|
|
102
102
|
const prevNode = parentNode.childNodes[parentNode.childNodes.indexOf(referenceNode) - 1];
|
|
@@ -104,7 +104,7 @@ exports.defaultTreeAdapter = {
|
|
|
104
104
|
prevNode.value += text;
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
exports.defaultTreeAdapter.insertBefore(parentNode, createTextNode(text), referenceNode);
|
|
107
|
+
exports.defaultTreeAdapter.insertBefore(parentNode, exports.defaultTreeAdapter.createTextNode(text), referenceNode);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
adoptAttributes(recipient, attrs) {
|
|
@@ -174,4 +174,3 @@ exports.defaultTreeAdapter = {
|
|
|
174
174
|
node.sourceCodeLocation = Object.assign(Object.assign({}, node.sourceCodeLocation), endLocation);
|
|
175
175
|
},
|
|
176
176
|
};
|
|
177
|
-
//# sourceMappingURL=default.js.map
|
|
@@ -17,7 +17,7 @@ export interface TreeAdapterTypeMap<Node = unknown, ParentNode = unknown, ChildN
|
|
|
17
17
|
* Note that `TreeAdapter` is not designed to be a general purpose AST manipulation library. You can build such library
|
|
18
18
|
* on top of existing `TreeAdapter` or use one of the existing libraries from npm.
|
|
19
19
|
*
|
|
20
|
-
* @see
|
|
20
|
+
* @see Have a look at the default tree adapter for reference.
|
|
21
21
|
*/
|
|
22
22
|
export interface TreeAdapter<T extends TreeAdapterTypeMap = TreeAdapterTypeMap> {
|
|
23
23
|
/**
|
|
@@ -40,6 +40,12 @@ export interface TreeAdapter<T extends TreeAdapterTypeMap = TreeAdapterTypeMap>
|
|
|
40
40
|
* @param data - Comment text.
|
|
41
41
|
*/
|
|
42
42
|
createCommentNode(data: string): T['commentNode'];
|
|
43
|
+
/**
|
|
44
|
+
* Creates a text node.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Text.
|
|
47
|
+
*/
|
|
48
|
+
createTextNode(value: string): T['textNode'];
|
|
43
49
|
/**
|
|
44
50
|
* Creates a document node.
|
|
45
51
|
*/
|
|
@@ -247,4 +253,3 @@ export interface TreeAdapter<T extends TreeAdapterTypeMap = TreeAdapterTypeMap>
|
|
|
247
253
|
*/
|
|
248
254
|
onItemPop?: (item: T['element'], newTop: T['parentNode']) => void;
|
|
249
255
|
}
|
|
250
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -2,4 +2,3 @@ import { DOCUMENT_MODE } from './html.js';
|
|
|
2
2
|
import type { DoctypeToken } from './token.js';
|
|
3
3
|
export declare function isConforming(token: DoctypeToken): boolean;
|
|
4
4
|
export declare function getDocumentMode(token: DoctypeToken): DOCUMENT_MODE;
|
|
5
|
-
//# sourceMappingURL=doctype.d.ts.map
|