multiformats
Advanced tools
Comparing version 1.1.11 to 1.1.12
@@ -1,2 +0,2 @@ | ||
import { coerce } from '../bytes.js' | ||
import { coerce } from 'multiformats/bytes.js' | ||
const encode = o => Buffer.from(o).toString('base64') | ||
@@ -3,0 +3,0 @@ const decode = s => coerce(Buffer.from(s, 'base64')) |
@@ -1,2 +0,2 @@ | ||
import { fromHex, toHex } from '../bytes.js' | ||
import { fromHex, toHex } from 'multiformats/bytes.js' | ||
@@ -3,0 +3,0 @@ const create = function base16 (alphabet) { |
import baseX from 'base-x' | ||
import { coerce } from '../bytes.js' | ||
import { coerce } from 'multiformats/bytes.js' | ||
import { Buffer } from 'buffer' | ||
@@ -4,0 +4,0 @@ |
@@ -1,2 +0,2 @@ | ||
import * as b64 from './_base64.js' | ||
import * as b64 from 'multiformats/bases/_base64.js' | ||
@@ -3,0 +3,0 @@ const create = alphabet => { |
@@ -1,7 +0,7 @@ | ||
import { create } from './index.js' | ||
import raw from './codecs/raw.js' | ||
import json from './codecs/json.js' | ||
import base32 from './bases/base32.js' | ||
import base64 from './bases/base64.js' | ||
import sha2 from './hashes/sha2.js' | ||
import { create } from 'multiformats/index.js' | ||
import raw from 'multiformats/codecs/raw.js' | ||
import json from 'multiformats/codecs/json.js' | ||
import base32 from 'multiformats/bases/base32.js' | ||
import base64 from 'multiformats/bases/base64.js' | ||
import sha2 from 'multiformats/hashes/sha2.js' | ||
@@ -8,0 +8,0 @@ const multiformats = create() |
@@ -1,2 +0,2 @@ | ||
import * as bytes from './bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import withIs from 'class-is' | ||
@@ -32,2 +32,3 @@ | ||
}) | ||
readonly(this, 'asCID', this) | ||
if (_CID.isCID(cid)) { | ||
@@ -34,0 +35,0 @@ readonly(this, 'version', cid.version) |
@@ -1,2 +0,2 @@ | ||
import { coerce } from '../bytes.js' | ||
import { coerce } from 'multiformats/bytes.js' | ||
@@ -3,0 +3,0 @@ const raw = buff => coerce(buff) |
import varints from 'varint' | ||
import createCID from './cid.js' | ||
import * as bytes from './bytes.js' | ||
import createCID from 'multiformats/cid.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
@@ -5,0 +5,0 @@ const cache = new Map() |
import CID from 'cids' | ||
import * as bytes from './bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import { Buffer } from 'buffer' | ||
@@ -4,0 +4,0 @@ |
{ | ||
"name": "multiformats", | ||
"version": "1.1.11", | ||
"version": "1.1.12", | ||
"description": "Interface for multihash, multicodec, multibase and CID.", | ||
@@ -11,5 +11,5 @@ "main": "index.js", | ||
"lint": "standard", | ||
"test:cjs": "npm run build && mocha dist/test/test-*.cjs", | ||
"test:cjs": "rm -rf dist && npm run build && mocha dist/test/test-*.cjs", | ||
"test:node": "hundreds mocha test/test-*.js", | ||
"test:browser": "polendina --cleanup test/test-*.js", | ||
"test:browser": "polendina --webpack-config polendina.webpack.config.cjs --cleanup test/test-*.js", | ||
"test": "npm run lint && npm run test:node && npm run test:browser && npm run test:cjs", | ||
@@ -30,2 +30,6 @@ "coverage": "c8 --reporter=html mocha test/test-*.js && npx st -d coverage -p 8080" | ||
}, | ||
"./index.js": { | ||
"import": "./index.js", | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./basics.js": { | ||
@@ -48,5 +52,5 @@ "import": "./basics.js", | ||
"./bases/_base64.js": { | ||
"browser": "./bases/_base64-browser.js", | ||
"import": "./bases/_base64.js", | ||
"require": "./dist/bases/_base64.cjs", | ||
"browser": "./bases/_base64-browser.js" | ||
"require": "./dist/bases/_base64.cjs" | ||
}, | ||
@@ -69,17 +73,13 @@ "./bases/base16.js": { | ||
}, | ||
"./hashes/sha2-browser.js": { | ||
"import": "./hashes/sha2-browser.js", | ||
"require": "./dist/hashes/sha2-browser.cjs" | ||
}, | ||
"./hashes/sha2.js": { | ||
"browser": "./hashes/sha2-browser.js", | ||
"import": "./hashes/sha2.js", | ||
"require": "./dist/hashes/sha2.cjs", | ||
"browser": "./hashes/sha2-browser.js" | ||
"require": "./dist/hashes/sha2.cjs" | ||
}, | ||
"./codecs/json.js": { | ||
"import": "./codecs/json.js.js", | ||
"import": "./codecs/json.js", | ||
"require": "./dist/codecs/json.cjs" | ||
}, | ||
"./codecs/raw.js": { | ||
"import": "./codecs/raw.js.js", | ||
"import": "./codecs/raw.js", | ||
"require": "./dist/codecs/raw.cjs" | ||
@@ -86,0 +86,0 @@ } |
@@ -1,41 +0,16 @@ | ||
import { readdirSync, readFileSync } from 'fs' | ||
import { fileURLToPath } from 'url' | ||
import { dirname, join } from 'path' | ||
import { readdirSync } from 'fs' | ||
import { join } from 'path' | ||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'))) | ||
const relativeToMain = name => ({ | ||
name: 'relative-to-main', | ||
renderChunk: source => { | ||
const lines = source.split('\n') | ||
source = '' | ||
for (let line of lines) { | ||
if (line.includes("require('../index.cjs')")) { | ||
line = line.replace("require('../index.cjs')", `require('${name}')`) | ||
} | ||
if (line.includes("require('../")) { | ||
line = line.replace("require('../", `require('${name}/`) | ||
line = line.replace('.cjs', '.js') | ||
} | ||
source += line + '\n' | ||
} | ||
return source | ||
} | ||
}) | ||
const plugins = [relativeToMain(pkg.name)] | ||
const dir = 'dist' | ||
const preserveModules = true | ||
const output = { dir, preserveModules, plugins, format: 'cjs', entryFileNames: '[name].cjs' } | ||
const testdir = join(__dirname, 'test') | ||
const filter = name => name.startsWith('test-') | ||
const createConfig = f => ({ input: join('test', f), output }) | ||
const configs = readdirSync(testdir).filter(filter).map(createConfig) | ||
const configs = [] | ||
for (const subdir of ['test', 'bases', 'hashes', 'codecs', '.']) { | ||
const output = { dir: join(dir, subdir), preserveModules, format: 'cjs', entryFileNames: '[name].cjs' } | ||
const testdir = join(__dirname, subdir) | ||
const filter = name => name.endsWith('.js') | ||
const createConfig = f => ({ input: join(subdir, f), output }) | ||
readdirSync(testdir).filter(filter).map(createConfig).forEach(c => configs.push(c)) | ||
} | ||
console.log(configs) | ||
export default configs |
/* globals describe, it */ | ||
import * as bytes from '../bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import { deepStrictEqual } from 'assert' | ||
@@ -4,0 +4,0 @@ const test = it |
@@ -5,7 +5,7 @@ /* globals before, describe, it */ | ||
import assert from 'assert' | ||
import { toHex } from '../bytes.js' | ||
import multiformats from '../basics.js' | ||
import base58 from '../bases/base58.js' | ||
import base32 from '../bases/base32.js' | ||
import base64 from '../bases/base64.js' | ||
import { toHex } from 'multiformats/bytes.js' | ||
import multiformats from 'multiformats/basics.js' | ||
import base58 from 'multiformats/bases/base58.js' | ||
import base32 from 'multiformats/bases/base32.js' | ||
import base64 from 'multiformats/bases/base64.js' | ||
import util from 'util' | ||
@@ -12,0 +12,0 @@ const test = it |
/* globals describe, it */ | ||
import assert from 'assert' | ||
import { create } from '../index.js' | ||
import { create } from 'multiformats/index.js' | ||
const multiformat = create() | ||
@@ -5,0 +5,0 @@ const test = it |
/* globals before, describe, it */ | ||
import { Buffer } from 'buffer' | ||
import assert from 'assert' | ||
import multiformats from '../basics.js' | ||
import legacy from '../legacy.js' | ||
import multiformats from 'multiformats/basics.js' | ||
import legacy from 'multiformats/legacy.js' | ||
const same = assert.deepStrictEqual | ||
@@ -7,0 +7,0 @@ const test = it |
/* globals describe, it */ | ||
import * as bytes from '../bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import assert from 'assert' | ||
import { create as multiformat } from '../index.js' | ||
import base16 from '../bases/base16.js' | ||
import base32 from '../bases/base32.js' | ||
import base58 from '../bases/base58.js' | ||
import base64 from '../bases/base64.js' | ||
import basics from '../basics.js' | ||
import { __browser } from '../bases/_base64.js' | ||
import { create as multiformat } from 'multiformats/index.js' | ||
import base16 from 'multiformats/bases/base16.js' | ||
import base32 from 'multiformats/bases/base32.js' | ||
import base58 from 'multiformats/bases/base58.js' | ||
import base64 from 'multiformats/bases/base64.js' | ||
import basics from 'multiformats/basics.js' | ||
import { __browser } from 'multiformats/bases/_base64.js' | ||
const basicsMultibase = basics.multibase | ||
@@ -12,0 +12,0 @@ const same = assert.deepStrictEqual |
/* globals describe, it */ | ||
import * as bytes from '../bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import assert from 'assert' | ||
import multiformats from '../basics.js' | ||
import multiformats from 'multiformats/basics.js' | ||
const same = assert.deepStrictEqual | ||
@@ -6,0 +6,0 @@ const test = it |
/* globals describe, it */ | ||
import * as bytes from '../bytes.js' | ||
import * as bytes from 'multiformats/bytes.js' | ||
import assert from 'assert' | ||
import { create as multiformat } from '../index.js' | ||
import { create as multiformat } from 'multiformats/index.js' | ||
import intTable from 'multicodec/src/int-table.js' | ||
@@ -9,3 +9,3 @@ import valid from './fixtures/valid-multihash.js' | ||
import crypto from 'crypto' | ||
import sha2 from '../hashes/sha2.js' | ||
import sha2 from 'multiformats/hashes/sha2.js' | ||
const same = assert.deepStrictEqual | ||
@@ -12,0 +12,0 @@ const test = it |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
872187
45
2243
2