Skip to content

Commit 0c580d1

Browse files
committed
ESM
1 parent d443504 commit 0c580d1

File tree

5 files changed

+543
-531
lines changed

5 files changed

+543
-531
lines changed

CHANGELOG.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
## [2.0.5](https://github.com/GMOD/tabix-js/compare/v2.0.4...v2.0.5) (2025-03-18)
22

3-
4-
53
## [2.0.4](https://github.com/GMOD/tabix-js/compare/v2.0.3...v2.0.4) (2024-12-18)
64

7-
8-
95
## [2.0.3](https://github.com/GMOD/tabix-js/compare/v2.0.2...v2.0.3) (2024-12-18)
106

11-
12-
137
## [2.0.2](https://github.com/GMOD/tabix-js/compare/v2.0.0...v2.0.2) (2024-12-12)
148

15-
16-
179
# [2.0.0](https://github.com/GMOD/tabix-js/compare/v1.6.1...v2.0.0) (2024-12-12)
1810

19-
20-
2111
## [1.6.1](https://github.com/GMOD/tabix-js/compare/v1.6.0...v1.6.1) (2024-12-07)
2212

2313
# [1.6.0](https://github.com/GMOD/tabix-js/compare/v1.5.15...v1.6.0) (2024-11-30)

package.json

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
"name": "@gmod/tabix",
33
"version": "2.0.5",
44
"description": "Read Tabix-indexed files, supports both .tbi and .csi indexes",
5+
"type": "module",
6+
"types": "./dist/index.d.ts",
7+
"exports": {
8+
"import": {
9+
"import": "./esm/index.js"
10+
},
11+
"require": {
12+
"require": "./dist/index.js"
13+
}
14+
},
515
"license": "MIT",
616
"repository": "GMOD/tabix-js",
717
"main": "dist/index.js",
@@ -26,8 +36,8 @@
2636
"docs": "documentation readme --shallow src/tabixIndexedFile.ts --section TabixIndexedFile",
2737
"clean": "rimraf dist esm",
2838
"prebuild": "npm run clean && npm run lint",
29-
"build:esm": "tsc --outDir esm",
30-
"build:es5": "tsc --module commonjs --outDir dist",
39+
"build:esm": "tsc --target es2020 --outDir esm",
40+
"build:es5": "tsc --target es2020 --module commonjs --outDir dist",
3141
"build": "npm run build:esm && npm run build:es5",
3242
"postbuild": "webpack",
3343
"preversion": "npm run lint && npm test run && npm run build",
@@ -50,12 +60,10 @@
5060
"@eslint/eslintrc": "^3.1.0",
5161
"@eslint/js": "^9.9.0",
5262
"@types/node": "^20.11.16",
53-
"@typescript-eslint/eslint-plugin": "^8.0.1",
54-
"@typescript-eslint/parser": "^8.0.1",
5563
"@vitest/coverage-v8": "^3.0.1",
5664
"documentation": "^14.0.3",
5765
"eslint": "^9.9.0",
58-
"eslint-plugin-unicorn": "^57.0.0",
66+
"eslint-plugin-unicorn": "^58.0.0",
5967
"prettier": "^3.3.3",
6068
"rimraf": "^6.0.1",
6169
"standard-changelog": "^6.0.0",

tsconfig.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
"outDir": "dist",
88
"strict": true,
99
"sourceMap": true,
10+
"allowImportingTsExtensions": true,
11+
"rewriteRelativeImportExtensions": true,
1012
"esModuleInterop": true
1113
},
1214
"include": ["src"]

webpack.config.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
const path = require('path')
1+
import path from 'path'
2+
import { fileURLToPath } from 'url'
23

3-
module.exports = {
4+
// Get the directory name equivalent to __dirname in ESM
5+
const __filename = fileURLToPath(import.meta.url)
6+
const __dirname = path.dirname(__filename)
7+
8+
export default {
49
mode: 'production',
510
entry: './dist/index.js',
611
output: {

0 commit comments

Comments
 (0)