Expand Support for Eliding Resources at Build Time #94
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type: feature
The following has been addressed in the PR:
prettier
as per the readme code style guidelinesDescription:
Extend static
has
build time processing to support additional scenarios such asimport
.Support for template literals
For applications that are not built in legacy mode, template literals are not down emitted therefore need to be supported when detecting the static
has
pragma`has('flag')`
Support for
require
with a variable declarationWhen an
require
contains a variable declaration, it should be elided.The variable declaration is replaced with an undefined variable:
Support for
import
syntaxApplications not built in
legacy
mode will not down emit theimport
syntax but should be supported.For imports that returns a declaration (either default or named), replaces import with an undefined var:
Is transformed to:
Has Flag Logic
Inverted the logic used by the static has processor to include the next import then the has check resolves as to true, this is more natural and reads like you would expect.
Previously this would have elided the
foo
import, however logically the statement appears to indicate that ifinclude-foo
is true then it should import foo. Meaning that thehas
pragma should be negated to elide the import, i.e. only for cases where foo does not exist.Consolidation of feature sets
We only leverage a single feature (currently
chrome
) set that describes modern browsers, therefore we can normalise this to a singlemodern
feature set.Related to dojo/framework#183