本文整理汇总了TypeScript中vinyl-buffer.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了default函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getBrowserCodeStream
export function getBrowserCodeStream(opts?: PrebootOptions): any {
opts = normalize(opts);
let bOpts = {
entries: [__dirname + '/../browser/preboot_browser.js'],
standalone: 'preboot',
basedir: __dirname + '/../browser',
browserField: false
};
let b = browserify(bOpts);
// ignore any strategies that are not being used
ignoreUnusedStrategies(b, bOpts, opts.listen, listenStrategies, './listen/listen_by_');
ignoreUnusedStrategies(b, bOpts, opts.replay, replayStrategies, './replay/replay_after_');
if (opts.freeze) {
ignoreUnusedStrategies(b, bOpts, [opts.freeze], freezeStrategies, './freeze/freeze_with_');
}
// ignore other code not being used
if (!opts.buffer) { b.ignore('./buffer_manager.js', bOpts); }
if (!opts.debug) { b.ignore('./log.js', bOpts); }
// use gulp to get the stream with the custom preboot browser code
let outputStream = b.bundle()
.pipe(source('src/browser/preboot_browser.js'))
.pipe(buffer())
.pipe(insert.append('\n\n;preboot.init(' + stringifyWithFunctions(opts) + ');\n\n'))
.pipe(rename('preboot.js'));
// uglify if the option is passed in
return opts.uglify ? outputStream.pipe(uglify()) : outputStream;
}
示例2: rebundleRelease
function rebundleRelease(bundleStream) {
return bundleStream.bundle()
.pipe(source('main.js'))
.pipe(streamify(uglify(smildSettings.uglifyjs)))
.pipe(buffer())
.pipe(gulp.dest(helper.getTempFolder() + '/js'));
}
示例3: return
return (next: (arg?: any) => void) => {
if (argv.verbose) gutil.log(`Building ${plugin_name}`)
const pluginOpts = {
entries: [path.resolve(path.join(paths.buildDir.jsTree, main))],
extensions: [".js"],
debug: true,
preludePath: pluginPreludePath,
prelude: pluginPreludeText,
paths: ['./node_modules', paths.buildDir.jsTree],
}
const plugin = browserify(pluginOpts)
labels[plugin_name] = namedLabeler(plugin, labels.bokehjs)
for (const file in labels.bokehjs) {
const name = labels.bokehjs[file]
if (name !== "_process")
plugin.external(file)
}
plugin
.bundle()
.pipe(source((paths.coffee as any)[plugin_name].destination.full))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// This solves a conflict when requirejs is loaded on the page. Backbone
// looks for `define` before looking for `module.exports`, which eats up
// our backbone.
.pipe(change((content: string) => {
return `(function() { var define = undefined; return ${content} })()`
}))
.pipe(insert.append(license))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildDir.js))
.on('end', () => next())
}
示例4: build
build(){
const stream = this.bundler
.plugin(tsify, {})
// .transform('brfs', {})
.bundle();
const sourceMapLocation = $.prod ? './' : '';
return stream.on('error', function (err:any) {
$.plugin.util.log(err.toString());
this.emit('end');
})
.pipe(source(this.path))
.pipe($.plugin.if(this.sourcemap, buffer()) )
.pipe($.plugin.if(this.sourcemap, $.plugin.sourcemaps.init({ loadMaps: true })) )
.pipe($.plugin.if($.prod, $.plugin.streamify($.plugin.uglify({
compress: { drop_console: true }
}))))
.pipe($.plugin.if(this.sourcemap, $.plugin.sourcemaps.write(sourceMapLocation)) )
.pipe($.plugin.rename({dirname: ''}) )
.pipe($.plugin.if($.prod, $.cachebust.resources()))
.pipe($.plugin.rename(function (path:any) {
path.extname = '.js'
}))
.pipe($.gulp.dest($.config.scripts.dest)).on('end',
function() {
$.bs.reload;
});
}
示例5: browserify
const tasks = files.map((entry: string) => {
return browserify({ entries: [entry] })
.bundle()
.pipe(source(entry.replace('tmp', 'resources')))
.pipe(buffer())
.pipe(uglify())
.pipe(dest('./built'));
});
示例6: function
gulp.task(`bundle${id}`, ['build'], function() {
// set up the browserify instance on a task basis
var b = browserify({
entries: [file],
debug: true,
paths: ['scripts'],
});
return b.bundle()
.pipe(source(outfile))
.pipe(buffer())
.pipe(gulp.dest(''));
});
示例7: through
files.forEach(filepath => {
console.log(filepath);
var bundledStream = through();
var fileParts = filepath.split('/');
var directory = fileParts.slice(0, fileParts.length - 1).join('/');
var filename = fileParts[fileParts.length - 1].replace('.ts', '.out.js');
if (filename == 'app.js')
return;
if (filename.indexOf('.out.out.') !== -1) {
return;
}
console.log(`dir: ${directory} filename: ${filename}`);
bundledStream
.pipe(source(filename))
.pipe(buffer())
// .pipe(sm.init({loadMaps: true}))
// .pipe(uglify())
// .pipe(sm.write('./'))
.pipe(gulp.dest(directory));
globby(taskPath, function(err, entries) {
if (err) {
bundledStream.emit('error', err);
return;
}
var b = browserify({
entries: [filepath],
debug: true,
paths: ['scripts'],
noParse:['lodash.js'],
standalone: 'GLib'
}).plugin('tsify',{target:'es5'});
b.bundle().pipe(bundledStream);
});
});
示例8: buildBokehjs
function buildBokehjs(next: (arg?: any) => void) {
if (argv.verbose) gutil.log("Building bokehjs")
bokehjs.exclude(path.resolve("build/js/tree/models/glyphs/webgl/index.js"))
labels.bokehjs = namedLabeler(bokehjs, {})
bokehjs
.bundle()
.pipe(source(paths.coffee.bokehjs.destination.full))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// This solves a conflict when requirejs is loaded on the page. Backbone
// looks for `define` before looking for `module.exports`, which eats up
// our backbone.
.pipe(change((content: string) => {
return `(function() { var define = undefined; return ${content} })()`
}))
.pipe(change((content: string) => {
return `window.Bokeh = Bokeh = ${content}`
}))
.pipe(insert.append(license))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.buildDir.js))
.on('end', () => next())
}
示例9: bundle
function bundle(namespace: string) {
let bundler = browserify(
SOURCE_DIR + '/' + namespace + '/app/app-' + env + '.js',
{
debug: true
}
).transform(babelify, { presets: ['es2015'] });
return bundler.bundle()
.on('error', function (err) {
console.log(err);
this.emit('end');
})
.pipe(source('app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(gulpif(minify, uglify()))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(DEST_DIR + '/' + namespace));
}