vite-plugin-solarite 0.7.0
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/index.js +21 -0
- package/package.json +33 -0
- package/readme.md +22 -0
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** vite-plugin-solarite — compiles .jsx/.tsx into Solarite precompile output before Vite's own JSX
|
|
2
|
+
* handling runs (the `enforce: 'pre'` slot @vitejs/plugin-react uses), giving JSX the same runtime
|
|
3
|
+
* speed as `h` tagged templates. Build-time only; nothing is shipped to the browser. */
|
|
4
|
+
import { transform } from 'babel-plugin-solarite';
|
|
5
|
+
|
|
6
|
+
export default function solariteVite(options = {}) {
|
|
7
|
+
return {
|
|
8
|
+
name: 'vite-plugin-solarite',
|
|
9
|
+
enforce: 'pre',
|
|
10
|
+
transform(code, id) {
|
|
11
|
+
const path = id.split('?')[0];
|
|
12
|
+
if (!/\.[jt]sx$/.test(path)) return null;
|
|
13
|
+
const result = transform(code, {
|
|
14
|
+
filename: path,
|
|
15
|
+
importSource: options.importSource,
|
|
16
|
+
sourceMaps: true,
|
|
17
|
+
});
|
|
18
|
+
return { code: result.code, map: result.map };
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vite-plugin-solarite",
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"description": "Vite plugin that compiles JSX/TSX to Solarite precompile output, giving JSX the same runtime speed as h tagged templates.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Eric Frost",
|
|
8
|
+
"main": "./index.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"index.js",
|
|
14
|
+
"readme.md"
|
|
15
|
+
],
|
|
16
|
+
"keywords": [
|
|
17
|
+
"solarite",
|
|
18
|
+
"jsx",
|
|
19
|
+
"tsx",
|
|
20
|
+
"vite",
|
|
21
|
+
"vite-plugin",
|
|
22
|
+
"precompile"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"babel-plugin-solarite": "^0.7.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"solarite": "^0.7.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependenciesMeta": {
|
|
31
|
+
"solarite": { "optional": true }
|
|
32
|
+
}
|
|
33
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# vite-plugin-solarite
|
|
2
|
+
|
|
3
|
+
Compiles JSX/TSX into **Solarite precompile output** so JSX renders at the **same speed as `h` tagged
|
|
4
|
+
templates**. It runs in Vite's `enforce: 'pre'` slot (before Vite's own JSX handling) and only at
|
|
5
|
+
build time — nothing is shipped to the browser.
|
|
6
|
+
|
|
7
|
+
Thin wrapper around [`babel-plugin-solarite`](../babel-plugin-solarite), which does the actual
|
|
8
|
+
compiling.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install --save-dev vite-plugin-solarite
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
// vite.config.js
|
|
16
|
+
import solarite from 'vite-plugin-solarite';
|
|
17
|
+
export default { plugins: [solarite()] };
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Options
|
|
21
|
+
|
|
22
|
+
- `importSource` — runtime module specifier (default `"solarite/jsx-runtime"`).
|