-
Notifications
You must be signed in to change notification settings - Fork 192
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
[REFACTOR] Extract environment variables into global context #1138
Conversation
{ | ||
"name": "@glimmer/global-context", | ||
"version": "0.58.0", | ||
"repository": "https://github.com/glimmerjs/glimmer-vm/tree/master/packages/@glimmer/global-context", |
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.
We should update these (in a future PR) to something like:
{
"repository": {
"type" : "git",
"url" : "https://github.com/glimmerjs/glimmer-vm.git",
"directory": "packages/@glimmer/global-context"
}
}
https://docs.npmjs.com/configuring-npm/package-json.html#repository
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 move the global revision stuff here? It seems very much in the same vein, though maybe we don't want to have to call a method to bump so might not want to move it...
- Should we add a validation similar to the one we added to
@glimmer/validations
to prevent loading the module two times? Seems like@glimmer/global-context
has much the same constraints as that one does... - Can you do a benchmark to confirm this doesn't have problems? (I suspect it will actually be somewhat beneficial, but good to confirm)
910635e
to
79ff403
Compare
valueForTag(tag1); | ||
dirtyTag(tag3); | ||
valueForTag(tag1); | ||
// let tag1 = createUpdatableTag(); |
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.
These comments should either be brought back or deleted.
There are a number of environment variables that are currently threaded through glimmer that are: 1. Only environment variables for compatibility reasons (e.g. legacy Ember compat) 2. Never expected to change over the lifetime of an append 3. Never expected to differ between different apps or render trees in the same context. This PR consolidates these into a single global context, exported from `@glimmer/global-context`, which is set once by the embedding environment before rendering. It also upstreams the logic for `protocolForUrl`, which was not specific to Ember, and simplifies the `attributeFor` logic to be as minimal as possible an interface for Ember.
e9c5581
to
47142cc
Compare
Benchmark shows no significant change: |
There are a number of environment variables that are currently threaded
through glimmer that are:
Ember compat)
the same context.
This PR consolidates these into a single global context, exported from
@glimmer/global-context
, which is set once by the embeddingenvironment before rendering. It also upstreams the logic for
protocolForUrl
, which was not specific to Ember, and simplifiesthe
attributeFor
logic to be as minimal as possible an interface forEmber.