Skip to content

Commit

Permalink
v3: Vite 5 & ESM [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed Nov 28, 2023
1 parent 9ba7932 commit 2b69fdc
Show file tree
Hide file tree
Showing 20 changed files with 1,189 additions and 1,577 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog

## 3.0.0

- Add vite@5 to peer dependency ranges
- Switch plugin to ESM. This removes the CJS warning when using the plugin with Vite 5. A CJS wrapper is still provided but [migrating](https://vitejs.dev/guide/migration.html#deprecate-cjs-node-api) to running Vite in ESM is encouraged
- Drop support for Vite 2 & 3 & node<18 (aligns with Vite 5)

## 2.0.0

Context menu on option+right click to see all the intermediate components and jump to the right place!
Expand Down
Binary file modified bun.lockb
Binary file not shown.
24 changes: 13 additions & 11 deletions package.json
@@ -1,6 +1,7 @@
{
"name": "vite-plugin-react-click-to-component",
"version": "2.0.0",
"type": "module",
"version": "3.0.0",
"license": "MIT",
"scripts": {
"postinstall": "cd playground && bun i",
Expand All @@ -9,24 +10,25 @@
"tsc": "tsc",
"lint": "bun lint-ci --fix --cache",
"lint-ci": "eslint src scripts --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"prettier": "yarn prettier-ci --write",
"prettier": "bun prettier-ci --write",
"prettier-ci": "prettier --ignore-path=.gitignore --check '**/*.{ts,tsx,html,css,json,md,yml}'",
"ci": "tsc && bun lint-ci && bun prettier-ci && bun run build && cd playground && tsc && bun lint-ci"
"ci": "tsc && bun lint-ci && bun prettier-ci && bun run build && cd playground && tsc && bun lint-ci && cd ../dist && bun publint"
},
"prettier": {
"trailingComma": "all"
},
"peerDependencies": {
"react": ">=16",
"vite": "^2 || ^3 || ^4"
"vite": "^4 || ^5"
},
"devDependencies": {
"@arnaud-barre/eslint-config": "^1.0.19",
"@nabla/tnode": "^0.8.0",
"@types/node": "^18.14.0",
"eslint": "^8.34.0",
"prettier": "^2.8.4",
"typescript": "^4.9.5",
"vite": "^4.1.4"
"@arnaud-barre/eslint-config": "^3.1.5",
"@arnaud-barre/tnode": "^0.19.2",
"@types/node": "^18.18.9",
"eslint": "^8.54.0",
"prettier": "3.0.3",
"publint": "^0.2.5",
"typescript": "~5.2.2",
"vite": "^5.0.0"
}
}
File renamed without changes.
Binary file modified playground/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion playground/index.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
5 changes: 3 additions & 2 deletions playground/package.json
@@ -1,5 +1,6 @@
{
"name": "playground",
"type": "module",
"private": true,
"scripts": {
"dev": "vite",
Expand All @@ -10,7 +11,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react-dom": "^18.0.11",
"@vitejs/plugin-react-swc": "^3.2.0"
"@types/react-dom": "^18.2.17",
"@vitejs/plugin-react-swc": "^3.5.0"
}
}
2 changes: 1 addition & 1 deletion playground/src/App.tsx
@@ -1,5 +1,5 @@
import reactLogo from "./react.svg";
import { Button } from "./Button";
import { Button } from "./Button.tsx";
import "./App.css";

export const App = () => (
Expand Down
2 changes: 1 addition & 1 deletion playground/src/index.tsx
@@ -1,6 +1,6 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App";
import { App } from "./App.tsx";
import "./index.css";

createRoot(document.getElementById("root")!).render(
Expand Down
27 changes: 14 additions & 13 deletions playground/tsconfig.json
@@ -1,26 +1,27 @@
{
"include": ["src", "vite.config.ts"],
"include": ["**/*.ts", "**/*.tsx"],
"compilerOptions": {
"module": "ESNext",
"lib": ["ESNext", "DOM", "DOM.Iterable"],
"target": "ESNext",
"target": "ES2021",
"useDefineForClassFields": true,
"jsx": "react-jsx",
"module": "ESNext",
"lib": ["ES2021", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"noEmit": true,
"isolatedModules": true,
"skipLibCheck": true,

/* Imports */
"moduleResolution": "node", // Allow `index` imports
"resolveJsonModule": true, // Allow json import
"forceConsistentCasingInFileNames": true, // Avoid difference in case between file name and import
"esModuleInterop": false,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"verbatimModuleSyntax": true,
"noEmit": true,

/* Linting */
"skipLibCheck": true,
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"useUnknownInCatchVariables": true
"useUnknownInCatchVariables": true,
"noPropertyAccessFromIndexSignature": true
}
}
4 changes: 2 additions & 2 deletions playground/vite.config.ts
@@ -1,8 +1,8 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import { reactClickToComponent } from "../dist";
import { reactClickToComponent } from "../dist/index.mjs";

// eslint-disable-next-line import/no-default-export
// eslint-disable-next-line @arnaud-barre/no-default-export
export default defineConfig({
plugins: [react(), reactClickToComponent()],
server: { open: true },
Expand Down

0 comments on commit 2b69fdc

Please sign in to comment.