bippy 0.3.8 → 0.3.10

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2024 Aiden Bai, Million Software, Inc.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,4 +1,4 @@
1
- import { getRDTHook, isHostFiber, getType, traverseFiber, isCompositeFiber, ClassComponentTag, getDisplayName } from './chunk-UTLFO7LL.js';
1
+ import { getRDTHook, isHostFiber, getType, traverseFiber, isCompositeFiber, ClassComponentTag, getDisplayName } from './chunk-GA5TCJWK.js';
2
2
  import { __commonJS, __toESM } from './chunk-EPG3GO3H.js';
3
3
  import React from 'react';
4
4
 
@@ -2079,65 +2079,71 @@ var describeNativeComponentFrame = (fn, construct, currentDispatcherRef) => {
2079
2079
  const previousDispatcher = currentDispatcherRef.current;
2080
2080
  currentDispatcherRef.current = null;
2081
2081
  const prevLogs = disableLogs();
2082
- const RunInRootFrame = {
2083
- DetermineComponentFrameRoot() {
2084
- let control;
2085
- try {
2086
- if (construct) {
2087
- const Fake = () => {
2088
- throw Error();
2089
- };
2090
- Object.defineProperty(Fake.prototype, "props", {
2091
- set: () => {
2082
+ try {
2083
+ const RunInRootFrame = {
2084
+ DetermineComponentFrameRoot() {
2085
+ let control;
2086
+ try {
2087
+ if (construct) {
2088
+ const Fake = function() {
2092
2089
  throw Error();
2090
+ };
2091
+ Object.defineProperty(Fake.prototype, "props", {
2092
+ // biome-ignore lint/complexity/useArrowFunction: OK
2093
+ set: function() {
2094
+ throw Error();
2095
+ }
2096
+ });
2097
+ if (typeof Reflect === "object" && Reflect.construct) {
2098
+ try {
2099
+ Reflect.construct(Fake, []);
2100
+ } catch (x) {
2101
+ control = x;
2102
+ }
2103
+ Reflect.construct(fn, [], Fake);
2104
+ } else {
2105
+ try {
2106
+ Fake.call();
2107
+ } catch (x) {
2108
+ control = x;
2109
+ }
2110
+ fn.call(Fake.prototype);
2093
2111
  }
2094
- });
2095
- if (typeof Reflect === "object" && Reflect.construct) {
2096
- try {
2097
- Reflect.construct(Fake, []);
2098
- } catch (x) {
2099
- control = x;
2100
- }
2101
- Reflect.construct(fn, [], Fake);
2102
2112
  } else {
2103
2113
  try {
2104
- Fake.call(null);
2114
+ throw Error();
2105
2115
  } catch (x) {
2106
2116
  control = x;
2107
2117
  }
2108
- fn.call(Fake.prototype);
2109
- }
2110
- } else {
2111
- try {
2112
- throw Error();
2113
- } catch (x) {
2114
- control = x;
2118
+ const maybePromise = fn();
2119
+ if (maybePromise && typeof maybePromise.catch === "function") {
2120
+ maybePromise.catch(() => {
2121
+ });
2122
+ }
2115
2123
  }
2116
- const maybePromise = fn();
2117
- if (maybePromise && typeof maybePromise === "object" && "catch" in maybePromise && typeof maybePromise.catch === "function") {
2118
- maybePromise.catch(() => {
2119
- });
2124
+ } catch (sample) {
2125
+ if (sample && control && typeof sample.stack === "string") {
2126
+ return [sample.stack, control.stack];
2120
2127
  }
2121
2128
  }
2122
- } catch (sample) {
2123
- if (sample instanceof Error && control && control.stack && sample.stack) {
2124
- return [sample.stack, control.stack];
2125
- }
2129
+ return [null, null];
2126
2130
  }
2127
- return [null, null];
2131
+ };
2132
+ RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
2133
+ const namePropDescriptor = Object.getOwnPropertyDescriptor(
2134
+ RunInRootFrame.DetermineComponentFrameRoot,
2135
+ "name"
2136
+ );
2137
+ if (namePropDescriptor?.configurable) {
2138
+ Object.defineProperty(
2139
+ RunInRootFrame.DetermineComponentFrameRoot,
2140
+ // Configurable properties can be updated even if its writable descriptor
2141
+ // is set to `false`.
2142
+ // $FlowFixMe[cannot-write]
2143
+ "name",
2144
+ { value: "DetermineComponentFrameRoot" }
2145
+ );
2128
2146
  }
2129
- };
2130
- RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
2131
- const namePropDescriptor = Object.getOwnPropertyDescriptor(
2132
- RunInRootFrame.DetermineComponentFrameRoot,
2133
- "name"
2134
- );
2135
- if (namePropDescriptor?.configurable) {
2136
- Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, "name", {
2137
- value: "DetermineComponentFrameRoot"
2138
- });
2139
- }
2140
- try {
2141
2147
  const [sampleStack, controlStack] = RunInRootFrame.DetermineComponentFrameRoot();
2142
2148
  if (sampleStack && controlStack) {
2143
2149
  const sampleLines = sampleStack.split("\n");
@@ -2181,7 +2187,7 @@ ${sampleLines[s].replace(" at new ", " at ")}`;
2181
2187
  } finally {
2182
2188
  reentry = false;
2183
2189
  Error.prepareStackTrace = previousPrepareStackTrace;
2184
- currentDispatcherRef.current = previousDispatcher;
2190
+ currentDispatcherRef.H = previousDispatcher;
2185
2191
  reenableLogs(prevLogs);
2186
2192
  }
2187
2193
  const name = fn ? getDisplayName(fn) : "";
@@ -2224,7 +2230,7 @@ var getFiberSource = async (fiber) => {
2224
2230
  if (isCompositeFiber(f)) return true;
2225
2231
  },
2226
2232
  true
2227
- )
2233
+ )?.type
2228
2234
  ) : getType(fiber.type);
2229
2235
  if (!componentFunction || reentry) {
2230
2236
  return null;
@@ -1,4 +1,4 @@
1
- import { safelyInstallRDTHook } from './chunk-UTLFO7LL.js';
1
+ import { safelyInstallRDTHook } from './chunk-GA5TCJWK.js';
2
2
 
3
3
  /**
4
4
  * @license bippy
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  // src/rdt-hook.ts
11
- var version = "0.3.8";
11
+ var version = "0.3.10";
12
12
  var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
13
13
  var objectDefineProperty = Object.defineProperty;
14
14
  var objectHasOwnProperty = Object.prototype.hasOwnProperty;
@@ -95,10 +95,9 @@ var installRDTHook = (onActive) => {
95
95
  hasRanHack = true;
96
96
  return -0;
97
97
  }
98
- return originalWindowHasOwnProperty.apply(this, arguments);
99
98
  } catch {
100
- return originalWindowHasOwnProperty.apply(this, arguments);
101
99
  }
100
+ return originalWindowHasOwnProperty.apply(this, arguments);
102
101
  },
103
102
  configurable: true,
104
103
  writable: true
@@ -469,7 +468,7 @@ var getLatestFiber = (fiber) => {
469
468
  const latestFiber = traverseFiber(root.current, (innerFiber) => {
470
469
  if (innerFiber === fiber) return true;
471
470
  });
472
- return latestFiber || alternate;
471
+ if (latestFiber) return latestFiber;
473
472
  }
474
473
  return fiber;
475
474
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXUTTH4PR_cjs = require('./chunk-XUTTH4PR.cjs');
3
+ var chunkOXTRHN64_cjs = require('./chunk-OXTRHN64.cjs');
4
4
 
5
5
  /**
6
6
  * @license bippy
@@ -12,4 +12,4 @@ var chunkXUTTH4PR_cjs = require('./chunk-XUTTH4PR.cjs');
12
12
  */
13
13
 
14
14
  // src/index.ts
15
- chunkXUTTH4PR_cjs.safelyInstallRDTHook();
15
+ chunkOXTRHN64_cjs.safelyInstallRDTHook();
@@ -10,7 +10,7 @@
10
10
  */
11
11
 
12
12
  // src/rdt-hook.ts
13
- var version = "0.3.8";
13
+ var version = "0.3.10";
14
14
  var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
15
15
  var objectDefineProperty = Object.defineProperty;
16
16
  var objectHasOwnProperty = Object.prototype.hasOwnProperty;
@@ -97,10 +97,9 @@ var installRDTHook = (onActive) => {
97
97
  hasRanHack = true;
98
98
  return -0;
99
99
  }
100
- return originalWindowHasOwnProperty.apply(this, arguments);
101
100
  } catch {
102
- return originalWindowHasOwnProperty.apply(this, arguments);
103
101
  }
102
+ return originalWindowHasOwnProperty.apply(this, arguments);
104
103
  },
105
104
  configurable: true,
106
105
  writable: true
@@ -471,7 +470,7 @@ var getLatestFiber = (fiber) => {
471
470
  const latestFiber = traverseFiber(root.current, (innerFiber) => {
472
471
  if (innerFiber === fiber) return true;
473
472
  });
474
- return latestFiber || alternate;
473
+ if (latestFiber) return latestFiber;
475
474
  }
476
475
  return fiber;
477
476
  };
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXUTTH4PR_cjs = require('./chunk-XUTTH4PR.cjs');
3
+ var chunkOXTRHN64_cjs = require('./chunk-OXTRHN64.cjs');
4
4
  var chunkAQ674A4M_cjs = require('./chunk-AQ674A4M.cjs');
5
5
  var React = require('react');
6
6
 
@@ -2085,65 +2085,71 @@ var describeNativeComponentFrame = (fn, construct, currentDispatcherRef) => {
2085
2085
  const previousDispatcher = currentDispatcherRef.current;
2086
2086
  currentDispatcherRef.current = null;
2087
2087
  const prevLogs = disableLogs();
2088
- const RunInRootFrame = {
2089
- DetermineComponentFrameRoot() {
2090
- let control;
2091
- try {
2092
- if (construct) {
2093
- const Fake = () => {
2094
- throw Error();
2095
- };
2096
- Object.defineProperty(Fake.prototype, "props", {
2097
- set: () => {
2088
+ try {
2089
+ const RunInRootFrame = {
2090
+ DetermineComponentFrameRoot() {
2091
+ let control;
2092
+ try {
2093
+ if (construct) {
2094
+ const Fake = function() {
2098
2095
  throw Error();
2096
+ };
2097
+ Object.defineProperty(Fake.prototype, "props", {
2098
+ // biome-ignore lint/complexity/useArrowFunction: OK
2099
+ set: function() {
2100
+ throw Error();
2101
+ }
2102
+ });
2103
+ if (typeof Reflect === "object" && Reflect.construct) {
2104
+ try {
2105
+ Reflect.construct(Fake, []);
2106
+ } catch (x) {
2107
+ control = x;
2108
+ }
2109
+ Reflect.construct(fn, [], Fake);
2110
+ } else {
2111
+ try {
2112
+ Fake.call();
2113
+ } catch (x) {
2114
+ control = x;
2115
+ }
2116
+ fn.call(Fake.prototype);
2099
2117
  }
2100
- });
2101
- if (typeof Reflect === "object" && Reflect.construct) {
2102
- try {
2103
- Reflect.construct(Fake, []);
2104
- } catch (x) {
2105
- control = x;
2106
- }
2107
- Reflect.construct(fn, [], Fake);
2108
2118
  } else {
2109
2119
  try {
2110
- Fake.call(null);
2120
+ throw Error();
2111
2121
  } catch (x) {
2112
2122
  control = x;
2113
2123
  }
2114
- fn.call(Fake.prototype);
2115
- }
2116
- } else {
2117
- try {
2118
- throw Error();
2119
- } catch (x) {
2120
- control = x;
2124
+ const maybePromise = fn();
2125
+ if (maybePromise && typeof maybePromise.catch === "function") {
2126
+ maybePromise.catch(() => {
2127
+ });
2128
+ }
2121
2129
  }
2122
- const maybePromise = fn();
2123
- if (maybePromise && typeof maybePromise === "object" && "catch" in maybePromise && typeof maybePromise.catch === "function") {
2124
- maybePromise.catch(() => {
2125
- });
2130
+ } catch (sample) {
2131
+ if (sample && control && typeof sample.stack === "string") {
2132
+ return [sample.stack, control.stack];
2126
2133
  }
2127
2134
  }
2128
- } catch (sample) {
2129
- if (sample instanceof Error && control && control.stack && sample.stack) {
2130
- return [sample.stack, control.stack];
2131
- }
2135
+ return [null, null];
2132
2136
  }
2133
- return [null, null];
2137
+ };
2138
+ RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
2139
+ const namePropDescriptor = Object.getOwnPropertyDescriptor(
2140
+ RunInRootFrame.DetermineComponentFrameRoot,
2141
+ "name"
2142
+ );
2143
+ if (namePropDescriptor?.configurable) {
2144
+ Object.defineProperty(
2145
+ RunInRootFrame.DetermineComponentFrameRoot,
2146
+ // Configurable properties can be updated even if its writable descriptor
2147
+ // is set to `false`.
2148
+ // $FlowFixMe[cannot-write]
2149
+ "name",
2150
+ { value: "DetermineComponentFrameRoot" }
2151
+ );
2134
2152
  }
2135
- };
2136
- RunInRootFrame.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
2137
- const namePropDescriptor = Object.getOwnPropertyDescriptor(
2138
- RunInRootFrame.DetermineComponentFrameRoot,
2139
- "name"
2140
- );
2141
- if (namePropDescriptor?.configurable) {
2142
- Object.defineProperty(RunInRootFrame.DetermineComponentFrameRoot, "name", {
2143
- value: "DetermineComponentFrameRoot"
2144
- });
2145
- }
2146
- try {
2147
2153
  const [sampleStack, controlStack] = RunInRootFrame.DetermineComponentFrameRoot();
2148
2154
  if (sampleStack && controlStack) {
2149
2155
  const sampleLines = sampleStack.split("\n");
@@ -2172,7 +2178,7 @@ var describeNativeComponentFrame = (fn, construct, currentDispatcherRef) => {
2172
2178
  if (c < 0 || sampleLines[s] !== controlLines[c]) {
2173
2179
  let frame = `
2174
2180
  ${sampleLines[s].replace(" at new ", " at ")}`;
2175
- const displayName = chunkXUTTH4PR_cjs.getDisplayName(fn);
2181
+ const displayName = chunkOXTRHN64_cjs.getDisplayName(fn);
2176
2182
  if (displayName && frame.includes("<anonymous>")) {
2177
2183
  frame = frame.replace("<anonymous>", displayName);
2178
2184
  }
@@ -2187,10 +2193,10 @@ ${sampleLines[s].replace(" at new ", " at ")}`;
2187
2193
  } finally {
2188
2194
  reentry = false;
2189
2195
  Error.prepareStackTrace = previousPrepareStackTrace;
2190
- currentDispatcherRef.current = previousDispatcher;
2196
+ currentDispatcherRef.H = previousDispatcher;
2191
2197
  reenableLogs(prevLogs);
2192
2198
  }
2193
- const name = fn ? chunkXUTTH4PR_cjs.getDisplayName(fn) : "";
2199
+ const name = fn ? chunkOXTRHN64_cjs.getDisplayName(fn) : "";
2194
2200
  const syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
2195
2201
  return syntheticFrame;
2196
2202
  };
@@ -2212,7 +2218,7 @@ var getFiberSource = async (fiber) => {
2212
2218
  if (fiber.memoizedProps?.__source) {
2213
2219
  return fiber.memoizedProps.__source;
2214
2220
  }
2215
- const rdtHook = chunkXUTTH4PR_cjs.getRDTHook();
2221
+ const rdtHook = chunkOXTRHN64_cjs.getRDTHook();
2216
2222
  let currentDispatcherRef = ReactSharedInternals?.ReactCurrentDispatcher || ReactSharedInternals?.H;
2217
2223
  for (const renderer of rdtHook.renderers.values()) {
2218
2224
  currentDispatcherRef = renderer.currentDispatcherRef;
@@ -2223,21 +2229,21 @@ var getFiberSource = async (fiber) => {
2223
2229
  if (!currentDispatcherRef) {
2224
2230
  return null;
2225
2231
  }
2226
- const componentFunction = chunkXUTTH4PR_cjs.isHostFiber(fiber) ? chunkXUTTH4PR_cjs.getType(
2227
- chunkXUTTH4PR_cjs.traverseFiber(
2232
+ const componentFunction = chunkOXTRHN64_cjs.isHostFiber(fiber) ? chunkOXTRHN64_cjs.getType(
2233
+ chunkOXTRHN64_cjs.traverseFiber(
2228
2234
  fiber,
2229
2235
  (f) => {
2230
- if (chunkXUTTH4PR_cjs.isCompositeFiber(f)) return true;
2236
+ if (chunkOXTRHN64_cjs.isCompositeFiber(f)) return true;
2231
2237
  },
2232
2238
  true
2233
- )
2234
- ) : chunkXUTTH4PR_cjs.getType(fiber.type);
2239
+ )?.type
2240
+ ) : chunkOXTRHN64_cjs.getType(fiber.type);
2235
2241
  if (!componentFunction || reentry) {
2236
2242
  return null;
2237
2243
  }
2238
2244
  const frame = describeNativeComponentFrame(
2239
2245
  componentFunction,
2240
- fiber.tag === chunkXUTTH4PR_cjs.ClassComponentTag,
2246
+ fiber.tag === chunkOXTRHN64_cjs.ClassComponentTag,
2241
2247
  ReactSharedInternals
2242
2248
  );
2243
2249
  return parseStackFrame(frame);