leaflet-india-boundary 0.1.0
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.
- package/LICENSE +25 -0
- package/LICENSE-DATA +101 -0
- package/README.md +391 -0
- package/data/india-boundary.geojson +1 -0
- package/dist/cjs/attribution.js +24 -0
- package/dist/cjs/attribution.js.map +1 -0
- package/dist/cjs/data.js +78 -0
- package/dist/cjs/data.js.map +1 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/leaflet.js +152 -0
- package/dist/cjs/leaflet.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/react.js +77 -0
- package/dist/cjs/react.js.map +1 -0
- package/dist/cjs/style.js +129 -0
- package/dist/cjs/style.js.map +1 -0
- package/dist/cjs/suppress.js +462 -0
- package/dist/cjs/suppress.js.map +1 -0
- package/dist/cjs/suppressionData.js +205 -0
- package/dist/cjs/suppressionData.js.map +1 -0
- package/dist/esm/attribution.d.ts +21 -0
- package/dist/esm/attribution.d.ts.map +1 -0
- package/dist/esm/attribution.js +21 -0
- package/dist/esm/attribution.js.map +1 -0
- package/dist/esm/data.d.ts +78 -0
- package/dist/esm/data.d.ts.map +1 -0
- package/dist/esm/data.js +75 -0
- package/dist/esm/data.js.map +1 -0
- package/dist/esm/index.d.ts +19 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +19 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/leaflet.d.ts +103 -0
- package/dist/esm/leaflet.d.ts.map +1 -0
- package/dist/esm/leaflet.js +147 -0
- package/dist/esm/leaflet.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/react.d.ts +31 -0
- package/dist/esm/react.d.ts.map +1 -0
- package/dist/esm/react.js +69 -0
- package/dist/esm/react.js.map +1 -0
- package/dist/esm/style.d.ts +106 -0
- package/dist/esm/style.d.ts.map +1 -0
- package/dist/esm/style.js +121 -0
- package/dist/esm/style.js.map +1 -0
- package/dist/esm/suppress.d.ts +64 -0
- package/dist/esm/suppress.d.ts.map +1 -0
- package/dist/esm/suppress.js +456 -0
- package/dist/esm/suppress.js.map +1 -0
- package/dist/esm/suppressionData.d.ts +34 -0
- package/dist/esm/suppressionData.d.ts.map +1 -0
- package/dist/esm/suppressionData.js +202 -0
- package/dist/esm/suppressionData.js.map +1 -0
- package/dist/style.css +66 -0
- package/package.json +113 -0
- package/src/attribution.ts +23 -0
- package/src/data.ts +153 -0
- package/src/index.ts +45 -0
- package/src/leaflet.ts +252 -0
- package/src/react.ts +92 -0
- package/src/style.css +66 -0
- package/src/style.ts +168 -0
- package/src/suppress.ts +599 -0
- package/src/suppressionData.ts +238 -0
- package/tools/build-india-boundary.mjs +836 -0
- package/tools/postbuild.mjs +61 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Finishes the dual ESM/CJS build:
|
|
4
|
+
*
|
|
5
|
+
* 1. Marks dist/cjs as CommonJS. The root package.json says `"type": "module"`,
|
|
6
|
+
* which every nested file inherits, so without this Node reads the CJS output
|
|
7
|
+
* as ESM and throws on the first `require`.
|
|
8
|
+
* 2. Copies the optional stylesheet to dist/style.css (tsc does not touch CSS).
|
|
9
|
+
* 3. Emits data/india-boundary.geojson — a plain GeoJSON file for people not
|
|
10
|
+
* using the JS API at all: QGIS, Python, a fetch() at runtime, another
|
|
11
|
+
* language entirely. It carries the licence and provenance as foreign
|
|
12
|
+
* members so the file stays self-describing once separated from this repo.
|
|
13
|
+
*/
|
|
14
|
+
import { copyFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { dirname, join } from "node:path";
|
|
16
|
+
import { fileURLToPath } from "node:url";
|
|
17
|
+
|
|
18
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
19
|
+
|
|
20
|
+
writeFileSync(
|
|
21
|
+
join(root, "dist/cjs/package.json"),
|
|
22
|
+
`${JSON.stringify({ type: "commonjs" }, null, 2)}\n`,
|
|
23
|
+
);
|
|
24
|
+
writeFileSync(
|
|
25
|
+
join(root, "dist/esm/package.json"),
|
|
26
|
+
`${JSON.stringify({ type: "module" }, null, 2)}\n`,
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
copyFileSync(join(root, "src/style.css"), join(root, "dist/style.css"));
|
|
30
|
+
|
|
31
|
+
const { INDIA_BOUNDARY, INDIA_BOUNDARY_COUNTS, INDIA_BOUNDARY_ATTRIBUTION_TEXT } =
|
|
32
|
+
await import(new URL("../dist/esm/index.js", import.meta.url));
|
|
33
|
+
|
|
34
|
+
// RFC 7946 §6.1 allows members it does not define, and readers must ignore them.
|
|
35
|
+
// So this travels as valid GeoJSON that QGIS will open, while still telling anyone
|
|
36
|
+
// who opens it in a text editor where it came from and what it is licensed under.
|
|
37
|
+
const fc = {
|
|
38
|
+
type: "FeatureCollection",
|
|
39
|
+
name: "india-boundary",
|
|
40
|
+
description:
|
|
41
|
+
"India's boundary through Jammu & Kashmir, Ladakh and Aksai Chin, as depicted by the Survey of India. Each feature's properties.source records whether OpenStreetMap independently corroborates it ('osm') or not ('hand').",
|
|
42
|
+
license: "ODbL-1.0",
|
|
43
|
+
attribution: INDIA_BOUNDARY_ATTRIBUTION_TEXT,
|
|
44
|
+
source_counts: INDIA_BOUNDARY_COUNTS,
|
|
45
|
+
homepage: "https://github.com/lux-in-tenebris-lucet/leaflet-india-boundary",
|
|
46
|
+
features: INDIA_BOUNDARY.features,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
mkdirSync(join(root, "data"), { recursive: true });
|
|
50
|
+
writeFileSync(join(root, "data/india-boundary.geojson"), `${JSON.stringify(fc)}\n`);
|
|
51
|
+
|
|
52
|
+
const points = INDIA_BOUNDARY.features.reduce(
|
|
53
|
+
(n, f) => n + f.geometry.coordinates.length,
|
|
54
|
+
0,
|
|
55
|
+
);
|
|
56
|
+
console.log(
|
|
57
|
+
`postbuild: dist/cjs + dist/esm marked, style.css copied, ` +
|
|
58
|
+
`data/india-boundary.geojson written ` +
|
|
59
|
+
`(${INDIA_BOUNDARY.features.length} features, ${points} points, ` +
|
|
60
|
+
`${INDIA_BOUNDARY_COUNTS.osm} osm / ${INDIA_BOUNDARY_COUNTS.hand} hand)`,
|
|
61
|
+
);
|