feat: Add @wxt-dev/module-solid package (#730)

This commit is contained in:
Aaron
2024-06-13 23:23:32 -05:00
committed by GitHub
parent 38b71d1350
commit 771ea03069
6 changed files with 244 additions and 17 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
},
"packageManager": "pnpm@8.15.8",
"scripts": {
"check": "check && pnpm -r run check",
"check": "check && pnpm -r --sequential run check",
"test": "vitest",
"test:coverage": "vitest run --coverage.enabled \"--coverage.include=packages/wxt/src/**\" \"--coverage.exclude=packages/wxt/src/core/utils/testing/**\" \"--coverage.exclude=**/*.d.ts\" \"--coverage.exclude=**/fixtures/**\"",
"prepare": "simple-git-hooks",
+32
View File
@@ -0,0 +1,32 @@
# `@wxt-dev/module-solid`
Enables the use of [SolidJS](https://www.solidjs.com/) in your web extension, in HTML pages and content scripts.
This plugin makes a few changes:
1. Adds `vite-plugin-solid` to vite
2. Adds the [`solid-js` preset](https://github.com/unjs/unimport/blob/main/src/presets/solid.ts) to auto-imports
## Usage
```sh
pnpm i solid-js
pnpm i -D @wxt-dev/module-solid
```
Then add the module to your config:
```ts
// wxt.config.ts
export default defineConfig({
// Required
modules: ['@wxt-dev/module-solid'],
// Optional: Pass options to the module:
solid: {
vite: {
// ...
},
},
});
```
+41
View File
@@ -0,0 +1,41 @@
{
"name": "@wxt-dev/module-solid",
"version": "1.0.0",
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"files": [
"dist"
],
"scripts": {
"build": "pnpm -s build-deps && unbuild",
"check": "pnpm -s build-deps && check",
"build-deps": "pnpm -ws build-deps @wxt-dev/module-solid"
},
"peerDependencies": {
"wxt": ">=0.18.5"
},
"dependencies": {
"vite-plugin-solid": "^2.10.2"
},
"devDependencies": {
"@aklinker1/check": "^1.3.1",
"publint": "^0.2.8",
"typescript": "^5.4.5",
"unbuild": "^2.0.0",
"wxt": "workspace:*"
}
}
+27
View File
@@ -0,0 +1,27 @@
import 'wxt';
import { addImportPreset, addViteConfig, defineWxtModule } from 'wxt/modules';
import solid, { Options as PluginOptions } from 'vite-plugin-solid';
export default defineWxtModule<SolidModuleOptions>({
name: '@wxt-dev/module-solid',
configKey: 'solid',
setup(wxt, options) {
const { vite } = options ?? {};
addViteConfig(wxt, () => ({
plugins: [solid(vite)],
}));
addImportPreset(wxt, 'solid-js');
},
});
export interface SolidModuleOptions {
vite?: PluginOptions;
}
declare module 'wxt' {
export interface InlineConfig {
solid?: SolidModuleOptions;
}
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "../../tsconfig.base.json",
"exclude": ["node_modules/**", "dist/**"]
}
+139 -16
View File
@@ -109,6 +109,28 @@ importers:
specifier: workspace:*
version: link:../wxt
packages/module-solid:
dependencies:
vite-plugin-solid:
specifier: ^2.10.2
version: 2.10.2(solid-js@1.8.17)(vite@5.3.0)
devDependencies:
'@aklinker1/check':
specifier: ^1.3.1
version: 1.3.1(typescript@5.4.5)
publint:
specifier: ^0.2.8
version: 0.2.8
typescript:
specifier: ^5.4.5
version: 5.4.5
unbuild:
specifier: ^2.0.0
version: 2.0.0(typescript@5.4.5)
wxt:
specifier: workspace:*
version: link:../wxt
packages/module-svelte:
dependencies:
'@sveltejs/vite-plugin-svelte':
@@ -609,6 +631,13 @@ packages:
dependencies:
'@babel/types': 7.24.7
/@babel/helper-module-imports@7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.24.7
dev: false
/@babel/helper-module-imports@7.24.7:
resolution: {integrity: sha512-8AyH3C+74cgCVVXow/myrynrAGv+nTVg5vKu2nZph9x7RcRwzmh0VFallJuFTZ9mx6u4eSdXZfcOzSqTUm0HCA==}
engines: {node: '>=6.9.0'}
@@ -712,6 +741,16 @@ packages:
dependencies:
'@babel/types': 7.24.7
/@babel/plugin-syntax-jsx@7.24.7(@babel/core@7.24.7):
resolution: {integrity: sha512-6ddciUPe/mpMnOKv/U+RSd2vvVy+Yw/JfBB0ZHYjEZt9NLHmCUylNYlsbqCCS1Bffjlb0fCwC9Vqz+sBz6PsiQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.24.7
'@babel/helper-plugin-utils': 7.24.7
dev: false
/@babel/plugin-transform-react-jsx-self@7.24.7(@babel/core@7.24.7):
resolution: {integrity: sha512-fOPQYbGSgH0HUp4UJO4sMBFjY6DuWq+2i8rixyUMb3CdGixs/gccURvYOAhajBdKDoGajFr3mUq5rH3phtkGzw==}
engines: {node: '>=6.9.0'}
@@ -1584,26 +1623,11 @@ packages:
rollup:
optional: true
dependencies:
'@rollup/pluginutils': 5.0.5(rollup@3.29.4)
'@rollup/pluginutils': 5.1.0(rollup@3.29.4)
magic-string: 0.30.10
rollup: 3.29.4
dev: true
/@rollup/pluginutils@5.0.5(rollup@3.29.4):
resolution: {integrity: sha512-6aEYR910NyP73oHiJglti74iRyOwgFU4x3meH/H8OJx6Ry0j6cOVZ5X/wTvub7G7Ao6qaHBEaNsV3GLJkSsF+Q==}
engines: {node: '>=14.0.0'}
peerDependencies:
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
peerDependenciesMeta:
rollup:
optional: true
dependencies:
'@types/estree': 1.0.5
estree-walker: 2.0.2
picomatch: 2.3.1
rollup: 3.29.4
dev: true
/@rollup/pluginutils@5.1.0(rollup@3.29.4):
resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==}
engines: {node: '>=14.0.0'}
@@ -2379,6 +2403,28 @@ packages:
dequal: 2.0.3
dev: false
/babel-plugin-jsx-dom-expressions@0.37.21(@babel/core@7.24.7):
resolution: {integrity: sha512-WbQo1NQ241oki8bYasVzkMXOTSIri5GO/K47rYJb2ZBh8GaPUEWiWbMV3KwXz+96eU2i54N6ThzjQG/f5n8Azw==}
peerDependencies:
'@babel/core': ^7.20.12
dependencies:
'@babel/core': 7.24.7
'@babel/helper-module-imports': 7.18.6
'@babel/plugin-syntax-jsx': 7.24.7(@babel/core@7.24.7)
'@babel/types': 7.24.7
html-entities: 2.3.3
validate-html-nesting: 1.2.2
dev: false
/babel-preset-solid@1.8.17(@babel/core@7.24.7):
resolution: {integrity: sha512-s/FfTZOeds0hYxYqce90Jb+0ycN2lrzC7VP1k1JIn3wBqcaexDKdYi6xjB+hMNkL+Q6HobKbwsriqPloasR9LA==}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.24.7
babel-plugin-jsx-dom-expressions: 0.37.21(@babel/core@7.24.7)
dev: false
/balanced-match@1.0.2:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
@@ -3933,6 +3979,10 @@ packages:
resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==}
dev: true
/html-entities@2.3.3:
resolution: {integrity: sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==}
dev: false
/html-escaper@2.0.2:
resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==}
dev: true
@@ -4311,6 +4361,11 @@ packages:
call-bind: 1.0.2
dev: true
/is-what@4.1.16:
resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==}
engines: {node: '>=12.13'}
dev: false
/is-wsl@2.2.0:
resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
engines: {node: '>=8'}
@@ -4698,6 +4753,13 @@ packages:
engines: {node: '>= 0.10.0'}
dev: true
/merge-anything@5.1.7:
resolution: {integrity: sha512-eRtbOb1N5iyH0tkQDAoQ4Ipsp/5qSR79Dzrz8hEPxRX10RWWR/iQXdoKmBSRCThY1Fh5EhISDtpSc93fpxUniQ==}
engines: {node: '>=12.13'}
dependencies:
is-what: 4.1.16
dev: false
/merge-stream@2.0.0:
resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==}
@@ -6083,6 +6145,20 @@ packages:
engines: {node: '>=10'}
hasBin: true
/seroval-plugins@1.0.7(seroval@1.0.7):
resolution: {integrity: sha512-GO7TkWvodGp6buMEX9p7tNyIkbwlyuAWbI6G9Ec5bhcm7mQdu3JOK1IXbEUwb3FVzSc363GraG/wLW23NSavIw==}
engines: {node: '>=10'}
peerDependencies:
seroval: ^1.0
dependencies:
seroval: 1.0.7
dev: false
/seroval@1.0.7:
resolution: {integrity: sha512-n6ZMQX5q0Vn19Zq7CIKNIo7E75gPkGCFUEqDpa8jgwpYr/vScjqnQ6H09t1uIiZ0ZSK0ypEGvrYK2bhBGWsGdw==}
engines: {node: '>=10'}
dev: false
/set-value@4.1.0:
resolution: {integrity: sha512-zTEg4HL0RwVrqcWs3ztF+x1vkxfm0lP+MQQFPiMJTKVceBwEV0A569Ou8l9IYQG8jOZdMVI1hGsc0tmeD2o/Lw==}
engines: {node: '>=11.0'}
@@ -6202,6 +6278,27 @@ packages:
ansi-styles: 6.2.1
is-fullwidth-code-point: 5.0.0
/solid-js@1.8.17:
resolution: {integrity: sha512-E0FkUgv9sG/gEBWkHr/2XkBluHb1fkrHywUgA6o6XolPDCJ4g1HaLmQufcBBhiF36ee40q+HpG/vCZu7fLpI3Q==}
dependencies:
csstype: 3.1.3
seroval: 1.0.7
seroval-plugins: 1.0.7(seroval@1.0.7)
dev: false
/solid-refresh@0.6.3(solid-js@1.8.17):
resolution: {integrity: sha512-F3aPsX6hVw9ttm5LYlth8Q15x6MlI/J3Dn+o3EQyRTtTxidepSTwAYdozt01/YA+7ObcciagGEyXIopGZzQtbA==}
peerDependencies:
solid-js: ^1.3
dependencies:
'@babel/generator': 7.24.7
'@babel/helper-module-imports': 7.24.7
'@babel/types': 7.24.7
solid-js: 1.8.17
transitivePeerDependencies:
- supports-color
dev: false
/source-map-js@1.2.0:
resolution: {integrity: sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==}
engines: {node: '>=0.10.0'}
@@ -6900,6 +6997,10 @@ packages:
hasBin: true
dev: false
/validate-html-nesting@1.2.2:
resolution: {integrity: sha512-hGdgQozCsQJMyfK5urgFcWEqsSSrK63Awe0t/IMR0bZ0QMtnuaiHzThW81guu3qx9abLi99NEuiaN6P9gVYsNg==}
dev: false
/validate-npm-package-license@3.0.4:
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
dependencies:
@@ -6928,6 +7029,28 @@ packages:
- terser
dev: true
/vite-plugin-solid@2.10.2(solid-js@1.8.17)(vite@5.3.0):
resolution: {integrity: sha512-AOEtwMe2baBSXMXdo+BUwECC8IFHcKS6WQV/1NEd+Q7vHPap5fmIhLcAzr+DUJ04/KHx/1UBU0l1/GWP+rMAPQ==}
peerDependencies:
'@testing-library/jest-dom': ^5.16.6 || ^5.17.0 || ^6.*
solid-js: ^1.7.2
vite: ^3.0.0 || ^4.0.0 || ^5.0.0
peerDependenciesMeta:
'@testing-library/jest-dom':
optional: true
dependencies:
'@babel/core': 7.24.7
'@types/babel__core': 7.20.5
babel-preset-solid: 1.8.17(@babel/core@7.24.7)
merge-anything: 5.1.7
solid-js: 1.8.17
solid-refresh: 0.6.3(solid-js@1.8.17)
vite: 5.3.0(@types/node@20.14.2)
vitefu: 0.2.5(vite@5.3.0)
transitivePeerDependencies:
- supports-color
dev: false
/vite@5.3.0(@types/node@20.14.2):
resolution: {integrity: sha512-hA6vAVK977NyW1Qw+fLvqSo7xDPej7von7C3DwwqPRmnnnK36XEBC/J3j1V5lP8fbt7y0TgTKJbpNGSwM+Bdeg==}
engines: {node: ^18.0.0 || >=20.0.0}