function ca(a, c, e) { function f(a, b) { if (a) return console.error(` error: browserify ${h}`.red, "\n", a), l(); let e = b + '', f = null; if (k && (f = JSON.parse(I.fromSource(e).toJSON()), e = I.removeMapFileComments(e)), N.babel.enable) { let a = ea(da(), h, e, f); if (a.err) return l(a.err); e = a.code, f = a.map; } try { q(c, e), k && d.writeFileSync(`${c}.map`, JSON.stringify(f, null, '\t')); } catch (a) { return console.error(` error: write codes and sources map to target file failed!`.red, "\n", a.stack || a), l(a); } return l(); }let h = j(c),k = N.source_map.enable && N.source_map.js,l = e,m = g([a], { extensions: ['.jsx'], debug: k, basedir: i(c), cache: {}, packageCache: {} });N.browserify.transform.map(({ name: a, options: b }) => m.transform(a, b)), L && (m.plugin(H, N.watchify), m.on('update', () => {l = () => (console.log(`${a} updated!`), Q.js()), m.bundle(f);})), m.bundle(f); }
function distFolderExists(error) { if (error) throw error; const filePrefix = "smartystreets-sdk-"; const version = require("./package.json").version; const fileName = distFolder + "/" + filePrefix + version; const minifiedFile = fileName + ".min.js"; const standardFile = fileName + ".js"; const sdkEntryPoint = "./index.js"; const standaloneVariableName = "SmartyStreetsSDK"; const options = { standalone: standaloneVariableName, }; let writeToDisk = (destination) => fs.createWriteStream(destination); let browserify = require("browserify"); browserify(sdkEntryPoint, options) .transform("babelify", {presets: ["env"]}) .bundle() .pipe(writeToDisk(standardFile)); browserify(sdkEntryPoint, options) .transform("babelify", {presets: ["env"]}) .plugin("tinyify") .bundle() .pipe(writeToDisk(minifiedFile)); }
gulp.task('js', () => { let bundler = browserify({ extensions: ['.js', '.jsx'], entries: paths.main_js, }) .transform('babelify', { presets: ['es2015', 'react'], plugins: ['transform-object-assign'], }); if (IS_PRODUCTION) { bundler = bundler.plugin('minifyify', { map: false, compress: { drop_debugger: true, drop_console: true, }, }); bundler = bundler.plugin('uglifyify', { global: true }); } bundler.bundle().on('error', (err) => debug('[browserify error]', err.message) ).pipe(source('bundle.js')) .pipe(gulp.dest('static/js')); });
packageCache: {} }) .plugin(watchify, { delay: 100, ignoreWatch: ['**/node_modules/**', '**/assets/**'],