Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly support named exports of @value #399

merged 7 commits into from Feb 16, 2018


None yet
1 participant
Copy link

commented Feb 16, 2018

Noticed this when upgrading, the change to export @values alongside classes in #398 caused a bug in my webpack/rollup code to become more obvious.

They were generating code like this:

export var a = ""b"";

since when you write @value a: "b" the literal value of a is "b", and I don't convert that to an unquoted string during the output process. Now it's using JSON.stringify(...) when exporting ALL values, which should be safer.

It may be worth adding support later for stripping the extraneous-seeming quotes off of @values that are solely "quoted strings" but I'm not touching that for now.

tivac added some commits Feb 16, 2018

fix: named exports of string values are broken
Was quoting & not escaping values at all, which creates invalid JS in some cases. Now using `JSON.stringify()` for these values.

WARNING: code like `@value val: "value"` will be `"\"value\""` in JS, I don't want to introduce special handling for it.

@tivac tivac merged commit 166bfb2 into master Feb 16, 2018

1 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build failed
continuous-integration/travis-ci/pr The Travis CI build passed

@tivac tivac deleted the named-export-values branch Feb 16, 2018


This comment has been minimized.

Copy link
Owner Author

commented Feb 16, 2018

Published in 8.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.