plevinjs 0.1.2 β†’ 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -55,12 +55,14 @@ Cloudflare Workers, and any browser off a CDN.
55
55
  <script type="module">
56
56
  import { open } from "https://cdn.jsdelivr.net/npm/plevinjs";
57
57
 
58
- const db = await open("https://plevin.tn3w.dev/db/plevin.plv");
59
- document.title = db.lookup("8.8.8.8").place.country.flag;
58
+ const db = await open("https://plevin.tn3w.dev/db/plevin.place-country-code.plv");
59
+ const { flag, name } = db.lookup("8.8.8.8").place.country;
60
+ document.body.textContent = `${flag} ${name}`; // 'πŸ‡ΊπŸ‡Έ United States'
60
61
  </script>
61
62
  ```
62
63
 
63
- `https://esm.sh/plevinjs` serves the same thing. Every database is rehosted with open
64
+ That build is 423 KB, the country code and nothing else, and the name and flag are
65
+ derived in the reader. `https://esm.sh/plevinjs` serves the same thing. Every database is rehosted with open
64
66
  CORS at [plevin.tn3w.dev/db](https://plevin.tn3w.dev/db/), because GitHub release
65
67
  downloads send no CORS header.
66
68
 
@@ -197,11 +199,18 @@ CDN serves it as it is.
197
199
  <script type="module">
198
200
  import { open } from "https://cdn.jsdelivr.net/npm/plevinjs";
199
201
 
200
- const db = await open("https://plevin.tn3w.dev/db/plevin.plv");
201
- document.title = db.lookup("1.1.1.1").place.country.flag;
202
+ const db = await open(
203
+ "https://plevin.tn3w.dev/db/plevin.place-country-code.plv"
204
+ );
205
+ const { flag, name } = db.lookup("1.1.1.1").place.country;
206
+ document.body.textContent = `${flag} ${name}`; // 'πŸ‡ΊπŸ‡Έ United States'
202
207
  </script>
203
208
  ```
204
209
 
210
+ Open the smallest build a page actually needs: `plevin.place-country-code.plv` is
211
+ 423 KB against the 16.9 MB of `plevin.plv`, so the first lookup lands in a moment
212
+ rather than a download.
213
+
205
214
  | | |
206
215
  | --- | --- |
207
216
  | `https://cdn.jsdelivr.net/npm/plevinjs` | `dist/plevin.min.js`, the whole reader in one file |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plevinjs",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Location, network and abuse information for any IP address in one offline file.",
5
5
  "keywords": [
6
6
  "ip",
@@ -27,7 +27,7 @@
27
27
  ],
28
28
  "license": "Apache-2.0",
29
29
  "author": "tn3w",
30
- "homepage": "https://github.com/tn3w/plevin#readme",
30
+ "homepage": "https://plevin.tn3w.dev",
31
31
  "repository": {
32
32
  "type": "git",
33
33
  "url": "git+https://github.com/tn3w/plevin.git",