This commit is contained in:
Alex
2023-08-09 01:38:04 -04:00
parent aeb69e38dc
commit 198c731cbb
8 changed files with 605 additions and 1211 deletions

View File

@ -12,7 +12,6 @@ import type { types as t } from '@babel/core';
import { dependencies } from './dist/package.json';
import { createMacro, type MacroHandler } from 'babel-plugin-macros';
const args = process.argv.slice(2);
const ENV = process.env.NODE_ENV || 'development';
const PROD = ENV === 'production';
@ -81,6 +80,15 @@ const map = new HandlerMap()
.set(
'string.prototype.matchall',
proto(t => t.identifier('matchAll')),
)
.set(
'object.groupby',
replace(t =>
t.memberExpression(
t.callExpression(t.identifier('require'), [t.stringLiteral('lodash')]),
t.identifier('groupBy'),
),
),
);
function replace(getReplacement: (types: typeof t) => t.Expression): MacroHandler {