@@ -23,15 +23,6 @@ async function main() {
2323 let outputPath = CliArgs . output ;
2424 let runtimeArgs = CliArgs . debug ? '--enable-script-debugging' : '' ;
2525
26- // Small optimization to skip componentization if the source file hasn't changed
27- if ( ! ( await ShouldComponentize ( src , outputPath , componentizeVersion , runtimeArgs ) ) ) {
28- console . log (
29- 'No changes detected in source file. Skipping componentization.' ,
30- ) ;
31- return ;
32- }
33- console . log ( 'Componentizing...' ) ;
34-
3526 // generate wit world string
3627 let wasiDeps = getPackagesWithWasiDeps ( process . cwd ( ) , new Set ( ) , true ) ;
3728 let { witPaths, targetWorlds } = processWasiDeps ( wasiDeps ) ;
@@ -63,6 +54,16 @@ async function main() {
63546455 ) ;
6556
57+ let inlineWitChecksum = await calculateChecksum ( inlineWit ) ;
58+ // Small optimization to skip componentization if the source file hasn't changed
59+ if ( ! ( await ShouldComponentize ( src , outputPath , componentizeVersion , runtimeArgs , inlineWitChecksum ) ) ) {
60+ console . log (
61+ 'No changes detected in source file and target World. Skipping componentization.' ,
62+ ) ;
63+ return ;
64+ }
65+ console . log ( 'Componentizing...' ) ;
66+
6667 const source = await readFile ( src , 'utf8' ) ;
6768 const precompiledSource = precompile ( source , src , true ) as string ;
6869
@@ -85,9 +86,10 @@ async function main() {
8586 // Save the checksum of the input file along with the componentize version
8687 await saveBuildData (
8788 getBuildDataPath ( src ) ,
88- await calculateChecksum ( src ) ,
89+ await calculateChecksum ( await readFile ( src ) ) ,
8990 componentizeVersion ,
9091 runtimeArgs ,
92+ inlineWitChecksum ,
9193 ) ;
9294
9395 console . log ( 'Component successfully written.' ) ;
0 commit comments