From ac71cdece2dc505de9e99b25b214e92c33b968e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 May 2025 10:54:16 +0000 Subject: [PATCH 1/4] deps(dev): bump aegir from 45.2.1 to 47.0.16 Bumps [aegir](https://github.com/ipfs/aegir) from 45.2.1 to 47.0.16. - [Release notes](https://github.com/ipfs/aegir/releases) - [Changelog](https://github.com/ipfs/aegir/blob/main/CHANGELOG.md) - [Commits](https://github.com/ipfs/aegir/compare/v45.2.1...v47.0.16) --- updated-dependencies: - dependency-name: aegir dependency-version: 47.0.16 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- packages/ipfs-unixfs-exporter/package.json | 2 +- packages/ipfs-unixfs-importer/package.json | 2 +- packages/ipfs-unixfs/package.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3ca9b93a..a7806f54 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "docs:no-publish": "aegir docs --publish false" }, "devDependencies": { - "aegir": "^45.0.8", + "aegir": "^47.0.16", "npm-run-all": "^4.1.5" }, "workspaces": [ diff --git a/packages/ipfs-unixfs-exporter/package.json b/packages/ipfs-unixfs-exporter/package.json index b81626c1..d9578afb 100644 --- a/packages/ipfs-unixfs-exporter/package.json +++ b/packages/ipfs-unixfs-exporter/package.json @@ -156,7 +156,7 @@ "devDependencies": { "@types/readable-stream": "^4.0.15", "@types/sinon": "^17.0.3", - "aegir": "^45.0.8", + "aegir": "^47.0.16", "blockstore-core": "^5.0.0", "delay": "^6.0.0", "ipfs-unixfs-importer": "^15.0.0", diff --git a/packages/ipfs-unixfs-importer/package.json b/packages/ipfs-unixfs-importer/package.json index 63abf473..309fd49c 100644 --- a/packages/ipfs-unixfs-importer/package.json +++ b/packages/ipfs-unixfs-importer/package.json @@ -177,7 +177,7 @@ "uint8arrays": "^5.1.0" }, "devDependencies": { - "aegir": "^45.0.8", + "aegir": "^47.0.16", "blockstore-core": "^5.0.0", "it-last": "^3.0.6", "wherearewe": "^2.0.1" diff --git a/packages/ipfs-unixfs/package.json b/packages/ipfs-unixfs/package.json index f445a04c..109d64d7 100644 --- a/packages/ipfs-unixfs/package.json +++ b/packages/ipfs-unixfs/package.json @@ -144,7 +144,7 @@ "uint8arraylist": "^2.4.8" }, "devDependencies": { - "aegir": "^45.0.8", + "aegir": "^47.0.16", "protons": "^7.6.0", "uint8arrays": "^5.1.0" }, From c2f433e1d8b09b2fd77abe1b144576cec283cb16 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 18 Jun 2025 07:10:20 +0300 Subject: [PATCH 2/4] chore: update project config and fix linting --- .github/dependabot.yml | 23 +- .github/workflows/semantic-pull-request.yml | 2 +- .github/workflows/stale.yml | 2 +- .gitignore | 2 + README.md | 6 +- benchmarks/import/package.json | 39 +--- benchmarks/import/test/index.spec.ts | 5 +- benchmarks/import/tsconfig.json | 5 + benchmarks/memory/package.json | 31 +-- benchmarks/memory/test/index.spec.ts | 10 +- benchmarks/memory/tsconfig.json | 5 + package.json | 1 + .../ipfs-unixfs-exporter/CODE_OF_CONDUCT.md | 3 + packages/ipfs-unixfs-exporter/LICENSE | 4 - packages/ipfs-unixfs-exporter/LICENSE-APACHE | 202 +++++++++++++++++- packages/ipfs-unixfs-exporter/package.json | 55 ++--- .../src/resolvers/unixfs-v1/content/file.ts | 3 +- .../content/hamt-sharded-directory.ts | 3 +- .../src/resolvers/unixfs-v1/index.ts | 3 +- .../src/utils/find-cid-in-shard.ts | 6 +- .../test/exporter-sharded.spec.ts | 3 +- .../test/exporter.spec.ts | 3 +- .../test/import-export-dir-sharding.spec.ts | 3 +- .../test/import-export-nested-dir.spec.ts | 7 +- .../test/import-export.spec.ts | 6 +- .../test/importer.spec.ts | 18 +- packages/ipfs-unixfs-exporter/typedoc.json | 1 + .../ipfs-unixfs-importer/CODE_OF_CONDUCT.md | 3 + packages/ipfs-unixfs-importer/LICENSE | 4 - packages/ipfs-unixfs-importer/LICENSE-APACHE | 202 +++++++++++++++++- packages/ipfs-unixfs-importer/package.json | 37 ++-- .../src/dag-builder/buffer-importer.ts | 3 +- .../src/dag-builder/file.ts | 3 +- .../src/dag-builder/index.ts | 6 +- packages/ipfs-unixfs-importer/src/dir-flat.ts | 13 +- .../ipfs-unixfs-importer/src/dir-sharded.ts | 16 +- packages/ipfs-unixfs-importer/src/dir.ts | 2 +- .../ipfs-unixfs-importer/src/flat-to-shard.ts | 5 +- packages/ipfs-unixfs-importer/src/index.ts | 12 +- .../ipfs-unixfs-importer/src/tree-builder.ts | 2 +- .../test/hash-parity-with-go-ipfs.spec.ts | 6 +- packages/ipfs-unixfs-importer/typedoc.json | 1 + packages/ipfs-unixfs/CODE_OF_CONDUCT.md | 3 + packages/ipfs-unixfs/LICENSE | 4 - packages/ipfs-unixfs/LICENSE-APACHE | 202 +++++++++++++++++- packages/ipfs-unixfs/package.json | 22 +- packages/ipfs-unixfs/src/unixfs.ts | 6 - .../ipfs-unixfs/test/unixfs-format.spec.ts | 3 +- packages/ipfs-unixfs/typedoc.json | 1 + typedoc.json | 10 +- 50 files changed, 816 insertions(+), 201 deletions(-) create mode 100644 packages/ipfs-unixfs-exporter/CODE_OF_CONDUCT.md delete mode 100644 packages/ipfs-unixfs-exporter/LICENSE create mode 100644 packages/ipfs-unixfs-importer/CODE_OF_CONDUCT.md delete mode 100644 packages/ipfs-unixfs-importer/LICENSE create mode 100644 packages/ipfs-unixfs/CODE_OF_CONDUCT.md delete mode 100644 packages/ipfs-unixfs/LICENSE diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d401a774..589a3341 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,11 +1,30 @@ version: 2 updates: - package-ecosystem: npm - directory: "/" + directories: + - "/" schedule: interval: daily time: "10:00" open-pull-requests-limit: 20 commit-message: prefix: "deps" - prefix-development: "deps(dev)" + prefix-development: "chore" + groups: + interplanetary-deps: # Helia/libp2p deps + patterns: + - "*helia*" + - "*libp2p*" + - "*multiformats*" + - "*blockstore*" + - "*datastore*" + kubo-deps: # kubo deps + patterns: + - "*kubo*" + - "ipfsd-ctl" +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + commit-message: + prefix: chore diff --git a/.github/workflows/semantic-pull-request.yml b/.github/workflows/semantic-pull-request.yml index bd00f090..8c0b9eaf 100644 --- a/.github/workflows/semantic-pull-request.yml +++ b/.github/workflows/semantic-pull-request.yml @@ -9,4 +9,4 @@ on: jobs: main: - uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3 + uses: ipdxco/unified-github-workflows/.github/workflows/reusable-semantic-pull-request.yml@v1 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7c955c41..1f9d6b8c 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,4 +1,4 @@ -name: Close Stale Issues +name: Close and mark stale issue on: schedule: diff --git a/.gitignore b/.gitignore index 7ad9e674..f115d26b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ node_modules package-lock.json yarn.lock .vscode +.tmp-compiled-docs +tsconfig-doc-check.aegir.json diff --git a/README.md b/README.md index 17c2080a..9ff2f886 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,16 @@ > JS implementation of the IPFS UnixFS +The UnixFS spec can be found at [ipfs/specs/UNIXFS.md](https://github.com/ipfs/specs/blob/master/UNIXFS.md) + # Packages +- [`benchmarks/import`](https://github.com/ipfs/js-ipfs-unixfs/tree/main/benchmarks/import) Import benchmarks for ipfs-unixfs-importer +- [`benchmarks/memory`](https://github.com/ipfs/js-ipfs-unixfs/tree/main/benchmarks/memory) Memory benchmarks for ipfs-unixfs-importer - [`packages/ipfs-unixfs`](https://github.com/ipfs/js-ipfs-unixfs/tree/main/packages/ipfs-unixfs) JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG) - [`packages/ipfs-unixfs-exporter`](https://github.com/ipfs/js-ipfs-unixfs/tree/main/packages/ipfs-unixfs-exporter) JavaScript implementation of the UnixFs exporter used by IPFS - [`packages/ipfs-unixfs-importer`](https://github.com/ipfs/js-ipfs-unixfs/tree/main/packages/ipfs-unixfs-importer) JavaScript implementation of the UnixFs importer used by IPFS -The UnixFS spec can be found at [ipfs/specs/UNIXFS.md](https://github.com/ipfs/specs/blob/master/UNIXFS.md) - # API Docs - diff --git a/benchmarks/import/package.json b/benchmarks/import/package.json index fa9f06ab..28966afe 100644 --- a/benchmarks/import/package.json +++ b/benchmarks/import/package.json @@ -1,29 +1,9 @@ { - "name": "ipfs-unixfs-memory-benchmark", + "name": "ipfs-unixfs-import-benchmark", "version": "0.0.0", - "description": "Memory benchmarks for ipfs-unixfs-importer", + "description": "Import benchmarks for ipfs-unixfs-importer", "license": "Apache-2.0 OR MIT", - "private": true, "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, "scripts": { "build": "aegir build --bundle false", "clean": "aegir clean", @@ -32,11 +12,12 @@ "start": "npm run build && node --expose-gc ./dist/test/index.spec.js" }, "devDependencies": { - "aegir": "^42.2.2", - "blockstore-core": "^4.0.1", - "blockstore-fs": "^1.0.0", - "ipfs-unixfs-importer": "../../packages/ipfs-unixfs-importer", - "it-buffer-stream": "^3.0.1", - "it-drain": "^3.0.5" - } + "aegir": "^47.0.16", + "blockstore-core": "^5.0.4", + "blockstore-fs": "^2.0.4", + "ipfs-unixfs-importer": "^15.0.0", + "it-buffer-stream": "^3.0.11", + "it-drain": "^3.0.10" + }, + "private": true } diff --git a/benchmarks/import/test/index.spec.ts b/benchmarks/import/test/index.spec.ts index dbd65ced..cb7a2df1 100644 --- a/benchmarks/import/test/index.spec.ts +++ b/benchmarks/import/test/index.spec.ts @@ -1,9 +1,10 @@ /* eslint-env mocha */ -import { importer, ImporterOptions } from 'ipfs-unixfs-importer' -import bufferStream from 'it-buffer-stream' import { MemoryBlockstore } from 'blockstore-core' +import { importer } from 'ipfs-unixfs-importer' +import bufferStream from 'it-buffer-stream' import drain from 'it-drain' +import type { ImporterOptions } from 'ipfs-unixfs-importer' const REPEATS = 10 const FILE_SIZE = Math.pow(2, 20) * 500 // 500MB diff --git a/benchmarks/import/tsconfig.json b/benchmarks/import/tsconfig.json index 13a35996..304093f2 100644 --- a/benchmarks/import/tsconfig.json +++ b/benchmarks/import/tsconfig.json @@ -6,5 +6,10 @@ "include": [ "src", "test" + ], + "references": [ + { + "path": "../../packages/ipfs-unixfs-importer" + } ] } diff --git a/benchmarks/memory/package.json b/benchmarks/memory/package.json index ae510405..70f46164 100644 --- a/benchmarks/memory/package.json +++ b/benchmarks/memory/package.json @@ -3,27 +3,7 @@ "version": "0.0.0", "description": "Memory benchmarks for ipfs-unixfs-importer", "license": "Apache-2.0 OR MIT", - "private": true, "type": "module", - "types": "./dist/src/index.d.ts", - "files": [ - "src", - "dist", - "!dist/test", - "!**/*.tsbuildinfo" - ], - "exports": { - ".": { - "types": "./dist/src/index.d.ts", - "import": "./dist/src/index.js" - } - }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "sourceType": "module" - } - }, "scripts": { "build": "aegir build --bundle false", "clean": "aegir clean", @@ -32,9 +12,10 @@ "start": "npm run build && node --expose-gc ./dist/test/index.spec.js" }, "devDependencies": { - "aegir": "^42.2.2", - "blockstore-fs": "^1.0.0", - "ipfs-unixfs-importer": "../../packages/ipfs-unixfs-importer", - "it-drain": "^3.0.5" - } + "aegir": "^47.0.16", + "blockstore-fs": "^2.0.4", + "ipfs-unixfs-importer": "^15.0.0", + "it-drain": "^3.0.10" + }, + "private": true } diff --git a/benchmarks/memory/test/index.spec.ts b/benchmarks/memory/test/index.spec.ts index 6a02873a..a42603da 100644 --- a/benchmarks/memory/test/index.spec.ts +++ b/benchmarks/memory/test/index.spec.ts @@ -1,11 +1,11 @@ /* eslint-disable no-console */ -import { importer } from 'ipfs-unixfs-importer' -import path from 'node:path' -import os from 'node:os' import fs from 'node:fs' -import drain from 'it-drain' +import os from 'node:os' +import path from 'node:path' import { FsBlockstore } from 'blockstore-fs' +import { importer } from 'ipfs-unixfs-importer' +import drain from 'it-drain' const ONE_MEG = 1024 * 1024 @@ -43,6 +43,6 @@ async function main (): Promise { } main().catch(err => { - console.error(err) // eslint-disable-line no-console + console.error(err) process.exit(1) }) diff --git a/benchmarks/memory/tsconfig.json b/benchmarks/memory/tsconfig.json index 13a35996..304093f2 100644 --- a/benchmarks/memory/tsconfig.json +++ b/benchmarks/memory/tsconfig.json @@ -6,5 +6,10 @@ "include": [ "src", "test" + ], + "references": [ + { + "path": "../../packages/ipfs-unixfs-importer" + } ] } diff --git a/package.json b/package.json index a7806f54..13c17a6f 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "npm-run-all": "^4.1.5" }, "workspaces": [ + "benchmarks/*", "packages/*" ] } diff --git a/packages/ipfs-unixfs-exporter/CODE_OF_CONDUCT.md b/packages/ipfs-unixfs-exporter/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b0fa54c --- /dev/null +++ b/packages/ipfs-unixfs-exporter/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Contributor Code of Conduct + +This project follows the [`IPFS Community Code of Conduct`](https://github.com/ipfs/community/blob/master/code-of-conduct.md) diff --git a/packages/ipfs-unixfs-exporter/LICENSE b/packages/ipfs-unixfs-exporter/LICENSE deleted file mode 100644 index 20ce483c..00000000 --- a/packages/ipfs-unixfs-exporter/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-unixfs-exporter/LICENSE-APACHE b/packages/ipfs-unixfs-exporter/LICENSE-APACHE index 14478a3b..b09cd785 100644 --- a/packages/ipfs-unixfs-exporter/LICENSE-APACHE +++ b/packages/ipfs-unixfs-exporter/LICENSE-APACHE @@ -1,5 +1,201 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -http://www.apache.org/licenses/LICENSE-2.0 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/ipfs-unixfs-exporter/package.json b/packages/ipfs-unixfs-exporter/package.json index 9b9dbb15..6213adf2 100644 --- a/packages/ipfs-unixfs-exporter/package.json +++ b/packages/ipfs-unixfs-exporter/package.json @@ -32,13 +32,6 @@ "import": "./dist/src/index.js" } }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "project": true, - "sourceType": "module" - } - }, "release": { "branches": [ "main" @@ -121,7 +114,15 @@ "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/github", - "@semantic-release/git" + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "package.json" + ] + } + ] ] }, "scripts": { @@ -136,38 +137,38 @@ "release": "aegir release" }, "dependencies": { - "@ipld/dag-cbor": "^9.2.1", - "@ipld/dag-json": "^10.2.2", - "@ipld/dag-pb": "^4.1.2", + "@ipld/dag-cbor": "^9.2.4", + "@ipld/dag-json": "^10.2.5", + "@ipld/dag-pb": "^4.1.5", "@multiformats/murmur3": "^2.1.8", "hamt-sharding": "^3.0.6", - "interface-blockstore": "^5.3.0", + "interface-blockstore": "^5.3.2", "ipfs-unixfs": "^11.0.0", - "it-filter": "^3.1.1", - "it-last": "^3.0.6", - "it-map": "^3.1.1", - "it-parallel": "^3.0.8", + "it-filter": "^3.1.4", + "it-last": "^3.0.9", + "it-map": "^3.1.4", + "it-parallel": "^3.0.13", "it-pipe": "^3.0.1", "it-pushable": "^3.2.3", - "multiformats": "^13.2.3", - "p-queue": "^8.0.1", + "multiformats": "^13.3.7", + "p-queue": "^8.1.0", "progress-events": "^1.0.1" }, "devDependencies": { - "@types/readable-stream": "^4.0.15", - "@types/sinon": "^17.0.3", + "@types/readable-stream": "^4.0.21", + "@types/sinon": "^17.0.4", "aegir": "^47.0.16", - "blockstore-core": "^5.0.0", + "blockstore-core": "^5.0.4", "delay": "^6.0.0", "ipfs-unixfs-importer": "^15.0.0", "iso-random-stream": "^2.0.2", - "it-all": "^3.0.6", - "it-buffer-stream": "^3.0.8", - "it-drain": "^3.0.7", - "it-first": "^3.0.6", - "it-to-buffer": "^4.0.7", + "it-all": "^3.0.9", + "it-buffer-stream": "^3.0.11", + "it-drain": "^3.0.10", + "it-first": "^3.0.9", + "it-to-buffer": "^4.0.10", "merge-options": "^3.0.4", - "readable-stream": "^4.5.2", + "readable-stream": "^4.7.0", "sinon": "^21.0.0", "uint8arrays": "^5.1.0", "wherearewe": "^2.0.1" diff --git a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts index d88e1a24..3d549048 100644 --- a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts +++ b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/file.ts @@ -3,7 +3,7 @@ import { UnixFS } from 'ipfs-unixfs' import map from 'it-map' import parallel from 'it-parallel' import { pipe } from 'it-pipe' -import { type Pushable, pushable } from 'it-pushable' +import { pushable } from 'it-pushable' import * as raw from 'multiformats/codecs/raw' import PQueue from 'p-queue' import { CustomProgressEvent } from 'progress-events' @@ -11,6 +11,7 @@ import { NotUnixFSError, OverReadError, UnderReadError } from '../../../errors.j import extractDataFromBlock from '../../../utils/extract-data-from-block.js' import validateOffsetAndLength from '../../../utils/validate-offset-and-length.js' import type { ExporterOptions, UnixfsV1FileContent, UnixfsV1Resolver, ReadableStorage, ExportProgress, ExportWalk } from '../../../index.js' +import type { Pushable } from 'it-pushable' async function walkDAG (blockstore: ReadableStorage, node: dagPb.PBNode | Uint8Array, queue: Pushable, streamPosition: bigint, start: bigint, end: bigint, options: ExporterOptions): Promise { // a `raw` node diff --git a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts index 52c2938d..b08255a2 100644 --- a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts +++ b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/content/hamt-sharded-directory.ts @@ -1,4 +1,4 @@ -import { decode, type PBNode } from '@ipld/dag-pb' +import { decode } from '@ipld/dag-pb' import { UnixFS } from 'ipfs-unixfs' import map from 'it-map' import parallel from 'it-parallel' @@ -6,6 +6,7 @@ import { pipe } from 'it-pipe' import { CustomProgressEvent } from 'progress-events' import { NotUnixFSError } from '../../../errors.js' import type { ExporterOptions, Resolve, UnixfsV1DirectoryContent, UnixfsV1Resolver, ReadableStorage, ExportWalk } from '../../../index.js' +import type { PBNode } from '@ipld/dag-pb' const hamtShardedDirectoryContent: UnixfsV1Resolver = (cid, node, unixfs, path, resolve, depth, blockstore) => { function yieldHamtDirectoryContent (options: ExporterOptions = {}): UnixfsV1DirectoryContent { diff --git a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts index 2ed6c6a0..4c5983e4 100644 --- a/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts +++ b/packages/ipfs-unixfs-exporter/src/resolvers/unixfs-v1/index.ts @@ -1,4 +1,4 @@ -import { decode, type PBNode } from '@ipld/dag-pb' +import { decode } from '@ipld/dag-pb' import { UnixFS } from 'ipfs-unixfs' import { NotFoundError, NotUnixFSError } from '../../errors.js' import findShardCid from '../../utils/find-cid-in-shard.js' @@ -6,6 +6,7 @@ import contentDirectory from './content/directory.js' import contentFile from './content/file.js' import contentHamtShardedDirectory from './content/hamt-sharded-directory.js' import type { Resolver, UnixfsV1Resolver } from '../../index.js' +import type { PBNode } from '@ipld/dag-pb' import type { CID } from 'multiformats/cid' const findLinkCid = (node: PBNode, name: string): CID | undefined => { diff --git a/packages/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts b/packages/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts index d3446ddd..d604ff28 100644 --- a/packages/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts +++ b/packages/ipfs-unixfs-exporter/src/utils/find-cid-in-shard.ts @@ -1,9 +1,11 @@ -import { decode, type PBLink, type PBNode } from '@ipld/dag-pb' +import { decode } from '@ipld/dag-pb' import { murmur3128 } from '@multiformats/murmur3' -import { Bucket, type BucketPosition, createHAMT } from 'hamt-sharding' +import { Bucket, createHAMT } from 'hamt-sharding' import { UnixFS } from 'ipfs-unixfs' import { NotUnixFSError } from '../errors.js' import type { ExporterOptions, ShardTraversalContext, ReadableStorage } from '../index.js' +import type { PBLink, PBNode } from '@ipld/dag-pb' +import type { BucketPosition } from 'hamt-sharding' import type { CID } from 'multiformats/cid' // FIXME: this is copy/pasted from ipfs-unixfs-importer/src/options.js diff --git a/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.ts b/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.ts index 00a3f1a8..dd2354c5 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/exporter-sharded.spec.ts @@ -4,7 +4,7 @@ import * as dagPb from '@ipld/dag-pb' import { expect } from 'aegir/chai' import { MemoryBlockstore } from 'blockstore-core' import { UnixFS } from 'ipfs-unixfs' -import { importer, type ImportCandidate } from 'ipfs-unixfs-importer' +import { importer } from 'ipfs-unixfs-importer' import all from 'it-all' import randomBytes from 'it-buffer-stream' import last from 'it-last' @@ -13,6 +13,7 @@ import { sha256 } from 'multiformats/hashes/sha2' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { exporter, walkPath } from '../src/index.js' import asAsyncIterable from './helpers/as-async-iterable.js' +import type { ImportCandidate } from 'ipfs-unixfs-importer' const SHARD_SPLIT_THRESHOLD = 10 diff --git a/packages/ipfs-unixfs-exporter/test/exporter.spec.ts b/packages/ipfs-unixfs-exporter/test/exporter.spec.ts index c1bce7d9..a48fe9bb 100644 --- a/packages/ipfs-unixfs-exporter/test/exporter.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/exporter.spec.ts @@ -9,7 +9,7 @@ import delay from 'delay' import { UnixFS } from 'ipfs-unixfs' import { importer } from 'ipfs-unixfs-importer' import { fixedSize } from 'ipfs-unixfs-importer/chunker' -import { balanced, type FileLayout, flat, trickle } from 'ipfs-unixfs-importer/layout' +import { balanced, flat, trickle } from 'ipfs-unixfs-importer/layout' import all from 'it-all' import randomBytes from 'it-buffer-stream' import drain from 'it-drain' @@ -32,6 +32,7 @@ import asAsyncIterable from './helpers/as-async-iterable.js' import type { PBNode } from '@ipld/dag-pb' import type { Blockstore } from 'interface-blockstore' import type { Chunker } from 'ipfs-unixfs-importer/chunker' +import type { FileLayout } from 'ipfs-unixfs-importer/layout' const ONE_MEG = Math.pow(1024, 2) diff --git a/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.ts b/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.ts index 2f4d5451..7140ea52 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/import-export-dir-sharding.spec.ts @@ -8,8 +8,9 @@ import last from 'it-last' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { exporter, type UnixFSDirectory, type UnixFSEntry } from '../src/index.js' +import { exporter } from '../src/index.js' import asAsyncIterable from './helpers/as-async-iterable.js' +import type { UnixFSDirectory, UnixFSEntry } from '../src/index.js' import type { CID } from 'multiformats/cid' describe('builder: directory sharding', () => { diff --git a/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.ts b/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.ts index e1ef084a..46dd856c 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/import-export-nested-dir.spec.ts @@ -7,8 +7,9 @@ import all from 'it-all' import { concat as uint8ArrayConcat } from 'uint8arrays/concat' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' import { toString as uint8ArrayToString } from 'uint8arrays/to-string' -import { exporter, type UnixFSEntry } from '../src/index.js' +import { exporter } from '../src/index.js' import asAsyncIterable from './helpers/as-async-iterable.js' +import type { UnixFSEntry } from '../src/index.js' import type { CID } from 'multiformats/cid' describe('import and export: directory', () => { @@ -113,7 +114,7 @@ function normalizeNode (node: { path?: string, cid: CID }): { path: string, mult } function byPath (a: { path: string }, b: { path: string }): number { - if (a.path > b.path) return -1 - if (a.path < b.path) return 1 + if (a.path > b.path) { return -1 } + if (a.path < b.path) { return 1 } return 0 } diff --git a/packages/ipfs-unixfs-exporter/test/import-export.spec.ts b/packages/ipfs-unixfs-exporter/test/import-export.spec.ts index de7e6479..82b8c24e 100644 --- a/packages/ipfs-unixfs-exporter/test/import-export.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/import-export.spec.ts @@ -4,10 +4,12 @@ import { expect } from 'aegir/chai' import loadFixture from 'aegir/fixtures' import { MemoryBlockstore } from 'blockstore-core' -import { importer, type ImporterOptions } from 'ipfs-unixfs-importer' -import { flat, balanced, trickle, type FileLayout } from 'ipfs-unixfs-importer/layout' +import { importer } from 'ipfs-unixfs-importer' +import { flat, balanced, trickle } from 'ipfs-unixfs-importer/layout' import { exporter } from '../src/index.js' import asAsyncIterable from './helpers/as-async-iterable.js' +import type { ImporterOptions } from 'ipfs-unixfs-importer' +import type { FileLayout } from 'ipfs-unixfs-importer/layout' const bigFile = loadFixture(('test') + '/fixtures/1.2MiB.txt') diff --git a/packages/ipfs-unixfs-exporter/test/importer.spec.ts b/packages/ipfs-unixfs-exporter/test/importer.spec.ts index 8a354159..2684468b 100644 --- a/packages/ipfs-unixfs-exporter/test/importer.spec.ts +++ b/packages/ipfs-unixfs-exporter/test/importer.spec.ts @@ -4,13 +4,14 @@ import { decode } from '@ipld/dag-pb' import { expect } from 'aegir/chai' import loadFixture from 'aegir/fixtures' import { MemoryBlockstore } from 'blockstore-core' -import { type Mtime, UnixFS } from 'ipfs-unixfs' -import { importer, type ImporterOptions } from 'ipfs-unixfs-importer' +import { UnixFS } from 'ipfs-unixfs' +import { importer } from 'ipfs-unixfs-importer' import { fixedSize } from 'ipfs-unixfs-importer/chunker' -import { balanced, type FileLayout, flat, trickle } from 'ipfs-unixfs-importer/layout' +import { balanced, flat, trickle } from 'ipfs-unixfs-importer/layout' import all from 'it-all' import first from 'it-first' import last from 'it-last' +// @ts-expect-error https://github.com/schnittstabil/merge-options/pull/28 import extend from 'merge-options' import { base58btc } from 'multiformats/bases/base58' import { CID } from 'multiformats/cid' @@ -21,6 +22,9 @@ import { exporter, recursive } from '../src/index.js' import asAsyncIterable from './helpers/as-async-iterable.js' import collectLeafCids from './helpers/collect-leaf-cids.js' import type { Blockstore } from 'interface-blockstore' +import type { Mtime } from 'ipfs-unixfs' +import type { ImporterOptions } from 'ipfs-unixfs-importer' +import type { FileLayout } from 'ipfs-unixfs-importer/layout' const bigFile = loadFixture('test/fixtures/1.2MiB.txt') const smallFile = loadFixture('test/fixtures/200Bytes.txt') @@ -1074,7 +1078,7 @@ describe('configuration', () => { content: 'content' }], block, { /** @type {import('ipfs-unixfs-importer').DAGBuilder} */ - dagBuilder: async function * (source, block) { // eslint-disable-line require-await + dagBuilder: async function * (source, block) { yield async function () { return Promise.resolve({ cid, @@ -1085,7 +1089,7 @@ describe('configuration', () => { } }, /** @type {import('ipfs-unixfs-importer').TreeBuilder} */ - treeBuilder: async function * (source, block) { // eslint-disable-line require-await + treeBuilder: async function * (source, block) { builtTree = true yield * source } @@ -1106,7 +1110,7 @@ describe('configuration', () => { path: 'path', content: asAsyncIterable(uint8ArrayFromString('content')) }], block, { - chunkValidator: async function * (source) { // eslint-disable-line require-await + chunkValidator: async function * (source) { validated = true for await (const str of source) { @@ -1117,7 +1121,7 @@ describe('configuration', () => { } } }, - chunker: async function * (source) { // eslint-disable-line require-await + chunker: async function * (source) { chunked = true yield * source } diff --git a/packages/ipfs-unixfs-exporter/typedoc.json b/packages/ipfs-unixfs-exporter/typedoc.json index f599dc72..db0b0747 100644 --- a/packages/ipfs-unixfs-exporter/typedoc.json +++ b/packages/ipfs-unixfs-exporter/typedoc.json @@ -1,4 +1,5 @@ { + "readme": "none", "entryPoints": [ "./src/index.ts" ] diff --git a/packages/ipfs-unixfs-importer/CODE_OF_CONDUCT.md b/packages/ipfs-unixfs-importer/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b0fa54c --- /dev/null +++ b/packages/ipfs-unixfs-importer/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Contributor Code of Conduct + +This project follows the [`IPFS Community Code of Conduct`](https://github.com/ipfs/community/blob/master/code-of-conduct.md) diff --git a/packages/ipfs-unixfs-importer/LICENSE b/packages/ipfs-unixfs-importer/LICENSE deleted file mode 100644 index 20ce483c..00000000 --- a/packages/ipfs-unixfs-importer/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-unixfs-importer/LICENSE-APACHE b/packages/ipfs-unixfs-importer/LICENSE-APACHE index 14478a3b..b09cd785 100644 --- a/packages/ipfs-unixfs-importer/LICENSE-APACHE +++ b/packages/ipfs-unixfs-importer/LICENSE-APACHE @@ -1,5 +1,201 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -http://www.apache.org/licenses/LICENSE-2.0 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/ipfs-unixfs-importer/package.json b/packages/ipfs-unixfs-importer/package.json index 309fd49c..0511a28e 100644 --- a/packages/ipfs-unixfs-importer/package.json +++ b/packages/ipfs-unixfs-importer/package.json @@ -56,13 +56,6 @@ "import": "./dist/src/layout/index.js" } }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "project": true, - "sourceType": "module" - } - }, "release": { "branches": [ "main" @@ -145,7 +138,15 @@ "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/github", - "@semantic-release/git" + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "package.json" + ] + } + ] ] }, "scripts": { @@ -160,17 +161,17 @@ "release": "aegir release" }, "dependencies": { - "@ipld/dag-pb": "^4.1.2", + "@ipld/dag-pb": "^4.1.5", "@multiformats/murmur3": "^2.1.8", "hamt-sharding": "^3.0.6", - "interface-blockstore": "^5.3.0", - "interface-store": "^6.0.0", + "interface-blockstore": "^5.3.2", + "interface-store": "^6.0.3", "ipfs-unixfs": "^11.0.0", - "it-all": "^3.0.6", - "it-batch": "^3.0.6", - "it-first": "^3.0.6", - "it-parallel-batch": "^3.0.6", - "multiformats": "^13.2.3", + "it-all": "^3.0.9", + "it-batch": "^3.0.9", + "it-first": "^3.0.9", + "it-parallel-batch": "^3.0.9", + "multiformats": "^13.3.7", "progress-events": "^1.0.1", "rabin-wasm": "^0.1.5", "uint8arraylist": "^2.4.8", @@ -178,8 +179,8 @@ }, "devDependencies": { "aegir": "^47.0.16", - "blockstore-core": "^5.0.0", - "it-last": "^3.0.6", + "blockstore-core": "^5.0.4", + "it-last": "^3.0.9", "wherearewe": "^2.0.1" }, "browser": { diff --git a/packages/ipfs-unixfs-importer/src/dag-builder/buffer-importer.ts b/packages/ipfs-unixfs-importer/src/dag-builder/buffer-importer.ts index c52b7285..b4f033ae 100644 --- a/packages/ipfs-unixfs-importer/src/dag-builder/buffer-importer.ts +++ b/packages/ipfs-unixfs-importer/src/dag-builder/buffer-importer.ts @@ -2,8 +2,9 @@ import * as dagPb from '@ipld/dag-pb' import { UnixFS } from 'ipfs-unixfs' import * as raw from 'multiformats/codecs/raw' import { CustomProgressEvent } from 'progress-events' -import { persist, type PersistOptions } from '../utils/persist.js' +import { persist } from '../utils/persist.js' import type { BufferImporter } from '../index.js' +import type { PersistOptions } from '../utils/persist.js' import type { CID, Version } from 'multiformats/cid' import type { ProgressOptions, ProgressEvent } from 'progress-events' diff --git a/packages/ipfs-unixfs-importer/src/dag-builder/file.ts b/packages/ipfs-unixfs-importer/src/dag-builder/file.ts index 3c3b19af..41862bce 100644 --- a/packages/ipfs-unixfs-importer/src/dag-builder/file.ts +++ b/packages/ipfs-unixfs-importer/src/dag-builder/file.ts @@ -1,4 +1,4 @@ -import { encode, type PBLink, type PBNode, prepare } from '@ipld/dag-pb' +import { encode, prepare } from '@ipld/dag-pb' import { UnixFS } from 'ipfs-unixfs' import parallelBatch from 'it-parallel-batch' import * as rawCodec from 'multiformats/codecs/raw' @@ -6,6 +6,7 @@ import { CustomProgressEvent } from 'progress-events' import { persist } from '../utils/persist.js' import type { BufferImporter, File, InProgressImportResult, WritableStorage, SingleBlockImportResult, ImporterProgressEvents } from '../index.js' import type { FileLayout, Reducer } from '../layout/index.js' +import type { PBLink, PBNode } from '@ipld/dag-pb' import type { CID, Version } from 'multiformats/cid' import type { ProgressOptions, ProgressEvent } from 'progress-events' diff --git a/packages/ipfs-unixfs-importer/src/dag-builder/index.ts b/packages/ipfs-unixfs-importer/src/dag-builder/index.ts index b9bfe8f6..33a032b7 100644 --- a/packages/ipfs-unixfs-importer/src/dag-builder/index.ts +++ b/packages/ipfs-unixfs-importer/src/dag-builder/index.ts @@ -1,7 +1,9 @@ import { CustomProgressEvent } from 'progress-events' import { InvalidContentError } from '../errors.js' -import { dirBuilder, type DirBuilderOptions } from './dir.js' -import { fileBuilder, type FileBuilderOptions } from './file.js' +import { dirBuilder } from './dir.js' +import { fileBuilder } from './file.js' +import type { DirBuilderOptions } from './dir.js' +import type { FileBuilderOptions } from './file.js' import type { ChunkValidator } from './validate-chunks.js' import type { Chunker } from '../chunker/index.js' import type { Directory, File, FileCandidate, ImportCandidate, ImporterProgressEvents, InProgressImportResult, WritableStorage } from '../index.js' diff --git a/packages/ipfs-unixfs-importer/src/dir-flat.ts b/packages/ipfs-unixfs-importer/src/dir-flat.ts index b649b430..d3548df4 100644 --- a/packages/ipfs-unixfs-importer/src/dir-flat.ts +++ b/packages/ipfs-unixfs-importer/src/dir-flat.ts @@ -1,8 +1,11 @@ -import { encode, type PBNode, prepare } from '@ipld/dag-pb' +import { encode, prepare } from '@ipld/dag-pb' import { UnixFS } from 'ipfs-unixfs' -import { Dir, CID_V0, CID_V1, type DirProps } from './dir.js' -import { persist, type PersistOptions } from './utils/persist.js' +import { Dir, CID_V0, CID_V1 } from './dir.js' +import { persist } from './utils/persist.js' +import type { DirProps } from './dir.js' import type { ImportResult, InProgressImportResult } from './index.js' +import type { PersistOptions } from './utils/persist.js' +import type { PBNode } from '@ipld/dag-pb' import type { Blockstore } from 'interface-blockstore' import type { CID } from 'multiformats/cid' @@ -35,11 +38,11 @@ export class DirFlat extends Dir { return this.childCount() } - onlyChild (): InProgressImportResult | Dir { + onlyChild (): InProgressImportResult | Dir | undefined { return this._children.values().next().value } - async * eachChildSeries (): AsyncGenerator<{ key: string, child: InProgressImportResult | Dir }, void, undefined> { + * eachChildSeries (): Generator<{ key: string, child: InProgressImportResult | Dir }, void, undefined> { for (const [key, child] of this._children.entries()) { yield { key, diff --git a/packages/ipfs-unixfs-importer/src/dir-sharded.ts b/packages/ipfs-unixfs-importer/src/dir-sharded.ts index 7bee99b0..4e65849c 100644 --- a/packages/ipfs-unixfs-importer/src/dir-sharded.ts +++ b/packages/ipfs-unixfs-importer/src/dir-sharded.ts @@ -1,10 +1,14 @@ -import { encode, type PBLink, prepare } from '@ipld/dag-pb' +import { encode, prepare } from '@ipld/dag-pb' import { murmur3128 } from '@multiformats/murmur3' -import { createHAMT, Bucket, type BucketChild } from 'hamt-sharding' +import { createHAMT, Bucket } from 'hamt-sharding' import { UnixFS } from 'ipfs-unixfs' -import { Dir, CID_V0, CID_V1, type DirProps } from './dir.js' -import { persist, type PersistOptions } from './utils/persist.js' +import { Dir, CID_V0, CID_V1 } from './dir.js' +import { persist } from './utils/persist.js' +import type { DirProps } from './dir.js' import type { ImportResult, InProgressImportResult } from './index.js' +import type { PersistOptions } from './utils/persist.js' +import type { PBLink } from '@ipld/dag-pb' +import type { BucketChild } from 'hamt-sharding' import type { Blockstore } from 'interface-blockstore' async function hamtHashFn (buf: Uint8Array): Promise { @@ -60,8 +64,8 @@ class DirSharded extends Dir { return this._bucket.onlyChild() } - async * eachChildSeries (): AsyncGenerator<{ key: string, child: InProgressImportResult | Dir }> { - for await (const { key, value } of this._bucket.eachLeafSeries()) { + * eachChildSeries (): Generator<{ key: string, child: InProgressImportResult | Dir }> { + for (const { key, value } of this._bucket.eachLeafSeries()) { yield { key, child: value diff --git a/packages/ipfs-unixfs-importer/src/dir.ts b/packages/ipfs-unixfs-importer/src/dir.ts index 3e1b2a4c..c13118ca 100644 --- a/packages/ipfs-unixfs-importer/src/dir.ts +++ b/packages/ipfs-unixfs-importer/src/dir.ts @@ -49,7 +49,7 @@ export abstract class Dir { abstract put (name: string, value: InProgressImportResult | Dir): Promise abstract get (name: string): Promise - abstract eachChildSeries (): AsyncIterable<{ key: string, child: InProgressImportResult | Dir }> + abstract eachChildSeries (): Iterable<{ key: string, child: InProgressImportResult | Dir }> abstract flush (blockstore: WritableStorage): AsyncGenerator abstract estimateNodeSize (): number abstract childCount (): number diff --git a/packages/ipfs-unixfs-importer/src/flat-to-shard.ts b/packages/ipfs-unixfs-importer/src/flat-to-shard.ts index f7e58959..fd028366 100644 --- a/packages/ipfs-unixfs-importer/src/flat-to-shard.ts +++ b/packages/ipfs-unixfs-importer/src/flat-to-shard.ts @@ -1,5 +1,6 @@ import { DirFlat } from './dir-flat.js' -import DirSharded, { type DirShardedOptions } from './dir-sharded.js' +import DirSharded from './dir-sharded.js' +import type { DirShardedOptions } from './dir-sharded.js' import type { Dir } from './dir.js' export async function flatToShard (child: Dir | null, dir: Dir, threshold: number, options: DirShardedOptions): Promise { @@ -43,7 +44,7 @@ async function convertToShard (oldDir: DirFlat, options: DirShardedOptions): Pro mode: oldDir.mode }, options) - for await (const { key, child } of oldDir.eachChildSeries()) { + for (const { key, child } of oldDir.eachChildSeries()) { await newDir.put(key, child) } diff --git a/packages/ipfs-unixfs-importer/src/index.ts b/packages/ipfs-unixfs-importer/src/index.ts index 859b877d..8497a79f 100644 --- a/packages/ipfs-unixfs-importer/src/index.ts +++ b/packages/ipfs-unixfs-importer/src/index.ts @@ -65,14 +65,18 @@ import first from 'it-first' import parallelBatch from 'it-parallel-batch' import { fixedSize } from './chunker/fixed-size.js' -import { type BufferImportProgressEvents, defaultBufferImporter } from './dag-builder/buffer-importer.js' -import { type DAGBuilder, type DagBuilderProgressEvents, defaultDagBuilder } from './dag-builder/index.js' -import { type ChunkValidator, defaultChunkValidator } from './dag-builder/validate-chunks.js' +import { defaultBufferImporter } from './dag-builder/buffer-importer.js' +import { defaultDagBuilder } from './dag-builder/index.js' +import { defaultChunkValidator } from './dag-builder/validate-chunks.js' import { InvalidParametersError } from './errors.js' -import { balanced, type FileLayout } from './layout/index.js' +import { balanced } from './layout/index.js' import { defaultTreeBuilder } from './tree-builder.js' import type { Chunker } from './chunker/index.js' +import type { BufferImportProgressEvents } from './dag-builder/buffer-importer.js' import type { ReducerProgressEvents } from './dag-builder/file.js' +import type { DAGBuilder, DagBuilderProgressEvents } from './dag-builder/index.js' +import type { ChunkValidator } from './dag-builder/validate-chunks.js' +import type { FileLayout } from './layout/index.js' import type { Blockstore } from 'interface-blockstore' import type { AwaitIterable } from 'interface-store' import type { UnixFS, Mtime } from 'ipfs-unixfs' diff --git a/packages/ipfs-unixfs-importer/src/tree-builder.ts b/packages/ipfs-unixfs-importer/src/tree-builder.ts index 18e94eb0..9e9b4fcc 100644 --- a/packages/ipfs-unixfs-importer/src/tree-builder.ts +++ b/packages/ipfs-unixfs-importer/src/tree-builder.ts @@ -112,7 +112,7 @@ export function defaultTreeBuilder (options: TreeBuilderOptions): TreeBuilder { if (options.wrapWithDirectory || (singleRoot && tree.childCount() > 1)) { yield * flushAndYield(tree, block) } else { - for await (const unwrapped of tree.eachChildSeries()) { + for (const unwrapped of tree.eachChildSeries()) { if (unwrapped == null) { continue } diff --git a/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.ts b/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.ts index 04637910..0dda35f3 100644 --- a/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.ts +++ b/packages/ipfs-unixfs-importer/test/hash-parity-with-go-ipfs.spec.ts @@ -5,9 +5,11 @@ import { MemoryBlockstore } from 'blockstore-core' import first from 'it-first' import last from 'it-last' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { importer, type ImporterOptions } from '../src/index.js' -import { balanced, type FileLayout, flat, trickle } from '../src/layout/index.js' +import { importer } from '../src/index.js' +import { balanced, flat, trickle } from '../src/layout/index.js' import randomByteStream from './helpers/finite-pseudorandom-byte-stream.js' +import type { ImporterOptions } from '../src/index.js' +import type { FileLayout } from '../src/layout/index.js' const strategies: Record<'flat' | 'trickle' | 'balanced', FileLayout> = { flat: flat(), diff --git a/packages/ipfs-unixfs-importer/typedoc.json b/packages/ipfs-unixfs-importer/typedoc.json index 34037848..941072f4 100644 --- a/packages/ipfs-unixfs-importer/typedoc.json +++ b/packages/ipfs-unixfs-importer/typedoc.json @@ -1,4 +1,5 @@ { + "readme": "none", "entryPoints": [ "./src/index.ts", "./src/chunker/index.ts", diff --git a/packages/ipfs-unixfs/CODE_OF_CONDUCT.md b/packages/ipfs-unixfs/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b0fa54c --- /dev/null +++ b/packages/ipfs-unixfs/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Contributor Code of Conduct + +This project follows the [`IPFS Community Code of Conduct`](https://github.com/ipfs/community/blob/master/code-of-conduct.md) diff --git a/packages/ipfs-unixfs/LICENSE b/packages/ipfs-unixfs/LICENSE deleted file mode 100644 index 20ce483c..00000000 --- a/packages/ipfs-unixfs/LICENSE +++ /dev/null @@ -1,4 +0,0 @@ -This project is dual licensed under MIT and Apache-2.0. - -MIT: https://www.opensource.org/licenses/mit -Apache-2.0: https://www.apache.org/licenses/license-2.0 diff --git a/packages/ipfs-unixfs/LICENSE-APACHE b/packages/ipfs-unixfs/LICENSE-APACHE index 14478a3b..b09cd785 100644 --- a/packages/ipfs-unixfs/LICENSE-APACHE +++ b/packages/ipfs-unixfs/LICENSE-APACHE @@ -1,5 +1,201 @@ -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -http://www.apache.org/licenses/LICENSE-2.0 + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/ipfs-unixfs/package.json b/packages/ipfs-unixfs/package.json index 4cc41ec5..fe5784da 100644 --- a/packages/ipfs-unixfs/package.json +++ b/packages/ipfs-unixfs/package.json @@ -32,16 +32,6 @@ "import": "./dist/src/index.js" } }, - "eslintConfig": { - "extends": "ipfs", - "parserOptions": { - "project": true, - "sourceType": "module" - }, - "ignorePatterns": [ - "src/unixfs.d.ts" - ] - }, "release": { "branches": [ "main" @@ -124,7 +114,15 @@ "@semantic-release/changelog", "@semantic-release/npm", "@semantic-release/github", - "@semantic-release/git" + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "package.json" + ] + } + ] ] }, "scripts": { @@ -145,7 +143,7 @@ }, "devDependencies": { "aegir": "^47.0.16", - "protons": "^7.6.0", + "protons": "^7.6.1", "uint8arrays": "^5.1.0" }, "browser": { diff --git a/packages/ipfs-unixfs/src/unixfs.ts b/packages/ipfs-unixfs/src/unixfs.ts index ceed9332..d6feac8d 100644 --- a/packages/ipfs-unixfs/src/unixfs.ts +++ b/packages/ipfs-unixfs/src/unixfs.ts @@ -1,9 +1,3 @@ -/* eslint-disable import/export */ -/* eslint-disable complexity */ -/* eslint-disable @typescript-eslint/no-namespace */ -/* eslint-disable @typescript-eslint/no-unnecessary-boolean-literal-compare */ -/* eslint-disable @typescript-eslint/no-empty-interface */ - import { enumeration, encodeMessage, decodeMessage, message } from 'protons-runtime' import type { Codec } from 'protons-runtime' import type { Uint8ArrayList } from 'uint8arraylist' diff --git a/packages/ipfs-unixfs/test/unixfs-format.spec.ts b/packages/ipfs-unixfs/test/unixfs-format.spec.ts index 12dae55b..15c76373 100644 --- a/packages/ipfs-unixfs/test/unixfs-format.spec.ts +++ b/packages/ipfs-unixfs/test/unixfs-format.spec.ts @@ -3,8 +3,9 @@ import { expect } from 'aegir/chai' import loadFixture from 'aegir/fixtures' import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string' -import { type Mtime, UnixFS } from '../src/index.js' +import { UnixFS } from '../src/index.js' import * as Pb from '../src/unixfs.js' +import type { Mtime } from '../src/index.js' const PBData = Pb.Data const raw = loadFixture('test/fixtures/raw.unixfs') diff --git a/packages/ipfs-unixfs/typedoc.json b/packages/ipfs-unixfs/typedoc.json index f599dc72..db0b0747 100644 --- a/packages/ipfs-unixfs/typedoc.json +++ b/packages/ipfs-unixfs/typedoc.json @@ -1,4 +1,5 @@ { + "readme": "none", "entryPoints": [ "./src/index.ts" ] diff --git a/typedoc.json b/typedoc.json index 481c04ce..ec8439cf 100644 --- a/typedoc.json +++ b/typedoc.json @@ -1,7 +1,9 @@ { "$schema": "https://typedoc.org/schema.json", - "name": "UnixFS", - "exclude": [ - "packages/interop" - ] + "name": "js-ipfs-unixfs", + "readme": "./README.md", + "headings": { + "readme": false, + "document": false + } } From d802ddb33be43d9347e9f639aca6b895c78e288d Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 18 Jun 2025 07:13:11 +0300 Subject: [PATCH 3/4] chore: fix deps --- benchmarks/import/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/benchmarks/import/package.json b/benchmarks/import/package.json index 28966afe..2c380ca6 100644 --- a/benchmarks/import/package.json +++ b/benchmarks/import/package.json @@ -14,7 +14,6 @@ "devDependencies": { "aegir": "^47.0.16", "blockstore-core": "^5.0.4", - "blockstore-fs": "^2.0.4", "ipfs-unixfs-importer": "^15.0.0", "it-buffer-stream": "^3.0.11", "it-drain": "^3.0.10" From bd08b68c7181472dd4ccbc6162b7caf1bb3fc6e3 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Wed, 18 Jun 2025 07:16:32 +0300 Subject: [PATCH 4/4] chore: exclude benchmarks from docs --- typedoc.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/typedoc.json b/typedoc.json index ec8439cf..a7a0c07b 100644 --- a/typedoc.json +++ b/typedoc.json @@ -5,5 +5,8 @@ "headings": { "readme": false, "document": false - } + }, + "exclude": [ + "benchmarks/**/*" + ] }