react-grab 0.0.13 → 0.0.14
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/dist/index.global.js +27 -28
- package/package.json +11 -12
- package/README.md +0 -46
package/dist/index.global.js
CHANGED
|
@@ -63,7 +63,7 @@ var ReactGrab = (function (exports) {
|
|
|
63
63
|
if (isKeyboardEventTriggeredByInput(event)) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
if (event.code ===
|
|
66
|
+
if (event.code === void 0) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
libStore.setState((state) => {
|
|
@@ -79,7 +79,7 @@ var ReactGrab = (function (exports) {
|
|
|
79
79
|
});
|
|
80
80
|
};
|
|
81
81
|
const handleKeyUp = (event) => {
|
|
82
|
-
if (event.code ===
|
|
82
|
+
if (event.code === void 0) {
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
85
|
libStore.setState((state) => {
|
|
@@ -164,10 +164,10 @@ var ReactGrab = (function (exports) {
|
|
|
164
164
|
let earliest;
|
|
165
165
|
for (const keyFromCombo of keysToInspect) {
|
|
166
166
|
const timestamp = getKeyFromTimestamps(keyFromCombo, timestamps);
|
|
167
|
-
if (timestamp ===
|
|
168
|
-
return
|
|
167
|
+
if (timestamp === void 0) {
|
|
168
|
+
return void 0;
|
|
169
169
|
}
|
|
170
|
-
if (earliest ===
|
|
170
|
+
if (earliest === void 0 || timestamp < earliest) {
|
|
171
171
|
earliest = timestamp;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
@@ -184,7 +184,7 @@ var ReactGrab = (function (exports) {
|
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
186
|
const earliestPressTime = getEarliestPressTime(keyPressTimestamps);
|
|
187
|
-
if (earliestPressTime ===
|
|
187
|
+
if (earliestPressTime === void 0) {
|
|
188
188
|
if (timeoutId !== null) {
|
|
189
189
|
clearTimeout(timeoutId);
|
|
190
190
|
timeoutId = null;
|
|
@@ -216,7 +216,7 @@ var ReactGrab = (function (exports) {
|
|
|
216
216
|
return cleanup;
|
|
217
217
|
};
|
|
218
218
|
|
|
219
|
-
// node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/src-R2iEnVC1.js
|
|
219
|
+
// ../../node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/src-R2iEnVC1.js
|
|
220
220
|
var version = "0.3.31";
|
|
221
221
|
var BIPPY_INSTRUMENTATION_STRING = `bippy-${version}`;
|
|
222
222
|
var objectDefineProperty = Object.defineProperty;
|
|
@@ -236,7 +236,7 @@ var ReactGrab = (function (exports) {
|
|
|
236
236
|
return "getFiberRoots" in rdtHook;
|
|
237
237
|
};
|
|
238
238
|
var isReactRefreshOverride = false;
|
|
239
|
-
var injectFnStr =
|
|
239
|
+
var injectFnStr = void 0;
|
|
240
240
|
var isReactRefresh = (rdtHook = getRDTHook()) => {
|
|
241
241
|
if (isReactRefreshOverride) return true;
|
|
242
242
|
if (typeof rdtHook.inject === "function") injectFnStr = rdtHook.inject.toString();
|
|
@@ -433,7 +433,7 @@ var ReactGrab = (function (exports) {
|
|
|
433
433
|
var _fiberRoots = /* @__PURE__ */ new Set();
|
|
434
434
|
safelyInstallRDTHook();
|
|
435
435
|
|
|
436
|
-
// node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/source-DWOhEbf2.js
|
|
436
|
+
// ../../node_modules/.pnpm/bippy@0.3.31_@types+react@19.2.2_react@19.2.0/node_modules/bippy/dist/source-DWOhEbf2.js
|
|
437
437
|
var __create = Object.create;
|
|
438
438
|
var __defProp = Object.defineProperty;
|
|
439
439
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -466,15 +466,15 @@ var ReactGrab = (function (exports) {
|
|
|
466
466
|
function extractLocation(urlLike) {
|
|
467
467
|
if (!urlLike.includes(":")) return [
|
|
468
468
|
urlLike,
|
|
469
|
-
|
|
470
|
-
|
|
469
|
+
void 0,
|
|
470
|
+
void 0
|
|
471
471
|
];
|
|
472
472
|
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
|
|
473
473
|
const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
|
|
474
474
|
return [
|
|
475
475
|
parts[1],
|
|
476
|
-
parts[2] ||
|
|
477
|
-
parts[3] ||
|
|
476
|
+
parts[2] || void 0,
|
|
477
|
+
parts[3] || void 0
|
|
478
478
|
];
|
|
479
479
|
}
|
|
480
480
|
function applySlice(lines, options) {
|
|
@@ -490,13 +490,13 @@ var ReactGrab = (function (exports) {
|
|
|
490
490
|
const location = sanitizedLine.match(/ (\(.+\)$)/);
|
|
491
491
|
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
|
|
492
492
|
const locationParts = extractLocation(location ? location[1] : sanitizedLine);
|
|
493
|
-
const functionName = location && sanitizedLine ||
|
|
494
|
-
const fileName = ["eval", "<anonymous>"].includes(locationParts[0]) ?
|
|
493
|
+
const functionName = location && sanitizedLine || void 0;
|
|
494
|
+
const fileName = ["eval", "<anonymous>"].includes(locationParts[0]) ? void 0 : locationParts[0];
|
|
495
495
|
return {
|
|
496
496
|
function: functionName,
|
|
497
497
|
file: fileName,
|
|
498
|
-
line: locationParts[1] ? +locationParts[1] :
|
|
499
|
-
col: locationParts[2] ? +locationParts[2] :
|
|
498
|
+
line: locationParts[1] ? +locationParts[1] : void 0,
|
|
499
|
+
col: locationParts[2] ? +locationParts[2] : void 0,
|
|
500
500
|
raw: line
|
|
501
501
|
};
|
|
502
502
|
});
|
|
@@ -511,13 +511,13 @@ var ReactGrab = (function (exports) {
|
|
|
511
511
|
else {
|
|
512
512
|
const functionNameRegex = /(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/;
|
|
513
513
|
const matches = line.match(functionNameRegex);
|
|
514
|
-
const functionName = matches && matches[1] ? matches[1] :
|
|
514
|
+
const functionName = matches && matches[1] ? matches[1] : void 0;
|
|
515
515
|
const locationParts = extractLocation(line.replace(functionNameRegex, ""));
|
|
516
516
|
return {
|
|
517
517
|
function: functionName,
|
|
518
518
|
file: locationParts[0],
|
|
519
|
-
line: locationParts[1] ? +locationParts[1] :
|
|
520
|
-
col: locationParts[2] ? +locationParts[2] :
|
|
519
|
+
line: locationParts[1] ? +locationParts[1] : void 0,
|
|
520
|
+
col: locationParts[2] ? +locationParts[2] : void 0,
|
|
521
521
|
raw: line
|
|
522
522
|
};
|
|
523
523
|
}
|
|
@@ -1219,7 +1219,7 @@ var ReactGrab = (function (exports) {
|
|
|
1219
1219
|
let sortCache = /* @__PURE__ */ new WeakMap();
|
|
1220
1220
|
exports.quickSort = function(ary, comparator, start = 0) {
|
|
1221
1221
|
let doQuickSort = sortCache.get(comparator);
|
|
1222
|
-
if (doQuickSort ===
|
|
1222
|
+
if (doQuickSort === void 0) {
|
|
1223
1223
|
doQuickSort = cloneSort(comparator);
|
|
1224
1224
|
sortCache.set(comparator, doQuickSort);
|
|
1225
1225
|
}
|
|
@@ -1316,7 +1316,7 @@ var ReactGrab = (function (exports) {
|
|
|
1316
1316
|
var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util$1.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
|
|
1317
1317
|
if (index >= 0) {
|
|
1318
1318
|
var mapping = this._originalMappings[index];
|
|
1319
|
-
if (aArgs.column ===
|
|
1319
|
+
if (aArgs.column === void 0) {
|
|
1320
1320
|
var originalLine = mapping.originalLine;
|
|
1321
1321
|
while (mapping && mapping.originalLine === originalLine) {
|
|
1322
1322
|
mappings.push({
|
|
@@ -1754,7 +1754,7 @@ var ReactGrab = (function (exports) {
|
|
|
1754
1754
|
var newLine = getNextLine() || "";
|
|
1755
1755
|
return lineContents + newLine;
|
|
1756
1756
|
function getNextLine() {
|
|
1757
|
-
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] :
|
|
1757
|
+
return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : void 0;
|
|
1758
1758
|
}
|
|
1759
1759
|
};
|
|
1760
1760
|
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
|
|
@@ -1798,7 +1798,7 @@ var ReactGrab = (function (exports) {
|
|
|
1798
1798
|
});
|
|
1799
1799
|
return node;
|
|
1800
1800
|
function addMappingWithCode(mapping, code) {
|
|
1801
|
-
if (mapping === null || mapping.source ===
|
|
1801
|
+
if (mapping === null || mapping.source === void 0) node.add(code);
|
|
1802
1802
|
else {
|
|
1803
1803
|
var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
|
|
1804
1804
|
node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
|
|
@@ -2011,7 +2011,7 @@ var ReactGrab = (function (exports) {
|
|
|
2011
2011
|
var describeNativeComponentFrame = (fn, construct) => {
|
|
2012
2012
|
if (!fn || reentry) return "";
|
|
2013
2013
|
const previousPrepareStackTrace = Error.prepareStackTrace;
|
|
2014
|
-
Error.prepareStackTrace =
|
|
2014
|
+
Error.prepareStackTrace = void 0;
|
|
2015
2015
|
reentry = true;
|
|
2016
2016
|
const previousDispatcher = getCurrentDispatcher();
|
|
2017
2017
|
setCurrentDispatcher(null);
|
|
@@ -2193,7 +2193,7 @@ ${error.stack}`;
|
|
|
2193
2193
|
match = componentPattern.exec(stackTrace);
|
|
2194
2194
|
matches.push({
|
|
2195
2195
|
name,
|
|
2196
|
-
source:
|
|
2196
|
+
source: void 0
|
|
2197
2197
|
});
|
|
2198
2198
|
continue;
|
|
2199
2199
|
}
|
|
@@ -2206,7 +2206,7 @@ ${error.stack}`;
|
|
|
2206
2206
|
}
|
|
2207
2207
|
matches.push({
|
|
2208
2208
|
name,
|
|
2209
|
-
source: source ||
|
|
2209
|
+
source: source || void 0
|
|
2210
2210
|
});
|
|
2211
2211
|
match = componentPattern.exec(stackTrace);
|
|
2212
2212
|
}
|
|
@@ -2892,7 +2892,6 @@ ${error.stack}`;
|
|
|
2892
2892
|
return;
|
|
2893
2893
|
}
|
|
2894
2894
|
const resolvedOptions = {
|
|
2895
|
-
enabled: true,
|
|
2896
2895
|
hotkey: ["Meta", "C"],
|
|
2897
2896
|
keyHoldDuration: 500,
|
|
2898
2897
|
...options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-grab",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"homepage": "https://github.com/aidenybai/react-grab#readme",
|
|
@@ -45,16 +45,6 @@
|
|
|
45
45
|
"README.md",
|
|
46
46
|
"LICENSE"
|
|
47
47
|
],
|
|
48
|
-
"scripts": {
|
|
49
|
-
"build": "tsup",
|
|
50
|
-
"dev": "tsup --watch --ignore-watch dist",
|
|
51
|
-
"lint": "eslint src/**/*.ts",
|
|
52
|
-
"lint:fix": "eslint src/**/*.ts --fix",
|
|
53
|
-
"format": "prettier --write .",
|
|
54
|
-
"check": "eslint src/**/*.ts && prettier --check .",
|
|
55
|
-
"publint": "publint",
|
|
56
|
-
"prepublishOnly": "pnpm build"
|
|
57
|
-
},
|
|
58
48
|
"devDependencies": {
|
|
59
49
|
"eslint": "^9.37.0",
|
|
60
50
|
"eslint-plugin-perfectionist": "^4.15.1",
|
|
@@ -68,5 +58,14 @@
|
|
|
68
58
|
},
|
|
69
59
|
"dependencies": {
|
|
70
60
|
"bippy": "^0.3.31"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsup",
|
|
64
|
+
"dev": "tsup --watch --ignore-watch dist",
|
|
65
|
+
"lint": "eslint src/**/*.ts",
|
|
66
|
+
"lint:fix": "eslint src/**/*.ts --fix",
|
|
67
|
+
"format": "prettier --write .",
|
|
68
|
+
"check": "eslint src/**/*.ts && prettier --check .",
|
|
69
|
+
"publint": "publint"
|
|
71
70
|
}
|
|
72
|
-
}
|
|
71
|
+
}
|
package/README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# react-grab
|
|
2
|
-
|
|
3
|
-
Inspect React components and copy their source file paths to clipboard.
|
|
4
|
-
|
|
5
|
-
## Install
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install react-grab
|
|
9
|
-
# or
|
|
10
|
-
pnpm add react-grab
|
|
11
|
-
# or
|
|
12
|
-
yarn add react-grab
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Usage
|
|
16
|
-
|
|
17
|
-
### Next.js (App Router)
|
|
18
|
-
|
|
19
|
-
Add to your `app/layout.tsx`:
|
|
20
|
-
|
|
21
|
-
```jsx
|
|
22
|
-
import Script from "next/script";
|
|
23
|
-
|
|
24
|
-
export default function RootLayout({ children }) {
|
|
25
|
-
return (
|
|
26
|
-
<html>
|
|
27
|
-
<head>
|
|
28
|
-
{process.env.NODE_ENV === "development" && (
|
|
29
|
-
<Script
|
|
30
|
-
src="//unpkg.com/react-grab@0.0.7/dist/index.global.js"
|
|
31
|
-
crossOrigin="anonymous"
|
|
32
|
-
strategy="beforeInteractive"
|
|
33
|
-
/>
|
|
34
|
-
)}
|
|
35
|
-
</head>
|
|
36
|
-
<body>{children}</body>
|
|
37
|
-
</html>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### How it works
|
|
43
|
-
|
|
44
|
-
1. Hold **Cmd** (Mac) for ~1 second to activate
|
|
45
|
-
2. Hover over any element on the page
|
|
46
|
-
3. Click to copy component stack trace and HTML to clipboard
|