expose-kit 0.13.0 → 0.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.
package/dist/index.js CHANGED
@@ -1107,11 +1107,35 @@ var shouldSkipReferencedIdentifier = (path) => {
1107
1107
  };
1108
1108
  var getArrayReturnExpression = (node) => {
1109
1109
  if (node.params.length !== 0) return null;
1110
- if (t4.isBlockStatement(node.body)) {
1111
- if (node.body.body.length !== 1) return null;
1112
- const statement = node.body.body[0];
1113
- if (!t4.isReturnStatement(statement) || !statement.argument) return null;
1114
- return t4.isArrayExpression(statement.argument) ? statement.argument : null;
1110
+ const body = node.body;
1111
+ if (t4.isBlockStatement(body)) {
1112
+ const statements = body.body;
1113
+ if (statements.length === 1) {
1114
+ const statement = statements[0];
1115
+ if (!t4.isReturnStatement(statement) || !statement.argument) return null;
1116
+ return t4.isArrayExpression(statement.argument) ? statement.argument : null;
1117
+ }
1118
+ if (statements.length === 2) {
1119
+ const [first, second] = statements;
1120
+ const arrayExpression = (() => {
1121
+ if (!t4.isVariableDeclaration(first) || first.declarations.length !== 1) {
1122
+ return null;
1123
+ }
1124
+ const declarator = first.declarations[0];
1125
+ if (!(t4.isIdentifier(declarator.id) && declarator.init && t4.isArrayExpression(declarator.init))) {
1126
+ return null;
1127
+ }
1128
+ if (!t4.isReturnStatement(second) || !second.argument) return null;
1129
+ if (!t4.isIdentifier(second.argument) || second.argument.name !== declarator.id.name) {
1130
+ return null;
1131
+ }
1132
+ return declarator.init;
1133
+ })();
1134
+ if (arrayExpression) {
1135
+ return arrayExpression;
1136
+ }
1137
+ }
1138
+ return null;
1115
1139
  }
1116
1140
  return t4.isArrayExpression(node.body) ? node.body : null;
1117
1141
  };
@@ -1561,6 +1585,7 @@ var removeReassign = (code, filename) => {
1561
1585
  const binding = path.scope.getBinding(path.node.id.name);
1562
1586
  if (!binding || !binding.constant) return;
1563
1587
  const wrapper = getWrapperInfo(
1588
+ // TODO: fix this
1564
1589
  initPath,
1565
1590
  binding
1566
1591
  );
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expose-kit",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "EdamAmex <edame8080@gmail.com> (https://github.com/EdamAme-x)",