Skip to content

Commit

Permalink
fix: update import paths to include extension (#82)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
achingbrain authored May 11, 2023
1 parent e2de671 commit 9fe97e3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { prepare, validate, createNode, createLink } from './util.js'
*/

/**
* @typedef {import('./interface').PBLink} PBLink
* @typedef {import('./interface').PBNode} PBNode
* @typedef {import('./interface.js').PBLink} PBLink
* @typedef {import('./interface.js').PBNode} PBNode
*/

export const name = 'dag-pb'
Expand Down
4 changes: 2 additions & 2 deletions src/pb-decode.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const textDecoder = new TextDecoder()

/**
* @typedef {import('./interface').RawPBLink} RawPBLink
* @typedef {import('./interface.js').RawPBLink} RawPBLink
*/

/**
* @typedef {import('./interface').RawPBNode} RawPBNode
* @typedef {import('./interface.js').RawPBNode} RawPBNode
*/

/**
Expand Down
4 changes: 2 additions & 2 deletions src/pb-encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ const maxInt32 = 2 ** 32
const maxUInt32 = 2 ** 31

/**
* @typedef {import('./interface').RawPBLink} RawPBLink
* @typedef {import('./interface.js').RawPBLink} RawPBLink
*/

/**
* @typedef {import('./interface').RawPBNode} RawPBNode
* @typedef {import('./interface.js').RawPBNode} RawPBNode
*/

// the encoders work backward from the end of the bytes array
Expand Down
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CID } from 'multiformats/cid'

/**
* @typedef {import('./interface').PBLink} PBLink
* @typedef {import('./interface').PBNode} PBNode
* @typedef {import('./interface.js').PBLink} PBLink
* @typedef {import('./interface.js').PBNode} PBNode
*/

const pbNodeProperties = ['Data', 'Links']
Expand Down

0 comments on commit 9fe97e3

Please sign in to comment.