File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
packages/webpack-plugin/src Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 11import { writeFile } from 'node:fs/promises'
22import { basename , dirname , join , relative } from 'node:path'
33
4- import { codeExtract , exportClassMap , exportSheet } from '@devup-ui/wasm'
4+ import {
5+ codeExtract ,
6+ exportClassMap ,
7+ exportFileMap ,
8+ exportSheet ,
9+ } from '@devup-ui/wasm'
510import type { RawLoaderDefinitionFunction } from 'webpack'
611
712export interface DevupUILoaderOptions {
@@ -21,6 +26,7 @@ const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions> =
2126 cssDir,
2227 sheetFile,
2328 classMapFile,
29+ fileMapFile,
2430 splitCss,
2531 } = this . getOptions ( )
2632 const callback = this . async ( )
@@ -52,6 +58,7 @@ const devupUILoader: RawLoaderDefinitionFunction<DevupUILoaderOptions> =
5258 ) ,
5359 watch ? writeFile ( sheetFile , exportSheet ( ) ) : null ,
5460 watch ? writeFile ( classMapFile , exportClassMap ( ) ) : null ,
61+ watch ? writeFile ( fileMapFile , exportFileMap ( ) ) : null ,
5562 ] )
5663 . catch ( console . error )
5764 . finally ( ( ) => callback ( null , code , sourceMap ) )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 getDefaultTheme ,
1414 getThemeInterface ,
1515 importClassMap ,
16+ importFileMap ,
1617 importSheet ,
1718 registerTheme ,
1819 setDebug ,
@@ -96,13 +97,16 @@ export class DevupUIWebpackPlugin {
9697
9798 const sheetFile = join ( this . options . interfacePath , 'sheet.json' )
9899 const classMapFile = join ( this . options . interfacePath , 'classMap.json' )
100+ const fileMapFile = join ( this . options . interfacePath , 'fileMap.json' )
99101 if ( this . options . watch ) {
100102 try {
101103 // load sheet
102104 if ( existsSync ( sheetFile ) )
103105 importSheet ( JSON . parse ( readFileSync ( sheetFile , 'utf-8' ) ) )
104106 if ( existsSync ( classMapFile ) )
105107 importClassMap ( JSON . parse ( readFileSync ( classMapFile , 'utf-8' ) ) )
108+ if ( existsSync ( fileMapFile ) )
109+ importFileMap ( JSON . parse ( readFileSync ( fileMapFile , 'utf-8' ) ) )
106110 } catch ( error ) {
107111 console . error ( error )
108112 }
@@ -177,6 +181,7 @@ export class DevupUIWebpackPlugin {
177181 cssDir : this . options . cssDir ,
178182 sheetFile,
179183 classMapFile,
184+ fileMapFile,
180185 watch : this . options . watch ,
181186 splitCss : this . options . splitCss ,
182187 } ,
You can’t perform that action at this time.
0 commit comments