Conversation
| sourceType: "script", | ||
| babelrc: false, | ||
| inputSourceMap: task.inputSourceMap || undefined, | ||
| ...opts, |
There was a problem hiding this comment.
It doesn't seem like we'd need to deep merge any of the options above so should be equivalent (or are all primitives)
| if (i < countArgs) arg = args[i]; | ||
| if (arg === undefined) arg = loClone(field.default); | ||
| if (arg === undefined) { | ||
| arg = Array.isArray(field.default) ? [] : field.default; |
There was a problem hiding this comment.
We should throw if we see a non-empty array or an object, so that we don't accidentally break this assumption in the future.
There was a problem hiding this comment.
ah right, https://lodash.com/docs/#clone seems complicated, maybe we need to check what we do allow instead then given it could be anything?
so string/boolean/null/[]
There was a problem hiding this comment.
Yeah, we can just throw if Array.isArray(def) ? def.length > 0 : def && typeof def === "object"
There was a problem hiding this comment.
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/44800/ |
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c34d89c:
|
| (value: unknown): t.Expression; | ||
| }; | ||
|
|
||
| function isRegExp(value): boolean { |
There was a problem hiding this comment.
| function isRegExp(value): boolean { | |
| function isRegExp(value): value is RegExp { |
|
|
||
| for (const plugin of pluginConfig) { | ||
| const camelPlugin = camelCase(plugin); | ||
| const camelPlugin = plugin.replace(/-([a-z])/g, c => |
There was a problem hiding this comment.
| const camelPlugin = plugin.replace(/-([a-z])/g, c => | |
| const camelPlugin = plugin.replace(/-[a-z]/g, c => |
I don't think we need the capturing group here
| @@ -20,7 +20,6 @@ | |||
| "@babel/helper-fixtures": "workspace:^7.13.10", | |||
| "babel-check-duplicated-nodes": "^1.0.0", | |||
| "escape-string-regexp": "condition:BABEL_8_BREAKING ? ^4.0.0 : ", | |||
There was a problem hiding this comment.
| "escape-string-regexp": "condition:BABEL_8_BREAKING ? ^4.0.0 : ", |
Can remove this as well now since you removed the file that uses it
| "use strict"; | ||
|
|
||
| module.exports = process.env.BABEL_8_BREAKING | ||
| ? require("escape-string-regexp") |
| delete taskOpts.os; | ||
| } | ||
| merge(opts, taskOpts); | ||
| opts = { args: [], ...taskOpts }; |
There was a problem hiding this comment.
Changed this merge too (the only thing replaced is args, which is always set in our tests given it's babel-cli)
nicolo-ribaudo
left a comment
There was a problem hiding this comment.
Thanks!
I love how "inline some deps" results in "more deleted lines than added lines" 😂
|
hey @hzoo @nicolo-ribaudo, is it expected that last version of Thanks! |

Inlining the function in most cases