metro-source-map 0.75.1 → 0.76.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro-source-map",
3
- "version": "0.75.1",
3
+ "version": "0.76.0",
4
4
  "description": "🚇 Source map generator for Metro.",
5
5
  "main": "src/source-map.js",
6
6
  "repository": {
@@ -15,9 +15,9 @@
15
15
  "@babel/traverse": "^7.20.0",
16
16
  "@babel/types": "^7.20.0",
17
17
  "invariant": "^2.2.4",
18
- "metro-symbolicate": "0.75.1",
18
+ "metro-symbolicate": "0.76.0",
19
19
  "nullthrows": "^1.1.1",
20
- "ob1": "0.75.1",
20
+ "ob1": "0.76.0",
21
21
  "source-map": "^0.5.6",
22
22
  "vlq": "^1.0.0"
23
23
  },
@@ -25,9 +25,9 @@
25
25
  "devDependencies": {
26
26
  "@babel/core": "^7.20.0",
27
27
  "@babel/parser": "^7.20.0",
28
- "uglify-es": "^3.1.9"
28
+ "terser": "^5.15.0"
29
29
  },
30
30
  "engines": {
31
- "node": ">=14.17.0"
31
+ "node": ">=16"
32
32
  }
33
33
  }
@@ -182,7 +182,6 @@ class MappingsConsumer extends AbstractConsumer {
182
182
  return add0(idx);
183
183
  }
184
184
  sourceContentFor(source, nullOnMissing) {
185
- var _sourcesContent$get;
186
185
  const { sourcesContent } = this._sourceMap;
187
186
  if (!sourcesContent) {
188
187
  return null;
@@ -191,10 +190,7 @@ class MappingsConsumer extends AbstractConsumer {
191
190
  if (idx == null) {
192
191
  return null;
193
192
  }
194
- return (_sourcesContent$get = sourcesContent[get0(idx)]) !== null &&
195
- _sourcesContent$get !== void 0
196
- ? _sourcesContent$get
197
- : null;
193
+ return sourcesContent[get0(idx)] ?? null;
198
194
  }
199
195
  }
200
196
  module.exports = MappingsConsumer;
package/src/Generator.js CHANGED
@@ -147,9 +147,6 @@ class Generator {
147
147
  sources: this.sources.slice(),
148
148
  // $FlowFixMe[exponential-spread]
149
149
  ...content,
150
- /* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
151
- * error found when Flow v0.111 was deployed. To see the error, delete
152
- * this comment and run Flow. */
153
150
  ...sourcesMetadata,
154
151
  names: this.names.items(),
155
152
  mappings: this.builder.toString(),
@@ -181,9 +181,6 @@ class Generator {
181
181
  sources: this.sources.slice(),
182
182
  // $FlowFixMe[exponential-spread]
183
183
  ...content,
184
- /* $FlowFixMe(>=0.111.0 site=react_native_fb) This comment suppresses an
185
- * error found when Flow v0.111 was deployed. To see the error, delete
186
- * this comment and run Flow. */
187
184
  ...sourcesMetadata,
188
185
  names: this.names.items(),
189
186
  mappings: this.builder.toString(),
@@ -171,14 +171,7 @@ function getNameForPath(path) {
171
171
  // foo = function () {};
172
172
  id = parent.left;
173
173
  } else if ((0, _types.isJSXExpressionContainer)(parent)) {
174
- var _parentPath$parentPat;
175
- const grandParentNode =
176
- parentPath === null || parentPath === void 0
177
- ? void 0
178
- : (_parentPath$parentPat = parentPath.parentPath) === null ||
179
- _parentPath$parentPat === void 0
180
- ? void 0
181
- : _parentPath$parentPat.node;
174
+ const grandParentNode = parentPath?.parentPath?.node;
182
175
  if ((0, _types.isJSXElement)(grandParentNode)) {
183
176
  // <foo>{function () {}}</foo>
184
177
  const openingElement = grandParentNode.openingElement;
@@ -188,18 +181,8 @@ function getNameForPath(path) {
188
181
  t.jsxIdentifier("children")
189
182
  );
190
183
  } else if ((0, _types.isJSXAttribute)(grandParentNode)) {
191
- var _parentPath$parentPat2, _parentPath$parentPat3;
192
184
  // <foo bar={function () {}} />
193
- const openingElement =
194
- parentPath === null || parentPath === void 0
195
- ? void 0
196
- : (_parentPath$parentPat2 = parentPath.parentPath) === null ||
197
- _parentPath$parentPat2 === void 0
198
- ? void 0
199
- : (_parentPath$parentPat3 = _parentPath$parentPat2.parentPath) ===
200
- null || _parentPath$parentPat3 === void 0
201
- ? void 0
202
- : _parentPath$parentPat3.node;
185
+ const openingElement = parentPath?.parentPath?.parentPath?.node;
203
186
  const prop = grandParentNode;
204
187
  id = t.jsxMemberExpression(
205
188
  // $FlowFixMe Flow error uncovered by typing Babel more strictly
@@ -322,10 +305,7 @@ function getNamePartsFromId(id) {
322
305
  } else if ((0, _types.isNullLiteral)(id)) {
323
306
  name = "null";
324
307
  } else if ((0, _types.isRegExpLiteral)(id)) {
325
- var _id$flags;
326
- name = `_${id.pattern}_${
327
- (_id$flags = id.flags) !== null && _id$flags !== void 0 ? _id$flags : ""
328
- }`;
308
+ name = `_${id.pattern}_${id.flags ?? ""}`;
329
309
  } else if ((0, _types.isTemplateLiteral)(id)) {
330
310
  name = id.quasis.map((quasi) => quasi.value.raw).join("");
331
311
  } else if ((0, _types.isLiteral)(id) && id.value != null) {