bippy 0.3.25 → 0.3.27

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.
@@ -6,8 +6,7 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { _renderers, getRDTHook } from "./rdt-hook-D3niGi6-.js";
10
- import { ActivityComponentTag, ClassComponentTag, ForwardRefTag, FunctionComponentTag, HostComponentTag, HostHoistableTag, HostSingletonTag, LazyComponentTag, SimpleMemoComponentTag, SuspenseComponentTag, SuspenseListComponentTag, ViewTransitionComponentTag, getDisplayName, getType, isCompositeFiber, isHostFiber, traverseFiber } from "./src-SdIrANMc.js";
9
+ import { ActivityComponentTag, ClassComponentTag, ForwardRefTag, FunctionComponentTag, HostComponentTag, HostHoistableTag, HostSingletonTag, LazyComponentTag, SimpleMemoComponentTag, SuspenseComponentTag, SuspenseListComponentTag, ViewTransitionComponentTag, _renderers, getDisplayName, getRDTHook, getType, isCompositeFiber, isHostFiber, traverseFiber } from "./src-CjbZfmEx.js";
11
10
 
12
11
  //#region rolldown:runtime
13
12
  var __create = Object.create;
@@ -2235,19 +2234,6 @@ let reentry = false;
2235
2234
  const describeBuiltInComponentFrame = (name) => {
2236
2235
  return `\n in ${name}`;
2237
2236
  };
2238
- const disableLogs = () => {
2239
- const prev = {
2240
- error: console.error,
2241
- warn: console.warn
2242
- };
2243
- console.error = () => {};
2244
- console.warn = () => {};
2245
- return prev;
2246
- };
2247
- const reenableLogs = (prev) => {
2248
- console.error = prev.error;
2249
- console.warn = prev.warn;
2250
- };
2251
2237
  const INLINE_SOURCEMAP_REGEX = /^data:application\/json[^,]+base64,/;
2252
2238
  const SOURCEMAP_REGEX = /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*(?:\*\/)[ \t]*$)/;
2253
2239
  const getSourceMap = async (url, content) => {
@@ -2267,11 +2253,6 @@ const getSourceMap = async (url, content) => {
2267
2253
  const rawSourceMap = await response.json();
2268
2254
  return new import_source_map.SourceMapConsumer(rawSourceMap);
2269
2255
  };
2270
- const getRemovedFileProtocolPath = (path) => {
2271
- const protocol = "file://";
2272
- if (path.startsWith(protocol)) return path.substring(protocol.length);
2273
- return path;
2274
- };
2275
2256
  const parseStackFrame = async (frame) => {
2276
2257
  const source = parseStack(frame);
2277
2258
  if (!source.length) return null;
@@ -2287,14 +2268,14 @@ const parseStackFrame = async (frame) => {
2287
2268
  column: columnNumber
2288
2269
  });
2289
2270
  return {
2290
- fileName: getRemovedFileProtocolPath(sourcemap.file || result.source),
2271
+ fileName: (sourcemap.file || result.source).replace(/^file:\/\//, ""),
2291
2272
  lineNumber: result.line,
2292
2273
  columnNumber: result.column
2293
2274
  };
2294
2275
  }
2295
2276
  }
2296
2277
  return {
2297
- fileName: getRemovedFileProtocolPath(fileName),
2278
+ fileName: fileName.replace(/^file:\/\//, ""),
2298
2279
  lineNumber,
2299
2280
  columnNumber
2300
2281
  };
@@ -2306,7 +2287,10 @@ const describeNativeComponentFrame = (fn, construct) => {
2306
2287
  reentry = true;
2307
2288
  const previousDispatcher = getCurrentDispatcher();
2308
2289
  setCurrentDispatcher(null);
2309
- const prevLogs = disableLogs();
2290
+ const prevError = console.error;
2291
+ const prevWarn = console.warn;
2292
+ console.error = () => {};
2293
+ console.warn = () => {};
2310
2294
  try {
2311
2295
  /**
2312
2296
  * Finding a common stack frame between sample and control errors can be
@@ -2365,26 +2349,26 @@ const describeNativeComponentFrame = (fn, construct) => {
2365
2349
  if (sampleStack && controlStack) {
2366
2350
  const sampleLines = sampleStack.split("\n");
2367
2351
  const controlLines = controlStack.split("\n");
2368
- let s = 0;
2369
- let c = 0;
2370
- while (s < sampleLines.length && !sampleLines[s].includes("DetermineComponentFrameRoot")) s++;
2371
- while (c < controlLines.length && !controlLines[c].includes("DetermineComponentFrameRoot")) c++;
2372
- if (s === sampleLines.length || c === controlLines.length) {
2373
- s = sampleLines.length - 1;
2374
- c = controlLines.length - 1;
2375
- while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) c--;
2352
+ let sampleIndex = 0;
2353
+ let controlIndex = 0;
2354
+ while (sampleIndex < sampleLines.length && !sampleLines[sampleIndex].includes("DetermineComponentFrameRoot")) sampleIndex++;
2355
+ while (controlIndex < controlLines.length && !controlLines[controlIndex].includes("DetermineComponentFrameRoot")) controlIndex++;
2356
+ if (sampleIndex === sampleLines.length || controlIndex === controlLines.length) {
2357
+ sampleIndex = sampleLines.length - 1;
2358
+ controlIndex = controlLines.length - 1;
2359
+ while (sampleIndex >= 1 && controlIndex >= 0 && sampleLines[sampleIndex] !== controlLines[controlIndex]) controlIndex--;
2376
2360
  }
2377
- for (; s >= 1 && c >= 0; s--, c--) if (sampleLines[s] !== controlLines[c]) {
2378
- if (s !== 1 || c !== 1) do {
2379
- s--;
2380
- c--;
2381
- if (c < 0 || sampleLines[s] !== controlLines[c]) {
2382
- let frame = `\n${sampleLines[s].replace(" at new ", " at ")}`;
2361
+ for (; sampleIndex >= 1 && controlIndex >= 0; sampleIndex--, controlIndex--) if (sampleLines[sampleIndex] !== controlLines[controlIndex]) {
2362
+ if (sampleIndex !== 1 || controlIndex !== 1) do {
2363
+ sampleIndex--;
2364
+ controlIndex--;
2365
+ if (controlIndex < 0 || sampleLines[sampleIndex] !== controlLines[controlIndex]) {
2366
+ let frame = `\n${sampleLines[sampleIndex].replace(" at new ", " at ")}`;
2383
2367
  const displayName = getDisplayName(fn);
2384
2368
  if (displayName && frame.includes("<anonymous>")) frame = frame.replace("<anonymous>", displayName);
2385
2369
  return frame;
2386
2370
  }
2387
- } while (s >= 1 && c >= 0);
2371
+ } while (sampleIndex >= 1 && controlIndex >= 0);
2388
2372
  break;
2389
2373
  }
2390
2374
  }
@@ -2392,7 +2376,8 @@ const describeNativeComponentFrame = (fn, construct) => {
2392
2376
  reentry = false;
2393
2377
  Error.prepareStackTrace = previousPrepareStackTrace;
2394
2378
  setCurrentDispatcher(previousDispatcher);
2395
- reenableLogs(prevLogs);
2379
+ console.error = prevError;
2380
+ console.warn = prevWarn;
2396
2381
  }
2397
2382
  const name = fn ? getDisplayName(fn) : "";
2398
2383
  const syntheticFrame = name ? describeBuiltInComponentFrame(name) : "";
@@ -2422,8 +2407,7 @@ const formatOwnerStack = (error) => {
2422
2407
  if (stack.startsWith("Error: react-stack-top-frame\n")) stack = stack.slice(29);
2423
2408
  let idx = stack.indexOf("\n");
2424
2409
  if (idx !== -1) stack = stack.slice(idx + 1);
2425
- idx = stack.indexOf("react_stack_bottom_frame");
2426
- if (idx === -1) idx = stack.indexOf("react-stack-bottom-frame");
2410
+ idx = Math.max(stack.indexOf("react_stack_bottom_frame"), stack.indexOf("react-stack-bottom-frame"));
2427
2411
  if (idx !== -1) idx = stack.lastIndexOf("\n", idx);
2428
2412
  if (idx !== -1) stack = stack.slice(0, idx);
2429
2413
  else return "";
@@ -2472,22 +2456,14 @@ const describeFiber = (fiber, childFiber) => {
2472
2456
  return describeBuiltInComponentFrame("Suspense");
2473
2457
  case SuspenseListComponentTag: return describeBuiltInComponentFrame("SuspenseList");
2474
2458
  case FunctionComponentTag:
2475
- case SimpleMemoComponentTag: return describeFunctionComponentFrame(fiber.type);
2476
- case ForwardRefTag: return describeFunctionComponentFrame(fiber.type.render);
2477
- case ClassComponentTag: return describeClassComponentFrame(fiber.type);
2459
+ case SimpleMemoComponentTag: return describeNativeComponentFrame(fiber.type, false);
2460
+ case ForwardRefTag: return describeNativeComponentFrame(fiber.type.render, false);
2461
+ case ClassComponentTag: return describeNativeComponentFrame(fiber.type, true);
2478
2462
  case ActivityComponentTag: return describeBuiltInComponentFrame("Activity");
2479
2463
  case ViewTransitionComponentTag: return describeBuiltInComponentFrame("ViewTransition");
2480
2464
  default: return "";
2481
2465
  }
2482
2466
  };
2483
- const describeFunctionComponentFrame = (fn) => {
2484
- if (!fn || reentry) return "";
2485
- return describeNativeComponentFrame(fn, false);
2486
- };
2487
- const describeClassComponentFrame = (fn) => {
2488
- if (!fn || reentry) return "";
2489
- return describeNativeComponentFrame(fn, true);
2490
- };
2491
2467
  const describeDebugInfoFrame = (name, env, _debugLocation) => {
2492
2468
  let result = `\n in ${name}`;
2493
2469
  if (env) result += ` (at ${env})`;
@@ -2524,20 +2500,24 @@ const getOwnerStack = async (stackTrace) => {
2524
2500
  let match;
2525
2501
  match = componentPattern.exec(stackTrace);
2526
2502
  while (match !== null) {
2527
- const componentName = match[1];
2503
+ const name = match[1];
2528
2504
  const locationStr = match[2];
2529
- if (!isCapitalized(componentName)) {
2505
+ if (!isCapitalized(name)) {
2530
2506
  match = componentPattern.exec(stackTrace);
2507
+ matches.push({
2508
+ name,
2509
+ source: void 0
2510
+ });
2531
2511
  continue;
2532
2512
  }
2533
2513
  let source;
2534
2514
  if (locationStr && locationStr !== "Server") try {
2535
- const mockFrame = ` at ${componentName} (${locationStr})`;
2515
+ const mockFrame = ` at ${name} (${locationStr})`;
2536
2516
  const parsedSource = await parseStackFrame(mockFrame);
2537
2517
  if (parsedSource) source = parsedSource;
2538
2518
  } catch {}
2539
2519
  matches.push({
2540
- componentName,
2520
+ name,
2541
2521
  source: source || void 0
2542
2522
  });
2543
2523
  match = componentPattern.exec(stackTrace);
@@ -2546,4 +2526,4 @@ const getOwnerStack = async (stackTrace) => {
2546
2526
  };
2547
2527
 
2548
2528
  //#endregion
2549
- export { describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFiber, describeFunctionComponentFrame, describeNativeComponentFrame, disableLogs, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getRemovedFileProtocolPath, getSourceMap, isCapitalized, parseStackFrame, reenableLogs, setCurrentDispatcher };
2529
+ export { describeBuiltInComponentFrame, describeDebugInfoFrame, describeFiber, describeNativeComponentFrame, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getSourceMap, isCapitalized, parseStackFrame, setCurrentDispatcher };
package/dist/source.cjs CHANGED
@@ -6,26 +6,20 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- const require_source = require('./source-B2Lz42Ab.cjs');
10
- require('./rdt-hook-CjHiFJfl.cjs');
11
- require('./src-Cy85kpeY.cjs');
9
+ const require_source = require('./source-B7n25ucM.cjs');
10
+ require('./src-BZnHmVEI.cjs');
12
11
 
13
12
  exports.describeBuiltInComponentFrame = require_source.describeBuiltInComponentFrame;
14
- exports.describeClassComponentFrame = require_source.describeClassComponentFrame;
15
13
  exports.describeDebugInfoFrame = require_source.describeDebugInfoFrame;
16
14
  exports.describeFiber = require_source.describeFiber;
17
- exports.describeFunctionComponentFrame = require_source.describeFunctionComponentFrame;
18
15
  exports.describeNativeComponentFrame = require_source.describeNativeComponentFrame;
19
- exports.disableLogs = require_source.disableLogs;
20
16
  exports.formatOwnerStack = require_source.formatOwnerStack;
21
17
  exports.getCurrentDispatcher = require_source.getCurrentDispatcher;
22
18
  exports.getFiberSource = require_source.getFiberSource;
23
19
  exports.getFiberStackFrame = require_source.getFiberStackFrame;
24
20
  exports.getFiberStackTrace = require_source.getFiberStackTrace;
25
21
  exports.getOwnerStack = require_source.getOwnerStack;
26
- exports.getRemovedFileProtocolPath = require_source.getRemovedFileProtocolPath;
27
22
  exports.getSourceMap = require_source.getSourceMap;
28
23
  exports.isCapitalized = require_source.isCapitalized;
29
24
  exports.parseStackFrame = require_source.parseStackFrame;
30
- exports.reenableLogs = require_source.reenableLogs;
31
25
  exports.setCurrentDispatcher = require_source.setCurrentDispatcher;
package/dist/source.d.cts CHANGED
@@ -9,22 +9,7 @@ interface FiberSource {
9
9
  columnNumber: number;
10
10
  }
11
11
  declare const describeBuiltInComponentFrame: (name: string) => string;
12
- declare const disableLogs: () => {
13
- error: {
14
- (...data: any[]): void;
15
- (message?: any, ...optionalParams: any[]): void;
16
- };
17
- warn: {
18
- (...data: any[]): void;
19
- (message?: any, ...optionalParams: any[]): void;
20
- };
21
- };
22
- declare const reenableLogs: (prev: {
23
- error: typeof console.error;
24
- warn: typeof console.warn;
25
- }) => void;
26
12
  declare const getSourceMap: (url: string, content: string) => Promise<SourceMapConsumer | null>;
27
- declare const getRemovedFileProtocolPath: (path: string) => string;
28
13
  declare const parseStackFrame: (frame: string) => Promise<FiberSource | null>;
29
14
  declare const describeNativeComponentFrame: (fn: React$1.ComponentType<unknown>, construct: boolean) => string;
30
15
  declare const getCurrentDispatcher: () => React$1.RefObject<unknown> | null;
@@ -33,16 +18,14 @@ declare const formatOwnerStack: (error: Error) => string;
33
18
  declare const getFiberStackFrame: (fiber: Fiber) => string | null;
34
19
  declare const getFiberSource: (fiber: Fiber) => Promise<FiberSource | null>;
35
20
  declare const describeFiber: (fiber: Fiber, childFiber: null | Fiber) => string;
36
- declare const describeFunctionComponentFrame: (fn: React$1.ComponentType<unknown>) => string;
37
- declare const describeClassComponentFrame: (fn: React$1.ComponentType<unknown>) => string;
38
21
  declare const describeDebugInfoFrame: (name: string, env?: string, _debugLocation?: unknown) => string;
39
22
  declare const getFiberStackTrace: (workInProgress: Fiber) => string;
40
23
  declare const isCapitalized: (str: string) => boolean;
41
24
  interface OwnerStackItem {
42
- componentName: string;
25
+ name: string;
43
26
  source?: FiberSource;
44
27
  }
45
28
  declare const getOwnerStack: (stackTrace: string) => Promise<OwnerStackItem[]>;
46
29
 
47
30
  //#endregion
48
- export { FiberSource, OwnerStackItem, describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFiber, describeFunctionComponentFrame, describeNativeComponentFrame, disableLogs, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getRemovedFileProtocolPath, getSourceMap, isCapitalized, parseStackFrame, reenableLogs, setCurrentDispatcher };
31
+ export { FiberSource, OwnerStackItem, describeBuiltInComponentFrame, describeDebugInfoFrame, describeFiber, describeNativeComponentFrame, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getSourceMap, isCapitalized, parseStackFrame, setCurrentDispatcher };
package/dist/source.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Fiber } from "./types-CeFOA1ZM.js";
1
+ import { Fiber } from "./types-Bud6qf-i.js";
2
2
  import * as React$1 from "react";
3
3
  import { SourceMapConsumer } from "source-map-js";
4
4
 
@@ -9,22 +9,7 @@ interface FiberSource {
9
9
  columnNumber: number;
10
10
  }
11
11
  declare const describeBuiltInComponentFrame: (name: string) => string;
12
- declare const disableLogs: () => {
13
- error: {
14
- (...data: any[]): void;
15
- (message?: any, ...optionalParams: any[]): void;
16
- };
17
- warn: {
18
- (...data: any[]): void;
19
- (message?: any, ...optionalParams: any[]): void;
20
- };
21
- };
22
- declare const reenableLogs: (prev: {
23
- error: typeof console.error;
24
- warn: typeof console.warn;
25
- }) => void;
26
12
  declare const getSourceMap: (url: string, content: string) => Promise<SourceMapConsumer | null>;
27
- declare const getRemovedFileProtocolPath: (path: string) => string;
28
13
  declare const parseStackFrame: (frame: string) => Promise<FiberSource | null>;
29
14
  declare const describeNativeComponentFrame: (fn: React$1.ComponentType<unknown>, construct: boolean) => string;
30
15
  declare const getCurrentDispatcher: () => React$1.RefObject<unknown> | null;
@@ -33,16 +18,14 @@ declare const formatOwnerStack: (error: Error) => string;
33
18
  declare const getFiberStackFrame: (fiber: Fiber) => string | null;
34
19
  declare const getFiberSource: (fiber: Fiber) => Promise<FiberSource | null>;
35
20
  declare const describeFiber: (fiber: Fiber, childFiber: null | Fiber) => string;
36
- declare const describeFunctionComponentFrame: (fn: React$1.ComponentType<unknown>) => string;
37
- declare const describeClassComponentFrame: (fn: React$1.ComponentType<unknown>) => string;
38
21
  declare const describeDebugInfoFrame: (name: string, env?: string, _debugLocation?: unknown) => string;
39
22
  declare const getFiberStackTrace: (workInProgress: Fiber) => string;
40
23
  declare const isCapitalized: (str: string) => boolean;
41
24
  interface OwnerStackItem {
42
- componentName: string;
25
+ name: string;
43
26
  source?: FiberSource;
44
27
  }
45
28
  declare const getOwnerStack: (stackTrace: string) => Promise<OwnerStackItem[]>;
46
29
 
47
30
  //#endregion
48
- export { FiberSource, OwnerStackItem, describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFiber, describeFunctionComponentFrame, describeNativeComponentFrame, disableLogs, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getRemovedFileProtocolPath, getSourceMap, isCapitalized, parseStackFrame, reenableLogs, setCurrentDispatcher };
31
+ export { FiberSource, OwnerStackItem, describeBuiltInComponentFrame, describeDebugInfoFrame, describeFiber, describeNativeComponentFrame, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getSourceMap, isCapitalized, parseStackFrame, setCurrentDispatcher };
package/dist/source.js CHANGED
@@ -6,8 +6,7 @@
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
- import { describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFiber, describeFunctionComponentFrame, describeNativeComponentFrame, disableLogs, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getRemovedFileProtocolPath, getSourceMap, isCapitalized, parseStackFrame, reenableLogs, setCurrentDispatcher } from "./source-DDEKmBrT.js";
10
- import "./rdt-hook-D3niGi6-.js";
11
- import "./src-SdIrANMc.js";
9
+ import { describeBuiltInComponentFrame, describeDebugInfoFrame, describeFiber, describeNativeComponentFrame, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getSourceMap, isCapitalized, parseStackFrame, setCurrentDispatcher } from "./source-BsqRDfoP.js";
10
+ import "./src-CjbZfmEx.js";
12
11
 
13
- export { describeBuiltInComponentFrame, describeClassComponentFrame, describeDebugInfoFrame, describeFiber, describeFunctionComponentFrame, describeNativeComponentFrame, disableLogs, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getRemovedFileProtocolPath, getSourceMap, isCapitalized, parseStackFrame, reenableLogs, setCurrentDispatcher };
12
+ export { describeBuiltInComponentFrame, describeDebugInfoFrame, describeFiber, describeNativeComponentFrame, formatOwnerStack, getCurrentDispatcher, getFiberSource, getFiberStackFrame, getFiberStackTrace, getOwnerStack, getSourceMap, isCapitalized, parseStackFrame, setCurrentDispatcher };