Comparing version 5.0.2 to 5.0.3
{ | ||
"name": "ipjs", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Universal JavaScript build and packaging system", | ||
@@ -5,0 +5,0 @@ "main": "src/build.js", |
@@ -7,3 +7,3 @@ import { promises as fs, existsSync } from 'fs' | ||
import { fileURLToPath } from 'url' | ||
import { join, dirname } from 'path' | ||
import { join, dirname, resolve, relative } from 'path' | ||
import rmtree from '@tgrajewski/rmtree' | ||
@@ -167,5 +167,7 @@ import preserveShebangs from 'rollup-plugin-preserve-shebangs' | ||
async stubFiles (dist, files) { | ||
async stubFiles (dist, overrides) { | ||
await Promise.all( | ||
files.map(async (file) => { | ||
Object.keys(overrides).map(async (file) => { | ||
const target = overrides[file] | ||
if (file === '.') { | ||
@@ -194,3 +196,13 @@ file = 'index.js' | ||
await writeFile(new URL(dist + '/' + file), '') | ||
const distPath = fileURLToPath(dist) | ||
const stubUrl = new URL(dist + '/' + file) | ||
const stubPath = fileURLToPath(stubUrl) | ||
const targetPath = resolve(join(distPath, target)) | ||
let relativePath = relative(dirname(stubPath), targetPath) | ||
if (!relativePath.startsWith('./')) { | ||
relativePath = `./${relativePath}` | ||
} | ||
await writeFile(stubUrl, `module.exports = require('${relativePath}')\n`) | ||
}) | ||
@@ -247,3 +259,3 @@ ) | ||
} | ||
await this.stubFiles(dist, Object.keys(json.browser)) | ||
await this.stubFiles(dist, json.browser) | ||
let files = Promise.all(pending) | ||
@@ -250,0 +262,0 @@ pending.push(writeFile(new URL(dist + '/package.json'), JSON.stringify(json, null, 2))) |
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
55764
1498