Skip to content

Commit

Permalink
Release: mangle plugin 2.0.0 (#37)
Browse files Browse the repository at this point in the history
* chore: use new build config

* chore(deps): upgrade

* feat: commit new vite and webpack config

* chore: no support webpack dev mode

* chore: commit docs

* feat: commit new plugins

* feat: commit default include and exclude

* feat: commit babel plugin

* feat: commit addToUsedBy and dump

* feat: commit snap

* feat: set preflight false

* chore: commit git diff

* fix: desc str replace

* feat: move ast plugin to core pkg

* fix: pre process js test case

* chore: bump config 1.0.1
  • Loading branch information
sonofmagic authored Aug 9, 2023
1 parent a4de2ba commit a807c0b
Show file tree
Hide file tree
Showing 69 changed files with 3,337 additions and 2,066 deletions.
4 changes: 3 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
packages/unplugin-tailwindcss-mangle/test/fixtures/**/*
packages/tailwindcss-patch/test/fixtures/**/*
packages/tailwindcss-patch/test/fixtures/**/*
packages/*/dist
packages/**/fixtures
70 changes: 70 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,76 @@
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"command": "yarn dev",
"name": "[vite-vue] dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-vue"
},
{
"command": "yarn build",
"name": "[vite-vue] build",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-vue"
},
{
"command": "yarn dev",
"name": "[vite-react] dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-react"
},
{
"command": "yarn build",
"name": "[vite-react] build",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-react"
},
{
"command": "yarn dev",
"name": "[vite-vanilla] dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-vanilla"
},
{
"command": "yarn build",
"name": "[vite-vanilla] build",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/vite-vanilla"
},
{
"command": "yarn dev",
"name": "[webpack5-vue3] dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/webpack5-vue3"
},
{
"command": "yarn build",
"name": "[webpack5-vue3] build",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/webpack5-vue3"
},
{
"command": "yarn patch",
"name": "do tailwindcss-patch",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/packages/tailwindcss-patch"
},
{
"command": "npm run dev",
"name": "[next-app] dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/next-app"
},
{
"command": "npm run test:dev",
"name": "[tailwindcss-patch] test:dev",
Expand Down Expand Up @@ -38,6 +101,13 @@
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/apps/next-app"
},
{
"command": "npm run test:dev",
"name": "[core] test:dev",
"request": "launch",
"type": "node-terminal",
"cwd": "${workspaceFolder}/packages/core"
}
]
}
12 changes: 7 additions & 5 deletions apps/next-app/next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const { webpackPlugin: utwm } = require('unplugin-tailwindcss-mangle')
const utwm = require('unplugin-tailwindcss-mangle/webpack')
// import utwm from 'unplugin-tailwindcss-mangle'

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack: (config) => {
config.plugins.push(utwm({
classSetOutput: true,
classMapOutput: true
}))
// console.log(process.env.NODE_ENV)
if (process.env.NODE_ENV === 'production') {
config.plugins.push(utwm({
classMapOutput: true
}))
}
return config
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"prepare": "tw-patch install"
},
"dependencies": {
"@types/node": "20.4.8",
"@types/react": "18.2.18",
"@types/node": "20.4.9",
"@types/react": "18.2.19",
"@types/react-dom": "18.2.7",
"autoprefixer": "10.4.14",
"eslint": "8.46.0",
Expand Down
5 changes: 3 additions & 2 deletions apps/next-app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Image from 'next/image'
// import { Inter } from 'next/font/google'
import { Inter } from 'next/font/google'

// const inter = Inter({ subsets: ['latin'] })
const inter = Inter({ subsets: ['latin'] })

export default function Home() {
console.log(inter)
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24">
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
Expand Down
3 changes: 3 additions & 0 deletions apps/next-app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ module.exports = {
},
},
plugins: [],
corePlugins: {
preflight: false
}
}
2 changes: 1 addition & 1 deletion apps/nuxt-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prepare": "tw-patch install"
},
"devDependencies": {
"@types/node": "^20.4.8",
"@types/node": "^20.4.9",
"autoprefixer": "^10.4.14",
"nuxt": "^3.6.5",
"postcss": "^8.4.27",
Expand Down
5 changes: 4 additions & 1 deletion apps/nuxt-app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ module.exports = {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
2 changes: 1 addition & 1 deletion apps/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"devDependencies": {
"@remix-run/dev": "^1.19.2",
"@remix-run/eslint-config": "^1.19.2",
"@types/react": "^18.2.18",
"@types/react": "^18.2.19",
"@types/react-dom": "^18.2.7",
"eslint": "^8.46.0",
"tailwindcss": "^3.3.3",
Expand Down
5 changes: 4 additions & 1 deletion apps/remix-app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ module.exports = {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
5 changes: 4 additions & 1 deletion apps/solid-app/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ module.exports = {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
3 changes: 1 addition & 2 deletions apps/solid-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { defineConfig } from 'vite'
import solidPlugin from 'vite-plugin-solid'
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
export default defineConfig({
plugins: [
solidPlugin(),
utwm({
classSetOutput: true,
classMapOutput: true
})
],
Expand Down
5 changes: 4 additions & 1 deletion apps/vite-lit/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export default {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
2 changes: 1 addition & 1 deletion apps/vite-lit/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from 'vite'
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
// https://vitejs.dev/config/
export default defineConfig({
build: {
Expand Down
2 changes: 1 addition & 1 deletion apps/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.18",
"@types/react": "^18.2.19",
"@types/react-dom": "^18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"autoprefixer": "^10.4.14",
Expand Down
5 changes: 4 additions & 1 deletion apps/vite-react/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export default {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
3 changes: 1 addition & 2 deletions apps/vite-react/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
utwm({
classSetOutput: true,
classMapOutput: true
})
]
Expand Down
5 changes: 4 additions & 1 deletion apps/vite-svelte/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ module.exports = {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
3 changes: 1 addition & 2 deletions apps/vite-svelte/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
svelte(),
utwm({
classSetOutput: true,
classMapOutput: true
})
]
Expand Down
5 changes: 4 additions & 1 deletion apps/vite-vanilla/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export default {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
3 changes: 1 addition & 2 deletions apps/vite-vanilla/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { defineConfig } from 'vite'
import { vitePlugin as utwm } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
utwm({
classSetOutput: true,
classMapOutput: true
})
]
Expand Down
5 changes: 4 additions & 1 deletion apps/vite-vue/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ export default {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
14 changes: 2 additions & 12 deletions apps/vite-vue/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vitePlugin as utwm, defaultMangleClassFilter } from 'unplugin-tailwindcss-mangle'
import utwm from 'unplugin-tailwindcss-mangle/vite'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
utwm({
mangleClassFilter(className) {
if (['ease-out', 'ease-linear', 'ease-in', 'ease-in-out'].includes(className)) {
return false
}
return defaultMangleClassFilter(className)
},
classSetOutput: true,
classMapOutput: true,
jsHandlerOptions: {
minified: true
}
classMapOutput: true
})
]
})
2 changes: 1 addition & 1 deletion apps/webpack5-vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"preview": "vite preview",
"lint": "vue-cli-service lint",
Expand Down
5 changes: 4 additions & 1 deletion apps/webpack5-vue3/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ export default {
theme: {
extend: {}
},
plugins: []
plugins: [],
corePlugins: {
preflight: false
}
}
3 changes: 1 addition & 2 deletions apps/webpack5-vue3/vue.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const { defineConfig } = require('@vue/cli-service')
const { webpackPlugin: utwm } = require('unplugin-tailwindcss-mangle')
const utwm = require('unplugin-tailwindcss-mangle/webpack')
module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: (config) => {
config.plugins.push(utwm({
classSetOutput: true,
classMapOutput: true
}))
}
Expand Down
Loading

0 comments on commit a807c0b

Please sign in to comment.