@@ -8,7 +8,7 @@ import { env } from "node:process";
88import ms from "pretty-ms" ;
99import { BuildOptions , build as buildBundle , watch } from "rolldown" ;
1010import { onExit } from "signal-exit" ;
11- import { MODELER_FILES } from "./constants.js" ;
11+ import { PACKAGE_FILES } from "./constants.js" ;
1212import { loadConfig } from "./rolldown.js" ;
1313import { blue , bold , dim , green , greenBright , inverse } from "./utils/colors.js" ;
1414import { isTypeScriptProject , readPackageJson } from "./utils/fs.js" ;
@@ -77,7 +77,7 @@ const tasks = {
7777 logger . success ( formatMsg . built ( bundle . output ?. file ! ) ) ;
7878 }
7979
80- await tasks . copyModelerFiles ( params ) ;
80+ await tasks . copyPackageFiles ( params ) ;
8181 await tasks . buildMpk ( params ) ;
8282
8383 const buildInfo = buildMeasure . end ( ) ;
@@ -117,8 +117,8 @@ const tasks = {
117117 } ) ;
118118
119119 await bundleWatchReady ;
120- await tasks . watchModelerFiles ( params ) ;
121- await tasks . watchContent ( params ) ;
120+ await tasks . watchPackageFiles ( params ) ;
121+ await tasks . watchPackageContent ( params ) ;
122122 logger . info ( "Waiting for changes..." ) ;
123123
124124 onExit ( ( ) => {
@@ -127,8 +127,8 @@ const tasks = {
127127 logger . log ( "Build watcher stopped" ) ;
128128 } ) ;
129129 } ,
130- async copyModelerFiles ( { project } : TaskParams ) : Promise < void > {
131- const stream = fg . stream ( MODELER_FILES ) ;
130+ async copyPackageFiles ( { project } : TaskParams ) : Promise < void > {
131+ const stream = fg . stream ( PACKAGE_FILES ) ;
132132 for await ( const src of stream ) {
133133 const f = path . parse ( src as string ) ;
134134 const dst = path . join ( project . outputDirs . contentRoot , f . base ) ;
@@ -138,12 +138,13 @@ const tasks = {
138138 } ) ;
139139 }
140140 } ,
141- async watchModelerFiles ( params : TaskParams ) : Promise < void > {
141+ /** Watch & copy static package files */
142+ async watchPackageFiles ( params : TaskParams ) : Promise < void > {
142143 const { project, logger } = params ;
143144
144- await tasks . copyModelerFiles ( params ) ;
145+ await tasks . copyPackageFiles ( params ) ;
145146
146- const watcher = chokidar . watch ( await fg ( MODELER_FILES ) ) ;
147+ const watcher = chokidar . watch ( await fg ( PACKAGE_FILES ) ) ;
147148 watcher . on ( "change" , async file => {
148149 logger . info ( formatMsg . copy ( file ) ) ;
149150 const f = path . parse ( file ) ;
@@ -155,7 +156,8 @@ const tasks = {
155156 watcher . close ( ) ;
156157 } ) ;
157158 } ,
158- async watchContent ( params : TaskParams ) : Promise < void > {
159+ /** Setup package content watcher to build mpk whenever package files change */
160+ async watchPackageContent ( params : TaskParams ) : Promise < void > {
159161 const { project } = params ;
160162 await tasks . buildMpk ( { ...params , quiet : true } ) ;
161163 const watcher = chokidar . watch ( project . outputDirs . contentRoot ) ;
0 commit comments