How to use the google-closure-compiler.compiler.JAR_PATH function in google-closure-compiler

To help you get started, we’ve selected a few google-closure-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ampproject / amphtml / build-system / single-pass.js View on Github external
}

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 {
github cramforce / splittable / splittable.js View on Github external
*/

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,
github zeit / pkg / test / test-79-npm / google-closure-compiler / google-closure-compiler.js View on Github external
'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');
}
github zeit / pkg / test / test-79-npm / google-closure-compiler / google-closure-compiler.js View on Github external
'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');
}