@babel/plugin-proposal-decorators 7.17.8 → 7.17.9

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.
@@ -11,6 +11,8 @@ var _pluginSyntaxDecorators = require("@babel/plugin-syntax-decorators");
11
11
 
12
12
  var _helperReplaceSupers = require("@babel/helper-replace-supers");
13
13
 
14
+ var _helperSplitExportDeclaration = require("@babel/helper-split-export-declaration");
15
+
14
16
  function incrementId(id, idx = id.length - 1) {
15
17
  if (idx === -1) {
16
18
  id.unshift(65);
@@ -204,7 +206,7 @@ function extractElementLocalAssignments(decorationInfo) {
204
206
  }
205
207
 
206
208
  function addCallAccessorsFor(element, key, getId, setId) {
207
- element.insertAfter(_core.types.classPrivateMethod("get", _core.types.cloneNode(key), [], _core.types.blockStatement([_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(getId), [_core.types.thisExpression()]))])));
209
+ element.insertAfter(_core.types.classPrivateMethod("get", _core.types.cloneNode(key), [], _core.types.blockStatement([_core.types.returnStatement(_core.types.callExpression(_core.types.cloneNode(getId), [_core.types.thisExpression()]))])));
208
210
  element.insertAfter(_core.types.classPrivateMethod("set", _core.types.cloneNode(key), [_core.types.identifier("v")], _core.types.blockStatement([_core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(setId), [_core.types.thisExpression(), _core.types.identifier("v")]))])));
209
211
  }
210
212
 
@@ -599,7 +601,7 @@ function transformClass(path, state, constantSuper) {
599
601
  }
600
602
 
601
603
  originalClass.body.body.unshift(_core.types.staticBlock([_core.types.expressionStatement(_core.types.assignmentExpression("=", _core.types.arrayPattern(locals), _core.types.callExpression(state.addHelper("applyDecs"), [_core.types.thisExpression(), elementDecorations, classDecorations]))), requiresStaticInit && _core.types.expressionStatement(_core.types.callExpression(_core.types.cloneNode(staticInitLocal), [_core.types.thisExpression()]))].filter(Boolean)));
602
- path.insertBefore(assignments);
604
+ path.insertBefore(assignments.map(expr => _core.types.expressionStatement(expr)));
603
605
  path.scope.crawl();
604
606
  return path;
605
607
  }
@@ -619,22 +621,22 @@ function _default({
619
621
  name: "proposal-decorators",
620
622
  inherits: _pluginSyntaxDecorators.default,
621
623
  visitor: {
622
- ClassDeclaration(path, state) {
623
- if (VISITED.has(path)) return;
624
- const newPath = transformClass(path, state, constantSuper);
624
+ "ExportNamedDeclaration|ExportDefaultDeclaration"(path) {
625
+ var _declaration$decorato;
625
626
 
626
- if (newPath) {
627
- VISITED.add(newPath);
627
+ const {
628
+ declaration
629
+ } = path.node;
630
+
631
+ if ((declaration == null ? void 0 : declaration.type) === "ClassDeclaration" && ((_declaration$decorato = declaration.decorators) == null ? void 0 : _declaration$decorato.length) > 0) {
632
+ (0, _helperSplitExportDeclaration.default)(path);
628
633
  }
629
634
  },
630
635
 
631
- ClassExpression(path, state) {
636
+ Class(path, state) {
632
637
  if (VISITED.has(path)) return;
633
638
  const newPath = transformClass(path, state, constantSuper);
634
-
635
- if (newPath) {
636
- VISITED.add(newPath);
637
- }
639
+ if (newPath) VISITED.add(newPath);
638
640
  }
639
641
 
640
642
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/plugin-proposal-decorators",
3
- "version": "7.17.8",
3
+ "version": "7.17.9",
4
4
  "author": "The Babel Team (https://babel.dev/team)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -20,9 +20,10 @@
20
20
  "decorators"
21
21
  ],
22
22
  "dependencies": {
23
- "@babel/helper-create-class-features-plugin": "^7.17.6",
23
+ "@babel/helper-create-class-features-plugin": "^7.17.9",
24
24
  "@babel/helper-plugin-utils": "^7.16.7",
25
25
  "@babel/helper-replace-supers": "^7.16.7",
26
+ "@babel/helper-split-export-declaration": "^7.16.7",
26
27
  "@babel/plugin-syntax-decorators": "^7.17.0",
27
28
  "charcodes": "^0.2.0"
28
29
  },
@@ -30,9 +31,9 @@
30
31
  "@babel/core": "^7.0.0-0"
31
32
  },
32
33
  "devDependencies": {
33
- "@babel/core": "^7.17.8",
34
+ "@babel/core": "^7.17.9",
34
35
  "@babel/helper-plugin-test-runner": "^7.16.7",
35
- "@babel/traverse": "^7.17.3",
36
+ "@babel/traverse": "^7.17.9",
36
37
  "babel-plugin-polyfill-es-shims": "^0.6.0",
37
38
  "object.getownpropertydescriptors": "^2.1.1"
38
39
  },