-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Astro.resolve #1085
Astro.resolve #1085
Conversation
This pull request is being automatically deployed with Vercel (learn more). astro-www – ./www🔍 Inspect: https://vercel.com/pikapkg/astro-www/B73eneqzciAAmDDpxKpXX8e96ugv [Deployment for 9fc2aad canceled] astro-docs – ./docs🔍 Inspect: https://vercel.com/pikapkg/astro-docs/9ndL4qAnqudzxRMka9BdnJrVDvYR |
🦋 Changeset detectedLatest commit: 9fc2aad The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! A few comments.
result[attr.name] = JSON.stringify(getTextFromAttribute(val)); | ||
case 'Text': { | ||
let text = getTextFromAttribute(val); | ||
warnIfRelativeStringLiteral(nodeName, attr, text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth calling out—if we're warning for every relative string literal, does the user have a way to say "Don't warn me, I know what I'm doing?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not... why wouldn't we just automatically run Astro.resolve
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great points! First, this should definitely be using the logger so users log level choice gets honored.
Also, I should probably soften the language a little so it doesn't come across like an error. I definitely feel the annoyance of getting a warning repeatedly for something that you did on purpose. Any suggestions here? Would a link to docs be less annoying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've updated this to use the logger so you can turn it off the same way you can turn off other warnings. I don't think we have a flag to set a specific log level so we should add that in another issue. A way to turn off specific warnings sounds like a nice add as well but I can't think of a great solution to that at the moment (maybe a config file or something)
6b1591a
to
331dfaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
* add: Astro.resolve * Add docs and tests for Astro.resolve * Add warnings when using string literals * Prevent windows errors * Adds a changeset * Use the astro logger to log the warning * Use the .js extension * Dont warn for data urls * Rename nonRelative and better match Co-authored-by: Jonathan Neal <[email protected]>
Closes #310 and #1071
Changes
This adds support for Astro.resolve as described in the #1071 RFC.
Testing
Tests added.
Docs
Docs added.