rollup-plugin-filesize
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -35,2 +35,3 @@ 'use strict'; | ||
const thisDirectory = path.dirname(new URL((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href))).pathname); | ||
const isWindows = process.platform === "win32"; | ||
function filesize(options = {}, env) { | ||
@@ -128,5 +129,15 @@ let { | ||
if (reporter === "boxen") { | ||
p = new Promise(function (resolve) { resolve(_interopNamespace(require(path.dirname(new URL((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href))).pathname) + "/reporters/boxen.js"))); }); | ||
p = new Promise(function (resolve) { resolve(_interopNamespace(require( // Node should be ok with this, but transpiling | ||
// to `require` doesn't work, so detect Windows | ||
// to remove slash instead | ||
// "file://" + | ||
path.dirname(new URL((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href))).pathname).slice( // istanbul ignore next | ||
isWindows ? 1 : 0) + "/reporters/boxen.js"))); }); | ||
} else { | ||
p = new Promise(function (resolve) { resolve(_interopNamespace(require(path.resolve(process.cwd(), reporter)))); }); | ||
p = new Promise(function (resolve) { resolve(_interopNamespace(require( // Node should be ok with this, but transpiling | ||
// to `require` doesn't work, so detect Windows | ||
// to remove slash instead | ||
// "file://" + | ||
path.resolve(process.cwd(), reporter).slice( // istanbul ignore next | ||
isWindows ? 1 : 0)))); }); | ||
} | ||
@@ -133,0 +144,0 @@ |
{ | ||
"name": "rollup-plugin-filesize", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "A rollup plugin to show filesize in the cli", | ||
@@ -15,5 +15,5 @@ "main": "dist/index.js", | ||
"test": "nyc ava test/index.test.js", | ||
"pretest": "rollup -c", | ||
"prepublishOnly": "npm run test", | ||
"prebuild": "rimraf dist/*" | ||
"remove-dist": "rimraf dist/*", | ||
"pretest": "npm run remove-dist && rollup -c", | ||
"prepare": "npm run test" | ||
}, | ||
@@ -20,0 +20,0 @@ "engines": { |
@@ -15,2 +15,4 @@ import { readFile as origReadFile } from "fs"; | ||
const isWindows = process.platform === "win32"; | ||
export default function filesize(options = {}, env) { | ||
@@ -127,7 +129,22 @@ let { | ||
p = import( | ||
dirname(new URL(import.meta.url).pathname) + | ||
"/reporters/boxen.js" | ||
// Node should be ok with this, but transpiling | ||
// to `require` doesn't work, so detect Windows | ||
// to remove slash instead | ||
// "file://" + | ||
dirname(new URL(import.meta.url).pathname).slice( | ||
// istanbul ignore next | ||
isWindows ? 1 : 0 | ||
) + "/reporters/boxen.js" | ||
); | ||
} else { | ||
p = import(pathResolve(process.cwd(), reporter)); | ||
p = import( | ||
// Node should be ok with this, but transpiling | ||
// to `require` doesn't work, so detect Windows | ||
// to remove slash instead | ||
// "file://" + | ||
pathResolve(process.cwd(), reporter).slice( | ||
// istanbul ignore next | ||
isWindows ? 1 : 0 | ||
) | ||
); | ||
} | ||
@@ -134,0 +151,0 @@ reporter = (await p).default; |
Sorry, the diff of this file is not supported yet
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
33964
392
5