Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const SPLIT_MARKER = `/** SPLIT${Math.floor(Math.random() * 10000)} */`;
// Since we no longer pass the process_common_js_modules flag to closure
// compiler, we must now tranform these common JS node_modules to ESM before
// passing them to closure.
// TODO(rsimha, erwinmombay): Derive this list programmatically if possible.
const commonJsModules = [
'node_modules/dompurify/',
'node_modules/promise-pjs/',
'node_modules/set-dom/',
];
// Override to local closure compiler JAR
ClosureCompiler.JAR_PATH = require.resolve('./runner/dist/runner.jar');
const mainBundle = 'src/amp.js';
const extensionsInfo = {};
let extensions = extensionBundles.concat(altMainBundles)
.filter(unsupportedExtensions).map(ext => {
const path = buildFullPathFromConfig(ext);
if (Array.isArray(path)) {
path.forEach((p, index) => {
extensionsInfo[p] = Object.create(ext);
extensionsInfo[p].filename = ext.name + '-' + ext.version[index];
});
} else {
extensionsInfo[path] = Object.create(ext);
if (isAltMainBundle(ext.name) && ext.path) {
extensionsInfo[path].filename = ext.name;
} else {
*/
var ClosureCompiler = require('google-closure-compiler').compiler;
var Promise = require('bluebird');
var babel = require('babelify');
var browserify = require('browserify');
var through = require('through2');
var devnull = require('dev-null');
var relativePath = require('path').relative;
var path = require('path');
var fs = require('fs');
var findPackageJsonPath = require('find-root');
const TopologicalSort = require('topological-sort');
// Override to local closure compiler JAR
ClosureCompiler.JAR_PATH = require.resolve(
'./third_party/closure-compiler/closure-compiler-1.0-SNAPSHOT.jar');
exports.splittable = function(config) {
if (!config || !config.modules) {
return Promise.reject(
new Error('Pass an array of entry modules via modules option. ' +
'Example: {modules: ["./first", "./second"]}'));
}
return exports.getFlags(config).then(function(flagsArray) {
return new Promise(function(resolve, reject) {
new ClosureCompiler(flagsArray).run(function(exitCode, stdOut, stdErr) {
if (exitCode == 0) {
resolve({
warnings: stdErr,
'use strict';
var fs = require('fs');
var Compiler = require('google-closure-compiler').compiler;
if (fs.existsSync(Compiler.JAR_PATH) &&
Compiler.JAR_PATH.indexOf('snapshot') < 0) {
console.log('ok');
}
'use strict';
var fs = require('fs');
var Compiler = require('google-closure-compiler').compiler;
if (fs.existsSync(Compiler.JAR_PATH) &&
Compiler.JAR_PATH.indexOf('snapshot') < 0) {
console.log('ok');
}