vite-plugin-react-click-to-component
Advanced tools
Comparing version
@@ -60,3 +60,3 @@ // src/client.ts | ||
currentTarget = event.target; | ||
event.target.dataset.clickToComponentTarget = "true"; | ||
event.target.dataset["clickToComponentTarget"] = "true"; | ||
}); | ||
@@ -108,3 +108,3 @@ window.addEventListener("contextmenu", (event) => { | ||
item.addEventListener("click", () => { | ||
fetch(`/__open-in-editor?file=${encodeURIComponent(layer.path)}`); | ||
void fetch(`/__open-in-editor?file=${encodeURIComponent(layer.path)}`); | ||
cleanUp(); | ||
@@ -130,3 +130,3 @@ }); | ||
if (current) | ||
delete current.dataset.clickToComponentTarget; | ||
delete current.dataset["clickToComponentTarget"]; | ||
currentTarget = void 0; | ||
@@ -141,3 +141,2 @@ }; | ||
var getLayersForElement = (element) => { | ||
var _a; | ||
let instance = getReactInstanceForElement(element); | ||
@@ -148,3 +147,3 @@ const layers = []; | ||
if (path) { | ||
const name = typeof instance.type === "string" ? instance.type : (_a = instance.type.displayName) != null ? _a : instance.type.name; | ||
const name = typeof instance.type === "string" ? instance.type : instance.type.displayName ?? instance.type.name; | ||
layers.push({ name, path }); | ||
@@ -151,0 +150,0 @@ } |
{ | ||
"name": "vite-plugin-react-click-to-component", | ||
"description": "Option+Right Click in your browser to open the source in your editor", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"author": "Arnaud Barré (https://github.com/ArnaudBarre)", | ||
"license": "MIT", | ||
"repository": "github:ArnaudBarre/vite-plugin-react-click-to-component", | ||
"main": "index.js", | ||
"type": "module", | ||
"main": "index.cjs", | ||
"types": "index.d.mts", | ||
"module": "index.mjs", | ||
"exports": { | ||
".": { | ||
"types": "./index.d.mts", | ||
"require": "./index.cjs", | ||
"import": "./index.mjs" | ||
} | ||
}, | ||
"keywords": [ | ||
@@ -18,4 +28,4 @@ "vite", | ||
"react": ">=16", | ||
"vite": "^2 || ^3 || ^4" | ||
"vite": "^4 || ^5" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # vite-plugin-react-click-to-component [](https://www.npmjs.com/package/vite-plugin-react-click-to-component) | ||
Light version of [ericclemmons/click-to-component](https://github.com/ericclemmons/click-to-component) that uses Vite's launch editor middleware to open the source code in your currently running editor. | ||
 | ||
@@ -25,1 +25,5 @@ ## Installation | ||
``` | ||
## Inspiration | ||
This plugin is a light version of [ericclemmons/click-to-component](https://github.com/ericclemmons/click-to-component) that uses Vite's launch editor middleware to open the source code in your currently running editor. This also benefits from Vite's transformIndexHtml hook so that you don't need to modify your source code. |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
7
16.67%28
16.67%1
-50%Yes
NaN9135
-4.03%205
-10.09%