You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// ==== step1: generate diff view data, this part can be used in the worker/server environment for better performance ==== //import{DiffFile}from"@git-diff-view/core";constfile=newDiffFile(data?.oldFile?.fileName||"",data?.oldFile?.content||"",data?.newFile?.fileName||"",data?.newFile?.content||"",data?.hunks||[],data?.oldFile?.fileLang||"",data?.newFile?.fileLang||"");// light / dark theme, base on current highlight engine// default is lightfile.initTheme(xxx);// initfile.init();// or you can use below method to initfile.initRaw();file.initSyntax();// if you do not want syntax highlight, you can skip this step// build the `Split View` data;file.buildSplitDiffLines();// build the `Unified View` data;file.buildUnifiedDiffLines();// get All the diff data bundle, you can safely to send this data to the client sideconstbundle=file.getBundle();// ==== step2: render the @git-diff-view component ==== //// merge bundleconstmergeFile=DiffFile.createInstance(data||{},bundle);// used for @git-diff-view/react and @git-diff-view/vue<DiffViewdiffFile={mergeFile}/><DiffView :diffFile="mergeFile"/>