Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Safeguard the caching of Babel transpilations by disallowing .babelrc… - #8182

Merged
thomasjo merged 1 commit into
masterfrom
bf-disable-babelrc
Aug 3, 2015
Merged

thomasjo merged 1 commit into
masterfrom
bf-disable-babelrc

Conversation

@bolinfest

Copy link
Copy Markdown
Contributor

… files.

Also update the version of Babel to pick up a JSON-parsing fix. This was an
issue that was discovered in the course of seeing how reading .babelrc files
would interact badly with Atom's Babel cache.

/cc @sebmck

… files.

Also update the version of Babel to pick up a JSON-parsing fix. This was an
issue that was discovered in the course of seeing how reading .babelrc files
would interact badly with Atom's Babel cache.

/cc @sebmck
@sebmck

sebmck commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

Yeah, this seems like an appropriate patch. Although I'm not sure how widespread the usage of Babel is in the atom community but this would be a breaking change for those relying on .babelrc files. In the next major all the transformers are going to be optional which means that specifying Babel configuration is going to be critical, not sure if there's some way to specify that currently to the Atom compiler.

@thomasjo

thomasjo commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

There's not that much usage of Babel yet, and I doubt many (if any) use .babelrc files. I can grab all packages and check. If there's no usage of it, I'll 🚢 this if that's OK with you @bolinfest?

@bolinfest

Copy link
Copy Markdown
Contributor Author

Sounds great -- thanks @thomasjo!

@sebmck

sebmck commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

@thomasjo Sounds good to me. I don't really mind what happens, flagging it just in case it's an issue 😊

@thomasjo

thomasjo commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

Here's the list of packages that has a .babelrc file in the root of their repo

format
hyperclick
nuclide-arcanist
nuclide-code-format
nuclide-diagnostics-store
nuclide-diagnostics-ui
nuclide-diff-view
nuclide-file-tree
nuclide-file-watcher
nuclide-find-references
nuclide-flow
nuclide-hack
nuclide-hg-repository
nuclide-installer
nuclide-language-hack
nuclide-ocaml
nuclide-quick-open
nuclide-remote-projects
nuclide-type-hint
zephir-ide

@bolinfest I guess we can ignore the nuclide packages from that list?

@bolinfest

Copy link
Copy Markdown
Contributor Author

@thomasjo Yes, all of the nuclide- and hyperclick since that's us, too.

@thomasjo

thomasjo commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

I don't know that much about Babel (yet), so I'm listing the contents of the two remaining .babelrc files;
(1) zephir-ide:

{
  "stage": 0,
  "loose": true,
  "sourceMap": "inline",
  "blacklist": [
    "es6.classes"
  ]
}

(2) format:

{
  "stage": 2,
  "loose": true
}

Would it be problematic for those packages if we ship this PR?

@sebmck

sebmck commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

They're very likely using experimental syntax that is enabled via the stage option which would break them.

@thomasjo

thomasjo commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

They're very likely using experimental syntax that is enabled via the stage option which would break them.

We are using stage: 0 by default though. Looks like the only problem for zephir-ide is the blacklisting of es6.classes (unless I'm misunderstanding the implication of stage).

@bolinfest

Copy link
Copy Markdown
Contributor Author

Hold up @sebmck, here are the options that are used in Atom today:

https://github.com/atom/atom/blob/master/src/babel.coffee

So for zephir-ide:

For format

  • stage: 0 means that stage: 2 should be supported
  • Again, I don't know about loose.

@sebmck

sebmck commented Aug 3, 2015

Copy link
Copy Markdown
Contributor

Ah my bad, I talked out of turn. Those other options are fine then.

ES6 classes are working natively in the version of io.js that is bundled with Atom, then we should include it in the blacklist

This will break decorators and class properties which rely on the class desugaring.

@bolinfest

Copy link
Copy Markdown
Contributor Author

@sebmck Ah, good to know about es6.classes. I guess we'll hold off on that then.

@thomasjo It sounds like we're good to go! Without this fix, any file that is bundled in Atom.app with 'use babel' will fail spectacularly and hilariously. (The problem won't manifest in development, however.) This is why we had to introduce facebookarchive/nuclide@6bbe3f4 as a stopgap.

thomasjo added a commit that referenced this pull request Aug 3, 2015
Safeguard the caching of Babel transpilations by disallowing .babelrc…
@thomasjo
thomasjo merged commit 71383fe into master Aug 3, 2015
@thomasjo
thomasjo deleted the bf-disable-babelrc branch August 3, 2015 20:24
@benogle benogle mentioned this pull request Aug 3, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants