Version 2.18.0-16.0.dev

Merge commit 'ecf42a3815be369c6a03899639682f7929055931' into 'dev'
diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json
deleted file mode 100644
index c37cde6..0000000
--- a/.dart_tool/package_config.json
+++ /dev/null
@@ -1,825 +0,0 @@
-{
-  "copyright": [
-    "Copyright (c) 2022, the Dart project authors. Please see the AUTHORS ",
-    "file for details. All rights reserved. Use of this source code is ",
-    "governed by a BSD-style license that can be found in the LICENSE file."
-  ],
-  "comment": [
-    "Package configuration for all packages in /pkg, and checked out by DEPS",
-    "into /third_party/pkg and /third_party/pkg_tested.",
-    "If you add a package to DEPS or /pkg or change a package's SDK",
-    "constraint, update this by running tools/generate_package_config.dart."
-  ],
-  "configVersion": 2,
-  "generator": "tools/generate_package_config.dart",
-  "packages": [
-    {
-      "name": "_fe_analyzer_shared",
-      "rootUri": "../pkg/_fe_analyzer_shared",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "_fe_analyzer_shared_assigned_variables",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_definite_assignment",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_definite_unassignment",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_inheritance",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/inheritance",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_nullability",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/nullability",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_reachability",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/reachability",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_type_promotion",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_fe_analyzer_shared_why_not_promoted",
-      "rootUri": "../pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "_js_interop_checks",
-      "rootUri": "../pkg/_js_interop_checks",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "analysis_server",
-      "rootUri": "../pkg/analysis_server",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "analysis_server_client",
-      "rootUri": "../pkg/analysis_server_client",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "analyzer",
-      "rootUri": "../pkg/analyzer",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "analyzer_cli",
-      "rootUri": "../pkg/analyzer_cli",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "analyzer_plugin",
-      "rootUri": "../pkg/analyzer_plugin",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "analyzer_utilities",
-      "rootUri": "../pkg/analyzer_utilities",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "args",
-      "rootUri": "../third_party/pkg/args",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "async",
-      "rootUri": "../third_party/pkg/async",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "async_helper",
-      "rootUri": "../pkg/async_helper",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "bazel_worker",
-      "rootUri": "../third_party/pkg/bazel_worker",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "benchmark_harness",
-      "rootUri": "../third_party/pkg/benchmark_harness",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "boolean_selector",
-      "rootUri": "../third_party/pkg/boolean_selector",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "browser_launcher",
-      "rootUri": "../third_party/pkg/browser_launcher",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "build_integration",
-      "rootUri": "../pkg/build_integration",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "characters",
-      "rootUri": "../third_party/pkg/characters",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "charcode",
-      "rootUri": "../third_party/pkg/charcode",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "cli_util",
-      "rootUri": "../third_party/pkg/cli_util",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "clock",
-      "rootUri": "../third_party/pkg/clock",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "collection",
-      "rootUri": "../third_party/pkg/collection",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "compiler",
-      "rootUri": "../pkg/compiler",
-      "packageUri": "lib/",
-      "languageVersion": "2.16"
-    },
-    {
-      "name": "convert",
-      "rootUri": "../third_party/pkg/convert",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "crypto",
-      "rootUri": "../third_party/pkg/crypto",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "csslib",
-      "rootUri": "../third_party/pkg/csslib",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dart2js_info",
-      "rootUri": "../pkg/dart2js_info",
-      "packageUri": "lib/",
-      "languageVersion": "2.11"
-    },
-    {
-      "name": "dart2js_runtime_metrics",
-      "rootUri": "../pkg/dart2js_runtime_metrics",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "dart2js_tools",
-      "rootUri": "../pkg/dart2js_tools",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dart2native",
-      "rootUri": "../pkg/dart2native",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dart2wasm",
-      "rootUri": "../pkg/dart2wasm",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dart_internal",
-      "rootUri": "../pkg/dart_internal",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dart_style",
-      "rootUri": "../third_party/pkg_tested/dart_style",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dartdev",
-      "rootUri": "../pkg/dartdev",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "dartdoc",
-      "rootUri": "../third_party/pkg/dartdoc",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "dds",
-      "rootUri": "../pkg/dds",
-      "packageUri": "lib/",
-      "languageVersion": "2.13"
-    },
-    {
-      "name": "dds_service_extensions",
-      "rootUri": "../pkg/dds_service_extensions",
-      "packageUri": "lib/",
-      "languageVersion": "2.13"
-    },
-    {
-      "name": "dev_compiler",
-      "rootUri": "../pkg/dev_compiler",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "devtools_shared",
-      "rootUri": "../third_party/devtools/devtools_shared",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "expect",
-      "rootUri": "../pkg/expect",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "ffi",
-      "rootUri": "../third_party/pkg/ffi",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "file",
-      "rootUri": "../third_party/pkg/file/packages/file",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "file_testing",
-      "rootUri": "../third_party/pkg/file/packages/file_testing",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "fixnum",
-      "rootUri": "../third_party/pkg/fixnum",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "front_end",
-      "rootUri": "../pkg/front_end",
-      "packageUri": "lib/",
-      "languageVersion": "2.13"
-    },
-    {
-      "name": "front_end_testcases",
-      "rootUri": "../pkg/front_end/testcases",
-      "packageUri": ".nonexisting/"
-    },
-    {
-      "name": "frontend_server",
-      "rootUri": "../pkg/frontend_server",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "frontend_server_client",
-      "rootUri": "../third_party/pkg/webdev/frontend_server_client",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "glob",
-      "rootUri": "../third_party/pkg/glob",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "html",
-      "rootUri": "../third_party/pkg/html",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "http",
-      "rootUri": "../third_party/pkg/http",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "http_io",
-      "rootUri": "../third_party/pkg_tested/http_io",
-      "packageUri": "lib/",
-      "languageVersion": "2.5"
-    },
-    {
-      "name": "http_multi_server",
-      "rootUri": "../third_party/pkg/http_multi_server",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "http_parser",
-      "rootUri": "../third_party/pkg/http_parser",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "intl",
-      "rootUri": "../third_party/pkg/intl",
-      "packageUri": "lib/",
-      "languageVersion": "2.11"
-    },
-    {
-      "name": "js",
-      "rootUri": "../pkg/js",
-      "packageUri": "lib/",
-      "languageVersion": "2.16"
-    },
-    {
-      "name": "js_ast",
-      "rootUri": "../pkg/js_ast",
-      "packageUri": "lib/",
-      "languageVersion": "2.16"
-    },
-    {
-      "name": "js_runtime",
-      "rootUri": "../pkg/js_runtime",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "json_rpc_2",
-      "rootUri": "../third_party/pkg/json_rpc_2",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "kernel",
-      "rootUri": "../pkg/kernel",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "language_versioning_2.7_test",
-      "rootUri": "../pkg/language_versioning_2.7_test",
-      "languageVersion": "2.7"
-    },
-    {
-      "name": "linter",
-      "rootUri": "../third_party/pkg/linter",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "lints",
-      "rootUri": "../third_party/pkg/lints",
-      "packageUri": "lib/",
-      "languageVersion": "2.17"
-    },
-    {
-      "name": "logging",
-      "rootUri": "../third_party/pkg/logging",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "markdown",
-      "rootUri": "../third_party/pkg/markdown",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "matcher",
-      "rootUri": "../third_party/pkg/matcher",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "meta",
-      "rootUri": "../pkg/meta",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "mime",
-      "rootUri": "../third_party/pkg/mime",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "mockito",
-      "rootUri": "../third_party/pkg/mockito",
-      "packageUri": "lib/",
-      "languageVersion": "2.0"
-    },
-    {
-      "name": "modular_test",
-      "rootUri": "../pkg/modular_test",
-      "packageUri": "lib/",
-      "languageVersion": "2.10"
-    },
-    {
-      "name": "native_stack_traces",
-      "rootUri": "../pkg/native_stack_traces",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "nnbd_migration",
-      "rootUri": "../pkg/nnbd_migration",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "oauth2",
-      "rootUri": "../third_party/pkg/oauth2",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "observatory",
-      "rootUri": "../runtime/observatory",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "observatory_2",
-      "rootUri": "../runtime/observatory_2",
-      "packageUri": "lib/",
-      "languageVersion": "2.6"
-    },
-    {
-      "name": "observatory_test_package",
-      "rootUri": "../runtime/observatory/tests/service/observatory_test_package",
-      "languageVersion": "2.9"
-    },
-    {
-      "name": "observatory_test_package_2",
-      "rootUri": "../runtime/observatory_2/tests/service_2/observatory_test_package_2",
-      "languageVersion": "2.7"
-    },
-    {
-      "name": "package_config",
-      "rootUri": "../third_party/pkg_tested/package_config",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "package_deps",
-      "rootUri": "../tools/package_deps",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "path",
-      "rootUri": "../third_party/pkg/path",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "pedantic",
-      "rootUri": "../third_party/pkg/pedantic",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "platform",
-      "rootUri": "../third_party/pkg/platform",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "pool",
-      "rootUri": "../third_party/pkg/pool",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "process",
-      "rootUri": "../third_party/pkg/process",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "protobuf",
-      "rootUri": "../third_party/pkg/protobuf/protobuf",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "pub",
-      "rootUri": "../third_party/pkg/pub",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "pub_semver",
-      "rootUri": "../third_party/pkg/pub_semver",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "scrape",
-      "rootUri": "../pkg/scrape",
-      "packageUri": "lib/",
-      "languageVersion": "2.13"
-    },
-    {
-      "name": "sdk_library_metadata",
-      "rootUri": "../sdk/lib/_internal/sdk_library_metadata",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "shelf",
-      "rootUri": "../third_party/pkg/shelf",
-      "packageUri": "lib/",
-      "languageVersion": "2.16"
-    },
-    {
-      "name": "shelf_packages_handler",
-      "rootUri": "../third_party/pkg/shelf_packages_handler",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "shelf_proxy",
-      "rootUri": "../third_party/pkg/shelf_proxy",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "shelf_static",
-      "rootUri": "../third_party/pkg/shelf_static",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "shelf_web_socket",
-      "rootUri": "../third_party/pkg/shelf_web_socket",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "smith",
-      "rootUri": "../pkg/smith",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "source_map_stack_trace",
-      "rootUri": "../third_party/pkg/source_map_stack_trace",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "source_maps",
-      "rootUri": "../third_party/pkg/source_maps",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "source_span",
-      "rootUri": "../third_party/pkg/source_span",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "sourcemap_testing",
-      "rootUri": "../pkg/sourcemap_testing",
-      "packageUri": "lib/",
-      "languageVersion": "2.1"
-    },
-    {
-      "name": "sse",
-      "rootUri": "../third_party/pkg/sse",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "stack_trace",
-      "rootUri": "../third_party/pkg/stack_trace",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "status_file",
-      "rootUri": "../pkg/status_file",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "stream_channel",
-      "rootUri": "../third_party/pkg/stream_channel",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "string_scanner",
-      "rootUri": "../third_party/pkg/string_scanner",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "sync_http",
-      "rootUri": "../third_party/pkg/sync_http",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "telemetry",
-      "rootUri": "../pkg/telemetry",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "term_glyph",
-      "rootUri": "../third_party/pkg/term_glyph",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test",
-      "rootUri": "../third_party/pkg/test/pkgs/test",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "test_api",
-      "rootUri": "../third_party/pkg/test/pkgs/test_api",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test_core",
-      "rootUri": "../third_party/pkg/test/pkgs/test_core",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "test_descriptor",
-      "rootUri": "../third_party/pkg/test_descriptor",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test_package",
-      "rootUri": "../pkg/vm_service/test/test_package",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test_process",
-      "rootUri": "../third_party/pkg/test_process",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test_reflective_loader",
-      "rootUri": "../third_party/pkg/test_reflective_loader",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "test_runner",
-      "rootUri": "../pkg/test_runner",
-      "packageUri": "lib/",
-      "languageVersion": "2.3"
-    },
-    {
-      "name": "testing",
-      "rootUri": "../pkg/testing",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "typed_data",
-      "rootUri": "../third_party/pkg/typed_data",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "usage",
-      "rootUri": "../third_party/pkg/usage",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "vector_math",
-      "rootUri": "../third_party/pkg/vector_math",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "vm",
-      "rootUri": "../pkg/vm",
-      "packageUri": "lib/",
-      "languageVersion": "2.15"
-    },
-    {
-      "name": "vm_service",
-      "rootUri": "../pkg/vm_service",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "vm_snapshot_analysis",
-      "rootUri": "../pkg/vm_snapshot_analysis",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "wasm_builder",
-      "rootUri": "../pkg/wasm_builder",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "watcher",
-      "rootUri": "../third_party/pkg/watcher",
-      "packageUri": "lib/",
-      "languageVersion": "2.14"
-    },
-    {
-      "name": "web_components",
-      "rootUri": "../third_party/pkg/web_components",
-      "packageUri": "lib/",
-      "languageVersion": "1.9"
-    },
-    {
-      "name": "web_socket_channel",
-      "rootUri": "../third_party/pkg/web_socket_channel",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "webdriver",
-      "rootUri": "../third_party/pkg/webdriver",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "webkit_inspection_protocol",
-      "rootUri": "../third_party/pkg/webkit_inspection_protocol",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "yaml",
-      "rootUri": "../third_party/pkg/yaml",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    },
-    {
-      "name": "yaml_edit",
-      "rootUri": "../third_party/pkg/yaml_edit",
-      "packageUri": "lib/",
-      "languageVersion": "2.12"
-    }
-  ]
-}
diff --git a/.gitignore b/.gitignore
index 1f4ccc7..9c674bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -75,6 +75,10 @@
 packages
 pubspec.lock
 
+# The top level package files (these are auto-generated per checkout)
+/.dart_tool/package_config.json
+/.packages
+
 # Local pub storage
 .pub
 
diff --git a/.packages b/.packages
deleted file mode 100644
index 646a631..0000000
--- a/.packages
+++ /dev/null
@@ -1,130 +0,0 @@
-# Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-#
-# This file is generated; do not edit. To re-generate, run:
-#   'dart tools/generate_package_config.dart'.
-
-_fe_analyzer_shared:pkg/_fe_analyzer_shared/lib
-_js_interop_checks:pkg/_js_interop_checks/lib
-analysis_server:pkg/analysis_server/lib
-analysis_server_client:pkg/analysis_server_client/lib
-analyzer:pkg/analyzer/lib
-analyzer_cli:pkg/analyzer_cli/lib
-analyzer_plugin:pkg/analyzer_plugin/lib
-analyzer_utilities:pkg/analyzer_utilities/lib
-args:third_party/pkg/args/lib
-async:third_party/pkg/async/lib
-async_helper:pkg/async_helper/lib
-bazel_worker:third_party/pkg/bazel_worker/lib
-benchmark_harness:third_party/pkg/benchmark_harness/lib
-boolean_selector:third_party/pkg/boolean_selector/lib
-browser_launcher:third_party/pkg/browser_launcher/lib
-build_integration:pkg/build_integration/lib
-characters:third_party/pkg/characters/lib
-charcode:third_party/pkg/charcode/lib
-cli_util:third_party/pkg/cli_util/lib
-clock:third_party/pkg/clock/lib
-collection:third_party/pkg/collection/lib
-compiler:pkg/compiler/lib
-convert:third_party/pkg/convert/lib
-crypto:third_party/pkg/crypto/lib
-csslib:third_party/pkg/csslib/lib
-dart2js_info:pkg/dart2js_info/lib
-dart2js_runtime_metrics:pkg/dart2js_runtime_metrics/lib
-dart2js_tools:pkg/dart2js_tools/lib
-dart2native:pkg/dart2native/lib
-dart2wasm:pkg/dart2wasm/lib
-dart_internal:pkg/dart_internal/lib
-dart_style:third_party/pkg_tested/dart_style/lib
-dartdev:pkg/dartdev/lib
-dartdoc:third_party/pkg/dartdoc/lib
-dds:pkg/dds/lib
-dds_service_extensions:pkg/dds_service_extensions/lib
-dev_compiler:pkg/dev_compiler/lib
-devtools_shared:third_party/devtools/devtools_shared/lib
-expect:pkg/expect/lib
-ffi:third_party/pkg/ffi/lib
-file:third_party/pkg/file/packages/file/lib
-file_testing:third_party/pkg/file/packages/file_testing/lib
-fixnum:third_party/pkg/fixnum/lib
-front_end:pkg/front_end/lib
-frontend_server:pkg/frontend_server/lib
-frontend_server_client:third_party/pkg/webdev/frontend_server_client/lib
-glob:third_party/pkg/glob/lib
-html:third_party/pkg/html/lib
-http:third_party/pkg/http/lib
-http_io:third_party/pkg_tested/http_io/lib
-http_multi_server:third_party/pkg/http_multi_server/lib
-http_parser:third_party/pkg/http_parser/lib
-intl:third_party/pkg/intl/lib
-js:pkg/js/lib
-js_ast:pkg/js_ast/lib
-js_runtime:pkg/js_runtime/lib
-json_rpc_2:third_party/pkg/json_rpc_2/lib
-kernel:pkg/kernel/lib
-linter:third_party/pkg/linter/lib
-lints:third_party/pkg/lints/lib
-logging:third_party/pkg/logging/lib
-markdown:third_party/pkg/markdown/lib
-matcher:third_party/pkg/matcher/lib
-meta:pkg/meta/lib
-mime:third_party/pkg/mime/lib
-mockito:third_party/pkg/mockito/lib
-modular_test:pkg/modular_test/lib
-native_stack_traces:pkg/native_stack_traces/lib
-nnbd_migration:pkg/nnbd_migration/lib
-oauth2:third_party/pkg/oauth2/lib
-observatory:runtime/observatory/lib
-observatory_2:runtime/observatory_2/lib
-package_config:third_party/pkg_tested/package_config/lib
-path:third_party/pkg/path/lib
-pedantic:third_party/pkg/pedantic/lib
-platform:third_party/pkg/platform/lib
-pool:third_party/pkg/pool/lib
-process:third_party/pkg/process/lib
-protobuf:third_party/pkg/protobuf/protobuf/lib
-pub:third_party/pkg/pub/lib
-pub_semver:third_party/pkg/pub_semver/lib
-scrape:pkg/scrape/lib
-sdk_library_metadata:sdk/lib/_internal/sdk_library_metadata/lib
-shelf:third_party/pkg/shelf/lib
-shelf_packages_handler:third_party/pkg/shelf_packages_handler/lib
-shelf_proxy:third_party/pkg/shelf_proxy/lib
-shelf_static:third_party/pkg/shelf_static/lib
-shelf_web_socket:third_party/pkg/shelf_web_socket/lib
-smith:pkg/smith/lib
-source_map_stack_trace:third_party/pkg/source_map_stack_trace/lib
-source_maps:third_party/pkg/source_maps/lib
-source_span:third_party/pkg/source_span/lib
-sourcemap_testing:pkg/sourcemap_testing/lib
-sse:third_party/pkg/sse/lib
-stack_trace:third_party/pkg/stack_trace/lib
-status_file:pkg/status_file/lib
-stream_channel:third_party/pkg/stream_channel/lib
-string_scanner:third_party/pkg/string_scanner/lib
-sync_http:third_party/pkg/sync_http/lib
-telemetry:pkg/telemetry/lib
-term_glyph:third_party/pkg/term_glyph/lib
-test:third_party/pkg/test/pkgs/test/lib
-test_api:third_party/pkg/test/pkgs/test_api/lib
-test_core:third_party/pkg/test/pkgs/test_core/lib
-test_descriptor:third_party/pkg/test_descriptor/lib
-test_process:third_party/pkg/test_process/lib
-test_reflective_loader:third_party/pkg/test_reflective_loader/lib
-test_runner:pkg/test_runner/lib
-testing:pkg/testing/lib
-typed_data:third_party/pkg/typed_data/lib
-usage:third_party/pkg/usage/lib
-vector_math:third_party/pkg/vector_math/lib
-vm:pkg/vm/lib
-vm_service:pkg/vm_service/lib
-vm_snapshot_analysis:pkg/vm_snapshot_analysis/lib
-wasm_builder:pkg/wasm_builder/lib
-watcher:third_party/pkg/watcher/lib
-web_components:third_party/pkg/web_components/lib
-web_socket_channel:third_party/pkg/web_socket_channel/lib
-webdriver:third_party/pkg/webdriver/lib
-webkit_inspection_protocol:third_party/pkg/webkit_inspection_protocol/lib
-yaml:third_party/pkg/yaml/lib
-yaml_edit:third_party/pkg/yaml_edit/lib
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index fc93703..6a47593 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -237,31 +237,6 @@
     return []
 
 
-def _CheckPackageConfigUpToDate(input_api, output_api):
-    """Checks that .dart_tool/package_config.json is up to date."""
-    # Run only if DEPS file or package_config.json have been modified.
-    if not any(p == 'DEPS' or p == '.dart_tool/package_config.json' or
-               p.endswith('pubspec.yaml') for p in input_api.LocalPaths()):
-        return []
-    local_root = input_api.change.RepositoryRoot()
-    utils = imp.load_source('utils',
-                            os.path.join(local_root, 'tools', 'utils.py'))
-
-    dart = utils.CheckedInSdkExecutable()
-    generate = os.path.join(local_root, 'tools', 'generate_package_config.dart')
-    cmd = [dart, generate, '--check']
-    result = subprocess.run(cmd, shell=utils.IsWindows())
-    if result.returncode != 0:
-        return [
-            output_api.PresubmitError(
-                'File .dart_tool/package_config.json is out of date.\n'
-                'Fix these issues with:\n'
-                'gclient sync -D && %s tools/generate_package_config.dart' %
-                (dart))
-        ]
-    return []
-
-
 def _CheckValidHostsInDEPS(input_api, output_api):
     """Checks that DEPS file deps are from allowed_hosts."""
     # Run only if DEPS file has been modified to annoy fewer bystanders.
@@ -382,7 +357,6 @@
     results.extend(_CheckLayering(input_api, output_api))
     results.extend(_CheckClangTidy(input_api, output_api))
     results.extend(_CheckTestMatrixValid(input_api, output_api))
-    results.extend(_CheckPackageConfigUpToDate(input_api, output_api))
     results.extend(
         input_api.canned_checks.CheckPatchFormatted(input_api, output_api))
     return results
diff --git a/pkg/_js_interop_checks/lib/src/js_interop.dart b/pkg/_js_interop_checks/lib/src/js_interop.dart
index 26c0c7d..9874a1c 100644
--- a/pkg/_js_interop_checks/lib/src/js_interop.dart
+++ b/pkg/_js_interop_checks/lib/src/js_interop.dart
@@ -3,6 +3,7 @@
 // BSD-style license that can be found in the LICENSE file.
 
 import 'package:kernel/kernel.dart';
+import 'package:kernel/util/graph.dart' as kernel_graph;
 
 /// Returns true iff the node has an `@JS(...)` annotation from `package:js` or
 /// from the internal `dart:_js_annotations`.
@@ -54,17 +55,20 @@
 }
 
 final _packageJs = Uri.parse('package:js/js.dart');
+final _jsWasm = Uri.parse('dart:js_wasm');
 final _internalJs = Uri.parse('dart:_js_annotations');
 final _jsHelper = Uri.parse('dart:_js_helper');
 
+bool _isAnyInteropUri(Uri uri) =>
+    uri == _packageJs || uri == _internalJs || uri == _jsWasm;
+
 /// Returns true if [value] is the interop annotation whose class is
 /// [annotationClassName] from `package:js` or from `dart:_js_annotations`.
 bool _isInteropAnnotation(Expression value, String annotationClassName) {
   var c = _annotationClass(value);
   return c != null &&
       c.name == annotationClassName &&
-      (c.enclosingLibrary.importUri == _packageJs ||
-          c.enclosingLibrary.importUri == _internalJs);
+      _isAnyInteropUri(c.enclosingLibrary.importUri);
 }
 
 bool _isPublicJSAnnotation(Expression value) =>
@@ -144,3 +148,40 @@
   }
   return values;
 }
+
+/// Returns the [Library] within [component] matching the specified
+/// [interopUri] or [null].
+Library? _findJsInteropLibrary(Component component, Uri interopUri) {
+  for (Library lib in component.libraries) {
+    for (LibraryDependency dependency in lib.dependencies) {
+      Library targetLibrary = dependency.targetLibrary;
+      if (targetLibrary.importUri == interopUri) {
+        return targetLibrary;
+      }
+    }
+  }
+  return null;
+}
+
+/// Calculates the libraries in [component] that transitively import a given js
+/// interop library.
+///
+/// Returns null if the given js interop library is not imported.
+/// NOTE: This function was based off of
+/// `calculateTransitiveImportsOfDartFfiIfUsed` in
+/// pkg/vm/lib/transformations/ffi/common.dart.
+List<Library>? calculateTransitiveImportsOfJsInteropIfUsed(
+    Component component, Uri interopUri) {
+  // Check for the presence of [jsInteropLibrary] as a dependency of any of the
+  // libraries in [component]. We use this to bypass the expensive
+  // [calculateTransitiveDependenciesOf] call for cases where js interop is
+  // not used, otherwise we could just use the index of the library instead.
+  Library? jsInteropLibrary = _findJsInteropLibrary(component, interopUri);
+  if (jsInteropLibrary == null) return null;
+
+  kernel_graph.LibraryGraph graph =
+      new kernel_graph.LibraryGraph(component.libraries);
+  Set<Library> result =
+      kernel_graph.calculateTransitiveDependenciesOf(graph, {jsInteropLibrary});
+  return result.toList();
+}
diff --git a/pkg/_js_interop_checks/lib/src/transformations/js_util_wasm_optimizer.dart b/pkg/_js_interop_checks/lib/src/transformations/js_util_wasm_optimizer.dart
new file mode 100644
index 0000000..f2a2aaa
--- /dev/null
+++ b/pkg/_js_interop_checks/lib/src/transformations/js_util_wasm_optimizer.dart
@@ -0,0 +1,242 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:kernel/ast.dart';
+import 'package:kernel/class_hierarchy.dart';
+import 'package:kernel/core_types.dart';
+import 'package:kernel/type_environment.dart';
+
+import '../js_interop.dart' show getJSName, hasStaticInteropAnnotation;
+
+/// Replaces:
+///   1) Factory constructors in classes with `@staticInterop` annotations with
+///      calls to `js_util_wasm.callConstructorVarArgs`.
+///   2) External methods in `@staticInterop` class extensions to their
+///      corresponding `js_util_wasm` calls.
+/// TODO(joshualitt): In the long term we'd like to have the same
+/// `JsUtilOptimizer` for all web backends. This is to ensure uniform semantics
+/// across all web backends. Some known challenges remain, and there may be
+/// unknown challenges that appear as we proceed. Known challenges include:
+///   1) Some constructs may need to be restricted on Dart2wasm, for example
+///      callbacks must be fully typed for the time being, though we could
+///      generalize this using `Function.apply`, but this is currently not
+///      implemented on Dart2wasm.
+///   2) We may want to handle this lowering differently on Dart2wasm in the
+///      long term. Currently, js_util on Wasm is implemented using a single
+///      trampoline per js_util function. We may want to specialize these
+///      trampolines based off the interop type, to avoid megamorphic behavior.
+///      This would have code size implications though, so we would need to
+///      proceed carefully.
+class JsUtilWasmOptimizer extends Transformer {
+  final Procedure _callMethodTarget;
+  final Procedure _callConstructorTarget;
+  final Procedure _globalThisTarget;
+  final Procedure _getPropertyTarget;
+  final Procedure _setPropertyTarget;
+  final Procedure _jsifyTarget;
+  final Procedure _dartifyTarget;
+  final Class _jsValueClass;
+
+  final CoreTypes _coreTypes;
+  final StatefulStaticTypeContext _staticTypeContext;
+  Map<Reference, ExtensionMemberDescriptor>? _extensionMemberIndex;
+  final Set<Class> _transformedClasses = {};
+
+  JsUtilWasmOptimizer(this._coreTypes, ClassHierarchy hierarchy)
+      : _callMethodTarget = _coreTypes.index
+            .getTopLevelProcedure('dart:js_util_wasm', 'callMethodVarArgs'),
+        _globalThisTarget = _coreTypes.index
+            .getTopLevelProcedure('dart:js_util_wasm', 'globalThis'),
+        _callConstructorTarget = _coreTypes.index.getTopLevelProcedure(
+            'dart:js_util_wasm', 'callConstructorVarArgs'),
+        _getPropertyTarget = _coreTypes.index
+            .getTopLevelProcedure('dart:js_util_wasm', 'getProperty'),
+        _setPropertyTarget = _coreTypes.index
+            .getTopLevelProcedure('dart:js_util_wasm', 'setProperty'),
+        _jsifyTarget =
+            _coreTypes.index.getTopLevelProcedure('dart:js_util_wasm', 'jsify'),
+        _dartifyTarget = _coreTypes.index
+            .getTopLevelProcedure('dart:js_util_wasm', 'dartify'),
+        _jsValueClass =
+            _coreTypes.index.getClass('dart:js_util_wasm', 'JSValue'),
+        _staticTypeContext = StatefulStaticTypeContext.stacked(
+            TypeEnvironment(_coreTypes, hierarchy)) {}
+
+  @override
+  Library visitLibrary(Library lib) {
+    _staticTypeContext.enterLibrary(lib);
+    lib.transformChildren(this);
+    _staticTypeContext.leaveLibrary(lib);
+    _extensionMemberIndex = null;
+    _transformedClasses.clear();
+    return lib;
+  }
+
+  @override
+  Member defaultMember(Member node) {
+    _staticTypeContext.enterMember(node);
+    node.transformChildren(this);
+    _staticTypeContext.leaveMember(node);
+    return node;
+  }
+
+  @override
+  Procedure visitProcedure(Procedure node) {
+    _staticTypeContext.enterMember(node);
+    ReturnStatement? transformedBody;
+    if (node.isExternal) {
+      if (node.isFactory) {
+        Class cls = node.enclosingClass!;
+        if (hasStaticInteropAnnotation(cls)) {
+          String jsName = getJSName(cls);
+          String constructorName = jsName == '' ? cls.name : jsName;
+          transformedBody =
+              _getExternalCallConstructorBody(node, constructorName);
+        }
+      } else if (node.isExtensionMember) {
+        var index = _extensionMemberIndex ??=
+            _createExtensionMembersIndex(node.enclosingLibrary);
+        var nodeDescriptor = index[node.reference];
+        if (nodeDescriptor != null) {
+          if (!nodeDescriptor.isStatic) {
+            if (nodeDescriptor.kind == ExtensionMemberKind.Getter) {
+              transformedBody = _getExternalGetterBody(node);
+            } else if (nodeDescriptor.kind == ExtensionMemberKind.Setter) {
+              transformedBody = _getExternalSetterBody(node);
+            } else if (nodeDescriptor.kind == ExtensionMemberKind.Method) {
+              transformedBody = _getExternalMethodBody(node);
+            }
+          }
+        }
+      }
+    }
+    if (transformedBody != null) {
+      node.function.body = transformedBody..parent = node.function;
+      node.isExternal = false;
+    } else {
+      node.transformChildren(this);
+    }
+    _staticTypeContext.leaveMember(node);
+    return node;
+  }
+
+  /// Returns and initializes `_extensionMemberIndex` to an index of the member
+  /// reference to the member `ExtensionMemberDescriptor`, for all extension
+  /// members in the given [library] of classes annotated with
+  /// `@staticInterop`.
+  Map<Reference, ExtensionMemberDescriptor> _createExtensionMembersIndex(
+      Library library) {
+    _extensionMemberIndex = {};
+    library.extensions.forEach((extension) {
+      DartType onType = extension.onType;
+      if (onType is InterfaceType &&
+          hasStaticInteropAnnotation(onType.className.asClass)) {
+        extension.members.forEach((descriptor) {
+          _extensionMemberIndex![descriptor.member] = descriptor;
+        });
+      }
+    });
+    return _extensionMemberIndex!;
+  }
+
+  DartType get _nullableJSValueType =>
+      _jsValueClass.getThisType(_coreTypes, Nullability.nullable);
+
+  Expression _jsifyVariable(VariableDeclaration variable) =>
+      StaticInvocation(_jsifyTarget, Arguments([VariableGet(variable)]));
+
+  /// Returns a new function body for the given [node] external method.
+  ///
+  /// The new function body will call `js_util_wasm.callConstructorVarArgs`
+  /// for the given external method.
+  ReturnStatement _getExternalCallConstructorBody(
+      Procedure node, String constructorName) {
+    var function = node.function;
+    var callConstructorInvocation = StaticInvocation(
+        _callConstructorTarget,
+        Arguments([
+          StaticInvocation(_globalThisTarget, Arguments([])),
+          StringLiteral(constructorName),
+          ListLiteral(
+              function.positionalParameters.map(_jsifyVariable).toList(),
+              typeArgument: _nullableJSValueType)
+        ]))
+      ..fileOffset = node.fileOffset;
+    return ReturnStatement(callConstructorInvocation);
+  }
+
+  Expression _dartify(Expression expression) =>
+      StaticInvocation(_dartifyTarget, Arguments([expression]));
+
+  /// Returns a new function body for the given [node] external getter.
+  ///
+  /// The new function body will call `js_util_wasm.getProperty` for the
+  /// given external getter.
+  ReturnStatement _getExternalGetterBody(Procedure node) {
+    var function = node.function;
+    assert(function.positionalParameters.length == 1);
+    var getPropertyInvocation = _dartify(StaticInvocation(
+        _getPropertyTarget,
+        Arguments([
+          VariableGet(function.positionalParameters.first),
+          StringLiteral(_getExtensionMemberName(node))
+        ])))
+      ..fileOffset = node.fileOffset;
+    return ReturnStatement(getPropertyInvocation);
+  }
+
+  /// Returns a new function body for the given [node] external setter.
+  ///
+  /// The new function body will call `js_util_wasm.setProperty` for
+  /// the given external setter.
+  ReturnStatement _getExternalSetterBody(Procedure node) {
+    var function = node.function;
+    assert(function.positionalParameters.length == 2);
+    var value = function.positionalParameters.last;
+    var setPropertyInvocation = _dartify(StaticInvocation(
+        _setPropertyTarget,
+        Arguments([
+          VariableGet(function.positionalParameters.first),
+          StringLiteral(_getExtensionMemberName(node)),
+          _jsifyVariable(value)
+        ])))
+      ..fileOffset = node.fileOffset;
+    return ReturnStatement(setPropertyInvocation);
+  }
+
+  /// Returns a new function body for the given [node] external method.
+  ///
+  /// The new function body will call `js_util_wasm.callMethodVarArgs` for
+  /// the given external method.
+  ReturnStatement _getExternalMethodBody(Procedure node) {
+    var function = node.function;
+    var callMethodInvocation = _dartify(StaticInvocation(
+        _callMethodTarget,
+        Arguments([
+          VariableGet(function.positionalParameters.first),
+          StringLiteral(_getExtensionMemberName(node)),
+          ListLiteral(
+              function.positionalParameters
+                  .sublist(1)
+                  .map(_jsifyVariable)
+                  .toList(),
+              typeArgument: _nullableJSValueType)
+        ])))
+      ..fileOffset = node.fileOffset;
+    return ReturnStatement(callMethodInvocation);
+  }
+
+  /// Returns the extension member name.
+  ///
+  /// Returns either the name from the `@JS` annotation if non-empty, or the
+  /// declared name of the extension member. Does not return the CFE generated
+  /// name for the top level member for this extension member.
+  String _getExtensionMemberName(Procedure node) {
+    var jsAnnotationName = getJSName(node);
+    if (jsAnnotationName.isNotEmpty) {
+      return jsAnnotationName;
+    }
+    return _extensionMemberIndex![node.reference]!.name.text;
+  }
+}
diff --git a/pkg/_js_interop_checks/lib/src/transformations/static_interop_class_eraser.dart b/pkg/_js_interop_checks/lib/src/transformations/static_interop_class_eraser.dart
index e00c88e..324a97d 100644
--- a/pkg/_js_interop_checks/lib/src/transformations/static_interop_class_eraser.dart
+++ b/pkg/_js_interop_checks/lib/src/transformations/static_interop_class_eraser.dart
@@ -29,9 +29,11 @@
   final CloneVisitorNotMembers _cloner = CloneVisitorNotMembers();
   late final _TypeSubstitutor _typeSubstitutor;
 
-  StaticInteropClassEraser(CoreTypes coreTypes)
-      : _javaScriptObject =
-            coreTypes.index.getClass('dart:_interceptors', 'JavaScriptObject') {
+  StaticInteropClassEraser(CoreTypes coreTypes,
+      {String libraryForJavaScriptObject = 'dart:_interceptors',
+      String classNameOfJavaScriptObject = 'JavaScriptObject'})
+      : _javaScriptObject = coreTypes.index
+            .getClass(libraryForJavaScriptObject, classNameOfJavaScriptObject) {
     _typeSubstitutor = _TypeSubstitutor(_javaScriptObject);
   }
 
diff --git a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
index 1ee2156..ff27a7f 100644
--- a/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/invocation_inferrer.dart
@@ -528,6 +528,7 @@
         value = argument;
         parameterKey = unnamedArgumentIndex++;
       }
+      value = value.unParenthesized;
       parameter = parameterMap[parameterKey];
       if (resolver.isInferenceUpdate1Enabled &&
           value is FunctionExpressionImpl) {
diff --git a/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart b/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
index 81d22f9..fe971f4 100644
--- a/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
+++ b/pkg/analyzer/test/src/dart/resolution/type_inference/inference_update_1_test.dart
@@ -205,6 +205,58 @@
         _isEnabled ? 'int' : 'Object?');
   }
 
+  test_horizontal_inference_simple_parenthesized() async {
+    await assertNoErrorsInCode('''
+void f<T>(T t, void Function(T) g) {}
+test() => f(0, ((x) {}));
+''');
+    assertType(
+        findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+    assertType(findNode.methodInvocation('f(').staticInvokeType,
+        'void Function(int, void Function(int))');
+    assertType(findNode.simpleParameter('x').declaredElement!.type,
+        _isEnabled ? 'int' : 'Object?');
+  }
+
+  test_horizontal_inference_simple_parenthesized_named() async {
+    await assertNoErrorsInCode('''
+void f<T>({required T t, required void Function(T) g}) {}
+test() => f(t: 0, g: ((x) {}));
+''');
+    assertType(
+        findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+    assertType(findNode.methodInvocation('f(').staticInvokeType,
+        'void Function({required void Function(int) g, required int t})');
+    assertType(findNode.simpleParameter('x').declaredElement!.type,
+        _isEnabled ? 'int' : 'Object?');
+  }
+
+  test_horizontal_inference_simple_parenthesized_twice() async {
+    await assertNoErrorsInCode('''
+void f<T>(T t, void Function(T) g) {}
+test() => f(0, (((x) {})));
+''');
+    assertType(
+        findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+    assertType(findNode.methodInvocation('f(').staticInvokeType,
+        'void Function(int, void Function(int))');
+    assertType(findNode.simpleParameter('x').declaredElement!.type,
+        _isEnabled ? 'int' : 'Object?');
+  }
+
+  test_horizontal_inference_simple_parenthesized_twice_named() async {
+    await assertNoErrorsInCode('''
+void f<T>({required T t, required void Function(T) g}) {}
+test() => f(t: 0, g: (((x) {})));
+''');
+    assertType(
+        findNode.methodInvocation('f(').typeArgumentTypes!.single, 'int');
+    assertType(findNode.methodInvocation('f(').staticInvokeType,
+        'void Function({required void Function(int) g, required int t})');
+    assertType(findNode.simpleParameter('x').declaredElement!.type,
+        _isEnabled ? 'int' : 'Object?');
+  }
+
   test_horizontal_inference_unnecessary_due_to_explicit_parameter_type() async {
     // In this example, there is no need for horizontal type inference because
     // the type of `x` is explicit.
diff --git a/pkg/compiler/lib/src/diagnostics/invariant.dart b/pkg/compiler/lib/src/diagnostics/invariant.dart
index 9986c24..76cdea1 100644
--- a/pkg/compiler/lib/src/diagnostics/invariant.dart
+++ b/pkg/compiler/lib/src/diagnostics/invariant.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.10
-
 library dart2js.diagnostics.invariant;
 
 import 'spannable.dart';
@@ -41,12 +39,6 @@
 ///
 ///     throw failedAt(position, message);
 ///
-bool failedAt(Spannable spannable, [String message]) {
-  // TODO(johnniwinther): Use [spannable] and [message] to provide better
-  // information on assertion errors.
-  if (spannable == null) {
-    throw SpannableAssertionFailure(CURRENT_ELEMENT_SPANNABLE,
-        'Spannable was null for failedAt. Use CURRENT_ELEMENT_SPANNABLE.');
-  }
+bool failedAt(Spannable spannable, [String? message]) {
   throw SpannableAssertionFailure(spannable, message);
 }
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index c7a774d..d28ed6f 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.10
-
 /// The messages in this file should follow the [Guide for Writing
 /// Diagnostics](../../../../front_end/lib/src/fasta/diagnostics.md).
 ///
@@ -21,8 +19,6 @@
 import 'invariant.dart' show failedAt;
 import 'spannable.dart' show CURRENT_ELEMENT_SPANNABLE;
 
-const DONT_KNOW_HOW_TO_FIX = "Computer says no!";
-
 /// Keys for the [MessageTemplate]s.
 enum MessageKind {
   COMPILER_CRASHED,
@@ -65,7 +61,7 @@
   final String template;
 
   /// Should describe how to fix the problem. Elided when using --terse option.
-  final String howToFix;
+  final String? howToFix;
 
   ///  Examples will be checked by
   ///  pkg/compiler/test/message_kind_test.dart.
@@ -73,7 +69,7 @@
   ///  An example is either a String containing the example source code or a Map
   ///  from filenames to source code. In the latter case, the filename for the
   ///  main library code must be 'main.dart'.
-  final List examples;
+  final List? examples;
 
   /// Additional options needed for the examples to work.
   final List<String> options;
@@ -238,54 +234,50 @@
   @override
   String toString() => template;
 
-  Message message(Map<String, String> arguments, CompilerOptions options) {
-    return Message(this, arguments, options);
+  Message message(Map<String, String> arguments, DiagnosticOptions? options) {
+    // [options] is nullable for testing.
+    // TODO(sra): Provide a testing version of [DiagnosticOptions] to allow
+    // [options] to be non-nullable, and use composition in [CompilerOptions]
+    // rather than inheritance.
+    return Message(this, arguments, options?.terseDiagnostics ?? false);
   }
 
-  bool get hasHowToFix => howToFix != null && howToFix != DONT_KNOW_HOW_TO_FIX;
+  bool get hasHowToFix => howToFix != null;
 }
 
 class Message {
   final MessageTemplate template;
   final Map<String, String> arguments;
-  final CompilerOptions _options;
-  bool get terse => _options?.terseDiagnostics ?? false;
-  String message;
+  final bool terse;
+  late String message = _computeMessage();
 
-  Message(this.template, this.arguments, this._options) {
-    assert(() {
-      computeMessage();
-      return true;
-    }());
+  Message(this.template, this.arguments, this.terse) {
+    assert(message != ''); // Force message formating in 'dart2js_developer'.
   }
 
   MessageKind get kind => template.kind;
 
-  String computeMessage() {
-    if (message == null) {
-      message = template.template;
+  String _computeMessage() {
+    message = template.template;
+    arguments.forEach((String key, String value) {
+      message = message.replaceAll('#{$key}', value);
+    });
+    assert(
+        kind == MessageKind.GENERIC || !message.contains(RegExp(r'#\{.+\}')),
+        failedAt(CURRENT_ELEMENT_SPANNABLE,
+            'Missing arguments in error message: "$message"'));
+    if (!terse && template.hasHowToFix) {
+      String howToFix = template.howToFix!;
       arguments.forEach((String key, String value) {
-        message = message.replaceAll('#{$key}', value);
+        howToFix = howToFix.replaceAll('#{$key}', value);
       });
-      assert(
-          kind == MessageKind.GENERIC || !message.contains(RegExp(r'#\{.+\}')),
-          failedAt(CURRENT_ELEMENT_SPANNABLE,
-              'Missing arguments in error message: "$message"'));
-      if (!terse && template.hasHowToFix) {
-        String howToFix = template.howToFix;
-        arguments.forEach((String key, String value) {
-          howToFix = howToFix.replaceAll('#{$key}', value);
-        });
-        message = '$message\n$howToFix';
-      }
+      message = '$message\n$howToFix';
     }
     return message;
   }
 
   @override
-  String toString() {
-    return computeMessage();
-  }
+  String toString() => message;
 
   @override
   bool operator ==(other) {
diff --git a/pkg/compiler/lib/src/diagnostics/source_span.dart b/pkg/compiler/lib/src/diagnostics/source_span.dart
index d180a9b..2b24c11 100644
--- a/pkg/compiler/lib/src/diagnostics/source_span.dart
+++ b/pkg/compiler/lib/src/diagnostics/source_span.dart
@@ -2,8 +2,6 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.10
-
 library dart2js.diagnostics.source_span;
 
 import 'spannable.dart' show Spannable;
diff --git a/pkg/compiler/lib/src/diagnostics/spannable.dart b/pkg/compiler/lib/src/diagnostics/spannable.dart
index 3e9da70..feef573 100644
--- a/pkg/compiler/lib/src/diagnostics/spannable.dart
+++ b/pkg/compiler/lib/src/diagnostics/spannable.dart
@@ -2,13 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
-// @dart = 2.10
-
 library dart2js.diagnostics.spannable;
 
 /// Tagging interface for classes from which source spans can be generated.
-// TODO(johnniwinther): Find a better name.
-// TODO(ahe): How about "Bolt"?
 abstract class Spannable {}
 
 class _SpannableSentinel implements Spannable {
@@ -33,7 +29,7 @@
 
 class SpannableAssertionFailure {
   final Spannable node;
-  final String message;
+  final String? message;
   SpannableAssertionFailure(this.node, this.message);
 
   @override
diff --git a/pkg/compiler/lib/src/ir/visitors.dart b/pkg/compiler/lib/src/ir/visitors.dart
index 82b81d6..a85e726 100644
--- a/pkg/compiler/lib/src/ir/visitors.dart
+++ b/pkg/compiler/lib/src/ir/visitors.dart
@@ -52,15 +52,39 @@
 
   DartTypes get _dartTypes => elementMap.commonElements.dartTypes;
 
-  DartType _convertNullability(DartType baseType, ir.Nullability nullability) {
+  DartType _convertNullability(
+      DartType baseType, ir.DartType nullabilitySource) {
+    final nullability = nullabilitySource.nullability;
     switch (nullability) {
+      case ir.Nullability.nonNullable:
+        return baseType;
       case ir.Nullability.nullable:
         return _dartTypes.nullableType(baseType);
       case ir.Nullability.legacy:
         return _dartTypes.legacyType(baseType);
-      default:
-        return baseType;
+      case ir.Nullability.undetermined:
+        // Type parameters may have undetermined nullability since it is derived
+        // from the intersection of the declared nullability with the
+        // nullability of the bound. We don't need a nullability wrapper in this
+        // case.
+        if (nullabilitySource is ir.TypeParameterType) return baseType;
+
+        // Iff `T` has undetermined nullability, then so will `FutureOr<T>`
+        // since it's the union of `T`, which has undetermined nullability, and
+        // `Future<T>`, which does not. We can treat the `Future`/`FutureOr` as
+        // non-nullable and rely on the conversion of the type argument to
+        // produce the right nullability.
+        if (nullabilitySource is ir.FutureOrType &&
+            nullabilitySource.typeArgument.nullability ==
+                ir.Nullability.undetermined) {
+          return baseType;
+        }
+
+        throw UnsupportedError(
+            'Undetermined nullability on $nullabilitySource');
     }
+    throw UnsupportedError(
+        'Unexpected nullability $nullability on $nullabilitySource');
   }
 
   DartType visitType(ir.DartType type) {
@@ -79,7 +103,7 @@
   DartType visitTypeParameterType(ir.TypeParameterType node) {
     DartType typeParameter = currentFunctionTypeParameters[node.parameter];
     if (typeParameter != null) {
-      return _convertNullability(typeParameter, node.nullability);
+      return _convertNullability(typeParameter, node);
     }
     if (node.parameter.parent is ir.Typedef) {
       // Typedefs are only used in type literals so we never need their type
@@ -88,7 +112,7 @@
     }
     return _convertNullability(
         _dartTypes.typeVariableType(elementMap.getTypeVariable(node.parameter)),
-        node.nullability);
+        node);
   }
 
   @override
@@ -125,7 +149,7 @@
             .toSet(),
         node.namedParameters.map((n) => visitType(n.type)).toList(),
         typeVariables ?? const <FunctionTypeVariable>[]);
-    DartType type = _convertNullability(functionType, node.nullability);
+    DartType type = _convertNullability(functionType, node);
     for (ir.TypeParameter typeParameter in node.typeParameters) {
       currentFunctionTypeParameters.remove(typeParameter);
     }
@@ -136,15 +160,13 @@
   DartType visitInterfaceType(ir.InterfaceType node) {
     ClassEntity cls = elementMap.getClass(node.classNode);
     return _convertNullability(
-        _dartTypes.interfaceType(cls, visitTypes(node.typeArguments)),
-        node.nullability);
+        _dartTypes.interfaceType(cls, visitTypes(node.typeArguments)), node);
   }
 
   @override
   DartType visitFutureOrType(ir.FutureOrType node) {
     return _convertNullability(
-        _dartTypes.futureOrType(visitType(node.typeArgument)),
-        node.declaredNullability);
+        _dartTypes.futureOrType(visitType(node.typeArgument)), node);
   }
 
   @override
@@ -166,7 +188,7 @@
 
   @override
   DartType visitNeverType(ir.NeverType node) {
-    return _convertNullability(_dartTypes.neverType(), node.nullability);
+    return _convertNullability(_dartTypes.neverType(), node);
   }
 
   @override
diff --git a/pkg/compiler/lib/src/kernel/dart2js_target.dart b/pkg/compiler/lib/src/kernel/dart2js_target.dart
index b25e1c4..76086f5 100644
--- a/pkg/compiler/lib/src/kernel/dart2js_target.dart
+++ b/pkg/compiler/lib/src/kernel/dart2js_target.dart
@@ -71,9 +71,12 @@
 
   final CompilerOptions? options;
   final bool canPerformGlobalTransforms;
+  final bool supportsUnevaluatedConstants;
 
   Dart2jsTarget(this.name, this.flags,
-      {this.options, this.canPerformGlobalTransforms = true});
+      {this.options,
+      this.canPerformGlobalTransforms = true,
+      this.supportsUnevaluatedConstants = true});
 
   @override
   bool get enableNoSuchMethodForwarders => true;
@@ -223,8 +226,8 @@
   }
 
   @override
-  ConstantsBackend get constantsBackend =>
-      const Dart2jsConstantsBackend(supportsUnevaluatedConstants: true);
+  ConstantsBackend get constantsBackend => Dart2jsConstantsBackend(
+      supportsUnevaluatedConstants: supportsUnevaluatedConstants);
 
   @override
   DartLibrarySupport get dartLibrarySupport =>
diff --git a/pkg/compiler/lib/src/kernel/front_end_adapter.dart b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
index 1643703..1243e98 100644
--- a/pkg/compiler/lib/src/kernel/front_end_adapter.dart
+++ b/pkg/compiler/lib/src/kernel/front_end_adapter.dart
@@ -117,7 +117,7 @@
       : const [];
   switch (message.severity) {
     case fe.Severity.internalProblem:
-      throw mainMessage.message.computeMessage();
+      throw mainMessage.message.message;
     case fe.Severity.error:
       reporter.reportError(mainMessage, infos);
       break;
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 70860ff..e899bd1 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -87,6 +87,9 @@
   /// to reduce generated code size.
   FeatureOption simpleAsyncToFuture = FeatureOption('simple-async-to-future');
 
+  /// Whether or not the CFE should evaluate constants.
+  FeatureOption cfeConstants = FeatureOption('cfe-constants');
+
   /// [FeatureOption]s which are shipped and cannot be toggled.
   late final List<FeatureOption> shipped = [
     newHolders,
@@ -102,7 +105,8 @@
   late final List<FeatureOption> canary = [
     writeUtf8,
     newDumpInfo,
-    simpleAsyncToFuture
+    simpleAsyncToFuture,
+    cfeConstants,
   ];
 
   /// Forces canary feature on. This must run after [Option].parse.
diff --git a/pkg/compiler/lib/src/phase/load_kernel.dart b/pkg/compiler/lib/src/phase/load_kernel.dart
index ee33403..57d15e7 100644
--- a/pkg/compiler/lib/src/phase/load_kernel.dart
+++ b/pkg/compiler/lib/src/phase/load_kernel.dart
@@ -213,8 +213,12 @@
     fe.InitializedCompilerState initializedCompilerState,
     String targetName) async {
   bool verbose = false;
+  bool cfeConstants = options.features.cfeConstants.isEnabled;
+  Map<String, String> environment = cfeConstants ? options.environment : null;
   Target target = Dart2jsTarget(targetName, TargetFlags(),
-      options: options, canPerformGlobalTransforms: true);
+      options: options,
+      canPerformGlobalTransforms: true,
+      supportsUnevaluatedConstants: !cfeConstants);
   fe.FileSystem fileSystem = CompilerFileSystem(compilerInput);
   fe.Verbosity verbosity = options.verbosity;
   fe.DiagnosticMessageHandler onDiagnostic = (fe.DiagnosticMessage message) {
@@ -237,6 +241,7 @@
       ..librariesSpecificationUri = options.librariesSpecificationUri
       ..packagesFileUri = options.packageConfig
       ..explicitExperimentalFlags = options.explicitExperimentalFlags
+      ..environmentDefines = environment
       ..verbose = verbose
       ..fileSystem = fileSystem
       ..onDiagnostic = onDiagnostic
@@ -266,6 +271,7 @@
       dependencies,
       options.packageConfig,
       explicitExperimentalFlags: options.explicitExperimentalFlags,
+      environmentDefines: environment,
       nnbdMode:
           options.useLegacySubtyping ? fe.NnbdMode.Weak : fe.NnbdMode.Strong,
       invocationModes: options.cfeInvocationModes,
diff --git a/pkg/dart2wasm/bin/run_wasm.js b/pkg/dart2wasm/bin/run_wasm.js
index 593f159..a0ba219 100644
--- a/pkg/dart2wasm/bin/run_wasm.js
+++ b/pkg/dart2wasm/bin/run_wasm.js
@@ -70,6 +70,8 @@
         return stringToDartString(object);
     } else if (object instanceof Array) {
         return arrayToDartList(object);
+    } else if (object instanceof Object) {
+        return dartInstance.exports.$boxJSValue(object);
     } else {
         return object;
     }
diff --git a/pkg/dart2wasm/lib/target.dart b/pkg/dart2wasm/lib/target.dart
index cb5310be..e2a182e 100644
--- a/pkg/dart2wasm/lib/target.dart
+++ b/pkg/dart2wasm/lib/target.dart
@@ -2,6 +2,9 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import 'package:_js_interop_checks/src/js_interop.dart' as jsInteropHelper;
+import 'package:_js_interop_checks/src/transformations/js_util_wasm_optimizer.dart';
+import 'package:_js_interop_checks/src/transformations/static_interop_class_eraser.dart';
 import 'package:kernel/ast.dart';
 import 'package:kernel/class_hierarchy.dart';
 import 'package:kernel/clone.dart';
@@ -47,12 +50,15 @@
         'dart:typed_data',
         'dart:nativewrappers',
         'dart:js_util_wasm',
+        "dart:js_wasm",
       ];
 
   @override
   List<String> get extraIndexedLibraries => const <String>[
         "dart:collection",
         "dart:typed_data",
+        'dart:js_util_wasm',
+        "dart:js_wasm",
       ];
 
   void _patchHostEndian(CoreTypes coreTypes) {
@@ -93,6 +99,16 @@
       ReferenceFromIndex? referenceFromIndex,
       {void logger(String msg)?,
       ChangedStructureNotifier? changedStructureNotifier}) {
+    List<Library>? transitiveImportingJSInterop =
+        jsInteropHelper.calculateTransitiveImportsOfJsInteropIfUsed(
+            component, Uri.parse("dart:js_wasm"));
+    if (transitiveImportingJSInterop == null) {
+      logger?.call("Skipped JS interop transformations");
+    } else {
+      performJSInteropTransformations(
+          coreTypes, hierarchy, transitiveImportingJSInterop);
+      logger?.call("Transformed JS interop classes");
+    }
     transformMixins.transformLibraries(
         this, coreTypes, hierarchy, libraries, referenceFromIndex);
     logger?.call("Transformed mixin applications");
@@ -222,3 +238,15 @@
   @override
   bool isSupportedPragma(String pragmaName) => pragmaName.startsWith("wasm:");
 }
+
+void performJSInteropTransformations(CoreTypes coreTypes,
+    ClassHierarchy hierarchy, List<Library> interopDependentLibraries) {
+  final jsUtilOptimizer = JsUtilWasmOptimizer(coreTypes, hierarchy);
+  final staticInteropClassEraser = StaticInteropClassEraser(coreTypes,
+      libraryForJavaScriptObject: 'dart:js_util_wasm',
+      classNameOfJavaScriptObject: 'JSValue');
+  for (Library library in interopDependentLibraries) {
+    jsUtilOptimizer.visitLibrary(library);
+    staticInteropClassEraser.visitLibrary(library);
+  }
+}
diff --git a/pkg/dart2wasm/pubspec.yaml b/pkg/dart2wasm/pubspec.yaml
index dd0b8de..8d6f9c2 100644
--- a/pkg/dart2wasm/pubspec.yaml
+++ b/pkg/dart2wasm/pubspec.yaml
@@ -5,6 +5,8 @@
   sdk: '>=2.12.0'
 
 dependencies:
+  _js_interop_checks:
+    path: ../_js_interop_checks
   front_end:
     path: ../front_end
   kernel:
@@ -16,6 +18,8 @@
 
 dependency_overrides:
   # Packages with source in the SDK
+  _js_interop_checks:
+    path: ../_js_interop_checks
   front_end:
     path: ../front_end
   kernel:
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index 014908f..9e23df4 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -129,6 +129,7 @@
     List<Uri> additionalDills,
     Uri packagesFileUri,
     {required Map<ExperimentalFlag, bool> explicitExperimentalFlags,
+    Map<String, String>? environmentDefines,
     bool verify: false,
     NnbdMode? nnbdMode,
     Set<InvocationMode> invocationModes: const <InvocationMode>{},
@@ -144,6 +145,7 @@
       equalLists(oldState.options.additionalDills, additionalDills) &&
       equalMaps(oldState.options.explicitExperimentalFlags,
           explicitExperimentalFlags) &&
+      equalMaps(oldState.options.environmentDefines, environmentDefines) &&
       oldState.options.verify == verify &&
       oldState.options.nnbdMode == nnbdMode &&
       equalSets(oldState.options.invocationModes, invocationModes) &&
@@ -157,6 +159,8 @@
     ..librariesSpecificationUri = librariesSpecificationUri
     ..packagesFileUri = packagesFileUri
     ..explicitExperimentalFlags = explicitExperimentalFlags
+    ..environmentDefines = environmentDefines
+    ..errorOnUnevaluatedConstant = environmentDefines != null ? true : false
     ..verify = verify
     ..invocationModes = invocationModes
     ..verbosity = verbosity;
diff --git a/pkg/front_end/tool/_fasta/command_line.dart b/pkg/front_end/tool/_fasta/command_line.dart
index 58d7517..00ce9c5 100644
--- a/pkg/front_end/tool/_fasta/command_line.dart
+++ b/pkg/front_end/tool/_fasta/command_line.dart
@@ -234,6 +234,18 @@
     });
   }
 
+  // In order to facilitate the roll out of CFE constants on Dart2js, we need to
+  // be able to support both passing '--no-defines' and also evaluating CFE
+  // constants when the target supports it. This is so we can easily enable or
+  // disable fully evaluating constants in the CFE with a flag. This can be
+  // deleted when the CFE fully evaluates constants for Dart2js in all cases.
+  Map<String, String>? environmentDefines;
+  if (noDefines && target.constantsBackend.supportsUnevaluatedConstants) {
+    // Pass a null environment.
+  } else {
+    environmentDefines = parsedOptions.defines;
+  }
+
   CompilerOptions compilerOptions = new CompilerOptions()
     ..compileSdk = compileSdk
     ..fileSystem = fileSystem
@@ -249,7 +261,7 @@
     ..verify = verify
     ..skipPlatformVerification = skipPlatformVerification
     ..explicitExperimentalFlags = explicitExperimentalFlags
-    ..environmentDefines = noDefines ? null : parsedOptions.defines
+    ..environmentDefines = environmentDefines
     ..nnbdMode = nnbdMode
     ..enableUnscheduledExperiments = enableUnscheduledExperiments
     ..additionalDills = linkDependencies
diff --git a/sdk/lib/_internal/wasm/lib/js_util_wasm_patch.dart b/sdk/lib/_internal/wasm/lib/js_util_wasm_patch.dart
index f4e7512..000f951 100644
--- a/sdk/lib/_internal/wasm/lib/js_util_wasm_patch.dart
+++ b/sdk/lib/_internal/wasm/lib/js_util_wasm_patch.dart
@@ -23,6 +23,9 @@
 void _listAdd(List<Object?> list, WasmAnyRef? item) =>
     list.add(dartifyRaw(item));
 
+@pragma("wasm:export", "\$boxJSValue")
+JSValue _boxJSValue(WasmAnyRef ref) => JSValue(ref);
+
 @patch
 Object _jsObjectToDartObject(WasmAnyRef ref) => unsafeCastOpaque<Object>(ref);
 
diff --git a/sdk/lib/js/js_sources.gni b/sdk/lib/js/js_sources.gni
index 6308b38..c581750 100644
--- a/sdk/lib/js/js_sources.gni
+++ b/sdk/lib/js/js_sources.gni
@@ -2,4 +2,7 @@
 # for details. All rights reserved. Use of this source code is governed by a
 # BSD-style license that can be found in the LICENSE file.
 
-js_sdk_sources = [ "js.dart" ]
+js_sdk_sources = [
+  "js.dart",
+  "js_wasm.dart",
+]
diff --git a/sdk/lib/js/js_wasm.dart b/sdk/lib/js/js_wasm.dart
new file mode 100644
index 0000000..847e6e0
--- /dev/null
+++ b/sdk/lib/js/js_wasm.dart
@@ -0,0 +1,16 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// This file contains annotations for JS interop on Wasm.
+
+class JS {
+  final String? name;
+  const JS([this.name]);
+}
+
+class _StaticInterop {
+  const _StaticInterop();
+}
+
+const _StaticInterop staticInterop = _StaticInterop();
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index 212955e..6c26f22 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -236,6 +236,9 @@
         "uri": "js_util/js_util_wasm.dart",
         "patches": "_internal/wasm/lib/js_util_wasm_patch.dart"
       },
+      "js_wasm": {
+        "uri": "js/js_wasm.dart"
+      },
       "math": {
         "uri": "math/math.dart",
         "patches": "_internal/wasm/lib/math_patch.dart"
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index e0a8e42..2b05632 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -219,6 +219,8 @@
     js_util_wasm:
       uri: js_util/js_util_wasm.dart
       patches: _internal/wasm/lib/js_util_wasm_patch.dart
+    js_wasm:
+      uri: js/js_wasm.dart
     math:
       uri: math/math.dart
       patches: _internal/wasm/lib/math_patch.dart
diff --git a/tests/language/inference_update_1/horizontal_inference_disabled_test.dart b/tests/language/inference_update_1/horizontal_inference_disabled_test.dart
index c63166b..f39b895 100644
--- a/tests/language/inference_update_1/horizontal_inference_disabled_test.dart
+++ b/tests/language/inference_update_1/horizontal_inference_disabled_test.dart
@@ -59,4 +59,34 @@
   a.expectStaticType<Exactly<int?>>();
 }
 
+testParenthesized(void Function<T>(T, void Function(T)) f) {
+  f(0, ((x) {
+    x.expectStaticType<Exactly<Object?>>();
+  }));
+}
+
+testParenthesizedNamed(
+    void Function<T>({required T a, required void Function(T) b}) f) {
+  f(
+      a: 0,
+      b: ((x) {
+        x.expectStaticType<Exactly<Object?>>();
+      }));
+}
+
+testParenthesizedTwice(void Function<T>(T, void Function(T)) f) {
+  f(0, (((x) {
+    x.expectStaticType<Exactly<Object?>>();
+  })));
+}
+
+testParenthesizedTwiceNamed(
+    void Function<T>({required T a, required void Function(T) b}) f) {
+  f(
+      a: 0,
+      b: (((x) {
+        x.expectStaticType<Exactly<Object?>>();
+      })));
+}
+
 main() {}
diff --git a/tests/language/inference_update_1/horizontal_inference_enabled_test.dart b/tests/language/inference_update_1/horizontal_inference_enabled_test.dart
index 6191c06..4d9f277 100644
--- a/tests/language/inference_update_1/horizontal_inference_enabled_test.dart
+++ b/tests/language/inference_update_1/horizontal_inference_enabled_test.dart
@@ -122,4 +122,34 @@
   a.expectStaticType<Exactly<int?>>();
 }
 
+testParenthesized(void Function<T>(T, void Function(T)) f) {
+  f(0, ((x) {
+    x.expectStaticType<Exactly<int>>();
+  }));
+}
+
+testParenthesizedNamed(
+    void Function<T>({required T a, required void Function(T) b}) f) {
+  f(
+      a: 0,
+      b: ((x) {
+        x.expectStaticType<Exactly<int>>();
+      }));
+}
+
+testParenthesizedTwice(void Function<T>(T, void Function(T)) f) {
+  f(0, (((x) {
+    x.expectStaticType<Exactly<int>>();
+  })));
+}
+
+testParenthesizedTwiceNamed(
+    void Function<T>({required T a, required void Function(T) b}) f) {
+  f(
+      a: 0,
+      b: (((x) {
+        x.expectStaticType<Exactly<int>>();
+      })));
+}
+
 main() {}
diff --git a/tests/web/wasm/static_interop_test.dart b/tests/web/wasm/static_interop_test.dart
new file mode 100644
index 0000000..3df1c84
--- /dev/null
+++ b/tests/web/wasm/static_interop_test.dart
@@ -0,0 +1,111 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:js_util_wasm';
+import 'dart:js_wasm';
+
+import 'package:expect/expect.dart';
+
+@JS('JSClass')
+@staticInterop
+class StaticJSClass {
+  external factory StaticJSClass.factory(String foo);
+}
+
+extension StaticJSClassMethods on StaticJSClass {
+  external String foo;
+  external String sum(String a, String? b, String c);
+}
+
+void createClassTest() {
+  eval(r'''
+    globalThis.JSClass = function(foo) {
+      this.foo = foo;
+      this.sum = function(a, b, c) {
+        if (b == null) b = ' ';
+        return a + b + c;
+      }
+    }
+  ''');
+  final foo = StaticJSClass.factory('foo');
+  Expect.equals(foo.foo, 'foo');
+  foo.foo = 'bar';
+  Expect.equals(foo.foo, 'bar');
+  Expect.equals('hello world!!', foo.sum('hello', null, 'world!!'));
+}
+
+@JS('JSParent')
+@staticInterop
+class StaticJSParent {
+  external factory StaticJSParent.factory();
+}
+
+extension StaticJSParentMethods on StaticJSParent {
+  external set child(StaticJSChild child);
+  external String childsFoo();
+}
+
+@JS('JSChild')
+@staticInterop
+class StaticJSChild {
+  external factory StaticJSChild.factory();
+}
+
+extension StaticJSChildMethods on StaticJSChild {
+  external set foo(String s);
+}
+
+void setInteropPropertyTest() {
+  eval(r'''
+    globalThis.JSParent = function() {
+      this.child = null;
+      this.childsFoo = () => {
+        return this.child.foo;
+      }
+    }
+
+    globalThis.JSChild = function() {
+      this.foo = null;
+    }
+  ''');
+
+  final parent = StaticJSParent.factory();
+  final child = StaticJSChild.factory();
+  parent.child = child;
+  child.foo = 'boo';
+  Expect.equals('boo', parent.childsFoo());
+}
+
+class DartObject {
+  final int x;
+
+  DartObject(this.x);
+}
+
+@JS('JSHolder')
+@staticInterop
+class StaticJSHolder {
+  external factory StaticJSHolder.factory(DartObject object);
+}
+
+extension StaticJSHolderMethods on StaticJSHolder {
+  external DartObject foo;
+}
+
+void setDartObjectPropertyTest() {
+  eval(r'''
+    globalThis.JSHolder = function(foo) {
+      this.foo = foo;
+    }
+  ''');
+  final traveler = DartObject(4);
+  final holder = StaticJSHolder.factory(traveler);
+  Expect.equals(traveler, holder.foo);
+}
+
+void main() {
+  createClassTest();
+  setInteropPropertyTest();
+  setDartObjectPropertyTest();
+}
diff --git a/tools/VERSION b/tools/VERSION
index 37c54e9..3a75f2e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 18
 PATCH 0
-PRERELEASE 15
+PRERELEASE 16
 PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 0bac3b9..1feea04 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -3595,14 +3595,6 @@
           ]
         },
         {
-          "name": "validate .dart_tool/package_config.json",
-          "script": "tools/sdks/dart-sdk/bin/dart",
-          "arguments": [
-            "tools/generate_package_config.dart",
-            "--check"
-          ]
-        },
-        {
           "name": "build dart",
           "script": "tools/build.py",
           "arguments": [
diff --git a/tools/generate_package_config.dart b/tools/generate_package_config.dart
index b4ba277..417b548 100644
--- a/tools/generate_package_config.dart
+++ b/tools/generate_package_config.dart
@@ -1,136 +1,80 @@
-#!/usr/bin/env dart
+// Copyright (c) 2020, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
 
 /// Generates the repo's ".dart_tool/package_config.json" file.
 import 'dart:convert';
 import 'dart:io';
 
-import 'package:args/args.dart';
-import 'package:path/path.dart' as p;
-import 'package:pub_semver/pub_semver.dart';
-import 'package:yaml/yaml.dart';
+// Important! Do not add package: imports to this file.
+// Do not add relative deps for libraries that themselves use package deps.
+// This tool runs before the .dart_tool/package_config.json file is created, so
+// can not itself use package references.
 
-bool _parseOptions(List<String> args) {
-  const usage = "Usage: dart generate_package_config.dart [flags...]";
-
-  var parser = ArgParser();
-
-  parser.addFlag("help", abbr: "h");
-
-  parser.addFlag("check",
-      abbr: "c",
-      help: "Return with a non-zero exit code if not up-to-date",
-      negatable: false);
-
-  var results = parser.parse(args);
-
-  if (results["help"] as bool) {
-    print("Regenerate the .dart_tool/package_config.json file.");
-    print("");
-    print(usage);
-    print("");
-    print(parser.usage);
-    exit(0);
-  }
-
-  return results["check"] as bool;
-}
-
-final repoRoot = p.dirname(p.dirname(p.fromUri(Platform.script)));
-final configFilePath = p.join(repoRoot, '.dart_tool/package_config.json');
+final repoRoot = dirname(dirname(fromUri(Platform.script)));
 
 void main(List<String> args) {
-  bool checkOnly = _parseOptions(args);
-
   var packageDirs = [
-    ...listSubdirectories('pkg'),
-    ...listSubdirectories('third_party/pkg'),
-    ...listSubdirectories('third_party/pkg_tested'),
-    ...listSubdirectories('third_party/pkg/file/packages'),
-    ...listSubdirectories('third_party/pkg/test/pkgs'),
-    packageDirectory('runtime/observatory'),
-    packageDirectory(
-        'runtime/observatory/tests/service/observatory_test_package'),
-    packageDirectory('runtime/observatory_2'),
-    packageDirectory(
+    ...listSubdirectories(platform('pkg')),
+    ...listSubdirectories(platform('third_party/pkg_tested')),
+    ...listSubdirectories(platform('third_party/pkg')),
+    ...listSubdirectories(platform('third_party/pkg/file/packages')),
+    ...listSubdirectories(platform('third_party/pkg/test/pkgs')),
+    platform('pkg/vm_service/test/test_package'),
+    platform('runtime/observatory_2'),
+    platform(
         'runtime/observatory_2/tests/service_2/observatory_test_package_2'),
-    packageDirectory('pkg/vm_service/test/test_package'),
-    packageDirectory('sdk/lib/_internal/sdk_library_metadata'),
-    packageDirectory('third_party/devtools/devtools_shared'),
-    packageDirectory('third_party/pkg/protobuf/protobuf'),
-    packageDirectory('third_party/pkg/webdev/frontend_server_client'),
-    packageDirectory('tools/package_deps'),
+    platform('runtime/observatory'),
+    platform('runtime/observatory/tests/service/observatory_test_package'),
+    platform('sdk/lib/_internal/sdk_library_metadata'),
+    platform('third_party/devtools/devtools_shared'),
+    platform('third_party/pkg/protobuf/protobuf'),
+    platform('third_party/pkg/webdev/frontend_server_client'),
+    platform('tools/package_deps'),
   ];
 
   var cfePackageDirs = [
-    packageDirectory('pkg/front_end/testcases/'),
+    platform('pkg/front_end/testcases'),
   ];
 
   var feAnalyzerSharedPackageDirs = [
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables/'),
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment/'),
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment/'),
-    packageDirectory('pkg/_fe_analyzer_shared/test/flow_analysis/nullability/'),
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/reachability/'),
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion/'),
-    packageDirectory(
-        'pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted//'),
-    packageDirectory('pkg/_fe_analyzer_shared/test/inheritance/'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/assigned_variables'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/definite_assignment'),
+    platform(
+        'pkg/_fe_analyzer_shared/test/flow_analysis/definite_unassignment'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/nullability'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/reachability'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/type_promotion'),
+    platform('pkg/_fe_analyzer_shared/test/flow_analysis/why_not_promoted'),
+    platform('pkg/_fe_analyzer_shared/test/inheritance'),
   ];
 
-  var packages = [
+  var packages = <Package>[
     ...makePackageConfigs(packageDirs),
     ...makeCfePackageConfigs(cfePackageDirs),
     ...makeFeAnalyzerSharedPackageConfigs(feAnalyzerSharedPackageDirs)
   ];
-  packages.sort((a, b) => a['name']!.compareTo(b['name']!));
+  packages.sort((a, b) => a.name.compareTo(b.name));
 
-  var configFile = File(p.join(repoRoot, '.dart_tool', 'package_config.json'));
-  var json = jsonDecode(configFile.readAsStringSync()) as Map<dynamic, dynamic>;
-  var oldPackages = json['packages'] as List<dynamic>;
+  var configFile = File(join(repoRoot, '.dart_tool', 'package_config.json'));
+  var packageConfig = PackageConfig(
+    packages,
+    extraData: {
+      'copyright': [
+        'Copyright (c) 2020, the Dart project authors. Please see the AUTHORS ',
+        'file for details. All rights reserved. Use of this source code is ',
+        'governed by a BSD-style license that can be found in the LICENSE file.',
+      ],
+      'comment': [
+        'Package configuration for all packages in pkg/, third_party/pkg/, and',
+        'third_party/pkg_tested/',
+      ],
+    },
+  );
+  writeIfDifferent(configFile, packageConfig.generateJson('..'));
 
-  if (checkOnly) {
-    // Validate the packages entry only, to avoid spurious failures from changes
-    // in the dates embedded in the other entries.
-    if (jsonEncode(packages) == jsonEncode(oldPackages)) {
-      print("Package config up to date.");
-      exit(0);
-    } else {
-      print("Package config out of date.");
-      print("Run `gclient sync -D && dart tools/generate_package_config.dart` "
-          "to update.");
-      exit(1);
-    }
-  }
-
-  var year = DateTime.now().year;
-  var config = <String, dynamic>{
-    'copyright': [
-      'Copyright (c) $year, the Dart project authors. Please see the AUTHORS ',
-      'file for details. All rights reserved. Use of this source code is ',
-      'governed by a BSD-style license that can be found in the LICENSE file.'
-    ],
-    'comment': [
-      'Package configuration for all packages in /pkg, and checked out by DEPS',
-      'into /third_party/pkg and /third_party/pkg_tested.',
-      'If you add a package to DEPS or /pkg or change a package\'s SDK',
-      'constraint, update this by running tools/generate_package_config.dart.'
-    ],
-    'configVersion': 2,
-    'generator': 'tools/generate_package_config.dart',
-    'packages': packages,
-  };
-
-  // TODO(rnystrom): Consider using package_config_v2 to generate this instead.
-  var jsonString = JsonEncoder.withIndent('  ').convert(config);
-  configFile.writeAsStringSync('$jsonString\n');
-
-  // Also generate the reop's .packages file.
-  var packagesFile = File(p.join(repoRoot, '.packages'));
+  // Also generate the repo's .packages file.
+  var packagesFile = File(join(repoRoot, '.packages'));
   var buffer = StringBuffer('''
 # Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file
 # for details. All rights reserved. Use of this source code is governed by a
@@ -141,114 +85,190 @@
 
 ''');
   for (var package in packages) {
-    final name = package['name'];
-    var path = package['rootUri']!;
-    if (path.startsWith('../')) {
-      path = path.substring('../'.length);
-    }
-    var packageUri = package['packageUri'];
-    if (packageUri != null && packageUri.endsWith('/')) {
-      packageUri = packageUri.substring(0, packageUri.length - 1);
-    }
+    final name = package.name;
+    final rootUri = package.rootUri;
+    final packageUri = package.packageUri;
+
     if (packageUri != null && packageUri != '.nonexisting') {
-      buffer.writeln('$name:$path/$packageUri');
+      buffer.writeln('$name:${posix(rootUri)}/${posix(packageUri)}');
     }
   }
-  packagesFile.writeAsStringSync(buffer.toString());
+  writeIfDifferent(packagesFile, buffer.toString());
+}
+
+/// Writes the given [contents] string to [file] if the contents are different
+/// than what's currently in the file.
+///
+/// This updates the file to the given contents, while preserving the file
+/// timestamp if there are no changes.
+void writeIfDifferent(File file, String contents) {
+  if (!file.existsSync() || file.readAsStringSync() != contents) {
+    file.writeAsStringSync(contents);
+  }
 }
 
 /// Generates package configurations for each package in [packageDirs].
-Iterable<Map<String, String>> makePackageConfigs(
-    List<String> packageDirs) sync* {
+Iterable<Package> makePackageConfigs(List<String> packageDirs) sync* {
   for (var packageDir in packageDirs) {
     var version = pubspecLanguageVersion(packageDir);
-    var hasLibDirectory = Directory(p.join(packageDir, 'lib')).existsSync();
+    var hasLibDirectory =
+        Directory(join(repoRoot, packageDir, 'lib')).existsSync();
 
-    yield {
-      'name': p.basename(packageDir),
-      'rootUri': p
-          .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
-          .toString(),
-      if (hasLibDirectory) 'packageUri': 'lib/',
-      'languageVersion': '${version.major}.${version.minor}'
-    };
+    yield Package(
+      name: basename(packageDir),
+      rootUri: packageDir,
+      packageUri: hasLibDirectory ? 'lib/' : null,
+      languageVersion: version,
+    );
   }
 }
 
-/// Generates package configurations for the special pseudo-packages used by
-/// the CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`).
-Iterable<Map<String, String>> makeCfePackageConfigs(
-    List<String> packageDirs) sync* {
+/// Generates package configurations for the special pseudo-packages used by the
+/// CFE unit tests (`pkg/front_end/test/unit_test_suites.dart`).
+Iterable<Package> makeCfePackageConfigs(List<String> packageDirs) sync* {
+  // TODO: Remove the use of '.nonexisting/'.
   for (var packageDir in packageDirs) {
-    yield {
-      'name': 'front_end_${p.basename(packageDir)}',
-      'rootUri': p
-          .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
-          .toString(),
-      'packageUri': '.nonexisting/',
-    };
+    yield Package(
+      name: 'front_end_${basename(packageDir)}',
+      rootUri: packageDir,
+      packageUri: '.nonexisting/',
+    );
   }
 }
 
-/// Generates package configurations for the special pseudo-packages used by
-/// the _fe_analyzer_shared id tests.
-Iterable<Map<String, String>> makeFeAnalyzerSharedPackageConfigs(
+/// Generates package configurations for the special pseudo-packages used by the
+/// _fe_analyzer_shared id tests.
+Iterable<Package> makeFeAnalyzerSharedPackageConfigs(
     List<String> packageDirs) sync* {
+  // TODO: Remove the use of '.nonexisting/'.
   for (var packageDir in packageDirs) {
-    yield {
-      'name': '_fe_analyzer_shared_${p.basename(packageDir)}',
-      'rootUri': p
-          .toUri(p.relative(packageDir, from: p.dirname(configFilePath)))
-          .toString(),
-      'packageUri': '.nonexisting/',
-    };
+    yield Package(
+      name: '_fe_analyzer_shared_${basename(packageDir)}',
+      rootUri: packageDir,
+      packageUri: '.nonexisting/',
+    );
   }
 }
 
-/// Generates a path to [relativePath] within the repo.
-String packageDirectory(String relativePath) => p.join(repoRoot, relativePath);
-
-/// Finds the paths of the immediate subdirectories of [packagesDir] that
+/// Finds the paths of the immediate subdirectories of [dir] that
 /// contain pubspecs.
-Iterable<String> listSubdirectories(String packagesDir) sync* {
-  for (var entry in Directory(p.join(repoRoot, packagesDir)).listSync()) {
+Iterable<String> listSubdirectories(String dir) sync* {
+  for (var entry in Directory(join(repoRoot, dir)).listSync()) {
     if (entry is! Directory) continue;
-    if (!File(p.join(entry.path, 'pubspec.yaml')).existsSync()) continue;
-    yield entry.path;
+    if (!File(join(entry.path, 'pubspec.yaml')).existsSync()) continue;
+    yield join(dir, basename(entry.path));
   }
 }
 
+final versionRE = RegExp(r"(?:\^|>=)(\d+\.\d+)");
+
 /// Infers the language version from the SDK constraint in the pubspec for
 /// [packageDir].
-Version pubspecLanguageVersion(String packageDir) {
-  final dartVersion2 = Version.parse('2.0.0');
-
-  var pubspecFile = File(p.join(packageDir, 'pubspec.yaml'));
-  var relative = p.relative(packageDir, from: repoRoot);
+///
+/// The version is returned in the form `major.minor`.
+String? pubspecLanguageVersion(String packageDir) {
+  var pubspecFile = File(join(repoRoot, packageDir, 'pubspec.yaml'));
 
   if (!pubspecFile.existsSync()) {
-    print("Error: Missing pubspec for $relative.");
+    print("Error: Missing pubspec for $packageDir.");
     exit(1);
   }
 
-  var pubspec =
-      loadYaml(pubspecFile.readAsStringSync()) as Map<dynamic, dynamic>;
-  if (!pubspec.containsKey('environment')) {
-    print("Error: Pubspec for $relative has no SDK constraint.");
+  var contents = pubspecFile.readAsLinesSync();
+  if (!contents.any((line) => line.contains('sdk: '))) {
+    print("Error: Pubspec for $packageDir has no SDK constraint.");
     exit(1);
   }
 
-  var environment = pubspec['environment'] as Map<dynamic, dynamic>;
-  if (!environment.containsKey('sdk')) {
-    print("Error: Pubspec for $relative has no SDK constraint.");
+  // Handle either "sdk: >=2.14.0 <3.0.0" or "sdk: ^2.3.0".
+  var sdkConstraint = contents.firstWhere((line) => line.contains('sdk: '));
+  sdkConstraint = sdkConstraint.trim().substring('sdk:'.length).trim();
+  if (sdkConstraint.startsWith('"') || sdkConstraint.startsWith("'")) {
+    sdkConstraint = sdkConstraint.substring(1, sdkConstraint.length - 2);
+  }
+
+  var match = versionRE.firstMatch(sdkConstraint);
+  if (match == null) {
+    print("Error: unknown version range for $packageDir: '$sdkConstraint'.");
     exit(1);
   }
-
-  var sdkConstraint = VersionConstraint.parse(environment['sdk'] as String);
-  if (sdkConstraint is VersionRange) {
-    return sdkConstraint.min ?? dartVersion2;
-  }
-
-  print("Error: SDK constraint $relative is not a version range.");
-  exit(1);
+  return match[1]!;
 }
+
+class Package {
+  final String name;
+  final String rootUri;
+  final String? packageUri;
+  final String? languageVersion;
+
+  Package({
+    required this.name,
+    required this.rootUri,
+    this.packageUri,
+    this.languageVersion,
+  });
+
+  Map<String, Object?> toMap(String relativeTo) {
+    return {
+      'name': name,
+      'rootUri': posix(join(relativeTo, rootUri)),
+      if (packageUri != null) 'packageUri': posix(packageUri!),
+      if (languageVersion != null) 'languageVersion': languageVersion,
+    };
+  }
+}
+
+class PackageConfig {
+  final List<Package> packages;
+  final Map<String, Object?>? extraData;
+
+  PackageConfig(this.packages, {this.extraData});
+
+  String generateJson(String relativeTo) {
+    var config = <String, Object?>{};
+    if (extraData != null) {
+      for (var key in extraData!.keys) {
+        config[key] = extraData![key];
+      }
+    }
+    config['configVersion'] = 2;
+    config['generator'] = 'tools/generate_package_config.dart';
+    config['packages'] =
+        packages.map((package) => package.toMap(relativeTo)).toList();
+    var jsonString = JsonEncoder.withIndent('  ').convert(config);
+    return '$jsonString\n';
+  }
+}
+
+// Below are some (very simplified) versions of the package:path functions.
+
+final String _separator = Platform.pathSeparator;
+
+String dirname(String s) {
+  return s.substring(0, s.lastIndexOf(_separator));
+}
+
+String join(String s1, String s2, [String? s3]) {
+  if (s3 != null) {
+    return join(join(s1, s2), s3);
+  } else {
+    return s1.endsWith(_separator) ? '$s1$s2' : '$s1$_separator$s2';
+  }
+}
+
+String basename(String s) {
+  while (s.endsWith(_separator)) {
+    s = s.substring(0, s.length - 1);
+  }
+  return s.substring(s.lastIndexOf(_separator) + 1);
+}
+
+String fromUri(Uri uri) => uri.toFilePath();
+
+/// Given a platform path, return a posix one.
+String posix(String s) =>
+    Platform.isWindows ? s.replaceAll(_separator, '/') : s;
+
+/// Given a posix path, return a platform one.
+String platform(String s) =>
+    Platform.isWindows ? s.replaceAll('/', _separator) : s;
diff --git a/tools/generate_package_config.py b/tools/generate_package_config.py
index 3c2f80f..b763b3d 100644
--- a/tools/generate_package_config.py
+++ b/tools/generate_package_config.py
@@ -5,17 +5,43 @@
 
 # Invoke the `tools/generate_package_config.dart` script.
 
-# NOTE(devoncarew): This script is currently a no-op in order to facilitate us
-# landing the package_config generation changes through flutter/engine. Once
-# generate_package_config.py exists in flutter/engine, we'll update that repo's
-# DEPS file to call this script, and then land the full package_config changes
-# in dart-lang/sdk.
+import os
+import os.path
+import platform
+import subprocess
+import sys
 
 USE_PYTHON3 = True
 
 
+def is_windows():
+    os_id = platform.system()
+    return os_id == 'Windows'
+
+
+def checked_in_sdk_path():
+    tools_dir = os.path.dirname(os.path.realpath(__file__))
+    return os.path.join(tools_dir, 'sdks', 'dart-sdk')
+
+
+def checked_in_sdk_executable():
+    name = 'dart'
+    if is_windows():
+        name = 'dart.exe'
+    return os.path.join(checked_in_sdk_path(), 'bin', name)
+
+
+def generate_package_config():
+    tools_dir = os.path.dirname(os.path.realpath(__file__))
+    process = subprocess.run([
+        checked_in_sdk_executable(),
+        os.path.join(tools_dir, 'generate_package_config.dart')
+    ])
+    return process.returncode
+
+
 def Main():
-    print('generate_package_config.py called')
+    sys.exit(generate_package_config())
 
 
 if __name__ == '__main__':