Skip to content

Commit 320d2c4

Browse files
committed
⬆️ Update core-js-builder and use the exported types instead of our own
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 0616fc7 commit 320d2c4

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
},
4646
"dependencies": {
4747
"browserslist": "^4.21.4",
48-
"core-js-builder": "^3.27.2",
48+
"core-js-builder": "^3.29.0",
4949
"magic-string": "^0.27.0"
5050
},
5151
"devDependencies": {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66

77
export { corejsPlugin } from "./plugin"
8-
export type { CoreJSOptions } from "./plugin"
8+
export type { CoreJSPluginOptions } from "./plugin"

src/plugin.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ import { Plugin } from "rollup"
1010
import builder from "core-js-builder"
1111
import MagicString from "magic-string"
1212

13-
export interface CoreJSOptions {
14-
/** Browserslist or core-js-compat format, if not set then browserslist config is tired to load */
15-
targets?:
16-
| string
17-
| readonly string[]
18-
| Record<string, string | readonly string[]>
13+
type CoreJSOptions = Parameters<typeof builder>[0]
14+
15+
export interface CoreJSPluginOptions {
16+
/** Browserslist or core-js-compat format, if not set then browserslist config is tried to load */
17+
targets?: CoreJSOptions["targets"]
1918
/** CoreJS modules to use, defaults to "core-js/es" */
20-
modules?: string | readonly string[] | readonly RegExp[]
19+
modules?: CoreJSOptions["modules"]
2120
/** CoreJS modules to exclude */
22-
exclude?: string | readonly string[] | readonly RegExp[]
21+
exclude?: CoreJSOptions["exclude"]
2322
/** Add comment with used modules within bundle */
2423
summary?: {
2524
size: boolean
@@ -28,9 +27,9 @@ export interface CoreJSOptions {
2827
}
2928

3029
export function corejsPlugin(
31-
options: CoreJSOptions = { modules: "core-js/es" }
30+
options: CoreJSPluginOptions = { modules: "core-js/es" }
3231
) {
33-
const config = {
32+
const config: CoreJSOptions = {
3433
format: "esm",
3534
modules: options.modules,
3635
exclude: options.exclude,

0 commit comments

Comments
 (0)