Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test.cb('bundle an empty file', t => {
vfs
.src('test/fixtures/empty.js')
.pipe(bro())
.pipe(assert.length(1))
.pipe(
assert.first(d =>
t.true(d.contents.toString().length > 0 /* browserify runtime */)
)
)
.pipe(assert.end(t.end))
})
function zip_crx_files (mode, async_cb) {
console.log("zipping ", mode);
var src = "./releases/chrome-app/" + mode + "/**",
zip_file_name = mode + ".zip";
vfs.src( src )
// zip the folder
.pipe( zip(zip_file_name) )
.pipe( vfs.dest( "./releases/chrome-app/" ) )
.on( "end", async_cb );
}
// there should not be any opportunity for glitches as only
// one vinylFS stream is active at a time. Wrapping the
// vinylFS stream in a playbackStream would be safer, but
// would buffer all the resources into memory at once with
// no backpressure. We like our users and don't want to eat
// all their RAM, so we just have to be careful not to
// introduce a regression when modifying this code.
vinylFS.src('./resources/**', { base: '.' }),
buildDeviceResources(
projectConfig,
buildTargets[family],
onDiagnostic,
),
),
new pumpify.obj(
vinylFS.src(componentTargets.device.translationsGlob, {
base: '.',
}),
compileTranslations(projectConfig.defaultLanguage),
),
),
makeDeviceManifest({ projectConfig, buildId }),
zip(bundleFilename),
transformIf(
maxDeviceBundleSize !== undefined,
validateFileSizes({
onDiagnostic,
maxSizes: { [bundleFilename]: maxDeviceBundleSize },
}),
),
gulpSetProperty({
componentBundle: {
env.logger.debug(() => {
fs.writeFile(
'sassdoc-data.json',
JSON.stringify(data, null, 2) + '\n',
err => {
if (err) throw err
}
)
return 'Dumping data to `sassdoc-data.json`.'
})
})
let streams = [
vfs.src(env.src),
recurse(),
exclude(env.exclude || []),
converter({ from: 'sass', to: 'scss' }),
filter
]
let pipeline = () => {
return new Promise((resolve, reject) => {
pipe(...streams, err =>
err ? reject(err) : resolve())
.resume() // Drain.
})
}
try {
await pipeline()
it("works with urlFormat", function(done) {
var expected = ["shane/kittie/post1.html", "shane/kittie/post2.html"];
var out = [];
fs.src([
"test/fixtures/_posts/**"
])
.pipe(crossbow.stream({
config: {
base: "test/fixtures",
urlFormat: {
"type:post": "/shane/kittie/:filename"
}
}
}))
.pipe(through.obj(function (file, enc, cb) {
out.push(file.relative);
cb();
}, function (cb) {
this.emit("end");
cb();
grunt.registerTask('instrument', function () {
fs.src('./component.json')
.pipe(component.scripts({
name: 'vue.test'
}))
.pipe(fs.dest('./test'))
.on('end', this.async())
})
}
exports.templates = function (app, glob, opts) {
opts = _.merge({}, app.options, opts);
opts.cwd = app.get('updater.cwd');
session.set('templates', opts);
return utils.createStack(app, [
vfs.src(glob, opts),
plugins.init.call(app, opts)
]);
};
function registerTemplatedHelpers (src) {
return vfs.src('helpers/*.js.template', { base: src, cwd: src })
.pipe(data(() => ({ manifest: fs.readFileSync('./public/_/data/rev-manifest.json').toString() })))
.pipe(template())
.pipe(map((file, enc, next) => {
handlebars.registerHelper(file.stem.replace('.js', ''), requireFromString(file.contents.toString()))
next()
}))
}
function copyImages (src, dest) {
return vfs.src('**/*.{png,svg}', { base: src, cwd: src }).pipe(vfs.dest(dest))
}