Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upExtract targets parser and compat data from preset-env #10899
Conversation
This comment has been minimized.
This comment has been minimized.
|
I swear at this point we should just append a random UUID to every filename except |
This comment has been minimized.
This comment has been minimized.
|
Did you see #10850? |
This comment has been minimized.
This comment has been minimized.
|
Hah, nope! Had no idea that was a thing Node allowed! |
b842a7c
to
fad046a
| @@ -7,7 +7,7 @@ const flattenDeep = require("lodash/flattenDeep"); | |||
| const isEqual = require("lodash/isEqual"); | |||
| const mapValues = require("lodash/mapValues"); | |||
| const pickBy = require("lodash/pickBy"); | |||
| const unreleasedLabels = require("../data/unreleased-labels"); | |||
| const { unreleasedLabels } = require("../../babel-helper-compilation-targets"); | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nicolo-ribaudo
Jan 8, 2020
Author
Member
Good catch; I'll update it. Note that this file isn't published to npm so it isn't a problem, but using @babel/helper-compilation-targets is more clear.
| "version": "0.0.0", | ||
| "author": "The Babel Team (https://babeljs.io/team)", | ||
| "license": "MIT", | ||
| "description": "", |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Any reason to not also move In fact, erring on the side of less packages to maintain, can we just have one package that exports isRequired(
name: string,
targetEnvironments: Targets,
options: {
compatData?: { [key in string]: Targets }
// ...
}
) { ... }This seems like a key use-case (as both vue/ember use it), and would allow anyone to pass their own mappings in, if they wanted. |
This comment has been minimized.
This comment has been minimized.
Maybe I forgot it, I'll check.
I don't think that this should be a goal? The maintenance cost of 2 packages in a monorepo is exactly the same as 1 package. I created two separate packages because, if we are going to disable sub-package imports in Babel 8.0.0, |
| import type { Targets } from "./types"; | ||
| import { isUnreleasedVersion, semverify } from "./utils"; | ||
|
|
||
| export function isItemRequired(supportedEnvironments: Targets, item: Targets) { |
This comment has been minimized.
This comment has been minimized.
nicolo-ribaudo
Jan 8, 2020
Author
Member
Oh, I already extracted it. I called it isItemRequired because it's not just used for plugins, but also for polyfills. Maybe I should choose another name?
This comment has been minimized.
This comment has been minimized.
457871b
to
ef4edea
This comment has been minimized.
This comment has been minimized.
|
Whops I accidentally deleted my comment. I wrote that I agree that the proposed Also, do you think that |
This comment has been minimized.
This comment has been minimized.
I'm not sure I agree with that... perhaps mechanically, but I think we should always consider the balance between a package's public API vs. adding more packages.
I think we can go with just plugins data for now. |
06652c9
to
58d6106
This comment has been minimized.
This comment has been minimized.
|
@existentialism I ended up not exporting |
58d6106
to
4fd4151
It was moved in babel#10899. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
It was moved in babel#10899. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
It was moved in babel/babel#10899. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
…bel 8 See babel/babel#10746 babel/babel#10899
…abel 8 (#5133) * refactor: use babel.loadPartialConfigSync (added in babel 7.8) As planned in babel/babel#10746, in babel 8 the old `loadPartialConfig` can't be used synchronously. * refactor: remove dependence on internal babel files, preparing for babel 8 See babel/babel#10746 babel/babel#10899
nicolo-ribaudo commentedDec 20, 2019
This is PR only moves code around, to expose as public packages internal API which are already used by some Babel integrations:
Otherwise, they will have problems in Babel 8 with #10850.
I created two new packages:
@babel/compat-dataand@babel/helper-compilation-targets.I wasn't sure about where to put the info about overlapping plugins which will be useful for
preset-modules(I put it in@babel/compat-data) and about the mappings from transform plugins to syntax plugins (I left it in@babel/preset-env).