1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
# Copyright 2023 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//tools/grit/preprocess_if_expr.gni")
import("//tools/typescript/webui_ts_library.gni")
import("//ui/webui/resources/tools/bundle_js.gni")
import("//ui/webui/resources/tools/minify_js.gni")
import("//ui/webui/webui_features.gni")
js_files = [
"constants.js",
"neterror.ts",
"dino_game/background_el.ts",
"dino_game/cloud.ts",
"dino_game/constants.ts",
"dino_game/dimensions.ts",
"dino_game/distance_meter.ts",
"dino_game/generated_sound_fx.ts",
"dino_game/game_over_panel.ts",
"dino_game/horizon_line.ts",
"dino_game/horizon.ts",
"dino_game/sprite_position.ts",
"dino_game/night_mode.ts",
"dino_game/obstacle.ts",
"dino_game/offline.js",
"dino_game/offline_sprite_definitions.ts",
"dino_game/trex.ts",
"dino_game/utils.ts",
]
preprocess_if_expr("preprocess") {
visibility = [ ":build_ts" ]
out_folder = "${target_gen_dir}/preprocessed"
in_files = js_files
if (is_ios) {
in_files += [ "error_page_controller_ios.js" ]
}
}
webui_ts_library("build_ts") {
visibility = [ ":bundle_js_internal" ]
root_dir = "${target_gen_dir}/preprocessed"
out_dir = "$target_gen_dir/tsc"
in_files = js_files
deps = [
"//third_party/lit/v3_0:build_ts",
"//ui/webui/resources/js:build_ts",
]
extra_deps = [ ":preprocess" ]
}
# Generate JS bundles for interstitials UIs. Always bundle regardless of the
# `optimize_webui` GN arg, as these UIs can't load any JS modules at runtime,
# since they are not proper WebUI pages and therefore are not backed up by any
# WebUIDataSource. Use `optimize_webui` only to decide whether to also minify.
group("bundle_js") {
if (optimize_webui) {
public_deps = [ ":minify_js" ]
} else {
public_deps = [ ":bundle_js_internal" ]
}
}
# Bundle without minifying.
bundle_js("bundle_js_internal") {
visibility = [
":bundle_js",
":minify_js",
]
# Using a dummy value for`host` which is ignored anyway since the code being
# bundled below is not served from any host.
host = "_ignored_"
input = rebase_path("${target_gen_dir}/tsc", root_build_dir)
out_folder = "${target_gen_dir}/bundled"
js_module_in_files = [ "neterror.js" ]
shared_interstitials_path =
rebase_path("${root_gen_dir}/components/security_interstitials/core/",
root_build_dir)
external_paths = [ "chrome://interstitials/|$shared_interstitials_path" ]
deps = [
":build_ts",
"../../security_interstitials/core/common/resources:preprocess",
"//third_party/lit/v3_0:build_min_js",
]
}
if (optimize_webui) {
# Bundle and minify.
minify_js("minify_js") {
visibility = [ ":bundle_js" ]
in_folder = "${target_gen_dir}/bundled"
out_folder = "${target_gen_dir}/minified"
in_files = [ "neterror.rollup.js" ]
deps = [ ":bundle_js_internal" ]
}
}
|