@zwishing/emap 0.1.2 → 0.2.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/CHANGELOG.md +52 -1
- package/README.md +5 -0
- package/dist/emap.js +1 -1
- package/dist/emap.mjs +1 -1
- package/dist/mapshaper-vendor.js +1 -1
- package/dist/mapshaper-vendor.mjs +1 -1
- package/dist/source/topology-source.d.ts +28 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,54 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.0] - 2026-05-17
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** `TopologySource.setData()` now returns
|
|
15
|
+
`Promise<TopologySource>` instead of `this`. It resolves once the import
|
|
16
|
+
completes and rejects if it fails, so `await source.setData(...)` is now the
|
|
17
|
+
canonical way to wait for the dataset (previously `await` resolved on the
|
|
18
|
+
next microtask, before the data existed — a silent footgun that left the
|
|
19
|
+
map blank). The `data` / `error` events still fire unchanged for
|
|
20
|
+
event-driven consumers, and last-write-wins semantics are preserved (a
|
|
21
|
+
superseded call's promise resolves early so awaiting it never hangs).
|
|
22
|
+
Fluent chaining off the return value (`source.setData(x).getLayers()`) no
|
|
23
|
+
longer works — `await` first. `fromUrl` / `fromBytes` now delegate to the
|
|
24
|
+
awaitable `setData` internally.
|
|
25
|
+
- `TopologySource.getLayers()` is now typed `MapshaperLayer[]` instead of
|
|
26
|
+
`any[]`, so `name` / `geometry_type` are reachable without an `any` cast at
|
|
27
|
+
every consumer. Runtime behavior is unchanged (additive type only).
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- Corrected `test/examples/*.html` (`box-select`, `draw-snap-edge`,
|
|
32
|
+
`lasso-select`, `polygon-fill`) that passed the camelCase `sourceLayer` key
|
|
33
|
+
to `addLayer` specs. The `LayerSpecification` only reads the canonical
|
|
34
|
+
MapLibre-style `'source-layer'`, so the camelCase key was silently ignored
|
|
35
|
+
and resolution fell back to the first layer — a real bug in `polygon-fill`,
|
|
36
|
+
which targets a specific layer. Examples now use `'source-layer'`.
|
|
37
|
+
- `npm run dev-build` was broken: the `prefer-browser-mapshaper-modules`
|
|
38
|
+
Rollup plugin only matched the terser-minified ternary form of mapshaper's
|
|
39
|
+
module loader, so it patched the production vendor but threw `Unable to
|
|
40
|
+
patch mapshaper module loader` on the unminified dev vendor (terser does
|
|
41
|
+
not run in dev). `dist/emap-dev.js` — referenced by every
|
|
42
|
+
`test/examples/*.html` — could not be built at all. Added a second pattern
|
|
43
|
+
matching the unminified `if / else-if / else` loader block and reordering
|
|
44
|
+
it to prefer `window.modules` over `require` (same intent as the minified
|
|
45
|
+
path). Dev and prod builds now both patch the vendor correctly.
|
|
46
|
+
|
|
47
|
+
## [0.1.3] - 2026-05-17
|
|
48
|
+
|
|
49
|
+
### Fixed
|
|
50
|
+
|
|
51
|
+
- Made the browser mapshaper vendor loader prefer `window.modules` before any
|
|
52
|
+
bundler-injected `require` shim. This closes the remaining Vite dev
|
|
53
|
+
dep-optimizer failure where esbuild could make `require` truthy and trigger
|
|
54
|
+
`Dynamic require of "iconv-lite" is not supported` on file upload.
|
|
55
|
+
- Added an esbuild pre-bundle smoke test for the shipped ESM entry so this
|
|
56
|
+
Vite dev failure mode is covered in CI.
|
|
57
|
+
|
|
10
58
|
## [0.1.2] - 2026-05-16
|
|
11
59
|
|
|
12
60
|
### Fixed
|
|
@@ -64,6 +112,9 @@ Initial public release.
|
|
|
64
112
|
- Distributed control stylesheet as `dist/emap.css` (importable via
|
|
65
113
|
`@zwishing/emap/style.css`).
|
|
66
114
|
|
|
67
|
-
[Unreleased]: https://github.com/zwishing/emap/compare/v0.
|
|
115
|
+
[Unreleased]: https://github.com/zwishing/emap/compare/v0.2.0...HEAD
|
|
116
|
+
[0.2.0]: https://github.com/zwishing/emap/compare/v0.1.3...v0.2.0
|
|
117
|
+
[0.1.3]: https://github.com/zwishing/emap/compare/v0.1.2...v0.1.3
|
|
118
|
+
[0.1.2]: https://github.com/zwishing/emap/compare/v0.1.1...v0.1.2
|
|
68
119
|
[0.1.1]: https://github.com/zwishing/emap/compare/v0.1.0...v0.1.1
|
|
69
120
|
[0.1.0]: https://github.com/zwishing/emap/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -117,6 +117,11 @@ const source = await TopologySource.fromUrl('id', url); // GeoJSON / TopoJSO
|
|
|
117
117
|
const source2 = await TopologySource.fromBytes('id', buf, {
|
|
118
118
|
filename: 'local.geojson',
|
|
119
119
|
}); // ArrayBuffer / Uint8Array
|
|
120
|
+
|
|
121
|
+
// Re-importing an existing source: setData is awaitable — it resolves
|
|
122
|
+
// once the dataset is ready, so getLayers()/getExtent() are safe after it.
|
|
123
|
+
// The `data` / `error` events still fire for event-driven consumers.
|
|
124
|
+
await source.setData({ filename: 'next.geojson', content: bytes });
|
|
120
125
|
source.getExtent();
|
|
121
126
|
source.getLayers();
|
|
122
127
|
```
|