UNPKG

2.45 kBTypeScriptView Raw
1/**
2 * Copyright 2018 The AMP HTML Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS-IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16import { ChunkTransform } from './transform';
17import { OutputOptions } from 'rollup';
18import { CompileOptions } from 'google-closure-compiler';
19import { PluginOptions } from './types';
20export declare const ERROR_WARNINGS_ENABLED_LANGUAGE_OUT_UNSPECIFIED = "Providing the warning_level=VERBOSE compile option also requires a valid language_out compile option.";
21export declare const ERROR_WARNINGS_ENABLED_LANGUAGE_OUT_INVALID = "Providing the warning_level=VERBOSE and language_out=NO_TRANSPILE compile options will remove warnings.";
22/**
23 * Checks if output format is ESM
24 * @param outputOptions
25 * @return boolean
26 */
27export declare const isESMFormat: ({ format }: OutputOptions) => boolean;
28/**
29 * Pluck the PluginOptions from the CompileOptions
30 * @param compileOptions
31 */
32export declare function pluckPluginOptions(compileOptions: CompileOptions): PluginOptions;
33/**
34 * Generate default Closure Compiler CompileOptions an author can override if they wish.
35 * These must be derived from configuration or input sources.
36 * @param transformers
37 * @param options
38 * @return derived CompileOptions for Closure Compiler
39 */
40export declare const defaults: (options: OutputOptions, providedExterns: Array<string>, transformers: Array<ChunkTransform> | null) => Promise<CompileOptions>;
41/**
42 * Compile Options is the final configuration to pass into Closure Compiler.
43 * defaultCompileOptions are overrideable by ones passed in directly to the plugin
44 * but the js source and sourcemap are not overrideable, since this would break the output if passed.
45 * @param compileOptions
46 * @param outputOptions
47 * @param code
48 * @param transforms
49 */
50export default function (incomingCompileOptions: CompileOptions, outputOptions: OutputOptions, code: string, transforms: Array<ChunkTransform> | null): Promise<[CompileOptions, string]>;