Skip to content

Commit

Permalink
unpin echarts (#987)
Browse files Browse the repository at this point in the history
* unpin echarts

* fix tests

* clean up call in recommendedLibraries

* add a link to the ECharts website

* hyphenate “open-source”

---------

Co-authored-by: Philippe Rivière <fil@rezo.net>
  • Loading branch information
mbostock and Fil authored Mar 6, 2024
1 parent d0fae89 commit 466092b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/lib/echarts.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ index: true

# Apache ECharts

Apache ECharts is available by default as `echarts` in Markdown. You can also import it explicitly like so:
[Apache ECharts](https://echarts.apache.org), an open-source JavaScript visualization library, is available by default as `echarts` in Markdown. You can also import it explicitly like so:

```js run=false
import * as echarts from "npm:echarts/dist/echarts.esm.js";
import * as echarts from "npm:echarts";
```

To use ECharts, declare a container element with the desired dimensions, [display it](../javascript/display), and then call `echarts.init`.
Expand Down
2 changes: 1 addition & 1 deletion src/client/stdlib/recommendedLibraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const d3 = () => import("npm:d3");
export const dot = () => import("observablehq:stdlib/dot").then((dot) => dot.default);
export const duckdb = () => import("npm:@duckdb/duckdb-wasm");
export const DuckDBClient = () => import("observablehq:stdlib/duckdb").then((duckdb) => duckdb.DuckDBClient);
export const echarts = () => import("npm:echarts/dist/echarts.esm.min.js");
export const echarts = () => import("npm:echarts");
export const htl = () => import("npm:htl");
export const html = () => import("npm:htl").then((htl) => htl.html);
export const svg = () => import("npm:htl").then((htl) => htl.svg);
Expand Down
2 changes: 1 addition & 1 deletion src/libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function getImplicitInputImports(inputs: Iterable<string>): Set<string> {
if (set.has("dot")) implicits.add("npm:@observablehq/dot");
if (set.has("duckdb")) implicits.add("npm:@duckdb/duckdb-wasm");
if (set.has("DuckDBClient")) implicits.add("npm:@observablehq/duckdb");
if (set.has("echarts")) implicits.add("npm:echarts/dist/echarts.esm.min.js");
if (set.has("echarts")) implicits.add("npm:echarts");
if (set.has("htl") || set.has("html") || set.has("svg")) implicits.add("npm:htl");
if (set.has("Inputs")) implicits.add("npm:@observablehq/inputs");
if (set.has("L")) implicits.add("npm:leaflet");
Expand Down
6 changes: 3 additions & 3 deletions src/npm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ export async function resolveNpmImport(root: string, specifier: string): Promise
? "13.0.0" // https://github.com/observablehq/framework/issues/750
: name === "parquet-wasm"
? "0.5.0" // https://github.com/observablehq/framework/issues/733
: name === "echarts"
? "5.4.3" // https://github.com/observablehq/framework/pull/811
: undefined,
path = name === "mermaid"
? "dist/mermaid.esm.min.mjs/+esm" // TODO
? "dist/mermaid.esm.min.mjs/+esm"
: name === "echarts"
? "dist/echarts.esm.min.js"
: "+esm"
} = parseNpmSpecifier(specifier);
return `/_npm/${name}@${await resolveNpmVersion(root, {name, range})}/${path.replace(/\+esm$/, "+esm.js")}`;
Expand Down
1 change: 1 addition & 0 deletions test/mocks/jsdelivr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const packages: [name: string, version: string][] = [
["canvas-confetti", "1.9.2"],
["d3-dsv", "3.0.1"],
["d3", "7.8.5"],
["echarts", "5.5.0"],
["exceljs", "4.4.0"],
["htl", "0.3.1"],
["jszip", "3.10.1"],
Expand Down

0 comments on commit 466092b

Please sign in to comment.