-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a28b087
commit b5ca646
Showing
11 changed files
with
391 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
.idea/ | ||
node_modules/ | ||
*.js | ||
*.d.ts | ||
!src/refresh-runtime.js | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[install.lockfile] | ||
print = "yarn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,27 @@ | ||
{ | ||
"name": "vite-plugin-swc-react-refresh", | ||
"description": "Use the versatility of swc for development and the maturity of esbuild for production", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"license": "MIT", | ||
"author": "Arnaud Barré (https://github.com/ArnaudBarre)", | ||
"main": "src/swc-react-refresh.js", | ||
"files": [ | ||
"src/*.js", | ||
"src/*.d.ts" | ||
], | ||
"repository": "github:ArnaudBarre/vite-plugin-swc-react-refresh", | ||
"keywords": [ | ||
"vite", | ||
"vite-plugin", | ||
"react", | ||
"swc", | ||
"react-refresh", | ||
"fast refresh" | ||
], | ||
"scripts": { | ||
"build": "tsc", | ||
"build": "scripts/bundle.ts", | ||
"prettier": "yarn prettier-ci --write", | ||
"prettier-ci": "prettier --check '**/*.{js,ts,json,md,yml}'" | ||
"prettier-ci": "prettier --ignore-path=.gitignore --check '**/*.{js,ts,json,md,yml}'", | ||
"ci": "tsc && bun prettier-ci && bun run build" | ||
}, | ||
"prettier": { | ||
"trailingComma": "all" | ||
}, | ||
"dependencies": { | ||
"@swc/core": "^1.2.245" | ||
"@swc/core": "^1.3.10" | ||
}, | ||
"peerDependencies": { | ||
"vite": "^2 || ^3" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^18.0.6", | ||
"@nabla/tnode": "^0.7.0", | ||
"@types/node": "^18.11.4", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.5" | ||
"typescript": "^4.8.4", | ||
"vite": "^3.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env tnode | ||
import { rmSync, writeFileSync } from "fs"; | ||
import { execSync } from "child_process"; | ||
import { build } from "esbuild"; | ||
|
||
import * as packageJSON from "../package.json"; | ||
|
||
rmSync("dist", { force: true, recursive: true }); | ||
|
||
build({ | ||
bundle: true, | ||
entryPoints: ["src/index.ts"], | ||
outdir: "dist", | ||
platform: "node", | ||
target: "node14", | ||
legalComments: "inline", | ||
external: Object.keys(packageJSON.peerDependencies).concat( | ||
Object.keys(packageJSON.dependencies), | ||
), | ||
}).then(() => { | ||
execSync("cp src/refresh-runtime.js LICENSE README.md dist/"); | ||
|
||
writeFileSync( | ||
"dist/index.d.ts", | ||
`import { PluginOption } from "vite"; | ||
export declare const swcReactRefresh: () => PluginOption; | ||
`, | ||
); | ||
|
||
writeFileSync( | ||
"dist/package.json", | ||
JSON.stringify( | ||
{ | ||
name: packageJSON.name, | ||
description: | ||
"Use the versatility of SWC for development and the maturity of esbuild for production", | ||
version: packageJSON.version, | ||
author: "Arnaud Barré (https://github.com/ArnaudBarre)", | ||
license: packageJSON.license, | ||
repository: "github:ArnaudBarre/vite-plugin-swc-react-refresh", | ||
main: "index.js", | ||
keywords: [ | ||
"vite", | ||
"vite-plugin", | ||
"react", | ||
"swc", | ||
"react-refresh", | ||
"fast refresh", | ||
], | ||
peerDependencies: packageJSON.peerDependencies, | ||
dependencies: packageJSON.dependencies, | ||
}, | ||
null, | ||
2, | ||
), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.