File tree Expand file tree Collapse file tree 5 files changed +20
-260
lines changed Expand file tree Collapse file tree 5 files changed +20
-260
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ export default tseslint.config(
100
100
'less' ,
101
101
'sass' ,
102
102
'sass-embedded' ,
103
+ 'terser' ,
103
104
'lightningcss' ,
104
105
'vitest' ,
105
106
'unbuild' ,
Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ export type { Connect } from 'dep-types/connect'
252
252
export type { WebSocket , WebSocketAlias } from 'dep-types/ws'
253
253
export type { HttpProxy } from 'dep-types/http-proxy'
254
254
export type { FSWatcher , WatchOptions } from 'dep-types/chokidar'
255
- export type { Terser } from 'dep- types/terser '
255
+ export type { Terser } from 'types/internal/terserOptions '
256
256
export type { RollupCommonJSOptions } from 'dep-types/commonjs'
257
257
export type { RollupDynamicImportVarsOptions } from 'dep-types/dynamicImportVars'
258
258
export type { Matcher , AnymatchPattern , AnymatchFn } from 'dep-types/anymatch'
Original file line number Diff line number Diff line change 1
- import type { Terser } from 'dep-types/terser'
1
+ import type {
2
+ TerserMinifyOptions ,
3
+ TerserMinifyOutput ,
4
+ } from 'types/internal/terserOptions'
2
5
import { WorkerWithFallback } from 'artichokie'
3
6
import type { Plugin } from '../plugin'
4
7
import type { ResolvedConfig } from '..'
5
8
import { requireResolveFromRootWithFallback } from '../utils'
6
9
7
- export interface TerserOptions extends Terser . MinifyOptions {
10
+ export interface TerserOptions extends TerserMinifyOptions {
8
11
/**
9
12
* Vite-specific option to specify the max number of workers to spawn
10
13
* when minifying files with terser.
@@ -42,12 +45,12 @@ export function terserPlugin(config: ResolvedConfig): Plugin {
42
45
async (
43
46
terserPath : string ,
44
47
code : string ,
45
- options : Terser . MinifyOptions ,
48
+ options : TerserMinifyOptions ,
46
49
) => {
47
50
// test fails when using `import`. maybe related: https://github.com/nodejs/node/issues/43205
48
51
// eslint-disable-next-line no-restricted-globals -- this function runs inside cjs
49
52
const terser = require ( terserPath )
50
- return terser . minify ( code , options ) as Terser . MinifyOutput
53
+ return terser . minify ( code , options ) as TerserMinifyOutput
51
54
} ,
52
55
{
53
56
shouldUseFake ( _terserPath , _code , options ) {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+
3
+ // @ts -ignore `terser` may not be installed
4
+ export type * as Terser from 'terser'
5
+ // @ts -ignore `terser` may not be installed
6
+ import type * as Terser from 'terser'
7
+
8
+ /* eslint-enable @typescript-eslint/ban-ts-comment */
9
+
10
+ export type TerserMinifyOptions = Terser . MinifyOptions
11
+ export type TerserMinifyOutput = Terser . MinifyOutput
You can’t perform that action at this time.
0 commit comments