This change marks all relevant define* callsites as pure, causing the compiler to emmit either @__PURE__ or @pureOrBreakMyCode annotation based on whether we are compiling code annotated for closure or terser. This change is needed in g3 where we don't run build optimizer but we need the code to be annotated for the closure compiler. Additionally this change allows for simplification of CLI and build optimizer as they will no longer need to rewrite the generated code (there are still other places where a build optimizer rewrite will be necessary so we can't remove it, we can only simplify it). PR Close #41096
Bundle
js_expected_symbol_test
This folder contains tests which assert that most of the code is tree shaken away. This is asserted by keeping gold files of all symbols which are expected to be retained. When doing renaming it is often necessary to update the gold files, to do so use these commands:
yarn bazel run --config=ivy //packages/core/test/bundling/injection:symbol_test.accept
yarn bazel run --config=ivy //packages/core/test/bundling/cyclic_import:symbol_test.accept
yarn bazel run --config=ivy //packages/core/test/bundling/forms:symbol_test.accept
yarn bazel run --config=ivy //packages/core/test/bundling/hello_world:symbol_test.accept
yarn bazel run --config=ivy //packages/core/test/bundling/router:symbol_test.accept
yarn bazel run --config=ivy //packages/core/test/bundling/todo:symbol_test.accept
Running all symbol tests
To run all symbol tests with one command, you can use the following scripts:
yarn run symbol-extractor:check
yarn run symbol-extractor:update