@askviraj/linter 1.1.2 → 1.1.3
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/node_modules/{synckit → @astrojs/compiler-binding}/LICENSE +1 -1
- package/node_modules/@astrojs/compiler-binding/browser.js +1 -0
- package/node_modules/@astrojs/compiler-binding/index.d.ts +337 -0
- package/node_modules/@astrojs/compiler-binding/index.js +599 -0
- package/node_modules/@astrojs/compiler-binding/package.json +83 -0
- package/node_modules/@astrojs/compiler-binding/webcontainer-fallback.cjs +23 -0
- package/node_modules/@astrojs/compiler-binding-linux-x64-gnu/README.md +3 -0
- package/node_modules/@astrojs/compiler-binding-linux-x64-gnu/astro.linux-x64-gnu.node +0 -0
- package/node_modules/@astrojs/compiler-binding-linux-x64-gnu/package.json +40 -0
- package/node_modules/{parse5 → @astrojs/compiler-rs}/LICENSE +7 -5
- package/node_modules/@astrojs/compiler-rs/README.md +62 -0
- package/node_modules/@astrojs/compiler-rs/async.d.ts +1 -0
- package/node_modules/@astrojs/compiler-rs/dist/async.d.mts +9 -0
- package/node_modules/@astrojs/compiler-rs/dist/async.mjs +1 -0
- package/node_modules/@astrojs/compiler-rs/dist/index.d.mts +9 -0
- package/node_modules/@astrojs/compiler-rs/dist/index.mjs +1 -0
- package/node_modules/@astrojs/compiler-rs/dist/shared.d.mts +45 -0
- package/node_modules/@astrojs/compiler-rs/dist/shared.mjs +1 -0
- package/node_modules/@astrojs/compiler-rs/dist/types.d.mts +94 -0
- package/node_modules/@astrojs/compiler-rs/dist/types.mjs +1 -0
- package/node_modules/@astrojs/compiler-rs/dist/utils.d.mts +4 -0
- package/node_modules/@astrojs/compiler-rs/dist/utils.mjs +1 -0
- package/node_modules/@astrojs/compiler-rs/package.json +55 -0
- package/node_modules/@astrojs/compiler-rs/types.d.ts +1 -0
- package/node_modules/@eslint/config-helpers/README.md +2 -2
- package/node_modules/@eslint/config-helpers/dist/cjs/index.cjs +27 -26
- package/node_modules/@eslint/config-helpers/dist/cjs/index.d.cts +13 -12
- package/node_modules/@eslint/config-helpers/dist/cjs/types.cts +4 -2
- package/node_modules/@eslint/config-helpers/dist/esm/index.d.ts +13 -12
- package/node_modules/@eslint/config-helpers/dist/esm/index.js +27 -26
- package/node_modules/@eslint/config-helpers/dist/esm/types.d.ts +2 -0
- package/node_modules/@eslint/config-helpers/dist/esm/types.ts +4 -2
- package/node_modules/@eslint/config-helpers/package.json +1 -1
- package/node_modules/@eslint/css/README.md +2 -2
- package/node_modules/@eslint/css/dist/build/rules.d.ts +75 -21
- package/node_modules/@eslint/css/dist/build/rules.js +15 -15
- package/node_modules/@eslint/css/dist/data/baseline-data.js +256 -32
- package/node_modules/@eslint/css/dist/index.js +1 -1
- package/node_modules/@eslint/css/dist/rules/font-family-fallbacks.d.ts +15 -15
- package/node_modules/@eslint/css/dist/rules/font-family-fallbacks.js +2 -5
- package/node_modules/@eslint/css/dist/rules/no-duplicate-imports.d.ts +18 -18
- package/node_modules/@eslint/css/dist/rules/no-duplicate-imports.js +9 -12
- package/node_modules/@eslint/css/dist/rules/no-duplicate-keyframe-selectors.d.ts +14 -14
- package/node_modules/@eslint/css/dist/rules/no-duplicate-keyframe-selectors.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-empty-blocks.d.ts +14 -14
- package/node_modules/@eslint/css/dist/rules/no-empty-blocks.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-important.d.ts +16 -16
- package/node_modules/@eslint/css/dist/rules/no-important.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-invalid-at-rule-placement.d.ts +16 -16
- package/node_modules/@eslint/css/dist/rules/no-invalid-at-rule-placement.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-invalid-at-rules.d.ts +21 -21
- package/node_modules/@eslint/css/dist/rules/no-invalid-at-rules.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-invalid-named-grid-areas.d.ts +16 -16
- package/node_modules/@eslint/css/dist/rules/no-invalid-named-grid-areas.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-invalid-properties.d.ts +18 -18
- package/node_modules/@eslint/css/dist/rules/no-invalid-properties.js +2 -3
- package/node_modules/@eslint/css/dist/rules/no-unmatchable-selectors.d.ts +14 -14
- package/node_modules/@eslint/css/dist/rules/no-unmatchable-selectors.js +2 -3
- package/node_modules/@eslint/css/dist/rules/prefer-logical-properties.d.ts +22 -19
- package/node_modules/@eslint/css/dist/rules/prefer-logical-properties.js +66 -23
- package/node_modules/@eslint/css/dist/rules/relative-font-units.d.ts +16 -16
- package/node_modules/@eslint/css/dist/rules/relative-font-units.js +13 -7
- package/node_modules/@eslint/css/dist/rules/selector-complexity.d.ts +17 -17
- package/node_modules/@eslint/css/dist/rules/selector-complexity.js +2 -3
- package/node_modules/@eslint/css/dist/rules/use-baseline.d.ts +22 -22
- package/node_modules/@eslint/css/dist/rules/use-baseline.js +2 -3
- package/node_modules/@eslint/css/dist/rules/use-layers.d.ts +18 -18
- package/node_modules/@eslint/css/dist/rules/use-layers.js +3 -4
- package/node_modules/@eslint/css/package.json +7 -12
- package/node_modules/@eslint/css-tree/README.md +2 -2
- package/node_modules/@eslint/css-tree/dist/csstree.esm.js +1 -1
- package/node_modules/@eslint/css-tree/dist/csstree.js +1 -1
- package/node_modules/@eslint/css-tree/dist/data.cjs +4 -1
- package/node_modules/@eslint/css-tree/dist/data.js +4 -1
- package/node_modules/@eslint/css-tree/dist/version.cjs +1 -1
- package/node_modules/@eslint/css-tree/dist/version.js +1 -1
- package/node_modules/@eslint/css-tree/package.json +3 -3
- package/node_modules/@eslint/json/README.md +2 -2
- package/node_modules/@eslint/json/dist/index.js +1 -1
- package/node_modules/@eslint/json/package.json +4 -9
- package/node_modules/@eslint/markdown/README.md +3 -3
- package/node_modules/@eslint/markdown/dist/build/rules.d.ts +105 -27
- package/node_modules/@eslint/markdown/dist/build/rules.js +21 -21
- package/node_modules/@eslint/markdown/dist/index.d.ts +2 -2
- package/node_modules/@eslint/markdown/dist/index.js +4 -4
- package/node_modules/@eslint/markdown/dist/processor.d.ts +4 -9
- package/node_modules/@eslint/markdown/dist/processor.js +12 -15
- package/node_modules/@eslint/markdown/dist/rules/fenced-code-language.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/fenced-code-language.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/fenced-code-meta.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/fenced-code-meta.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/heading-increment.d.ts +16 -16
- package/node_modules/@eslint/markdown/dist/rules/heading-increment.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-bare-urls.d.ts +14 -14
- package/node_modules/@eslint/markdown/dist/rules/no-bare-urls.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-duplicate-definitions.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/no-duplicate-definitions.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-duplicate-headings.d.ts +15 -15
- package/node_modules/@eslint/markdown/dist/rules/no-duplicate-headings.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-empty-definitions.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/no-empty-definitions.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-empty-images.d.ts +14 -14
- package/node_modules/@eslint/markdown/dist/rules/no-empty-images.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-empty-links.d.ts +14 -14
- package/node_modules/@eslint/markdown/dist/rules/no-empty-links.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-html.d.ts +15 -15
- package/node_modules/@eslint/markdown/dist/rules/no-html.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-invalid-label-refs.d.ts +14 -14
- package/node_modules/@eslint/markdown/dist/rules/no-invalid-label-refs.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-missing-atx-heading-space.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/no-missing-atx-heading-space.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-missing-label-refs.d.ts +16 -16
- package/node_modules/@eslint/markdown/dist/rules/no-missing-label-refs.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-missing-link-fragments.d.ts +16 -16
- package/node_modules/@eslint/markdown/dist/rules/no-missing-link-fragments.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-multiple-h1.d.ts +16 -16
- package/node_modules/@eslint/markdown/dist/rules/no-multiple-h1.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-reference-like-urls.d.ts +15 -15
- package/node_modules/@eslint/markdown/dist/rules/no-reference-like-urls.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-reversed-media-syntax.d.ts +15 -15
- package/node_modules/@eslint/markdown/dist/rules/no-reversed-media-syntax.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-space-in-emphasis.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/no-space-in-emphasis.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/no-unused-definitions.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/no-unused-definitions.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/require-alt-text.d.ts +14 -14
- package/node_modules/@eslint/markdown/dist/rules/require-alt-text.js +2 -3
- package/node_modules/@eslint/markdown/dist/rules/table-column-count.d.ts +17 -17
- package/node_modules/@eslint/markdown/dist/rules/table-column-count.js +2 -3
- package/node_modules/@eslint/markdown/package.json +5 -10
- package/node_modules/@eslint-community/eslint-utils/index.js +1 -1
- package/node_modules/@eslint-community/eslint-utils/index.js.map +1 -1
- package/node_modules/@eslint-community/eslint-utils/index.mjs +1 -1
- package/node_modules/@eslint-community/eslint-utils/index.mjs.map +1 -1
- package/node_modules/@eslint-community/eslint-utils/package.json +12 -7
- package/node_modules/@html-eslint/core/dist/index.js +1 -0
- package/node_modules/@html-eslint/core/dist/index.js.map +1 -1
- package/node_modules/@html-eslint/core/dist/index.mjs +1 -0
- package/node_modules/@html-eslint/core/dist/index.mjs.map +1 -1
- package/node_modules/@html-eslint/core/package.json +3 -3
- package/node_modules/@html-eslint/eslint-plugin/lib/rules/require-content.js +20 -1
- package/node_modules/@html-eslint/eslint-plugin/lib/rules/require-input-label.js +110 -8
- package/node_modules/@html-eslint/eslint-plugin/lib/rules/utils/node.js +13 -0
- package/node_modules/@html-eslint/eslint-plugin/package.json +7 -7
- package/node_modules/@html-eslint/eslint-plugin/types/rules/require-content.d.ts.map +1 -1
- package/node_modules/@html-eslint/eslint-plugin/types/rules/require-input-label.d.ts.map +1 -1
- package/node_modules/@html-eslint/eslint-plugin/types/rules/utils/node.d.ts +7 -0
- package/node_modules/@html-eslint/eslint-plugin/types/rules/utils/node.d.ts.map +1 -1
- package/node_modules/@html-eslint/parser/lib/parser.js +0 -1
- package/node_modules/@html-eslint/parser/package.json +4 -4
- package/node_modules/@html-eslint/parser/types/parser.d.ts.map +1 -1
- package/node_modules/@html-eslint/template-parser/package.json +3 -3
- package/node_modules/@html-eslint/template-syntax-parser/package.json +3 -3
- package/node_modules/@html-eslint/types/package.json +2 -2
- package/node_modules/@rviscomi/capo.js/README.md +4 -4
- package/node_modules/@rviscomi/capo.js/dist/adapters/adapter.cjs +7 -2
- package/node_modules/@rviscomi/capo.js/dist/adapters/browser.cjs +31 -3
- package/node_modules/@rviscomi/capo.js/dist/adapters/index.cjs +36 -4
- package/node_modules/@rviscomi/capo.js/dist/adapters/test-suite.cjs +6 -1
- package/node_modules/@rviscomi/capo.js/dist/analyzer.cjs +53 -24
- package/node_modules/@rviscomi/capo.js/dist/chrome/README.md +53 -0
- package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/capo.html +1 -1
- package/node_modules/@rviscomi/capo.js/dist/chrome/capo.js +3 -0
- package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/chrome.js +56 -18
- package/node_modules/@rviscomi/capo.js/dist/chrome/manifest.json +26 -0
- package/node_modules/@rviscomi/capo.js/dist/chrome/options/options.js +1 -0
- package/node_modules/@rviscomi/capo.js/dist/chrome.zip +0 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/README.md +53 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/background.js +7 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/capo.css +59 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/capo.html +12 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/capo.js +3 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/chrome.js +120 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/images/icon128.png +0 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/manifest.json +39 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/options/options.css +81 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/options/options.html +43 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/options/options.js +1 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox/styles/open-props.css +291 -0
- package/node_modules/@rviscomi/capo.js/dist/firefox.zip +0 -0
- package/node_modules/@rviscomi/capo.js/dist/index.cjs +93 -33
- package/node_modules/@rviscomi/capo.js/dist/lib/colors.cjs +1 -0
- package/node_modules/@rviscomi/capo.js/dist/lib/io.cjs +137 -28
- package/node_modules/@rviscomi/capo.js/dist/lib/options.cjs +61 -0
- package/node_modules/@rviscomi/capo.js/dist/lib/rules.cjs +28 -13
- package/node_modules/@rviscomi/capo.js/dist/lib/validation.cjs +31 -16
- package/node_modules/@rviscomi/capo.js/dist/source.zip +0 -0
- package/node_modules/@rviscomi/capo.js/dist/types/adapters/adapter.d.ts +105 -0
- package/node_modules/@rviscomi/capo.js/dist/types/adapters/browser.d.ts +107 -0
- package/node_modules/@rviscomi/capo.js/dist/types/adapters/index.d.ts +7 -0
- package/node_modules/@rviscomi/capo.js/dist/types/adapters/test-suite.d.ts +52 -0
- package/node_modules/@rviscomi/capo.js/dist/types/analyzer.d.ts +195 -0
- package/node_modules/@rviscomi/capo.js/dist/types/index.d.ts +29 -0
- package/node_modules/@rviscomi/capo.js/dist/types/lib/colors.d.ts +20 -0
- package/node_modules/@rviscomi/capo.js/dist/types/lib/io.d.ts +166 -0
- package/node_modules/@rviscomi/capo.js/dist/types/lib/options.d.ts +114 -0
- package/node_modules/@rviscomi/capo.js/dist/types/lib/rules.d.ts +111 -0
- package/node_modules/@rviscomi/capo.js/dist/types/lib/validation.d.ts +61 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/adapters/adapter.d.ts +105 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/adapters/browser.d.ts +107 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/adapters/index.d.ts +7 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/adapters/test-suite.d.ts +52 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/analyzer.d.ts +195 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/index.d.ts +13 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/lib/colors.d.ts +20 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/lib/io.d.ts +166 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/lib/options.d.ts +114 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/lib/rules.d.ts +111 -0
- package/node_modules/@rviscomi/capo.js/dist/types/src/lib/validation.d.ts +61 -0
- package/node_modules/@rviscomi/capo.js/package.json +34 -16
- package/node_modules/@rviscomi/capo.js/src/adapters/adapter.js +16 -5
- package/node_modules/@rviscomi/capo.js/src/adapters/browser.js +30 -4
- package/node_modules/@rviscomi/capo.js/src/adapters/test-suite.js +11 -10
- package/node_modules/@rviscomi/capo.js/src/analyzer.js +47 -25
- package/node_modules/@rviscomi/capo.js/src/extension/README.md +53 -0
- package/node_modules/@rviscomi/capo.js/src/extension/background.js +7 -0
- package/node_modules/@rviscomi/capo.js/src/extension/capo.css +59 -0
- package/node_modules/@rviscomi/capo.js/src/extension/capo.html +12 -0
- package/node_modules/@rviscomi/capo.js/src/extension/capo.js +93 -0
- package/node_modules/@rviscomi/capo.js/src/extension/chrome.js +120 -0
- package/node_modules/@rviscomi/capo.js/src/extension/images/icon128.png +0 -0
- package/node_modules/@rviscomi/capo.js/src/extension/images/icon256.png +0 -0
- package/node_modules/@rviscomi/capo.js/{crx → src/extension}/manifest.json +1 -1
- package/node_modules/@rviscomi/capo.js/src/extension/options/options.css +81 -0
- package/node_modules/@rviscomi/capo.js/src/extension/options/options.html +43 -0
- package/node_modules/@rviscomi/capo.js/src/extension/options.js +87 -0
- package/node_modules/@rviscomi/capo.js/src/extension/styles/open-props.css +291 -0
- package/node_modules/@rviscomi/capo.js/src/index.js +10 -0
- package/node_modules/@rviscomi/capo.js/src/lib/colors.js +14 -0
- package/node_modules/@rviscomi/capo.js/src/lib/io.js +171 -32
- package/node_modules/@rviscomi/capo.js/src/lib/options.js +82 -1
- package/node_modules/@rviscomi/capo.js/src/lib/rules.js +120 -43
- package/node_modules/@rviscomi/capo.js/src/lib/validation.js +211 -86
- package/node_modules/@rviscomi/capo.js/src/web/capo.js +5 -8
- package/node_modules/@types/hast/README.md +2 -2
- package/node_modules/@types/hast/index.d.ts +642 -0
- package/node_modules/@types/hast/package.json +9 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslintrc/all.d.ts +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/eslintrc/all.js +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/configs/flat/all.js +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/index.d.ts +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/index.js +47 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/raw-plugin.d.ts +0 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/ban-ts-comment.js +4 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.d.ts +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/method-signature-style.js +23 -10
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-base-to-string.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-loop-func.js +16 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-misused-promises.js +41 -3
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-restricted-imports.js +12 -0
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.d.ts +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-shadow.js +5 -4
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-this-alias.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-parameter-property-assignment.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-template-expression.js +2 -2
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unnecessary-type-assertion.js +5 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/no-unused-vars.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/prefer-string-starts-ends-with.js +2 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/require-array-sort-compare.js +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/dist/rules/unbound-method.js +36 -9
- package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/index.js +11 -2
- package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/legacy.js +11 -2
- package/node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore/package.json +1 -1
- package/node_modules/@typescript-eslint/eslint-plugin/package.json +22 -11
- package/node_modules/@typescript-eslint/parser/dist/index.js +47 -0
- package/node_modules/@typescript-eslint/parser/dist/parser.js +11 -6
- package/node_modules/@typescript-eslint/parser/package.json +9 -7
- package/node_modules/@typescript-eslint/project-service/package.json +7 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/FunctionScope.js +2 -2
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/index.d.ts +1 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/scope/index.js +1 -0
- package/node_modules/@typescript-eslint/scope-manager/package.json +8 -6
- package/node_modules/@typescript-eslint/tsconfig-utils/package.json +5 -3
- package/node_modules/@typescript-eslint/type-utils/package.json +9 -7
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +10 -0
- package/node_modules/@typescript-eslint/types/dist/parser-options.d.ts +13 -0
- package/node_modules/@typescript-eslint/types/package.json +5 -3
- package/node_modules/@typescript-eslint/typescript-estree/dist/check-syntax-errors.js +22 -6
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +5 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/getImportClausePhaseModifier.d.ts +4 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/getImportClausePhaseModifier.js +56 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/createParseSettings.js +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +27 -18
- package/node_modules/@typescript-eslint/typescript-estree/dist/parser-options.d.ts +8 -0
- package/node_modules/@typescript-eslint/typescript-estree/package.json +9 -7
- package/node_modules/@typescript-eslint/utils/dist/ts-eslint/Rule.d.ts +1 -1
- package/node_modules/@typescript-eslint/utils/package.json +8 -6
- package/node_modules/@typescript-eslint/visitor-keys/package.json +6 -4
- package/node_modules/acorn/CHANGELOG.md +12 -0
- package/node_modules/acorn/README.md +5 -0
- package/node_modules/acorn/dist/acorn.d.mts +8 -0
- package/node_modules/acorn/dist/acorn.d.ts +8 -0
- package/node_modules/acorn/dist/acorn.js +16 -7
- package/node_modules/acorn/dist/acorn.mjs +16 -7
- package/node_modules/acorn/package.json +1 -1
- package/node_modules/astro-eslint-parser/lib/index.d.mts +113 -18
- package/node_modules/astro-eslint-parser/lib/index.mjs +871 -1172
- package/node_modules/astro-eslint-parser/package.json +7 -9
- package/node_modules/brace-expansion/README.md +11 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts +2 -0
- package/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/commonjs/index.js +162 -84
- package/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.d.ts +2 -0
- package/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -1
- package/node_modules/brace-expansion/dist/esm/index.js +161 -83
- package/node_modules/brace-expansion/dist/esm/index.js.map +1 -1
- package/node_modules/brace-expansion/package.json +2 -2
- package/node_modules/eslint/README.md +2 -2
- package/node_modules/eslint/lib/cli-engine/formatters/html.js +1 -1
- package/node_modules/eslint/lib/languages/js/index.js +1 -1
- package/node_modules/eslint/lib/linter/code-path-analysis/debug-helpers.js +1 -1
- package/node_modules/eslint/lib/linter/vfile.js +1 -1
- package/node_modules/eslint/lib/rules/class-methods-use-this.js +6 -5
- package/node_modules/eslint/lib/rules/complexity.js +1 -1
- package/node_modules/eslint/lib/rules/eqeqeq.js +26 -6
- package/node_modules/eslint/lib/rules/func-name-matching.js +3 -3
- package/node_modules/eslint/lib/rules/generator-star-spacing.js +4 -6
- package/node_modules/eslint/lib/rules/indent.js +4 -6
- package/node_modules/eslint/lib/rules/key-spacing.js +5 -7
- package/node_modules/eslint/lib/rules/max-len.js +1 -1
- package/node_modules/eslint/lib/rules/max-nested-callbacks.js +11 -1
- package/node_modules/eslint/lib/rules/no-compare-neg-zero.js +91 -8
- package/node_modules/eslint/lib/rules/no-control-regex.js +3 -0
- package/node_modules/eslint/lib/rules/no-implicit-coercion.js +22 -8
- package/node_modules/eslint/lib/rules/no-invalid-regexp.js +3 -1
- package/node_modules/eslint/lib/rules/no-mixed-spaces-and-tabs.js +5 -7
- package/node_modules/eslint/lib/rules/no-promise-executor-return.js +5 -7
- package/node_modules/eslint/lib/rules/no-script-url.js +4 -6
- package/node_modules/eslint/lib/rules/no-shadow.js +14 -20
- package/node_modules/eslint/lib/rules/no-unreachable-loop.js +8 -4
- package/node_modules/eslint/lib/rules/prefer-numeric-literals.js +14 -6
- package/node_modules/eslint/lib/rules/prefer-object-has-own.js +4 -6
- package/node_modules/eslint/lib/rules/prefer-object-spread.js +9 -1
- package/node_modules/eslint/lib/rules/prefer-template.js +1 -1
- package/node_modules/eslint/lib/rules/preserve-caught-error.js +268 -116
- package/node_modules/eslint/lib/rules/quotes.js +1 -1
- package/node_modules/eslint/lib/rules/radix.js +58 -57
- package/node_modules/eslint/lib/rules/use-isnan.js +20 -12
- package/node_modules/eslint/lib/rules/utils/ast-utils.js +1 -1
- package/node_modules/eslint/lib/shared/serialization.js +1 -1
- package/node_modules/eslint/lib/shared/translate-cli-options.js +3 -3
- package/node_modules/eslint/lib/types/config-api.d.ts +8 -1
- package/node_modules/eslint/lib/types/index.d.ts +3 -6
- package/node_modules/eslint/lib/types/rules.d.ts +17 -9
- package/node_modules/eslint/package.json +7 -7
- package/node_modules/eslint-plugin-astro/README.md +10 -2
- package/node_modules/eslint-plugin-astro/lib/index.d.mts +0 -1
- package/node_modules/eslint-plugin-astro/lib/index.mjs +76 -637
- package/node_modules/eslint-plugin-astro/package.json +11 -11
- package/node_modules/eslint-plugin-toml/README.md +2 -0
- package/node_modules/eslint-plugin-toml/lib/index.d.mts +6 -5
- package/node_modules/eslint-plugin-toml/lib/index.mjs +32 -3
- package/node_modules/eslint-plugin-toml/package.json +7 -7
- package/node_modules/eslint-plugin-yml/lib/index.mjs +49 -19
- package/node_modules/eslint-plugin-yml/package.json +2 -2
- package/node_modules/flatted/golang/pkg/flatted/flatted.go +16 -14
- package/node_modules/flatted/package.json +10 -5
- package/node_modules/flatted/types/index.d.ts +1 -1
- package/node_modules/globals/globals.json +105 -33
- package/node_modules/globals/index.d.ts +105 -33
- package/node_modules/globals/package.json +2 -2
- package/node_modules/mdn-data/css/properties.json +64 -16
- package/node_modules/mdn-data/css/properties.schema.json +1 -7
- package/node_modules/mdn-data/css/syntaxes.json +1 -1
- package/node_modules/mdn-data/l10n/css.json +3 -62
- package/node_modules/mdn-data/package.json +1 -1
- package/node_modules/minimatch/package.json +9 -9
- package/node_modules/nanoid/non-secure/index.cjs +2 -2
- package/node_modules/nanoid/non-secure/index.js +2 -2
- package/node_modules/nanoid/package.json +1 -1
- package/node_modules/picomatch/README.md +15 -21
- package/node_modules/picomatch/lib/parse.js +39 -9
- package/node_modules/picomatch/lib/picomatch.js +14 -2
- package/node_modules/picomatch/package.json +3 -2
- package/node_modules/postcss/README.md +1 -2
- package/node_modules/postcss/lib/container.js +81 -34
- package/node_modules/postcss/lib/fromJSON.js +65 -26
- package/node_modules/postcss/lib/input.js +7 -1
- package/node_modules/postcss/lib/lazy-result.js +77 -14
- package/node_modules/postcss/lib/list.js +1 -0
- package/node_modules/postcss/lib/node.d.ts +2 -2
- package/node_modules/postcss/lib/node.js +90 -52
- package/node_modules/postcss/lib/postcss.d.ts +4 -1
- package/node_modules/postcss/lib/previous-map.js +6 -3
- package/node_modules/postcss/lib/processor.js +1 -1
- package/node_modules/postcss/lib/root.js +16 -1
- package/node_modules/postcss/lib/stringifier.js +112 -25
- package/node_modules/postcss/lib/warning.js +10 -0
- package/node_modules/postcss/package.json +2 -2
- package/node_modules/typescript-eslint/dist/index.js +47 -0
- package/node_modules/typescript-eslint/package.json +14 -6
- package/node_modules/yaml-eslint-parser/lib/chunk-CfYAbeIz.mjs +13 -0
- package/node_modules/yaml-eslint-parser/lib/index.d.mts +2 -2
- package/node_modules/yaml-eslint-parser/lib/index.mjs +164 -157
- package/node_modules/yaml-eslint-parser/package.json +17 -18
- package/package.json +23 -23
- package/node_modules/@astrojs/compiler/LICENSE +0 -53
- package/node_modules/@astrojs/compiler/README.md +0 -72
- package/node_modules/@astrojs/compiler/dist/astro.wasm +0 -0
- package/node_modules/@astrojs/compiler/dist/browser/index.cjs +0 -2
- package/node_modules/@astrojs/compiler/dist/browser/index.d.ts +0 -11
- package/node_modules/@astrojs/compiler/dist/browser/index.js +0 -1
- package/node_modules/@astrojs/compiler/dist/browser/utils.cjs +0 -3
- package/node_modules/@astrojs/compiler/dist/browser/utils.d.ts +0 -29
- package/node_modules/@astrojs/compiler/dist/browser/utils.js +0 -3
- package/node_modules/@astrojs/compiler/dist/browser/wasm_exec.cjs +0 -2
- package/node_modules/@astrojs/compiler/dist/browser/wasm_exec.d.ts +0 -37
- package/node_modules/@astrojs/compiler/dist/browser/wasm_exec.js +0 -1
- package/node_modules/@astrojs/compiler/dist/chunk-QR6QDSEV.js +0 -2
- package/node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js +0 -1
- package/node_modules/@astrojs/compiler/dist/node/index.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/node/index.d.ts +0 -12
- package/node_modules/@astrojs/compiler/dist/node/index.js +0 -1
- package/node_modules/@astrojs/compiler/dist/node/sync.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/node/sync.d.ts +0 -16
- package/node_modules/@astrojs/compiler/dist/node/sync.js +0 -1
- package/node_modules/@astrojs/compiler/dist/node/utils.cjs +0 -3
- package/node_modules/@astrojs/compiler/dist/node/utils.d.ts +0 -29
- package/node_modules/@astrojs/compiler/dist/node/utils.js +0 -3
- package/node_modules/@astrojs/compiler/dist/node/wasm_exec.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/node/wasm_exec.d.ts +0 -37
- package/node_modules/@astrojs/compiler/dist/node/wasm_exec.js +0 -1
- package/node_modules/@astrojs/compiler/dist/shared/ast.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/shared/ast.d.ts +0 -74
- package/node_modules/@astrojs/compiler/dist/shared/ast.js +0 -0
- package/node_modules/@astrojs/compiler/dist/shared/diagnostics.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/shared/diagnostics.d.ts +0 -18
- package/node_modules/@astrojs/compiler/dist/shared/diagnostics.js +0 -1
- package/node_modules/@astrojs/compiler/dist/shared/types.cjs +0 -1
- package/node_modules/@astrojs/compiler/dist/shared/types.d.ts +0 -153
- package/node_modules/@astrojs/compiler/dist/shared/types.js +0 -1
- package/node_modules/@astrojs/compiler/package.json +0 -58
- package/node_modules/@astrojs/compiler/sync.d.ts +0 -1
- package/node_modules/@astrojs/compiler/types.d.ts +0 -1
- package/node_modules/@astrojs/compiler/utils.d.ts +0 -1
- package/node_modules/@pkgr/core/index.d.cts +0 -3
- package/node_modules/@pkgr/core/lib/constants.d.ts +0 -6
- package/node_modules/@pkgr/core/lib/constants.js +0 -9
- package/node_modules/@pkgr/core/lib/constants.js.map +0 -1
- package/node_modules/@pkgr/core/lib/helpers.d.ts +0 -19
- package/node_modules/@pkgr/core/lib/helpers.js +0 -67
- package/node_modules/@pkgr/core/lib/helpers.js.map +0 -1
- package/node_modules/@pkgr/core/lib/index.cjs +0 -91
- package/node_modules/@pkgr/core/lib/index.d.ts +0 -2
- package/node_modules/@pkgr/core/lib/index.js +0 -3
- package/node_modules/@pkgr/core/lib/index.js.map +0 -1
- package/node_modules/@pkgr/core/package.json +0 -38
- package/node_modules/@rviscomi/capo.js/crx/README.md +0 -10
- package/node_modules/@rviscomi/capo.js/crx/capo.js +0 -3
- package/node_modules/@rviscomi/capo.js/crx/options/options.js +0 -1
- package/node_modules/@rviscomi/capo.js/docs/.vscode/extensions.json +0 -4
- package/node_modules/@rviscomi/capo.js/docs/.vscode/launch.json +0 -11
- package/node_modules/@rviscomi/capo.js/docs/README.md +0 -51
- package/node_modules/@rviscomi/capo.js/docs/astro.config.mjs +0 -82
- package/node_modules/@rviscomi/capo.js/docs/package-lock.json +0 -7439
- package/node_modules/@rviscomi/capo.js/docs/package.json +0 -21
- package/node_modules/@rviscomi/capo.js/docs/public/capo-social-alt.webp +0 -0
- package/node_modules/@rviscomi/capo.js/docs/public/capo-social.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/public/capo-social.webp +0 -0
- package/node_modules/@rviscomi/capo.js/docs/public/favicon.svg +0 -13
- package/node_modules/@rviscomi/capo.js/docs/src/assets/bookmarklet-setup.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/bookmarklet.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/capo-chrome.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/capo-extension.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/capo800.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-console-expanded.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-console-interactive.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-console.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-hover-validation.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-menu.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-options-dark.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-options-light.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/crx-store.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/custom-palette.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/developer-mode.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/devtools-console.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/devtools-snippet.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/devtools-sources.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/houston.webp +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/load-unpacked.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-areas.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-base.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-crx-stripes.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-csp.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-invalid-element.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-origin-trial.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/assets/validation-title.png +0 -0
- package/node_modules/@rviscomi/capo.js/docs/src/components/CapoClient.astro +0 -165
- package/node_modules/@rviscomi/capo.js/docs/src/components/CapoOptions.astro +0 -10
- package/node_modules/@rviscomi/capo.js/docs/src/components/CapoPalette.astro +0 -26
- package/node_modules/@rviscomi/capo.js/docs/src/components/InlineCapoIcon.astro +0 -15
- package/node_modules/@rviscomi/capo.js/docs/src/components/InlineCapoWeightBars.astro +0 -39
- package/node_modules/@rviscomi/capo.js/docs/src/components/VirtualConsole.astro +0 -11
- package/node_modules/@rviscomi/capo.js/docs/src/content/config.ts +0 -7
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/developer/contributing.mdx +0 -8
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/developer/crx-local.mdx +0 -28
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/developer/custom-adapters.mdx +0 -273
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/index.mdx +0 -108
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/migration-v2.mdx +0 -62
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/actionability.mdx +0 -6
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/assessment-mode.mdx +0 -29
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/config.mdx +0 -195
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/demo.mdx +0 -9
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/extension.mdx +0 -116
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/performance.mdx +0 -6
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/quick-start.mdx +0 -26
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/rules.mdx +0 -202
- package/node_modules/@rviscomi/capo.js/docs/src/content/docs/user/validation.mdx +0 -197
- package/node_modules/@rviscomi/capo.js/docs/src/env.d.ts +0 -2
- package/node_modules/@rviscomi/capo.js/docs/src/lib/VirtualConsole.js +0 -190
- package/node_modules/@rviscomi/capo.js/docs/src/lib/capo.js +0 -1533
- package/node_modules/@rviscomi/capo.js/docs/src/styles/custom.css +0 -7
- package/node_modules/@rviscomi/capo.js/docs/src/styles/virtual-console.css +0 -131
- package/node_modules/@rviscomi/capo.js/docs/tests/VirtualConsole.test.js +0 -108
- package/node_modules/@rviscomi/capo.js/docs/tsconfig.json +0 -3
- package/node_modules/@rviscomi/capo.js/src/crx/capo.js +0 -62
- package/node_modules/@rviscomi/capo.js/src/crx/options.js +0 -69
- package/node_modules/astrojs-compiler-sync/LICENSE +0 -53
- package/node_modules/astrojs-compiler-sync/README.md +0 -3
- package/node_modules/astrojs-compiler-sync/browser/index.d.ts +0 -6
- package/node_modules/astrojs-compiler-sync/browser/index.js +0 -76
- package/node_modules/astrojs-compiler-sync/browser/wasm_exec.js +0 -665
- package/node_modules/astrojs-compiler-sync/lib/astrojs-compiler-worker.js +0 -5
- package/node_modules/astrojs-compiler-sync/lib/compiler-sync.cjs +0 -31
- package/node_modules/astrojs-compiler-sync/lib/index.cjs +0 -30
- package/node_modules/astrojs-compiler-sync/lib/index.d.cts +0 -3
- package/node_modules/astrojs-compiler-sync/lib/index.d.ts +0 -14
- package/node_modules/astrojs-compiler-sync/lib/index.js +0 -18
- package/node_modules/astrojs-compiler-sync/package.json +0 -100
- package/node_modules/entities/LICENSE +0 -11
- package/node_modules/entities/dist/decode-codepoint.d.ts +0 -8
- package/node_modules/entities/dist/decode-codepoint.d.ts.map +0 -1
- package/node_modules/entities/dist/decode-codepoint.js +0 -46
- package/node_modules/entities/dist/decode-codepoint.js.map +0 -1
- package/node_modules/entities/dist/decode.d.ts +0 -194
- package/node_modules/entities/dist/decode.d.ts.map +0 -1
- package/node_modules/entities/dist/decode.js +0 -544
- package/node_modules/entities/dist/decode.js.map +0 -1
- package/node_modules/entities/dist/encode.d.ts +0 -24
- package/node_modules/entities/dist/encode.d.ts.map +0 -1
- package/node_modules/entities/dist/encode.js +0 -90
- package/node_modules/entities/dist/encode.js.map +0 -1
- package/node_modules/entities/dist/escape.d.ts +0 -48
- package/node_modules/entities/dist/escape.d.ts.map +0 -1
- package/node_modules/entities/dist/escape.js +0 -132
- package/node_modules/entities/dist/escape.js.map +0 -1
- package/node_modules/entities/dist/generated/decode-data-html.d.ts +0 -3
- package/node_modules/entities/dist/generated/decode-data-html.d.ts.map +0 -1
- package/node_modules/entities/dist/generated/decode-data-html.js +0 -5
- package/node_modules/entities/dist/generated/decode-data-html.js.map +0 -1
- package/node_modules/entities/dist/generated/decode-data-xml.d.ts +0 -3
- package/node_modules/entities/dist/generated/decode-data-xml.d.ts.map +0 -1
- package/node_modules/entities/dist/generated/decode-data-xml.js +0 -5
- package/node_modules/entities/dist/generated/decode-data-xml.js.map +0 -1
- package/node_modules/entities/dist/generated/encode-html.d.ts +0 -5
- package/node_modules/entities/dist/generated/encode-html.d.ts.map +0 -1
- package/node_modules/entities/dist/generated/encode-html.js +0 -12
- package/node_modules/entities/dist/generated/encode-html.js.map +0 -1
- package/node_modules/entities/dist/index.d.ts +0 -89
- package/node_modules/entities/dist/index.d.ts.map +0 -1
- package/node_modules/entities/dist/index.js +0 -91
- package/node_modules/entities/dist/index.js.map +0 -1
- package/node_modules/entities/dist/internal/bin-trie-flags.d.ts +0 -17
- package/node_modules/entities/dist/internal/bin-trie-flags.d.ts.map +0 -1
- package/node_modules/entities/dist/internal/bin-trie-flags.js +0 -18
- package/node_modules/entities/dist/internal/bin-trie-flags.js.map +0 -1
- package/node_modules/entities/dist/internal/decode-shared.d.ts +0 -7
- package/node_modules/entities/dist/internal/decode-shared.d.ts.map +0 -1
- package/node_modules/entities/dist/internal/decode-shared.js +0 -17
- package/node_modules/entities/dist/internal/decode-shared.js.map +0 -1
- package/node_modules/entities/dist/internal/encode-shared.d.ts +0 -33
- package/node_modules/entities/dist/internal/encode-shared.d.ts.map +0 -1
- package/node_modules/entities/dist/internal/encode-shared.js +0 -93
- package/node_modules/entities/dist/internal/encode-shared.js.map +0 -1
- package/node_modules/entities/package.json +0 -83
- package/node_modules/entities/readme.md +0 -131
- package/node_modules/entities/src/decode-codepoint.ts +0 -50
- package/node_modules/entities/src/decode.ts +0 -671
- package/node_modules/entities/src/encode.ts +0 -95
- package/node_modules/entities/src/escape.ts +0 -160
- package/node_modules/entities/src/generated/decode-data-html.ts +0 -7
- package/node_modules/entities/src/generated/decode-data-xml.ts +0 -7
- package/node_modules/entities/src/generated/encode-html.ts +0 -18
- package/node_modules/entities/src/index.ts +0 -162
- package/node_modules/entities/src/internal/bin-trie-flags.ts +0 -16
- package/node_modules/entities/src/internal/decode-shared.ts +0 -18
- package/node_modules/entities/src/internal/encode-shared.ts +0 -123
- package/node_modules/parse5/README.md +0 -38
- package/node_modules/parse5/dist/common/doctype.d.ts +0 -4
- package/node_modules/parse5/dist/common/doctype.js +0 -114
- package/node_modules/parse5/dist/common/error-codes.d.ts +0 -67
- package/node_modules/parse5/dist/common/error-codes.js +0 -63
- package/node_modules/parse5/dist/common/foreign-content.d.ts +0 -9
- package/node_modules/parse5/dist/common/foreign-content.js +0 -228
- package/node_modules/parse5/dist/common/html.d.ts +0 -289
- package/node_modules/parse5/dist/common/html.js +0 -523
- package/node_modules/parse5/dist/common/token.d.ts +0 -84
- package/node_modules/parse5/dist/common/token.js +0 -20
- package/node_modules/parse5/dist/common/unicode.d.ts +0 -42
- package/node_modules/parse5/dist/common/unicode.js +0 -62
- package/node_modules/parse5/dist/index.d.ts +0 -71
- package/node_modules/parse5/dist/index.js +0 -42
- package/node_modules/parse5/dist/parser/formatting-element-list.d.ts +0 -36
- package/node_modules/parse5/dist/parser/formatting-element-list.js +0 -110
- package/node_modules/parse5/dist/parser/index.d.ts +0 -221
- package/node_modules/parse5/dist/parser/index.js +0 -3245
- package/node_modules/parse5/dist/parser/open-element-stack.d.ts +0 -53
- package/node_modules/parse5/dist/parser/open-element-stack.js +0 -324
- package/node_modules/parse5/dist/serializer/index.d.ts +0 -60
- package/node_modules/parse5/dist/serializer/index.js +0 -168
- package/node_modules/parse5/dist/tokenizer/index.d.ts +0 -247
- package/node_modules/parse5/dist/tokenizer/index.js +0 -2712
- package/node_modules/parse5/dist/tokenizer/preprocessor.d.ts +0 -36
- package/node_modules/parse5/dist/tokenizer/preprocessor.js +0 -196
- package/node_modules/parse5/dist/tree-adapters/default.d.ts +0 -84
- package/node_modules/parse5/dist/tree-adapters/default.js +0 -173
- package/node_modules/parse5/dist/tree-adapters/interface.d.ts +0 -255
- package/node_modules/parse5/dist/tree-adapters/interface.js +0 -1
- package/node_modules/parse5/package.json +0 -53
- package/node_modules/synckit/README.md +0 -256
- package/node_modules/synckit/lib/common.d.ts +0 -5
- package/node_modules/synckit/lib/common.js +0 -22
- package/node_modules/synckit/lib/common.js.map +0 -1
- package/node_modules/synckit/lib/constants.d.ts +0 -38
- package/node_modules/synckit/lib/constants.js +0 -54
- package/node_modules/synckit/lib/constants.js.map +0 -1
- package/node_modules/synckit/lib/helpers.d.ts +0 -27
- package/node_modules/synckit/lib/helpers.js +0 -411
- package/node_modules/synckit/lib/helpers.js.map +0 -1
- package/node_modules/synckit/lib/index.cjs +0 -588
- package/node_modules/synckit/lib/index.d.cts +0 -138
- package/node_modules/synckit/lib/index.d.ts +0 -7
- package/node_modules/synckit/lib/index.js +0 -68
- package/node_modules/synckit/lib/index.js.map +0 -1
- package/node_modules/synckit/lib/types.d.ts +0 -48
- package/node_modules/synckit/lib/types.js +0 -2
- package/node_modules/synckit/lib/types.js.map +0 -1
- package/node_modules/synckit/package.json +0 -45
- package/node_modules/yaml-eslint-parser/lib/chunk-15K8U1wQ.mjs +0 -18
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/background.js +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/capo.css +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/images/icon128.png +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/images/icon256.png +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/options/options.css +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/options/options.html +0 -0
- /package/node_modules/@rviscomi/capo.js/{crx → dist/chrome}/styles/open-props.css +0 -0
- /package/node_modules/@rviscomi/capo.js/{docs/src/assets/capo256.png → dist/firefox/images/icon256.png} +0 -0
- /package/node_modules/eslint-plugin-toml/lib/{chunk-CfYAbeIz.mjs → rolldown-runtime-D7D4PA-g.mjs} +0 -0
|
@@ -1,1533 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capo.js v2.0 - DOM-agnostic HTML <head> analyzer
|
|
3
|
-
*
|
|
4
|
-
* Main entry point for programmatic usage.
|
|
5
|
-
* Exports both the core analyzer API and adapter implementations.
|
|
6
|
-
*
|
|
7
|
-
* @module capo
|
|
8
|
-
*/ // Core Analysis API
|
|
9
|
-
/**
|
|
10
|
-
* Core DOM-agnostic analyzer for capo.js
|
|
11
|
-
* Provides single-pass analysis of HTML <head> elements
|
|
12
|
-
*
|
|
13
|
-
* @module analyzer
|
|
14
|
-
*/ const $ee7e0c73e51ebfda$export$881088883fcab450 = {
|
|
15
|
-
META: 10,
|
|
16
|
-
TITLE: 9,
|
|
17
|
-
PRECONNECT: 8,
|
|
18
|
-
ASYNC_SCRIPT: 7,
|
|
19
|
-
IMPORT_STYLES: 6,
|
|
20
|
-
SYNC_SCRIPT: 5,
|
|
21
|
-
SYNC_STYLES: 4,
|
|
22
|
-
PRELOAD: 3,
|
|
23
|
-
DEFER_SCRIPT: 2,
|
|
24
|
-
PREFETCH_PRERENDER: 1,
|
|
25
|
-
OTHER: 0
|
|
26
|
-
};
|
|
27
|
-
const $ee7e0c73e51ebfda$export$6ade8bb3620eb74b = {
|
|
28
|
-
META: $ee7e0c73e51ebfda$export$daeb0db0c224decd,
|
|
29
|
-
TITLE: $ee7e0c73e51ebfda$export$e55aad21605f020a,
|
|
30
|
-
PRECONNECT: $ee7e0c73e51ebfda$export$a3316bd0a640eb8b,
|
|
31
|
-
ASYNC_SCRIPT: $ee7e0c73e51ebfda$export$20e2051ffd813ee3,
|
|
32
|
-
IMPORT_STYLES: $ee7e0c73e51ebfda$export$be443fc6335656f0,
|
|
33
|
-
SYNC_SCRIPT: $ee7e0c73e51ebfda$export$65983fc0a5543400,
|
|
34
|
-
SYNC_STYLES: $ee7e0c73e51ebfda$export$9d6cdbffb13bee21,
|
|
35
|
-
PRELOAD: $ee7e0c73e51ebfda$export$226ad5ba23be83f0,
|
|
36
|
-
DEFER_SCRIPT: $ee7e0c73e51ebfda$export$3d269f86e8bd1d24,
|
|
37
|
-
PREFETCH_PRERENDER: $ee7e0c73e51ebfda$export$4d2ed086e1fec499
|
|
38
|
-
};
|
|
39
|
-
const $ee7e0c73e51ebfda$export$b7417cf4a2235f73 = [
|
|
40
|
-
"accept-ch",
|
|
41
|
-
"content-security-policy",
|
|
42
|
-
"content-type",
|
|
43
|
-
"default-style",
|
|
44
|
-
"delegate-ch",
|
|
45
|
-
"origin-trial",
|
|
46
|
-
"x-dns-prefetch-control"
|
|
47
|
-
];
|
|
48
|
-
function $ee7e0c73e51ebfda$export$daeb0db0c224decd(element, adapter) {
|
|
49
|
-
const tagName = adapter.getTagName(element);
|
|
50
|
-
// Check if it's a base element
|
|
51
|
-
if (tagName === "base") return true;
|
|
52
|
-
// Check if it's a meta element with charset, viewport, or critical http-equiv
|
|
53
|
-
if (tagName !== "meta") return false;
|
|
54
|
-
// Check for charset attribute
|
|
55
|
-
if (adapter.hasAttribute(element, "charset")) return true;
|
|
56
|
-
// Check for viewport meta
|
|
57
|
-
const name = adapter.getAttribute(element, "name");
|
|
58
|
-
if (name && name.toLowerCase() === "viewport") return true;
|
|
59
|
-
// Check for critical http-equiv values
|
|
60
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
61
|
-
if (httpEquiv) {
|
|
62
|
-
const normalizedValue = httpEquiv.toLowerCase();
|
|
63
|
-
return $ee7e0c73e51ebfda$export$b7417cf4a2235f73.includes(normalizedValue);
|
|
64
|
-
}
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
function $ee7e0c73e51ebfda$export$e55aad21605f020a(element, adapter) {
|
|
68
|
-
return adapter.getTagName(element) === "title";
|
|
69
|
-
}
|
|
70
|
-
function $ee7e0c73e51ebfda$export$a3316bd0a640eb8b(element, adapter) {
|
|
71
|
-
if (adapter.getTagName(element) !== "link") return false;
|
|
72
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
73
|
-
return rel?.toLowerCase() === "preconnect";
|
|
74
|
-
}
|
|
75
|
-
function $ee7e0c73e51ebfda$export$20e2051ffd813ee3(element, adapter) {
|
|
76
|
-
return adapter.getTagName(element) === "script" && adapter.hasAttribute(element, "src") && adapter.hasAttribute(element, "async");
|
|
77
|
-
}
|
|
78
|
-
function $ee7e0c73e51ebfda$export$be443fc6335656f0(element, adapter) {
|
|
79
|
-
const importRe = /@import/;
|
|
80
|
-
if (adapter.getTagName(element) === "style") return importRe.test(adapter.getTextContent(element));
|
|
81
|
-
/* TODO: Support external stylesheets.
|
|
82
|
-
if (adapter.getTagName(element) === 'link' &&
|
|
83
|
-
adapter.getAttribute(element, 'rel')?.toLowerCase() === 'stylesheet' &&
|
|
84
|
-
adapter.hasAttribute(element, 'href')) {
|
|
85
|
-
let response = fetch(adapter.getAttribute(element, 'href'));
|
|
86
|
-
response = response.text();
|
|
87
|
-
return importRe.test(response);
|
|
88
|
-
} */ return false;
|
|
89
|
-
}
|
|
90
|
-
function $ee7e0c73e51ebfda$export$65983fc0a5543400(element, adapter) {
|
|
91
|
-
// Must be a script element
|
|
92
|
-
if (adapter.getTagName(element) !== "script") return false;
|
|
93
|
-
// Original selector: script:not([src][defer],[src][type=module],[src][async],[type*=json])
|
|
94
|
-
// This excludes scripts that match ANY of these compound conditions:
|
|
95
|
-
// Exclude: scripts with src AND defer
|
|
96
|
-
if (adapter.hasAttribute(element, "src") && adapter.hasAttribute(element, "defer")) return false;
|
|
97
|
-
// Exclude: scripts with src AND type=module
|
|
98
|
-
if (adapter.hasAttribute(element, "src")) {
|
|
99
|
-
const type = adapter.getAttribute(element, "type");
|
|
100
|
-
if (type && type.toLowerCase() === "module") return false;
|
|
101
|
-
}
|
|
102
|
-
// Exclude: scripts with src AND async
|
|
103
|
-
if (adapter.hasAttribute(element, "src") && adapter.hasAttribute(element, "async")) return false;
|
|
104
|
-
// Exclude: scripts with type containing "json"
|
|
105
|
-
const type = adapter.getAttribute(element, "type");
|
|
106
|
-
if (type && type.toLowerCase().includes("json")) return false;
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
function $ee7e0c73e51ebfda$export$9d6cdbffb13bee21(element, adapter) {
|
|
110
|
-
const tagName = adapter.getTagName(element);
|
|
111
|
-
// Check if it's a style element
|
|
112
|
-
if (tagName === "style") return true;
|
|
113
|
-
// Check if it's a stylesheet link
|
|
114
|
-
if (tagName === "link") {
|
|
115
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
116
|
-
return rel?.toLowerCase() === "stylesheet";
|
|
117
|
-
}
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
function $ee7e0c73e51ebfda$export$226ad5ba23be83f0(element, adapter) {
|
|
121
|
-
if (adapter.getTagName(element) !== "link") return false;
|
|
122
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
123
|
-
if (!rel) return false;
|
|
124
|
-
const relLower = rel.toLowerCase();
|
|
125
|
-
return relLower === "preload" || relLower === "modulepreload";
|
|
126
|
-
}
|
|
127
|
-
function $ee7e0c73e51ebfda$export$3d269f86e8bd1d24(element, adapter) {
|
|
128
|
-
if (adapter.getTagName(element) !== "script") return false;
|
|
129
|
-
if (!adapter.hasAttribute(element, "src")) return false;
|
|
130
|
-
// Script with defer attribute
|
|
131
|
-
if (adapter.hasAttribute(element, "defer")) return true;
|
|
132
|
-
// Module scripts are defer by default, unless they have async
|
|
133
|
-
const type = adapter.getAttribute(element, "type");
|
|
134
|
-
if (type && type.toLowerCase() === "module") return !adapter.hasAttribute(element, "async");
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
function $ee7e0c73e51ebfda$export$4d2ed086e1fec499(element, adapter) {
|
|
138
|
-
if (adapter.getTagName(element) !== "link") return false;
|
|
139
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
140
|
-
if (!rel) return false;
|
|
141
|
-
const relLower = rel.toLowerCase();
|
|
142
|
-
return relLower === "prefetch" || relLower === "dns-prefetch" || relLower === "prerender";
|
|
143
|
-
}
|
|
144
|
-
function $ee7e0c73e51ebfda$export$38a04d482ec50f88(element, adapter) {
|
|
145
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
146
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
147
|
-
return httpEquiv?.toLowerCase() === "origin-trial";
|
|
148
|
-
}
|
|
149
|
-
function $ee7e0c73e51ebfda$export$14b1a2f64a600585(element, adapter) {
|
|
150
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
151
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
152
|
-
if (!httpEquiv) return false;
|
|
153
|
-
const httpEquivLower = httpEquiv.toLowerCase();
|
|
154
|
-
return httpEquivLower === "content-security-policy" || httpEquivLower === "content-security-policy-report-only";
|
|
155
|
-
}
|
|
156
|
-
function $ee7e0c73e51ebfda$export$de32fe5d64aee40c(element, adapter) {
|
|
157
|
-
for (let [id, detector] of Object.entries($ee7e0c73e51ebfda$export$6ade8bb3620eb74b)){
|
|
158
|
-
if (detector(element, adapter)) return $ee7e0c73e51ebfda$export$881088883fcab450[id];
|
|
159
|
-
}
|
|
160
|
-
return $ee7e0c73e51ebfda$export$881088883fcab450.OTHER;
|
|
161
|
-
}
|
|
162
|
-
function $ee7e0c73e51ebfda$export$5cc4a311ddbe699c(head, adapter) {
|
|
163
|
-
const headChildren = adapter.getChildren(head);
|
|
164
|
-
return headChildren.filter((element)=>{
|
|
165
|
-
// Filter out text nodes and comments - only include actual elements
|
|
166
|
-
const tagName = adapter.getTagName(element);
|
|
167
|
-
return tagName && tagName !== "";
|
|
168
|
-
}).map((element)=>{
|
|
169
|
-
return {
|
|
170
|
-
element: element,
|
|
171
|
-
weight: $ee7e0c73e51ebfda$export$de32fe5d64aee40c(element, adapter)
|
|
172
|
-
};
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const $c322f9a5057eaf5c$export$79e124b7caef7aa9 = new Set([
|
|
179
|
-
"base",
|
|
180
|
-
"link",
|
|
181
|
-
"meta",
|
|
182
|
-
"noscript",
|
|
183
|
-
"script",
|
|
184
|
-
"style",
|
|
185
|
-
"template",
|
|
186
|
-
"title"
|
|
187
|
-
]);
|
|
188
|
-
const $c322f9a5057eaf5c$export$2f975f13375faaa1 = 'meta[http-equiv="content-type" i], meta[charset]';
|
|
189
|
-
const $c322f9a5057eaf5c$export$9739336dee0b3205 = "meta[http-equiv]";
|
|
190
|
-
const $c322f9a5057eaf5c$export$5540ac2a18901364 = 'link:is([rel="preload" i], [rel="modulepreload" i])';
|
|
191
|
-
function $c322f9a5057eaf5c$export$a8257692ac88316c(element, adapter) {
|
|
192
|
-
const tagName = adapter.getTagName(element);
|
|
193
|
-
// Text nodes and comment nodes are valid (they don't have tag names)
|
|
194
|
-
if (!tagName || tagName === "") return true;
|
|
195
|
-
return $c322f9a5057eaf5c$export$79e124b7caef7aa9.has(tagName.toLowerCase());
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Check if element has any invalid child elements
|
|
199
|
-
* @param {any} element - Element to check
|
|
200
|
-
* @param {any} adapter - Adapter instance
|
|
201
|
-
* @returns {boolean}
|
|
202
|
-
*/ function $c322f9a5057eaf5c$var$hasInvalidChildren(element, adapter) {
|
|
203
|
-
const children = adapter.getChildren(element);
|
|
204
|
-
return children.some((child)=>!$c322f9a5057eaf5c$export$a8257692ac88316c(child, adapter));
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Check if this is a duplicate title element (2nd+ occurrence)
|
|
208
|
-
* @param {any} element - Element to check
|
|
209
|
-
* @param {any} adapter - Adapter instance
|
|
210
|
-
* @returns {boolean}
|
|
211
|
-
*/ function $c322f9a5057eaf5c$var$isDuplicateTitle(element, adapter) {
|
|
212
|
-
if (adapter.getTagName(element) !== "title") return false;
|
|
213
|
-
const parent = adapter.getParent(element);
|
|
214
|
-
if (!parent) return false;
|
|
215
|
-
// Check if this is the first title element
|
|
216
|
-
let foundFirst = false;
|
|
217
|
-
for (const child of adapter.getChildren(parent))if (adapter.getTagName(child) === "title") {
|
|
218
|
-
if (child === element) // This is the element we're checking - it's a duplicate if we already found a title
|
|
219
|
-
return foundFirst;
|
|
220
|
-
// Found a title element - mark that we've seen one
|
|
221
|
-
foundFirst = true;
|
|
222
|
-
}
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Check if this is a duplicate base element
|
|
227
|
-
* @param {any} element - Element to check
|
|
228
|
-
* @param {any} adapter - Adapter instance
|
|
229
|
-
* @returns {boolean}
|
|
230
|
-
*/ function $c322f9a5057eaf5c$var$isDuplicateBase(element, adapter) {
|
|
231
|
-
if (adapter.getTagName(element) !== "base") return false;
|
|
232
|
-
const siblings = adapter.getSiblings(element);
|
|
233
|
-
return siblings.some((sibling)=>adapter.getTagName(sibling) === "base");
|
|
234
|
-
}
|
|
235
|
-
function $c322f9a5057eaf5c$export$eeefd08c3a6f8db7(element, adapter) {
|
|
236
|
-
// Element itself is not valid.
|
|
237
|
-
if (!$c322f9a5057eaf5c$export$a8257692ac88316c(element, adapter)) return true;
|
|
238
|
-
// Children are not valid.
|
|
239
|
-
if ($c322f9a5057eaf5c$var$hasInvalidChildren(element, adapter)) return true;
|
|
240
|
-
// <title> is not the first of its type.
|
|
241
|
-
if ($c322f9a5057eaf5c$var$isDuplicateTitle(element, adapter)) return true;
|
|
242
|
-
// <base> is not the first of its type.
|
|
243
|
-
if ($c322f9a5057eaf5c$var$isDuplicateBase(element, adapter)) return true;
|
|
244
|
-
// CSP meta tag anywhere.
|
|
245
|
-
if ((0, $ee7e0c73e51ebfda$export$14b1a2f64a600585)(element, adapter)) return true;
|
|
246
|
-
// Invalid http-equiv.
|
|
247
|
-
if ($c322f9a5057eaf5c$var$isInvalidHttpEquiv(element, adapter)) return true;
|
|
248
|
-
// Invalid meta viewport.
|
|
249
|
-
if ($c322f9a5057eaf5c$var$isInvalidMetaViewport(element, adapter)) return true;
|
|
250
|
-
// Invalid default-style.
|
|
251
|
-
if ($c322f9a5057eaf5c$var$isInvalidDefaultStyle(element, adapter)) return true;
|
|
252
|
-
// Invalid character encoding.
|
|
253
|
-
if ($c322f9a5057eaf5c$var$isInvalidContentType(element, adapter)) return true;
|
|
254
|
-
// Origin trial expired, or invalid origin.
|
|
255
|
-
if ($c322f9a5057eaf5c$var$isInvalidOriginTrial(element, adapter)) return true;
|
|
256
|
-
// Preload is unnecessary.
|
|
257
|
-
if ($c322f9a5057eaf5c$var$isUnnecessaryPreload(element, adapter)) return true;
|
|
258
|
-
// Preload is missing crossorigin.
|
|
259
|
-
if ($c322f9a5057eaf5c$var$isInvalidFontPreload(element, adapter)) return true;
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
function $c322f9a5057eaf5c$export$b01ab94d0cd042a0(head, adapter) {
|
|
263
|
-
const validationWarnings = [];
|
|
264
|
-
// Get all children of head element
|
|
265
|
-
const children = adapter.getChildren(head);
|
|
266
|
-
// Check for title elements
|
|
267
|
-
const titleElements = children.filter((child)=>adapter.getTagName(child) === "title");
|
|
268
|
-
const titleElementCount = titleElements.length;
|
|
269
|
-
if (titleElementCount != 1) validationWarnings.push({
|
|
270
|
-
ruleId: titleElementCount === 0 ? "require-title" : "no-duplicate-title",
|
|
271
|
-
warning: `Expected exactly 1 <title> element, found ${titleElementCount}`,
|
|
272
|
-
elements: titleElements
|
|
273
|
-
});
|
|
274
|
-
// Check for meta viewport
|
|
275
|
-
const metaViewport = children.filter((child)=>{
|
|
276
|
-
if (adapter.getTagName(child) !== "meta") return false;
|
|
277
|
-
const name = adapter.getAttribute(child, "name");
|
|
278
|
-
return name && name.toLowerCase() === "viewport";
|
|
279
|
-
});
|
|
280
|
-
if (metaViewport.length != 1) validationWarnings.push({
|
|
281
|
-
ruleId: metaViewport.length === 0 ? "require-meta-viewport" : "valid-meta-viewport",
|
|
282
|
-
warning: `Expected exactly 1 <meta name=viewport> element, found ${metaViewport.length}`,
|
|
283
|
-
elements: metaViewport
|
|
284
|
-
});
|
|
285
|
-
// Check for base elements
|
|
286
|
-
const baseElements = children.filter((child)=>adapter.getTagName(child) === "base");
|
|
287
|
-
const baseElementCount = baseElements.length;
|
|
288
|
-
if (baseElementCount > 1) validationWarnings.push({
|
|
289
|
-
ruleId: "no-duplicate-base",
|
|
290
|
-
warning: `Expected at most 1 <base> element, found ${baseElementCount}`,
|
|
291
|
-
elements: baseElements
|
|
292
|
-
});
|
|
293
|
-
// Note: CSP meta tags are validated in customValidations, not here
|
|
294
|
-
// to avoid duplicate reporting
|
|
295
|
-
// Check for invalid elements
|
|
296
|
-
children.forEach((element)=>{
|
|
297
|
-
if ($c322f9a5057eaf5c$export$a8257692ac88316c(element, adapter)) return;
|
|
298
|
-
// For invalid elements, we just report the element itself
|
|
299
|
-
// (adapter doesn't have parentElement concept, so we can't find root)
|
|
300
|
-
validationWarnings.push({
|
|
301
|
-
ruleId: "no-invalid-head-elements",
|
|
302
|
-
warning: `${adapter.getTagName(element)} elements are not allowed in the <head>`,
|
|
303
|
-
element: element
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
// Note: Origin trials are validated in customValidations, not here
|
|
307
|
-
// to avoid duplicate reporting
|
|
308
|
-
return validationWarnings;
|
|
309
|
-
}
|
|
310
|
-
function $c322f9a5057eaf5c$export$6c93e2175c028eeb(element, adapter, parentElement = null) {
|
|
311
|
-
const results = [];
|
|
312
|
-
if ((0, $ee7e0c73e51ebfda$export$38a04d482ec50f88)(element, adapter)) results.push($c322f9a5057eaf5c$var$validateOriginTrial(element, adapter));
|
|
313
|
-
if ((0, $ee7e0c73e51ebfda$export$14b1a2f64a600585)(element, adapter)) results.push($c322f9a5057eaf5c$var$validateCSP(element, adapter));
|
|
314
|
-
if ($c322f9a5057eaf5c$var$isDefaultStyle(element, adapter)) results.push($c322f9a5057eaf5c$var$validateDefaultStyle(element, adapter));
|
|
315
|
-
if ($c322f9a5057eaf5c$var$isMetaViewport(element, adapter)) results.push($c322f9a5057eaf5c$var$validateMetaViewport(element, adapter));
|
|
316
|
-
if ($c322f9a5057eaf5c$var$isContentType(element, adapter)) results.push($c322f9a5057eaf5c$var$validateContentType(element, adapter));
|
|
317
|
-
if ($c322f9a5057eaf5c$var$isHttpEquiv(element, adapter)) results.push($c322f9a5057eaf5c$var$validateHttpEquiv(element, adapter));
|
|
318
|
-
if ($c322f9a5057eaf5c$var$isUnnecessaryPreload(element, adapter, parentElement)) results.push($c322f9a5057eaf5c$var$validateUnnecessaryPreload(element, adapter, parentElement));
|
|
319
|
-
if ($c322f9a5057eaf5c$var$isInvalidFontPreload(element, adapter)) results.push($c322f9a5057eaf5c$var$validateInvalidFontPreload(element, adapter));
|
|
320
|
-
if (results.length === 0) return {};
|
|
321
|
-
if (results.length === 1) return results[0];
|
|
322
|
-
// Merge results
|
|
323
|
-
const combined = {
|
|
324
|
-
warnings: [],
|
|
325
|
-
payload: {},
|
|
326
|
-
ruleId: results[0].ruleId
|
|
327
|
-
};
|
|
328
|
-
results.forEach((result)=>{
|
|
329
|
-
if (result.warnings) combined.warnings.push(...result.warnings);
|
|
330
|
-
if (result.payload) Object.assign(combined.payload, result.payload);
|
|
331
|
-
});
|
|
332
|
-
return combined;
|
|
333
|
-
}
|
|
334
|
-
function $c322f9a5057eaf5c$var$validateCSP(element, adapter) {
|
|
335
|
-
const warnings = [];
|
|
336
|
-
let payload = null;
|
|
337
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
338
|
-
const httpEquivLower = httpEquiv?.toLowerCase();
|
|
339
|
-
if (httpEquivLower === "content-security-policy-report-only") {
|
|
340
|
-
//https://w3c.github.io/webappsec-csp/#meta-element
|
|
341
|
-
warnings.push("CSP Report-Only is forbidden in meta tags");
|
|
342
|
-
return {
|
|
343
|
-
ruleId: "no-meta-csp",
|
|
344
|
-
warnings: warnings,
|
|
345
|
-
payload: payload
|
|
346
|
-
};
|
|
347
|
-
}
|
|
348
|
-
if (httpEquivLower === "content-security-policy") warnings.push("meta CSP discouraged. See https://crbug.com/1458493.");
|
|
349
|
-
const content = adapter.getAttribute(element, "content");
|
|
350
|
-
if (!content) {
|
|
351
|
-
warnings.push("Invalid CSP. The content attribute must be set.");
|
|
352
|
-
return {
|
|
353
|
-
warnings: warnings,
|
|
354
|
-
payload: payload
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
const directives = Object.fromEntries(content.split(/\s*;\s*/).map((directive)=>{
|
|
358
|
-
const [key, ...value] = directive.split(" ");
|
|
359
|
-
return [
|
|
360
|
-
key,
|
|
361
|
-
value.join(" ")
|
|
362
|
-
];
|
|
363
|
-
}));
|
|
364
|
-
payload = payload ?? {};
|
|
365
|
-
payload.directives = directives;
|
|
366
|
-
if ("report-uri" in directives) warnings.push("The report-uri directive is not supported. Use the Content-Security-Policy-Report-Only HTTP header instead.");
|
|
367
|
-
if ("frame-ancestors" in directives) warnings.push("The frame-ancestors directive is not supported. Use the Content-Security-Policy HTTP header instead.");
|
|
368
|
-
if ("sandbox" in directives) warnings.push("The sandbox directive is not supported. Use the Content-Security-Policy HTTP header instead.");
|
|
369
|
-
return {
|
|
370
|
-
ruleId: "no-meta-csp",
|
|
371
|
-
warnings: warnings,
|
|
372
|
-
payload: payload
|
|
373
|
-
};
|
|
374
|
-
}
|
|
375
|
-
function $c322f9a5057eaf5c$var$isInvalidOriginTrial(element, adapter) {
|
|
376
|
-
if (!(0, $ee7e0c73e51ebfda$export$38a04d482ec50f88)(element, adapter)) return false;
|
|
377
|
-
const { warnings: warnings } = $c322f9a5057eaf5c$var$validateOriginTrial(element, adapter);
|
|
378
|
-
return warnings.length > 0;
|
|
379
|
-
}
|
|
380
|
-
function $c322f9a5057eaf5c$var$validateOriginTrial(element, adapter) {
|
|
381
|
-
const metadata = {
|
|
382
|
-
ruleId: "no-invalid-origin-trial",
|
|
383
|
-
payload: null,
|
|
384
|
-
warnings: []
|
|
385
|
-
};
|
|
386
|
-
const token = adapter.getAttribute(element, "content");
|
|
387
|
-
try {
|
|
388
|
-
metadata.payload = $c322f9a5057eaf5c$var$decodeOriginTrialToken(token);
|
|
389
|
-
} catch {
|
|
390
|
-
metadata.warnings.push("Invalid origin trial token: invalid token");
|
|
391
|
-
return metadata;
|
|
392
|
-
}
|
|
393
|
-
if (metadata.payload.expiry < new Date()) metadata.warnings.push("Invalid origin trial token: expired");
|
|
394
|
-
// Origin validation only works in browser context with document.location
|
|
395
|
-
if (typeof document !== "undefined" && document.location && document.location.href) {
|
|
396
|
-
if (!$c322f9a5057eaf5c$var$isSameOrigin(metadata.payload.origin, document.location.href)) {
|
|
397
|
-
const subdomain = $c322f9a5057eaf5c$var$isSubdomain(metadata.payload.origin, document.location.href);
|
|
398
|
-
// Cross-origin OTs are only valid if:
|
|
399
|
-
// 1. The document is a subdomain of the OT origin and the isSubdomain config is set
|
|
400
|
-
// 2. The isThirdParty config is set
|
|
401
|
-
if (subdomain && !metadata.payload.isSubdomain) metadata.warnings.push("Invalid origin trial token: invalid subdomain");
|
|
402
|
-
else if (!subdomain && !metadata.payload.isThirdParty) metadata.warnings.push("Invalid origin trial token: invalid third-party origin");
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
return metadata;
|
|
406
|
-
}
|
|
407
|
-
// Adapted from https://glitch.com/~ot-decode.
|
|
408
|
-
function $c322f9a5057eaf5c$var$decodeOriginTrialToken(token) {
|
|
409
|
-
const buffer = new Uint8Array([
|
|
410
|
-
...atob(token)
|
|
411
|
-
].map((a)=>a.charCodeAt(0)));
|
|
412
|
-
const view = new DataView(buffer.buffer);
|
|
413
|
-
const length = view.getUint32(65, false);
|
|
414
|
-
const payload = JSON.parse(new TextDecoder().decode(buffer.slice(69, 69 + length)));
|
|
415
|
-
payload.expiry = new Date(payload.expiry * 1000);
|
|
416
|
-
return payload;
|
|
417
|
-
}
|
|
418
|
-
function $c322f9a5057eaf5c$var$isSameOrigin(a, b) {
|
|
419
|
-
return new URL(a).origin === new URL(b).origin;
|
|
420
|
-
}
|
|
421
|
-
// Whether b is a subdomain of a
|
|
422
|
-
function $c322f9a5057eaf5c$var$isSubdomain(a, b) {
|
|
423
|
-
// www.example.com ends with .example.com
|
|
424
|
-
a = new URL(a);
|
|
425
|
-
b = new URL(b);
|
|
426
|
-
return b.host.endsWith(`.${a.host}`);
|
|
427
|
-
}
|
|
428
|
-
function $c322f9a5057eaf5c$var$isDefaultStyle(element, adapter) {
|
|
429
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
430
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
431
|
-
return httpEquiv?.toLowerCase() === "default-style";
|
|
432
|
-
}
|
|
433
|
-
function $c322f9a5057eaf5c$var$isContentType(element, adapter) {
|
|
434
|
-
// Matches: meta[http-equiv="content-type" i], meta[charset]
|
|
435
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
436
|
-
if (adapter.hasAttribute(element, "charset")) return true;
|
|
437
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
438
|
-
return httpEquiv?.toLowerCase() === "content-type";
|
|
439
|
-
}
|
|
440
|
-
function $c322f9a5057eaf5c$var$isHttpEquiv(element, adapter) {
|
|
441
|
-
// Matches: meta[http-equiv]
|
|
442
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
443
|
-
return adapter.hasAttribute(element, "http-equiv");
|
|
444
|
-
}
|
|
445
|
-
function $c322f9a5057eaf5c$var$isMetaViewport(element, adapter) {
|
|
446
|
-
if (adapter.getTagName(element) !== "meta") return false;
|
|
447
|
-
const name = adapter.getAttribute(element, "name");
|
|
448
|
-
return name?.toLowerCase() === "viewport";
|
|
449
|
-
}
|
|
450
|
-
function $c322f9a5057eaf5c$var$isInvalidDefaultStyle(element, adapter) {
|
|
451
|
-
if (!$c322f9a5057eaf5c$var$isDefaultStyle(element, adapter)) return false;
|
|
452
|
-
const { warnings: warnings } = $c322f9a5057eaf5c$var$validateDefaultStyle(element, adapter);
|
|
453
|
-
return warnings.length > 0;
|
|
454
|
-
}
|
|
455
|
-
function $c322f9a5057eaf5c$var$isInvalidContentType(element, adapter) {
|
|
456
|
-
if (!$c322f9a5057eaf5c$var$isContentType(element, adapter)) return false;
|
|
457
|
-
const { warnings: warnings } = $c322f9a5057eaf5c$var$validateContentType(element, adapter);
|
|
458
|
-
return warnings.length > 0;
|
|
459
|
-
}
|
|
460
|
-
function $c322f9a5057eaf5c$var$isInvalidHttpEquiv(element, adapter) {
|
|
461
|
-
if (!$c322f9a5057eaf5c$var$isHttpEquiv(element, adapter)) return false;
|
|
462
|
-
const { warnings: warnings } = $c322f9a5057eaf5c$var$validateHttpEquiv(element, adapter);
|
|
463
|
-
return warnings.length > 0;
|
|
464
|
-
}
|
|
465
|
-
function $c322f9a5057eaf5c$var$isInvalidMetaViewport(element, adapter) {
|
|
466
|
-
if (!$c322f9a5057eaf5c$var$isMetaViewport(element, adapter)) return false;
|
|
467
|
-
const { warnings: warnings } = $c322f9a5057eaf5c$var$validateMetaViewport(element, adapter);
|
|
468
|
-
return warnings.length > 0;
|
|
469
|
-
}
|
|
470
|
-
function $c322f9a5057eaf5c$var$isUnnecessaryPreload(element, adapter, parentElement = null) {
|
|
471
|
-
// Matches: link:is([rel="preload" i], [rel="modulepreload" i])
|
|
472
|
-
const tagName = adapter.getTagName(element);
|
|
473
|
-
if (tagName !== "link") return false;
|
|
474
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
475
|
-
const relLower = rel?.toLowerCase();
|
|
476
|
-
if (relLower !== "preload" && relLower !== "modulepreload") return false;
|
|
477
|
-
const href = adapter.getAttribute(element, "href");
|
|
478
|
-
if (!href) return false;
|
|
479
|
-
const parent = parentElement || adapter.getParent(element);
|
|
480
|
-
if (!parent) return false;
|
|
481
|
-
const found = $c322f9a5057eaf5c$var$findElementWithSource(parent, href, element, adapter);
|
|
482
|
-
return found != null;
|
|
483
|
-
}
|
|
484
|
-
function $c322f9a5057eaf5c$var$isInvalidFontPreload(element, adapter) {
|
|
485
|
-
const tagName = adapter.getTagName(element);
|
|
486
|
-
if (tagName !== "link") return false;
|
|
487
|
-
const rel = adapter.getAttribute(element, "rel");
|
|
488
|
-
if (rel?.toLowerCase() !== "preload") return false;
|
|
489
|
-
const as = adapter.getAttribute(element, "as");
|
|
490
|
-
if (as?.toLowerCase() !== "font") return false;
|
|
491
|
-
// crossorigin must be present (even if empty, which means anonymous)
|
|
492
|
-
return !adapter.hasAttribute(element, "crossorigin");
|
|
493
|
-
}
|
|
494
|
-
function $c322f9a5057eaf5c$var$validateInvalidFontPreload(element, adapter) {
|
|
495
|
-
const warnings = [
|
|
496
|
-
"Font preloads must have the crossorigin attribute set, even for same-origin fonts."
|
|
497
|
-
];
|
|
498
|
-
return {
|
|
499
|
-
ruleId: "valid-font-preload",
|
|
500
|
-
warnings: warnings,
|
|
501
|
-
payload: null
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Find an element with matching source using adapter (non-browser)
|
|
506
|
-
* @param {*} parent - Parent element to search within
|
|
507
|
-
* @param {string} sourceUrl - URL to match
|
|
508
|
-
* @param {*} excludeElement - Element to exclude from search (the preload itself)
|
|
509
|
-
* @param {*} adapter - Adapter instance
|
|
510
|
-
* @returns {*|null} - Matching element or null
|
|
511
|
-
*/ function $c322f9a5057eaf5c$var$findElementWithSource(parent, sourceUrl, excludeElement, adapter) {
|
|
512
|
-
const children = adapter.getChildren(parent);
|
|
513
|
-
for (const child of children){
|
|
514
|
-
// Skip the preload element itself
|
|
515
|
-
if (child === excludeElement) continue;
|
|
516
|
-
const tagName = adapter.getTagName(child);
|
|
517
|
-
// Check link elements (but not preload/modulepreload)
|
|
518
|
-
if (tagName === "link") {
|
|
519
|
-
const rel = adapter.getAttribute(child, "rel");
|
|
520
|
-
if (rel && /\b(preload|modulepreload)\b/i.test(rel)) continue; // Skip other preloads
|
|
521
|
-
const childHref = adapter.getAttribute(child, "href");
|
|
522
|
-
if (childHref === sourceUrl) return child;
|
|
523
|
-
}
|
|
524
|
-
// Check script elements
|
|
525
|
-
if (tagName === "script") {
|
|
526
|
-
const src = adapter.getAttribute(child, "src");
|
|
527
|
-
if (src === sourceUrl) return child;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
return null;
|
|
531
|
-
}
|
|
532
|
-
function $c322f9a5057eaf5c$var$absolutifyUrl(href) {
|
|
533
|
-
// Browser-only function
|
|
534
|
-
if (typeof document === "undefined" || !document.baseURI) // In non-browser context, return href as-is
|
|
535
|
-
return href;
|
|
536
|
-
return new URL(href, document.baseURI).href;
|
|
537
|
-
}
|
|
538
|
-
function $c322f9a5057eaf5c$var$validateDefaultStyle(element, adapter) {
|
|
539
|
-
const warnings = [];
|
|
540
|
-
let payload = null;
|
|
541
|
-
// Check if the value points to an alternate stylesheet with that title
|
|
542
|
-
const title = adapter.getAttribute(element, "content");
|
|
543
|
-
// Browser-only validation
|
|
544
|
-
if (element.parentElement && element.parentElement.querySelector) {
|
|
545
|
-
const stylesheet = element.parentElement.querySelector(`link[rel~="alternate" i][rel~="stylesheet" i][title="${title}"]`);
|
|
546
|
-
if (!title) warnings.push("This has no effect. The content attribute must be set to a valid stylesheet title.");
|
|
547
|
-
else if (!stylesheet) {
|
|
548
|
-
payload = {
|
|
549
|
-
alternateStylesheets: Array.from(element.parentElement.querySelectorAll('link[rel~="alternate" i][rel~="stylesheet" i]'))
|
|
550
|
-
};
|
|
551
|
-
warnings.push(`This has no effect. No alternate stylesheet found having title="${title}".`);
|
|
552
|
-
}
|
|
553
|
-
} else if (!title) // In non-browser context, we can still check for missing title
|
|
554
|
-
warnings.push("This has no effect. The content attribute must be set to a valid stylesheet title.");
|
|
555
|
-
warnings.push("Even when used correctly, the default-style method of setting a preferred stylesheet results in a flash of unstyled content. Use modern CSS features like @media rules instead.");
|
|
556
|
-
return {
|
|
557
|
-
ruleId: "no-default-style",
|
|
558
|
-
warnings: warnings,
|
|
559
|
-
payload: payload
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
function $c322f9a5057eaf5c$var$validateContentType(element, adapter) {
|
|
563
|
-
const warnings = [];
|
|
564
|
-
let payload = null;
|
|
565
|
-
// https://html.spec.whatwg.org/multipage/semantics.html#character-encoding-declaration
|
|
566
|
-
// Check if there exists both meta[http-equiv] and meta[chartset] variations
|
|
567
|
-
// Check if this is a charset or content-type meta
|
|
568
|
-
const isCharset = adapter.hasAttribute(element, "charset");
|
|
569
|
-
const httpEquiv = adapter.getAttribute(element, "http-equiv");
|
|
570
|
-
const isContentTypeMeta = httpEquiv?.toLowerCase() === "content-type";
|
|
571
|
-
if (isCharset || isContentTypeMeta) {
|
|
572
|
-
// Check for duplicate charset declarations among siblings
|
|
573
|
-
const siblings = adapter.getSiblings(element);
|
|
574
|
-
const hasDuplicateCharset = siblings.some((sibling)=>{
|
|
575
|
-
if (adapter.getTagName(sibling) !== "meta") return false;
|
|
576
|
-
// Check if sibling is also a charset declaration
|
|
577
|
-
if (adapter.hasAttribute(sibling, "charset")) return true;
|
|
578
|
-
const siblingHttpEquiv = adapter.getAttribute(sibling, "http-equiv");
|
|
579
|
-
return siblingHttpEquiv?.toLowerCase() === "content-type";
|
|
580
|
-
});
|
|
581
|
-
if (hasDuplicateCharset) {
|
|
582
|
-
const parent = adapter.getParent(element);
|
|
583
|
-
if (parent) {
|
|
584
|
-
const charsetElements = adapter.getChildren(parent).filter((child)=>{
|
|
585
|
-
if (adapter.getTagName(child) !== "meta") return false;
|
|
586
|
-
if (adapter.hasAttribute(child, "charset")) return true;
|
|
587
|
-
const childHttpEquiv = adapter.getAttribute(child, "http-equiv");
|
|
588
|
-
return childHttpEquiv?.toLowerCase() === "content-type";
|
|
589
|
-
});
|
|
590
|
-
// Find the first one (not this element)
|
|
591
|
-
const encodingDeclaration = charsetElements.find((el)=>el !== element);
|
|
592
|
-
if (encodingDeclaration) {
|
|
593
|
-
payload = payload ?? {};
|
|
594
|
-
payload.encodingDeclaration = encodingDeclaration;
|
|
595
|
-
warnings.push(`There can only be one meta-based character encoding declaration per document. Already found \`${adapter.stringify(encodingDeclaration)}\`.`);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
// Check if it completely exists in the first 1024 bytes
|
|
601
|
-
// This check only works in browser context with ownerDocument
|
|
602
|
-
if (element.ownerDocument?.documentElement?.outerHTML && element.outerHTML) {
|
|
603
|
-
const charPos = element.ownerDocument.documentElement.outerHTML.indexOf(element.outerHTML) + element.outerHTML.length;
|
|
604
|
-
if (charPos > 1024) {
|
|
605
|
-
payload = payload ?? {};
|
|
606
|
-
payload.characterPosition = charPos;
|
|
607
|
-
warnings.push(`The element containing the character encoding declaration must be serialized completely within the first 1024 bytes of the document. Found at byte ${charPos}.`);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
// Check that the character encoding is UTF-8
|
|
611
|
-
let charset = null;
|
|
612
|
-
if (isCharset) charset = adapter.getAttribute(element, "charset");
|
|
613
|
-
else {
|
|
614
|
-
const charsetPattern = /text\/html;\s*charset=(.*)/i;
|
|
615
|
-
charset = adapter.getAttribute(element, "content")?.match(charsetPattern)?.[1]?.trim();
|
|
616
|
-
}
|
|
617
|
-
if (charset?.toLowerCase() != "utf-8") {
|
|
618
|
-
payload = payload ?? {};
|
|
619
|
-
payload.charset = charset;
|
|
620
|
-
warnings.push(`Documents are required to use UTF-8 encoding. Found "${charset}".`);
|
|
621
|
-
}
|
|
622
|
-
if (warnings.length) // Append the spec source to the last warning
|
|
623
|
-
warnings[warnings.length - 1] += "\nLearn more: https://html.spec.whatwg.org/multipage/semantics.html#character-encoding-declaration";
|
|
624
|
-
return {
|
|
625
|
-
ruleId: "valid-charset",
|
|
626
|
-
warnings: warnings,
|
|
627
|
-
payload: payload
|
|
628
|
-
};
|
|
629
|
-
}
|
|
630
|
-
function $c322f9a5057eaf5c$var$validateHttpEquiv(element, adapter) {
|
|
631
|
-
const warnings = [];
|
|
632
|
-
const type = adapter.getAttribute(element, "http-equiv").toLowerCase();
|
|
633
|
-
const content = adapter.getAttribute(element, "content")?.toLowerCase();
|
|
634
|
-
switch(type){
|
|
635
|
-
case "content-security-policy":
|
|
636
|
-
case "content-security-policy-report-only":
|
|
637
|
-
case "origin-trial":
|
|
638
|
-
case "content-type":
|
|
639
|
-
case "default-style":
|
|
640
|
-
break;
|
|
641
|
-
case "refresh":
|
|
642
|
-
if (!content) {
|
|
643
|
-
warnings.push("This doesn't do anything. The content attribute must be set. However, using refresh is discouraged.");
|
|
644
|
-
break;
|
|
645
|
-
}
|
|
646
|
-
if (content.includes("url=")) warnings.push("Meta auto-redirects are discouraged. Use HTTP 3XX responses instead.");
|
|
647
|
-
else warnings.push("Meta auto-refreshes are discouraged unless users have the ability to disable it.");
|
|
648
|
-
break;
|
|
649
|
-
case "x-dns-prefetch-control":
|
|
650
|
-
if (content == "on") warnings.push(`DNS prefetching is enabled by default. Setting it to "${content}" has no effect.`);
|
|
651
|
-
else if (content != "off") warnings.push(`This is a non-standard way of disabling DNS prefetching, which is a performance optimization. Found content="${content}". Use content="off" if you have a legitimate security concern, otherwise remove it.`);
|
|
652
|
-
else warnings.push("This is non-standard, however most browsers support disabling speculative DNS prefetching. It should still be noted that DNS prefetching is a generally accepted performance optimization and you should only disable it if you have specific security concerns.");
|
|
653
|
-
break;
|
|
654
|
-
case "cache-control":
|
|
655
|
-
case "etag":
|
|
656
|
-
case "pragma":
|
|
657
|
-
case "expires":
|
|
658
|
-
case "last-modified":
|
|
659
|
-
warnings.push("This doesn't do anything. Use HTTP headers for any cache directives.");
|
|
660
|
-
break;
|
|
661
|
-
case "x-frame-options":
|
|
662
|
-
warnings.push("This doesn't do anything. Use the CSP HTTP header with the frame-ancestors directive instead.");
|
|
663
|
-
break;
|
|
664
|
-
case "x-ua-compatible":
|
|
665
|
-
case "content-style-type":
|
|
666
|
-
case "content-script-type":
|
|
667
|
-
case "imagetoolbar":
|
|
668
|
-
case "cleartype":
|
|
669
|
-
case "page-enter":
|
|
670
|
-
case "page-exit":
|
|
671
|
-
case "site-enter":
|
|
672
|
-
case "site-exit":
|
|
673
|
-
case "msthemecompatible":
|
|
674
|
-
case "window-target":
|
|
675
|
-
warnings.push("This doesn't do anything. It was an Internet Explorer feature and is now deprecated.");
|
|
676
|
-
break;
|
|
677
|
-
case "content-language":
|
|
678
|
-
case "language":
|
|
679
|
-
warnings.push("This is non-conforming. Use the html[lang] attribute instead.");
|
|
680
|
-
break;
|
|
681
|
-
case "set-cookie":
|
|
682
|
-
warnings.push("This is non-conforming. Use the Set-Cookie HTTP header instead.");
|
|
683
|
-
break;
|
|
684
|
-
case "application-name":
|
|
685
|
-
case "author":
|
|
686
|
-
case "description":
|
|
687
|
-
case "generator":
|
|
688
|
-
case "keywords":
|
|
689
|
-
case "referrer":
|
|
690
|
-
case "theme-color":
|
|
691
|
-
case "color-scheme":
|
|
692
|
-
case "viewport":
|
|
693
|
-
case "creator":
|
|
694
|
-
case "googlebot":
|
|
695
|
-
case "publisher":
|
|
696
|
-
case "robots":
|
|
697
|
-
warnings.push(`This doesn't do anything. Did you mean \`meta[name=${type}]\`?`);
|
|
698
|
-
break;
|
|
699
|
-
case "encoding":
|
|
700
|
-
warnings.push("This doesn't do anything. Did you mean `meta[charset]`?");
|
|
701
|
-
break;
|
|
702
|
-
case "title":
|
|
703
|
-
warnings.push("This doesn't do anything. Did you mean to use the `title` tag instead?");
|
|
704
|
-
break;
|
|
705
|
-
case "accept-ch":
|
|
706
|
-
case "delegate-ch":
|
|
707
|
-
warnings.push("This is non-standard and may not work across browsers. Use HTTP headers instead.");
|
|
708
|
-
break;
|
|
709
|
-
default:
|
|
710
|
-
warnings.push("This is non-standard and may not work across browsers. http-equiv is not an alternative to HTTP headers.");
|
|
711
|
-
break;
|
|
712
|
-
}
|
|
713
|
-
return {
|
|
714
|
-
ruleId: "no-invalid-http-equiv",
|
|
715
|
-
warnings: warnings
|
|
716
|
-
};
|
|
717
|
-
}
|
|
718
|
-
function $c322f9a5057eaf5c$var$validateMetaViewport(element, adapter) {
|
|
719
|
-
const warnings = [];
|
|
720
|
-
let payload = null;
|
|
721
|
-
// Redundant meta viewport validation.
|
|
722
|
-
// Check if there are other viewport meta elements among siblings
|
|
723
|
-
const siblings = adapter.getSiblings(element);
|
|
724
|
-
const hasDuplicateViewport = siblings.some((sibling)=>{
|
|
725
|
-
if (adapter.getTagName(sibling) !== "meta") return false;
|
|
726
|
-
const name = adapter.getAttribute(sibling, "name");
|
|
727
|
-
return name?.toLowerCase() === "viewport";
|
|
728
|
-
});
|
|
729
|
-
if (hasDuplicateViewport) {
|
|
730
|
-
const parent = adapter.getParent(element);
|
|
731
|
-
if (parent) {
|
|
732
|
-
const viewportElements = adapter.getChildren(parent).filter((child)=>{
|
|
733
|
-
if (adapter.getTagName(child) !== "meta") return false;
|
|
734
|
-
const name = adapter.getAttribute(child, "name");
|
|
735
|
-
return name?.toLowerCase() === "viewport";
|
|
736
|
-
});
|
|
737
|
-
// Find the first one (not this element)
|
|
738
|
-
const firstMetaViewport = viewportElements.find((el)=>el !== element);
|
|
739
|
-
if (firstMetaViewport) {
|
|
740
|
-
payload = {
|
|
741
|
-
firstMetaViewport: firstMetaViewport
|
|
742
|
-
};
|
|
743
|
-
warnings.push("Another meta viewport element has already been declared. Having multiple viewport settings can lead to unexpected behavior.");
|
|
744
|
-
return {
|
|
745
|
-
warnings: warnings,
|
|
746
|
-
payload: payload
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
// Additional validation performed only on the first meta viewport.
|
|
752
|
-
const content = adapter.getAttribute(element, "content")?.toLowerCase();
|
|
753
|
-
if (!content) {
|
|
754
|
-
warnings.push("Invalid viewport. The content attribute must be set.");
|
|
755
|
-
return {
|
|
756
|
-
warnings: warnings,
|
|
757
|
-
payload: payload
|
|
758
|
-
};
|
|
759
|
-
}
|
|
760
|
-
const directives = Object.fromEntries(content.split(",").map((directive)=>{
|
|
761
|
-
const [key, value] = directive.split("=");
|
|
762
|
-
return [
|
|
763
|
-
key?.trim(),
|
|
764
|
-
value?.trim()
|
|
765
|
-
];
|
|
766
|
-
}));
|
|
767
|
-
if ("width" in directives) {
|
|
768
|
-
const width = directives["width"];
|
|
769
|
-
if (Number(width) < 1 || Number(width) > 10000) warnings.push(`Invalid width "${width}". Numeric values must be between 1 and 10000.`);
|
|
770
|
-
else if (width != "device-width") warnings.push(`Invalid width "${width}".`);
|
|
771
|
-
}
|
|
772
|
-
if ("height" in directives) {
|
|
773
|
-
const height = directives["height"];
|
|
774
|
-
if (Number(height) < 1 || Number(height) > 10000) warnings.push(`Invalid height "${height}". Numeric values must be between 1 and 10000.`);
|
|
775
|
-
else if (height != "device-height") warnings.push(`Invalid height "${height}".`);
|
|
776
|
-
}
|
|
777
|
-
if ("initial-scale" in directives) {
|
|
778
|
-
const initialScale = Number(directives["initial-scale"]);
|
|
779
|
-
if (isNaN(initialScale)) warnings.push(`Invalid initial zoom level "${directives["initial-scale"]}". Values must be numeric.`);
|
|
780
|
-
if (initialScale < 0.1 || initialScale > 10) warnings.push(`Invalid initial zoom level "${initialScale}". Values must be between 0.1 and 10.`);
|
|
781
|
-
}
|
|
782
|
-
if ("minimum-scale" in directives) {
|
|
783
|
-
const minimumScale = Number(directives["minimum-scale"]);
|
|
784
|
-
if (isNaN(minimumScale)) warnings.push(`Invalid minimum zoom level "${directives["minimum-scale"]}". Values must be numeric.`);
|
|
785
|
-
if (minimumScale < 0.1 || minimumScale > 10) warnings.push(`Invalid minimum zoom level "${minimumScale}". Values must be between 0.1 and 10.`);
|
|
786
|
-
}
|
|
787
|
-
if ("maximum-scale" in directives) {
|
|
788
|
-
const maxScale = Number(directives["maximum-scale"]);
|
|
789
|
-
if (isNaN(maxScale)) warnings.push(`Invalid maximum zoom level "${directives["maximum-scale"]}". Values must be numeric.`);
|
|
790
|
-
if (maxScale < 0.1 || maxScale > 10) warnings.push(`Invalid maximum zoom level "${maxScale}". Values must be between 0.1 and 10.`);
|
|
791
|
-
if (maxScale < 2) warnings.push(`Disabling zoom levels under 2x can cause accessibility issues. Found "${maxScale}".`);
|
|
792
|
-
}
|
|
793
|
-
if ("user-scalable" in directives) {
|
|
794
|
-
const userScalable = directives["user-scalable"];
|
|
795
|
-
if (userScalable == "no" || userScalable == "0") warnings.push(`Disabling zooming can cause accessibility issues to users with visual impairments. Found "${userScalable}".`);
|
|
796
|
-
if (![
|
|
797
|
-
"0",
|
|
798
|
-
"1",
|
|
799
|
-
"yes",
|
|
800
|
-
"no"
|
|
801
|
-
].includes(userScalable)) warnings.push(`Unsupported value "${userScalable}" found.`);
|
|
802
|
-
}
|
|
803
|
-
if ("interactive-widget" in directives) {
|
|
804
|
-
const interactiveWidget = directives["interactive-widget"];
|
|
805
|
-
const validValues = [
|
|
806
|
-
"resizes-visual",
|
|
807
|
-
"resizes-content",
|
|
808
|
-
"overlays-content"
|
|
809
|
-
];
|
|
810
|
-
if (!validValues.includes(interactiveWidget)) warnings.push(`Unsupported value "${interactiveWidget}" found.`);
|
|
811
|
-
}
|
|
812
|
-
if ("viewport-fit" in directives) {
|
|
813
|
-
const viewportFit = directives["viewport-fit"];
|
|
814
|
-
const validValues = [
|
|
815
|
-
"auto",
|
|
816
|
-
"contain",
|
|
817
|
-
"cover"
|
|
818
|
-
];
|
|
819
|
-
if (!validValues.includes(viewportFit)) warnings.push(`Unsupported value "${viewportFit}" found. Should be one of: ${validValues.join(", ")}.`);
|
|
820
|
-
}
|
|
821
|
-
if ("shrink-to-fit" in directives) warnings.push("The shrink-to-fit directive has been obsolete since iOS 9.2.\n See https://www.scottohara.me/blog/2018/12/11/shrink-to-fit.html");
|
|
822
|
-
const validDirectives = new Set([
|
|
823
|
-
"width",
|
|
824
|
-
"height",
|
|
825
|
-
"initial-scale",
|
|
826
|
-
"minimum-scale",
|
|
827
|
-
"maximum-scale",
|
|
828
|
-
"user-scalable",
|
|
829
|
-
"interactive-widget"
|
|
830
|
-
]);
|
|
831
|
-
Object.keys(directives).filter((directive)=>{
|
|
832
|
-
if (validDirectives.has(directive)) // The directive is valid.
|
|
833
|
-
return false;
|
|
834
|
-
if (directive == "shrink-to-fit") // shrink-to-fit is not valid, but we have a separate warning for it.
|
|
835
|
-
return false;
|
|
836
|
-
directive;
|
|
837
|
-
return true;
|
|
838
|
-
}).forEach((directive)=>{
|
|
839
|
-
warnings.push(`Invalid viewport directive "${directive}".`);
|
|
840
|
-
});
|
|
841
|
-
return {
|
|
842
|
-
ruleId: "valid-meta-viewport",
|
|
843
|
-
warnings: warnings,
|
|
844
|
-
payload: payload
|
|
845
|
-
};
|
|
846
|
-
}
|
|
847
|
-
function $c322f9a5057eaf5c$var$validateUnnecessaryPreload(element, adapter, parentElement = null) {
|
|
848
|
-
const href = adapter.getAttribute(element, "href");
|
|
849
|
-
if (!href) return {
|
|
850
|
-
ruleId: "no-unnecessary-preload",
|
|
851
|
-
warnings: []
|
|
852
|
-
};
|
|
853
|
-
const parent = parentElement || adapter.getParent(element);
|
|
854
|
-
if (!parent) return {
|
|
855
|
-
ruleId: "no-unnecessary-preload",
|
|
856
|
-
warnings: []
|
|
857
|
-
};
|
|
858
|
-
const preloadedElement = $c322f9a5057eaf5c$var$findElementWithSource(parent, href, element, adapter);
|
|
859
|
-
if (!preloadedElement) return {
|
|
860
|
-
ruleId: "no-unnecessary-preload",
|
|
861
|
-
warnings: []
|
|
862
|
-
};
|
|
863
|
-
return {
|
|
864
|
-
ruleId: "no-unnecessary-preload",
|
|
865
|
-
warnings: [
|
|
866
|
-
`This preload has little to no effect. ${href} is already discoverable by another ${adapter.getTagName(preloadedElement)} element.`
|
|
867
|
-
]
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
function $4638c35e8aec1c56$export$66aa292af6e88fd9(headNode, adapter, options = {}) {
|
|
873
|
-
const { includeValidation: includeValidation = true, includeCustomValidations: includeCustomValidations = true } = options;
|
|
874
|
-
// Pass 1: Compute weights for all elements
|
|
875
|
-
const weights = $ee7e0c73e51ebfda$export$5cc4a311ddbe699c(headNode, adapter);
|
|
876
|
-
// Pass 2: Get document-level validation warnings
|
|
877
|
-
const validationWarnings = includeValidation ? (0, $c322f9a5057eaf5c$export$b01ab94d0cd042a0)(headNode, adapter) : [];
|
|
878
|
-
// Pass 3: Get element-level custom validations
|
|
879
|
-
const customValidations = includeCustomValidations ? $4638c35e8aec1c56$var$getElementValidations(headNode, adapter) : [];
|
|
880
|
-
return {
|
|
881
|
-
weights: weights,
|
|
882
|
-
validationWarnings: validationWarnings,
|
|
883
|
-
customValidations: customValidations,
|
|
884
|
-
headElement: headNode
|
|
885
|
-
};
|
|
886
|
-
}
|
|
887
|
-
/**
|
|
888
|
-
* Get custom validations for all elements in head
|
|
889
|
-
*
|
|
890
|
-
* @param {any} headNode - The <head> element
|
|
891
|
-
* @param {Object} adapter - HTMLAdapter implementation
|
|
892
|
-
* @returns {Array<CustomValidation>}
|
|
893
|
-
* @private
|
|
894
|
-
*/ function $4638c35e8aec1c56$var$getElementValidations(headNode, adapter) {
|
|
895
|
-
const customValidations = [];
|
|
896
|
-
const children = adapter.getChildren(headNode);
|
|
897
|
-
for (const element of children){
|
|
898
|
-
const validation = (0, $c322f9a5057eaf5c$export$6c93e2175c028eeb)(element, adapter, headNode);
|
|
899
|
-
if (validation && validation.warnings && validation.warnings.length > 0) customValidations.push({
|
|
900
|
-
ruleId: validation.ruleId,
|
|
901
|
-
element: element,
|
|
902
|
-
warnings: validation.warnings,
|
|
903
|
-
payload: validation.payload
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
|
-
return customValidations;
|
|
907
|
-
}
|
|
908
|
-
function $4638c35e8aec1c56$export$a824357f4ceaf2cf(weight) {
|
|
909
|
-
// Find the category that matches this weight
|
|
910
|
-
for (const [category, value] of Object.entries($ee7e0c73e51ebfda$export$881088883fcab450)){
|
|
911
|
-
if (value === weight) return category;
|
|
912
|
-
}
|
|
913
|
-
return "UNKNOWN";
|
|
914
|
-
}
|
|
915
|
-
function $4638c35e8aec1c56$export$9d3d5cf01843f4a8(weights) {
|
|
916
|
-
const violations = [];
|
|
917
|
-
for(let i = 0; i < weights.length - 1; i++){
|
|
918
|
-
const current = weights[i];
|
|
919
|
-
const next = weights[i + 1];
|
|
920
|
-
if (current.weight < next.weight) {
|
|
921
|
-
const currentCategory = $4638c35e8aec1c56$export$a824357f4ceaf2cf(current.weight);
|
|
922
|
-
const nextCategory = $4638c35e8aec1c56$export$a824357f4ceaf2cf(next.weight);
|
|
923
|
-
violations.push({
|
|
924
|
-
index: i + 1,
|
|
925
|
-
currentElement: current.element,
|
|
926
|
-
nextElement: next.element,
|
|
927
|
-
currentWeight: current.weight,
|
|
928
|
-
nextWeight: next.weight,
|
|
929
|
-
currentCategory: currentCategory,
|
|
930
|
-
nextCategory: nextCategory,
|
|
931
|
-
message: `${nextCategory} element should come before ${currentCategory} element`
|
|
932
|
-
});
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
return violations;
|
|
936
|
-
}
|
|
937
|
-
function $4638c35e8aec1c56$export$283ccd6e4ed2051d(headNode, adapter, options = {}) {
|
|
938
|
-
const result = $4638c35e8aec1c56$export$66aa292af6e88fd9(headNode, adapter, options);
|
|
939
|
-
const orderingViolations = $4638c35e8aec1c56$export$9d3d5cf01843f4a8(result.weights);
|
|
940
|
-
return {
|
|
941
|
-
...result,
|
|
942
|
-
orderingViolations: orderingViolations
|
|
943
|
-
};
|
|
944
|
-
}
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
/**
|
|
950
|
-
* @file Browser DOM adapter
|
|
951
|
-
*
|
|
952
|
-
* Wraps native DOM Element APIs to implement the HTMLAdapter interface.
|
|
953
|
-
* This adapter is used in browser environments where capo.js operates
|
|
954
|
-
* on actual DOM elements.
|
|
955
|
-
*/ /**
|
|
956
|
-
* @file Base adapter interface for HTML tree operations
|
|
957
|
-
*
|
|
958
|
-
* This file defines the contract that all adapters must implement.
|
|
959
|
-
* Adapters abstract away environment-specific operations (browser DOM vs AST nodes)
|
|
960
|
-
* to make capo.js core logic reusable across different contexts.
|
|
961
|
-
*
|
|
962
|
-
* @interface HTMLAdapter
|
|
963
|
-
*/ const $7afc5bf68bcc75e1$var$REQUIRED_METHODS = [
|
|
964
|
-
"isElement",
|
|
965
|
-
"getTagName",
|
|
966
|
-
"getAttribute",
|
|
967
|
-
"hasAttribute",
|
|
968
|
-
"getAttributeNames",
|
|
969
|
-
"getTextContent",
|
|
970
|
-
"getChildren",
|
|
971
|
-
"getParent",
|
|
972
|
-
"getSiblings",
|
|
973
|
-
"stringify"
|
|
974
|
-
];
|
|
975
|
-
class $7afc5bf68bcc75e1$export$d1d100ae3c773a95 {
|
|
976
|
-
/**
|
|
977
|
-
* Check if node is an Element (not text, comment, etc.)
|
|
978
|
-
* @param {any} node - The node to check
|
|
979
|
-
* @returns {boolean}
|
|
980
|
-
*/ isElement(node) {
|
|
981
|
-
throw new Error("isElement() not implemented");
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Get the tag name of an element (lowercase)
|
|
985
|
-
* @param {any} node - Element node
|
|
986
|
-
* @returns {string} - Tag name like 'meta', 'link', 'script'
|
|
987
|
-
*/ getTagName(node) {
|
|
988
|
-
throw new Error("getTagName() not implemented");
|
|
989
|
-
}
|
|
990
|
-
/**
|
|
991
|
-
* Get attribute value from element
|
|
992
|
-
* @param {any} node - Element node
|
|
993
|
-
* @param {string} attrName - Attribute name (case-insensitive)
|
|
994
|
-
* @returns {string | null} - Attribute value or null if not found
|
|
995
|
-
*/ getAttribute(node, attrName) {
|
|
996
|
-
throw new Error("getAttribute() not implemented");
|
|
997
|
-
}
|
|
998
|
-
/**
|
|
999
|
-
* Check if element has a specific attribute
|
|
1000
|
-
* @param {any} node - Element node
|
|
1001
|
-
* @param {string} attrName - Attribute name (case-insensitive)
|
|
1002
|
-
* @returns {boolean} - True if attribute exists
|
|
1003
|
-
*/ hasAttribute(node, attrName) {
|
|
1004
|
-
throw new Error("hasAttribute() not implemented");
|
|
1005
|
-
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Get all attribute names for an element
|
|
1008
|
-
* @param {any} node - Element node
|
|
1009
|
-
* @returns {string[]} - Array of attribute names
|
|
1010
|
-
*/ getAttributeNames(node) {
|
|
1011
|
-
throw new Error("getAttributeNames() not implemented");
|
|
1012
|
-
}
|
|
1013
|
-
/**
|
|
1014
|
-
* Get text content of a node (for inline scripts/styles)
|
|
1015
|
-
* @param {any} node - Element node
|
|
1016
|
-
* @returns {string} - Text content
|
|
1017
|
-
*/ getTextContent(node) {
|
|
1018
|
-
throw new Error("getTextContent() not implemented");
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* Get child elements of a node
|
|
1022
|
-
* @param {any} node - Parent node
|
|
1023
|
-
* @returns {any[]} - Array of child element nodes (excluding text/comment nodes)
|
|
1024
|
-
*/ getChildren(node) {
|
|
1025
|
-
throw new Error("getChildren() not implemented");
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Get parent element of a node
|
|
1029
|
-
* @param {any} node - Child node
|
|
1030
|
-
* @returns {any | null} - Parent element node, or null if no parent
|
|
1031
|
-
*/ getParent(node) {
|
|
1032
|
-
throw new Error("getParent() not implemented");
|
|
1033
|
-
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Get sibling elements of a node
|
|
1036
|
-
* @param {any} node - Element node
|
|
1037
|
-
* @returns {any[]} - Array of sibling element nodes (excluding the node itself)
|
|
1038
|
-
*/ getSiblings(node) {
|
|
1039
|
-
throw new Error("getSiblings() not implemented");
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Get source location for a node (optional, for linting)
|
|
1043
|
-
* @param {any} node - Element node
|
|
1044
|
-
* @returns {{ line: number, column: number, endLine?: number, endColumn?: number } | null}
|
|
1045
|
-
*/ getLocation(node) {
|
|
1046
|
-
return null;
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Stringify element for logging/debugging
|
|
1050
|
-
* @param {any} node - Element node
|
|
1051
|
-
* @returns {string} - String representation like "<meta charset='utf-8'>"
|
|
1052
|
-
*/ stringify(node) {
|
|
1053
|
-
throw new Error("stringify() not implemented");
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
function $7afc5bf68bcc75e1$export$8b0c6d51edeaa8b(adapter) {
|
|
1057
|
-
for (const method of $7afc5bf68bcc75e1$var$REQUIRED_METHODS){
|
|
1058
|
-
if (typeof adapter[method] !== "function") throw new Error(`Adapter missing required method: ${method}()`);
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
class $6e48536853157d9f$export$e467cc3399500025 extends (0, $7afc5bf68bcc75e1$export$d1d100ae3c773a95) {
|
|
1064
|
-
/**
|
|
1065
|
-
* Check if node is an Element (not text, comment, etc.)
|
|
1066
|
-
* @param {any} node - The node to check
|
|
1067
|
-
* @returns {boolean}
|
|
1068
|
-
*/ isElement(node) {
|
|
1069
|
-
if (!node) return false;
|
|
1070
|
-
// Node.ELEMENT_NODE === 1
|
|
1071
|
-
return node.nodeType === 1;
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Get the tag name of an element (lowercase)
|
|
1075
|
-
* @param {any} node - Element node
|
|
1076
|
-
* @returns {string} - Tag name like 'meta', 'link', 'script'
|
|
1077
|
-
*/ getTagName(node) {
|
|
1078
|
-
if (!node || !node.tagName) return "";
|
|
1079
|
-
return node.tagName.toLowerCase();
|
|
1080
|
-
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Get attribute value from element
|
|
1083
|
-
* @param {any} node - Element node
|
|
1084
|
-
* @param {string} attrName - Attribute name (case-insensitive)
|
|
1085
|
-
* @returns {string | null} - Attribute value or null if not found
|
|
1086
|
-
*/ getAttribute(node, attrName) {
|
|
1087
|
-
if (!node || typeof node.getAttribute !== "function") return null;
|
|
1088
|
-
return node.getAttribute(attrName);
|
|
1089
|
-
}
|
|
1090
|
-
/**
|
|
1091
|
-
* Check if element has a specific attribute
|
|
1092
|
-
* @param {any} node - Element node
|
|
1093
|
-
* @param {string} attrName - Attribute name (case-insensitive)
|
|
1094
|
-
* @returns {boolean} - True if attribute exists
|
|
1095
|
-
*/ hasAttribute(node, attrName) {
|
|
1096
|
-
if (!node || typeof node.hasAttribute !== "function") return false;
|
|
1097
|
-
return node.hasAttribute(attrName);
|
|
1098
|
-
}
|
|
1099
|
-
/**
|
|
1100
|
-
* Get all attribute names for an element
|
|
1101
|
-
* @param {any} node - Element node
|
|
1102
|
-
* @returns {string[]} - Array of attribute names
|
|
1103
|
-
*/ getAttributeNames(node) {
|
|
1104
|
-
if (!node || typeof node.getAttributeNames !== "function") return [];
|
|
1105
|
-
return node.getAttributeNames();
|
|
1106
|
-
}
|
|
1107
|
-
/**
|
|
1108
|
-
* Get text content of a node (for inline scripts/styles)
|
|
1109
|
-
* @param {any} node - Element node
|
|
1110
|
-
* @returns {string} - Text content
|
|
1111
|
-
*/ getTextContent(node) {
|
|
1112
|
-
if (!node) return "";
|
|
1113
|
-
return node.textContent || "";
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* Get child elements of a node
|
|
1117
|
-
* @param {any} node - Parent node
|
|
1118
|
-
* @returns {any[]} - Array of child element nodes (excluding text/comment nodes)
|
|
1119
|
-
*/ getChildren(node) {
|
|
1120
|
-
if (!node || !node.children) return [];
|
|
1121
|
-
return Array.from(node.children);
|
|
1122
|
-
}
|
|
1123
|
-
/**
|
|
1124
|
-
* Get parent element of a node
|
|
1125
|
-
* @param {any} node - Child node
|
|
1126
|
-
* @returns {any | null} - Parent element node, or null if no parent
|
|
1127
|
-
*/ getParent(node) {
|
|
1128
|
-
if (!node) return null;
|
|
1129
|
-
return node.parentElement || null;
|
|
1130
|
-
}
|
|
1131
|
-
/**
|
|
1132
|
-
* Get sibling elements of a node
|
|
1133
|
-
* @param {any} node - Element node
|
|
1134
|
-
* @returns {any[]} - Array of sibling element nodes (excluding the node itself)
|
|
1135
|
-
*/ getSiblings(node) {
|
|
1136
|
-
if (!node) return [];
|
|
1137
|
-
const parent = node.parentElement;
|
|
1138
|
-
if (!parent) return [];
|
|
1139
|
-
return Array.from(parent.children).filter((child)=>child !== node);
|
|
1140
|
-
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Get source location for a node (optional, for linting)
|
|
1143
|
-
*
|
|
1144
|
-
* Browser DOM elements don't have source location information,
|
|
1145
|
-
* so this always returns null.
|
|
1146
|
-
*
|
|
1147
|
-
* @param {any} node - Element node
|
|
1148
|
-
* @returns {null}
|
|
1149
|
-
*/ getLocation(node) {
|
|
1150
|
-
// Not available in browser DOM
|
|
1151
|
-
return null;
|
|
1152
|
-
}
|
|
1153
|
-
/**
|
|
1154
|
-
* Stringify element for logging/debugging
|
|
1155
|
-
* @param {any} node - Element node
|
|
1156
|
-
* @returns {string} - String representation like "<meta charset='utf-8'>"
|
|
1157
|
-
*/ stringify(node) {
|
|
1158
|
-
if (!node || !node.nodeName) return "[invalid node]";
|
|
1159
|
-
const tagName = this.getTagName(node);
|
|
1160
|
-
const attrNames = this.getAttributeNames(node);
|
|
1161
|
-
if (attrNames.length === 0) return `<${tagName}>`;
|
|
1162
|
-
// Build attribute string
|
|
1163
|
-
const attrs = attrNames.map((attr)=>{
|
|
1164
|
-
const value = this.getAttribute(node, attr);
|
|
1165
|
-
// Escape value for display
|
|
1166
|
-
const escapedValue = value ? value.replace(/"/g, """) : "";
|
|
1167
|
-
return `${attr}="${escapedValue}"`;
|
|
1168
|
-
}).join(" ");
|
|
1169
|
-
return `<${tagName} ${attrs}>`;
|
|
1170
|
-
}
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
// Test utilities for custom adapters
|
|
1176
|
-
// These are exported via package.json for node usage only
|
|
1177
|
-
// to avoid bundling node:test in the browser.
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
const $47602b39438c5a8c$var$Hues = {
|
|
1182
|
-
PINK: 320,
|
|
1183
|
-
BLUE: 200
|
|
1184
|
-
};
|
|
1185
|
-
function $47602b39438c5a8c$export$921514c0345db5eb(hue) {
|
|
1186
|
-
return [
|
|
1187
|
-
`oklch(5% .1 ${hue})`,
|
|
1188
|
-
`oklch(13% .2 ${hue})`,
|
|
1189
|
-
`oklch(25% .2 ${hue})`,
|
|
1190
|
-
`oklch(35% .25 ${hue})`,
|
|
1191
|
-
`oklch(50% .27 ${hue})`,
|
|
1192
|
-
`oklch(67% .31 ${hue})`,
|
|
1193
|
-
`oklch(72% .25 ${hue})`,
|
|
1194
|
-
`oklch(80% .2 ${hue})`,
|
|
1195
|
-
`oklch(90% .1 ${hue})`,
|
|
1196
|
-
`oklch(99% .05 ${hue})`,
|
|
1197
|
-
"#ccc"
|
|
1198
|
-
];
|
|
1199
|
-
}
|
|
1200
|
-
const $47602b39438c5a8c$export$e6952b12ade67489 = [
|
|
1201
|
-
"#9e0142",
|
|
1202
|
-
"#d53e4f",
|
|
1203
|
-
"#f46d43",
|
|
1204
|
-
"#fdae61",
|
|
1205
|
-
"#fee08b",
|
|
1206
|
-
"#e6f598",
|
|
1207
|
-
"#abdda4",
|
|
1208
|
-
"#66c2a5",
|
|
1209
|
-
"#3288bd",
|
|
1210
|
-
"#5e4fa2",
|
|
1211
|
-
"#cccccc"
|
|
1212
|
-
];
|
|
1213
|
-
const $47602b39438c5a8c$export$d68d0fda4a10dbc2 = $47602b39438c5a8c$export$921514c0345db5eb($47602b39438c5a8c$var$Hues.PINK);
|
|
1214
|
-
const $47602b39438c5a8c$export$738c3b9a44c87ecc = $47602b39438c5a8c$export$921514c0345db5eb($47602b39438c5a8c$var$Hues.BLUE);
|
|
1215
|
-
const $47602b39438c5a8c$export$9a82c28ef488e918 = {
|
|
1216
|
-
DEFAULT: $47602b39438c5a8c$export$e6952b12ade67489,
|
|
1217
|
-
PINK: $47602b39438c5a8c$export$d68d0fda4a10dbc2,
|
|
1218
|
-
BLUE: $47602b39438c5a8c$export$738c3b9a44c87ecc
|
|
1219
|
-
};
|
|
1220
|
-
function $47602b39438c5a8c$export$18c940335d915715(elementColor) {
|
|
1221
|
-
let invalidColor = "#cccccc";
|
|
1222
|
-
if (elementColor == invalidColor) invalidColor = "red";
|
|
1223
|
-
return `repeating-linear-gradient(45deg, ${elementColor}, ${elementColor} 3px, ${invalidColor} 3px, ${invalidColor} 6px)`;
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
class $33f7359dc421be0c$export$8f8422ac5947a789 {
|
|
1228
|
-
constructor(document1, options, output = window.console){
|
|
1229
|
-
this.document = document1;
|
|
1230
|
-
this.options = options;
|
|
1231
|
-
this.console = output;
|
|
1232
|
-
this.isStaticHead = false;
|
|
1233
|
-
this.head = null;
|
|
1234
|
-
}
|
|
1235
|
-
async init() {
|
|
1236
|
-
if (this.head) return;
|
|
1237
|
-
if (this.options.prefersDynamicAssessment()) {
|
|
1238
|
-
this.head = this.document.querySelector("head");
|
|
1239
|
-
return;
|
|
1240
|
-
}
|
|
1241
|
-
try {
|
|
1242
|
-
let html = await this.getStaticHTML();
|
|
1243
|
-
html = html.replace(/(\<\/?)(head)/gi, "$1static-head");
|
|
1244
|
-
const staticDoc = this.document.implementation.createHTMLDocument("New Document");
|
|
1245
|
-
staticDoc.documentElement.innerHTML = html;
|
|
1246
|
-
this.head = staticDoc.querySelector("static-head");
|
|
1247
|
-
if (this.head) this.isStaticHead = true;
|
|
1248
|
-
else this.head = this.document.head;
|
|
1249
|
-
} catch (e) {
|
|
1250
|
-
this.console.error(`${this.options.loggingPrefix}An exception occurred while getting the static <head>:`, e);
|
|
1251
|
-
this.head = this.document.head;
|
|
1252
|
-
}
|
|
1253
|
-
if (!this.isStaticHead) this.console.warn(`${this.options.loggingPrefix}Unable to parse the static (server-rendered) <head>. Falling back to document.head`, this.head);
|
|
1254
|
-
}
|
|
1255
|
-
async getStaticHTML() {
|
|
1256
|
-
const url = this.document.location.href;
|
|
1257
|
-
const response = await fetch(url);
|
|
1258
|
-
return await response.text();
|
|
1259
|
-
}
|
|
1260
|
-
getHead() {
|
|
1261
|
-
return this.head;
|
|
1262
|
-
}
|
|
1263
|
-
stringifyElement(element) {
|
|
1264
|
-
return element.getAttributeNames().reduce((id, attr)=>{
|
|
1265
|
-
return id += `[${CSS.escape(attr)}=${JSON.stringify(element.getAttribute(attr))}]`;
|
|
1266
|
-
}, element.nodeName);
|
|
1267
|
-
}
|
|
1268
|
-
getLoggableElement(element) {
|
|
1269
|
-
if (!this.isStaticHead) return element;
|
|
1270
|
-
const selector = this.stringifyElement(element);
|
|
1271
|
-
const candidates = Array.from(this.document.head.querySelectorAll(selector));
|
|
1272
|
-
if (candidates.length == 0) return element;
|
|
1273
|
-
if (candidates.length == 1) return candidates[0];
|
|
1274
|
-
// The way the static elements are parsed makes their innerHTML different.
|
|
1275
|
-
// Recreate the element in DOM and compare its innerHTML with those of the candidates.
|
|
1276
|
-
// This ensures a consistent parsing and positive string matches.
|
|
1277
|
-
const candidateWrapper = this.document.createElement("div");
|
|
1278
|
-
const elementWrapper = this.document.createElement("div");
|
|
1279
|
-
elementWrapper.innerHTML = element.innerHTML;
|
|
1280
|
-
const candidate = candidates.find((c)=>{
|
|
1281
|
-
candidateWrapper.innerHTML = c.innerHTML;
|
|
1282
|
-
return candidateWrapper.innerHTML == elementWrapper.innerHTML;
|
|
1283
|
-
});
|
|
1284
|
-
if (candidate) return candidate;
|
|
1285
|
-
return element;
|
|
1286
|
-
}
|
|
1287
|
-
// Note: AI-generated function.
|
|
1288
|
-
createElementFromSelector(selector) {
|
|
1289
|
-
// Extract the tag name from the selector
|
|
1290
|
-
const tagName = selector.match(/^[A-Za-z]+/)[0];
|
|
1291
|
-
if (!tagName) return;
|
|
1292
|
-
// Create the new element
|
|
1293
|
-
const element = document.createElement(tagName);
|
|
1294
|
-
// Extract the attribute key-value pairs from the selector
|
|
1295
|
-
const attributes = selector.match(/\[([A-Za-z-]+)="([^"]+)"\]/g) || [];
|
|
1296
|
-
// Set the attributes on the new element
|
|
1297
|
-
attributes.forEach((attribute)=>{
|
|
1298
|
-
// Trim square brackets
|
|
1299
|
-
attribute = attribute.slice(1, -1);
|
|
1300
|
-
const delimeterPosition = attribute.indexOf("=");
|
|
1301
|
-
// Everything before the =
|
|
1302
|
-
const key = attribute.slice(0, delimeterPosition);
|
|
1303
|
-
// Everything after the =, with quotes trimmed
|
|
1304
|
-
const value = attribute.slice(delimeterPosition + 1).slice(1, -1);
|
|
1305
|
-
element.setAttribute(key, value);
|
|
1306
|
-
});
|
|
1307
|
-
return element;
|
|
1308
|
-
}
|
|
1309
|
-
logAnalysis(result) {
|
|
1310
|
-
const headElement = this.getHead();
|
|
1311
|
-
const headWeights = result.weights.map((w)=>{
|
|
1312
|
-
const customValidation = result.customValidations.find((v)=>v.element === w.element);
|
|
1313
|
-
return {
|
|
1314
|
-
element: w.element,
|
|
1315
|
-
weight: w.weight,
|
|
1316
|
-
isValid: !customValidation,
|
|
1317
|
-
customValidations: customValidation || {}
|
|
1318
|
-
};
|
|
1319
|
-
});
|
|
1320
|
-
this.logValidationWarnings(result.validationWarnings);
|
|
1321
|
-
// Log custom validations (e.g. origin trials) at the top level
|
|
1322
|
-
result.customValidations.forEach((v)=>{
|
|
1323
|
-
if (v.warnings.length > 0) this.console.warn(`${this.options.loggingPrefix}${v.warnings[0]}`, v.element, v.payload || "");
|
|
1324
|
-
});
|
|
1325
|
-
this.visualizeHead("Actual", headElement, headWeights);
|
|
1326
|
-
const sortedHeadWeights = [
|
|
1327
|
-
...headWeights
|
|
1328
|
-
].sort((a, b)=>b.weight - a.weight);
|
|
1329
|
-
const sortedHeadElement = headElement.cloneNode(false);
|
|
1330
|
-
sortedHeadWeights.forEach(({ element: element })=>{
|
|
1331
|
-
if (element) sortedHeadElement.appendChild(element.cloneNode(true));
|
|
1332
|
-
});
|
|
1333
|
-
this.visualizeHead("Sorted", sortedHeadElement, sortedHeadWeights);
|
|
1334
|
-
return headWeights;
|
|
1335
|
-
}
|
|
1336
|
-
logElementFromSelector({ weight: weight, selector: selector, innerHTML: innerHTML, isValid: isValid, customValidations: customValidations = {} }) {
|
|
1337
|
-
weight = +weight;
|
|
1338
|
-
const viz = this.getElementVisualization(weight, isValid);
|
|
1339
|
-
let element = this.createElementFromSelector(selector);
|
|
1340
|
-
element.innerHTML = innerHTML;
|
|
1341
|
-
element = this.getLoggableElement(element);
|
|
1342
|
-
this.logElement({
|
|
1343
|
-
viz: viz,
|
|
1344
|
-
weight: weight,
|
|
1345
|
-
element: element,
|
|
1346
|
-
isValid: isValid,
|
|
1347
|
-
customValidations: customValidations
|
|
1348
|
-
});
|
|
1349
|
-
}
|
|
1350
|
-
logElement({ viz: viz, weight: weight, element: element, isValid: isValid, customValidations: customValidations = {}, omitPrefix: omitPrefix = false }) {
|
|
1351
|
-
if (!omitPrefix) viz.visual = `${this.options.loggingPrefix}${viz.visual}`;
|
|
1352
|
-
let loggingLevel = "log";
|
|
1353
|
-
const loggedElement = element.cloneNode(false);
|
|
1354
|
-
loggedElement.innerHTML = "";
|
|
1355
|
-
const args = [
|
|
1356
|
-
viz.visual,
|
|
1357
|
-
viz.style,
|
|
1358
|
-
weight + 1,
|
|
1359
|
-
loggedElement
|
|
1360
|
-
];
|
|
1361
|
-
if (!this.options.isValidationEnabled()) {
|
|
1362
|
-
this.console[loggingLevel](...args);
|
|
1363
|
-
return;
|
|
1364
|
-
}
|
|
1365
|
-
const { payload: payload, warnings: warnings } = customValidations;
|
|
1366
|
-
if (payload) {
|
|
1367
|
-
if (typeof payload.expiry == "string") // Deserialize origin trial expiration dates.
|
|
1368
|
-
payload.expiry = new Date(payload.expiry);
|
|
1369
|
-
args.push(payload);
|
|
1370
|
-
}
|
|
1371
|
-
if (warnings?.length) {
|
|
1372
|
-
// Element-specific warnings.
|
|
1373
|
-
loggingLevel = "warn";
|
|
1374
|
-
args.push("\n" + warnings.map((warning)=>` ❌ ${warning}`).join("\n"));
|
|
1375
|
-
} else if (!isValid && (this.options.prefersDynamicAssessment() || this.isStaticHead)) {
|
|
1376
|
-
// General warnings.
|
|
1377
|
-
loggingLevel = "warn";
|
|
1378
|
-
args.push(`\n ❌ invalid element (${element.tagName})`);
|
|
1379
|
-
}
|
|
1380
|
-
this.console[loggingLevel](...args);
|
|
1381
|
-
}
|
|
1382
|
-
logValidationWarnings(warnings) {
|
|
1383
|
-
if (!this.options.isValidationEnabled()) return;
|
|
1384
|
-
warnings.forEach(({ warning: warning, elements: elements = [], element: element })=>{
|
|
1385
|
-
elements = elements.map(this.getLoggableElement.bind(this));
|
|
1386
|
-
this.console.warn(`${this.options.loggingPrefix}${warning}`, ...elements, element || "");
|
|
1387
|
-
});
|
|
1388
|
-
}
|
|
1389
|
-
getColor(weight) {
|
|
1390
|
-
return this.options.palette[10 - weight];
|
|
1391
|
-
}
|
|
1392
|
-
getHeadVisualization(elements) {
|
|
1393
|
-
let visual = "";
|
|
1394
|
-
const styles = [];
|
|
1395
|
-
elements.forEach(({ weight: weight, isValid: isValid })=>{
|
|
1396
|
-
visual += "%c ";
|
|
1397
|
-
const color = this.getColor(weight);
|
|
1398
|
-
let style = `padding: 5px; margin: 0 -1px; `;
|
|
1399
|
-
if (isValid) style += `background-color: ${color};`;
|
|
1400
|
-
else style += `background-image: ${(0, $47602b39438c5a8c$export$18c940335d915715)(color)}`;
|
|
1401
|
-
styles.push(style);
|
|
1402
|
-
});
|
|
1403
|
-
return {
|
|
1404
|
-
visual: visual,
|
|
1405
|
-
styles: styles
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
getElementVisualization(weight, isValid = true) {
|
|
1409
|
-
const visual = `%c${new Array(weight + 1).fill("█").join("")}`;
|
|
1410
|
-
const color = this.getColor(weight);
|
|
1411
|
-
let style = `color: ${color}`;
|
|
1412
|
-
return {
|
|
1413
|
-
visual: visual,
|
|
1414
|
-
style: style
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
visualizeHead(groupName, headElement, headWeights) {
|
|
1418
|
-
const headViz = this.getHeadVisualization(headWeights);
|
|
1419
|
-
this.console.groupCollapsed(`${this.options.loggingPrefix}${groupName} %chead%c order\n${headViz.visual}`, "font-family: monospace", "font-family: inherit", ...headViz.styles);
|
|
1420
|
-
headWeights.forEach(({ weight: weight, element: element, isValid: isValid, customValidations: customValidations })=>{
|
|
1421
|
-
const viz = this.getElementVisualization(weight, isValid);
|
|
1422
|
-
this.logElement({
|
|
1423
|
-
viz: viz,
|
|
1424
|
-
weight: weight,
|
|
1425
|
-
element: element,
|
|
1426
|
-
isValid: isValid,
|
|
1427
|
-
customValidations: customValidations,
|
|
1428
|
-
omitPrefix: true
|
|
1429
|
-
});
|
|
1430
|
-
});
|
|
1431
|
-
this.console.log(`${groupName} %chead%c element`, "font-family: monospace", "font-family: inherit", headElement);
|
|
1432
|
-
this.console.groupEnd();
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
class $5daa40bf356478d7$export$c019608e5b5bb4cb {
|
|
1439
|
-
constructor({ preferredAssessmentMode: preferredAssessmentMode = $5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode.STATIC, validation: validation = true, palette: palette = $47602b39438c5a8c$export$e6952b12ade67489, loggingPrefix: loggingPrefix = "Capo: " } = {}){
|
|
1440
|
-
this.setPreferredAssessmentMode(preferredAssessmentMode);
|
|
1441
|
-
this.setValidation(validation);
|
|
1442
|
-
this.setPalette(palette);
|
|
1443
|
-
this.setLoggingPrefix(loggingPrefix);
|
|
1444
|
-
}
|
|
1445
|
-
static get AssessmentMode() {
|
|
1446
|
-
return {
|
|
1447
|
-
STATIC: "static",
|
|
1448
|
-
DYNAMIC: "dynamic"
|
|
1449
|
-
};
|
|
1450
|
-
}
|
|
1451
|
-
static get Palettes() {
|
|
1452
|
-
return $47602b39438c5a8c$export$9a82c28ef488e918;
|
|
1453
|
-
}
|
|
1454
|
-
prefersStaticAssessment() {
|
|
1455
|
-
return this.preferredAssessmentMode === $5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode.STATIC;
|
|
1456
|
-
}
|
|
1457
|
-
prefersDynamicAssessment() {
|
|
1458
|
-
return this.preferredAssessmentMode === $5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode.DYNAMIC;
|
|
1459
|
-
}
|
|
1460
|
-
isValidationEnabled() {
|
|
1461
|
-
return this.validation;
|
|
1462
|
-
}
|
|
1463
|
-
setPreferredAssessmentMode(preferredAssessmentMode) {
|
|
1464
|
-
if (!this.isValidAssessmentMode(preferredAssessmentMode)) throw new Error(`Invalid option: preferred assessment mode, expected AssessmentMode.STATIC or AssessmentMode.DYNAMIC, got "${preferredAssessmentMode}".`);
|
|
1465
|
-
this.preferredAssessmentMode = preferredAssessmentMode;
|
|
1466
|
-
}
|
|
1467
|
-
setPreferredAssessmentModeToStatic(prefersStatic) {
|
|
1468
|
-
let mode = $5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode.STATIC;
|
|
1469
|
-
if (!prefersStatic) mode = $5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode.DYNAMIC;
|
|
1470
|
-
this.setPreferredAssessmentMode(mode);
|
|
1471
|
-
}
|
|
1472
|
-
setValidation(validation) {
|
|
1473
|
-
if (!this.isValidValidation(validation)) throw new Error(`Invalid option: validation, expected boolean, got "${validation}".`);
|
|
1474
|
-
this.validation = validation;
|
|
1475
|
-
}
|
|
1476
|
-
setPalette(palette) {
|
|
1477
|
-
if (!this.isValidPalette(palette)) throw new Error(`Invalid option: palette, expected [${Object.keys($47602b39438c5a8c$export$9a82c28ef488e918).join("|")}] or an array of colors, got "${palette}".`);
|
|
1478
|
-
if (typeof palette === "string") {
|
|
1479
|
-
this.palette = $47602b39438c5a8c$export$9a82c28ef488e918[palette];
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
|
-
this.palette = palette;
|
|
1483
|
-
}
|
|
1484
|
-
setLoggingPrefix(loggingPrefix) {
|
|
1485
|
-
if (!this.isValidLoggingPrefix(loggingPrefix)) throw new Error(`Invalid option: logging prefix, expected string, got "${loggingPrefix}".`);
|
|
1486
|
-
this.loggingPrefix = loggingPrefix;
|
|
1487
|
-
}
|
|
1488
|
-
isValidAssessmentMode(assessmentMode) {
|
|
1489
|
-
return Object.values($5daa40bf356478d7$export$c019608e5b5bb4cb.AssessmentMode).includes(assessmentMode);
|
|
1490
|
-
}
|
|
1491
|
-
isValidValidation(validation) {
|
|
1492
|
-
return typeof validation === "boolean";
|
|
1493
|
-
}
|
|
1494
|
-
isValidPalette(palette) {
|
|
1495
|
-
if (typeof palette === "string") return Object.keys($47602b39438c5a8c$export$9a82c28ef488e918).includes(palette);
|
|
1496
|
-
if (!Array.isArray(palette)) return false;
|
|
1497
|
-
return palette.length === 11 && palette.every((color)=>typeof color === "string");
|
|
1498
|
-
}
|
|
1499
|
-
isValidLoggingPrefix(loggingPrefix) {
|
|
1500
|
-
return typeof loggingPrefix === "string";
|
|
1501
|
-
}
|
|
1502
|
-
isPreferredPalette(palette) {
|
|
1503
|
-
return JSON.stringify(this.palette) == JSON.stringify(palette);
|
|
1504
|
-
}
|
|
1505
|
-
valueOf() {
|
|
1506
|
-
return {
|
|
1507
|
-
preferredAssessmentMode: this.preferredAssessmentMode,
|
|
1508
|
-
validation: this.validation,
|
|
1509
|
-
palette: this.palette,
|
|
1510
|
-
loggingPrefix: this.loggingPrefix
|
|
1511
|
-
};
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
const $3536df9ffc9a62b8$var$FORCED_OPTIONS = {
|
|
1517
|
-
preferredAssessmentMode: (0, $5daa40bf356478d7$export$c019608e5b5bb4cb).AssessmentMode.DYNAMIC
|
|
1518
|
-
};
|
|
1519
|
-
function $3536df9ffc9a62b8$export$889ea624f2cb2c57(input, output, userOptions = {}) {
|
|
1520
|
-
userOptions = Object.assign(userOptions, $3536df9ffc9a62b8$var$FORCED_OPTIONS);
|
|
1521
|
-
const staticDoc = document.implementation.createHTMLDocument("New Document");
|
|
1522
|
-
staticDoc.documentElement.innerHTML = input;
|
|
1523
|
-
const options = new (0, $5daa40bf356478d7$export$c019608e5b5bb4cb)(userOptions);
|
|
1524
|
-
const io = new (0, $33f7359dc421be0c$export$8f8422ac5947a789)(staticDoc.documentElement, options, output);
|
|
1525
|
-
io.init();
|
|
1526
|
-
const headElement = io.getHead();
|
|
1527
|
-
const adapter = new (0, $6e48536853157d9f$export$e467cc3399500025)();
|
|
1528
|
-
const result = (0, $4638c35e8aec1c56$export$66aa292af6e88fd9)(headElement, adapter);
|
|
1529
|
-
io.logAnalysis(result);
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
export {$3536df9ffc9a62b8$export$889ea624f2cb2c57 as run};
|