Esbuild patch time

typescript

#esbuild:
другие самплы
// main.d.ts:

export interface WatchMode {
  onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
  onStartRebuild?: () => void;    // <= added
  timeMeasurement?: true; 		 // <= added
}

// main.js:

      let watchKeys = /* @__PURE__ */ Object.create(null);
      let onRebuild = getFlag(watch, watchKeys, "onRebuild", mustBeFunction);
      let onStartRebuild = getFlag(watch, watchKeys, "onStartRebuild", mustBeFunction);							// <= added
      let timeMeasurement = getFlag(watch, watchKeys, "timeMeasurement", mustBeStringOrBoolean);  // <= added
      checkForInvalidFlags(watch, watchKeys, `on "watch" in ${callName}() call`);
      watchMode = { onRebuild, onStartRebuild, timeMeasurement };														  // // <= changed

// ....

              requestCallbacks["watch-rebuild"] = (id, request2) => {
                	 if (watch.onStartRebuild) watch.onStartRebuild()			   // <= added	
					 if (watch.timeMeasurement) console.time('rebuild time')   // <= added
                
// ...                
                
                    result2.stop = stop;
                    if (watch.onRebuild)
						  	 watch.timeMeasurement && console.timeEnd('rebuild time')           // <= added
(ваш голос учтен)

Прикрепить файл