@umijs/babel-preset-umi 4.6.1 → 4.6.2

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.
@@ -39,7 +39,7 @@ var stripExports_default = () => {
39
39
  Program: {
40
40
  enter(path, { opts }) {
41
41
  const expressions = path.get("body");
42
- const exports2 = (opts == null ? void 0 : opts.exports) || [];
42
+ const exports = (opts == null ? void 0 : opts.exports) || [];
43
43
  expressions.forEach((exp) => {
44
44
  if (!(t.isExportNamedDeclaration(exp) || t.isExportDefaultDeclaration(exp)))
45
45
  return;
@@ -48,36 +48,46 @@ var stripExports_default = () => {
48
48
  handleExportsDefault(exp);
49
49
  });
50
50
  function handleExportsIndividual(path2) {
51
- if (!path2.node) return;
52
- if (!t.isExportNamedDeclaration(path2)) return;
53
- if (!path2.get("declaration").node) return;
51
+ if (!path2.node)
52
+ return;
53
+ if (!t.isExportNamedDeclaration(path2))
54
+ return;
55
+ if (!path2.get("declaration").node)
56
+ return;
54
57
  const declaration = path2.get("declaration");
55
58
  if (t.isVariableDeclaration(declaration)) {
56
59
  const variables = declaration.get("declarations");
57
60
  variables.forEach((variable) => {
58
- exports2.includes(variable.get("id.name").node) && variable.remove();
61
+ exports.includes(variable.get("id.name").node) && variable.remove();
59
62
  });
60
63
  } else {
61
- exports2.includes(declaration.get("id.name").node) && declaration.remove();
64
+ exports.includes(declaration.get("id.name").node) && declaration.remove();
62
65
  }
63
66
  }
64
67
  function handleExportsList(path2) {
65
- if (!path2.node) return;
66
- if (!t.isExportNamedDeclaration(path2)) return;
68
+ if (!path2.node)
69
+ return;
70
+ if (!t.isExportNamedDeclaration(path2))
71
+ return;
67
72
  const specifiers = path2.get("specifiers");
68
- if (!specifiers || specifiers.length === 0) return;
73
+ if (!specifiers || specifiers.length === 0)
74
+ return;
69
75
  specifiers.forEach((specifier) => {
70
- if (exports2.includes(specifier.get("exported.name").node))
76
+ if (exports.includes(specifier.get("exported.name").node))
71
77
  specifier.remove();
72
78
  });
73
- if (path2.get("specifiers").length === 0) path2.remove();
79
+ if (path2.get("specifiers").length === 0)
80
+ path2.remove();
74
81
  }
75
82
  function handleExportsDefault(path2) {
76
- if (!path2.node) return;
77
- if (!t.isExportDefaultDeclaration(path2)) return;
83
+ if (!path2.node)
84
+ return;
85
+ if (!t.isExportDefaultDeclaration(path2))
86
+ return;
78
87
  const declaration = path2.get("declaration");
79
- if (!declaration.node) return;
80
- if (exports2.includes(declaration.get("name").node))
88
+ if (!declaration.node)
89
+ return;
90
+ if (exports.includes(declaration.get("name").node))
81
91
  declaration.remove();
82
92
  }
83
93
  },
@@ -85,13 +95,16 @@ var stripExports_default = () => {
85
95
  path.scope.crawl();
86
96
  const expressions = path.get("body");
87
97
  expressions.forEach((exp) => {
88
- if (!t.isImportDeclaration(exp)) return;
98
+ if (!t.isImportDeclaration(exp))
99
+ return;
89
100
  const specifiers = exp.get("specifiers");
90
101
  specifiers.forEach((s) => {
91
102
  const name = s.get("local.name").node;
92
- if (!s.scope.getBinding(name).referenced) s.remove();
103
+ if (!s.scope.getBinding(name).referenced)
104
+ s.remove();
93
105
  });
94
- if (exp.get("specifiers").length === 0) exp.remove();
106
+ if (exp.get("specifiers").length === 0)
107
+ exp.remove();
95
108
  });
96
109
  }
97
110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/babel-preset-umi",
3
- "version": "4.6.1",
3
+ "version": "4.6.2",
4
4
  "description": "Official babel preset for umi.",
5
5
  "homepage": "https://github.com/umijs/umi/tree/master/packages/babel-preset-umi#readme",
6
6
  "bugs": "https://github.com/umijs/umi/issues",
@@ -18,8 +18,8 @@
18
18
  "@babel/runtime": "7.23.6",
19
19
  "@bloomberg/record-tuple-polyfill": "0.0.4",
20
20
  "core-js": "3.34.0",
21
- "@umijs/bundler-utils": "4.6.1",
22
- "@umijs/utils": "4.6.1"
21
+ "@umijs/utils": "4.6.2",
22
+ "@umijs/bundler-utils": "4.6.2"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"