@@ -8,7 +8,7 @@ import {pathToFileURL} from "node:url";
88import he from "he" ;
99import type MarkdownIt from "markdown-it" ;
1010import wrapAnsi from "wrap-ansi" ;
11- import { DUCKDB_CORE_EXTENSIONS , DUCKDB_PLATFORMS } from "./duckdb.js" ;
11+ import { DUCKDB_CORE_ALIASES , DUCKDB_CORE_EXTENSIONS } from "./duckdb.js" ;
1212import { visitFiles } from "./files.js" ;
1313import { formatIsoDate , formatLocaleDate } from "./format.js" ;
1414import type { FrontMatter } from "./frontMatter.js" ;
@@ -78,7 +78,7 @@ export interface SearchConfigSpec {
7878}
7979
8080export interface DuckDBConfig {
81- platforms : Record < string , true > ;
81+ platforms : { [ name : string ] : true } ;
8282 extensions : { [ name : string ] : DuckDBExtensionConfig } ;
8383}
8484
@@ -522,21 +522,22 @@ export function stringOrNull(spec: unknown): string | null {
522522 return spec == null || spec === false ? null : String ( spec ) ;
523523}
524524
525- // TODO configure platforms?
526525function normalizeDuckDB ( spec : unknown ) : DuckDBConfig {
526+ const { mvp = true , eh = true } = spec ?. [ "platforms" ] ?? { } ;
527527 const extensions : { [ name : string ] : DuckDBExtensionConfig } = { } ;
528528 let extspec : Record < string , unknown > = spec ?. [ "extensions" ] ?? { } ;
529529 if ( Array . isArray ( extspec ) ) extspec = Object . fromEntries ( extspec . map ( ( name ) => [ name , { } ] ) ) ;
530530 if ( extspec . json === undefined ) extspec = { ...extspec , json : false } ;
531531 if ( extspec . parquet === undefined ) extspec = { ...extspec , parquet : false } ;
532- for ( const name in extspec ) {
532+ for ( let name in extspec ) {
533533 if ( ! / ^ \w + $ / . test ( name ) ) throw new Error ( `invalid extension: ${ name } ` ) ;
534534 const vspec = extspec [ name ] ;
535535 if ( vspec == null ) continue ;
536+ name = DUCKDB_CORE_ALIASES [ name ] ?? name ;
536537 const {
537- source = DUCKDB_CORE_EXTENSIONS . some ( ( [ n ] ) => n === name ) ? "core" : "community" ,
538+ source = name in DUCKDB_CORE_EXTENSIONS ? "core" : "community" ,
538539 install = true ,
539- load = ! DUCKDB_CORE_EXTENSIONS . find ( ( [ n ] ) => n === name ) ?. [ 1 ]
540+ load = ! DUCKDB_CORE_EXTENSIONS [ name ]
540541 } = typeof vspec === "boolean"
541542 ? { load : vspec }
542543 : typeof vspec === "string"
@@ -548,7 +549,15 @@ function normalizeDuckDB(spec: unknown): DuckDBConfig {
548549 load : Boolean ( load )
549550 } ;
550551 }
551- return { platforms : DUCKDB_PLATFORMS , extensions} ;
552+ return {
553+ platforms : Object . fromEntries (
554+ [
555+ [ "mvp" , mvp ] ,
556+ [ "eh" , eh ]
557+ ] . filter ( ( [ , enabled ] ) => enabled )
558+ ) ,
559+ extensions
560+ } ;
552561}
553562
554563function normalizeDuckDBSource ( source : string ) : string {
0 commit comments