From 60e66465430c87d2794b45edc6e8a9212e6ef8fe Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 15 Mar 2024 09:01:56 -0700 Subject: [PATCH 1/3] fix describe{Tables,Columns} (#1068) --- src/client/stdlib/duckdb.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/client/stdlib/duckdb.js b/src/client/stdlib/duckdb.js index 6f14b3487..09420378f 100644 --- a/src/client/stdlib/duckdb.js +++ b/src/client/stdlib/duckdb.js @@ -146,18 +146,19 @@ export class DuckDBClient { } async describeTables() { - const tables = await this.query("SHOW TABLES"); - return tables.map(({name}) => ({name})); + return Array.from(await this.query("SHOW TABLES"), ({name}) => ({name})); } async describeColumns({table} = {}) { - const columns = await this.query(`DESCRIBE ${this.escape(table)}`); - return columns.map(({column_name, column_type, null: nullable}) => ({ - name: column_name, - type: getDuckDBType(column_type), - nullable: nullable !== "NO", - databaseType: column_type - })); + return Array.from( + await this.query(`DESCRIBE ${this.escape(table)}`), + ({column_name, column_type, null: nullable}) => ({ + name: column_name, + type: getDuckDBType(column_type), + nullable: nullable !== "NO", + databaseType: column_type + }) + ); } static async of(sources = {}, config = {}) { From 1971b567b103d948fa51c8c1ced72407c768fa05 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 15 Mar 2024 09:03:03 -0700 Subject: [PATCH 2/3] fix resolveScript during build (#1069) --- src/build.ts | 5 +++++ test/output/build/imports/script.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/build.ts b/src/build.ts index b1b88718f..52fdc7697 100644 --- a/src/build.ts +++ b/src/build.ts @@ -238,6 +238,11 @@ export async function build( const r = resolvers.resolveImport(specifier); const a = aliases.get(resolvePath(path, r)); return a ? relativePath(path, a) : isPathImport(specifier) ? specifier : r; // fallback to specifier if enoent + }, + resolveScript(specifier) { + const r = resolvers.resolveScript(specifier); + const a = aliases.get(resolvePath(path, r)); + return a ? relativePath(path, a) : specifier; // fallback to specifier if enoent } } }); diff --git a/test/output/build/imports/script.html b/test/output/build/imports/script.html index 510ccd227..cfd0511db 100644 --- a/test/output/build/imports/script.html +++ b/test/output/build/imports/script.html @@ -36,7 +36,7 @@

Scripts

- +