-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Add babel-preset-env 2.0 support. Controll version/build from the circle. #1415
Conversation
Deploy preview for babel ready! Built with commit 1b935a1 |
Seems like netlify preview breaks down with new commits after the first successful build. |
js/repl/PluginConfig.js
Outdated
const envPresetConfig: PluginConfig = { | ||
label: "Env Preset", | ||
package: "babel-preset-env-standalone", | ||
version: "0", | ||
version: "2.0.0-beta.2", |
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 default this to 1.x since we default to Babel 6.x?
@existentialism Updated: |
Changed status to WIP, because we need to land babel/babel#6438 firstly and then fit it there. |
# Conflicts: # js/repl/Repl.js # js/repl/ReplOptions.js # js/repl/Worker.js # js/repl/WorkerApi.js # js/repl/loadBabel.js # js/repl/types.js
Seems like it's ready. It works with babel-preset-env 2.0 betas and with circleci builds. So after each PR into The only thing is that I need to test |
js/repl/loadBundle.js
Outdated
(semver.valid(version) && semver.gte(version, "7.0.0-beta.4")) || | ||
version >= 7 | ||
? "@babel/standalone" |
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.
my thoughts: I kinda feel like it's easier to read/maintain with hardcoding this stuff? If we rename or anything like that I'm not sure I'd know where to look in this codebase with so much indirection? And in this case we can't substitute babel-standalone env in the same way because it won't be published until beta.33 not beta.4
We actually discussed about that a few months ago (Rich-Harris/packd#27) but I forgot about it. Your point is still valid, I agree. I will work on it when I get a chance. |
# Conflicts: # _data/users.yml # js/repl/CircleCI.js # js/repl/PluginConfig.js # js/repl/Repl.js # js/repl/ReplOptions.js # js/repl/compile.js # js/repl/replUtils.js # js/repl/types.js
Sorry I haven't followed this PR so much, what is the status of babel-standalone having the incorrect version of Babel? |
@xtuc We can fix only publishing process, but it won't fully solve the problem because all versions published before this fix to npm will still return the previous version. I've created PR for the website, which disables version overriding: #1488 |
This PR isn't blocked by this bug because it's already present on the https://babeljs.io |
js/repl/PluginConfig.js
Outdated
|
||
const stage3Plugins: Array<PluginConfig> = [ | ||
"proposal-async-generator-functions", | ||
// "proposal-object-rest-spread", |
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.
oops, I probably confused you, but I meant to say that we should add a comment describing why we need stage3Plugins
(i.e. proposal-async-generator-functions not available >= beta.36)
js/repl/PluginConfig.js
Outdated
@@ -58,20 +112,26 @@ const replDefaults: ReplState = { | |||
isPresetsTabExpanded: false, | |||
isSettingsTabExpanded: true, | |||
lineWrap: true, | |||
presets: "es2015,react,stage-2", |
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.
Nit: why was this moved? I kinda prefer this being alpha sorted :) (no big deal)
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.
Oh, I just merged crookedly. Will fix, thanks :)
code: persistedState.code, | ||
compiled: null, | ||
compileErrorMessage: null, | ||
debugEnvPreset: persistedState.debug, | ||
envConfig, | ||
envPresetDebugInfo: null, | ||
envPresetState: configToState( | ||
envPresetState: persistedStateToEnvState( |
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.
Not a blocker, but we should step back and re-think/clean up the state shape now that we have all a number of things that may or may not be loaded and depending on version, etc
js/repl/ReplOptions.js
Outdated
<a | ||
className={className} | ||
target="_blank" | ||
href={`https://github.com/babel/babel/tree/master/experimental/babel-preset-env#${section}`} |
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.
This link needs updating
js/repl/ReplOptions.js
Outdated
this.props.onEnvPresetSettingChange("electron", event.target.value); | ||
}; | ||
|
||
_onShippedProposalsChange = (event: SyntheticInputEvent) => { |
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.
Nit: we could replace these with something more generic for the checkboxes:
_onEnvSettingChange = (event: SyntheticInputEvent) => {
this.props.onEnvPresetSettingChange(event.target.name, event.target.checked)
}
import { BabelState } from "./types"; | ||
import WorkerApi from "./WorkerApi"; | ||
|
||
const SCOPED_CORE_VERSION_FROM = "7.0.0-beta.4"; |
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.
The things we do to ourselves :)
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.
aha exactly!
@existentialism Thanks for the review! 🎉 |
Since we've moved babel-preset-env to the original repo and going to move babel-preset-env-standalone, we can take the same advantage like we're used with babel-standalone.
This PR:
envVersion
query param for babel-preset-env version, so /#?envVersion=2.0.0-beta.2 will use it for the repl.usage
/entry
🚧 I've disabled
debug
option unless onPresetBuild support will be merged. I'll move PR to the monorepo today.The next steps: