@nx/js 18.2.0-beta.0 → 18.2.0-beta.1
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.
- package/LICENSE +1 -1
- package/babel.js +33 -16
- package/package.json +4 -4
package/LICENSE
CHANGED
package/babel.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const path_1 = require("path");
|
|
4
|
+
const semver_1 = require("semver");
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
module.exports = function (api, options = {}) {
|
|
6
7
|
api.assertVersion(7);
|
|
@@ -27,22 +28,7 @@ module.exports = function (api, options = {}) {
|
|
|
27
28
|
// such as import syntax.
|
|
28
29
|
isTest || process.env.NODE_ENV === 'test' || process.env.JEST_WORKER_ID
|
|
29
30
|
? { targets: { node: 'current' }, loose: true }
|
|
30
|
-
:
|
|
31
|
-
// Allow importing core-js in entrypoint and use browserslist to select polyfills.
|
|
32
|
-
useBuiltIns: options.useBuiltIns ?? 'entry',
|
|
33
|
-
corejs: options.useBuiltIns !== false
|
|
34
|
-
? // Setting the minor version as well for better optimization (See: https://github.com/zloirock/core-js#babelpreset-env)
|
|
35
|
-
'3.36'
|
|
36
|
-
: null,
|
|
37
|
-
// Do not transform modules to CJS
|
|
38
|
-
modules: false,
|
|
39
|
-
targets: isModern ? { esmodules: 'intersect' } : undefined,
|
|
40
|
-
bugfixes: true,
|
|
41
|
-
// Exclude transforms that make all code slower
|
|
42
|
-
exclude: ['transform-typeof-symbol'],
|
|
43
|
-
// This must match the setting for `@babel/plugin-proposal-class-properties`
|
|
44
|
-
loose,
|
|
45
|
-
},
|
|
31
|
+
: createBabelPresetEnvOptions(options.useBuiltIns, isModern, loose),
|
|
46
32
|
],
|
|
47
33
|
[
|
|
48
34
|
require.resolve('@babel/preset-typescript'),
|
|
@@ -92,3 +78,34 @@ module.exports = function (api, options = {}) {
|
|
|
92
78
|
],
|
|
93
79
|
};
|
|
94
80
|
};
|
|
81
|
+
function createBabelPresetEnvOptions(useBuiltIns, isModern, loose) {
|
|
82
|
+
const presetOptions = {
|
|
83
|
+
// Do not transform modules to CJS
|
|
84
|
+
modules: false,
|
|
85
|
+
targets: isModern ? { esmodules: 'intersect' } : undefined,
|
|
86
|
+
bugfixes: true,
|
|
87
|
+
// Exclude transforms that make all code slower
|
|
88
|
+
exclude: ['transform-typeof-symbol'],
|
|
89
|
+
// This must match the setting for `@babel/plugin-proposal-class-properties`
|
|
90
|
+
loose,
|
|
91
|
+
};
|
|
92
|
+
// If core-js is installed then set corresponding options, otherwise don't use core-js.
|
|
93
|
+
// Previously, core-js was required for all projects, but it is not longer required when using only stable JS features that does not need to be transpiled.
|
|
94
|
+
const coreJsVersion = findCoreJsVersion();
|
|
95
|
+
if (coreJsVersion) {
|
|
96
|
+
presetOptions.useBuiltIns = useBuiltIns ?? 'entry';
|
|
97
|
+
presetOptions.corejs = useBuiltIns !== false ? coreJsVersion : null;
|
|
98
|
+
}
|
|
99
|
+
return presetOptions;
|
|
100
|
+
}
|
|
101
|
+
function findCoreJsVersion() {
|
|
102
|
+
try {
|
|
103
|
+
// nx-ignore-next-line
|
|
104
|
+
const v = require('core-js/package.json').version;
|
|
105
|
+
const { major, minor } = (0, semver_1.parse)(v);
|
|
106
|
+
return `${major}.${minor}`;
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/js",
|
|
3
|
-
"version": "18.2.0-beta.
|
|
3
|
+
"version": "18.2.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"semver": "^7.5.3",
|
|
58
58
|
"source-map-support": "0.5.19",
|
|
59
59
|
"tslib": "^2.3.0",
|
|
60
|
-
"@nx/devkit": "18.2.0-beta.
|
|
61
|
-
"@nx/workspace": "18.2.0-beta.
|
|
62
|
-
"@nrwl/js": "18.2.0-beta.
|
|
60
|
+
"@nx/devkit": "18.2.0-beta.1",
|
|
61
|
+
"@nx/workspace": "18.2.0-beta.1",
|
|
62
|
+
"@nrwl/js": "18.2.0-beta.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"verdaccio": "^5.0.4"
|