Download ESM modules from npm and jsdelivr
Project description
download-esm
Download ESM modules from npm and jsdelivr
Installation
Install this tool using pip
:
pip install download-esm
Warning
This is alpha software. It works for downloading Observable Plot, but has not been tested against any other packages yet.
Your help welcome in testing this further!
Usage
To download Observable Plot and all of its dependencies as ECMAScript modules:
download-esm @observablehq/plot
This will download around 40 .js
files to the current directory.
To put them in another directory, add that as an argument:
download-esm @observablehq/plot ./js
Each file will have any import
and export
statements rewritten as relative paths.
You can then use the library in your own HTML and JavaScript something like this:
<div id="myplot"></div>
<script type="module">
import * as Plot from "./js/observablehq-plot-0-6-6.js";
const plot = Plot.rectY(
{length: 10000}, Plot.binX({y: "count"}, {x: Math.random})
).plot();
const div = document.querySelector("#myplot");
div.append(plot);
</script>
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd download-esm
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file download-esm-0.1a0.tar.gz
.
File metadata
- Download URL: download-esm-0.1a0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccf23288162742b59c37841d2284e6aedb0c85b58993b76dd14143307cfe7601 |
|
MD5 | 3e98c3dcf3fdf06868d210fd34dd41bc |
|
BLAKE2b-256 | d07e5a4c58075871588f5758f6fe0b33f27fe13e56bb79e928742882dd8da2b8 |
File details
Details for the file download_esm-0.1a0-py3-none-any.whl
.
File metadata
- Download URL: download_esm-0.1a0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e1351852496d9352f6041da6119cec45c4d65cd85bad1696bef7221646d4f5a |
|
MD5 | 200bddd19c4e7f41a985181e0208d235 |
|
BLAKE2b-256 | 06c1fba22466c59fe53244c02834c8aba8d758605bd892227be0f51dfa1daf0c |