File tree Expand file tree Collapse file tree 2 files changed +18
-18
lines changed
packages/shared/plugin-less-copy Expand file tree Collapse file tree 2 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 1
1
// import { fileURLToPath, URL } from 'url'
2
2
3
- import resolve from '@rollup/plugin-node-resolve'
4
- import typescript from '@rollup/plugin-typescript'
5
- import commonjs from '@rollup/plugin-commonjs'
3
+ import resolve from '@rollup/plugin-node-resolve' ;
4
+ import typescript from '@rollup/plugin-typescript' ;
5
+ import commonjs from '@rollup/plugin-commonjs' ;
6
6
7
- import pkg from './package.json'
7
+ import pkg from './package.json' ;
8
8
9
9
export default {
10
10
input : 'src/index.ts' ,
@@ -21,4 +21,4 @@ export default {
21
21
sourceMap : false ,
22
22
} ) ,
23
23
] ,
24
- }
24
+ } ;
Original file line number Diff line number Diff line change 1
- import { resolve } from 'path'
2
- import { normalizePath , type Plugin } from 'vite'
1
+ import { resolve } from 'path' ;
2
+ import { normalizePath , type Plugin } from 'vite' ;
3
3
4
- const excludeRegx = / n o d e _ m o d u l e s /
4
+ const excludeRegx = / n o d e _ m o d u l e s / ;
5
5
6
6
function createPlugin ( ) : Plugin {
7
- const maps = new Map < string , string > ( )
8
- const srcDir = normalizePath ( resolve ( './src/' ) )
7
+ const maps = new Map < string , string > ( ) ;
8
+ const srcDir = normalizePath ( resolve ( './src/' ) ) ;
9
9
10
10
return {
11
11
name : 'vite-plugin-less-copy' ,
12
12
enforce : 'pre' ,
13
13
apply : 'build' ,
14
14
transform ( code : string , id : string ) {
15
15
if ( ! id . endsWith ( '.less' ) || excludeRegx . test ( id ) ) {
16
- return
16
+ return ;
17
17
}
18
18
19
- maps . set ( id , code )
20
- return code
19
+ maps . set ( id , code ) ;
20
+ return code ;
21
21
} ,
22
22
23
23
generateBundle ( ) {
24
24
maps . forEach ( ( code , file ) => {
25
- const filename = file . replace ( srcDir , '' ) . substring ( 1 )
25
+ const filename = file . replace ( srcDir , '' ) . substring ( 1 ) ;
26
26
this . emitFile ( {
27
27
type : 'asset' ,
28
28
fileName : filename ,
29
29
source : code ,
30
- } )
31
- } )
30
+ } ) ;
31
+ } ) ;
32
32
} ,
33
- }
33
+ } ;
34
34
}
35
35
36
- export default createPlugin
36
+ export default createPlugin ;
You can’t perform that action at this time.
0 commit comments