import { File } from "fuse-box" ; import { WorkFlowContext , Plugin } from "fuse-box" ; export class implements Plugin export class FuseBoxSnapshotPlugin implements Plugin { type { RegExp } memberOf public test : RegExp = /\.snap$/ ; param { WorkFlowContext } context memberOf public init ( context ) { context . allowExtension ( ".snap" ) ; } param { File } file memberOf public transform ( file ) { const context = file . context ; if ( context . useCache ) { if ( file . loadFromCache ( ) ) { return ; } } file . loadContents ( ) ; if ( context . useCache ) { context . emitJavascriptHotReload ( file ) ; context . cache . writeStaticCache ( file , file . sourceMap ) ; } } } ; export const SnapshotPlugin = ( ) => { return new FuseBoxSnapshotPlugin ( ) ; } ;