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
Remove lodash deps #13057
Remove lodash deps #13057
Conversation
sourceType: "script", | ||
babelrc: false, | ||
inputSourceMap: task.inputSourceMap || undefined, | ||
...opts, |
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.
It doesn't seem like we'd need to deep merge any of the options above so should be equivalent (or are all primitives)
@@ -23,7 +22,9 @@ export default function builder<T extends t.Node>( | |||
|
|||
let arg; | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can just throw if Array.isArray(def) ? def.length > 0 : def && typeof def === "object"
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.
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:
|
@@ -33,6 +32,10 @@ export default valueToNode as { | |||
(value: unknown): t.Expression; | |||
}; | |||
|
|||
function isRegExp(value): boolean { |
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.
function isRegExp(value): boolean { | |
function isRegExp(value): value is RegExp { |
Gulpfile.mjs
Outdated
@@ -162,7 +162,9 @@ function generateStandalone() { | |||
let allList = ""; | |||
|
|||
for (const plugin of pluginConfig) { | |||
const camelPlugin = camelCase(plugin); | |||
const camelPlugin = plugin.replace(/-([a-z])/g, c => |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"escape-string-regexp": "condition:BABEL_8_BREAKING ? ^4.0.0 : ", |
Can remove this as well now since you removed the file that uses it
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.
good catch thanks!!
"use strict"; | ||
|
||
module.exports = process.env.BABEL_8_BREAKING | ||
? require("escape-string-regexp") |
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.
Same here
@@ -244,7 +246,7 @@ fs.readdirSync(fixtureLoc).forEach(function (binName) { | |||
|
|||
delete taskOpts.os; | |||
} | |||
merge(opts, taskOpts); | |||
opts = { args: [], ...taskOpts }; |
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.
Changed this merge too (the only thing replaced is args, which is always set in our tests given it's babel-cli)
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.
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