Added Gulp.js for compiling SCSS stylesheets
This commit is contained in:
43
node_modules/vinyl-fs/lib/symlink/index.js
generated
vendored
Normal file
43
node_modules/vinyl-fs/lib/symlink/index.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
var pumpify = require('pumpify');
|
||||
var lead = require('lead');
|
||||
var mkdirpStream = require('fs-mkdirp-stream');
|
||||
var createResolver = require('resolve-options');
|
||||
|
||||
var config = require('./options');
|
||||
var prepare = require('./prepare');
|
||||
var linkFile = require('./link-file');
|
||||
|
||||
var folderConfig = {
|
||||
outFolder: {
|
||||
type: 'string',
|
||||
},
|
||||
};
|
||||
|
||||
function symlink(outFolder, opt) {
|
||||
if (!outFolder) {
|
||||
throw new Error('Invalid symlink() folder argument.' +
|
||||
' Please specify a non-empty string or a function.');
|
||||
}
|
||||
|
||||
var optResolver = createResolver(config, opt);
|
||||
var folderResolver = createResolver(folderConfig, { outFolder: outFolder });
|
||||
|
||||
function dirpath(file, callback) {
|
||||
var dirMode = optResolver.resolve('dirMode', file);
|
||||
|
||||
callback(null, file.dirname, dirMode);
|
||||
}
|
||||
|
||||
var stream = pumpify.obj(
|
||||
prepare(folderResolver, optResolver),
|
||||
mkdirpStream.obj(dirpath),
|
||||
linkFile(optResolver)
|
||||
);
|
||||
|
||||
// Sink the stream to start flowing
|
||||
return lead(stream);
|
||||
}
|
||||
|
||||
module.exports = symlink;
|
89
node_modules/vinyl-fs/lib/symlink/link-file.js
generated
vendored
Normal file
89
node_modules/vinyl-fs/lib/symlink/link-file.js
generated
vendored
Normal file
@ -0,0 +1,89 @@
|
||||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
var path = require('path');
|
||||
|
||||
var through = require('through2');
|
||||
|
||||
var fo = require('../file-operations');
|
||||
|
||||
var isWindows = (os.platform() === 'win32');
|
||||
|
||||
function linkStream(optResolver) {
|
||||
|
||||
function linkFile(file, enc, callback) {
|
||||
var isRelative = optResolver.resolve('relativeSymlinks', file);
|
||||
var flags = fo.getFlags({
|
||||
overwrite: optResolver.resolve('overwrite', file),
|
||||
append: false,
|
||||
});
|
||||
|
||||
if (!isWindows) {
|
||||
// On non-Windows, just use 'file'
|
||||
return createLinkWithType('file');
|
||||
}
|
||||
|
||||
fo.reflectStat(file.symlink, file, onReflectTarget);
|
||||
|
||||
function onReflectTarget(statErr) {
|
||||
if (statErr && statErr.code !== 'ENOENT') {
|
||||
return callback(statErr);
|
||||
}
|
||||
// If target doesn't exist, the vinyl will still carry the target stats.
|
||||
// Let's use those to determine which kind of dangling link to create.
|
||||
|
||||
// This option provides a way to create a Junction instead of a
|
||||
// Directory symlink on Windows. This comes with the following caveats:
|
||||
// * NTFS Junctions cannot be relative.
|
||||
// * NTFS Junctions MUST be directories.
|
||||
// * NTFS Junctions must be on the same file system.
|
||||
// * Most products CANNOT detect a directory is a Junction:
|
||||
// This has the side effect of possibly having a whole directory
|
||||
// deleted when a product is deleting the Junction directory.
|
||||
// For example, JetBrains product lines will delete the entire contents
|
||||
// of the TARGET directory because the product does not realize it's
|
||||
// a symlink as the JVM and Node return false for isSymlink.
|
||||
|
||||
// This function is Windows only, so we don't need to check again
|
||||
var useJunctions = optResolver.resolve('useJunctions', file);
|
||||
|
||||
var dirType = useJunctions ? 'junction' : 'dir';
|
||||
var type = !statErr && file.isDirectory() ? dirType : 'file';
|
||||
|
||||
createLinkWithType(type);
|
||||
}
|
||||
|
||||
function createLinkWithType(type) {
|
||||
// This is done after prepare() to use the adjusted file.base property
|
||||
if (isRelative && type !== 'junction') {
|
||||
file.symlink = path.relative(file.base, file.symlink);
|
||||
}
|
||||
|
||||
var opts = {
|
||||
flags: flags,
|
||||
type: type,
|
||||
};
|
||||
fo.symlink(file.symlink, file.path, opts, onSymlink);
|
||||
}
|
||||
|
||||
function onSymlink(symlinkErr) {
|
||||
if (symlinkErr) {
|
||||
return callback(symlinkErr);
|
||||
}
|
||||
|
||||
fo.reflectLinkStat(file.path, file, onReflectLink);
|
||||
}
|
||||
|
||||
function onReflectLink(reflectErr) {
|
||||
if (reflectErr) {
|
||||
return callback(reflectErr);
|
||||
}
|
||||
|
||||
callback(null, file);
|
||||
}
|
||||
}
|
||||
|
||||
return through.obj(linkFile);
|
||||
}
|
||||
|
||||
module.exports = linkStream;
|
26
node_modules/vinyl-fs/lib/symlink/options.js
generated
vendored
Normal file
26
node_modules/vinyl-fs/lib/symlink/options.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var config = {
|
||||
cwd: {
|
||||
type: 'string',
|
||||
default: process.cwd,
|
||||
},
|
||||
dirMode: {
|
||||
type: 'number',
|
||||
},
|
||||
overwrite: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
relativeSymlinks: {
|
||||
type: 'boolean',
|
||||
default: false,
|
||||
},
|
||||
// This option is ignored on non-Windows platforms
|
||||
useJunctions: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = config;
|
51
node_modules/vinyl-fs/lib/symlink/prepare.js
generated
vendored
Normal file
51
node_modules/vinyl-fs/lib/symlink/prepare.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
'use strict';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
var fs = require('graceful-fs');
|
||||
var Vinyl = require('vinyl');
|
||||
var through = require('through2');
|
||||
|
||||
function prepareSymlink(folderResolver, optResolver) {
|
||||
if (!folderResolver) {
|
||||
throw new Error('Invalid output folder');
|
||||
}
|
||||
|
||||
function normalize(file, enc, cb) {
|
||||
if (!Vinyl.isVinyl(file)) {
|
||||
return cb(new Error('Received a non-Vinyl object in `symlink()`'));
|
||||
}
|
||||
|
||||
// TODO: Remove this after people upgrade vinyl/transition from gulp-util
|
||||
if (typeof file.isSymbolic !== 'function') {
|
||||
file = new Vinyl(file);
|
||||
}
|
||||
|
||||
var cwd = path.resolve(optResolver.resolve('cwd', file));
|
||||
|
||||
var outFolderPath = folderResolver.resolve('outFolder', file);
|
||||
if (!outFolderPath) {
|
||||
return cb(new Error('Invalid output folder'));
|
||||
}
|
||||
var basePath = path.resolve(cwd, outFolderPath);
|
||||
var writePath = path.resolve(basePath, file.relative);
|
||||
|
||||
// Wire up new properties
|
||||
// Note: keep the target stats for now, we may need them in link-file
|
||||
file.stat = (file.stat || new fs.Stats());
|
||||
file.cwd = cwd;
|
||||
file.base = basePath;
|
||||
// This is the path we are linking *TO*
|
||||
file.symlink = file.path;
|
||||
file.path = writePath;
|
||||
// We have to set contents to null for a link
|
||||
// Otherwise `isSymbolic()` returns false
|
||||
file.contents = null;
|
||||
|
||||
cb(null, file);
|
||||
}
|
||||
|
||||
return through.obj(normalize);
|
||||
}
|
||||
|
||||
module.exports = prepareSymlink;
|
Reference in New Issue
Block a user