Create deploy phases for Polymer. Note that inlining HTML Imports
comes first (other than linter, if options.linter
is enabled), which
allows the rest of the HTML-processing phases to operate only on HTML that
is actually imported.
List<List<Transformer>> createDeployPhases(TransformOptions options,
{String sdkDir}) {
// TODO(sigmund): this should be done differently. We should lint everything
// that is reachable and have the option to lint the rest (similar to how
// dart2js can analyze reachable code or entire libraries).
var phases = [];
phases.addAll([
/// Must happen first, temporarily rewrites <link rel="x-dart-test"> tags to
/// <script type="application/dart" _was_test></script> tags.
[new web_components.RewriteXDartTestToScript(options.entryPoints)],
[new web_components.ScriptCompactorTransformer(options.entryPoints)],
[new PolymerBootstrapTransformer(options)],
]);
// Lint after injecting @HtmlImport imports otherwise we will likely have
// incorrect warnings about missing elements.
if (options.lint.enabled) phases.add([new Linter(options)]);
phases.addAll([
[
new web_components.ImportInlinerTransformer(
options.entryPoints, ['[[', '{{'])
],
[new HtmlFinalizer(options)],
[
new ObservableTransformer(
releaseMode: options.releaseMode,
injectBuildLogsInOutput: options.injectBuildLogsInOutput)
],
// TODO(jakemac): Move to web_components.
[new PolyfillInjector(options)],
[new BuildFilter(options)],
[new BuildLogCombiner(options)],
]);
if (!options.releaseMode) {
phases.add([new IndexPageBuilder(options)]);
}
/// Must happen last, rewrites
/// <script type="application/dart" _was_test></script> tags back to
/// <link rel="x-dart-test"> tags.
phases.add(
[new web_components.RewriteScriptToXDartTest(options.entryPoints)]);
return phases;
}