Skip to content

Commit df96ede

Browse files
authored
feat: support devtools for better user experience (#110)
1 parent 30df7af commit df96ede

File tree

31 files changed

+761
-91
lines changed

31 files changed

+761
-91
lines changed

example/craco/craco.config.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
1-
const WindiCSSWebpackPlugin = require('windicss-webpack-plugin')
1+
const WindiCSSWebpackPlugin = require('../../')
22

33
module.exports = {
4+
eslint: {
5+
pluginOptions: config => {
6+
config.exclude = ['**/node_modules/**', '**/virtual:windi-devtools*']
7+
return config;
8+
},
9+
},
410
webpack: {
511
plugins: {
612
add: [
713
new WindiCSSWebpackPlugin({
8-
virtualModulePath: 'src'
14+
virtualModulePath: 'src',
15+
server: {
16+
port: 9999,
17+
host: 'localhost'
18+
}
919
})
1020
],
1121
},
12-
},
22+
}
1323
}

example/craco/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"react": "^17.0.2",
1212
"react-dom": "^17.0.2",
1313
"react-scripts": "^4.0.3",
14-
"web-vitals": "^1.0.1"
14+
"web-vitals": "^1.0.1",
15+
"windicss-webpack-plugin": "file:../../"
1516
},
1617
"scripts": {
1718
"start": "craco start",

example/craco/src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import './index.css';
44
import App from './App';
55
import reportWebVitals from './reportWebVitals';
66
import './virtual:windi.css'
7+
import './virtual:windi-devtools'
78

89
ReactDOM.render(
910
<React.StrictMode>

example/icejs/build.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"webpackPlugins": {
33
"windicss-webpack-plugin": {}
4+
},
5+
"eslint": {
6+
"exclude": ["**/node_modules/**", "**/virtual:windi-devtools*"]
47
}
58
}

example/icejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"eslint": "^7.30.0",
1414
"ice.js": "^2.0.0",
1515
"stylelint": "^13.7.2",
16-
"windicss-webpack-plugin": "^1.5.6"
16+
"windicss-webpack-plugin": "file:../../"
1717
},
1818
"scripts": {
1919
"start": "icejs start",

example/icejs/src/app.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { runApp, IAppConfig } from 'ice';
22

33
import 'windi.css';
4+
import 'windi-devtools';
45

56
const appConfig: IAppConfig = {
67
app: {

example/icejs/yarn.lock

Lines changed: 88 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
lodash.debounce "^4.0.8"
1111
lodash.throttle "^4.1.1"
1212

13-
"@antfu/utils@^0.3.0":
14-
version "0.3.0"
15-
resolved "https://registry.npmmirror.com/@antfu/utils/download/@antfu/utils-0.3.0.tgz#6306c43b52a883bd8e973e3ed8dd64248418bcc4"
16-
integrity sha1-YwbEO1Kog72Olz4+2N1kJIQYvMQ=
17-
dependencies:
18-
"@types/throttle-debounce" "^2.1.0"
13+
"@antfu/utils@^0.5.1":
14+
version "0.5.1"
15+
resolved "https://registry.yarnpkg.com/@antfu/utils/-/utils-0.5.1.tgz#7eb6764878adb715daff20019e5a15fd63d93342"
16+
integrity sha512-8Afo0+xvYe1K8Wm4xHTymfTkpzy36aaqDvhXIayUwl+mecMG9Xzl3XjXa6swG6Bk8FBeQ646RyvmsYt6+2Be9g==
1917

2018
"@apideck/better-ajv-errors@^0.2.4":
2119
version "0.2.6"
@@ -1496,11 +1494,6 @@
14961494
resolved "https://registry.npmmirror.com/@types/scheduler/download/@types/scheduler-0.16.2.tgz#1a62f89525723dde24ba1b01b092bf5df8ad4d39"
14971495
integrity sha1-GmL4lSVyPd4kuhsBsJK/XfitTTk=
14981496

1499-
"@types/throttle-debounce@^2.1.0":
1500-
version "2.1.0"
1501-
resolved "https://registry.npmmirror.com/@types/throttle-debounce/download/@types/throttle-debounce-2.1.0.tgz#1c3df624bfc4b62f992d3012b84c56d41eab3776"
1502-
integrity sha1-HD32JL/Eti+ZLTASuExW1B6rN3Y=
1503-
15041497
"@types/trusted-types@^2.0.2":
15051498
version "2.0.2"
15061499
resolved "https://registry.npmmirror.com/@types/trusted-types/download/@types/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
@@ -1608,27 +1601,27 @@
16081601
"@rollup/pluginutils" "^4.1.1"
16091602
react-refresh "^0.10.0"
16101603

1611-
"@windicss/config@1.5.1":
1612-
version "1.5.1"
1613-
resolved "https://registry.npmmirror.com/@windicss/config/download/@windicss/config-1.5.1.tgz#e3fdaddfc553442c85f67f2e9290ef46ce87b3a1"
1614-
integrity sha1-4/2t38VTRCyF9n8ukpDvRs6Hs6E=
1604+
"@windicss/config@1.8.4":
1605+
version "1.8.4"
1606+
resolved "https://registry.yarnpkg.com/@windicss/config/-/config-1.8.4.tgz#090c7f48cb86b6cba1bd97742a2f012852026d3c"
1607+
integrity sha512-i4fFGFfZoRess6WMkauykHC3PFd9xKYVx7lSuLfMK7sgo6x3+l4dY42GbsWMHyLqH1sTMfyt1LgfXSIKYJozSA==
16151608
dependencies:
1616-
debug "^4.3.2"
1617-
jiti "^1.12.9"
1618-
windicss "^3.2.1"
1609+
debug "^4.3.4"
1610+
jiti "^1.13.0"
1611+
windicss "^3.5.1"
16191612

1620-
"@windicss/plugin-utils@^1.5.1":
1621-
version "1.5.1"
1622-
resolved "https://registry.npmmirror.com/@windicss/plugin-utils/download/@windicss/plugin-utils-1.5.1.tgz#9750bb72e8c14585e011d46a33351d47d8519e31"
1623-
integrity sha1-l1C7cujBRYXgEdRqMzUdR9hRnjE=
1613+
"@windicss/plugin-utils@^1.8.4":
1614+
version "1.8.4"
1615+
resolved "https://registry.yarnpkg.com/@windicss/plugin-utils/-/plugin-utils-1.8.4.tgz#fba74b6eb29276e24b9d09931bc22808fd7230d7"
1616+
integrity sha512-DqJVwAfzlgd8nYSNlmhXOey32pI8UwH7QiOWdFS/AR2O/q9oLDGHDn97Its/kZdfoyhi8ylwZNP2Pk0H7cihhQ==
16241617
dependencies:
1625-
"@antfu/utils" "^0.3.0"
1626-
"@windicss/config" "1.5.1"
1627-
debug "^4.3.2"
1628-
fast-glob "^3.2.7"
1629-
magic-string "^0.25.7"
1630-
micromatch "^4.0.4"
1631-
windicss "^3.2.1"
1618+
"@antfu/utils" "^0.5.1"
1619+
"@windicss/config" "1.8.4"
1620+
debug "^4.3.4"
1621+
fast-glob "^3.2.11"
1622+
magic-string "^0.26.1"
1623+
micromatch "^4.0.5"
1624+
windicss "^3.5.1"
16321625

16331626
accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7:
16341627
version "1.3.7"
@@ -2071,7 +2064,7 @@ braces@^2.3.1:
20712064
split-string "^3.0.2"
20722065
to-regex "^3.0.1"
20732066

2074-
braces@^3.0.1, braces@~3.0.2:
2067+
braces@^3.0.1, braces@^3.0.2, braces@~3.0.2:
20752068
version "3.0.2"
20762069
resolved "https://registry.npmmirror.com/braces/download/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
20772070
integrity sha1-NFThpGLujVmeI23zNs2epPiv4Qc=
@@ -2828,13 +2821,20 @@ debug@^3.0.1, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6, debug@^3.2.7:
28282821
dependencies:
28292822
ms "^2.1.1"
28302823

2831-
debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2:
2824+
debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
28322825
version "4.3.2"
28332826
resolved "https://registry.npmmirror.com/debug/download/debug-4.3.2.tgz?cache=0&sync_timestamp=1636300872595&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fdebug%2Fdownload%2Fdebug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
28342827
integrity sha1-8KScGKyHeeMdSgxgKd+3aHPHQos=
28352828
dependencies:
28362829
ms "2.1.2"
28372830

2831+
debug@^4.3.3, debug@^4.3.4:
2832+
version "4.3.4"
2833+
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
2834+
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
2835+
dependencies:
2836+
ms "2.1.2"
2837+
28382838
decamelize-keys@^1.1.0:
28392839
version "1.1.0"
28402840
resolved "https://registry.npmmirror.com/decamelize-keys/download/decamelize-keys-1.1.0.tgz#d171a87933252807eb3cb61dc1c1445d078df2d9"
@@ -3803,6 +3803,17 @@ fast-glob@^3.1.1, fast-glob@^3.2.5, fast-glob@^3.2.7:
38033803
merge2 "^1.3.0"
38043804
micromatch "^4.0.4"
38053805

3806+
fast-glob@^3.2.11:
3807+
version "3.2.11"
3808+
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.11.tgz#a1172ad95ceb8a16e20caa5c5e56480e5129c1d9"
3809+
integrity sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==
3810+
dependencies:
3811+
"@nodelib/fs.stat" "^2.0.2"
3812+
"@nodelib/fs.walk" "^1.2.3"
3813+
glob-parent "^5.1.2"
3814+
merge2 "^1.3.0"
3815+
micromatch "^4.0.4"
3816+
38063817
fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0:
38073818
version "2.1.0"
38083819
resolved "https://registry.npmmirror.com/fast-json-stable-stringify/download/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
@@ -4131,6 +4142,11 @@ get-own-enumerable-property-symbols@^3.0.0:
41314142
resolved "https://registry.npmmirror.com/get-own-enumerable-property-symbols/download/get-own-enumerable-property-symbols-3.0.2.tgz#b5fde77f22cbe35f390b4e089922c50bce6ef664"
41324143
integrity sha1-tf3nfyLL4185C04ImSLFC85u9mQ=
41334144

4145+
get-port@^6.1.2:
4146+
version "6.1.2"
4147+
resolved "https://registry.yarnpkg.com/get-port/-/get-port-6.1.2.tgz#c1228abb67ba0e17fb346da33b15187833b9c08a"
4148+
integrity sha512-BrGGraKm2uPqurfGVj/z97/zv8dPleC6x9JBNRTrDNtCkkRF4rPwrQXFgL7+I+q8QSdU4ntLQX2D7KIxSy8nGw==
4149+
41344150
get-stdin@^8.0.0:
41354151
version "8.0.0"
41364152
resolved "https://registry.npmmirror.com/get-stdin/download/get-stdin-8.0.0.tgz#cbad6a73feb75f6eeb22ba9e01f89aa28aa97a53"
@@ -5119,10 +5135,10 @@ jest-worker@^27.3.1:
51195135
merge-stream "^2.0.0"
51205136
supports-color "^8.0.0"
51215137

5122-
jiti@^1.12.9:
5123-
version "1.12.9"
5124-
resolved "https://registry.npmmirror.com/jiti/download/jiti-1.12.9.tgz#2ce45b265cfc8dc91ebd70a5204807cf915291bc"
5125-
integrity sha1-LORbJlz8jckevXClIEgHz5FSkbw=
5138+
jiti@^1.13.0:
5139+
version "1.13.0"
5140+
resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.13.0.tgz#3cdfc4e651ca0cca4c62ed5e47747b5841d41a8e"
5141+
integrity sha512-/n9mNxZj/HDSrincJ6RP+L+yXbpnB8FybySBa+IjIaoH9FIxBbrbRT5XUbe8R7zuVM2AQqNMNDDqz0bzx3znOQ==
51265142

51275143
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
51285144
version "4.0.0"
@@ -5430,6 +5446,13 @@ magic-string@^0.25.0, magic-string@^0.25.7:
54305446
dependencies:
54315447
sourcemap-codec "^1.4.4"
54325448

5449+
magic-string@^0.26.1:
5450+
version "0.26.1"
5451+
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.26.1.tgz#ba9b651354fa9512474199acecf9c6dbe93f97fd"
5452+
integrity sha512-ndThHmvgtieXe8J/VGPjG+Apu7v7ItcD5mhEIvOscWjPF/ccOiLxHaSuCAS2G+3x4GKsAbT8u7zdyamupui8Tg==
5453+
dependencies:
5454+
sourcemap-codec "^1.4.8"
5455+
54335456
make-dir@^2.0.0, make-dir@^2.1.0:
54345457
version "2.1.0"
54355458
resolved "https://registry.npmmirror.com/make-dir/download/make-dir-2.1.0.tgz#5f0310e18b8be898cc07009295a30ae41e91e6f5"
@@ -5598,6 +5621,14 @@ micromatch@^4.0.2, micromatch@^4.0.4:
55985621
braces "^3.0.1"
55995622
picomatch "^2.2.3"
56005623

5624+
micromatch@^4.0.5:
5625+
version "4.0.5"
5626+
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
5627+
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
5628+
dependencies:
5629+
braces "^3.0.2"
5630+
picomatch "^2.3.1"
5631+
56015632
mime-db@1.51.0, "mime-db@>= 1.43.0 < 2":
56025633
version "1.51.0"
56035634
resolved "https://registry.npmmirror.com/mime-db/download/mime-db-1.51.0.tgz?cache=0&sync_timestamp=1636425999210&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fmime-db%2Fdownload%2Fmime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c"
@@ -6305,6 +6336,11 @@ path-type@^4.0.0:
63056336
resolved "https://registry.npmmirror.com/path-type/download/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
63066337
integrity sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=
63076338

6339+
pathe@^0.2.0:
6340+
version "0.2.0"
6341+
resolved "https://registry.yarnpkg.com/pathe/-/pathe-0.2.0.tgz#30fd7bbe0a0d91f0e60bae621f5d19e9e225c339"
6342+
integrity sha512-sTitTPYnn23esFR3RlqYBWn4c45WGeLcsKzQiUpXJAyfcWkolvlYpV8FLo7JishK946oQwMFUCHXQ9AjGPKExw==
6343+
63086344
picocolors@^0.2.1:
63096345
version "0.2.1"
63106346
resolved "https://registry.npmmirror.com/picocolors/download/picocolors-0.2.1.tgz?cache=0&sync_timestamp=1634093437726&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fpicocolors%2Fdownload%2Fpicocolors-0.2.1.tgz#570670f793646851d1ba135996962abad587859f"
@@ -6320,6 +6356,11 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3:
63206356
resolved "https://registry.npmmirror.com/picomatch/download/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
63216357
integrity sha1-8fBh3o9qS/AiiS4tEoI0+5gwKXI=
63226358

6359+
picomatch@^2.3.1:
6360+
version "2.3.1"
6361+
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
6362+
integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
6363+
63236364
pify@^4.0.1:
63246365
version "4.0.1"
63256366
resolved "https://registry.npmmirror.com/pify/download/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
@@ -7477,7 +7518,7 @@ source-map@^0.8.0-beta.0:
74777518
dependencies:
74787519
whatwg-url "^7.0.0"
74797520

7480-
sourcemap-codec@^1.4.4:
7521+
sourcemap-codec@^1.4.4, sourcemap-codec@^1.4.8:
74817522
version "1.4.8"
74827523
resolved "https://registry.npmmirror.com/sourcemap-codec/download/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4"
74837524
integrity sha1-6oBL2UhXQC5pktBaOO8a41qatMQ=
@@ -8231,11 +8272,6 @@ upath@^1.2.0:
82318272
resolved "https://registry.npmmirror.com/upath/download/upath-1.2.0.tgz#8f66dbcd55a883acdae4408af8b035a5044c1894"
82328273
integrity sha1-j2bbzVWog6za5ECK+LA1pQRMGJQ=
82338274

8234-
upath@^2.0.1:
8235-
version "2.0.1"
8236-
resolved "https://registry.npmmirror.com/upath/download/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b"
8237-
integrity sha1-UMc96mjW9rmQ9R0nnOYIFmXWGos=
8238-
82398275
upper-case@^1.1.1:
82408276
version "1.1.3"
82418277
resolved "https://registry.npmmirror.com/upper-case/download/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
@@ -8569,24 +8605,22 @@ wide-align@^1.1.0:
85698605
dependencies:
85708606
string-width "^1.0.2 || 2 || 3 || 4"
85718607

8572-
windicss-webpack-plugin@^1.5.6:
8573-
version "1.5.6"
8574-
resolved "https://registry.npmmirror.com/windicss-webpack-plugin/download/windicss-webpack-plugin-1.5.6.tgz#451333bac64d3d0b229d4a58c70f5f66249acefd"
8575-
integrity sha512-Wap3bvaNlIFKkJugaeVMqV1ICMDfSmwernYkYrRftK/ZJXP7/pkVvdXu5DDvFIlRVXjhlJlltIlFb1UNJn84sA==
8608+
"windicss-webpack-plugin@file:../..":
8609+
version "1.6.10"
85768610
dependencies:
8577-
"@windicss/plugin-utils" "^1.5.1"
8578-
debug "^4.3.2"
8611+
"@windicss/plugin-utils" "^1.8.4"
8612+
debug "^4.3.3"
8613+
get-port "^6.1.2"
85798614
loader-utils "^2.0.0"
85808615
lodash "^4.17.21"
8581-
magic-string "^0.25.7"
8582-
upath "^2.0.1"
8616+
pathe "^0.2.0"
85838617
webpack-virtual-modules "^0.4.3"
8584-
windicss "^3.2.1"
8618+
windicss "^3.5.1"
85858619

8586-
windicss@^3.2.1:
8587-
version "3.2.1"
8588-
resolved "https://registry.npmmirror.com/windicss/download/windicss-3.2.1.tgz#bd0f7b9ebabba04ea8dfedcbb0263c2ef9591db4"
8589-
integrity sha1-vQ97nrq7oE6o3+3LsCY8LvlZHbQ=
8620+
windicss@^3.5.1:
8621+
version "3.5.1"
8622+
resolved "https://registry.yarnpkg.com/windicss/-/windicss-3.5.1.tgz#5e279c21179dbc122122d0b3a3a2651511249241"
8623+
integrity sha512-E1hYZATcZFci/XhGS0sJAMRxULjnK+glNukE78Ku7xeb3jxgMY55fFOdIrav+GjQCsgR+IZxPq9/DwmO6eyc4Q==
85908624

85918625
word-wrap@^1.2.3, word-wrap@~1.2.3:
85928626
version "1.2.3"

example/next/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"next": "11.0.1",
1414
"react": "17.0.2",
1515
"react-dom": "17.0.2",
16-
"sass": "^1.35.1"
16+
"sass": "^1.35.1",
17+
"windicss-webpack-plugin": "file:../../"
1718
}
1819
}

example/next/pages/_app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import '../styles/plain.css'
33
import '../styles/main.sass'
44
import '../styles/main.scss'
55
import 'windi.css'
6+
import 'windi-devtools'
67

78
function MyApp({Component, pageProps}) {
89
return <Component {...pageProps} />

0 commit comments

Comments
 (0)