-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: latest multiformats, introduce full type check & generation
- Loading branch information
Showing
17 changed files
with
411 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,70 @@ | ||
{ | ||
"name": "@ipld/dag-pb", | ||
"version": "0.0.0", | ||
"version": "0.0.0-dev", | ||
"description": "JS implementation of DAG-PB", | ||
"main": "./src/index.js", | ||
"types": "./types/src/index.d.ts", | ||
"type": "module", | ||
"exports": { | ||
"import": "./index.js" | ||
}, | ||
"scripts": { | ||
"lint": "standard", | ||
"build": "npm_config_yes=true npx ipjs@latest build --tests", | ||
"publish": "npm_config_yes=true npx ipjs@latest publish", | ||
"test:cjs": "npm run build && mocha dist/cjs/node-test/test-*.js", | ||
"build": "npm run build:js && npm run build:types", | ||
"build:js": "npm_config_yes=true ipjs build --tests --main && npm run build:copy", | ||
"build:copy": "cp -a tsconfig.json src *.js dist/ && mkdir -p dist/test && cp test/*.js dist/test/", | ||
"build:types": "npm run build:copy && cd dist && tsc --build", | ||
"check": "tsc --noEmit", | ||
"publish": "npm_config_yes=true ipjs publish", | ||
"test:cjs": "npm run build:js && mocha dist/cjs/node-test/test-*.js && npm run test:cjs:browser", | ||
"test:node": "hundreds mocha test/test-*.js", | ||
"test:browser": "polendina --cleanup dist/cjs/node-test/test-*.js", | ||
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:browser", | ||
"test:cjs:browser": "polendina --page --worker --serviceworker --cleanup dist/cjs/node-test/test-*.js", | ||
"test:ts": "npm run build:types && npm run test --prefix test/ts-use", | ||
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:ts", | ||
"coverage": "c8 --reporter=html mocha test/test-*.js && npx st -d coverage -p 8080" | ||
}, | ||
"exports": { | ||
"import": "./src/index.js" | ||
}, | ||
"license": "(Apache-2.0 AND MIT)", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ipld/js-dag-pb.git" | ||
}, | ||
"keywords": [ | ||
"IPFS", | ||
"IPLD" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/ipld/js-dag-pb/issues" | ||
}, | ||
"homepage": "https://github.com/ipld/js-dag-pb", | ||
"dependencies": { | ||
"multiformats": "^4.0.0" | ||
"multiformats": "https://gitpkg.now.sh/multiformats/js-multiformats/dist?rvagg/moar-generic-blockcodec" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.3.1", | ||
"@types/chai": "^4.2.16", | ||
"@types/mocha": "^8.2.2", | ||
"chai": "^4.2.0", | ||
"chai-subset": "^1.6.0", | ||
"hundreds": "0.0.8", | ||
"mocha": "^8.1.3", | ||
"polendina": "^1.1.0", | ||
"standard": "^14.3.4" | ||
"standard": "^16.0.3", | ||
"typescript": "^4.2.3" | ||
}, | ||
"author": "Rod Vagg <r@va.gg>", | ||
"keywords": [ | ||
"IPFS", | ||
"IPLD" | ||
] | ||
"standard": { | ||
"ignore": [ | ||
"dist", | ||
"test/ts-use/src/main.js" | ||
] | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"types/*" | ||
], | ||
"types/*": [ | ||
"types/*" | ||
] | ||
} | ||
}, | ||
"author": "Rod Vagg <r@va.gg>" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { CID } from 'multiformats/cid' | ||
|
||
/* | ||
PBNode and PBLink match the DAG-PB logical format, as described at: | ||
https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-pb.md#logical-format | ||
*/ | ||
|
||
export interface PBLink { | ||
Name?: string, | ||
Tsize?: number, | ||
Hash: CID | ||
} | ||
|
||
export interface PBNode { | ||
Data?: Uint8Array, | ||
Links: PBLink[] | ||
} | ||
|
||
// Raw versions of PBNode and PBLink used internally to deal with the underlying | ||
// encode/decode byte interface. | ||
// A future iteration could make pb-encode.js and pb-decode.js aware of PBNode | ||
// and PBLink specifics (including CID and optionals). | ||
|
||
export interface RawPBLink { | ||
Name: string, | ||
Tsize: number, | ||
Hash: Uint8Array | ||
} | ||
|
||
export interface RawPBNode { | ||
Data: Uint8Array, | ||
Links: RawPBLink[] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.