mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Babel preset: Remove regenerator from Hermes dev builds (#59390)
Summary: (This is a re-land of https://github.com/react/react-native/issues/59303.) ## Motivation - Dev/release consistency in correctness and performance shape. - ~10% faster dev cold builds - More responsive dev apps (~2x faster promise handling) - Improved debugging support Since https://github.com/react/react-native/pull/52651, Hermes profiles have lowered generators (with `enableBabelRuntime: false`), `for...of`, `?.`, `??` and optional catch binding in dev builds only, because Hermes couldn't show local variables when paused on a breakpoint in a native generator. That turned out to be a Hermes bug: a breakpoint on that a `yield` line resolved to scope-less entry code before the body had even run. It was fixed in https://github.com/facebook/hermes/commit/d1238c8c61907ad41caadf579f6739f724e959a3 (hermes-v260318099.0.2), which main has used since https://github.com/react/react-native/pull/58397. This removes `enableRegenerator`, so Hermes-profile dev output matches release. It also fixes a dev-only divergence - loose `for-of` never calls `iterator.return()`, so breaking out of a `for...of` over a generator skipped its `finally` in dev but not release. Note that with the default `enableBabelRuntime`, generators were already native in dev, so in practice the generator change mostly affects `enableBabelRuntime: false` setups, including RN's own Jest. (There's no good reason generator was ever conditional on `enableBabelRuntime === false` - it seems to date from https://github.com/react/react-native/pull/44668 and probably a misunderstanding of what the `regenerator` argument to `babel/plugin-transform-runtime` did - it doesn't make that plugin transform generators, it just rewrites the helper import.) Native generator debugging still isn't perfect on .0.2 - stepping through `try`/`catch` can stop on a `catch` line that doesn't run, and breakpoints on `yield*` lines or on a `throw` after a resume don't fire. Those already affect every default config though, so there's no regression in most cases. Regenerator has its own problems, eg breakpoints often stop a line early because statements merge into its `case` blocks. Overall, native is now a better experience. Detailed comparison in https://robhogan.github.io/reports/react-native-regenerator-removal/ ## Changelog [GENERAL] [FIXED] - Babel preset: Hermes profiles no longer lower generators, `for...of`, optional chaining, nullish coalescing or optional catch binding in dev, matching release Pull Request resolved: https://github.com/react/react-native/pull/59390 Test Plan: Reproduced the original bug through Hermes's `CDPAgent` test harness with `Debugger.setBreakpointByUrl`. On hermes-v250829098.0.16 and v260318099.0.1, a breakpoint on a generator's last `yield` line pauses at the generator call with only the global scope, and every local evaluates to `undefined`. On v260318099.0.2 and .0.4 it pauses at the real code with all locals. AI-driven breakpoint sweep: this preset with `dev: true, enableBabelRuntime: false`, before and after this change, over 248 source lines of generator, async function, async generator, exception and loop fixtures. A breakpoint was set on every line, each pause was mapped back through the source map, and every local was evaluated. Same results with eager and lazy compilation. | Hermes | Identical | Different, equivalent | Native better | Native worse | Mixed (loop headers) | Total | | --- | --- | --- | --- | --- | --- | --- | | 250829098.0.16 | 164 | 10 | 49 | 22 | 3 | 248 | | 260318099.0.2 | 183 | 11 | 47 | 3 | 3 | 247 | | 260318099.0.4 | 184 | 11 | 47 | 3 | 3 | 248 | Local validation: - `js1 test xplat/js/react-native-github/packages/react-native-babel-preset xplat/js/react-native-github/scripts/releases/__tests__/set-version-test.js --runInBand --skipFilter`: 8 suites, 134 tests and 54 snapshots passed. - `js1 test xplat/js/scripts/rn-native-modules/__tests__/findTurboModules-test.js --runInBand --skipFilter`: 14 tests passed across development and minified release bundles. Covers optional access, optional calls, both combined, `get` and `getEnforcing`; development also covers namespace imports and CommonJS. With the original scanner, all six added optional development cases failed while the ordinary-call control passed. - `arc lint -a`: no lint issues. - Independent expert review: no blockers. - `buck2 build fbsource//fbandroid/apps/oculus/twilight:twilight_arm64_debug-turbomodule-check fbsource//fbandroid/apps/oculus/twilight:twilight_x86_debug-turbomodule-check @//xplat/mode/hermes/disable_dev_assert @//fbandroid/mode/legacy_apk`: BUILD SUCCEEDED (exit 0). https://www.internalfb.com/buck2/c5b626d6-0feb-4560-958d-87e1e2c54824 - `buck2 build fbsource//fbobjc/Apps/Oculus/Twilight:Twilight-turbomodule-plugin-assertion @//fbobjc/mode/buck2/linux @//xplat/mode/hermes/disable_dev_assert @//fbobjc/mode/twilight-hsr-native -c apple.dry_run_code_signing=true`: BUILD SUCCEEDED (exit 0). https://www.internalfb.com/buck2/fae8c6c0-e740-41ec-9f81-a6f202d9a2aa - CodeSync export of draft 456916329 was blocked: the linked PR #59390 belongs to a different author, and CodeSync only permits that PR owner to export it. Export job: https://www.internalfb.com/intern/sandcastle/job/49539596691166518. The existing PR was not unlinked or replaced. Other draft CI remains in progress; no claim of full CI success. Reviewed By: andrewdacenko Differential Revision: D127195443 Pulled By: javache fbshipit-source-id: dd0a115bc8e8306f4800b67800a038141e477ff6
This commit is contained in:
1 parent
778fef746d
commit
ca952774d6
11 files changed
+103
-158
No files matched your search
@@ -39,19 +39,14 @@
|
||||
"@babel/plugin-transform-classes": "^7.25.4",
|
||||
"@babel/plugin-transform-destructuring": "^7.24.8",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
||||
"@babel/plugin-transform-for-of": "^7.24.7",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
|
||||
"@babel/plugin-transform-named-capturing-groups-regex": "^7.24.7",
|
||||
"@babel/plugin-transform-nullish-coalescing-operator": "^7.24.7",
|
||||
"@babel/plugin-transform-optional-catch-binding": "^7.24.7",
|
||||
"@babel/plugin-transform-optional-chaining": "^7.24.8",
|
||||
"@babel/plugin-transform-private-methods": "^7.24.7",
|
||||
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
|
||||
"@babel/plugin-transform-react-display-name": "^7.24.7",
|
||||
"@babel/plugin-transform-react-jsx": "^7.25.2",
|
||||
"@babel/plugin-transform-react-jsx-self": "^7.24.7",
|
||||
"@babel/plugin-transform-react-jsx-source": "^7.24.7",
|
||||
"@babel/plugin-transform-regenerator": "^7.24.7",
|
||||
"@babel/plugin-transform-runtime": "^7.24.7",
|
||||
"@babel/plugin-transform-typescript": "^7.25.2",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
|
||||
+5
-10
@@ -53,9 +53,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
var _count = (0, _classPrivateFieldLooseKey2.default)("count");
|
||||
var _instances = (0, _classPrivateFieldLooseKey2.default)("instances");
|
||||
var _increment = (0, _classPrivateFieldLooseKey2.default)("increment");
|
||||
@@ -114,8 +111,7 @@ function _fetchData() {
|
||||
return _fetchData.apply(this, arguments);
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -168,8 +164,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
var total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
var [a, b] = _step.value;
|
||||
for (var [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -181,7 +176,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
var match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -193,13 +188,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
var MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+5
-10
@@ -50,9 +50,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
var _count = (0, _classPrivateFieldLooseKey2.default)("count");
|
||||
var _instances = (0, _classPrivateFieldLooseKey2.default)("instances");
|
||||
var _increment = (0, _classPrivateFieldLooseKey2.default)("increment");
|
||||
@@ -99,8 +96,7 @@ async function fetchData(url) {
|
||||
};
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -151,8 +147,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
var total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
var [a, b] = _step.value;
|
||||
for (var [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -164,7 +159,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
var match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -176,13 +171,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
var MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+5
-10
@@ -53,9 +53,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
var _count = (0, _classPrivateFieldLooseKey2.default)("count");
|
||||
var _instances = (0, _classPrivateFieldLooseKey2.default)("instances");
|
||||
var _increment = (0, _classPrivateFieldLooseKey2.default)("increment");
|
||||
@@ -114,8 +111,7 @@ function _fetchData() {
|
||||
return _fetchData.apply(this, arguments);
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -168,8 +164,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
let total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
const [a, b] = _step.value;
|
||||
for (const [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -181,7 +176,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
const match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -193,13 +188,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
const match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
const MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+5
-10
@@ -51,9 +51,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
class Counter {
|
||||
#count = 0;
|
||||
static #instances = 0;
|
||||
@@ -100,8 +97,7 @@ function _fetchData() {
|
||||
return _fetchData.apply(this, arguments);
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -154,8 +150,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
var total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
var [a, b] = _step.value;
|
||||
for (var [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -167,7 +162,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
var match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -179,13 +174,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
var MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+5
-10
@@ -53,9 +53,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
var _count = (0, _classPrivateFieldLooseKey2.default)("count");
|
||||
var _instances = (0, _classPrivateFieldLooseKey2.default)("instances");
|
||||
var _increment = (0, _classPrivateFieldLooseKey2.default)("increment");
|
||||
@@ -114,8 +111,7 @@ function _fetchData() {
|
||||
return _fetchData.apply(this, arguments);
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -168,8 +164,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
var total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
var [a, b] = _step.value;
|
||||
for (var [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -181,7 +176,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
var match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -193,13 +188,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
var MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+5
-10
@@ -53,9 +53,6 @@ var _dataUtils = require("./data-utils");
|
||||
var _jsxFileName = "/absolute/path/to/input.js";
|
||||
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
||||
function _wrapRegExp() { _wrapRegExp = function (e, r) { return new BabelRegExp(e, void 0, r); }; var e = RegExp.prototype, r = new WeakMap(); function BabelRegExp(e, t, p) { var o = RegExp(e, t); return r.set(o, p || r.get(e)), (0, _setPrototypeOf2.default)(o, BabelRegExp.prototype); } function buildGroups(e, t) { var p = r.get(t); return Object.keys(p).reduce(function (r, t) { var o = p[t]; if ("number" == typeof o) r[t] = e[o];else { for (var i = 0; void 0 === e[o[i]] && i + 1 < o.length;) i++; r[t] = e[o[i]]; } return r; }, Object.create(null)); } return (0, _inherits2.default)(BabelRegExp, RegExp), BabelRegExp.prototype.exec = function (r) { var t = e.exec.call(this, r); if (t) { t.groups = buildGroups(t, this); var p = t.indices; p && (p.groups = buildGroups(p, this)); } return t; }, BabelRegExp.prototype[Symbol.replace] = function (t, p) { if ("string" == typeof p) { var o = r.get(this); return e[Symbol.replace].call(this, t, p.replace(/\$<([^>]+)(>|$)/g, function (e, r, t) { if ("" === t) return e; var p = o[r]; return Array.isArray(p) ? "$" + p.join("$") : "number" == typeof p ? "$" + p : ""; })); } if ("function" == typeof p) { var i = this; return e[Symbol.replace].call(this, t, function () { var e = arguments; return "object" != typeof e[e.length - 1] && (e = [].slice.call(e)).push(buildGroups(e, i)), p.apply(this, e); }); } return e[Symbol.replace].call(this, t, p); }, _wrapRegExp.apply(this, arguments); }
|
||||
function _createForOfIteratorHelperLoose(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
||||
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
||||
var _count = (0, _classPrivateFieldLooseKey2.default)("count");
|
||||
var _instances = (0, _classPrivateFieldLooseKey2.default)("instances");
|
||||
var _increment = (0, _classPrivateFieldLooseKey2.default)("increment");
|
||||
@@ -114,8 +111,7 @@ function _fetchData() {
|
||||
return _fetchData.apply(this, arguments);
|
||||
}
|
||||
function getNestedValue(obj) {
|
||||
var _obj$a$b$c, _obj$a;
|
||||
return (_obj$a$b$c = obj == null || (_obj$a = obj.a) == null || (_obj$a = _obj$a.b) == null ? void 0 : _obj$a.c) != null ? _obj$a$b$c : 42;
|
||||
return obj?.a?.b?.c ?? 42;
|
||||
}
|
||||
class Animal {
|
||||
#age;
|
||||
@@ -168,8 +164,7 @@ function mergeConfigs(base, ...overrides) {
|
||||
}
|
||||
function sumPairs(pairs) {
|
||||
var total = 0;
|
||||
for (var _iterator = _createForOfIteratorHelperLoose(pairs), _step; !(_step = _iterator()).done;) {
|
||||
var [a, b] = _step.value;
|
||||
for (var [a, b] of pairs) {
|
||||
total += a + b;
|
||||
}
|
||||
return total;
|
||||
@@ -181,7 +176,7 @@ function parseDate(dateString) {
|
||||
day: 3
|
||||
});
|
||||
var match = dateString.match(regex);
|
||||
if (match != null && match.groups) {
|
||||
if (match?.groups) {
|
||||
return {
|
||||
year: match.groups.year,
|
||||
month: match.groups.month,
|
||||
@@ -193,13 +188,13 @@ function parseDate(dateString) {
|
||||
function safeJsonParse(input) {
|
||||
try {
|
||||
return JSON.parse(input);
|
||||
} catch (_unused) {
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
function matchEmoji(text) {
|
||||
var match = text.match(/(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEDC-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9\uDEF0-\uDEF8])/);
|
||||
return match == null ? void 0 : match[0];
|
||||
return match?.[0];
|
||||
}
|
||||
var MyClass = class {
|
||||
constructor(value) {
|
||||
|
||||
+29
-4
@@ -354,22 +354,47 @@ describe('react-native-babel-preset transform snapshots', () => {
|
||||
expect(result).toContain('_wrapAsyncGenerator');
|
||||
});
|
||||
|
||||
it('handles optional chaining', () => {
|
||||
it('preserves optional chaining in dev with hermes-stable profile', () => {
|
||||
const code = `const x = obj?.a?.b?.c;`;
|
||||
const result = transformCode(code, {
|
||||
dev: true,
|
||||
unstable_transformProfile: 'hermes-stable',
|
||||
});
|
||||
expect(result).not.toContain('?.');
|
||||
expect(result).toContain('obj?.a?.b?.c');
|
||||
});
|
||||
|
||||
it('handles nullish coalescing', () => {
|
||||
it('preserves nullish coalescing in dev with hermes-stable profile', () => {
|
||||
const code = `const x = a ?? b;`;
|
||||
const result = transformCode(code, {
|
||||
dev: true,
|
||||
unstable_transformProfile: 'hermes-stable',
|
||||
});
|
||||
expect(result).not.toContain('??');
|
||||
expect(result).toContain('a ?? b');
|
||||
});
|
||||
|
||||
it('preserves generators, for-of and optional catch binding in dev without Babel runtime', () => {
|
||||
const code = `
|
||||
function* gen() {
|
||||
try {
|
||||
yield 1;
|
||||
} catch {
|
||||
yield 2;
|
||||
}
|
||||
}
|
||||
for (const x of gen()) {
|
||||
console.log(x);
|
||||
}
|
||||
`;
|
||||
const result = transformCode(code, {
|
||||
dev: true,
|
||||
unstable_transformProfile: 'hermes-stable',
|
||||
enableBabelRuntime: false,
|
||||
});
|
||||
expect(result).toContain('function* gen()');
|
||||
expect(result).toContain('x of gen()');
|
||||
expect(result).toContain('catch {');
|
||||
expect(result).not.toContain('_regenerator');
|
||||
expect(result).not.toContain('_createForOfIteratorHelperLoose');
|
||||
});
|
||||
|
||||
it('handles flow enums', () => {
|
||||
|
||||
+4
-57
@@ -116,16 +116,6 @@ const getPreset = (src, options, babel) => {
|
||||
transformProfile === 'hermes-stable' ||
|
||||
transformProfile === 'hermes-canary';
|
||||
|
||||
// We enable regenerator in Hermes V1 dev builds for the time being because
|
||||
// Hermes V1 doesn't yet fully support debugging native generators.
|
||||
// (e.g. - it's not possible to inspect local variables when paused in a
|
||||
// generator).
|
||||
//
|
||||
// Use native generators in release mode because it has already yielded perf
|
||||
// wins. The next release of Hermes V1 will close this gap, so this won't
|
||||
// be permanent.
|
||||
const enableRegenerator = isHermesProfile && dev;
|
||||
|
||||
// Preserve class syntax and related features for Hermes V1 profiles.
|
||||
const preserveClasses = isHermesProfile;
|
||||
|
||||
@@ -155,20 +145,10 @@ const getPreset = (src, options, babel) => {
|
||||
const enableBabelRuntime =
|
||||
options.enableBabelRuntime ?? babel?.caller(getEnableBabelRuntime) ?? true;
|
||||
|
||||
// When @babel/plugin-transform-runtime is disabled, generators and async
|
||||
// functions are lowered by @babel/plugin-transform-regenerator, which cannot
|
||||
// handle destructuring patterns inside them (e.g. `const {a} = await x()`).
|
||||
const usesRegeneratorTransform =
|
||||
enableRegenerator && enableBabelRuntime === false;
|
||||
|
||||
// Preserve destructuring syntax by default, as Hermes supports it natively.
|
||||
// It is still transformed when the regenerator transform is in use, because
|
||||
// that transform requires destructuring to be lowered first.
|
||||
const preserveDestructuring =
|
||||
!usesRegeneratorTransform &&
|
||||
TRUE_VALS.has(
|
||||
options.customTransformOptions?.unstable_preserveDestructuring ?? true,
|
||||
);
|
||||
const preserveDestructuring = TRUE_VALS.has(
|
||||
options.customTransformOptions?.unstable_preserveDestructuring ?? true,
|
||||
);
|
||||
|
||||
const isNull = src == null;
|
||||
const hasClass = isNull || src.indexOf('class') !== -1;
|
||||
@@ -225,12 +205,6 @@ const getPreset = (src, options, babel) => {
|
||||
extraPlugins.push([
|
||||
require('@babel/plugin-transform-named-capturing-groups-regex'),
|
||||
]);
|
||||
// Needed for regenerator
|
||||
if (enableRegenerator) {
|
||||
extraPlugins.push([
|
||||
require('@babel/plugin-transform-optional-catch-binding'),
|
||||
]);
|
||||
}
|
||||
|
||||
if (!preserveDestructuring) {
|
||||
extraPlugins.push([
|
||||
@@ -251,20 +225,6 @@ const getPreset = (src, options, babel) => {
|
||||
) {
|
||||
extraPlugins.push([require('@babel/plugin-transform-react-display-name')]);
|
||||
}
|
||||
// This is also needed for regenerator
|
||||
if (enableRegenerator && (isNull || src.indexOf('?.') !== -1)) {
|
||||
extraPlugins.push([
|
||||
require('@babel/plugin-transform-optional-chaining'),
|
||||
{loose: true},
|
||||
]);
|
||||
}
|
||||
// This is also needed for regenerator
|
||||
if (enableRegenerator && (isNull || src.indexOf('??') !== -1)) {
|
||||
extraPlugins.push([
|
||||
require('@babel/plugin-transform-nullish-coalescing-operator'),
|
||||
{loose: true},
|
||||
]);
|
||||
}
|
||||
|
||||
if (dev && !options.disableDeepImportWarnings) {
|
||||
firstPartyPlugins.push([require('../plugin-warn-on-deep-imports.js')]);
|
||||
@@ -275,17 +235,6 @@ const getPreset = (src, options, babel) => {
|
||||
extraPlugins.push([require('@babel/plugin-transform-react-jsx-self')]);
|
||||
}
|
||||
|
||||
if (
|
||||
enableRegenerator &&
|
||||
(isNull || (src.indexOf('for') !== -1 && src.indexOf('of') !== -1))
|
||||
) {
|
||||
// Needed for regenerator
|
||||
extraPlugins.push([
|
||||
require('@babel/plugin-transform-for-of'),
|
||||
{loose: true},
|
||||
]);
|
||||
}
|
||||
|
||||
if (enableBabelRuntime !== false) {
|
||||
// A string value pins a specific runtime version to optimize output.
|
||||
const isVersion = typeof enableBabelRuntime === 'string';
|
||||
@@ -298,15 +247,13 @@ const getPreset = (src, options, babel) => {
|
||||
require('@babel/plugin-transform-runtime'),
|
||||
{
|
||||
helpers: true,
|
||||
regenerator: enableRegenerator,
|
||||
regenerator: false,
|
||||
...(isVersion && {version: enableBabelRuntime}),
|
||||
...(babelRuntimeModuleName != null && {
|
||||
moduleName: babelRuntimeModuleName,
|
||||
}),
|
||||
},
|
||||
]);
|
||||
} else if (enableRegenerator) {
|
||||
extraPlugins.push([require('@babel/plugin-transform-regenerator')]);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -8,20 +8,25 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
const {setVersion} = require('../set-version');
|
||||
const path = require('node:path');
|
||||
|
||||
jest.mock('../../shared/consts', () => ({
|
||||
REPO_ROOT: path.join(__dirname, '__fixtures__', 'set-version'),
|
||||
PACKAGES_DIR: path.join(__dirname, '__fixtures__', 'set-version', 'packages'),
|
||||
REACT_NATIVE_PACKAGE_DIR: path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'set-version',
|
||||
'packages',
|
||||
'react-native',
|
||||
),
|
||||
}));
|
||||
jest.mock('../../shared/consts', () => {
|
||||
const path = require('node:path');
|
||||
return {
|
||||
REPO_ROOT: path.join(__dirname, '__fixtures__', 'set-version'),
|
||||
PACKAGES_DIR: path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'set-version',
|
||||
'packages',
|
||||
),
|
||||
REACT_NATIVE_PACKAGE_DIR: path.join(
|
||||
__dirname,
|
||||
'__fixtures__',
|
||||
'set-version',
|
||||
'packages',
|
||||
'react-native',
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
let customWriteFileExpect = null;
|
||||
const writeFileMock = jest.fn().mockImplementation((filePath, content) => {
|
||||
@@ -45,27 +50,30 @@ const writeFileMock = jest.fn().mockImplementation((filePath, content) => {
|
||||
expect(content).toMatchSnapshot(normalizedFilePath);
|
||||
});
|
||||
|
||||
// set-version's dependencies read `fs` and the repo paths when they load, so
|
||||
// both are mocked before it is required. Otherwise it writes to the real repo.
|
||||
jest.mock('node:fs', () => {
|
||||
// $FlowFixMe[underconstrained-implicit-instantiation]
|
||||
const originalFs = jest.requireActual('node:fs');
|
||||
|
||||
return {
|
||||
...originalFs,
|
||||
writeFileSync: writeFileMock,
|
||||
promises: {
|
||||
...originalFs.promises,
|
||||
writeFile: writeFileMock,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const {setVersion} = require('../set-version');
|
||||
const path = require('node:path');
|
||||
|
||||
describe('setVersion', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
jest.mock('node:fs', () => {
|
||||
// $FlowFixMe[underconstrained-implicit-instantiation]
|
||||
const originalFs = jest.requireActual('node:fs');
|
||||
|
||||
return {
|
||||
...originalFs,
|
||||
writeFileSync: writeFileMock,
|
||||
promises: {
|
||||
...originalFs.promises,
|
||||
writeFile: writeFileMock,
|
||||
},
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
test('updates monorepo for release-candidate', async () => {
|
||||
await setVersion('0.80.0-rc.3');
|
||||
});
|
||||
|
||||
@@ -629,7 +629,7 @@
|
||||
"@babel/helper-plugin-utils" "^7.26.5"
|
||||
"@babel/plugin-syntax-flow" "^7.26.0"
|
||||
|
||||
"@babel/plugin-transform-for-of@^7.24.7", "@babel/plugin-transform-for-of@^7.26.9":
|
||||
"@babel/plugin-transform-for-of@^7.26.9":
|
||||
version "7.26.9"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.26.9.tgz#27231f79d5170ef33b5111f07fe5cafeb2c96a56"
|
||||
integrity sha512-Hry8AusVm8LW5BVFgiyUReuoGzPUpdHQQqJY5bZnbbf+ngOHWuCuYFKw/BqaaWlvEUrF91HMhDtEaI1hZzNbLg==
|
||||
@@ -754,7 +754,7 @@
|
||||
"@babel/helper-plugin-utils" "^7.25.9"
|
||||
"@babel/helper-replace-supers" "^7.25.9"
|
||||
|
||||
"@babel/plugin-transform-optional-catch-binding@^7.24.7", "@babel/plugin-transform-optional-catch-binding@^7.25.9":
|
||||
"@babel/plugin-transform-optional-catch-binding@^7.25.9":
|
||||
version "7.25.9"
|
||||
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-optional-catch-binding/-/plugin-transform-optional-catch-binding-7.25.9.tgz#10e70d96d52bb1f10c5caaac59ac545ea2ba7ff3"
|
||||
integrity sha512-qM/6m6hQZzDcZF3onzIhZeDHDO43bkNNlOX0i8n3lR6zLbu0GN2d8qfM/IERJZYauhAHSLHy39NF0Ctdvcid7g==
|
||||
|
||||
Reference in new issue
Block a user