dongyuwei / CommonJS.erl

A CommonJS Module Packager in Erlang
Other
3 stars 0 forks source link

watch and rebuild #2

Closed dongyuwei closed 7 years ago

dongyuwei commented 7 years ago
  1. master process spawn one process per JavaScript entry file, this child-process is the entry owner.
  2. master process spawn a standalone process to watch all JavaScript files.
  3. when file changed, the monitor process send msg to the master process.
  4. the master process then send the change event to all the entry owner processes.
  5. entry owner process update the cached source code in process dictionary, then rebuild the entry file.
dongyuwei commented 7 years ago

It can watch changed module and rebuild entry file now. todo: rebuild incrementally --- cache every module and it's dependencies, if the module changed, check if its dependencies names changed. If the module's dependencies names not changed, just update the content of the module in source_cache then rebuild the entry file. If the module's dependencies names changed, rebuild the module entirely.