@parcel/transformer-babel 2.12.0 → 2.13.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.
@@ -35,7 +35,7 @@ function _semver() {
35
35
  }
36
36
  var _babel = _interopRequireDefault(require("./babel7"));
37
37
  var _config = require("./config");
38
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
38
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
39
39
  var _default = exports.default = new (_plugin().Transformer)({
40
40
  loadConfig({
41
41
  config,
package/lib/babel7.js CHANGED
@@ -34,11 +34,11 @@ function _utils() {
34
34
  }
35
35
  var _remapAstLocations = require("./remapAstLocations");
36
36
  var _package = _interopRequireDefault(require("../package.json"));
37
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
38
38
  const transformerVersion = _package.default.version;
39
39
  (0, _assert().default)(typeof transformerVersion === 'string');
40
40
  async function babel7(opts) {
41
- var _babelOptions$config$, _babelOptions$config$2, _babelOptions$syntaxP;
41
+ var _babelOptions$config$;
42
42
  let {
43
43
  asset,
44
44
  options,
@@ -65,13 +65,12 @@ async function babel7(opts) {
65
65
  allowReturnOutsideFunction: true,
66
66
  strictMode: false,
67
67
  sourceType: 'module',
68
- plugins: [...((_babelOptions$config$ = (_babelOptions$config$2 = babelOptions.config.parserOpts) === null || _babelOptions$config$2 === void 0 ? void 0 : _babelOptions$config$2.plugins) !== null && _babelOptions$config$ !== void 0 ? _babelOptions$config$ : []), ...((_babelOptions$syntaxP = babelOptions.syntaxPlugins) !== null && _babelOptions$syntaxP !== void 0 ? _babelOptions$syntaxP : []),
68
+ plugins: [...(((_babelOptions$config$ = babelOptions.config.parserOpts) === null || _babelOptions$config$ === void 0 ? void 0 : _babelOptions$config$.plugins) ?? []), ...(babelOptions.syntaxPlugins ?? []),
69
69
  // Applied by preset-env
70
70
  'classProperties', 'classPrivateProperties', 'classPrivateMethods', 'exportDefaultFrom'
71
71
  // 'topLevelAwait'
72
72
  ]
73
73
  },
74
-
75
74
  caller: {
76
75
  name: 'parcel',
77
76
  version: transformerVersion,
package/lib/config.js CHANGED
@@ -36,12 +36,11 @@ var _constants = require("./constants");
36
36
  var _jsx = _interopRequireDefault(require("./jsx"));
37
37
  var _flow = _interopRequireDefault(require("./flow"));
38
38
  var _utils2 = require("./utils");
39
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
40
40
  const TYPESCRIPT_EXTNAME_RE = /\.tsx?$/;
41
41
  const JS_EXTNAME_RE = /^\.(js|cjs|mjs)$/;
42
42
  const BABEL_CONFIG_FILENAMES = ['.babelrc', '.babelrc.js', '.babelrc.json', '.babelrc.cjs', '.babelrc.mjs', '.babelignore', 'babel.config.js', 'babel.config.json', 'babel.config.mjs', 'babel.config.cjs'];
43
43
  async function load(config, options, logger) {
44
- var _ref, _ref2, _options$env$BABEL_EN;
45
44
  // Don't transpile inside node_modules
46
45
  if (!config.isSource) {
47
46
  return;
@@ -75,7 +74,7 @@ async function load(config, options, logger) {
75
74
  let babelOptions = {
76
75
  filename: config.searchPath,
77
76
  cwd: options.projectRoot,
78
- envName: (_ref = (_ref2 = (_options$env$BABEL_EN = options.env.BABEL_ENV) !== null && _options$env$BABEL_EN !== void 0 ? _options$env$BABEL_EN : options.env.NODE_ENV) !== null && _ref2 !== void 0 ? _ref2 : options.mode === 'production' || options.mode === 'development' ? options.mode : null) !== null && _ref !== void 0 ? _ref : 'development',
77
+ envName: options.env.BABEL_ENV ?? options.env.NODE_ENV ?? (options.mode === 'production' || options.mode === 'development' ? options.mode : null) ?? 'development',
79
78
  showIgnoredFiles: true
80
79
  };
81
80
  let partialConfig = await babelCore.loadPartialConfigAsync(babelOptions);
@@ -220,11 +219,10 @@ function definePluginDependencies(config, babelConfig, options) {
220
219
  }
221
220
  const redundantPresets = new Set(['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript', '@parcel/babel-preset-env']);
222
221
  async function warnOnRedundantPlugins(fs, babelConfig, logger) {
223
- var _babelConfig$config;
224
222
  if (babelConfig == null) {
225
223
  return;
226
224
  }
227
- let configPath = (_babelConfig$config = babelConfig.config) !== null && _babelConfig$config !== void 0 ? _babelConfig$config : babelConfig.babelrc;
225
+ let configPath = babelConfig.config ?? babelConfig.babelrc;
228
226
  if (!configPath) {
229
227
  return;
230
228
  }
@@ -262,12 +260,11 @@ async function warnOnRedundantPlugins(fs, babelConfig, logger) {
262
260
  });
263
261
  }
264
262
  if (foundRedundantPresets.has('@babel/preset-env')) {
265
- var _babelConfig$config2, _babelConfig$config3;
266
263
  diagnostics.push({
267
264
  message: "@babel/preset-env does not support Parcel's targets, which will likely result in unnecessary transpilation and larger bundle sizes.",
268
265
  codeFrames: [{
269
- filePath: (_babelConfig$config2 = babelConfig.config) !== null && _babelConfig$config2 !== void 0 ? _babelConfig$config2 : babelConfig.babelrc,
270
- codeHighlights: await getCodeHighlights(fs, (_babelConfig$config3 = babelConfig.config) !== null && _babelConfig$config3 !== void 0 ? _babelConfig$config3 : babelConfig.babelrc, new Set(['@babel/preset-env']))
266
+ filePath: babelConfig.config ?? babelConfig.babelrc,
267
+ codeHighlights: await getCodeHighlights(fs, babelConfig.config ?? babelConfig.babelrc, new Set(['@babel/preset-env']))
271
268
  }],
272
269
  hints: [`Either remove __@babel/preset-env__ to use Parcel's builtin transpilation, or replace with __@parcel/babel-preset-env__`],
273
270
  documentationURL: 'https://parceljs.org/languages/javascript/#custom-plugins'
package/lib/flow.js CHANGED
@@ -12,7 +12,7 @@ function _path() {
12
12
  };
13
13
  return data;
14
14
  }
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
16
16
  /**
17
17
  * Generates a babel config for stripping away Flow types.
18
18
  */
package/lib/jsx.js CHANGED
@@ -11,7 +11,7 @@ function _path() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const JSX_EXTENSIONS = new Set(['.jsx', '.tsx']);
16
16
  const JSX_LIBRARIES = ['react', 'preact', 'nervejs', 'hyperapp'];
17
17
 
package/lib/utils.js CHANGED
@@ -18,7 +18,7 @@ function _semver() {
18
18
  };
19
19
  return data;
20
20
  }
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  // Copied from @babel/helper-compilation-targets/lib/options.js
23
23
  const TargetNames = {
24
24
  node: 'node',
@@ -56,7 +56,7 @@ function enginesToBabelTargets(env) {
56
56
  (0, _assert().default)(typeof engineValue === 'string');
57
57
  if (!TargetNames.hasOwnProperty(engineName)) continue;
58
58
  let minVersion = (_semver$minVersion = _semver().default.minVersion(engineValue)) === null || _semver$minVersion === void 0 ? void 0 : _semver$minVersion.toString();
59
- targets[engineName] = minVersion !== null && minVersion !== void 0 ? minVersion : engineValue;
59
+ targets[engineName] = minVersion ?? engineValue;
60
60
  }
61
61
  }
62
62
  if (env.outputFormat === 'esmodule' && env.isBrowser()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/transformer-babel",
3
- "version": "2.12.0",
3
+ "version": "2.13.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -16,14 +16,14 @@
16
16
  "main": "lib/BabelTransformer.js",
17
17
  "source": "src/BabelTransformer.js",
18
18
  "engines": {
19
- "node": ">= 12.0.0",
20
- "parcel": "^2.12.0"
19
+ "node": ">= 16.0.0",
20
+ "parcel": "^2.13.1"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/diagnostic": "2.12.0",
24
- "@parcel/plugin": "2.12.0",
23
+ "@parcel/diagnostic": "2.13.1",
24
+ "@parcel/plugin": "2.13.1",
25
25
  "@parcel/source-map": "^2.1.1",
26
- "@parcel/utils": "2.12.0",
26
+ "@parcel/utils": "2.13.1",
27
27
  "browserslist": "^4.6.6",
28
28
  "json5": "^2.2.0",
29
29
  "nullthrows": "^1.1.1",
@@ -33,7 +33,7 @@
33
33
  "@babel/core": "^7.22.11",
34
34
  "@babel/preset-env": "^7.22.14",
35
35
  "@babel/types": "^7.22.11",
36
- "@parcel/types": "2.12.0"
36
+ "@parcel/types": "2.13.1"
37
37
  },
38
- "gitHead": "2059029ee91e5f03a273b0954d3e629d7375f986"
38
+ "gitHead": "4a297f79db3eec74437f4c5133127c98bf303703"
39
39
  }