Skip to content

Commit bce5e23

Browse files
iterianipkozlowski-opensource
authored andcommitted
feat(core): Add build target for jsaction contract binary. (#55319)
Right now this binary sits at 9.5kb. Additional changes to the library will be done to reduce the binary size, such as converting event_type from an enum to an object, and other code size reductions. PR Close #55319
1 parent 7d5bc1c commit bce5e23

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

packages/core/primitives/event-dispatch/BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
load("//tools:defaults.bzl", "ts_library", "tsec_test")
2+
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
3+
load("@npm//@bazel/terser:index.bzl", "terser_minified")
24

35
package(default_visibility = ["//visibility:public"])
46

@@ -26,3 +28,16 @@ filegroup(
2628
]),
2729
visibility = ["//visibility:public"],
2830
)
31+
32+
rollup_bundle(
33+
name = "bundled_contract_binary_tmp",
34+
entry_point = ":contract_binary.ts",
35+
format = "esm",
36+
deps = [":event-dispatch"],
37+
)
38+
39+
terser_minified(
40+
name = "bundle",
41+
src = ":bundled_contract_binary_tmp",
42+
config_file = ":terser.config.json",
43+
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
10+
import {bootstrapEventContract} from './src/register_events';
11+
12+
(window as any)['__jsaction_bootstrap'] = bootstrapEventContract;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"ecma": "es2020",
3+
"compress": {
4+
"toplevel": true,
5+
"passes": 2,
6+
"pure_getters": true
7+
},
8+
"mangle": {
9+
"toplevel": true,
10+
"properties": true,
11+
"keep_classnames": false,
12+
"keep_fnames": false
13+
},
14+
"format": {
15+
"ecma": "es2020",
16+
"ascii_only": true,
17+
"wrap_func_args": false,
18+
"comments": false
19+
}
20+
}

0 commit comments

Comments
 (0)