Skip to content

Commit 125dfa9

Browse files
authored
Merge pull request #74 from springmeyer/chore/esm
chore: publish ESM only
2 parents d33a487 + 8dbb9ce commit 125dfa9

15 files changed

Lines changed: 73 additions & 871 deletions

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest]
16-
node: [16, 18, 20, 22, 24]
16+
node: [18, 20, 22, 24]
1717

1818
steps:
1919
- uses: actions/checkout@v6

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.DS_store
22
node_modules
33
coverage
4-
dist/
5-
arc.js
4+
dist

.npmignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,36 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55

66
## [Unreleased][unreleased]
77

8+
## [1.0.0] - 2026-03-29
9+
10+
### Breaking change
11+
12+
- arc.js is now a [pure](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) ESM package.
13+
14+
If you need to `require()` arc.js as CJS (CommonJS), or have a runtime older than Node.js 18, please use `0.1.4`.
15+
16+
0.x syntax:
17+
```js
18+
const arc = require('arc');
19+
const gc = new arc.GreatCircle(/* */);
20+
```
21+
22+
1.x syntax:
23+
```js
24+
import { GreatCircle } from 'arc';
25+
const gc = new GreatCircle(/* */);
26+
```
27+
28+
### Fixed
29+
30+
- antimeridian splitting in GreatCircle.Arc (From @copilot)
31+
832
## [0.2.0] - 2025-09-22
33+
### Breaking
34+
- Node.js 16 is now the minimum supported runtime
35+
936
### Changed
10-
- TypeScript support with back compatibilty (From @thomas-hervey)
37+
- TypeScript support with backwards compatibility (From @thomas-hervey)
1138

1239
## [0.1.4] - 2022-11-16
1340
### Changed
@@ -39,7 +66,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3966
### Fixed
4067
- Fixed jshint strict errors
4168

42-
[unreleased]: https://github.com/springmeyer/arc.js/compare/v0.1.4..HEAD
69+
[unreleased]: https://github.com/springmeyer/arc.js/compare/v1.0.0..HEAD
70+
[1.0.0]: https://github.com/springmeyer/arc.js/compare/v0.2.0...v1.0.0
71+
[0.2.0]: https://github.com/springmeyer/arc.js/compare/v0.1.4...v0.2.0
4372
[0.1.4]: https://github.com/springmeyer/arc.js/compare/v0.1.3...v0.1.4
4473
[0.1.3]: https://github.com/springmeyer/arc.js/compare/v0.1.2...v0.1.3
4574
[0.1.2]: https://github.com/springmeyer/arc.js/compare/v0.1.1...v0.1.2

README.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Calculate great circle routes as lines in GeoJSON or WKT format.
66

77
**Features:**
88
- Full TypeScript support with type definitions
9-
- Works in Node.js (CommonJS & ES modules) and browsers
9+
- Works in Node.js and browsers
1010
- Generates GeoJSON and WKT output formats
1111
- Handles dateline crossing automatically
1212
- Based on [Ed Williams' Aviation Formulary](https://edwilliams.org/avform.htm#Intermediate) algorithms and the GDAL source code
@@ -19,15 +19,6 @@ npm install arc
1919

2020
## Quick Start
2121

22-
### CommonJS (Node.js)
23-
```js
24-
const arc = require('arc');
25-
const gc = new arc.GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
26-
const line = gc.Arc(100);
27-
console.log(line.json()); // GeoJSON output
28-
```
29-
30-
### ES Modules (Node.js, bundlers)
3122
```js
3223
import { GreatCircle } from 'arc';
3324
const gc = new GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
@@ -45,10 +36,10 @@ const gc = new GreatCircle(start, end);
4536
const line = gc.Arc(100);
4637
```
4738

48-
### Browser (Global)
39+
### Browser (ESM)
4940
```html
50-
<script src="./arc.js"></script>
51-
<script>
41+
<script type="module">
42+
import { GreatCircle } from 'https://cdn.skypack.dev/arc@1';
5243
const gc = new arc.GreatCircle({x: -122, y: 48}, {x: -77, y: 39});
5344
const line = gc.Arc(100);
5445
</script>
@@ -165,7 +156,7 @@ arc.js powers the [`greatCircle`](https://turfjs.org/docs/api/greatCircle) funct
165156

166157
## License
167158

168-
This project is licensed under the BSD license. See [LICENSE.md](LICENSE.md) for details.
159+
This project is licensed under the BSD license. See [LICENSE.md](LICENSE) for details.
169160

170161
### Third-Party Licenses
171162

index.html

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<title>arc.js - Great Circle Routes Demo</title>
77
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" />
88
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
9-
<script src="./arc.js"></script>
109
<style>
1110
* {
1211
box-sizing: border-box;
@@ -340,8 +339,8 @@ <h3>Settings</h3>
340339
</div>
341340

342341
<div class="control-group">
343-
<button class="btn" onclick="clearMap()">Clear All</button>
344-
<button class="btn btn-danger" onclick="resetView()">Reset View</button>
342+
<button id="clear" class="btn">Clear All</button>
343+
<button id="reset" class="btn btn-danger">Reset View</button>
345344
</div>
346345
</div>
347346

@@ -357,8 +356,9 @@ <h4>Generated GeoJSON</h4>
357356
</div>
358357
</div>
359358
</div>
360-
361-
<script>
359+
<script type="module">
360+
import { GreatCircle } from 'https://cdn.skypack.dev/arc@1';
361+
362362
// Initialize map
363363
var map = L.map('map').setView(new L.LatLng(0, 0), 2);
364364
var idx = 1;
@@ -468,7 +468,7 @@ <h4>Generated GeoJSON</h4>
468468
distance: calculateDistance(from, to)
469469
};
470470

471-
var greatCircle = new arc.GreatCircle(from, to, properties);
471+
var greatCircle = new GreatCircle(from, to, properties);
472472
var gc = greatCircle.Arc(npoints, { offset: offset });
473473
var line = new L.geoJson().addTo(map);
474474
var geojson_feature = gc.json();
@@ -591,7 +591,7 @@ <h4>Generated GeoJSON</h4>
591591
};
592592

593593
try {
594-
var greatCircle = new arc.GreatCircle(nyc, london, properties);
594+
var greatCircle = new GreatCircle(nyc, london, properties);
595595
var gc = greatCircle.Arc(npoints, { offset: offset });
596596
var line = new L.geoJson().addTo(map);
597597
var geojson_feature = gc.json();
@@ -629,6 +629,9 @@ <h4>Generated GeoJSON</h4>
629629

630630
// Initialize JSON output
631631
updateJsonOutput();
632+
633+
document.querySelector('#clear').addEventListener('click', clearMap);
634+
document.querySelector('#reset').addEventListener('click', resetView);
632635
</script>
633636
</body>
634637
</html>

index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = {
1+
export default {
22
// Use ts-jest preset for TypeScript support
33
preset: 'ts-jest',
44

0 commit comments

Comments
 (0)