build-ts 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,58 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import url from 'node:url';
4
+
5
+ /** @type {import('@babel/core').TransformOptions} */
6
+ const config = {
7
+ presets: [
8
+ [
9
+ '@babel/preset-env',
10
+ {
11
+ bugfixes: true,
12
+ },
13
+ ],
14
+ '@babel/typescript',
15
+ ],
16
+ plugins: ['@babel/proposal-class-properties', '@babel/proposal-numeric-separator'],
17
+ env: {
18
+ production: {
19
+ plugins: [
20
+ [
21
+ 'transform-remove-console',
22
+ {
23
+ exclude: ['error', 'info', 'warn'],
24
+ },
25
+ ],
26
+ ],
27
+ },
28
+ test: {
29
+ plugins: [
30
+ [
31
+ 'transform-remove-console',
32
+ {
33
+ exclude: ['error', 'info', 'warn', 'debug'],
34
+ },
35
+ ],
36
+ ],
37
+ presets: [
38
+ [
39
+ '@babel/preset-env',
40
+ {
41
+ modules: 'auto',
42
+ },
43
+ ],
44
+ ],
45
+ },
46
+ },
47
+ };
48
+
49
+ const rootPath = url.fileURLToPath(path.dirname(import.meta.url));
50
+ const packageJson = JSON.parse(fs.readFileSync(path.join(rootPath, 'package.json'), 'utf8'));
51
+ const [major, minor] = packageJson.dependencies['core-js'].split('.');
52
+
53
+ /** @type {import('@babel/core').PluginItem} */
54
+ const presetEnvConfig = config.presets[0][1];
55
+ presetEnvConfig.useBuiltIns = 'usage';
56
+ presetEnvConfig.corejs = `${major}.${minor}`;
57
+
58
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "build-ts",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "repository": "github:WillBooster/build-ts",
5
5
  "license": "UNLICENSED",
6
6
  "author": "WillBooster Inc.",
@@ -9,7 +9,8 @@
9
9
  "bin": "bin/index.mjs",
10
10
  "files": [
11
11
  "bin/",
12
- "dist/"
12
+ "dist/",
13
+ "babel.*.config.mjs"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "yarn start app",