Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {promisify} = require('@parcel/utils');
const fs = require('fs');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
exports.readFile = promisify(fs.readFile);
exports.writeFile = promisify(fs.writeFile);
exports.stat = promisify(fs.stat);
exports.readdir = promisify(fs.readdir);
exports.unlink = promisify(fs.unlink);
exports.rimraf = promisify(rimraf);
exports.realpath = async function(path) {
const realpath = promisify(fs.realpath);
try {
path = await realpath(path);
} catch (e) {
// do nothing
}
return path;
};
exports.lstat = promisify(fs.lstat);
exports.exists = function(filename) {
return new Promise(resolve => {
fs.exists(filename, resolve);
exports.realpath = async function(path) {
const realpath = promisify(fs.realpath);
try {
path = await realpath(path);
} catch (e) {
// do nothing
}
return path;
};
exports.lstat = promisify(fs.lstat);
const {promisify} = require('@parcel/utils');
const fs = require('fs');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
exports.readFile = promisify(fs.readFile);
exports.writeFile = promisify(fs.writeFile);
exports.stat = promisify(fs.stat);
exports.readdir = promisify(fs.readdir);
exports.unlink = promisify(fs.unlink);
exports.rimraf = promisify(rimraf);
exports.realpath = async function(path) {
const realpath = promisify(fs.realpath);
try {
path = await realpath(path);
} catch (e) {
// do nothing
}
return path;
};
exports.lstat = promisify(fs.lstat);
exports.exists = function(filename) {
return new Promise(resolve => {
import fs from 'fs';
import ncp from 'ncp';
import mkdirp from 'mkdirp';
import rimraf from 'rimraf';
import {registerSerializableClass, promisify} from '@parcel/utils';
import watcher from '@parcel/watcher';
import packageJSON from '../package.json';
// Most of this can go away once we only support Node 10+, which includes
// require('fs').promises
const realpath = promisify(fs.realpath);
export class NodeFS implements FileSystem {
readFile = promisify(fs.readFile);
writeFile = promisify(fs.writeFile);
copyFile = promisify(fs.copyFile);
stat = promisify(fs.stat);
readdir = promisify(fs.readdir);
unlink = promisify(fs.unlink);
utimes = promisify(fs.utimes);
mkdirp = promisify(mkdirp);
rimraf = promisify(rimraf);
ncp = promisify(ncp);
createReadStream = fs.createReadStream;
createWriteStream = fs.createWriteStream;
cwd = process.cwd;
chdir = process.chdir;
readFileSync = fs.readFileSync;
statSync = fs.statSync;
realpathSync = fs.realpathSync;
async transform({asset, options, config, logger}) {
await warnAboutNodeSassBeingUnsupported(asset.filePath, logger);
let sass = await options.packageManager.require('sass', asset.filePath);
const sassRender = promisify(sass.render.bind(sass));
let css;
try {
css = (await sassRender(config)).css;
} catch (err) {
// Adapt the Error object for the reporter.
err.fileName = err.file;
err.loc = {
line: err.line,
column: err.column,
};
throw err;
}
asset.type = 'css';
// Most of this can go away once we only support Node 10+, which includes
// require('fs').promises
const realpath = promisify(fs.realpath);
export class NodeFS implements FileSystem {
readFile = promisify(fs.readFile);
writeFile = promisify(fs.writeFile);
copyFile = promisify(fs.copyFile);
stat = promisify(fs.stat);
readdir = promisify(fs.readdir);
unlink = promisify(fs.unlink);
utimes = promisify(fs.utimes);
mkdirp = promisify(mkdirp);
rimraf = promisify(rimraf);
ncp = promisify(ncp);
createReadStream = fs.createReadStream;
createWriteStream = fs.createWriteStream;
cwd = process.cwd;
chdir = process.chdir;
readFileSync = fs.readFileSync;
statSync = fs.statSync;
realpathSync = fs.realpathSync;
existsSync = fs.existsSync;
readdirSync = (fs.readdirSync: any);
async realpath(originalPath: string): Promise {
try {
return await realpath(originalPath, 'utf8');
} catch (e) {
// do nothing
import fs from 'fs';
import ncp from 'ncp';
import mkdirp from 'mkdirp';
import rimraf from 'rimraf';
import {registerSerializableClass, promisify} from '@parcel/utils';
import watcher from '@parcel/watcher';
import packageJSON from '../package.json';
// Most of this can go away once we only support Node 10+, which includes
// require('fs').promises
const realpath = promisify(fs.realpath);
export class NodeFS implements FileSystem {
readFile = promisify(fs.readFile);
writeFile = promisify(fs.writeFile);
copyFile = promisify(fs.copyFile);
stat = promisify(fs.stat);
readdir = promisify(fs.readdir);
unlink = promisify(fs.unlink);
utimes = promisify(fs.utimes);
mkdirp = promisify(mkdirp);
rimraf = promisify(rimraf);
ncp = promisify(ncp);
createReadStream = fs.createReadStream;
createWriteStream = fs.createWriteStream;
cwd = process.cwd;
chdir = process.chdir;
readFileSync = fs.readFileSync;
statSync = fs.statSync;
const {promisify} = require('@parcel/utils');
const fs = require('fs');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
exports.readFile = promisify(fs.readFile);
exports.writeFile = promisify(fs.writeFile);
exports.stat = promisify(fs.stat);
exports.readdir = promisify(fs.readdir);
exports.unlink = promisify(fs.unlink);
exports.rimraf = promisify(rimraf);
exports.realpath = async function(path) {
const realpath = promisify(fs.realpath);
try {
path = await realpath(path);
} catch (e) {
// do nothing
}
return path;
};
exports.lstat = promisify(fs.lstat);
const {promisify} = require('@parcel/utils');
const fs = require('fs');
const mkdirp = require('mkdirp');
const rimraf = require('rimraf');
exports.readFile = promisify(fs.readFile);
exports.writeFile = promisify(fs.writeFile);
exports.stat = promisify(fs.stat);
exports.readdir = promisify(fs.readdir);
exports.unlink = promisify(fs.unlink);
exports.rimraf = promisify(rimraf);
exports.realpath = async function(path) {
const realpath = promisify(fs.realpath);
try {
path = await realpath(path);
} catch (e) {
// do nothing
}
return path;
};
exports.lstat = promisify(fs.lstat);
exports.exists = function(filename) {
Options as WatcherOptions,
AsyncSubscription,
} from '@parcel/watcher';
import fs from 'fs';
import ncp from 'ncp';
import mkdirp from 'mkdirp';
import rimraf from 'rimraf';
import {registerSerializableClass, promisify} from '@parcel/utils';
import watcher from '@parcel/watcher';
import packageJSON from '../package.json';
// Most of this can go away once we only support Node 10+, which includes
// require('fs').promises
const realpath = promisify(fs.realpath);
export class NodeFS implements FileSystem {
readFile = promisify(fs.readFile);
writeFile = promisify(fs.writeFile);
copyFile = promisify(fs.copyFile);
stat = promisify(fs.stat);
readdir = promisify(fs.readdir);
unlink = promisify(fs.unlink);
utimes = promisify(fs.utimes);
mkdirp = promisify(mkdirp);
rimraf = promisify(rimraf);
ncp = promisify(ncp);
createReadStream = fs.createReadStream;
createWriteStream = fs.createWriteStream;
cwd = process.cwd;
chdir = process.chdir;