Comparing version 6.0.2 to 7.0.0
@@ -0,56 +1,29 @@ | ||
import type { Multiaddr } from '@multiformats/multiaddr'; | ||
import { CID } from 'multiformats/cid'; | ||
export declare const pathGatewayPattern: RegExp; | ||
export declare const pathPattern: RegExp; | ||
export declare const subdomainGatewayPattern: RegExp; | ||
declare function isMultihash(hash: Uint8Array | string): boolean; | ||
declare function isMultiaddr(input: string | Uint8Array | Multiaddr): input is Multiaddr; | ||
declare function isCID(hash: CID | Uint8Array | string): hash is CID; | ||
/** | ||
* @param {*} hash | ||
*/ | ||
declare function isMultihash(hash: any): boolean; | ||
/** | ||
* @param {*} input | ||
*/ | ||
declare function isMultiaddr(input: any): boolean; | ||
/** | ||
* @param {string | Uint8Array | Multiaddr} input | ||
*/ | ||
declare function isPeerMultiaddr(input: string | Uint8Array | Multiaddr): boolean; | ||
/** | ||
* @param {*} hash | ||
*/ | ||
declare function isCID(hash: any): boolean; | ||
import { CID } from "multiformats/cid"; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function ipfsSubdomain(url: string | Uint8Array): boolean; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function ipnsSubdomain(url: string | Uint8Array): boolean; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function subdomain(url: string | Uint8Array): boolean; | ||
export const subdomainGatewayPattern: RegExp; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function ipfsUrl(url: string | Uint8Array): boolean; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function ipnsUrl(url: string | Uint8Array): boolean; | ||
/** | ||
* @param {string | Uint8Array} url | ||
*/ | ||
export function url(url: string | Uint8Array): boolean; | ||
export const pathGatewayPattern: RegExp; | ||
/** | ||
* @param {string | Uint8Array} path | ||
*/ | ||
export function path(path: string | Uint8Array): boolean; | ||
export const pathPattern: RegExp; | ||
import { Multiaddr } from "multiaddr"; | ||
export declare function base32cid(cid: string | Uint8Array | CID): boolean; | ||
export declare function ipfsPath(path: string | Uint8Array): boolean; | ||
export declare function ipnsPath(path: string | Uint8Array): boolean; | ||
export declare function urlOrPath(x: string | Uint8Array): boolean; | ||
export declare function cidPath(path: string | Uint8Array | CID): boolean; | ||
export { isMultihash as multihash, isMultiaddr as multiaddr, isPeerMultiaddr as peerMultiaddr, isCID as cid }; | ||
export declare const ipfsSubdomain: (url: string | Uint8Array) => boolean; | ||
export declare const ipnsSubdomain: (url: string | Uint8Array) => boolean; | ||
export declare const subdomain: (url: string | Uint8Array) => boolean; | ||
export declare const ipfsUrl: (url: string | Uint8Array) => boolean; | ||
export declare const ipnsUrl: (url: string | Uint8Array) => boolean; | ||
export declare const url: (url: string | Uint8Array) => boolean; | ||
export declare const path: (path: string | Uint8Array) => boolean; | ||
export { isMultihash as multihash }; | ||
export { isMultiaddr as multiaddr }; | ||
export { isPeerMultiaddr as peerMultiaddr }; | ||
export { isCID as cid }; | ||
export declare const base32cid: (cid: CID | string | Uint8Array) => boolean; | ||
export declare const ipfsPath: (path: string | Uint8Array) => boolean; | ||
export declare const ipnsPath: (path: string | Uint8Array) => boolean; | ||
export declare const urlOrPath: (x: string | Uint8Array) => boolean; | ||
export declare const cidPath: (path: string | Uint8Array | CID) => boolean; | ||
//# sourceMappingURL=index.d.ts.map |
186
package.json
{ | ||
"name": "is-ipfs", | ||
"version": "6.0.2", | ||
"version": "7.0.0", | ||
"description": "A set of utilities to help identify IPFS resources on the web", | ||
"author": "Francisco Dias <francisco@baiodias.com> (http://franciscodias.net/)", | ||
"license": "Apache-2.0 OR MIT", | ||
"homepage": "https://github.com/ipfs-shipyard/is-ipfs#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ipfs-shipyard/is-ipfs.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ipfs-shipyard/is-ipfs/issues" | ||
}, | ||
"keywords": [ | ||
"js-ipfs", | ||
"dnslink", | ||
"gateway", | ||
"ipfs", | ||
"ipns", | ||
"gateway", | ||
"dnslink", | ||
"ipfs" | ||
"js-ipfs" | ||
], | ||
"homepage": "https://github.com/ipfs/is-ipfs", | ||
"bugs": { | ||
"url": "https://github.com/ipfs/is-ipfs/issues" | ||
"engines": { | ||
"node": ">=16.0.0", | ||
"npm": ">=7.0.0" | ||
}, | ||
"license": "MIT", | ||
"author": "Francisco Dias <francisco@baiodias.com> (http://franciscodias.net/)", | ||
"leadMaintainer": "Marcin Rataj <lidel@lidel.org>", | ||
"type": "module", | ||
"types": "./dist/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist" | ||
"dist/src", | ||
"!dist/test", | ||
"!**/*.tsbuildinfo" | ||
], | ||
"types": "./dist/src/index.d.ts", | ||
"main": "src/index.js", | ||
"browser": { | ||
"fs": false | ||
"exports": { | ||
".": { | ||
"types": "./dist/src/index.d.ts", | ||
"import": "./dist/src/index.js" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ipfs/is-ipfs.git" | ||
"eslintConfig": { | ||
"extends": "ipfs", | ||
"parserOptions": { | ||
"sourceType": "module" | ||
} | ||
}, | ||
"release": { | ||
"branches": [ | ||
"master" | ||
], | ||
"plugins": [ | ||
[ | ||
"@semantic-release/commit-analyzer", | ||
{ | ||
"preset": "conventionalcommits", | ||
"releaseRules": [ | ||
{ | ||
"breaking": true, | ||
"release": "major" | ||
}, | ||
{ | ||
"revert": true, | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "feat", | ||
"release": "minor" | ||
}, | ||
{ | ||
"type": "fix", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "docs", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "test", | ||
"release": "patch" | ||
}, | ||
{ | ||
"type": "deps", | ||
"release": "patch" | ||
}, | ||
{ | ||
"scope": "no-release", | ||
"release": false | ||
} | ||
] | ||
} | ||
], | ||
[ | ||
"@semantic-release/release-notes-generator", | ||
{ | ||
"preset": "conventionalcommits", | ||
"presetConfig": { | ||
"types": [ | ||
{ | ||
"type": "feat", | ||
"section": "Features" | ||
}, | ||
{ | ||
"type": "fix", | ||
"section": "Bug Fixes" | ||
}, | ||
{ | ||
"type": "chore", | ||
"section": "Trivial Changes" | ||
}, | ||
{ | ||
"type": "docs", | ||
"section": "Documentation" | ||
}, | ||
{ | ||
"type": "deps", | ||
"section": "Dependencies" | ||
}, | ||
{ | ||
"type": "test", | ||
"section": "Tests" | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
"@semantic-release/git" | ||
] | ||
}, | ||
"scripts": { | ||
"prepare": "aegir build --no-bundle", | ||
"test:node": "aegir test --target node", | ||
"test:browser": "aegir test --target browser", | ||
"clean": "aegir clean", | ||
"lint": "aegir lint", | ||
"dep-check": "aegir dep-check", | ||
"generate": "protons src/pb/peer.proto src/pb/tags.proto", | ||
"build": "aegir build", | ||
"test": "aegir test", | ||
"prepublishOnly": "aegir build", | ||
"lint": "aegir ts -p check && aegir lint-package-json && aegir lint", | ||
"release": "aegir release", | ||
"release-minor": "aegir release --type minor", | ||
"release-major": "aegir release --type major" | ||
"test:chrome": "aegir test -t browser", | ||
"test:chrome-webworker": "aegir test -t webworker", | ||
"test:firefox": "aegir test -t browser -- --browser firefox", | ||
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox", | ||
"test:node": "aegir test -t node", | ||
"test:electron-main": "aegir test -t electron-main", | ||
"release": "aegir release" | ||
}, | ||
"dependencies": { | ||
"@multiformats/mafmt": "^11.0.3", | ||
"@multiformats/multiaddr": "^11.0.0", | ||
"iso-url": "^1.1.3", | ||
"mafmt": "^10.0.0", | ||
"multiaddr": "^10.0.0", | ||
"multiformats": "^9.0.0", | ||
@@ -51,24 +154,7 @@ "uint8arrays": "^3.0.0" | ||
"devDependencies": { | ||
"aegir": "^35.0.2", | ||
"pre-commit": "^1.2.2", | ||
"util": "^0.12.4" | ||
"aegir": "^37.5.3" | ||
}, | ||
"engines": { | ||
"node": ">=14.0.0", | ||
"npm": ">=6.0.0" | ||
}, | ||
"pre-commit": [ | ||
"test", | ||
"lint" | ||
], | ||
"contributors": [ | ||
"Marcin Rataj <lidel@lidel.org>", | ||
"Francisco Baio Dias <xicombd@gmail.com>", | ||
"David Dias <daviddias.p@gmail.com>", | ||
"Alan Shaw <alan.shaw@protocol.ai>", | ||
"Alex Potsides <alex@achingbrain.net>", | ||
"nginnever <ginneversource@gmail.com>", | ||
"Hugo Dias <mail@hugodias.me>", | ||
"Henrique Dias <hacdias@gmail.com>" | ||
] | ||
"browser": { | ||
"fs": false | ||
} | ||
} |
@@ -1,9 +0,46 @@ | ||
is-ipfs 🕵️ | ||
==== | ||
# is-ipfs <!-- omit in toc --> | ||
[![](https://img.shields.io/github/release/ipfs/is-ipfs.svg)](https://github.com/ipfs/is-ipfs/releases/latest) | ||
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](https://webchat.freenode.net/?channels=%23ipfs) | ||
[![codecov](https://img.shields.io/codecov/c/github/ipfs-shipyard/is-ipfs.svg?style=flat-square)](https://codecov.io/gh/ipfs-shipyard/is-ipfs) | ||
[![CI](https://img.shields.io/github/workflow/status/ipfs-shipyard/is-ipfs/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs-shipyard/is-ipfs/actions/workflows/js-test-and-release.yml) | ||
> A set of utilities to help identify [IPFS](https://ipfs.io/) resources | ||
> A set of utilities to help identify IPFS resources on the web | ||
## Table of contents <!-- omit in toc --> | ||
- - [Install](#install) | ||
- [Lead Maintainer](#lead-maintainer) | ||
- [Browser: Browserify, Webpack, other bundlers](#browser-browserify-webpack-other-bundlers) | ||
- [In the Browser through `<script>` tag](#in-the-browser-through-script-tag) | ||
- [Usage](#usage) | ||
- [API](#api) | ||
- [Content Identifiers](#content-identifiers) | ||
- [`isIPFS.multihash(hash)`](#isipfsmultihashhash) | ||
- [`isIPFS.cid(hash)`](#isipfscidhash) | ||
- [`isIPFS.base32cid(hash)`](#isipfsbase32cidhash) | ||
- [URLs](#urls) | ||
- [`isIPFS.url(url)`](#isipfsurlurl) | ||
- [`isIPFS.ipfsUrl(url)`](#isipfsipfsurlurl) | ||
- [`isIPFS.ipnsUrl(url)`](#isipfsipnsurlurl) | ||
- [Paths](#paths) | ||
- [`isIPFS.path(path)`](#isipfspathpath) | ||
- [`isIPFS.urlOrPath(path)`](#isipfsurlorpathpath) | ||
- [`isIPFS.ipfsPath(path)`](#isipfsipfspathpath) | ||
- [`isIPFS.ipnsPath(path)`](#isipfsipnspathpath) | ||
- [`isIPFS.cidPath(path)`](#isipfscidpathpath) | ||
- [Subdomains](#subdomains) | ||
- [`isIPFS.subdomain(url)`](#isipfssubdomainurl) | ||
- [`isIPFS.ipfsSubdomain(url)`](#isipfsipfssubdomainurl) | ||
- [`isIPFS.ipnsSubdomain(url)`](#isipfsipnssubdomainurl) | ||
- [Multiaddrs](#multiaddrs) | ||
- [`isIPFS.multiaddr(addr)`](#isipfsmultiaddraddr) | ||
- [`isIPFS.peerMultiaddr(addr)`](#isipfspeermultiaddraddr) | ||
- [License](#license) | ||
- [Contribute](#contribute) | ||
## Install | ||
```console | ||
$ npm i is-ipfs | ||
``` | ||
## Lead Maintainer | ||
@@ -13,6 +50,2 @@ | ||
# Install | ||
### In Node.js through npm | ||
```bash | ||
@@ -27,9 +60,8 @@ $ npm install --save is-ipfs | ||
```js | ||
const isIPFS = require('is-ipfs') | ||
const isIPFS from 'is-ipfs') | ||
``` | ||
### In the Browser through `<script>` tag | ||
Loading this module through a script tag will make the ```IsIpfs``` obj available in the global namespace. | ||
Loading this module through a script tag will make the `IsIpfs` obj available in the global namespace. | ||
@@ -43,4 +75,5 @@ ```html | ||
# Usage | ||
```javascript | ||
const isIPFS = require('is-ipfs') | ||
const isIPFS from 'is-ipfs') | ||
@@ -131,5 +164,6 @@ isIPFS.multihash('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true | ||
Detection of IPFS Paths and identifiers in URLs is a two-stage process: | ||
1. `pathPattern`/`pathGatewayPattern`/`subdomainGatewayPattern` regex is applied to quickly identify potential candidates | ||
2. proper CID validation is applied to remove false-positives | ||
1. `pathPattern`/`pathGatewayPattern`/`subdomainGatewayPattern` regex is applied to quickly identify potential candidates | ||
2. proper CID validation is applied to remove false-positives | ||
## Content Identifiers | ||
@@ -187,3 +221,2 @@ | ||
## Subdomains | ||
@@ -214,3 +247,2 @@ | ||
## Multiaddrs | ||
@@ -230,4 +262,11 @@ | ||
# License | ||
## License | ||
MIT | ||
Licensed under either of | ||
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>) | ||
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>) | ||
## Contribute | ||
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
266
Yes
37550
1
80
394
1
+ Added@multiformats/mafmt@^11.0.3
+ Added@chainsafe/is-ip@2.0.2(transitive)
+ Added@chainsafe/netmask@2.0.0(transitive)
+ Added@fastify/busboy@2.1.1(transitive)
+ Added@leichtgewicht/ip-codec@2.0.5(transitive)
+ Added@multiformats/dns@1.0.6(transitive)
+ Added@multiformats/mafmt@11.1.2(transitive)
+ Added@multiformats/multiaddr@11.6.112.3.1(transitive)
+ Added@types/dns-packet@5.6.5(transitive)
+ Added@types/node@22.7.4(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addeddns-over-http-resolver@2.1.3(transitive)
+ Addeddns-packet@5.6.1(transitive)
+ Addedeventemitter3@5.0.1(transitive)
+ Addedhashlru@2.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedmultiformats@11.0.212.1.313.3.0(transitive)
+ Addednative-fetch@4.0.2(transitive)
+ Addedp-queue@8.0.1(transitive)
+ Addedp-timeout@6.1.2(transitive)
+ Addedprogress-events@1.0.1(transitive)
+ Addeduint8-varint@2.0.4(transitive)
+ Addeduint8arraylist@2.4.8(transitive)
+ Addeduint8arrays@4.0.105.1.0(transitive)
+ Addedundici@5.28.4(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removedmafmt@^10.0.0
- Removedmultiaddr@^10.0.0
- Removeddata-uri-to-buffer@4.0.1(transitive)
- Removeddns-over-http-resolver@1.2.3(transitive)
- Removedfetch-blob@3.2.0(transitive)
- Removedformdata-polyfill@4.0.10(transitive)
- Removedip-regex@4.3.0(transitive)
- Removedis-ip@3.1.0(transitive)
- Removedmafmt@10.0.0(transitive)
- Removedmultiaddr@10.0.1(transitive)
- Removednative-fetch@3.0.0(transitive)
- Removednode-domexception@1.0.0(transitive)
- Removednode-fetch@3.3.2(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)