Comparing version
@@ -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://github.com/ipfs/is-ipfs/releases/latest) | ||
[](https://webchat.freenode.net/?channels=%23ipfs) | ||
[](https://codecov.io/gh/ipfs-shipyard/is-ipfs) | ||
[](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
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
1
-66.67%266
17.18%Yes
NaN37550
-43.71%1
Infinity%80
-20%394
-11.26%1
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed