@@ -58,6 +58,7 @@ async function buildBrowser(options) {
58
58
59
59
detailedGrammarSizes ( languages ) ;
60
60
61
+ await buildVuePluginJS ( { minify : options . minify } ) ;
61
62
const size = await buildBrowserHighlightJS ( languages , { minify : options . minify } ) ;
62
63
63
64
log ( "-----" ) ;
@@ -154,6 +155,29 @@ function installDemoStyles() {
154
155
} ) ;
155
156
}
156
157
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
+
157
181
async function buildBrowserHighlightJS ( languages , { minify } ) {
158
182
log ( "Building highlight.js." ) ;
159
183
0 commit comments