File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import hljs from "../../build/es/index.js" ;
2
+
3
+ const API = [
4
+ "getLanguage" ,
5
+ "registerLanguage" ,
6
+ "highlight" ,
7
+ "highlightAuto" ,
8
+ "highlightAll" ,
9
+ "highlightElement" ,
10
+ ] ;
11
+
12
+ const assert = ( f , msg ) => {
13
+ if ( ! f ( ) ) {
14
+ console . error ( msg ) ;
15
+ process . exit ( 1 ) ;
16
+ }
17
+ } ;
18
+ const keys = Object . keys ( hljs ) ;
19
+
20
+ API . forEach ( ( n ) => {
21
+ assert ( ( _ ) => keys . includes ( n ) , `API should include ${ n } ` ) ;
22
+ } ) ;
23
+
24
+ console . log ( "Pass: browser build works with Node.js just fine." ) ;
Original file line number Diff line number Diff line change
1
+ // rollup.config.js
2
+ import commonjs from "@rollup/plugin-commonjs" ;
3
+
4
+ export default {
5
+ input : "test/builds/node_build_as_esm.mjs" ,
6
+ output : {
7
+ file : "build/bundle.js" ,
8
+ format : "iife" ,
9
+ } ,
10
+ plugins : [
11
+ commonjs ( {
12
+ include : "build/**" , // Default: undefined
13
+ exclude : [ "node_modules/**" ] , // Default: undefined
14
+ } ) ,
15
+ ] ,
16
+ } ;
You can’t perform that action at this time.
0 commit comments