From b767f751f58ae11a7976101c0cf29c74be255643 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Wed, 8 May 2019 15:28:03 -0700 Subject: [PATCH] Add specs for @forward See sass/sass#1094 --- spec/core_functions/function_exists.hrx | 89 ++++ spec/core_functions/get_function.hrx | 125 ++++++ .../core_functions/global_variable_exists.hrx | 89 ++++ spec/core_functions/mixin_exists.hrx | 89 ++++ spec/core_functions/variable_exists.hrx | 72 +++ spec/directives/forward/css.hrx | 108 +++++ spec/directives/forward/error/extend.hrx | 24 + spec/directives/forward/error/load.hrx | 82 ++++ spec/directives/forward/error/member.hrx | 425 ++++++++++++++++++ spec/directives/forward/error/syntax.hrx | 349 ++++++++++++++ spec/directives/forward/extend.hrx | 63 +++ spec/directives/forward/member/as.hrx | 171 +++++++ spec/directives/forward/member/bare.hrx | 99 ++++ spec/directives/forward/member/import.hrx | 144 ++++++ spec/directives/forward/member/shadowed.hrx | 87 ++++ spec/directives/forward/member/visibility.hrx | 149 ++++++ spec/directives/forward/options.yml | 3 + 17 files changed, 2168 insertions(+) create mode 100644 spec/directives/forward/css.hrx create mode 100644 spec/directives/forward/error/extend.hrx create mode 100644 spec/directives/forward/error/load.hrx create mode 100644 spec/directives/forward/error/member.hrx create mode 100644 spec/directives/forward/error/syntax.hrx create mode 100644 spec/directives/forward/extend.hrx create mode 100644 spec/directives/forward/member/as.hrx create mode 100644 spec/directives/forward/member/bare.hrx create mode 100644 spec/directives/forward/member/import.hrx create mode 100644 spec/directives/forward/member/shadowed.hrx create mode 100644 spec/directives/forward/member/visibility.hrx create mode 100644 spec/directives/forward/options.yml diff --git a/spec/core_functions/function_exists.hrx b/spec/core_functions/function_exists.hrx index e27d5f657a..1509c33441 100644 --- a/spec/core_functions/function_exists.hrx +++ b/spec/core_functions/function_exists.hrx @@ -66,6 +66,95 @@ a { b: true; } +<===> +================================================================================ +<===> through_forward/options.yml +--- +:todo: +- libsass # sass/libsass#2807 + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "midstream" as *; +a {b: function-exists(c)} + +<===> through_forward/bare/_midstream.scss +@forward "upstream"; + +<===> through_forward/bare/_upstream.scss +@function c() {@return null} + +<===> through_forward/bare/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "midstream" as *; +a { + with-prefix: function-exists(b-c); + without-prefix: function-exists(c); +} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as b-*; + +<===> through_forward/as/_upstream.scss +@function c() {@return null} + +<===> through_forward/as/output.css +a { + with-prefix: true; + without-prefix: false; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "midstream" as *; +a { + shown: function-exists(b); + not-shown: function-exists(c); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show b; + +<===> through_forward/show/_upstream.scss +@function b() {@return null} +@function c() {@return null} + +<===> through_forward/show/output.css +a { + shown: true; + not-shown: false; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "midstream" as *; +a { + hidden: function-exists(b); + not-hidden: function-exists(c); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide b; + +<===> through_forward/hide/_upstream.scss +@function b() {@return null} +@function c() {@return null} + +<===> through_forward/hide/output.css +a { + hidden: false; + not-hidden: true; +} + <===> ================================================================================ <===> non_existent/input.scss diff --git a/spec/core_functions/get_function.hrx b/spec/core_functions/get_function.hrx index 8e3278c96a..8dcab5953b 100644 --- a/spec/core_functions/get_function.hrx +++ b/spec/core_functions/get_function.hrx @@ -72,6 +72,87 @@ a { b: 12; } +<===> +================================================================================ +<===> through_forward/options.yml +--- +:todo: +- libsass # sass/libsass#2807 + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "midstream" as *; +a {b: call(get-function(c))} + +<===> through_forward/bare/_midstream.scss +@forward "upstream"; + +<===> through_forward/bare/_upstream.scss +@function c() {@return c} + +<===> through_forward/bare/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "midstream" as *; +a { + b: call(get-function(c-d)); +} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as c-*; + +<===> through_forward/as/_upstream.scss +@function d() {@return d} + +<===> through_forward/as/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "midstream" as *; +a { + b: call(get-function(c)); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show c; + +<===> through_forward/show/_upstream.scss +@function c() {@return c} + +<===> through_forward/show/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "midstream" as *; +a { + b: call(get-function(d)); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide c; + +<===> through_forward/hide/_upstream.scss +@function d() {@return d} + +<===> through_forward/hide/output.css +a { + b: d; +} + <===> ================================================================================ <===> plain_css/input.scss @@ -325,6 +406,50 @@ Error: Function not found: does-not-exist ' input.scss 1:7 root stylesheet +<===> +================================================================================ +<===> error/through_forward/show/input.scss +@use "midstream" as *; +a { + b: call(get-function(d)); +} + +<===> error/through_forward/show/_midstream.scss +@forward "upstream" show c; + +<===> error/through_forward/show/_upstream.scss +@function d() {@return c} + +<===> error/through_forward/show/error +Error: Function not found: d + , +3 | b: call(get-function(d)); + | ^^^^^^^^^^^^^^^ + ' + input.scss 3:11 root stylesheet + +<===> +================================================================================ +<===> error/through_forward/hide/input.scss +@use "midstream" as *; +a { + b: call(get-function(c)); +} + +<===> error/through_forward/hide/_midstream.scss +@forward "upstream" hide c; + +<===> error/through_forward/hide/_upstream.scss +@function c() {@return c} + +<===> error/through_forward/hide/error +Error: Function not found: c + , +3 | b: call(get-function(c)); + | ^^^^^^^^^^^^^^^ + ' + input.scss 3:11 root stylesheet + <===> ================================================================================ <===> error/division/input.scss diff --git a/spec/core_functions/global_variable_exists.hrx b/spec/core_functions/global_variable_exists.hrx index 909c2d32aa..ca719f620e 100644 --- a/spec/core_functions/global_variable_exists.hrx +++ b/spec/core_functions/global_variable_exists.hrx @@ -54,6 +54,95 @@ a { b: true; } +<===> +================================================================================ +<===> through_forward/options.yml +--- +:todo: +- libsass # sass/libsass#2807 + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "midstream" as *; +a {b: variable-exists(c)} + +<===> through_forward/bare/_midstream.scss +@forward "upstream"; + +<===> through_forward/bare/_upstream.scss +$c: null; + +<===> through_forward/bare/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "midstream" as *; +a { + with-prefix: global-variable-exists(b-c); + without-prefix: global-variable-exists(c); +} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as b-*; + +<===> through_forward/as/_upstream.scss +$c: null; + +<===> through_forward/as/output.css +a { + with-prefix: true; + without-prefix: false; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "midstream" as *; +a { + shown: global-variable-exists(b); + not-shown: global-variable-exists(c); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show $b; + +<===> through_forward/show/_upstream.scss +$b: null; +$c: null; + +<===> through_forward/show/output.css +a { + shown: true; + not-shown: false; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "midstream" as *; +a { + hidden: global-variable-exists(b); + not-hidden: global-variable-exists(c); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide $b; + +<===> through_forward/hide/_upstream.scss +$b: null; +$c: null; + +<===> through_forward/hide/output.css +a { + hidden: false; + not-hidden: true; +} + <===> ================================================================================ <===> dash_insensitive/input.scss diff --git a/spec/core_functions/mixin_exists.hrx b/spec/core_functions/mixin_exists.hrx index cf3f1bfb7f..6b2c1f520a 100644 --- a/spec/core_functions/mixin_exists.hrx +++ b/spec/core_functions/mixin_exists.hrx @@ -66,6 +66,95 @@ a { b: true; } +<===> +================================================================================ +<===> through_forward/options.yml +--- +:todo: +- libsass # sass/libsass#2807 + +<===> +================================================================================ +<===> through_forward/bare/input.scss +@use "midstream" as *; +a {b: mixin-exists(c)} + +<===> through_forward/bare/_midstream.scss +@forward "upstream"; + +<===> through_forward/bare/_upstream.scss +@mixin c() {} + +<===> through_forward/bare/output.css +a { + b: true; +} + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "midstream" as *; +a { + with-prefix: mixin-exists(b-c); + without-prefix: mixin-exists(c); +} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as b-*; + +<===> through_forward/as/_upstream.scss +@mixin c() {} + +<===> through_forward/as/output.css +a { + with-prefix: true; + without-prefix: false; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "midstream" as *; +a { + shown: mixin-exists(b); + not-shown: mixin-exists(c); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show b; + +<===> through_forward/show/_upstream.scss +@mixin b() {} +@mixin c() {} + +<===> through_forward/show/output.css +a { + shown: true; + not-shown: false; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "midstream" as *; +a { + hidden: mixin-exists(b); + not-hidden: mixin-exists(c); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide b; + +<===> through_forward/hide/_upstream.scss +@mixin b() {} +@mixin c() {} + +<===> through_forward/hide/output.css +a { + hidden: false; + not-hidden: true; +} + <===> ================================================================================ <===> non_existent/input.scss diff --git a/spec/core_functions/variable_exists.hrx b/spec/core_functions/variable_exists.hrx index 2a6bfd2ecd..97c3be1149 100644 --- a/spec/core_functions/variable_exists.hrx +++ b/spec/core_functions/variable_exists.hrx @@ -54,6 +54,78 @@ a { b: true; } +<===> +================================================================================ +<===> through_forward/options.yml +--- +:todo: +- libsass # sass/libsass#2807 + +<===> +================================================================================ +<===> through_forward/as/input.scss +@use "midstream" as *; +a { + with-prefix: variable-exists(b-c); + without-prefix: variable-exists(c); +} + +<===> through_forward/as/_midstream.scss +@forward "upstream" as b-*; + +<===> through_forward/as/_upstream.scss +$c: null; + +<===> through_forward/as/output.css +a { + with-prefix: true; + without-prefix: false; +} + +<===> +================================================================================ +<===> through_forward/show/input.scss +@use "midstream" as *; +a { + shown: variable-exists(b); + not-shown: variable-exists(c); +} + +<===> through_forward/show/_midstream.scss +@forward "upstream" show $b; + +<===> through_forward/show/_upstream.scss +$b: null; +$c: null; + +<===> through_forward/show/output.css +a { + shown: true; + not-shown: false; +} + +<===> +================================================================================ +<===> through_forward/hide/input.scss +@use "midstream" as *; +a { + hidden: variable-exists(b); + not-hidden: variable-exists(c); +} + +<===> through_forward/hide/_midstream.scss +@forward "upstream" hide $b; + +<===> through_forward/hide/_upstream.scss +$b: null; +$c: null; + +<===> through_forward/hide/output.css +a { + hidden: false; + not-hidden: true; +} + <===> ================================================================================ <===> dash_insensitive/input.scss diff --git a/spec/directives/forward/css.hrx b/spec/directives/forward/css.hrx new file mode 100644 index 0000000000..ddb4fc8176 --- /dev/null +++ b/spec/directives/forward/css.hrx @@ -0,0 +1,108 @@ +<===> README.md +`@forward` should handle CSS in the same way as `@use`. We assume that they use +shared infrastructure, though, and as such only test basic cases. + +<===> +================================================================================ +<===> forward_only/input.scss +@forward "other"; + +<===> forward_only/_other.scss +a {b: c} + +<===> forward_only/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> once/multiple_forwards/input.scss +@forward "other"; +@forward "other"; +@forward "other"; + +<===> once/multiple_forwards/_other.scss +a {b: c} + +<===> once/multiple_forwards/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> once/forward_and_use/input.scss +@forward "other"; +@use "other"; + +<===> once/forward_and_use/_other.scss +a {b: c} + +<===> once/forward_and_use/output.css +a { + b: c; +} + +<===> +================================================================================ +<===> order/input.scss +@forward "other1"; +@use "other2"; +@forward "other3"; + +a {file: input} + +<===> order/_other1.scss +a {file: other1} + +<===> order/_other2.scss +a {file: other2} + +<===> order/_other3.scss +a {file: other3} + +<===> order/output.css +a { + file: other1; +} + +a { + file: other2; +} + +a { + file: other3; +} + +a { + file: input; +} + +<===> +================================================================================ +<===> forward_into_import/input.scss +@forward "forwarded"; + +in-input {a: b} + +<===> forward_into_import/_forwarded.scss +@import "imported"; + +in-forwarded {a: b} + +<===> forward_into_import/_imported.scss +in-imported {a: b} + +<===> forward_into_import/output.css +in-imported { + a: b; +} + +in-forwarded { + a: b; +} + +in-input { + a: b; +} diff --git a/spec/directives/forward/error/extend.hrx b/spec/directives/forward/error/extend.hrx new file mode 100644 index 0000000000..0e40fe27e7 --- /dev/null +++ b/spec/directives/forward/error/extend.hrx @@ -0,0 +1,24 @@ +<===> README.md +`@forward` should handle extensions in the same way as `@use`, and as such +should produce the same errors when extensions fail. We assume that they use +shared infrastructure, though, and as such only test a basic case. + +<===> input.scss +@use "midstream"; + +in-input {a: b} + +<===> _midstream.scss +@forward "upstream"; + +<===> _upstream.scss +in-upstream {@extend in-input} + +<===> error +Error: The target selector was not found. +Use "@extend in-input !optional" to avoid this error. + , +1 | in-upstream {@extend in-input} + | ^^^^^^^^^^^^^^^^ + ' + _upstream.scss 1:14 root stylesheet diff --git a/spec/directives/forward/error/load.hrx b/spec/directives/forward/error/load.hrx new file mode 100644 index 0000000000..7521180948 --- /dev/null +++ b/spec/directives/forward/error/load.hrx @@ -0,0 +1,82 @@ +<===> README.md +`@forward` should load modules in the same way as `@use`, and as such should +produce the same errors when loading fails. We assume that they use shared +infrastructure, though, and as such only duplicate a few basic load tests for +`@forward`. + +<===> +================================================================================ +<===> missing/input.scss +@forward "other"; + +<===> missing/error +Error: Can't find stylesheet to import. + , +1 | @forward "other"; + | ^^^^^^^^^^^^^^^^ + ' + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> loop/forward_self/input.scss +@forward "input"; + +<===> loop/forward_self/error +Error: This module is currently being loaded. + , +1 | @forward "input"; + | ^^^^^^^^^^^^^^^^ + ' + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> loop/forward_to_forward/input.scss +@forward "other"; + +<===> loop/forward_to_forward/other.scss +@forward "input"; + +<===> loop/forward_to_forward/error +Error: This module is currently being loaded. + , +1 | @forward "input"; + | ^^^^^^^^^^^^^^^^ + ' + other.scss 1:1 @forward + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> loop/forward_to_use/input.scss +@forward "other"; + +<===> loop/forward_to_use/other.scss +@use "input"; + +<===> loop/forward_to_use/error +Error: This module is currently being loaded. + , +1 | @use "input"; + | ^^^^^^^^^^^^ + ' + other.scss 1:1 @forward + input.scss 1:1 root stylesheet + +<===> +================================================================================ +<===> loop/forward_to_import/input.scss +@forward "other"; + +<===> loop/forward_to_import/other.scss +@import "input"; + +<===> loop/forward_to_import/error +Error: This file is already being loaded. + , +1 | @import "input"; + | ^^^^^^^ + ' + other.scss 1:9 @forward + input.scss 1:1 root stylesheet diff --git a/spec/directives/forward/error/member.hrx b/spec/directives/forward/error/member.hrx new file mode 100644 index 0000000000..26075e5d30 --- /dev/null +++ b/spec/directives/forward/error/member.hrx @@ -0,0 +1,425 @@ +<===> conflict/README.md +When two modules that contain conflicting members are `@forward`ed, that +produces an error immediately even if the member is never used. This is unlike +`@use`, which only produces an error on use. + +<===> +================================================================================ +<===> conflict/variable/input.scss +@forward "other1"; +@forward "other2"; + +<===> conflict/variable/_other1.scss +$a: from other1; + +<===> conflict/variable/_other2.scss +$a: from other2; + +<===> conflict/variable/error +Error: Module _other1.scss and the new module both forward a variable named $a. + , +2 | @forward "other2"; + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> conflict/function/input.scss +@forward "other1"; +@forward "other2"; + +<===> conflict/function/_other1.scss +@function a() {@return from other1} + +<===> conflict/function/_other2.scss +@function a() {@return from other2} + +<===> conflict/function/error +Error: Module _other1.scss and the new module both forward a function named a. + , +2 | @forward "other2"; + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> conflict/mixin/input.scss +@forward "other1"; +@forward "other2"; + +<===> conflict/mixin/_other1.scss +@mixin a {b: from other1} + +<===> conflict/mixin/_other2.scss +@mixin a {b: from other2} + +<===> conflict/mixin/error +Error: Module _other1.scss and the new module both forward a mixin named a. + , +2 | @forward "other2"; + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> conflict/same_file/input.scss +@forward "other"; +@forward "other"; + +<===> conflict/same_file/_other.scss +$a: b; + +<===> conflict/same_file/error +Error: Module _other.scss and the new module both forward a variable named $a. + , +2 | @forward "other"; + | ^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> conflict/because_of_as/first/input.scss +@forward "other1" as a-*; +@forward "other2"; + +<===> conflict/because_of_as/first/_other1.scss +$b: from other1; + +<===> conflict/because_of_as/first/_other2.scss +$a-b: from other2; + +<===> conflict/because_of_as/first/error +Error: Module _other1.scss and the new module both forward a variable named $a-b. + , +2 | @forward "other2"; + | ^^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> conflict/because_of_as/last/input.scss +@forward "other1"; +@forward "other2" as a-*; + +<===> conflict/because_of_as/last/_other1.scss +$a-b: from other1; + +<===> conflict/because_of_as/last/_other2.scss +$b: from other2; + +<===> conflict/because_of_as/last/error +Error: Module _other1.scss and the new module both forward a variable named $a-b. + , +2 | @forward "other2" as a-*; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/local/variable/input.scss +@forward "other"; + +a {b: $c}; + +<===> inaccessible/local/variable/_other.scss +$c: d; + +<===> inaccessible/local/variable/error +Error: Undefined variable. + , +3 | a {b: $c}; + | ^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> inaccessible/local/function/input.scss +@forward "other"; + +// This is technically not a compile error, since `-member()` is treated as +// plain CSS, but it's included here for consistency with the other specs. +a {b: c()}; + +<===> inaccessible/local/function/_other.scss +@function c() {@return d} + +<===> inaccessible/local/function/output.css +a { + b: c(); +} + +<===> +================================================================================ +<===> inaccessible/local/mixin/input.scss +@forward "other"; + +@include a; + +<===> inaccessible/local/mixin/_other.scss +@mixin a {b {c: d}} + +<===> inaccessible/local/mixin/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/private/variable/input.scss +@use "midstream" as *; + +a {b: $-c}; + +<===> inaccessible/private/variable/_midstream.scss +@forward "upstream"; + +<===> inaccessible/private/variable/_upstream.scss +$-c: d; + +<===> inaccessible/private/variable/error +Error: Undefined variable. + , +3 | a {b: $-c}; + | ^^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> inaccessible/private/function/input.scss +@use "midstream" as *; + +// This is technically not a compile error, since `-member()` is treated as +// plain CSS, but it's included here for consistency with the other specs. +a {b: -c()}; + +<===> inaccessible/private/function/_midstream.scss +@forward "upstream"; + +<===> inaccessible/private/function/_upstream.scss +@function -c() {@return d} + +<===> inaccessible/private/function/output.css +a { + b: -c(); +} + +<===> +================================================================================ +<===> inaccessible/private/mixin/input.scss +@use "midstream" as *; + +@include -a; + +<===> inaccessible/private/mixin/_midstream.scss +@forward "upstream"; + +<===> inaccessible/private/mixin/_upstream.scss +@mixin -a {b {c: d}} + +<===> inaccessible/private/mixin/error +Error: Undefined mixin. + , +3 | @include -a; + | ^^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/hidden/variable/input.scss +@use "midstream" as *; + +a {b: $c} + +<===> inaccessible/hidden/variable/_midstream.scss +@forward "upstream" hide $c; + +<===> inaccessible/hidden/variable/_upstream.scss +$c: d; + +<===> inaccessible/hidden/variable/error +Error: Undefined variable. + , +3 | a {b: $c} + | ^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> inaccessible/hidden/mixin/input.scss +@use "midstream" as *; + +@include a; + +<===> inaccessible/hidden/mixin/_midstream.scss +@forward "upstream" hide a; + +<===> inaccessible/hidden/mixin/_upstream.scss +@mixin a {b {c: d}} + +<===> inaccessible/hidden/mixin/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/hidden/as/different_separator/input.scss +@use "midstream" as *; + +@include a; + +<===> inaccessible/hidden/as/different_separator/_midstream.scss +@forward "upstream" as b-* hide b_a; + +<===> inaccessible/hidden/as/different_separator/_upstream.scss +@as a {b {c: d}} + +<===> inaccessible/hidden/as/different_separator/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/hidden/as/same_separator/input.scss +@use "midstream" as *; + +@include a; + +<===> inaccessible/hidden/as/same_separator/_midstream.scss +@forward "upstream" as b-* hide b-a; + +<===> inaccessible/hidden/as/same_separator/_upstream.scss +@as a {b {c: d}} + +<===> inaccessible/hidden/as/same_separator/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/not_shown/variable/input.scss +@use "midstream" as *; + +a {b: $c} + +<===> inaccessible/not_shown/variable/_midstream.scss +@forward "upstream" show $d; + +<===> inaccessible/not_shown/variable/_upstream.scss +$c: e; + +<===> inaccessible/not_shown/variable/error +Error: Undefined variable. + , +3 | a {b: $c} + | ^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> inaccessible/not_shown/mixin/input.scss +@use "midstream" as *; + +@include a; + +<===> inaccessible/not_shown/mixin/_midstream.scss +@forward "upstream" show b; + +<===> inaccessible/not_shown/mixin/_upstream.scss +@mixin a {c {d: e}} + +<===> inaccessible/not_shown/mixin/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/not_shown/wrong_type/variable/input.scss +@use "midstream" as *; + +a {b: $c} + +<===> inaccessible/not_shown/wrong_type/variable/_midstream.scss +@forward "upstream" show c; + +<===> inaccessible/not_shown/wrong_type/variable/_upstream.scss +$c: e; + +<===> inaccessible/not_shown/wrong_type/variable/error +Error: Undefined variable. + , +3 | a {b: $c} + | ^^ + ' + input.scss 3:7 root stylesheet + +<===> +================================================================================ +<===> inaccessible/not_shown/wrong_type/mixin/input.scss +@use "midstream" as *; + +@include a; + +<===> inaccessible/not_shown/wrong_type/mixin/_midstream.scss +@forward "upstream" show $a; + +<===> inaccessible/not_shown/wrong_type/mixin/_upstream.scss +@mixin a {c {d: e}} + +<===> inaccessible/not_shown/wrong_type/mixin/error +Error: Undefined mixin. + , +3 | @include a; + | ^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet + +<===> +================================================================================ +<===> inaccessible/not_shown/as/mixin/input.scss +@use "midstream" as *; + +@include b-a; + +<===> inaccessible/not_shown/as/mixin/_midstream.scss +@forward "upstream" as b-* show a; + +<===> inaccessible/not_shown/as/mixin/_upstream.scss +@mixin a {c {d: e}} + +<===> inaccessible/not_shown/as/mixin/error +Error: Undefined mixin. + , +3 | @include b-a; + | ^^^^^^^^^^^^ + ' + input.scss 3:1 root stylesheet diff --git a/spec/directives/forward/error/syntax.hrx b/spec/directives/forward/error/syntax.hrx new file mode 100644 index 0000000000..9bc8169bde --- /dev/null +++ b/spec/directives/forward/error/syntax.hrx @@ -0,0 +1,349 @@ +<===> empty/input.scss +@forward; + +<===> empty/error +Error: Expected string. + , +1 | @forward; + | ^ + ' + input.scss 1:9 root stylesheet + +<===> +================================================================================ +<===> as/nothing/input.scss +@forward "a" as; + +<===> as/nothing/error +Error: Expected identifier. + , +1 | @forward "a" as; + | ^ + ' + input.scss 1:16 root stylesheet + +<===> +================================================================================ +<===> as/asterisk/input.scss +@forward "a" as *; + +<===> as/asterisk/error +Error: Expected identifier. + , +1 | @forward "a" as *; + | ^ + ' + input.scss 1:17 root stylesheet + +<===> +================================================================================ +<===> as/invalid/input.scss +@forward "a" as 1-*; + +<===> as/invalid/error +Error: Expected identifier. + , +1 | @forward "a" as 1-*; + | ^ + ' + input.scss 1:17 root stylesheet + +<===> +================================================================================ +<===> as/no_star/input.scss +@forward "a" as foo; + +<===> as/no_star/error +Error: expected "*". + , +1 | @forward "a" as foo; + | ^ + ' + input.scss 1:20 root stylesheet + +<===> +================================================================================ +<===> show/nothing/input.scss +@forward "a" show; + +<===> show/nothing/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" show; + | ^ + ' + input.scss 1:18 root stylesheet + +<===> +================================================================================ +<===> show/invalid/input.scss +@forward "a" show 1; + +<===> show/invalid/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" show 1; + | ^ + ' + input.scss 1:19 root stylesheet + +<===> +================================================================================ +<===> show/empty_variable/input.scss +@forward "a" show $; + +<===> show/empty_variable/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" show $; + | ^ + ' + input.scss 1:20 root stylesheet + +<===> +================================================================================ +<===> show/trailing_comma/input.scss +@forward "a" show b,; + +<===> show/trailing_comma/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" show b,; + | ^ + ' + input.scss 1:21 root stylesheet + +<===> +================================================================================ +<===> show/and_hide/input.scss +@forward "a" show b hide c; + +<===> show/and_hide/error +Error: expected ";". + , +1 | @forward "a" show b hide c; + | ^ + ' + input.scss 1:21 root stylesheet + +<===> +================================================================================ +<===> hide/nothing/input.scss +@forward "a" hide; + +<===> hide/nothing/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" hide; + | ^ + ' + input.scss 1:18 root stylesheet + +<===> +================================================================================ +<===> hide/invalid/input.scss +@forward "a" hide 1; + +<===> hide/invalid/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" hide 1; + | ^ + ' + input.scss 1:19 root stylesheet + +<===> +================================================================================ +<===> hide/empty_variable/input.scss +@forward "a" hide $; + +<===> hide/empty_variable/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" hide $; + | ^ + ' + input.scss 1:20 root stylesheet + +<===> +================================================================================ +<===> hide/trailing_comma/input.scss +@forward "a" hide b,; + +<===> hide/trailing_comma/error +Error: Expected variable, mixin, or function name + , +1 | @forward "a" hide b,; + | ^ + ' + input.scss 1:21 root stylesheet + +<===> +================================================================================ +<===> hide/and_show/input.scss +@forward "a" hide b show c; + +<===> hide/and_show/error +Error: expected ";". + , +1 | @forward "a" hide b show c; + | ^ + ' + input.scss 1:21 root stylesheet + +<===> +================================================================================ +<===> url/unquoted/input.scss +@forward foo; + +<===> url/unquoted/error +Error: Expected string. + , +1 | @forward foo; + | ^ + ' + input.scss 1:10 root stylesheet + +<===> +================================================================================ +<===> within/mixin/input.scss +@mixin a { + @forward "b"; +} + +<===> within/mixin/error +Error: This at-rule is not allowed here. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:3 root stylesheet + +<===> +================================================================================ +<===> within/function/input.scss +@function a() { + @forward "b"; +} + +<===> within/function/error +Error: This at-rule is not allowed here. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:3 root stylesheet + +<===> +================================================================================ +<===> within/style_rule/input.scss +a { + @forward "b"; +} + +<===> within/style_rule/error +Error: This at-rule is not allowed here. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:3 root stylesheet + +<===> +================================================================================ +<===> after/at_rule/unknown/input.scss +@a; +@forward "b"; + +<===> after/at_rule/unknown/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> after/at_rule/sass/input.scss +@if true {}; +@forward "a"; + +<===> after/at_rule/sass/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "a"; + | ^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> after/at_rule/import/input.scss +@import "a"; +@forward "b"; + +<===> after/at_rule/import/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> after/at_rule/css/input.scss +@keyframes a {}; +@forward "b"; + +<===> after/at_rule/css/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> after/style_rule/input.scss +a {}; +@forward "b"; + +<===> after/style_rule/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "b"; + | ^^^^^^^^^^^^ + ' + input.scss 2:1 root stylesheet + +<===> +================================================================================ +<===> after/indented/mixin/input.sass +=a + b: c +@forward "d" + +<===> after/indented/mixin/error +Error: @forward rules must be written before any other rules. + , +3 | @forward "d" + | ^^^^^^^^^^^^ + ' + input.sass 3:1 root stylesheet + +<===> +================================================================================ +<===> after/indented/include/input.sass ++a +@forward "b" + +<===> after/indented/include/error +Error: @forward rules must be written before any other rules. + , +2 | @forward "b" + | ^^^^^^^^^^^^ + ' + input.sass 2:1 root stylesheet diff --git a/spec/directives/forward/extend.hrx b/spec/directives/forward/extend.hrx new file mode 100644 index 0000000000..8cc32b0dcd --- /dev/null +++ b/spec/directives/forward/extend.hrx @@ -0,0 +1,63 @@ +<===> README.md +`@forward` should handle extensions in the same way as `@use`. We assume that +they use shared infrastructure, though, and as such only test basic cases. + +<===> +================================================================================ +<===> upstream/input.scss +@use "midstream"; + +in-input {@extend in-upstream} + +<===> upstream/_midstream.scss +@forward "upstream"; + +<===> upstream/_upstream.scss +in-upstream {a: b} + +<===> upstream/output.css +in-upstream, in-input { + a: b; +} + +<===> +================================================================================ +<===> forward_into_use/input.scss +@use "midstream"; + +in-input {@extend in-used} + +<===> forward_into_use/_midstream.scss +@forward "forwarded"; + +<===> forward_into_use/_forwarded.scss +@use "used"; + +<===> forward_into_use/_used.scss +in-used {a: b} + +<===> forward_into_use/output.css +in-used, in-input { + a: b; +} + +<===> +================================================================================ +<===> forward_into_import/input.scss +@use "midstream"; + +in-input {@extend in-imported} + +<===> forward_into_import/_midstream.scss +@forward "forwarded"; + +<===> forward_into_import/_forwarded.scss +@import "imported"; + +<===> forward_into_import/_imported.scss +in-imported {a: b} + +<===> forward_into_import/output.css +in-imported, in-input { + a: b; +} diff --git a/spec/directives/forward/member/as.hrx b/spec/directives/forward/member/as.hrx new file mode 100644 index 0000000000..f0277e1cf3 --- /dev/null +++ b/spec/directives/forward/member/as.hrx @@ -0,0 +1,171 @@ +<===> variable_use/input.scss +@use "midstream"; + +a {b: $midstream.d-c} + +<===> variable_use/_midstream.scss +@forward "upstream" as d-*; + +<===> variable_use/_upstream.scss +$c: e; + +<===> variable_use/output.css +a { + b: e; +} + +<===> +================================================================================ +<===> variable_assignment/top_level/input.scss +@use "midstream"; + +$midstream.d-a: new value; + +b {c: midstream.d-get-a()}; + +<===> variable_assignment/top_level/_midstream.scss +@forward "upstream" as d-*; + +<===> variable_assignment/top_level/_upstream.scss +$a: old value; + +@function get-a() {@return $a} + +<===> variable_assignment/top_level/output.css +b { + c: new value; +} + +<===> +================================================================================ +<===> variable_assignment/nested/input.scss +@use "midstream"; + +a { + // Namespaced assignments always assign to the other module's variable, even + // if they're nested in a block scope. + $midstream.d-b: new value; + + c: midstream.d-get-b(); +} + +<===> variable_assignment/nested/_midstream.scss +@forward "upstream" as d-*; + +<===> variable_assignment/nested/_upstream.scss +$b: old value; + +@function get-b() {@return $b} + +<===> variable_assignment/nested/output.css +a { + c: new value; +} + +<===> +================================================================================ +<===> function/input.scss +@use "midstream"; + +a {b: midstream.d-c()} + +<===> function/_midstream.scss +@forward "upstream" as d-*; + +<===> function/_upstream.scss +@function c() {@return e} + +<===> function/output.css +a { + b: e; +} + +<===> +================================================================================ +<===> mixin/input.scss +@use "midstream"; + +@include midstream.b-a; + +<===> mixin/_midstream.scss +@forward "upstream" as b-*; + +<===> mixin/_upstream.scss +@mixin a() {c {d: e}} + +<===> mixin/output.css +c { + d: e; +} + +<===> +================================================================================ +<===> different_separator/input.scss +@use "midstream"; + +a {b: $midstream.d-c} + +<===> different_separator/_midstream.scss +@forward "upstream" as d_*; + +<===> different_separator/_upstream.scss +$c: e; + +<===> different_separator/output.css +a { + b: e; +} + +<===> +================================================================================ +<===> show/same_separator/input.scss +@use "midstream"; + +@include midstream.b-a; + +<===> show/same_separator/_midstream.scss +@forward "upstream" as b-* show b-a; + +<===> show/same_separator/_upstream.scss +@mixin a() {c {d: e}} + +<===> show/same_separator/output.css +c { + d: e; +} + +<===> +================================================================================ +<===> show/different_separator/input.scss +@use "midstream"; + +@include midstream.b-a; + +<===> show/different_separator/_midstream.scss +@forward "upstream" as b-* show b_a; + +<===> show/different_separator/_upstream.scss +@mixin a() {c {d: e}} + +<===> show/different_separator/output.css +c { + d: e; +} + +<===> +================================================================================ +<===> hide/input.scss +@use "midstream"; + +@include midstream.b-a; + +<===> hide/_midstream.scss +@forward "upstream" as b-* hide a; + +<===> hide/_upstream.scss +@mixin a() {c {d: e}} + +<===> hide/output.css +c { + d: e; +} diff --git a/spec/directives/forward/member/bare.hrx b/spec/directives/forward/member/bare.hrx new file mode 100644 index 0000000000..620a526e06 --- /dev/null +++ b/spec/directives/forward/member/bare.hrx @@ -0,0 +1,99 @@ +<===> variable_use/input.scss +@use "midstream"; + +a {b: $midstream.c} + +<===> variable_use/_midstream.scss +@forward "upstream"; + +<===> variable_use/_upstream.scss +$c: d; + +<===> variable_use/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> variable_assignment/top_level/input.scss +@use "midstream"; + +$midstream.a: new value; + +b {c: midstream.get-a()}; + +<===> variable_assignment/top_level/_midstream.scss +@forward "upstream"; + +<===> variable_assignment/top_level/_upstream.scss +$a: old value; + +@function get-a() {@return $a} + +<===> variable_assignment/top_level/output.css +b { + c: new value; +} + +<===> +================================================================================ +<===> variable_assignment/nested/input.scss +@use "midstream"; + +a { + // Namespaced assignments always assign to the other module's variable, even + // if they're nested in a block scope. + $midstream.b: new value; + + c: midstream.get-b(); +} + +<===> variable_assignment/nested/_midstream.scss +@forward "upstream"; + +<===> variable_assignment/nested/_upstream.scss +$b: old value; + +@function get-b() {@return $b} + +<===> variable_assignment/nested/output.css +a { + c: new value; +} + +<===> +================================================================================ +<===> function/input.scss +@use "midstream"; + +a {b: midstream.c()} + +<===> function/_midstream.scss +@forward "upstream"; + +<===> function/_upstream.scss +@function c() {@return d} + +<===> function/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> mixin/input.scss +@use "midstream"; + +@include midstream.a; + +<===> mixin/_midstream.scss +@forward "upstream"; + +<===> mixin/_upstream.scss +@mixin a() {b {c: d}} + +<===> mixin/output.css +b { + c: d; +} diff --git a/spec/directives/forward/member/import.hrx b/spec/directives/forward/member/import.hrx new file mode 100644 index 0000000000..d94d506b4a --- /dev/null +++ b/spec/directives/forward/member/import.hrx @@ -0,0 +1,144 @@ +<===> precedence/input.scss +// Forwarded definitions take precedence over local definitions through imports, +// to match the behavior of definitions written directly in the imported file. +$a: in-input; + +@import "midstream"; + +b {c: $a} + +<===> precedence/_midstream.scss +@forward "upstream"; + +<===> precedence/_upstream.scss +$a: in-upstream; + +<===> precedence/output.css +b { + c: in-upstream; +} + +<===> +================================================================================ +<===> forward_to_import/mixin/input.scss +@use "used"; + +@include used.a; + +<===> forward_to_import/mixin/_used.scss +@forward "forwarded"; + +<===> forward_to_import/mixin/_forwarded.scss +@import "imported"; + +<===> forward_to_import/mixin/_imported.scss +@mixin a() {b {c: d}} + +<===> forward_to_import/mixin/output.css +b { + c: d; +} + +<===> +================================================================================ +<===> forward_to_import/variable_assignment/input.scss +@use "used"; + +$used.a: new value; + +b {c: used.get-a()}; + +<===> forward_to_import/variable_assignment/_used.scss +@forward "forwarded"; + +<===> forward_to_import/variable_assignment/_forwarded.scss +@import "imported"; + +<===> forward_to_import/variable_assignment/_imported.scss +$a: old value; + +@function get-a() {@return $a} + +<===> forward_to_import/variable_assignment/output.css +b { + c: new value; +} + +<===> +================================================================================ +<===> forward_to_import/variable_use/input.scss +@use "used"; + +a {b: $used.c} + +<===> forward_to_import/variable_use/_used.scss +@forward "forwarded"; + +<===> forward_to_import/variable_use/_forwarded.scss +@import "imported"; + +<===> forward_to_import/variable_use/_imported.scss +$c: d; + +<===> forward_to_import/variable_use/output.css +a { + b: d; +} + +<===> +================================================================================ +<===> import_to_forward/mixin/input.scss +@import "midstream"; + +@include a; + +<===> import_to_forward/mixin/_midstream.scss +@forward "upstream"; + +<===> import_to_forward/mixin/_upstream.scss +@mixin a() {b {c: d}} + +<===> import_to_forward/mixin/output.css +b { + c: d; +} + +<===> +================================================================================ +<===> import_to_forward/variable_assignment/input.scss +@import "midstream"; + +$a: new value; + +b {c: get-a()}; + +<===> import_to_forward/variable_assignment/_midstream.scss +@forward "upstream"; + +<===> import_to_forward/variable_assignment/_upstream.scss +$a: old value; + +@function get-a() {@return $a} + +<===> import_to_forward/variable_assignment/output.css +b { + c: new value; +} + +<===> +================================================================================ +<===> import_to_forward/variable_use/input.scss +@import "midstream"; + +a {b: $c} + +<===> import_to_forward/variable_use/_midstream.scss +@forward "upstream"; + +<===> import_to_forward/variable_use/_upstream.scss +$c: d; + +<===> import_to_forward/variable_use/output.css +a { + b: d; +} diff --git a/spec/directives/forward/member/shadowed.hrx b/spec/directives/forward/member/shadowed.hrx new file mode 100644 index 0000000000..4215a2ccbb --- /dev/null +++ b/spec/directives/forward/member/shadowed.hrx @@ -0,0 +1,87 @@ +<===> variable_use/input.scss +@use "midstream"; + +a {b: $midstream.c} + +<===> variable_use/_midstream.scss +@forward "upstream"; + +$c: midstream; + +<===> variable_use/_upstream.scss +$c: upstream; + +<===> variable_use/output.css +a { + b: midstream; +} + +<===> +================================================================================ +<===> variable_assignment/top_level/input.scss +@use "midstream"; + +$midstream.a: new value; + +b { + midstream: midstream.get-midstream-a(); + upstream: midstream.get-upstream-a(); +}; + +<===> variable_assignment/top_level/_midstream.scss +@forward "upstream"; + +$a: midstream value; + +@function get-midstream-a() {@return $a} + +<===> variable_assignment/top_level/_upstream.scss +$a: upstream value; + +@function get-upstream-a() {@return $a} + +<===> variable_assignment/top_level/output.css +b { + midstream: midstream value; + upstream: new value; +} + +<===> +================================================================================ +<===> function/input.scss +@use "midstream"; + +a {b: midstream.c()} + +<===> function/_midstream.scss +@forward "upstream"; + +@function c() {@return midstream} + +<===> function/_upstream.scss +@function c() {@return upstream} + +<===> function/output.css +a { + b: midstream; +} + +<===> +================================================================================ +<===> mixin/input.scss +@use "midstream"; + +@include midstream.a; + +<===> mixin/_midstream.scss +@forward "upstream"; + +@mixin a() {b {c: midstream}} + +<===> mixin/_upstream.scss +@mixin a() {b {c: upstream}} + +<===> mixin/output.css +b { + c: midstream; +} diff --git a/spec/directives/forward/member/visibility.hrx b/spec/directives/forward/member/visibility.hrx new file mode 100644 index 0000000000..ebb3213049 --- /dev/null +++ b/spec/directives/forward/member/visibility.hrx @@ -0,0 +1,149 @@ +<===> hide/mixin/_midstream.scss +@forward "upstream" hide b; + +<===> hide/mixin/_upstream.scss +@mixin a() {c {d: e}} + +<===> +================================================================================ +<===> hide/mixin/input.scss +@use "midstream"; + +@include midstream.a; + +<===> hide/mixin/output.css +c { + d: e; +} + +<===> hide/variable_assignment/_midstream.scss +@forward "upstream" hide d; + +<===> hide/variable_assignment/_upstream.scss +$a: old value; + +@function get-a() {@return $a} + +<===> +================================================================================ +<===> hide/variable_assignment/input.scss +@use "midstream"; + +$midstream.a: new value; + +b {c: midstream.get-a()}; + +<===> hide/variable_assignment/output.css +b { + c: new value; +} + +<===> hide/variable_use/_midstream.scss +@forward "upstream" hide d; + +<===> hide/variable_use/_upstream.scss +$c: e; + +<===> hide/variable_use/input.scss +@use "midstream"; + +a {b: $midstream.c} + +<===> hide/variable_use/output.css +a { + b: e; +} + +<===> hide/wrong_type/mixin/_midstream.scss +@forward "upstream" hide $a; + +<===> hide/wrong_type/mixin/_upstream.scss +@mixin a() {c {d: e}} + +<===> +================================================================================ +<===> hide/wrong_type/mixin/input.scss +@use "midstream"; + +@include midstream.a; + +<===> hide/wrong_type/mixin/output.css +c { + d: e; +} + +<===> hide/wrong_type/variable_use/_midstream.scss +@forward "upstream" hide c; + +<===> hide/wrong_type/variable_use/_upstream.scss +$c: e; + +<===> +================================================================================ +<===> hide/wrong_type/variable_use/input.scss +@use "midstream"; + +a {b: $midstream.c} + +<===> hide/wrong_type/variable_use/output.css +a { + b: e; +} + +<===> +================================================================================ +<===> show/mixin/_midstream.scss +@forward "upstream" show a; + +<===> show/mixin/_upstream.scss +@mixin a() {b {c: d}} + +<===> +================================================================================ +<===> show/mixin/input.scss +@use "midstream"; + +@include midstream.a; + +<===> show/mixin/output.css +b { + c: d; +} + +<===> show/variable_assignment/_midstream.scss +@forward "upstream" show $a, get-a; + +<===> show/variable_assignment/_upstream.scss +$a: old value; + +@function get-a() {@return $a} + +<===> +================================================================================ +<===> show/variable_assignment/input.scss +@use "midstream"; + +$midstream.a: new value; + +b {c: midstream.get-a()}; + +<===> show/variable_assignment/output.css +b { + c: new value; +} + +<===> show/variable_use/_midstream.scss +@forward "upstream" show $c; + +<===> show/variable_use/_upstream.scss +$c: d; + +<===> show/variable_use/input.scss +@use "midstream"; + +a {b: $midstream.c} + +<===> show/variable_use/output.css +a { + b: d; +} diff --git a/spec/directives/forward/options.yml b/spec/directives/forward/options.yml new file mode 100644 index 0000000000..7152963953 --- /dev/null +++ b/spec/directives/forward/options.yml @@ -0,0 +1,3 @@ +--- +:todo: +- libsass # sass/libsass#2807