Skip to content

Commit

Permalink
feat: New plugin, new decorator version.
Browse files Browse the repository at this point in the history
Updated to latest babel (7.21).
Added new plugin '@babel/plugin-proposal-regexp-modifiers'.
Breaking: Updated decorators plugin to use latest draft (2023-01).

Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
  • Loading branch information
Johannestegner committed Feb 27, 2023
1 parent b47bdd5 commit 343b914
Show file tree
Hide file tree
Showing 5 changed files with 222 additions and 262 deletions.
75 changes: 0 additions & 75 deletions CHANGELOG.md

This file was deleted.

7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Includes the following presets and plugins:
@babel/plugin-transform-object-assign
@babel/plugin-transform-runtime
@babel/runtime-corejs3
@babel/plugin-proposal-regexp-modifiers
```

Requires `corejs (v 3+)` and `@babel/core`.
Expand All @@ -45,7 +46,7 @@ Other than those, the following options are possible to use:
* `polyfill` (defaults to false)
* `polyfillModuleName` (defaults to peerDependency `@bloomberg/record-tuple-polyfill`)
* `decorators`
* `version` (defaults to `2022-03`)
* `version` (defaults to `2023-01`)
* `pipeline`
* `poposal` (defaults to `hack`)
* `topicToken` (defaults to `^^`)
Expand All @@ -59,11 +60,15 @@ The following values are checked with a `indexOf` check:
```
preset-env => @babel/preset-env
decorators => @babel/plugin-proposal-decorators
transform-runtime => @babel/plugin-transform-runtime
partial-application => @babel/plugin-proposal-partial-application
throw-expressions => @babel/plugin-proposal-throw-expressions
async-do-expressions => @babel/plugin-proposal-async-do-expressions
function-bind => @babel/plugin-proposal-function-bind
pipeline-operator => @babel/plugin-proposal-pipeline-operator
record-and-tuple => @babel/plugin-proposal-record-and-tuple
duplicate-named-capturing-groups-regex => @babel/plugin-proposal-duplicate-named-capturing-groups-regex
export-default-from => @babel/plugin-proposal-export-default-from
object-assign => @babel/plugin-transform-object-assign
regexp-modifiers => @babel/plugin-proposal-regexp-modifiers
```
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = declare((api, options) => {
pipeline: {},
recordAndTuple: {},
...options,
}
};

const presetOptions = {
useBuiltIns: setOr(opts.useBuiltIns, 'entry'),
Expand Down Expand Up @@ -58,7 +58,7 @@ module.exports = declare((api, options) => {
plugins: [
isNotExcluded('decorators', () => [
require('@babel/plugin-proposal-decorators'), {
version: setOr(opts.decorators.version, '2022-03'),
version: setOr(opts.decorators.version, '2023-01'),
}
]),
isNotExcluded('transform-runtime', () => [
Expand Down Expand Up @@ -101,7 +101,9 @@ module.exports = declare((api, options) => {
isNotExcluded('object-assign', () =>
require('@babel/plugin-transform-object-assign')),
isNotExcluded('duplicate-named-capturing-groups-regex', () =>
require('@babel/plugin-proposal-duplicate-named-capturing-groups-regex'))
require('@babel/plugin-proposal-duplicate-named-capturing-groups-regex')),
isNotExcluded('regexp-modifiers', () =>
require('@babel/plugin-proposal-regexp-modifiers'))
].filter(p => p !== null)
};
});
Loading

0 comments on commit 343b914

Please sign in to comment.