@meteorjs/babel 7.20.1 → 7.20.2-alpha.0
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/options.js +8 -17
- package/package.json +1 -1
package/options.js
CHANGED
|
@@ -24,8 +24,10 @@ function getReifyOptions(features) {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
if (features) {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// nodeMajorVersion is only set when compiling for a Node target (server,
|
|
28
|
+
// shell, tool); modernBrowsers only for modern web/cordova targets. Legacy
|
|
29
|
+
// web builds set neither, so this is a target check, not a version check.
|
|
30
|
+
if (features.modernBrowsers || features.nodeMajorVersion) {
|
|
29
31
|
reifyOptions.avoidModernSyntax = false;
|
|
30
32
|
reifyOptions.generateLetDeclarations = true;
|
|
31
33
|
}
|
|
@@ -46,8 +48,9 @@ function getReifyOptions(features) {
|
|
|
46
48
|
|
|
47
49
|
exports.getDefaults = function getDefaults(features) {
|
|
48
50
|
if (features) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
// Only set for Node targets; see getReifyOptions.
|
|
52
|
+
if (features.nodeMajorVersion) {
|
|
53
|
+
return getDefaultsForNode(features);
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
if (features.modernBrowsers) {
|
|
@@ -166,7 +169,7 @@ function getRuntimeTransform(features) {
|
|
|
166
169
|
}];
|
|
167
170
|
}
|
|
168
171
|
|
|
169
|
-
function
|
|
172
|
+
function getDefaultsForNode(features) {
|
|
170
173
|
const combined = {
|
|
171
174
|
presets: [],
|
|
172
175
|
plugins: [getReifyPlugin(features)]
|
|
@@ -181,27 +184,15 @@ function getDefaultsForNode8(features) {
|
|
|
181
184
|
combined.plugins.push(rt);
|
|
182
185
|
}
|
|
183
186
|
|
|
184
|
-
// Not fully supported in Node 8 without the --harmony flag.
|
|
185
|
-
combined.plugins.push(
|
|
186
|
-
require("@babel/plugin-syntax-object-rest-spread"),
|
|
187
|
-
require("@babel/plugin-proposal-object-rest-spread")
|
|
188
|
-
);
|
|
189
|
-
|
|
190
187
|
if (features.useNativeAsyncAwait === false) {
|
|
191
188
|
combined.plugins.push([
|
|
192
189
|
require('./plugins/async-await.js'),
|
|
193
190
|
{
|
|
194
|
-
// Even though Node 8 supports native async/await, it is not
|
|
195
|
-
// compatible with fibers.
|
|
196
191
|
useNativeAsyncAwait: false,
|
|
197
192
|
},
|
|
198
193
|
]);
|
|
199
194
|
}
|
|
200
|
-
// Enable async generator functions proposal.
|
|
201
|
-
combined.plugins.push(require("@babel/plugin-proposal-async-generator-functions"));
|
|
202
|
-
}
|
|
203
195
|
|
|
204
|
-
if (! compileModulesOnly) {
|
|
205
196
|
maybeAddReactPlugins(features, combined);
|
|
206
197
|
}
|
|
207
198
|
|