当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript browserify.default函数代码示例

本文整理汇总了TypeScript中browserify.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了default函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:TheLarkInn,项目名称:universal,代码行数:33,代码来源:browser_code_generator.ts

示例2: function

app.get('/browserify/*', function(req, res) {
	//TODO: cache this in production or generate all files beforehand
	let reqFile:string = req.params[0]
	let stream = browserify(["./public/ts/"+reqFile]).bundle()
	stream.on("data", function(buffer){
		res.write(buffer)
	})
	stream.on("end", function(){
		res.end()
	})
});
开发者ID:TrevorDev,项目名称:typescriptWebStart,代码行数:11,代码来源:app.ts

示例3: getBrowserify

async function getBrowserify(inputRootDir: FilePath, sourceFile: FilePath) {
    return browserify({
        debug: true,
        //entries: [inputRootDir + "/" + sourceFile],
        entries: [sourceFile],
        cache: {},
        packageCache: {},

        // TODO: decide how to pass parameter
        basedir: inputRootDir
    });

    //return pluginsCommon(browserifyInstance);
}
开发者ID:ondratra,项目名称:soliditySapper,代码行数:14,代码来源:tsxCompiler.ts

示例4: constructor

 constructor (public path: string){
     let that = this;
     this.path = path;
     this.sourcemap = !$.prod || $.config.scripts.sourcemap;
     this.bundler = browserify({
         //entries: [$.config.scripts.dev + this.path],
         debug: this.sourcemap,
         cache: {},
         packageCache: {},
         fullPaths: !$.prod
     }).add($.config.scripts.dev + this.path);
     if (!$.prod) {
         this.bundler = watchify(this.bundler);
         this.bundler.on('update', () => {
             this.build();
             $.plugin.util.log($.plugin.util.colors.green(`Rebundle ${this.path}`));
         });
     }
 }
开发者ID:AlexKryzh,项目名称:angular-typescript-seed,代码行数:19,代码来源:scripts.ts

示例5: function

gulp.task('compile-ts', function () {
    var opts = {
        basedir: config.paths.app,
        debug: true
    };

    var b = browserify(opts)
        .add(config.paths.app + '/main.ts')
        .external('jquery')
        .plugin(tsify, {
            removeComments: true,
            noImplicitAny: true,
            target: 'es5'
        })
        .transform(debowerify);

    return b.bundle()
        .on('error', gutil.log.bind(gutil, 'Browserify Error'))
        .pipe(exorcist(config.paths.pub + '/app.js.map'))
        .pipe(source('app.js'))
        .pipe(gulp.dest(config.paths.pub));

});
开发者ID:alekspolitov,项目名称:TypeScriptTest,代码行数:23,代码来源:gulpfile.ts

示例6: 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));

}
开发者ID:lindsaymacvean,项目名称:seventag,代码行数:24,代码来源:Gulpfile.ts

示例7: async

export const createTestBundle = async (modulePath: string): Promise<TestBundle> => {
    const bundler = browserify(modulePath, {
        // Generate sourcemaps for debugging
        debug: true,
        // Expose the module under this global variable
        standalone: 'moduleUnderTest',
        // rootDir for sourcemaps
        basedir: __dirname + '/../../src',
    })
    bundler.plugin(tsify, { project: __dirname + '/../../tsconfig.test.json' })

    // If running through nyc, instrument bundle for coverage reporting too
    if (process.env.NYC_CONFIG) {
        bundler.transform(babelify.configure({ plugins: [babelPluginIstanbul], extensions: ['.tsx', '.ts'] }))
    }

    const spinner = ora(`Bundling ${modulePath}`)
    bundler.on('file', (file, id) => {
        spinner.text = `Bundling ${id}`
    })
    spinner.start()
    try {
        const bundle = await getStream(bundler.bundle())
        return {
            load(): DOMModuleSandbox {
                const jsdom = new JSDOM('', { runScripts: 'dangerously' }) as JSDOM & {
                    window: { moduleUnderTest: any }
                }
                jsdom.window.eval(bundle)
                return { window: jsdom.window, module: jsdom.window.moduleUnderTest }
            },
        }
    } finally {
        spinner.stop()
    }
}
开发者ID:JoYiRis,项目名称:sourcegraph,代码行数:36,代码来源:unit-test-utils.ts

示例8: require

/// <reference path="browserify.d.ts"/>

import browserify = require("browserify");
import fs = require("fs");

var b: BrowserifyObject = browserify();
b.add('./browser/main.js');
b.transform('deamdify');
b.bundle().pipe(fs.createWriteStream('bundle.js'));

var customBrowsify: Browserify = require("browserify");
customBrowsify({entries: []});
开发者ID:APM3,项目名称:DefinitelyTyped,代码行数:12,代码来源:browserify-tests.ts


注:本文中的browserify.default函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。