Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function buildPolyfills() {
const bundle = await rollup.rollup(common.inputOptions);
const file = common.adaptSlashes(`${CWD}/${ENV === constants.ENV.PROD ? 'dist' : '.tmp'}/app/es6-polyfills.js`);
// console.log(`Styleguide Bundel: ${file}`); // eslint-disable-line
// or write the bundle to disk
await bundle.write({
...common.outputOptions,
file,
});
}
var rollup = require( 'rollup' );
var fs = require('fs');
var path = require('path');
var ncp = require('ncp').ncp;
var es2015Entry = path.join(__dirname, '../node_modules/ionic-ui/es2015/index.js');
var es2015Dest = es2015Entry;
var npmPackageJsonSource = path.join(__dirname, './npm.package.json');
var npmPackageJsonDest = path.join(path.dirname(es2015Dest), '../package.json');
var npmPackageJsonContent = fs.readFileSync(npmPackageJsonSource).toString();
fs.writeFileSync(npmPackageJsonDest, npmPackageJsonContent);
rollup.rollup({
entry: es2015Entry
}).then(function (bundle) {
// Generate bundle + sourcemap
var result = bundle.generate({
format: 'es'
});
fs.writeFileSync(es2015Dest, result.code);
var source = path.dirname(es2015Entry, '..');
deepCopy(source, path.join(__dirname, '../demos/angular/node_modules/ionic-ui'));
});
async function bundleDevServer() {
const rollupBuild = await rollup.rollup({
input: ENTRY_FILE,
external: [
'buffer',
'child_process',
'crypto',
'events',
'fs',
'http',
'https',
'net',
'os',
'path',
'querystring',
'url',
'zlib',
],
readme.plugin(),
headerComment(),
topLevelOptions(),
eslint({})
]
};
const outputOptions = {
file: `${outputDir}${src}.js`,
format: "iife",
globals: {
bitsy: 'window'
}
};
return rollup.rollup(inputOptions)
.then(bundle => {
return bundle.write(outputOptions);
});
}
function rollupBundle ({ env }) {
return rollup({
entry: 'src/index.js',
plugins: [
node({
extensions: ['.js', '.jsx']
}),
cjs(),
jsx({ factory: 'h' }),
replace(Object.assign({
__VERSION__: version
}, env)),
buble({
objectAssign: 'Object.assign'
})
]
})
}
get prodBuilder(): Observable {
return Observable.fromPromise(rollup.rollup({
entry: path.resolve(__dirname, '../../aot/src/main.aot.js'),
context: 'this',
plugins: [
angular({
preprocessors: {
style: (scss: string, path: string) => {
return sass.renderSync({ file: path, outputStyle: 'compressed' }).css;
}
}
}),
commonjs(),
nodeResolve(),
progress()
]
}));
};
return new Promise((resolve, reject) => {
rollup.rollup(config).then(bundle => {
bundle.write(config.output).then(() => {
report(config.output.file)
resolve()
})
})
})
}
}
const [mainOutputPath, ...otherOutputPaths] = Packaging.getBundleOutputPaths(
"UNIVERSAL",
filename,
packageName
)
const rollupOutputOptions = getRollupOutputOptions(
mainOutputPath,
format,
peerGlobals,
bundle.global
)
const spinner = ora(logKey).start()
try {
const result = await rollup(rollupConfig)
await result.write(rollupOutputOptions)
} catch (error) {
spinner.fail()
handleRollupError(error)
throw error
}
for (let i = 0; i < otherOutputPaths.length; i++) {
await asyncCopyTo(mainOutputPath, otherOutputPaths[i])
}
spinner.succeed()
}
devMainBuilder(tempDir: string): Observable {
return Observable.fromPromise(rollup.rollup({
entry: path.resolve(__dirname, '../../src/main.ts'),
cache: this.cache,
context: 'this',
plugins: [
angular({
preprocessors: {
style: (scss: string, path: string) => {
return sass.renderSync({ file: path, outputStyle: 'compressed' }).css;
}
}
}),
tsr({
typescript: require('../../node_modules/typescript')
}),
commonjs(),
nodeResolve({ jsnext: true, main: true, browser: true }),
function buildEntry(config) {
const output = config.output
const { file } = output
return rollup.rollup(config)
.then(bundle => bundle.generate(output))
.then((res) => {
return write(file, res.output[0].code)
})
}