@alexlit/lint-kit 183.4.0 → 183.6.0
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/package.json +1 -1
- package/packages/config-eslint/package.json +4 -4
- package/packages/config-stylelint/node_modules/ansi-regex/index.d.ts +33 -0
- package/packages/config-stylelint/node_modules/ansi-regex/index.js +14 -0
- package/packages/config-stylelint/node_modules/ansi-regex/license +9 -0
- package/packages/config-stylelint/node_modules/ansi-regex/package.json +61 -0
- package/packages/config-stylelint/node_modules/ansi-regex/readme.md +66 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/LICENSE +19 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/README.md +630 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.cjs +559 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.d.cts +304 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.d.ts +304 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/dist/index.js +525 -0
- package/packages/config-stylelint/node_modules/file-entry-cache/package.json +62 -0
- package/packages/config-stylelint/node_modules/flat-cache/LICENSE +19 -0
- package/packages/config-stylelint/node_modules/flat-cache/README.md +235 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.cjs +495 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.d.cts +255 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.d.ts +255 -0
- package/packages/config-stylelint/node_modules/flat-cache/dist/index.js +455 -0
- package/packages/config-stylelint/node_modules/flat-cache/package.json +81 -0
- package/packages/config-stylelint/node_modules/globby/ignore.js +337 -0
- package/packages/config-stylelint/node_modules/globby/index.d.ts +394 -0
- package/packages/config-stylelint/node_modules/globby/index.js +488 -0
- package/packages/config-stylelint/node_modules/globby/license +9 -0
- package/packages/config-stylelint/node_modules/globby/package.json +94 -0
- package/packages/config-stylelint/node_modules/globby/readme.md +388 -0
- package/packages/config-stylelint/node_modules/globby/utilities.js +382 -0
- package/packages/config-stylelint/node_modules/meow/build/dependencies.js +7347 -0
- package/packages/config-stylelint/node_modules/meow/build/index.d.ts +2684 -0
- package/packages/config-stylelint/node_modules/meow/build/index.js +185 -0
- package/packages/config-stylelint/node_modules/meow/build/licenses.md +1254 -0
- package/packages/config-stylelint/node_modules/meow/build/options.js +147 -0
- package/packages/config-stylelint/node_modules/meow/build/parser.js +113 -0
- package/packages/config-stylelint/node_modules/meow/build/utils.js +7 -0
- package/packages/config-stylelint/node_modules/meow/build/validate.js +145 -0
- package/packages/config-stylelint/node_modules/meow/license +9 -0
- package/packages/config-stylelint/node_modules/meow/package.json +103 -0
- package/packages/config-stylelint/node_modules/meow/readme.md +387 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/LICENSE +20 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/README.md +25 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/lib/safe-parse.js +12 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/lib/safe-parser.js +100 -0
- package/packages/config-stylelint/node_modules/postcss-safe-parser/package.json +36 -0
- package/packages/config-stylelint/node_modules/slash/index.d.ts +23 -0
- package/packages/config-stylelint/node_modules/slash/index.js +9 -0
- package/packages/config-stylelint/node_modules/slash/license +9 -0
- package/packages/config-stylelint/node_modules/slash/package.json +39 -0
- package/packages/config-stylelint/node_modules/slash/readme.md +36 -0
- package/packages/config-stylelint/node_modules/string-width/index.d.ts +39 -0
- package/packages/config-stylelint/node_modules/string-width/index.js +119 -0
- package/packages/config-stylelint/node_modules/string-width/license +9 -0
- package/packages/config-stylelint/node_modules/string-width/package.json +65 -0
- package/packages/config-stylelint/node_modules/string-width/readme.md +66 -0
- package/packages/config-stylelint/node_modules/strip-ansi/index.d.ts +15 -0
- package/packages/config-stylelint/node_modules/strip-ansi/index.js +19 -0
- package/packages/config-stylelint/node_modules/strip-ansi/license +9 -0
- package/packages/config-stylelint/node_modules/strip-ansi/package.json +59 -0
- package/packages/config-stylelint/node_modules/strip-ansi/readme.md +37 -0
- package/packages/config-stylelint/node_modules/stylelint/LICENSE +20 -0
- package/packages/config-stylelint/node_modules/stylelint/README.md +113 -0
- package/packages/config-stylelint/node_modules/stylelint/bin/stylelint.mjs +7 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/assignDisabledRanges.mjs +483 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/augmentConfig.mjs +586 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/cli.mjs +746 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/constants.mjs +25 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createPartialStylelintResult.mjs +114 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createPlugin.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/createStylelint.mjs +37 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/descriptionlessDisables.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/calcSeverityCounts.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/compactFormatter.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/index.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/jsonFormatter.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/preprocessWarnings.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/stringFormatter.mjs +308 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/tapFormatter.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/terminalLink.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/unixFormatter.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/formatters/verboseFormatter.mjs +175 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/getConfigForFile.mjs +110 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/getPostcssResult.mjs +131 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/index.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/invalidScopeDisables.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/isPathIgnored.mjs +48 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/lintPostcssResult.mjs +172 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/lintSource.mjs +135 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/needlessDisables.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/normalizeAllRuleSettings.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/normalizeRuleSettings.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/postcssPlugin.mjs +50 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/prepareReturnValue.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/printConfig.mjs +44 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/atKeywords.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/functions.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/keywords.mjs +663 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/mediaFeatures.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/mediaTypes.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/prefixes.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/properties.mjs +1111 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/selectors.mjs +472 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reference/units.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reportDisables.mjs +48 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/reportUnknownRuleNames.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/resolveConfig.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/alpha-value-notation/index.mjs +207 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/annotation-no-unknown/index.mjs +88 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-allowed-list/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-descriptor-no-unknown/index.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-descriptor-value-no-unknown/index.mjs +64 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-disallowed-list/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-empty-line-before/index.mjs +178 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-deprecated/index.mjs +86 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-unknown/index.mjs +80 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-no-vendor-prefix/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-prelude-no-invalid/index.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/block-no-empty/index.mjs +116 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/block-no-redundant-nested-style-rules/index.mjs +52 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-function-alias-notation/index.mjs +87 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-function-notation/index.mjs +168 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-hex-alpha/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-hex-length/index.mjs +128 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-named/colordUtils.mjs +109 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-named/index.mjs +183 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-no-hex/index.mjs +69 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-empty-line-before/index.mjs +131 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-no-empty/index.mjs +50 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-pattern/index.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-whitespace-inside/index.mjs +149 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/comment-word-disallowed-list/index.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/container-name-pattern/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-media-pattern/index.mjs +61 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-empty-line-before/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-no-missing-var-function/index.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/custom-property-pattern/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-custom-properties/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.mjs +301 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.mjs +411 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-block-single-line-max-declarations/index.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.mjs +160 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-no-important/index.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-max-values/index.mjs +79 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-unit-allowed-list/index.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-unit-disallowed-list/index.mjs +94 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-allowed-list/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-disallowed-list/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-keyword-no-deprecated/index.mjs +207 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/declaration-property-value-no-unknown/index.mjs +466 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/display-notation/index.mjs +225 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-name-quotes/index.mjs +243 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.mjs +122 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.mjs +122 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/font-weight-notation/index.mjs +221 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-allowed-list/index.mjs +114 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.mjs +589 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-disallowed-list/index.mjs +73 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-linear-gradient-no-nonstandard-direction/index.mjs +145 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-name-case/index.mjs +120 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-no-unknown/index.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-no-scheme-relative/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-quotes/index.mjs +230 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-scheme-allowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/function-url-scheme-disallowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/hue-degree-notation/index.mjs +123 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/import-notation/index.mjs +104 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/index.mjs +180 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-block-no-duplicate-selectors/index.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-declaration-no-important/index.mjs +54 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframe-selector-notation/index.mjs +202 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/keyframes-name-pattern/index.mjs +63 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/layer-name-pattern/index.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/length-zero-no-unit/index.mjs +221 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/lightness-notation/index.mjs +165 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/max-nesting-depth/index.mjs +195 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-allowed-list/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-disallowed-list/index.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-no-unknown/index.mjs +79 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.mjs +94 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-unit-allowed-list/index.mjs +110 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-value-allowed-list/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-name-value-no-unknown/index.mjs +296 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-feature-range-notation/index.mjs +187 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-query-no-invalid/index.mjs +193 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/media-type-no-deprecated/index.mjs +82 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.mjs +117 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/utils/findNotContiguousOrRectangular.mjs +57 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/nesting-selector-no-missing-scoping-root/index.mjs +165 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-descending-specificity/index.mjs +200 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-duplicate-at-import-rules/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.mjs +218 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-empty-source/index.mjs +61 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-position-at-import-rule/index.mjs +76 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-invalid-position-declaration/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.mjs +236 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-animations/index.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-custom-media/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/no-unknown-custom-properties/index.mjs +72 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/number-max-precision/index.mjs +209 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-allowed-list/index.mjs +58 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-disallowed-list/index.mjs +58 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-deprecated/index.mjs +143 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-unknown/index.mjs +126 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/property-no-vendor-prefix/index.mjs +100 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-empty-line-before/index.mjs +156 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-nesting-at-rule-required-list/index.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/rule-selector-property-disallowed-list/index.mjs +119 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-anb-no-unmatchable/index.mjs +121 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-name-disallowed-list/index.mjs +69 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-operator-allowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-operator-disallowed-list/index.mjs +70 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-attribute-quotes/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-class-pattern/index.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-combinator-allowed-list/index.mjs +81 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-combinator-disallowed-list/index.mjs +81 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-disallowed-list/index.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-id-pattern/index.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-attribute/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-class/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-combinators/index.mjs +77 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.mjs +123 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-id/index.mjs +107 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.mjs +85 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-specificity/index.mjs +146 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-type/index.mjs +219 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-max-universal/index.mjs +95 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-nested-pattern/index.mjs +95 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.mjs +323 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-no-vendor-prefix/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-not-notation/index.mjs +217 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-allowed-list/index.mjs +84 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-disallowed-list/index.mjs +84 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-class-no-unknown/index.mjs +179 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-allowed-list/index.mjs +75 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.mjs +93 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-disallowed-list/index.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-pseudo-element-no-unknown/index.mjs +91 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-type-case/index.mjs +118 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/selector-type-no-unknown/index.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/shorthand-property-no-redundant-values/index.mjs +359 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/string-no-newline/index.mjs +120 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/syntax-string-no-invalid/index.mjs +80 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/time-min-milliseconds/index.mjs +167 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-allowed-list/index.mjs +116 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-disallowed-list/index.mjs +211 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/unit-no-unknown/index.mjs +207 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/value-keyword-case/index.mjs +253 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/rules/value-no-vendor-prefix/index.mjs +92 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/standalone.mjs +383 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/timing.mjs +134 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/unscopedDisables.mjs +66 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/FileCache.mjs +115 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/addEmptyLineBefore.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/addSemicolonForEditInfo.mjs +35 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/appendRuleName.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/arrayEqual.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/beforeBlockString.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/blockString.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/blurInterpolation.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/cachedImport.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/checkAgainstRule.mjs +71 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.mjs +105 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/configurationComment.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/containsString.mjs +52 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/createMapWithSet.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/dynamicImport.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/eachDeclarationBlock.mjs +59 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/eachNodeUpToRoot.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/emitWarning.mjs +84 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/errors.mjs +55 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/filterFilePaths.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findAnimationName.mjs +74 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findAtRuleContext.mjs +27 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findFontFamily.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findMediaFeatureNames.mjs +151 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/findNodeUpToRoot.mjs +25 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/fixEmptyLinesBefore.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/functionArgumentsSearch.mjs +65 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getAtRuleParams.mjs +7 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getDeclarationValue.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getDimension.mjs +62 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFileIgnorer.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFormatter.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getFormatterOptionsText.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getImportantPosition.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getLexer.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getModulePath.mjs +35 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getNextNonSharedLineCommentNode.mjs +34 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getPreviousNonSharedLineCommentNode.mjs +36 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getRelativePath.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getRuleSelector.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getSchemeFromUrl.mjs +36 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getSelectorSourceIndex.mjs +12 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getStrippedSelectorSource.mjs +47 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/getStylelintRule.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasBlock.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasEmptyLine.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasInterpolation.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasLessInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasPsvInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasScssInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hasTplInterpolation.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/hash.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterBlock.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterComment.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterSingleLineComment.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAfterStandardPropertyDeclaration.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isAutoprefixable.mjs +364 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterBlocklessAtRule.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isBlocklessAtRuleAfterSameNameBlocklessAtRule.mjs +21 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isContextFunctionalPseudoClass.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCounterIncrementCustomIdentValue.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCounterResetCustomIdentValue.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomElement.mjs +34 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomMediaQuery.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomProperty.mjs +8 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isCustomSelector.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isDescriptorDeclaration.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isFirstNested.mjs +83 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isFirstNodeOfRoot.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isHexColor.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isInDocument.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isKeyframeRule.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isKeyframeSelector.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isMathFunction.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isNonNegativeInteger.mjs +6 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isNumbery.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isOnlyWhitespace.mjs +17 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isPathNotFoundError.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isScssVariable.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isSharedLineComment.mjs +53 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isSingleLineString.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxAtRule.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxColorFunction.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxCombinator.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxComment.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.mjs +57 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxFunction.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxHexColor.mjs +14 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxKeyframesName.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxProperty.mjs +32 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxRule.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxSelector.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxTypeSelector.mjs +56 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxUrl.mjs +49 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isStandardSyntaxValue.mjs +51 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUnicodeRangeDescriptor.mjs +24 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUnicodeSupported.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUrlFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidFontSize.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidHex.mjs +11 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isValidIdentifier.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isVarFunction.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isVariable.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/isWhitespace.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/matchesStringOrRegExp.mjs +97 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/mergeSyntaxDefinitions.mjs +137 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/narrowFixRange.mjs +68 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/nodeContextLookup.mjs +41 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/nodeFieldIndices.mjs +119 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeFilePath.mjs +26 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeFixMode.mjs +22 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/normalizeSelector.mjs +231 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/optionsMatches.mjs +20 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/optionsMatchesEntry.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseCustomMediaQuery.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseMediaQuery.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/parseSelector.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/pathExists.mjs +16 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/pluralize.mjs +10 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/putIfAbsent.mjs +20 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/rangesOverlap.mjs +19 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/rawNodeString.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/regexes.mjs +135 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/removeEmptyLinesBefore.mjs +13 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/report.mjs +321 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/reportCommentProblem.mjs +39 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveFilePath.mjs +38 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveNestedSelectorsForRule.mjs +108 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveOptionValue.mjs +30 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/resolveSilent.mjs +144 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/ruleMessages.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/setAtRuleParams.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/setDeclarationValue.mjs +18 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/suppressionsService.mjs +317 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/toPath.mjs +23 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/typeGuards.mjs +90 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/uniteSets.mjs +9 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateObjectWithArrayProps.mjs +29 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateObjectWithProps.mjs +28 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateOptions.mjs +176 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/validateTypes.mjs +148 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/utils/vendor.mjs +43 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/validateDisableSettings.mjs +67 -0
- package/packages/config-stylelint/node_modules/stylelint/lib/writeOutputFile.mjs +15 -0
- package/packages/config-stylelint/node_modules/stylelint/package.json +211 -0
- package/packages/config-stylelint/node_modules/stylelint/types/stylelint/index.d.ts +1594 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/default.d.ts +13 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/default.js +14 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/license +9 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/node.d.ts +125 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/node.js +49 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/package.json +68 -0
- package/packages/config-stylelint/node_modules/unicorn-magic/readme.md +31 -0
- package/packages/config-stylelint/package.json +3 -3
- package/packages/config-stylelint/plugins/color-format.js +2 -2
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import hasInterpolation from './hasInterpolation.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check whether a value is standard
|
|
5
|
+
*
|
|
6
|
+
* @param {string} value
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export default function isStandardSyntaxValue(value) {
|
|
10
|
+
let normalizedValue = value;
|
|
11
|
+
|
|
12
|
+
// Ignore operators before variables (example -$variable)
|
|
13
|
+
if (/^[-+*/]/.test(value.charAt(0))) {
|
|
14
|
+
normalizedValue = normalizedValue.slice(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// SCSS variable (example $variable)
|
|
18
|
+
// styled component interpolation (example ${foo => foo.bar})
|
|
19
|
+
if (normalizedValue.startsWith('$')) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// SCSS namespace (example namespace.$variable)
|
|
24
|
+
if (/^.+\.\$/.test(value)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// SCSS namespace (example namespace.function-name())
|
|
29
|
+
if (/^.+\.[-\w]+\(/.test(value)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Less variable
|
|
34
|
+
if (normalizedValue.startsWith('@')) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// SCSS or Less interpolation
|
|
39
|
+
if (hasInterpolation(normalizedValue)) {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// WebExtension replacement keyword used by Chrome/Firefox
|
|
44
|
+
// more information: https://developer.chrome.com/extensions/i18n
|
|
45
|
+
// and https://github.com/stylelint/stylelint/issues/4707
|
|
46
|
+
if (/__MSG_\S+__/.test(value)) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return true;
|
|
51
|
+
}
|
package/packages/config-stylelint/node_modules/stylelint/lib/utils/isUnicodeRangeDescriptor.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isAtRule } from './typeGuards.mjs';
|
|
2
|
+
|
|
3
|
+
const IS_UNICODE_RANGE = /^unicode-range$/i;
|
|
4
|
+
const IS_AT_FONT_FACE = /^font-face$/i;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check whether a declaration is the `unicode-range` descriptor of an `@font-face` rule.
|
|
8
|
+
*
|
|
9
|
+
* @param {import('postcss').Declaration} decl
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export default function isUnicodeRangeDescriptor(decl) {
|
|
13
|
+
if (!IS_UNICODE_RANGE.test(decl.prop)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const parent = decl.parent;
|
|
18
|
+
|
|
19
|
+
if (!parent || !isAtRule(parent)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return IS_AT_FONT_FACE.test(parent.name);
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Originally copied from https://github.com/sindresorhus/is-unicode-supported/blob/506f27260df3636555714bf10ed40ab9e6a6c96e/index.js
|
|
5
|
+
* @version 2.0.0
|
|
6
|
+
* @summary Detect whether the terminal supports Unicode
|
|
7
|
+
* @see https://github.com/sindresorhus/is-unicode-supported/pull/1#issuecomment-827321546
|
|
8
|
+
* @see microsoft/terminal#13680
|
|
9
|
+
*/
|
|
10
|
+
export default function isUnicodeSupported() {
|
|
11
|
+
if (process.platform !== 'win32') {
|
|
12
|
+
return process.env.TERM !== 'linux'; // Linux console (kernel)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
Boolean(process.env.WT_SESSION) || // Windows Terminal
|
|
17
|
+
Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
18
|
+
process.env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder
|
|
19
|
+
process.env.TERM_PROGRAM === 'Terminus-Sublime' ||
|
|
20
|
+
process.env.TERM_PROGRAM === 'vscode' ||
|
|
21
|
+
process.env.TERM === 'xterm-256color' ||
|
|
22
|
+
process.env.TERM === 'alacritty' ||
|
|
23
|
+
process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm' ||
|
|
24
|
+
process.env.TERM?.startsWith('rxvt-unicode') // fork of rxvt
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isValueFunction } from './typeGuards.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('postcss-value-parser').Node} node
|
|
5
|
+
* @returns {node is import('postcss-value-parser').FunctionNode}
|
|
6
|
+
*/
|
|
7
|
+
export default function isUrlFunction(node) {
|
|
8
|
+
return isValueFunction(node) && node.value.toLowerCase() === 'url';
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import valueParser from 'postcss-value-parser';
|
|
2
|
+
|
|
3
|
+
import { fontSizeKeywords } from '../reference/keywords.mjs';
|
|
4
|
+
import { lengthUnits } from '../reference/units.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Check if a word is a font-size value.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} word
|
|
10
|
+
* @returns {boolean}
|
|
11
|
+
*/
|
|
12
|
+
export default function isValidFontSize(word) {
|
|
13
|
+
if (!word) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (fontSizeKeywords.has(word)) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const numberUnit = valueParser.unit(word);
|
|
22
|
+
|
|
23
|
+
if (!numberUnit) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const unit = numberUnit.unit;
|
|
28
|
+
|
|
29
|
+
if (unit === '%') {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (lengthUnits.has(unit.toLowerCase())) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const IS_VALID_HEX = /^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check if a value is a valid 3, 4, 6 or 8 digit hex
|
|
5
|
+
*
|
|
6
|
+
* @param {string} value
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
export default function isValidHex(value) {
|
|
10
|
+
return IS_VALID_HEX.test(value);
|
|
11
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const ISO_10646_CHARACTERS = /\\[0-9a-f]{1,6}(\\r\\n|[ \t\r\n\f])?/gi;
|
|
2
|
+
const SINGLE_ESCAPED_CHARACTERS = /\\./g;
|
|
3
|
+
const NON_WORD_OR_DASH = /[^\w-]/;
|
|
4
|
+
const DIGIT = /\d/;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns whether a string is a valid CSS identifier
|
|
8
|
+
* (i.e. only alphanumeric characters, `-`, and `_`;
|
|
9
|
+
* does not have a leading digit, leading dash followed by digit, or two leading dashes)
|
|
10
|
+
* furthermore, any escaped or ISO 10646 characters are allowed.
|
|
11
|
+
* @see https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier
|
|
12
|
+
* @param {string} ident
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
export default function isValidIdentifier(ident) {
|
|
16
|
+
if (!ident || ident.trim() === '') {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// trims, removes ISO 10646 characters, and singly-escaped characters
|
|
21
|
+
const trimmedIdent = ident
|
|
22
|
+
.trim()
|
|
23
|
+
.replace(ISO_10646_CHARACTERS, '')
|
|
24
|
+
.replace(SINGLE_ESCAPED_CHARACTERS, '');
|
|
25
|
+
|
|
26
|
+
if (NON_WORD_OR_DASH.test(trimmedIdent)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (DIGIT.test(trimmedIdent.charAt(0))) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (trimmedIdent.charAt(0) === '-' && DIGIT.test(trimmedIdent.charAt(1))) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isValueFunction } from './typeGuards.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {import('postcss-value-parser').Node} node
|
|
5
|
+
* @returns {node is import('postcss-value-parser').FunctionNode}
|
|
6
|
+
*/
|
|
7
|
+
export default function isVarFunction(node) {
|
|
8
|
+
return isValueFunction(node) && node.value.toLowerCase() === 'var';
|
|
9
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compares a string to a second value that, if it fits a certain convention,
|
|
3
|
+
* is converted to a regular expression before the comparison.
|
|
4
|
+
* If it doesn't fit the convention, then two strings are compared.
|
|
5
|
+
*
|
|
6
|
+
* Any strings starting and ending with `/` are interpreted
|
|
7
|
+
* as regular expressions.
|
|
8
|
+
*
|
|
9
|
+
* @typedef {{match: string, pattern: (string | RegExp), substring: string} | false} MatchResult
|
|
10
|
+
*
|
|
11
|
+
* @param {string | Array<string>} input
|
|
12
|
+
* @param {string | RegExp | Array<string | RegExp>} comparison
|
|
13
|
+
* @returns {MatchResult}
|
|
14
|
+
*/
|
|
15
|
+
export default function matchesStringOrRegExp(input, comparison) {
|
|
16
|
+
if (!Array.isArray(input)) {
|
|
17
|
+
return testAgainstStringOrRegExpOrArray(input, comparison);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
for (const inputItem of input) {
|
|
21
|
+
const testResult = testAgainstStringOrRegExpOrArray(inputItem, comparison);
|
|
22
|
+
|
|
23
|
+
if (testResult) {
|
|
24
|
+
return testResult;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} value
|
|
33
|
+
* @param {string | RegExp | Array<string | RegExp>} comparison
|
|
34
|
+
* @returns {MatchResult}
|
|
35
|
+
*/
|
|
36
|
+
function testAgainstStringOrRegExpOrArray(value, comparison) {
|
|
37
|
+
if (!Array.isArray(comparison)) {
|
|
38
|
+
return testAgainstStringOrRegExp(value, comparison);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const comparisonItem of comparison) {
|
|
42
|
+
const testResult = testAgainstStringOrRegExp(value, comparisonItem);
|
|
43
|
+
|
|
44
|
+
if (testResult) {
|
|
45
|
+
return testResult;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @param {string} value
|
|
54
|
+
* @param {RegExp} pattern
|
|
55
|
+
* @returns {MatchResult}
|
|
56
|
+
*/
|
|
57
|
+
function matchValue(value, pattern) {
|
|
58
|
+
const match = value.match(pattern);
|
|
59
|
+
|
|
60
|
+
return match ? { match: value, pattern, substring: match[0] ?? '' } : false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @param {string} value
|
|
65
|
+
* @param {string | RegExp} comparison
|
|
66
|
+
* @returns {MatchResult}
|
|
67
|
+
*/
|
|
68
|
+
function testAgainstStringOrRegExp(value, comparison) {
|
|
69
|
+
// If it's a RegExp, test directly
|
|
70
|
+
if (comparison instanceof RegExp) {
|
|
71
|
+
return matchValue(value, comparison);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Check if it's RegExp in a string
|
|
75
|
+
const regexFlag = 'i';
|
|
76
|
+
const comparisonIsRegex =
|
|
77
|
+
comparison.startsWith('/') &&
|
|
78
|
+
(comparison.endsWith('/') || comparison.endsWith(`/${regexFlag}`));
|
|
79
|
+
|
|
80
|
+
// If so, create a new RegExp from it
|
|
81
|
+
if (comparisonIsRegex) {
|
|
82
|
+
const pattern = comparison.endsWith(regexFlag)
|
|
83
|
+
? new RegExp(comparison.slice(1, -2), regexFlag)
|
|
84
|
+
: new RegExp(comparison.slice(1, -1));
|
|
85
|
+
|
|
86
|
+
const result = matchValue(value, pattern);
|
|
87
|
+
|
|
88
|
+
if (result) {
|
|
89
|
+
result.pattern = comparison;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Otherwise, it's a string. Do a strict comparison
|
|
96
|
+
return value === comparison ? { match: value, pattern: comparison, substring: value } : false;
|
|
97
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/** @typedef {Record<string, {prelude?: string | undefined, descriptors?: Record<string, string> | undefined}>} AtRuleDefinitions */
|
|
2
|
+
/** @typedef {Record<string, string>} PropertyDefinitions */
|
|
3
|
+
/** @typedef {Record<string, string>} TypeDefinitions */
|
|
4
|
+
/** @typedef {Array<string>} CSSWideKeywords */
|
|
5
|
+
/** @typedef {{atrules?: AtRuleDefinitions | undefined, properties?: PropertyDefinitions | undefined, types?: TypeDefinitions | undefined, cssWideKeywords?: CSSWideKeywords | undefined}} SyntaxDefinition */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Merge multiple separate syntax definitions.
|
|
9
|
+
* Individual definitions will override each other unless the second definition starts with a pipe symbol `|`.
|
|
10
|
+
*
|
|
11
|
+
* @param {...(SyntaxDefinition|undefined)} sources
|
|
12
|
+
* @returns {SyntaxDefinition}
|
|
13
|
+
*/
|
|
14
|
+
export default function mergeSyntaxDefinitions(...sources) {
|
|
15
|
+
/** @type {SyntaxDefinition|undefined} */
|
|
16
|
+
let target = sources[0] ?? {};
|
|
17
|
+
|
|
18
|
+
for (let i = 1; i < sources.length; i++) {
|
|
19
|
+
const source = sources[i];
|
|
20
|
+
|
|
21
|
+
if (!source) continue;
|
|
22
|
+
|
|
23
|
+
target = mergeTwoSyntaxDefinitions(target, source);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return target;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Merge two separate syntax definitions.
|
|
31
|
+
* Individual definitions will override each other unless the second definition starts with a pipe symbol `|`.
|
|
32
|
+
*
|
|
33
|
+
* @param {SyntaxDefinition} source1
|
|
34
|
+
* @param {SyntaxDefinition} source2
|
|
35
|
+
* @returns {SyntaxDefinition}
|
|
36
|
+
*/
|
|
37
|
+
function mergeTwoSyntaxDefinitions(source1, source2) {
|
|
38
|
+
/** @type {SyntaxDefinition} */
|
|
39
|
+
const target = {};
|
|
40
|
+
|
|
41
|
+
target.atrules = mergeAtRuleDefinitions(source1.atrules, source2.atrules);
|
|
42
|
+
target.properties = mergePropertyOrTypeDefinitions(source1.properties, source2.properties);
|
|
43
|
+
target.types = mergePropertyOrTypeDefinitions(source1.types, source2.types);
|
|
44
|
+
target.cssWideKeywords = mergeKeywords(source1.cssWideKeywords, source2.cssWideKeywords);
|
|
45
|
+
|
|
46
|
+
return target;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @param {AtRuleDefinitions | undefined} source1
|
|
51
|
+
* @param {AtRuleDefinitions | undefined} source2
|
|
52
|
+
* @returns {AtRuleDefinitions | undefined}
|
|
53
|
+
*/
|
|
54
|
+
function mergeAtRuleDefinitions(source1, source2) {
|
|
55
|
+
if (typeof source1 === 'undefined' || typeof source2 === 'undefined')
|
|
56
|
+
return source1 ?? source2 ?? {};
|
|
57
|
+
|
|
58
|
+
/** @type {AtRuleDefinitions} */
|
|
59
|
+
const target = structuredClone(source1);
|
|
60
|
+
|
|
61
|
+
for (const [atRuleName, atRule] of Object.entries(source2)) {
|
|
62
|
+
const targetAtRule = target[atRuleName] ?? {};
|
|
63
|
+
|
|
64
|
+
targetAtRule.prelude = mergePrelude(targetAtRule.prelude, atRule.prelude);
|
|
65
|
+
targetAtRule.descriptors = mergePropertyOrTypeDefinitions(
|
|
66
|
+
targetAtRule.descriptors,
|
|
67
|
+
atRule.descriptors,
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
target[atRuleName] = targetAtRule;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @param {Record<string, string> | undefined} source1
|
|
78
|
+
* @param {Record<string, string> | undefined} source2
|
|
79
|
+
* @returns {Record<string, string> | undefined}
|
|
80
|
+
*/
|
|
81
|
+
function mergePropertyOrTypeDefinitions(source1, source2) {
|
|
82
|
+
if (typeof source1 === 'undefined' || typeof source2 === 'undefined')
|
|
83
|
+
return source1 ?? source2 ?? {};
|
|
84
|
+
|
|
85
|
+
/** @type {Record<string, string>} */
|
|
86
|
+
const target = {
|
|
87
|
+
...source1,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
for (const [name, syntax] of Object.entries(source2)) {
|
|
91
|
+
target[name] = mergeSyntax(target[name], syntax);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return target;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @param {Array<string> | undefined} source1
|
|
99
|
+
* @param {Array<string> | undefined} source2
|
|
100
|
+
* @returns {Array<string> | undefined}
|
|
101
|
+
*/
|
|
102
|
+
function mergeKeywords(source1, source2) {
|
|
103
|
+
if (typeof source1 === 'undefined' || typeof source2 === 'undefined')
|
|
104
|
+
return source1 ?? source2 ?? [];
|
|
105
|
+
|
|
106
|
+
return Array.from(new Set([...source1, ...source2]));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {string | undefined} source1
|
|
111
|
+
* @param {string} source2
|
|
112
|
+
* @returns {string}
|
|
113
|
+
*/
|
|
114
|
+
function mergeSyntax(source1, source2) {
|
|
115
|
+
if (typeof source1 === 'undefined') return source2;
|
|
116
|
+
|
|
117
|
+
const trimmedSource2 = source2.trimStart();
|
|
118
|
+
|
|
119
|
+
if (!trimmedSource2.startsWith('|')) return source2;
|
|
120
|
+
|
|
121
|
+
return `${source1} ${trimmedSource2}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @param {string | undefined} source1
|
|
126
|
+
* @param {string | undefined} source2
|
|
127
|
+
* @returns {string | undefined}
|
|
128
|
+
*/
|
|
129
|
+
function mergePrelude(source1, source2) {
|
|
130
|
+
if (typeof source1 === 'undefined' || typeof source2 === 'undefined') return source1 ?? source2;
|
|
131
|
+
|
|
132
|
+
const trimmedSource2 = source2.trimStart();
|
|
133
|
+
|
|
134
|
+
if (!trimmedSource2.startsWith('|')) return source2;
|
|
135
|
+
|
|
136
|
+
return `${source1} ${trimmedSource2}`;
|
|
137
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/** @import { Node as PostcssNode } from 'postcss' */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Make a fix range as narrow as possible by trimming common prefixes and suffixes
|
|
5
|
+
*
|
|
6
|
+
* @param {PostcssNode} node
|
|
7
|
+
* @param {{range: [number, number], text: string}} fixData
|
|
8
|
+
* @returns {{range: [number, number], text: string}}
|
|
9
|
+
*/
|
|
10
|
+
export default function narrowFixRange(node, fixData) {
|
|
11
|
+
if (!node.source) {
|
|
12
|
+
return fixData;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let startOffset = fixData.range[0];
|
|
16
|
+
let endOffset = fixData.range[1];
|
|
17
|
+
|
|
18
|
+
const stringRepresentation = node.source.input.css.slice(startOffset, endOffset);
|
|
19
|
+
|
|
20
|
+
let replacementStartOffset = 0;
|
|
21
|
+
|
|
22
|
+
for (let i = 0; i < stringRepresentation.length; i++) {
|
|
23
|
+
const a = stringRepresentation[i];
|
|
24
|
+
const b = fixData.text[i];
|
|
25
|
+
|
|
26
|
+
if (a !== b) break;
|
|
27
|
+
|
|
28
|
+
startOffset++;
|
|
29
|
+
replacementStartOffset++;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let replacementEndOffset = fixData.text.length;
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < stringRepresentation.length; i++) {
|
|
35
|
+
const ia = stringRepresentation.length - 1 - i;
|
|
36
|
+
|
|
37
|
+
if (ia < replacementStartOffset) break;
|
|
38
|
+
|
|
39
|
+
const a = stringRepresentation[ia];
|
|
40
|
+
|
|
41
|
+
const ib = fixData.text.length - 1 - i;
|
|
42
|
+
|
|
43
|
+
if (ib < replacementStartOffset) break;
|
|
44
|
+
|
|
45
|
+
const b = fixData.text[ib];
|
|
46
|
+
|
|
47
|
+
if (a !== b) break;
|
|
48
|
+
|
|
49
|
+
endOffset--;
|
|
50
|
+
replacementEndOffset--;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Try to have a context size of at least 1
|
|
54
|
+
if (startOffset === endOffset) {
|
|
55
|
+
if (startOffset > fixData.range[0]) {
|
|
56
|
+
startOffset--;
|
|
57
|
+
replacementStartOffset--;
|
|
58
|
+
} else if (endOffset < fixData.range[1]) {
|
|
59
|
+
endOffset++;
|
|
60
|
+
replacementEndOffset++;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
text: fixData.text.slice(replacementStartOffset, replacementEndOffset),
|
|
66
|
+
range: [startOffset, endOffset],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a collection of Maps that serve to contextualize a given node.
|
|
3
|
+
* This is useful to ensure that you only compare nodes that share a certain
|
|
4
|
+
* context.
|
|
5
|
+
*
|
|
6
|
+
* All nodes are initially contextualized by their input source.
|
|
7
|
+
* From there, you can contextualize them however you want.
|
|
8
|
+
*
|
|
9
|
+
* For a usage example, see `selector-no-descending-specificity`.
|
|
10
|
+
*/
|
|
11
|
+
export default function nodeContextLookup() {
|
|
12
|
+
const contextMap = new Map();
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
/**
|
|
16
|
+
* @param {import('postcss').Node} node
|
|
17
|
+
* @param {any[]} subContexts
|
|
18
|
+
* @returns {Map<any, any>}
|
|
19
|
+
*/
|
|
20
|
+
getContext(node, ...subContexts) {
|
|
21
|
+
if (!node.source) throw new Error('The node source must be present');
|
|
22
|
+
|
|
23
|
+
const nodeSource = node.source.input.from;
|
|
24
|
+
const baseContext = creativeGetMap(contextMap, nodeSource);
|
|
25
|
+
|
|
26
|
+
return subContexts.reduce((result, context) => creativeGetMap(result, context), baseContext);
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {Map<any, any>} someMap
|
|
33
|
+
* @param {any} someThing
|
|
34
|
+
*/
|
|
35
|
+
function creativeGetMap(someMap, someThing) {
|
|
36
|
+
if (!someMap.has(someThing)) {
|
|
37
|
+
someMap.set(someThing, new Map());
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return someMap.get(someThing);
|
|
41
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import getAtRuleParams from './getAtRuleParams.mjs';
|
|
2
|
+
import getRuleSelector from './getRuleSelector.mjs';
|
|
3
|
+
|
|
4
|
+
import { isObject, isString } from './validateTypes.mjs';
|
|
5
|
+
|
|
6
|
+
/** @import {AtRule, Declaration, Rule} from 'postcss' */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {AtRule} atRule
|
|
10
|
+
* @returns {number}
|
|
11
|
+
*/
|
|
12
|
+
export function atRuleParamIndex(atRule) {
|
|
13
|
+
const index = atRuleAfterNameIndex(atRule);
|
|
14
|
+
|
|
15
|
+
return index + (atRule.raws.afterName?.length ?? 0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {AtRule} atRule
|
|
20
|
+
* @returns {number}
|
|
21
|
+
*/
|
|
22
|
+
export function atRuleAfterIndex(atRule) {
|
|
23
|
+
// subtract 1 for `}`
|
|
24
|
+
|
|
25
|
+
const endOffset = atRule.source?.end?.offset;
|
|
26
|
+
|
|
27
|
+
if (!endOffset) return atRule.toString().length - 1;
|
|
28
|
+
|
|
29
|
+
const afterLength = atRule.raws?.after?.length;
|
|
30
|
+
|
|
31
|
+
if (!afterLength) return endOffset - 1;
|
|
32
|
+
|
|
33
|
+
return endOffset - (afterLength + 1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {AtRule} atRule
|
|
38
|
+
* @returns {number}
|
|
39
|
+
*/
|
|
40
|
+
export function atRuleAfterNameIndex(atRule) {
|
|
41
|
+
// Initial 1 is for the `@`
|
|
42
|
+
return 1 + atRule.name.length;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @param {AtRule} atRule
|
|
47
|
+
* @returns {number}
|
|
48
|
+
*/
|
|
49
|
+
export function atRuleBetweenIndex(atRule) {
|
|
50
|
+
return atRuleParamIndex(atRule) + getAtRuleParams(atRule).length;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {Declaration} decl
|
|
55
|
+
* @returns {number}
|
|
56
|
+
*/
|
|
57
|
+
export function declarationBetweenIndex(decl) {
|
|
58
|
+
const { prop } = decl.raws;
|
|
59
|
+
const propIsObject = isObject(prop);
|
|
60
|
+
|
|
61
|
+
return countChars([
|
|
62
|
+
propIsObject && 'prefix' in prop && prop.prefix,
|
|
63
|
+
(propIsObject && 'raw' in prop && prop.raw) || decl.prop,
|
|
64
|
+
propIsObject && 'suffix' in prop && prop.suffix,
|
|
65
|
+
]);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Get the index of a declaration's value
|
|
70
|
+
*
|
|
71
|
+
* @param {Declaration} decl
|
|
72
|
+
* @returns {number}
|
|
73
|
+
*/
|
|
74
|
+
export function declarationValueIndex(decl) {
|
|
75
|
+
const { between, value } = decl.raws;
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
declarationBetweenIndex(decl) +
|
|
79
|
+
countChars([between || ':', value && 'prefix' in value && value.prefix])
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {Rule} rule
|
|
85
|
+
* @returns {number}
|
|
86
|
+
*/
|
|
87
|
+
export function ruleBetweenIndex(rule) {
|
|
88
|
+
return getRuleSelector(rule).length;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {Rule} rule
|
|
93
|
+
* @returns {number}
|
|
94
|
+
*/
|
|
95
|
+
export function ruleAfterIndex(rule) {
|
|
96
|
+
// subtract 1 for `}`
|
|
97
|
+
|
|
98
|
+
const endOffset = rule.source?.end?.offset;
|
|
99
|
+
|
|
100
|
+
if (!endOffset) return rule.toString().length - 1;
|
|
101
|
+
|
|
102
|
+
const afterLength = rule.raws?.after?.length;
|
|
103
|
+
|
|
104
|
+
if (!afterLength) return endOffset - 1;
|
|
105
|
+
|
|
106
|
+
return endOffset - (afterLength + 1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @param {unknown[]} values
|
|
111
|
+
* @returns {number}
|
|
112
|
+
*/
|
|
113
|
+
function countChars(values) {
|
|
114
|
+
return values.reduce((/** @type {number} */ count, value) => {
|
|
115
|
+
if (isString(value)) return count + value.length;
|
|
116
|
+
|
|
117
|
+
return count;
|
|
118
|
+
}, 0);
|
|
119
|
+
}
|