@@ -58,6 +58,7 @@ async function buildBrowser(options) {
5858
5959 detailedGrammarSizes ( languages ) ;
6060
61+ await buildVuePluginJS ( { minify : options . minify } ) ;
6162 const size = await buildBrowserHighlightJS ( languages , { minify : options . minify } ) ;
6263
6364 log ( "-----" ) ;
@@ -154,6 +155,29 @@ function installDemoStyles() {
154155 } ) ;
155156}
156157
158+ async function buildVuePluginJS ( { minify } ) {
159+ log ( "Building vue_plugin.js." ) ;
160+
161+ const outFile = `${ process . env . BUILD_DIR } /vue_plugin.js` ;
162+ const minifiedFile = outFile . replace ( / j s $ / , "min.js" ) ;
163+
164+ const input = { ...config . rollup . browser_core . input , input : `src/plugins/vue.js` } ;
165+ const output = config . rollup . browser_core . output ;
166+ // output.footer = output.footer.replace("hljs", "hljsVue");
167+ let pluginSrc = await rollupCode ( input ,
168+ { ...output , file : outFile , name : "hljsVue" , footer : null } ) ;
169+
170+ const tasks = [ ] ;
171+ tasks . push ( fs . writeFile ( outFile , pluginSrc , { encoding : "utf8" } ) ) ;
172+
173+ if ( minify ) {
174+ const tersed = await Terser . minify ( pluginSrc , config . terser ) ;
175+ tasks . push ( fs . writeFile ( minifiedFile , tersed . code , { encoding : "utf8" } ) ) ;
176+ }
177+
178+ await Promise . all ( tasks ) ;
179+ }
180+
157181async function buildBrowserHighlightJS ( languages , { minify } ) {
158182 log ( "Building highlight.js." ) ;
159183
0 commit comments