@@ -3,7 +3,10 @@ const { preprocess } = require('requirejs-esm-preprocessor')
33function createPreprocessor ( args , config , helper ) {
44 const { basePath, logLevel, LOG_DEBUG , LOG_DISABLE , requirejsEsmPreprocessor } = config
55 const defaults = { useStrict : true , sourceMap : true }
6- const { isScript, useStrict, sourceMap } = helper . merge ( defaults , args , requirejsEsmPreprocessor || { } )
6+ const {
7+ isScript, useStrict, sourceMap,
8+ onBeforeTransform, onAfterTransform, onBeforeUpdate, onAfterUpdate
9+ } = helper . merge ( defaults , args , requirejsEsmPreprocessor || { } )
710 const verbose = logLevel === LOG_DEBUG
811 const silent = logLevel === LOG_DISABLE
912 const { length : basePathLen } = basePath
@@ -12,7 +15,10 @@ function createPreprocessor(args, config, helper) {
1215 let { originalPath : path } = file
1316 if ( path . startsWith ( basePath ) ) path = path . substring ( basePathLen )
1417 if ( ! isScript || isScript ( path ) ) {
15- contents = preprocess ( { path, contents, isScript, useStrict, sourceMap, verbose, silent } )
18+ contents = preprocess ( {
19+ path, contents, isScript, useStrict, sourceMap, verbose, silent,
20+ onBeforeTransform, onAfterTransform, onBeforeUpdate, onAfterUpdate
21+ } )
1622 }
1723 done ( null , contents )
1824 }
0 commit comments