[Module System] Properly rename config variables for "@forward as"

Closes #70
This commit is contained in:
Natalie Weizenbaum 2019-02-28 15:58:59 -08:00
parent 9ec3160eac
commit 753bbd8a8d
2 changed files with 21 additions and 3 deletions

View File

@ -35,6 +35,9 @@
to load `foo.scss.import` and `@import "foo"` doesn't try to load
`foo.import/index.scss`.
* Rename configuration variables when they're passed to a forwarded module with
an `AsClause`.
* Only allow top-level members to shadow forwarded members.
* Clean up the way "Forwarding Modules" is invoked.

View File

@ -1059,10 +1059,25 @@ Given a source file `file`, a [configuration](#configuration) `config`, and an
* When a `@forward` rule `rule` is encountered:
* Let `forwarded` be the result of [loading](#loading-modules) the module
with `rule`'s URL and `config`.
* If `rule` has an `AsClause` with identifier `prefix`:
* [Forward `forwarded`](#forwarding-modules) with `file` through `module`.
* Let `rule-config` be an empty configuration.
* For each variable `variable` in `config`:
* If `variable`'s name begins with `prefix`:
* Let `suffix` be the portion of `variable`'s name after `prefix`.
* Add a variable to `rule-config` with the name `suffix` and with the
same value as `variable`.
* Otherwise, let `rule-config` be `config`.
* Let `forwarded` be the result of [loading](#loading-modules) the module with
`rule`'s URL and `rule-config`.
* [Forward `forwarded`](#forwarding-modules) with `file` through `module`.
* When an `@import` rule is encountered,
[import the file](#importing-files) it refers to with `import`.