Skip to content

Commit 1da8f2f

Browse files
committed
chore: commit rollup options
1 parent 0d826c5 commit 1da8f2f

15 files changed

+161
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { Config } from 'jest'
2+
import baseConfig from '../../jest.config'
3+
const config: Config = {
4+
projects: [
5+
{
6+
...baseConfig
7+
}
8+
]
9+
}
10+
11+
export default config

packages/unplugin-tailwindcss-mangle/package.json

+47-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,47 @@
22
"name": "unplugin-tailwindcss-mangle",
33
"version": "0.0.0",
44
"description": "",
5-
"main": "index.js",
5+
"exports": {
6+
".": {
7+
"types": "./dist/index.d.ts",
8+
"require": "./dist/index.cjs",
9+
"import": "./dist/index.js"
10+
},
11+
"./vite": {
12+
"types": "./dist/vite.d.ts",
13+
"require": "./dist/vite.cjs",
14+
"import": "./dist/vite.js"
15+
},
16+
"./webpack": {
17+
"types": "./dist/webpack.d.ts",
18+
"require": "./dist/webpack.cjs",
19+
"import": "./dist/webpack.js"
20+
},
21+
"./rollup": {
22+
"types": "./dist/rollup.d.ts",
23+
"require": "./dist/rollup.cjs",
24+
"import": "./dist/rollup.js"
25+
},
26+
"./esbuild": {
27+
"types": "./dist/esbuild.d.ts",
28+
"require": "./dist/esbuild.cjs",
29+
"import": "./dist/esbuild.js"
30+
},
31+
"./nuxt": {
32+
"types": "./dist/nuxt.d.ts",
33+
"require": "./dist/nuxt.cjs",
34+
"import": "./dist/nuxt.js"
35+
},
36+
"./types": {
37+
"types": "./dist/types.d.ts",
38+
"require": "./dist/types.cjs",
39+
"import": "./dist/types.js"
40+
},
41+
"./*": "./*"
42+
},
43+
"main": "dist/index.cjs",
44+
"module": "dist/index.js",
45+
"types": "dist/index.d.ts",
646
"scripts": {
747
"dev": "cross-env NODE_ENV=development rollup -cw",
848
"build": "cross-env NODE_ENV=production rollup -c",
@@ -18,15 +58,16 @@
1858
"author": "SonOfMagic <qq1324318532@gmail.com>",
1959
"license": "MIT",
2060
"dependencies": {
21-
"tailwindcss-patch": "workspace:*",
22-
"unplugin": "^1.3.1",
2361
"@babel/generator": "^7.21.4",
2462
"@babel/parser": "^7.21.4",
2563
"@babel/traverse": "^7.21.4",
2664
"@babel/types": "^7.21.4",
65+
"parse5": "^7.1.2",
2766
"postcss": "^8.4.21",
2867
"postcss-selector-parser": "^6.0.11",
29-
"semver": "^7.3.8"
68+
"semver": "^7.3.8",
69+
"tailwindcss-patch": "workspace:*",
70+
"unplugin": "^1.3.1"
3071
},
3172
"publishConfig": {
3273
"access": "public",
@@ -36,6 +77,7 @@
3677
"@types/babel__generator": "^7.6.4",
3778
"@types/babel__traverse": "^7.18.3",
3879
"@types/semver": "^7.3.13",
39-
"pkg-types": "^1.0.2"
80+
"pkg-types": "^1.0.2",
81+
"tslib": "^2.5.0"
4082
}
4183
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { createRollupConfig, legacyOutputOptions } from '@icebreakers/rollup'
2+
3+
export default createRollupConfig({
4+
input: {
5+
index: 'src/index.ts',
6+
esbuild: 'src/esbuild.ts',
7+
nuxt: 'src/nuxt.ts',
8+
rollup: 'src/rollup.ts',
9+
vite: 'src/vite.ts',
10+
webpack: 'src/webpack.ts'
11+
},
12+
output: [
13+
{
14+
dir: 'dist',
15+
format: 'cjs',
16+
entryFileNames: '[name].cjs',
17+
chunkFileNames: '[name]-[hash].cjs',
18+
...legacyOutputOptions
19+
},
20+
{
21+
dir: 'dist',
22+
format: 'esm',
23+
...legacyOutputOptions
24+
}
25+
]
26+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unplugin from '.'
2+
3+
export default unplugin.esbuild
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createUnplugin } from 'unplugin'
2+
import type { Options } from './types'
3+
4+
export default createUnplugin<Options | undefined>((options) => ({
5+
name: 'unplugin-starter',
6+
transformInclude(id) {
7+
return id.endsWith('main.ts')
8+
},
9+
transform(code) {
10+
return code.replace('__UNPLUGIN__', `Hello Unplugin! ${options}`)
11+
}
12+
}))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import generate from '@babel/generator'
2+
import { parse } from '@babel/parser'
3+
import traverse from '@babel/traverse'
4+
5+
export { generate, parse, traverse }

packages/unplugin-tailwindcss-mangle/src/lib/html.ts

Whitespace-only changes.

packages/unplugin-tailwindcss-mangle/src/lib/postcss.ts

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import type { Options } from './types'
2+
import unplugin from '.'
3+
4+
export default function (options: Options = {}, nuxt: any) {
5+
// install webpack plugin
6+
nuxt.hook('webpack:config', async (config: any) => {
7+
config.plugins = config.plugins || []
8+
config.plugins.unshift(unplugin.webpack(options))
9+
})
10+
11+
// install vite plugin
12+
nuxt.hook('vite:extendConfig', async (config: any) => {
13+
config.plugins = config.plugins || []
14+
config.plugins.push(unplugin.vite(options))
15+
})
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unplugin from '.'
2+
3+
export default unplugin.rollup
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export interface Options {
2+
// define your plugin options here
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unplugin from '.'
2+
3+
export default unplugin.vite
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import unplugin from '.'
2+
3+
export default unplugin.webpack
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "dist",
5+
"declarationDir": "dist"
6+
},
7+
"include": [
8+
"src"
9+
]
10+
}

pnpm-lock.yaml

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)