@babel/plugin-proposal-decorators 7.17.2 → 7.17.8

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.
@@ -161,8 +161,13 @@ function isDecoratorInfo(info) {
161
161
  return "decorators" in info;
162
162
  }
163
163
 
164
+ function filteredOrderedDecoratorInfo(info) {
165
+ const filtered = info.filter(isDecoratorInfo);
166
+ return [...filtered.filter(el => el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => !el.isStatic && el.kind >= ACCESSOR && el.kind <= SETTER), ...filtered.filter(el => el.isStatic && el.kind === FIELD), ...filtered.filter(el => !el.isStatic && el.kind === FIELD)];
167
+ }
168
+
164
169
  function generateDecorationExprs(info) {
165
- return _core.types.arrayExpression(info.filter(isDecoratorInfo).map(el => {
170
+ return _core.types.arrayExpression(filteredOrderedDecoratorInfo(info).map(el => {
166
171
  const decs = el.decorators.length > 1 ? _core.types.arrayExpression(el.decorators) : el.decorators[0];
167
172
  const kind = el.isStatic ? el.kind + STATIC : el.kind;
168
173
  const decInfo = [decs, _core.types.numericLiteral(kind), el.name];
@@ -181,19 +186,21 @@ function generateDecorationExprs(info) {
181
186
  }
182
187
 
183
188
  function extractElementLocalAssignments(decorationInfo) {
184
- const locals = [];
189
+ const localIds = [];
185
190
 
186
- for (const el of decorationInfo) {
187
- if ("locals" in el && el.locals) {
188
- if (Array.isArray(el.locals)) {
189
- locals.push(...el.locals);
190
- } else {
191
- locals.push(el.locals);
192
- }
191
+ for (const el of filteredOrderedDecoratorInfo(decorationInfo)) {
192
+ const {
193
+ locals
194
+ } = el;
195
+
196
+ if (Array.isArray(locals)) {
197
+ localIds.push(...locals);
198
+ } else if (locals !== undefined) {
199
+ localIds.push(locals);
193
200
  }
194
201
  }
195
202
 
196
- return locals;
203
+ return localIds;
197
204
  }
198
205
 
199
206
  function addCallAccessorsFor(element, key, getId, setId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babel/plugin-proposal-decorators",
3
- "version": "7.17.2",
3
+ "version": "7.17.8",
4
4
  "author": "The Babel Team (https://babel.dev/team)",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -20,7 +20,7 @@
20
20
  "decorators"
21
21
  ],
22
22
  "dependencies": {
23
- "@babel/helper-create-class-features-plugin": "^7.17.1",
23
+ "@babel/helper-create-class-features-plugin": "^7.17.6",
24
24
  "@babel/helper-plugin-utils": "^7.16.7",
25
25
  "@babel/helper-replace-supers": "^7.16.7",
26
26
  "@babel/plugin-syntax-decorators": "^7.17.0",
@@ -30,9 +30,9 @@
30
30
  "@babel/core": "^7.0.0-0"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "^7.17.2",
33
+ "@babel/core": "^7.17.8",
34
34
  "@babel/helper-plugin-test-runner": "^7.16.7",
35
- "@babel/traverse": "^7.17.0",
35
+ "@babel/traverse": "^7.17.3",
36
36
  "babel-plugin-polyfill-es-shims": "^0.6.0",
37
37
  "object.getownpropertydescriptors": "^2.1.1"
38
38
  },