critical
Advanced tools
Comparing version 2.0.0-26 to 2.0.0-27
@@ -6,3 +6,2 @@ /* eslint-disable promise/prefer-await-to-then */ | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const through2 = require('through2'); | ||
@@ -12,2 +11,3 @@ const PluginError = require('plugin-error'); | ||
const {create} = require('./src/core'); | ||
const {outputFileAsync} = require('./src/file'); | ||
const {getOptions} = require('./src/config'); | ||
@@ -28,3 +28,3 @@ | ||
if (target.css) { | ||
await fs.outputFile(path.resolve(base, target.css), result.css); | ||
await outputFileAsync(path.resolve(base, target.css), result.css); | ||
} | ||
@@ -34,3 +34,3 @@ | ||
if (target.html) { | ||
await fs.outputFile(path.resolve(base, target.html), result.html); | ||
await outputFileAsync(path.resolve(base, target.html), result.html); | ||
} | ||
@@ -40,3 +40,3 @@ | ||
if (target.uncritical) { | ||
await fs.outputFile(path.resolve(base, target.uncritical), result.uncritical); | ||
await outputFileAsync(path.resolve(base, target.uncritical), result.uncritical); | ||
} | ||
@@ -43,0 +43,0 @@ |
{ | ||
"name": "critical", | ||
"version": "2.0.0-26", | ||
"version": "2.0.0-27", | ||
"description": "Extract & Inline Critical-path CSS from HTML", | ||
@@ -36,3 +36,2 @@ "author": "Addy Osmani", | ||
"find-up": "^4.1.0", | ||
"fs-extra": "^9.0.0", | ||
"get-stdin": "^8.0.0", | ||
@@ -46,2 +45,3 @@ "globby": "^11.0.0", | ||
"lodash": "^4.17.15", | ||
"make-dir": "^3.1.0", | ||
"meow": "^7.0.1", | ||
@@ -48,0 +48,0 @@ "oust": "^1.0.1", |
@@ -6,4 +6,6 @@ 'use strict'; | ||
const url = require('url'); | ||
const fs = require('fs-extra'); | ||
const fs = require('fs'); | ||
const {promisify} = require('util'); | ||
const findUp = require('find-up'); | ||
const makeDir = require('make-dir'); | ||
const globby = require('globby'); | ||
@@ -28,2 +30,16 @@ const isGlob = require('is-glob'); | ||
const unlinkAsync = promisify(fs.unlink); | ||
const readFileAsync = promisify(fs.readFile); | ||
const writeFileAsync = promisify(fs.writeFile); | ||
async function outputFileAsync(file, data) { | ||
const dir = path.dirname(file); | ||
if (!fs.existsSync(dir)) { | ||
await makeDir(dir); | ||
} | ||
return writeFileAsync(file, data); | ||
} | ||
/** | ||
@@ -160,3 +176,3 @@ * Fixup slashes in file paths for Windows and remove volume definition in front | ||
try { | ||
fs.remove(file); | ||
unlinkAsync(file); | ||
} catch (_) { | ||
@@ -657,3 +673,3 @@ debug(`${file} was already deleted`); | ||
file.virtualPath = filepath; | ||
file.contents = await fs.readFile(filepath); | ||
file.contents = await readFileAsync(filepath); | ||
} else { | ||
@@ -807,3 +823,3 @@ throw new FileNotFoundError(filepath); | ||
// Write html to temp file | ||
await fs.outputFile(file, injected); | ||
await outputFileAsync(file, injected); | ||
@@ -816,3 +832,3 @@ tmp.push(file); | ||
tmp.push(filename); | ||
await fs.outputFile(filename, document.css); | ||
await outputFileAsync(filename, document.css); | ||
} | ||
@@ -824,3 +840,3 @@ | ||
tmp.push(filename); | ||
fs.outputFile(filename, ''); | ||
outputFileAsync(filename, ''); | ||
}); | ||
@@ -923,2 +939,3 @@ | ||
getDocumentFromSource, | ||
outputFileAsync, | ||
}; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
94682
1492
3
+ Addedmake-dir@^3.1.0
+ Addedmake-dir@3.1.0(transitive)
+ Addedsemver@6.3.1(transitive)
- Removedfs-extra@^9.0.0
- Removedat-least-node@1.0.0(transitive)
- Removedfs-extra@9.1.0(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removeduniversalify@2.0.1(transitive)