Skip to content

Release: 1.2.2 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions apps/next-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"prepare": "tw-patch"
},
"dependencies": {
"@types/node": "20.2.1",
"@types/react": "18.2.6",
"@types/node": "20.2.5",
"@types/react": "18.2.8",
"@types/react-dom": "18.2.4",
"autoprefixer": "10.4.14",
"eslint": "8.40.0",
"eslint-config-next": "13.4.2",
"next": "13.4.2",
"postcss": "8.4.23",
"eslint": "8.42.0",
"eslint-config-next": "13.4.4",
"next": "13.4.4",
"postcss": "8.4.24",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.2",
"typescript": "5.0.4"
"typescript": "5.1.3"
},
"devDependencies": {
"tailwindcss-patch": "workspace:*",
Expand Down
6 changes: 3 additions & 3 deletions apps/nuxt-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"prepare": "tw-patch"
},
"devDependencies": {
"@types/node": "^20.2.1",
"@types/node": "^20.2.5",
"autoprefixer": "^10.4.14",
"nuxt": "^3.5.0",
"postcss": "^8.4.23",
"nuxt": "^3.5.3",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"unplugin-tailwindcss-mangle": "workspace:*"
Expand Down
16 changes: 8 additions & 8 deletions apps/remix-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@
"prepare": "tw-patch"
},
"dependencies": {
"@remix-run/node": "^1.16.1",
"@remix-run/react": "^1.16.1",
"@remix-run/serve": "^1.16.1",
"@remix-run/node": "^1.17.0",
"@remix-run/react": "^1.17.0",
"@remix-run/serve": "^1.17.0",
"isbot": "^3.6.8",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "^1.16.1",
"@remix-run/eslint-config": "^1.16.1",
"@types/react": "^18.2.6",
"@remix-run/dev": "^1.17.0",
"@remix-run/eslint-config": "^1.17.0",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"eslint": "^8.40.0",
"eslint": "^8.42.0",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*"
},
"engines": {
Expand Down
8 changes: 4 additions & 4 deletions apps/solid-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
"license": "MIT",
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8",
"vite": "^4.3.9",
"vite-plugin-solid": "^2.5.0"
},
"dependencies": {
"solid-js": "^1.7.5"
"solid-js": "^1.7.6"
}
}
8 changes: 4 additions & 4 deletions apps/vite-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"prepare": "tw-patch"
},
"dependencies": {
"lit": "^2.7.4"
"lit": "^2.7.5"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8"
"vite": "^4.3.9"
}
}
8 changes: 4 additions & 4 deletions apps/vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.6",
"@types/react": "^18.2.8",
"@types/react-dom": "^18.2.4",
"@vitejs/plugin-react": "^4.0.0",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8"
"vite": "^4.3.9"
}
}
12 changes: 6 additions & 6 deletions apps/vite-svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.2.0",
"@sveltejs/vite-plugin-svelte": "^2.4.1",
"@tsconfig/svelte": "^4.0.1",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"svelte": "^3.59.1",
"svelte-check": "^3.3.2",
"svelte-check": "^3.4.3",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"tslib": "^2.5.1",
"typescript": "^5.0.4",
"tslib": "^2.5.3",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8"
"vite": "^4.3.9"
}
}
6 changes: 3 additions & 3 deletions apps/vite-vanilla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8"
"vite": "^4.3.9"
}
}
6 changes: 3 additions & 3 deletions apps/vite-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
"devDependencies": {
"@vitejs/plugin-vue": "^4.2.3",
"autoprefixer": "^10.4.14",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "^5.0.4",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*",
"vite": "^4.3.8",
"vite": "^4.3.9",
"vue-tsc": "^1.6.5"
}
}
16 changes: 8 additions & 8 deletions apps/webpack5-vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"dependencies": {
"core-js": "^3.30.2",
"vue": "^3.3.4",
"vue-router": "^4.2.0"
"vue-router": "^4.2.2"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@typescript-eslint/eslint-plugin": "^5.59.9",
"@typescript-eslint/parser": "^5.59.9",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-router": "~5.0.0",
Expand All @@ -25,17 +25,17 @@
"@vue/eslint-config-standard": "^8.0.1",
"@vue/eslint-config-typescript": "^11.0.3",
"autoprefixer": "^10.4.14",
"eslint": "^8.40.0",
"eslint": "^8.42.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.13.0",
"postcss": "^8.4.23",
"eslint-plugin-vue": "^9.14.1",
"postcss": "^8.4.24",
"sass": "^1.62.1",
"sass-loader": "^13.2.2",
"sass-loader": "^13.3.1",
"tailwindcss": "^3.3.2",
"tailwindcss-patch": "workspace:*",
"typescript": "~5.0.4",
"typescript": "~5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*"
}
}
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailwindcss-mangle",
"version": "1.2.1",
"version": "1.2.2",
"private": true,
"workspaces": [
"apps/*",
Expand All @@ -20,29 +20,29 @@
"sync": "cnpm sync tailwindcss-mangle-shared tailwindcss-patch unplugin-tailwindcss-mangle tailwindcss-mangle-core"
},
"devDependencies": {
"@icebreakers/eslint-config-ts": "^1.0.4",
"@icebreakers/eslint-config-ts": "^1.1.0",
"@icebreakers/rollup": "^0.4.0",
"@icebreakers/tsconfig": "^0.0.6",
"@tsconfig/recommended": "^1.0.2",
"@types/jest": "^29.5.1",
"@types/node": "^20.2.1",
"bumpp": "^9.1.0",
"@types/jest": "^29.5.2",
"@types/node": "^20.2.5",
"bumpp": "^9.1.1",
"cross-env": "^7.0.3",
"eslint": "^8.40.0",
"eslint": "^8.42.0",
"jest": "^29.5.0",
"only-allow": "^1.1.1",
"prettier": "^2.8.8",
"rollup": "^3.22.0",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"rollup": "^3.23.1",
"tailwindcss-mangle-core": "workspace:*",
"tailwindcss-mangle-shared": "workspace:*",
"tailwindcss-patch": "workspace:*",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
"unplugin-tailwindcss-mangle": "workspace:*"
},
"engines": {
"node": ">=14.0.0"
},
"packageManager": "pnpm@8.5.1"
}
}
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tailwindcss-mangle-core",
"version": "1.2.1",
"version": "1.2.2",
"description": "The core of tailwindcss-mangle",
"main": "dist/index.js",
"module": "./dist/index.mjs",
Expand Down Expand Up @@ -28,17 +28,17 @@
"registry": "https://registry.npmjs.org/"
},
"dependencies": {
"@babel/core": "^7.21.8",
"@babel/types": "^7.21.5",
"@babel/core": "^7.22.1",
"@babel/types": "^7.22.4",
"parse5": "^7.1.2",
"postcss": "^8.4.23",
"postcss": "^8.4.24",
"postcss-selector-parser": "^6.0.13",
"tailwindcss-mangle-shared": "workspace:^"
},
"devDependencies": {
"@parse5/tools": "^0.1.0",
"@types/babel__core": "^7.20.0",
"tslib": "^2.5.1"
"@types/babel__core": "^7.20.1",
"tslib": "^2.5.3"
},
"homepage": "https://github.com/sonofmagic/tailwindcss-mangle",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/env.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const isProd = () => process.env.NODE_ENV === 'production'
export const isDev = () => process.env.NODE_ENV === 'development'
2 changes: 2 additions & 0 deletions packages/core/src/js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as t from '@babel/types'
import { transformSync, type BabelFileResult, type NodePath } from '@babel/core'
import type { IJsHandlerOptions } from '../types'
import { makeRegex, splitCode } from '../shared'
import { isProd } from '../env'

export function handleValue(str: string, node: StringLiteral | TemplateElement, options: IJsHandlerOptions) {
const { runtimeSet: set, classGenerator: clsGen, splitQuote = true } = options
Expand Down Expand Up @@ -66,6 +67,7 @@ export function jsHandler(rawSource: string, options: IJsHandlerOptions) {
}
}
],
minified: options.minified ?? isProd(),
sourceMaps: false,
configFile: false
})
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface IHtmlHandlerOptions extends IHandlerOptions {}

export interface IJsHandlerOptions extends IHandlerOptions {
splitQuote?: boolean
minified?: boolean
}

export interface ICssHandlerOptions extends IHandlerOptions {
Expand Down
22 changes: 22 additions & 0 deletions packages/core/test/__snapshots__/js.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`js handler comment-ignore case 1`] = `
"const clipPath = [\`circle()\`];
document.documentElement.animate({
clipPath
}, {
duration: 500,
easing: "tw-a",
pseudoElement: '::view-transition-new(root)'
});
document.documentElement.animate({
clipPath
}, {
duration: 500,
easing: /* tw-mangle ignore */'ease-out',
pseudoElement: '::view-transition-new(root)'
});"
`;

exports[`js handler common StringLiteral 1`] = `"element.innerHTML = "<div class=\\"tw-a tw-b\\">count is counter</div>";"`;

exports[`js handler common StringLiteral with splitQuote false 1`] = `"element.innerHTML = '<div class="dark:bg-zinc-800/30 lg:dark:bg-zinc-800/30">count is counter</div>';"`;
Expand All @@ -17,6 +35,10 @@ exports[`js handler eval script case 1`] = `
});"
`;

exports[`js handler minified js true 1`] = `"const clipPath=[\`circle()\`];document.documentElement.animate({clipPath},{duration:500,easing:"tw-a",pseudoElement:"::view-transition-new(root)"});document.documentElement.animate({clipPath},{duration:500,easing:/* tw-mangle ignore */"ease-out",pseudoElement:"::view-transition-new(root)"});"`;

exports[`js handler minified js with NODE_ENV 1`] = `"const clipPath=[\`circle()\`];document.documentElement.animate({clipPath},{duration:500,easing:"tw-a",pseudoElement:"::view-transition-new(root)"});document.documentElement.animate({clipPath},{duration:500,easing:/* tw-mangle ignore */"ease-out",pseudoElement:"::view-transition-new(root)"});"`;

exports[`js handler nextjs server side mangle 1`] = `
""use strict";

Expand Down
23 changes: 23 additions & 0 deletions packages/core/test/fixtures/comment-ignore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const clipPath = [`circle()`]

document.documentElement.animate(
{
clipPath
},
{
duration: 500,
easing: 'ease-out',
pseudoElement: '::view-transition-new(root)'
}
)

document.documentElement.animate(
{
clipPath
},
{
duration: 500,
easing: /* tw-mangle ignore */ 'ease-out',
pseudoElement: '::view-transition-new(root)'
}
)
Loading