Skip to content

Commit 9fe97e3

Browse files
authored
fix: update import paths to include extension (#82)
The import path must include the extension when publishing ESM as otherwise the module loader doesn't know how to find the file. Fixes errors like: ``` Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path. ```` This is a weakness of JSDoc types and would be caught by converting to TypeScript. Refs: multiformats/js-multiformats#249
1 parent e2de671 commit 9fe97e3

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { prepare, validate, createNode, createLink } from './util.js'
99
*/
1010

1111
/**
12-
* @typedef {import('./interface').PBLink} PBLink
13-
* @typedef {import('./interface').PBNode} PBNode
12+
* @typedef {import('./interface.js').PBLink} PBLink
13+
* @typedef {import('./interface.js').PBNode} PBNode
1414
*/
1515

1616
export const name = 'dag-pb'

src/pb-decode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const textDecoder = new TextDecoder()
22

33
/**
4-
* @typedef {import('./interface').RawPBLink} RawPBLink
4+
* @typedef {import('./interface.js').RawPBLink} RawPBLink
55
*/
66

77
/**
8-
* @typedef {import('./interface').RawPBNode} RawPBNode
8+
* @typedef {import('./interface.js').RawPBNode} RawPBNode
99
*/
1010

1111
/**

src/pb-encode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ const maxInt32 = 2 ** 32
33
const maxUInt32 = 2 ** 31
44

55
/**
6-
* @typedef {import('./interface').RawPBLink} RawPBLink
6+
* @typedef {import('./interface.js').RawPBLink} RawPBLink
77
*/
88

99
/**
10-
* @typedef {import('./interface').RawPBNode} RawPBNode
10+
* @typedef {import('./interface.js').RawPBNode} RawPBNode
1111
*/
1212

1313
// the encoders work backward from the end of the bytes array

src/util.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { CID } from 'multiformats/cid'
22

33
/**
4-
* @typedef {import('./interface').PBLink} PBLink
5-
* @typedef {import('./interface').PBNode} PBNode
4+
* @typedef {import('./interface.js').PBLink} PBLink
5+
* @typedef {import('./interface.js').PBNode} PBNode
66
*/
77

88
const pbNodeProperties = ['Data', 'Links']

0 commit comments

Comments
 (0)