@jesscss/core 2.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +9 -0
- package/lib/context.d.ts +352 -0
- package/lib/context.d.ts.map +1 -0
- package/lib/context.js +636 -0
- package/lib/context.js.map +1 -0
- package/lib/conversions.d.ts +73 -0
- package/lib/conversions.d.ts.map +1 -0
- package/lib/conversions.js +253 -0
- package/lib/conversions.js.map +1 -0
- package/lib/debug-log.d.ts +2 -0
- package/lib/debug-log.d.ts.map +1 -0
- package/lib/debug-log.js +27 -0
- package/lib/debug-log.js.map +1 -0
- package/lib/define-function.d.ts +587 -0
- package/lib/define-function.d.ts.map +1 -0
- package/lib/define-function.js +726 -0
- package/lib/define-function.js.map +1 -0
- package/lib/deprecation.d.ts +34 -0
- package/lib/deprecation.d.ts.map +1 -0
- package/lib/deprecation.js +57 -0
- package/lib/deprecation.js.map +1 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +23 -0
- package/lib/index.js.map +1 -0
- package/lib/jess-error.d.ts +343 -0
- package/lib/jess-error.d.ts.map +1 -0
- package/lib/jess-error.js +508 -0
- package/lib/jess-error.js.map +1 -0
- package/lib/logger/deprecation-processing.d.ts +41 -0
- package/lib/logger/deprecation-processing.d.ts.map +1 -0
- package/lib/logger/deprecation-processing.js +81 -0
- package/lib/logger/deprecation-processing.js.map +1 -0
- package/lib/logger.d.ts +10 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +20 -0
- package/lib/logger.js.map +1 -0
- package/lib/plugin.d.ts +94 -0
- package/lib/plugin.d.ts.map +1 -0
- package/lib/plugin.js +174 -0
- package/lib/plugin.js.map +1 -0
- package/lib/tree/ampersand.d.ts +94 -0
- package/lib/tree/ampersand.d.ts.map +1 -0
- package/lib/tree/ampersand.js +269 -0
- package/lib/tree/ampersand.js.map +1 -0
- package/lib/tree/any.d.ts +58 -0
- package/lib/tree/any.d.ts.map +1 -0
- package/lib/tree/any.js +101 -0
- package/lib/tree/any.js.map +1 -0
- package/lib/tree/at-rule.d.ts +53 -0
- package/lib/tree/at-rule.d.ts.map +1 -0
- package/lib/tree/at-rule.js +503 -0
- package/lib/tree/at-rule.js.map +1 -0
- package/lib/tree/block.d.ts +22 -0
- package/lib/tree/block.d.ts.map +1 -0
- package/lib/tree/block.js +24 -0
- package/lib/tree/block.js.map +1 -0
- package/lib/tree/bool.d.ts +17 -0
- package/lib/tree/bool.d.ts.map +1 -0
- package/lib/tree/bool.js +24 -0
- package/lib/tree/bool.js.map +1 -0
- package/lib/tree/call.d.ts +66 -0
- package/lib/tree/call.d.ts.map +1 -0
- package/lib/tree/call.js +306 -0
- package/lib/tree/call.js.map +1 -0
- package/lib/tree/collection.d.ts +30 -0
- package/lib/tree/collection.d.ts.map +1 -0
- package/lib/tree/collection.js +37 -0
- package/lib/tree/collection.js.map +1 -0
- package/lib/tree/color.d.ts +101 -0
- package/lib/tree/color.d.ts.map +1 -0
- package/lib/tree/color.js +513 -0
- package/lib/tree/color.js.map +1 -0
- package/lib/tree/combinator.d.ts +12 -0
- package/lib/tree/combinator.d.ts.map +1 -0
- package/lib/tree/combinator.js +8 -0
- package/lib/tree/combinator.js.map +1 -0
- package/lib/tree/comment.d.ts +20 -0
- package/lib/tree/comment.d.ts.map +1 -0
- package/lib/tree/comment.js +18 -0
- package/lib/tree/comment.js.map +1 -0
- package/lib/tree/condition.d.ts +31 -0
- package/lib/tree/condition.d.ts.map +1 -0
- package/lib/tree/condition.js +103 -0
- package/lib/tree/condition.js.map +1 -0
- package/lib/tree/control.d.ts +104 -0
- package/lib/tree/control.d.ts.map +1 -0
- package/lib/tree/control.js +430 -0
- package/lib/tree/control.js.map +1 -0
- package/lib/tree/declaration-custom.d.ts +18 -0
- package/lib/tree/declaration-custom.d.ts.map +1 -0
- package/lib/tree/declaration-custom.js +24 -0
- package/lib/tree/declaration-custom.js.map +1 -0
- package/lib/tree/declaration-var.d.ts +36 -0
- package/lib/tree/declaration-var.d.ts.map +1 -0
- package/lib/tree/declaration-var.js +63 -0
- package/lib/tree/declaration-var.js.map +1 -0
- package/lib/tree/declaration.d.ts +78 -0
- package/lib/tree/declaration.d.ts.map +1 -0
- package/lib/tree/declaration.js +289 -0
- package/lib/tree/declaration.js.map +1 -0
- package/lib/tree/default-guard.d.ts +15 -0
- package/lib/tree/default-guard.d.ts.map +1 -0
- package/lib/tree/default-guard.js +19 -0
- package/lib/tree/default-guard.js.map +1 -0
- package/lib/tree/dimension.d.ts +33 -0
- package/lib/tree/dimension.d.ts.map +1 -0
- package/lib/tree/dimension.js +291 -0
- package/lib/tree/dimension.js.map +1 -0
- package/lib/tree/expression.d.ts +24 -0
- package/lib/tree/expression.d.ts.map +1 -0
- package/lib/tree/expression.js +28 -0
- package/lib/tree/expression.js.map +1 -0
- package/lib/tree/extend-list.d.ts +23 -0
- package/lib/tree/extend-list.d.ts.map +1 -0
- package/lib/tree/extend-list.js +20 -0
- package/lib/tree/extend-list.js.map +1 -0
- package/lib/tree/extend.d.ts +47 -0
- package/lib/tree/extend.d.ts.map +1 -0
- package/lib/tree/extend.js +292 -0
- package/lib/tree/extend.js.map +1 -0
- package/lib/tree/function.d.ts +48 -0
- package/lib/tree/function.d.ts.map +1 -0
- package/lib/tree/function.js +74 -0
- package/lib/tree/function.js.map +1 -0
- package/lib/tree/import-js.d.ts +35 -0
- package/lib/tree/import-js.d.ts.map +1 -0
- package/lib/tree/import-js.js +45 -0
- package/lib/tree/import-js.js.map +1 -0
- package/lib/tree/import-style.d.ts +156 -0
- package/lib/tree/import-style.d.ts.map +1 -0
- package/lib/tree/import-style.js +556 -0
- package/lib/tree/import-style.js.map +1 -0
- package/lib/tree/index.d.ts +71 -0
- package/lib/tree/index.d.ts.map +1 -0
- package/lib/tree/index.js +95 -0
- package/lib/tree/index.js.map +1 -0
- package/lib/tree/interpolated-reference.d.ts +24 -0
- package/lib/tree/interpolated-reference.d.ts.map +1 -0
- package/lib/tree/interpolated-reference.js +37 -0
- package/lib/tree/interpolated-reference.js.map +1 -0
- package/lib/tree/interpolated.d.ts +62 -0
- package/lib/tree/interpolated.d.ts.map +1 -0
- package/lib/tree/interpolated.js +204 -0
- package/lib/tree/interpolated.js.map +1 -0
- package/lib/tree/js-array.d.ts +10 -0
- package/lib/tree/js-array.d.ts.map +1 -0
- package/lib/tree/js-array.js +10 -0
- package/lib/tree/js-array.js.map +1 -0
- package/lib/tree/js-expr.d.ts +23 -0
- package/lib/tree/js-expr.d.ts.map +1 -0
- package/lib/tree/js-expr.js +28 -0
- package/lib/tree/js-expr.js.map +1 -0
- package/lib/tree/js-function.d.ts +20 -0
- package/lib/tree/js-function.d.ts.map +1 -0
- package/lib/tree/js-function.js +16 -0
- package/lib/tree/js-function.js.map +1 -0
- package/lib/tree/js-object.d.ts +10 -0
- package/lib/tree/js-object.d.ts.map +1 -0
- package/lib/tree/js-object.js +10 -0
- package/lib/tree/js-object.js.map +1 -0
- package/lib/tree/list.d.ts +38 -0
- package/lib/tree/list.d.ts.map +1 -0
- package/lib/tree/list.js +83 -0
- package/lib/tree/list.js.map +1 -0
- package/lib/tree/log.d.ts +29 -0
- package/lib/tree/log.d.ts.map +1 -0
- package/lib/tree/log.js +56 -0
- package/lib/tree/log.js.map +1 -0
- package/lib/tree/mixin.d.ts +87 -0
- package/lib/tree/mixin.d.ts.map +1 -0
- package/lib/tree/mixin.js +112 -0
- package/lib/tree/mixin.js.map +1 -0
- package/lib/tree/negative.d.ts +17 -0
- package/lib/tree/negative.d.ts.map +1 -0
- package/lib/tree/negative.js +22 -0
- package/lib/tree/negative.js.map +1 -0
- package/lib/tree/nil.d.ts +31 -0
- package/lib/tree/nil.d.ts.map +1 -0
- package/lib/tree/nil.js +36 -0
- package/lib/tree/nil.js.map +1 -0
- package/lib/tree/node-base.d.ts +359 -0
- package/lib/tree/node-base.d.ts.map +1 -0
- package/lib/tree/node-base.js +884 -0
- package/lib/tree/node-base.js.map +1 -0
- package/lib/tree/node.d.ts +10 -0
- package/lib/tree/node.d.ts.map +1 -0
- package/lib/tree/node.js +45 -0
- package/lib/tree/node.js.map +1 -0
- package/lib/tree/number.d.ts +21 -0
- package/lib/tree/number.d.ts.map +1 -0
- package/lib/tree/number.js +27 -0
- package/lib/tree/number.js.map +1 -0
- package/lib/tree/operation.d.ts +26 -0
- package/lib/tree/operation.d.ts.map +1 -0
- package/lib/tree/operation.js +103 -0
- package/lib/tree/operation.js.map +1 -0
- package/lib/tree/paren.d.ts +18 -0
- package/lib/tree/paren.d.ts.map +1 -0
- package/lib/tree/paren.js +86 -0
- package/lib/tree/paren.js.map +1 -0
- package/lib/tree/query-condition.d.ts +17 -0
- package/lib/tree/query-condition.d.ts.map +1 -0
- package/lib/tree/query-condition.js +39 -0
- package/lib/tree/query-condition.js.map +1 -0
- package/lib/tree/quoted.d.ts +27 -0
- package/lib/tree/quoted.d.ts.map +1 -0
- package/lib/tree/quoted.js +66 -0
- package/lib/tree/quoted.js.map +1 -0
- package/lib/tree/range.d.ts +33 -0
- package/lib/tree/range.d.ts.map +1 -0
- package/lib/tree/range.js +47 -0
- package/lib/tree/range.js.map +1 -0
- package/lib/tree/reference.d.ts +76 -0
- package/lib/tree/reference.d.ts.map +1 -0
- package/lib/tree/reference.js +521 -0
- package/lib/tree/reference.js.map +1 -0
- package/lib/tree/rest.d.ts +15 -0
- package/lib/tree/rest.d.ts.map +1 -0
- package/lib/tree/rest.js +32 -0
- package/lib/tree/rest.js.map +1 -0
- package/lib/tree/rules-raw.d.ts +17 -0
- package/lib/tree/rules-raw.d.ts.map +1 -0
- package/lib/tree/rules-raw.js +37 -0
- package/lib/tree/rules-raw.js.map +1 -0
- package/lib/tree/rules.d.ts +255 -0
- package/lib/tree/rules.d.ts.map +1 -0
- package/lib/tree/rules.js +2293 -0
- package/lib/tree/rules.js.map +1 -0
- package/lib/tree/ruleset.d.ts +91 -0
- package/lib/tree/ruleset.d.ts.map +1 -0
- package/lib/tree/ruleset.js +506 -0
- package/lib/tree/ruleset.js.map +1 -0
- package/lib/tree/selector-attr.d.ts +31 -0
- package/lib/tree/selector-attr.d.ts.map +1 -0
- package/lib/tree/selector-attr.js +99 -0
- package/lib/tree/selector-attr.js.map +1 -0
- package/lib/tree/selector-basic.d.ts +23 -0
- package/lib/tree/selector-basic.d.ts.map +1 -0
- package/lib/tree/selector-basic.js +34 -0
- package/lib/tree/selector-basic.js.map +1 -0
- package/lib/tree/selector-capture.d.ts +23 -0
- package/lib/tree/selector-capture.d.ts.map +1 -0
- package/lib/tree/selector-capture.js +34 -0
- package/lib/tree/selector-capture.js.map +1 -0
- package/lib/tree/selector-complex.d.ts +40 -0
- package/lib/tree/selector-complex.d.ts.map +1 -0
- package/lib/tree/selector-complex.js +143 -0
- package/lib/tree/selector-complex.js.map +1 -0
- package/lib/tree/selector-compound.d.ts +16 -0
- package/lib/tree/selector-compound.d.ts.map +1 -0
- package/lib/tree/selector-compound.js +114 -0
- package/lib/tree/selector-compound.js.map +1 -0
- package/lib/tree/selector-interpolated.d.ts +23 -0
- package/lib/tree/selector-interpolated.d.ts.map +1 -0
- package/lib/tree/selector-interpolated.js +27 -0
- package/lib/tree/selector-interpolated.js.map +1 -0
- package/lib/tree/selector-list.d.ts +17 -0
- package/lib/tree/selector-list.d.ts.map +1 -0
- package/lib/tree/selector-list.js +184 -0
- package/lib/tree/selector-list.js.map +1 -0
- package/lib/tree/selector-pseudo.d.ts +42 -0
- package/lib/tree/selector-pseudo.d.ts.map +1 -0
- package/lib/tree/selector-pseudo.js +191 -0
- package/lib/tree/selector-pseudo.js.map +1 -0
- package/lib/tree/selector-simple.d.ts +5 -0
- package/lib/tree/selector-simple.d.ts.map +1 -0
- package/lib/tree/selector-simple.js +6 -0
- package/lib/tree/selector-simple.js.map +1 -0
- package/lib/tree/selector.d.ts +43 -0
- package/lib/tree/selector.d.ts.map +1 -0
- package/lib/tree/selector.js +56 -0
- package/lib/tree/selector.js.map +1 -0
- package/lib/tree/sequence.d.ts +43 -0
- package/lib/tree/sequence.d.ts.map +1 -0
- package/lib/tree/sequence.js +148 -0
- package/lib/tree/sequence.js.map +1 -0
- package/lib/tree/tree.d.ts +87 -0
- package/lib/tree/tree.d.ts.map +1 -0
- package/lib/tree/tree.js +2 -0
- package/lib/tree/tree.js.map +1 -0
- package/lib/tree/url.d.ts +18 -0
- package/lib/tree/url.d.ts.map +1 -0
- package/lib/tree/url.js +35 -0
- package/lib/tree/url.js.map +1 -0
- package/lib/tree/util/__tests__/debug-log.d.ts +1 -0
- package/lib/tree/util/__tests__/debug-log.d.ts.map +1 -0
- package/lib/tree/util/__tests__/debug-log.js +36 -0
- package/lib/tree/util/__tests__/debug-log.js.map +1 -0
- package/lib/tree/util/calculate.d.ts +3 -0
- package/lib/tree/util/calculate.d.ts.map +1 -0
- package/lib/tree/util/calculate.js +10 -0
- package/lib/tree/util/calculate.js.map +1 -0
- package/lib/tree/util/cast.d.ts +10 -0
- package/lib/tree/util/cast.d.ts.map +1 -0
- package/lib/tree/util/cast.js +87 -0
- package/lib/tree/util/cast.js.map +1 -0
- package/lib/tree/util/cloning.d.ts +4 -0
- package/lib/tree/util/cloning.d.ts.map +1 -0
- package/lib/tree/util/cloning.js +8 -0
- package/lib/tree/util/cloning.js.map +1 -0
- package/lib/tree/util/collections.d.ts +57 -0
- package/lib/tree/util/collections.d.ts.map +1 -0
- package/lib/tree/util/collections.js +136 -0
- package/lib/tree/util/collections.js.map +1 -0
- package/lib/tree/util/compare.d.ts +11 -0
- package/lib/tree/util/compare.d.ts.map +1 -0
- package/lib/tree/util/compare.js +89 -0
- package/lib/tree/util/compare.js.map +1 -0
- package/lib/tree/util/extend-helpers.d.ts +2 -0
- package/lib/tree/util/extend-helpers.d.ts.map +1 -0
- package/lib/tree/util/extend-helpers.js +2 -0
- package/lib/tree/util/extend-helpers.js.map +1 -0
- package/lib/tree/util/extend-roots.d.ts +37 -0
- package/lib/tree/util/extend-roots.d.ts.map +1 -0
- package/lib/tree/util/extend-roots.js +682 -0
- package/lib/tree/util/extend-roots.js.map +1 -0
- package/lib/tree/util/extend-roots.old.d.ts +132 -0
- package/lib/tree/util/extend-roots.old.d.ts.map +1 -0
- package/lib/tree/util/extend-roots.old.js +2272 -0
- package/lib/tree/util/extend-roots.old.js.map +1 -0
- package/lib/tree/util/extend-trace-debug.d.ts +13 -0
- package/lib/tree/util/extend-trace-debug.d.ts.map +1 -0
- package/lib/tree/util/extend-trace-debug.js +34 -0
- package/lib/tree/util/extend-trace-debug.js.map +1 -0
- package/lib/tree/util/extend.d.ts +218 -0
- package/lib/tree/util/extend.d.ts.map +1 -0
- package/lib/tree/util/extend.js +3033 -0
- package/lib/tree/util/extend.js.map +1 -0
- package/lib/tree/util/find-extendable-locations.d.ts +2 -0
- package/lib/tree/util/find-extendable-locations.d.ts.map +1 -0
- package/lib/tree/util/find-extendable-locations.js +2 -0
- package/lib/tree/util/find-extendable-locations.js.map +1 -0
- package/lib/tree/util/format.d.ts +20 -0
- package/lib/tree/util/format.d.ts.map +1 -0
- package/lib/tree/util/format.js +67 -0
- package/lib/tree/util/format.js.map +1 -0
- package/lib/tree/util/is-node.d.ts +13 -0
- package/lib/tree/util/is-node.d.ts.map +1 -0
- package/lib/tree/util/is-node.js +43 -0
- package/lib/tree/util/is-node.js.map +1 -0
- package/lib/tree/util/print.d.ts +80 -0
- package/lib/tree/util/print.d.ts.map +1 -0
- package/lib/tree/util/print.js +205 -0
- package/lib/tree/util/print.js.map +1 -0
- package/lib/tree/util/process-leading-is.d.ts +25 -0
- package/lib/tree/util/process-leading-is.d.ts.map +1 -0
- package/lib/tree/util/process-leading-is.js +364 -0
- package/lib/tree/util/process-leading-is.js.map +1 -0
- package/lib/tree/util/recursion-helper.d.ts +15 -0
- package/lib/tree/util/recursion-helper.d.ts.map +1 -0
- package/lib/tree/util/recursion-helper.js +43 -0
- package/lib/tree/util/recursion-helper.js.map +1 -0
- package/lib/tree/util/regex.d.ts +4 -0
- package/lib/tree/util/regex.d.ts.map +1 -0
- package/lib/tree/util/regex.js +4 -0
- package/lib/tree/util/regex.js.map +1 -0
- package/lib/tree/util/registry-utils.d.ts +192 -0
- package/lib/tree/util/registry-utils.d.ts.map +1 -0
- package/lib/tree/util/registry-utils.js +1242 -0
- package/lib/tree/util/registry-utils.js.map +1 -0
- package/lib/tree/util/ruleset-trace.d.ts +4 -0
- package/lib/tree/util/ruleset-trace.d.ts.map +1 -0
- package/lib/tree/util/ruleset-trace.js +14 -0
- package/lib/tree/util/ruleset-trace.js.map +1 -0
- package/lib/tree/util/selector-compare.d.ts +2 -0
- package/lib/tree/util/selector-compare.d.ts.map +1 -0
- package/lib/tree/util/selector-compare.js +2 -0
- package/lib/tree/util/selector-compare.js.map +1 -0
- package/lib/tree/util/selector-match-core.d.ts +171 -0
- package/lib/tree/util/selector-match-core.d.ts.map +1 -0
- package/lib/tree/util/selector-match-core.js +1578 -0
- package/lib/tree/util/selector-match-core.js.map +1 -0
- package/lib/tree/util/selector-utils.d.ts +30 -0
- package/lib/tree/util/selector-utils.d.ts.map +1 -0
- package/lib/tree/util/selector-utils.js +100 -0
- package/lib/tree/util/selector-utils.js.map +1 -0
- package/lib/tree/util/serialize-helper.d.ts +13 -0
- package/lib/tree/util/serialize-helper.d.ts.map +1 -0
- package/lib/tree/util/serialize-helper.js +387 -0
- package/lib/tree/util/serialize-helper.js.map +1 -0
- package/lib/tree/util/serialize-types.d.ts +9 -0
- package/lib/tree/util/serialize-types.d.ts.map +1 -0
- package/lib/tree/util/serialize-types.js +216 -0
- package/lib/tree/util/serialize-types.js.map +1 -0
- package/lib/tree/util/should-operate.d.ts +23 -0
- package/lib/tree/util/should-operate.d.ts.map +1 -0
- package/lib/tree/util/should-operate.js +46 -0
- package/lib/tree/util/should-operate.js.map +1 -0
- package/lib/tree/util/sourcemap.d.ts +7 -0
- package/lib/tree/util/sourcemap.d.ts.map +1 -0
- package/lib/tree/util/sourcemap.js +25 -0
- package/lib/tree/util/sourcemap.js.map +1 -0
- package/lib/types/config.d.ts +205 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +2 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/index.d.ts +15 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/modes.d.ts +24 -0
- package/lib/types/modes.d.ts.map +1 -0
- package/lib/types/modes.js +2 -0
- package/lib/types/modes.js.map +1 -0
- package/lib/types.d.ts +61 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +2 -0
- package/lib/types.js.map +1 -0
- package/lib/use-webpack-resolver.d.ts +9 -0
- package/lib/use-webpack-resolver.d.ts.map +1 -0
- package/lib/use-webpack-resolver.js +41 -0
- package/lib/use-webpack-resolver.js.map +1 -0
- package/lib/visitor/index.d.ts +136 -0
- package/lib/visitor/index.d.ts.map +1 -0
- package/lib/visitor/index.js +135 -0
- package/lib/visitor/index.js.map +1 -0
- package/lib/visitor/less-visitor.d.ts +7 -0
- package/lib/visitor/less-visitor.d.ts.map +1 -0
- package/lib/visitor/less-visitor.js +7 -0
- package/lib/visitor/less-visitor.js.map +1 -0
- package/package.json +66 -0
package/lib/logger.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
configure?(log: Logger): void;
|
|
3
|
+
log?(...args: any[]): void;
|
|
4
|
+
info?(...args: any[]): void;
|
|
5
|
+
warn?(...args: any[]): void;
|
|
6
|
+
error?(...args: any[]): void;
|
|
7
|
+
}
|
|
8
|
+
/** Configure with custom behavior */
|
|
9
|
+
export declare const logger: Required<Logger>;
|
|
10
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,SAAS,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAC5B,KAAK,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;CAC9B;AACD,qCAAqC;AACrC,eAAO,MAAM,MAAM,EAAE,QAAQ,CAAC,MAAM,CAoBnC,CAAC"}
|
package/lib/logger.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/** Configure with custom behavior */
|
|
3
|
+
export const logger = {
|
|
4
|
+
configure(log) {
|
|
5
|
+
Object.assign(logger, log);
|
|
6
|
+
},
|
|
7
|
+
log(...args) {
|
|
8
|
+
console.log(...args);
|
|
9
|
+
},
|
|
10
|
+
info(...args) {
|
|
11
|
+
console.info(...args);
|
|
12
|
+
},
|
|
13
|
+
warn(...args) {
|
|
14
|
+
console.error(chalk.yellow(...args));
|
|
15
|
+
},
|
|
16
|
+
error(...args) {
|
|
17
|
+
console.error(chalk.red(...args));
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,qCAAqC;AACrC,MAAM,CAAC,MAAM,MAAM,GAAqB;IACtC,SAAS,CAAC,GAAW;QACnB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,GAAG,IAAW;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,GAAG,IAAW;QACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,GAAG,IAAW;QAClB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IACpC,CAAC;CACF,CAAC"}
|
package/lib/plugin.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { Rules } from './tree/rules.js';
|
|
2
|
+
import type { Visitor } from './visitor/index.js';
|
|
3
|
+
import { type ErrorDiagnostic, type WarningDiagnostic } from './jess-error.js';
|
|
4
|
+
export type ISafeParseResult = {
|
|
5
|
+
/**
|
|
6
|
+
* The parsed tree, if parsing succeeded
|
|
7
|
+
*/
|
|
8
|
+
tree?: Rules;
|
|
9
|
+
/**
|
|
10
|
+
* Normalized errors from parsing.
|
|
11
|
+
* This should include ALL errors from lexing, parsing, and any plugin-level issues.
|
|
12
|
+
* Plugins should convert all errors to normalized ErrorDiagnostic format.
|
|
13
|
+
* Always an array (empty if no errors).
|
|
14
|
+
*/
|
|
15
|
+
errors: ErrorDiagnostic[];
|
|
16
|
+
/**
|
|
17
|
+
* Normalized warnings from parsing.
|
|
18
|
+
* This should include ALL warnings from lexing, parsing, and any plugin-level issues.
|
|
19
|
+
* Plugins should convert all warnings to normalized WarningDiagnostic format.
|
|
20
|
+
* Always an array (empty if no warnings).
|
|
21
|
+
*/
|
|
22
|
+
warnings: WarningDiagnostic[];
|
|
23
|
+
};
|
|
24
|
+
export interface PluginInterface {
|
|
25
|
+
/**
|
|
26
|
+
* e.g. 'less-plugin'
|
|
27
|
+
*/
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* Queryable filter if we have resolved the extension
|
|
31
|
+
* no dots e.g. `['less', 'scss']`
|
|
32
|
+
*/
|
|
33
|
+
supportedExtensions?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Expand an import path into a set of paths to try.
|
|
36
|
+
* e.g.
|
|
37
|
+
* `@import 'foo'` -> `['./foo.less']`
|
|
38
|
+
* `@import 'foo'` -> `['./foo.scss', './_foo.scss']`
|
|
39
|
+
*/
|
|
40
|
+
expandImport?(importPath: string, currentDir: string): string[];
|
|
41
|
+
/**
|
|
42
|
+
* e.g.
|
|
43
|
+
* `./foo` -> `/Users/foo/bar/foo`
|
|
44
|
+
* `@/alias` -> `/Users/foo/bar/src/alias`
|
|
45
|
+
* `one/two` -> `/Users/foo/node_modules/one/two`
|
|
46
|
+
*
|
|
47
|
+
* Does not attempt to check if the path exists.
|
|
48
|
+
* Note: paths may already be absolute.
|
|
49
|
+
*
|
|
50
|
+
* If the plugin has nothing to change, return `null` or return the array as-is.
|
|
51
|
+
*
|
|
52
|
+
* @note - I suppose a plugin doesn't have to resolve to an absolute path, if it's
|
|
53
|
+
* using some other method to handle the resolved paths in `locate()`.
|
|
54
|
+
* To that end, `locate()` shouldn't presume that the paths are absolute.
|
|
55
|
+
*/
|
|
56
|
+
resolve?(path: string | string[], currentDir: string, searchPaths: string[]): null | string[] | Promise<null | string[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Pick the first one that exists. Return null to let another plugin handle the path.
|
|
59
|
+
*/
|
|
60
|
+
locate?(pathCandidates: string[], currentDir: string): null | string | Promise<string | null>;
|
|
61
|
+
/**
|
|
62
|
+
* Get the source code for the file.
|
|
63
|
+
*/
|
|
64
|
+
getSource?(absoluteFilePath: string): Promise<string>;
|
|
65
|
+
/**
|
|
66
|
+
* If we have the extension in `supportedExtensions`, and this method exists,
|
|
67
|
+
* then this plugin is assumed to be able to parse the file.
|
|
68
|
+
*/
|
|
69
|
+
parse?(filePath: string, source: string): Rules;
|
|
70
|
+
/** No errors thrown; instead will return errors in the result */
|
|
71
|
+
safeParse?(filePath: string, source: string): ISafeParseResult;
|
|
72
|
+
/** If this method exists, then the plugin can return a JS module / object */
|
|
73
|
+
import?(absoluteFilePath: string): Promise<Record<string, any>>;
|
|
74
|
+
/** Post-parse or post-eval visitor(s) */
|
|
75
|
+
visitor?: Visitor | Visitor[];
|
|
76
|
+
/** Pre-eval visitor(s) - called before node.eval() during the preEval phase */
|
|
77
|
+
preEvalVisitor?: Visitor | Visitor[];
|
|
78
|
+
/** Post-eval visitor(s) - called after node.eval() (alternative to visitor for clarity) */
|
|
79
|
+
postEvalVisitor?: Visitor | Visitor[];
|
|
80
|
+
}
|
|
81
|
+
export declare abstract class AbstractPlugin implements PluginInterface {
|
|
82
|
+
abstract name: string;
|
|
83
|
+
/**
|
|
84
|
+
* Does a basic path resolution. Node resolution is in other plugins.
|
|
85
|
+
*/
|
|
86
|
+
resolve(filePath: string | string[], currentDir: string, searchPaths: string[]): string[];
|
|
87
|
+
/** Default source getter */
|
|
88
|
+
getSource(absoluteFilePath: string): Promise<string>;
|
|
89
|
+
/** Gets the first match using from the filesystem that exists */
|
|
90
|
+
locate(pathCandidates: string[], currentDir: string): null | string;
|
|
91
|
+
parse(filePath: string, source: string): Rules;
|
|
92
|
+
}
|
|
93
|
+
export type Plugin = <T extends Record<string, any>>(opts?: T) => PluginInterface;
|
|
94
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,iBAAiB,EAA2B,MAAM,iBAAiB,CAAC;AAE5H,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,IAAI,CAAC,EA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O,EAAE,CAAC;IAC9B,+EAA+E;IAC/E,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;IACrC,2FAA2F;IAC3F,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAC;CACvC;AAID,8BAAsB,cAAe,YAAW,eAAe;IAC7D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAkB9E,4BAA4B;IACtB,SAAS,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAS1D,iEAAiE;IACjE,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IAUnE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK;CAkC/C;AAED,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,KAAK,eAAe,CAAC"}
|
package/lib/plugin.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { join, isAbsolute, resolve } from 'node:path';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { JessError } from './jess-error.js';
|
|
5
|
+
const { isArray } = Array;
|
|
6
|
+
export class AbstractPlugin {
|
|
7
|
+
/**
|
|
8
|
+
* Does a basic path resolution. Node resolution is in other plugins.
|
|
9
|
+
*/
|
|
10
|
+
resolve(filePath, currentDir, searchPaths) {
|
|
11
|
+
const bases = [currentDir, ...searchPaths];
|
|
12
|
+
const out = [];
|
|
13
|
+
const seen = new Set();
|
|
14
|
+
filePath = isArray(filePath) ? filePath : [filePath];
|
|
15
|
+
for (const base of bases) {
|
|
16
|
+
const baseDir = isAbsolute(base) ? base : join(currentDir, base);
|
|
17
|
+
for (const path of filePath) {
|
|
18
|
+
const abs = resolve(baseDir, path);
|
|
19
|
+
if (abs && !seen.has(abs)) {
|
|
20
|
+
seen.add(abs);
|
|
21
|
+
out.push(abs);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
/** Default source getter */
|
|
28
|
+
async getSource(absoluteFilePath) {
|
|
29
|
+
try {
|
|
30
|
+
const result = await readFile(absoluteFilePath, 'utf8');
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Gets the first match using from the filesystem that exists */
|
|
38
|
+
locate(pathCandidates, currentDir) {
|
|
39
|
+
for (const candidate of pathCandidates) {
|
|
40
|
+
const absolutePath = isAbsolute(candidate) ? candidate : join(currentDir, candidate);
|
|
41
|
+
if (existsSync(absolutePath)) {
|
|
42
|
+
return absolutePath;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
parse(filePath, source) {
|
|
48
|
+
const safeParse = this.safeParse;
|
|
49
|
+
if (!safeParse) {
|
|
50
|
+
throw new Error(`Plugin "${this.name}" does not support parsing`);
|
|
51
|
+
}
|
|
52
|
+
const { tree, errors } = safeParse.call(this, filePath, source);
|
|
53
|
+
if (errors.length > 0) {
|
|
54
|
+
const firstError = errors[0];
|
|
55
|
+
throw new JessError({
|
|
56
|
+
code: firstError.code,
|
|
57
|
+
phase: firstError.phase,
|
|
58
|
+
severity: 'error',
|
|
59
|
+
ctx: firstError.file ? { file: firstError.file } : undefined,
|
|
60
|
+
filePath: firstError.filePath,
|
|
61
|
+
source: firstError.file?.source,
|
|
62
|
+
line: firstError.line,
|
|
63
|
+
column: firstError.column,
|
|
64
|
+
reason: firstError.reason,
|
|
65
|
+
fix: firstError.fix,
|
|
66
|
+
note: firstError.note,
|
|
67
|
+
errors: firstError.errors,
|
|
68
|
+
lexerErrors: firstError.lexerErrors
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (!tree) {
|
|
72
|
+
throw new Error(`Plugin "${this.name}" failed to parse "${filePath}"`);
|
|
73
|
+
}
|
|
74
|
+
return tree;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// export abstract class FileManager<O extends Record<string, any> = Record<string, any>> {
|
|
78
|
+
// abstract supportedExtensions?: string[];
|
|
79
|
+
// constructor(
|
|
80
|
+
// public opts: Partial<O> = {}
|
|
81
|
+
// ) {}
|
|
82
|
+
// /**
|
|
83
|
+
// * Turns relative paths into absolute paths.
|
|
84
|
+
// * e.g.
|
|
85
|
+
// * `./foo` -> `/Users/foo/bar/foo`
|
|
86
|
+
// * `@/alias` -> `/Users/foo/bar/src/alias`
|
|
87
|
+
// * `one/two` -> `/Users/foo/node_modules/one/two`
|
|
88
|
+
// *
|
|
89
|
+
// * Does not attempt to check if the path exists.
|
|
90
|
+
// * Note: paths may already be absolute.
|
|
91
|
+
// */
|
|
92
|
+
// abstract resolver?(paths: Set<string>, currentDir: string): Set<string>;
|
|
93
|
+
// /**
|
|
94
|
+
// * e.g.
|
|
95
|
+
// * Less file manager: `@import 'foo'` -> `['./foo.less']`
|
|
96
|
+
// * Sass file manager: `@import 'foo'` -> `['./foo.scss', './_foo.scss']`
|
|
97
|
+
// */
|
|
98
|
+
// abstract getPathsToTry?(filePath: string, currentDir: string, paths: string[], options: PathOptions): Set<string>;
|
|
99
|
+
// /**
|
|
100
|
+
// * Get the final resolved path.
|
|
101
|
+
// *
|
|
102
|
+
// * @param filePath Will be a partial path
|
|
103
|
+
// * @param paths The paths to search. This should always contain
|
|
104
|
+
// * the directory context where the file was imported. Can be
|
|
105
|
+
// * a fully-qualified path or a glob. Relative paths
|
|
106
|
+
// * will be resolved relative to process.cwd(). Plugins
|
|
107
|
+
// * may alter the paths array and return false to let another
|
|
108
|
+
// * plugin handle the path resolution.
|
|
109
|
+
// * @param options Determined by the file manager
|
|
110
|
+
// */
|
|
111
|
+
// resolvePath(
|
|
112
|
+
// filePath: string,
|
|
113
|
+
// currentDir: string,
|
|
114
|
+
// paths: string[],
|
|
115
|
+
// options: PathOptions
|
|
116
|
+
// ): string | string[] {
|
|
117
|
+
// filePath = this.opts.resolver(filePath);
|
|
118
|
+
// const pathsTried: string[] = [];
|
|
119
|
+
// if (isAbsolute(filePath)) {
|
|
120
|
+
// pathsTried.push(filePath);
|
|
121
|
+
// if (existsSync(filePath)) {
|
|
122
|
+
// return filePath;
|
|
123
|
+
// }
|
|
124
|
+
// }
|
|
125
|
+
// let isRelative = filePath.startsWith('.');
|
|
126
|
+
// let tryPath: string | undefined;
|
|
127
|
+
// if (options.allowBareRelative || isRelative) {
|
|
128
|
+
// tryPath = join(currentDir, filePath);
|
|
129
|
+
// pathsTried.push(tryPath);
|
|
130
|
+
// if (existsSync(tryPath)) {
|
|
131
|
+
// return tryPath;
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
// if (!isRelative) {
|
|
135
|
+
// try {
|
|
136
|
+
// tryPath = require.resolve(filePath);
|
|
137
|
+
// if (existsSync(tryPath)) {
|
|
138
|
+
// return tryPath;
|
|
139
|
+
// }
|
|
140
|
+
// } catch (err) {
|
|
141
|
+
// // ignore
|
|
142
|
+
// }
|
|
143
|
+
// }
|
|
144
|
+
// for (let i = 0; i < paths.length; i++) {
|
|
145
|
+
// tryPath = join(paths[i]!, filePath);
|
|
146
|
+
// pathsTried.push(tryPath);
|
|
147
|
+
// if (existsSync(tryPath)) {
|
|
148
|
+
// return tryPath;
|
|
149
|
+
// }
|
|
150
|
+
// }
|
|
151
|
+
// return pathsTried;
|
|
152
|
+
// }
|
|
153
|
+
// async loadFile(fullPath: string) {
|
|
154
|
+
// return await readFile(fullPath, 'utf8');
|
|
155
|
+
// }
|
|
156
|
+
// /**
|
|
157
|
+
// * Can override this instead of `getTree` if we want
|
|
158
|
+
// * to preserve extension-checking logic.
|
|
159
|
+
// */
|
|
160
|
+
// protected async _getTree(fullPath: string, options?: Record<string, any>): Promise<Rules | false> {
|
|
161
|
+
// return false;
|
|
162
|
+
// }
|
|
163
|
+
// /**
|
|
164
|
+
// * @param fullPath The fully resolved path
|
|
165
|
+
// */
|
|
166
|
+
// async getTree(fullPath: string, options?: Record<string, any>): Promise<Rules | false> {
|
|
167
|
+
// const supported = this.supportedExtensions;
|
|
168
|
+
// if (supported && !supported.includes(extname(fullPath))) {
|
|
169
|
+
// return false;
|
|
170
|
+
// }
|
|
171
|
+
// return await this._getTree(fullPath, options);
|
|
172
|
+
// }
|
|
173
|
+
// }
|
|
174
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,EAAkF,SAAS,EAAE,MAAM,iBAAiB,CAAC;AA0F5H,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;AAE1B,MAAM,OAAgB,cAAc;IAGlC;;OAEG;IACH,OAAO,CAAC,QAA2B,EAAE,UAAkB,EAAE,WAAqB;QAC5E,MAAM,KAAK,GAAG,CAAC,UAAU,EAAE,GAAG,WAAW,CAAC,CAAC;QAC3C,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;QAC/B,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CA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sBAAsB;AACtB,QAAQ;AACR,qDAAqD;AACrD,MAAM;AACN,IAAI"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type NodeOptions, type LocationInfo, type TreeContext, type Node } from './node.js';
|
|
2
|
+
import { Nil } from './nil.js';
|
|
3
|
+
import type { Context } from '../context.js';
|
|
4
|
+
import { SimpleSelector } from './selector-simple.js';
|
|
5
|
+
import { type Selector } from './selector.js';
|
|
6
|
+
import { type PrintOptions } from './util/print.js';
|
|
7
|
+
export type AmpersandValue = {
|
|
8
|
+
/**
|
|
9
|
+
* The only value that may exist is an anonymous value
|
|
10
|
+
* This is represented as &(). Any &() will signal
|
|
11
|
+
* a forced output (as well as an adjacent ident starting with
|
|
12
|
+
* a dash or numbers)
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
.rule {
|
|
16
|
+
&-foo {
|
|
17
|
+
color: red;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// output:
|
|
21
|
+
.rule-foo {
|
|
22
|
+
color: red;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.rule {
|
|
26
|
+
&(-foo) {
|
|
27
|
+
color: red;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// output:
|
|
31
|
+
.rule-foo {
|
|
32
|
+
color: red;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rule {
|
|
36
|
+
&.foo {
|
|
37
|
+
color: red;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// output:
|
|
41
|
+
.rule {
|
|
42
|
+
&.foo {
|
|
43
|
+
color: red;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.rule {
|
|
48
|
+
&().foo {
|
|
49
|
+
color: red;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// output:
|
|
53
|
+
.rule.foo {
|
|
54
|
+
color: red;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
*/
|
|
58
|
+
/** Set to an empty string to hoist to root */
|
|
59
|
+
appendValue?: string;
|
|
60
|
+
/**
|
|
61
|
+
* When set (e.g. by ruleset preEval), returns the current parent ruleset's selector ("pointer").
|
|
62
|
+
* Prefer this over value.selector so extend sees the parent after it has been mutated (e.g. by extend).
|
|
63
|
+
*/
|
|
64
|
+
selectorContainer?: {
|
|
65
|
+
selector?: Selector | Nil | undefined;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The '&' selector element
|
|
70
|
+
*/
|
|
71
|
+
export declare class Ampersand extends SimpleSelector<{
|
|
72
|
+
appendValue?: string;
|
|
73
|
+
}> {
|
|
74
|
+
type: "Ampersand";
|
|
75
|
+
shortType: "amp";
|
|
76
|
+
private _storedSelector;
|
|
77
|
+
private _selectorContainer;
|
|
78
|
+
constructor(value?: AmpersandValue | string, options?: NodeOptions, location?: LocationInfo, treeContext?: TreeContext);
|
|
79
|
+
get keySet(): Set<string>;
|
|
80
|
+
/** The keys of an ampersand are the keys of the selector it contains */
|
|
81
|
+
protected _computeKeySetAndFastReject(): void;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the current selector from the selector container (live when container is ruleset value).
|
|
84
|
+
* Used by extend, serialization, and matching so nested rules see the parent after extend.
|
|
85
|
+
*/
|
|
86
|
+
getResolvedSelector(): Selector | Nil | undefined;
|
|
87
|
+
valueOf(): string;
|
|
88
|
+
toTrimmedString(options?: PrintOptions): string;
|
|
89
|
+
/** Hmm this should never return Extend */
|
|
90
|
+
evalNode(context: Context): Selector | Nil;
|
|
91
|
+
clone(deep?: boolean, cloneFn?: (n: Node) => Node): this;
|
|
92
|
+
}
|
|
93
|
+
export declare const amp: (value?: string | AmpersandValue | undefined, options?: NodeOptions | undefined, location?: LocationInfo | undefined) => Ampersand;
|
|
94
|
+
//# sourceMappingURL=ampersand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ampersand.d.ts","sourceRoot":"","sources":["../../src/tree/ampersand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