How to use the google-closure-compiler/lib/utils.js.getNativeImagePath 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 / rollup-plugin-closure-compiler / src / compiler.ts View on Github external
return new Promise((resolve: (stdOut: string) => void, reject: (error: any) => void) => {
    const [config, platform] = filterContent(compileOptions);
    const instance = new compiler(config);
    const firstSupportedPlatform = getFirstSupportedPlatform(orderPlatforms(platform));

    if (firstSupportedPlatform !== Platform.JAVA) {
      // TODO(KB): Provide feedback on this API. It's a little strange to nullify the JAR_PATH
      // and provide a fake java path.
      instance.JAR_PATH = null;
      instance.javaPath = getNativeImagePath();
    }

    instance.run(async (exitCode: number, code: string, stdErr: string) => {
      if (
        'warning_level' in compileOptions &&
        compileOptions.warning_level === 'VERBOSE' &&
        stdErr !== ''
      ) {
        reject(new Error(`Google Closure Compiler ${stdErr}`));
      } else if (exitCode !== 0) {
        reject(new Error(`Google Closure Compiler exit ${exitCode}: ${stdErr}`));
      } else {
        resolve(await postCompilation(code, transforms));
      }
    });
  });