本文整理匯總了TypeScript中vinyl-source-stream.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了default函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: rebundleRelease
function rebundleRelease(bundleStream) {
return bundleStream.bundle()
.pipe(source('main.js'))
.pipe(streamify(uglify(smildSettings.uglifyjs)))
.pipe(buffer())
.pipe(gulp.dest(helper.getTempFolder() + '/js'));
}
示例2: 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;
}
示例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: browserify
gulp.task('typescript', () => {
var bundle: BrowserifyObject = browserify({debug: !release, entries: ['./app/app.ts']});
typescriptErrors = [];
bundle.on('error', onTypescriptError);
return bundle
.plugin('tsify', {noImplicitAny: true, target: 'ES5'})
.bundle()
.pipe(sourceStream('app.ts'))
.pipe(rename('app.js'))
.pipe(gulp.dest(release ? RELEASE_DIR : BUILD_DIR));
});
示例7: 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(''));
});
示例8: rebundleDevelopment
function rebundleDevelopment(bundleStream) {
let bundle = bundleStream.bundle();
if (buildHelper.isWatching())
bundle = bundle.on('error', function (err) {
console.error(err.message);
this.emit("end");
});
return bundle
.pipe(source('main.js'))
.pipe(transform(() => {
return exorcist(helper.getTempFolder() + '/js/main.map.js');
}))
.pipe(gulp.dest(helper.getTempFolder() + '/js'))
.pipe(refresh({
start: helper.isWatching(),
port: smildSettings.liveReloadPort
}));
}
示例9: browserify
gulp.task("compiler:build", ["compiler:ts"], () => {
const compilerOpts = {
entries: [join(paths.build_dir.compiler, "compile.js")],
browserField: false,
builtins: false,
commondir: false,
insertGlobals: false,
insertGlobalVars: {
process: undefined,
global: undefined,
'Buffer.isBuffer': undefined,
Buffer: undefined,
}
}
return browserify(compilerOpts)
.bundle()
.pipe(source("compiler.js"))
.pipe(gulp.dest(paths.build_dir.js))
})
示例10: 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);
});
});