-
-
Notifications
You must be signed in to change notification settings - Fork 4.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
Version info thingy #8761
Version info thingy #8761
Conversation
import { VERSION } from '../shared/version'; | ||
|
||
// @ts-ignore | ||
if (typeof window !== undefined) (window.__svelte || (window.__svelte = {})).version = VERSION; |
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.
should we be paranoid here and don't do anything at all if window.__svelte
is already defined? We might override sth else here. Opposite of that: Do we want to support that multiple versions could exist on one through a set? Right now last one wins, with my proposal first one wins. I'm probably in favor of keeping it simple and not do that
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.
Good question. @Rich-Harris had suggested multiple version in an array originally: #8636
Multiple versions is more powerful though I suspect it'd be rarely used
I don't know if there's any difference between first one wins and last one wins
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.
Needs a changeset, but otherwise looks good to me
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
packages/svelte/test/helpers.js
Outdated
@@ -134,6 +134,10 @@ export function create_loader(compileOptions, cwd) { | |||
resolved = `${svelte_path}src/runtime/index.js`; | |||
} | |||
|
|||
if (id === 'svelte/internal/tag-version') { |
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.
perhaps this should be called disclose-version
to match the option name
My personal opinion is that we should expose only the major version. We can already get stats for full versions on https://www.npmjs.com/package/svelte?activeTab=versions, so including the full version doesn't provide much benefit since we don't need it for getting stats about which versions are more used. While hiding the full version doesn't make a site secure, it will add a bit more work for attackers who want to go after vulnerabilities at scale. |
just FYI @gtm-nayan, it looks like the test failure is a real one |
Fixed, thanks for the heads up. |
Closes #8636
HEADS UP: BIG RESTRUCTURING UNDERWAY
The Svelte repo is currently in the process of heavy restructuring for Svelte 4. After that, work on Svelte 5 will likely change a lot on the compiler aswell. For that reason, please don't open PRs that are large in scope, touch more than a couple of files etc. In other words, bug fixes are fine, but feature PRs will likely not be merged.
Before submitting the PR, please make sure you do the following
feat:
,fix:
,chore:
, ordocs:
.Tests
npm test
and lint the project withnpm run lint