Skip to content

Commit

Permalink
detect non-local sql tables (#1636)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock authored Sep 3, 2024
1 parent 802f0dd commit fa80489
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ if (location.pathname.endsWith("/")) {
import ${preview || page.code.length ? `{${preview ? "open, " : ""}define} from ` : ""}${JSON.stringify(
resolveImport("observablehq:client")
)};${
files.size || data?.sql
files.size
? `\nimport {registerFile${data?.sql ? ", FileAttachment" : ""}} from ${JSON.stringify(
resolveImport("observablehq:stdlib")
)};`
Expand Down
7 changes: 5 additions & 2 deletions src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ export async function getResolvers(

// Add SQL sources.
if (page.data.sql) {
for (const source of Object.values(page.data.sql)) {
files.add(String(source));
for (const value of Object.values(page.data.sql)) {
const source = String(value);
if (isAssetPath(source)) {
files.add(source);
}
}
}

Expand Down

0 comments on commit fa80489

Please sign in to comment.