Skip to content

Commit 03af299

Browse files
authored
Merge pull request #1506 from zloirock/v4-rd
Rework `@core-js/builder`
2 parents 5c6db9d + e3e826f commit 03af299

File tree

20 files changed

+727
-970
lines changed

20 files changed

+727
-970
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,8 @@ jobs:
5050
strategy:
5151
matrix:
5252
node:
53-
- 20.9
54-
- 21
55-
- ^22.5.1
53+
- ^20.19
54+
- ^22.12
5655
- 23
5756
- 24
5857
- 25
@@ -74,9 +73,8 @@ jobs:
7473
- windows-latest
7574
- macos-latest
7675
node:
77-
- 20.9
78-
- 21
79-
- ^22.5.1
76+
- ^20.19
77+
- ^22.12
8078
- 23
8179
- 24
8280
- 25

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ node_modules/
2424
/packages/core-js/LICENSE
2525
/packages/core-js-babel-plugin/LICENSE
2626
/packages/core-js-builder/LICENSE
27+
/packages/core-js-builder/__tmp__/
2728
/packages/core-js-bundle/LICENSE
2829
/packages/core-js-bundle/index.js
2930
/packages/core-js-bundle/minified.js

package-lock.json

Lines changed: 470 additions & 664 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core-js-babel-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
"@core-js/compat": "4.0.0-alpha.0"
3333
},
3434
"engines": {
35-
"node": ">=20.19.0"
35+
"node": "^20.19.0 || >=22.12.0"
3636
}
3737
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
2+
__tmp__/
23
*.log
34
.*

packages/core-js-builder/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const { script } = await builder({
3131
// output format, 'bundle' by default, can be 'cjs' or 'esm', and in this case
3232
// the result will not be bundled and will contain imports of required modules
3333
format: 'bundle',
34+
// minify the output in the case of format: bundle, `true` by default
35+
minify: true,
3436
// optional target filename, if it's missed a file will not be created
3537
filename: PATH_TO_MY_COREJS_BUNDLE,
3638
});

packages/core-js-builder/config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
const version = '4.0.0-alpha.0';
2+
3+
/* eslint-disable prefer-template -- for better formatting */
4+
export const banner = '/**\n' +
5+
' * core-js ' + version + '\n' +
6+
' * © 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.\n' +
7+
' * license: https://github.com/zloirock/core-js/blob/v' + version + '/LICENSE\n' +
8+
' * source: https://github.com/zloirock/core-js\n' +
9+
' */';
10+
/* eslint-enable prefer-template -- for better formatting */
11+
12+
export function getRolldownOptions(input, output) {
13+
return {
14+
input,
15+
platform: 'neutral',
16+
treeshake: false,
17+
output: {
18+
externalLiveBindings: false,
19+
format: 'iife',
20+
file: output,
21+
keepNames: true,
22+
minifyInternalExports: true,
23+
},
24+
};
25+
}
26+
27+
export const ModernSyntax = [
28+
'arrow-functions',
29+
'shorthand-properties',
30+
];
31+
32+
export const MinifyOptions = {
33+
minify: true,
34+
jsc: {
35+
minify: {
36+
compress: {
37+
arrows: false,
38+
ecma: 5,
39+
hoist_funs: true,
40+
keep_fnames: true,
41+
pure_getters: true,
42+
reduce_funcs: true,
43+
// document.all detection case
44+
typeofs: false,
45+
unsafe_proto: true,
46+
unsafe_undefined: true,
47+
},
48+
mangle: {
49+
keep_fnames: true,
50+
safari10: true,
51+
toplevel: true,
52+
},
53+
format: {
54+
comments: false,
55+
ecma: 5,
56+
},
57+
},
58+
},
59+
};

packages/core-js-builder/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ type Options = Pick<CompatOptions, "exclude" | "modules" | "targets"> & {
2222
format?: Format,
2323
/** optional target filename, if it's missed a file will not be created */
2424
filename?: string,
25+
/** minify the output in the case of format: bundle, `true` by default */
26+
minify?: boolean,
2527
/** shows summary for the bundle, disabled by default */
2628
summary?: Summary,
2729
};

packages/core-js-builder/index.js

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)