@@ -9,7 +9,7 @@ import { renderToHtmlDualThemes } from './renderer-html-dual-themes'
9
9
10
10
export type HighlighterCore = HighlighterGeneric < never , never >
11
11
12
- export async function getHighlighterCore ( options : HighlighterCoreOptions ) : Promise < HighlighterCore > {
12
+ export async function getHighlighterCore ( options : HighlighterCoreOptions = { } ) : Promise < HighlighterCore > {
13
13
async function resolveLangs ( langs : LanguageInput [ ] ) {
14
14
return Array . from ( new Set ( ( await Promise . all (
15
15
langs . map ( async lang => await normalizeGetter ( lang ) . then ( r => Array . isArray ( r ) ? r : [ r ] ) ) ,
@@ -19,8 +19,8 @@ export async function getHighlighterCore(options: HighlighterCoreOptions): Promi
19
19
const [
20
20
themes , langs ,
21
21
] = await Promise . all ( [
22
- Promise . all ( options . themes . map ( normalizeGetter ) ) ,
23
- resolveLangs ( options . langs ) ,
22
+ Promise . all ( ( options . themes || [ ] ) . map ( normalizeGetter ) ) ,
23
+ resolveLangs ( options . langs || [ ] ) ,
24
24
typeof options . loadWasm === 'function'
25
25
? Promise . resolve ( options . loadWasm ( ) ) . then ( r => loadWasm ( r ) )
26
26
: options . loadWasm
@@ -40,7 +40,7 @@ export async function getHighlighterCore(options: HighlighterCoreOptions): Promi
40
40
const _registry = new Registry ( resolver , themes , langs )
41
41
await _registry . init ( )
42
42
43
- const defaultTheme = themes [ 0 ] . name
43
+ const defaultTheme = themes [ 0 ] ? .name
44
44
45
45
function codeToThemedTokens (
46
46
code : string ,
0 commit comments