multiformats
Advanced tools
Comparing version 1.1.10 to 1.1.11
{ | ||
"name": "multiformats", | ||
"version": "1.1.10", | ||
"version": "1.1.11", | ||
"description": "Interface for multihash, multicodec, multibase and CID.", | ||
@@ -90,3 +90,3 @@ "main": "index.js", | ||
"polendina": "^1.0.0", | ||
"rollup": "^2.17.1", | ||
"rollup": "^2.18.0", | ||
"standard": "^14.3.4" | ||
@@ -93,0 +93,0 @@ }, |
@@ -1,7 +0,9 @@ | ||
import globby from 'globby' | ||
import path from 'path' | ||
import { readdirSync, readFileSync } from 'fs' | ||
import { fileURLToPath } from 'url' | ||
import { dirname, join } from 'path' | ||
let configs = [] | ||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
const _filter = p => !p.includes('/_') && !p.includes('rollup.config') | ||
const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'))) | ||
@@ -11,8 +13,14 @@ const relativeToMain = name => ({ | ||
renderChunk: source => { | ||
while (source.includes("require('../index.js')")) { | ||
source = source.replace("require('../index.js')", "require('multiformats')") | ||
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' | ||
} | ||
while (source.includes("require('../")) { | ||
source = source.replace('require(\'../', 'require(\'multiformats/') | ||
} | ||
return source | ||
@@ -22,21 +30,14 @@ } | ||
const plugins = [relativeToMain('multiformats')] | ||
const add = (pattern) => { | ||
configs = configs.concat(globby.sync(pattern).filter(_filter).map(inputFile => ({ | ||
input: inputFile, | ||
output: { | ||
plugins: pattern.startsWith('test') ? plugins : null, | ||
file: path.join('dist', inputFile).replace('.js', '.cjs'), | ||
format: 'cjs' | ||
} | ||
}))) | ||
} | ||
add('*.js') | ||
add('bases/*.js') | ||
add('hashes/*.js') | ||
add('codecs/*.js') | ||
add('test/*.js') | ||
add('test/fixtures/*.js') | ||
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) | ||
console.log(configs) | ||
export default configs |
@@ -32,3 +32,3 @@ /* globals describe, it */ | ||
test('browser', () => { | ||
same(__browser, !!process.browser) | ||
same(!!__browser, !!process.browser) | ||
}) | ||
@@ -35,0 +35,0 @@ |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
868972
2206
1