Files
sdk/pubspec.yaml
T
Jonas Finnemann Jensen 8c42f67d35 [dartpad] Part 1-8 squashed into a single commmit.
Reviewed in https://dart-review.googlesource.com/c/sdk/+/497583

[dartpad] Part 1: Protocol and Scaffolding

This sets up folders for `package:dartpad` and `package:dartpad_worker`,

R=athom@google.com, sigurdm@google.com

including:
 * `OWNERS` files,
 * Protocol definition,
 * Exceptions, and,
 * Virtual file system utilities.

[dartpad] Part 2: HotReloadCompiler

Adds the hot reload compiler logic to dartpad_worker.

This is models on dartdevc with `--reload-last-accepted-kernel` and
`--reload-delta-kernel` options. I don't think this does an incremental
compilation, instead it does a modular compilation. Meaning, we can have
a huge collection of precompiled DDC modules and the compiler just gets
a DDC outline/summary dill files for these modules. But on the other hand
the actual code that is compiled will be recompiled on every compile()
call.

This is very important for flutter_web.js / flutter_web.dill where the
precompiled DDC modules is around 60 MB in total. The fact that
package:flutter is precompiled into flutter_web.js is critical for
compilation performance for small dartpad-style example apps.

The downside is that unlike incremental compilation with _frontendserver_,
if the user were to install package:http and use it in the app they are
compiling then every `compile()` call will recompile `package:http`.
Where as with _frontendserver_ we'd be able to invalidate specific files,
and only those would be recompiled.

This leaves future work to either:
 * (A) Add support for modular compilation to _frontendserver_, such that
   we can do incremental compilation without having to first compile all
   of `package:flutter`.
 * (B) Refactor compilation strategy implemented here, to leverage
   modular further. We could for example compile all dependencies from
   `PUB_CACHE` into a `pub_cache_outline.dill` inside the dartpad worker.
   Then recompilation would only touch the user-code. Granted this is
   still less than ideal.

At the moment the lack of incremental compilation is not a blocker,
current dartpad doesn't have incremental compilation, but granted it also
only supported a single file. This dartpad environment will support
multiple files, but adding many files will result in poor performance
until we refactor and figure out how to do incremental compilation.
Hence, why we shouldn't block progress waiting for incremental compilation
to work.

R=nshahan@google.com

[dartpad] Part 3: Pub execution wrapper

Adds the internal wrapper for executing pub commands inside the
worker's virtual file system.

R=sigurdm@google.com

[dartpad] Part 4: Language Server wrapper

Adds the internal wrapper for spawning and communicating with the
Dart LSP inside the DartPad worker.

R=scheglov@google.com

[dartpad] Part 5: DartPad Worker

Implements the main worker entrypoint, RPC message handling. The
`bin/worker.dart` is what will be compiled to WASM and will run as a
_Web Worker_.

R=sigurdm@google.com

[dartpad] Part 6: DartPad Client library

The public-facing `dartpad` library that developers use to embed
the compilation environment in their web applications.

This finishes `package:dartpad`featuring:
 * `DartPad.create()`, which creates a _Web Worker_ running the compiled
   `pkg/dartpad_worker/bin/worker.dart`, and returns a `DartPad` instance
   wrapping RPC calls into the _Web Worker_.
 * `Sandbox.createIFrame()` which creates a _sandboxed iframe_ containing
   precompiled DDC modules from the SDK assets and `sandbox.js` for
   wrapping `ddc_module_loader.js` with an RPC interface. This returns a
   `Sandbox` instance wrapping RPC calls into the _sandboxed iframe_,
   making it easy to load modules, run library entrypoints (main()),
   initiate hot-reload, or launch a flutter app.

This is an initial API design that works. There are minor inconsistencies
and improvements that we should do. But I propose that we do so in
follow-up PRs.

R=sigurdm@google.com

[dartpad] Part 7: Build Targets

Adds a `dartpad` target to the Dart SDK, which produces:
```
out/ReleaseX64/dartpad/
├── dart
│   ├── dart_sdk.js.map
│   ├── sdk.js
│   └── sdk.tar
├── ddc_module_loader.js
├── sandbox.js
├── worker.loader.js
├── worker.mjs
├── worker.support.js
├── worker.wasm
└── worker.wasm.map
```

The `dartpad/` output folder is intended to be used as `assetBaseUrl` in
client libraries provided in `package:dartpad`. And the `dartpad/dart/`
folder is intended to be used as `sdkLocation`. These files are not
intended to be distributed along side the normal Dart SDK, instead we'll
publish them on a CDN and let people use `package:dartpad` to point at
these files. If they want to self-host everything, they can copy from our
CDN or rebuild the files using a local Dart SDK checkout.

These files are also necessary for testing, to ensure that we have proper
integration tests for `pkg/dartpad_worker/`. As we will want to publish
these files on a CDN the actual compiled size in release-mode matters,
thus, we have enabled wasm optimizations steps in this mode.

R=rmacnak@google.com

[dartpad] Part 8: Tests for `package:dartpad` and `pkg/dartpad_worker/`.

We have 3 kinds of tests:
 * Unit tests (vm, browser or both),
 * Worker tests (vm and browser),
 * Integration tests (browser-only).

As the Dart SDK test runner simply executes `*_test.dart` files with
`dart` and doesn't support compiling tests to the browser, launching and
running tests in the browser, we employ `dart test` to run tests. We do
this by having `pkg/dartpad_worker/dart_test.yaml` specify that
`dart test` should look for files names `test_*.dart`, and we then create
`pkg/dartpad_worker/test/ci_test.dart´ to be a single test that simply
runs `dart test` as a subprocess. Thus, the only test file triggered by
Dart SDK test runner is `ci_test.dart`, and if you locally run `dart test`
this will run the individual `test_*.dart` files.

While this hack to use `dart test` isn't ideal it gives everyone a decent
work flow. And saves us from having to invent complex test harness for
`pkg/dartpad_worker/`.

**Worker tests** defined in `test/dart/worker/` and `test/flutter/worker/`
are all imported into `test_dart_worker.dart` and
`test_flutter_worker.dart` to reduce test compilation time. These have a
non-trivial compilation time because the worker is running in the test
process. This allows testing on VM, which can be easier to debug.

**Integration tests** unlike _worker tests_ launch the worker compiled by
the `dartpad` build target in a _Web Worker_. This has less compilation
overhead for the individual tests, but involves more setup, and can be
a bit harder to debug.

Both worker and integration tests employ `test/asset_server/` which serves
assets built by the `dartpad` build target, and serves as a pub-server for
tests. It also serves assets built by `tool/setup_local_flutter.dart`
which creates flutter assets, though this is not intended to run as part
of CI, since we do not have a Flutter checkout available. Thus, for the
time being flutter testing is local only. Maybe, later we'll move this
script to another repository.

R=sigurdm@google.com

Cq-Include-Trybots: luci.dart.try:pkg-linux-release-try,pkg-win-release-try
Change-Id: I3a99939ec5217b9f3a855fc5b9ad9699047d02cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/507321
Commit-Queue: Jonas Jensen <jonasfj@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2026-05-29 02:25:49 -07:00

329 lines
9.5 KiB
YAML

# Copyright (c) 2025, 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 defines pub workspace for the sdk enabling a common resolution.
name: _
publish_to: none
environment:
# This constraint decides the language-version for all dart code in the
# repository that doesn't have its own package. Mainly the code in `tests/`.
#
# It needs to be updated before testing language features introduced in the
# next language version.
sdk: ^3.13.0-0
# These are the packages that are contained in the SDK.
workspace:
- pkg/analysis_server
- pkg/analysis_server_client
- pkg/analysis_server_plugin
- pkg/analyzer
- pkg/api_summary
- pkg/analyzer_cli
- pkg/analyzer_plugin
- pkg/analyzer_testing
- pkg/analyzer_utilities
- pkg/async_helper
- pkg/bisect_dart
- pkg/build_integration
- pkg/cfg
- pkg/compiler
- pkg/compiler/test/record_use/data
- pkg/dart2bytecode
- pkg/dart2js_info
- pkg/dart2js_runtime_metrics
- pkg/dart2js_tools
- pkg/dart2native
- pkg/dart2wasm
- pkg/dartdev
- pkg/dartpad
- pkg/dartpad_worker
- pkg/dart_data_home
- pkg/dart_internal
- pkg/dart_runtime_service
- pkg/dart_runtime_service_vm
- pkg/dart_service_protocol_shared
- pkg/dds
- pkg/dds_service_extensions
- pkg/dev_compiler
- pkg/dtd
- pkg/dtd_impl
- pkg/dwds
- pkg/dwds_test_common
- pkg/dynamic_modules
- pkg/expect
- pkg/_fe_analyzer_shared
- pkg/front_end
- pkg/frontend_server
- pkg/frontend_server_client
- pkg/heap_snapshot
- pkg/js
- pkg/js_ast
- pkg/_js_interop_checks
- pkg/js_runtime
- pkg/js_shared
- pkg/kernel
- pkg/linter
- pkg/meta
- pkg/mmap
- pkg/modular_test
- pkg/native_compiler
- pkg/native_stack_traces
- pkg/node_preamble
- pkg/perf_witness
- pkg/reload_test
- pkg/scrape
- pkg/server_plugin
- pkg/shell_arg_splitter
- pkg/smith
- pkg/sourcemap_testing
- pkg/status_file
- pkg/telemetry
- pkg/testing
- pkg/test_runner
- pkg/vm
- pkg/vm/testcases/transformations/record_use
- pkg/vm_service
- pkg/vm_service_interface
- pkg/vm_service_protos
- pkg/vm_snapshot_analysis
- pkg/wasm_builder
- runtime/tests/vm/dart
- runtime/tools
- runtime/tools/profiling
- samples/ffi/http
- samples/ffi/httpIG
- tests/ffi
# dap and language_server_protocol are checked in to and
# developed in the SDK repo, though they are located in `third_party/`.
- third_party/pkg/dap
- third_party/pkg/language_server_protocol
- tools/package_deps
- tools/verify_docs
- tools
- utils
# All third_party packages are retrieved via the DEPS-file and overridden here.
dependency_overrides:
args:
path: third_party/pkg/core/pkgs/args
async:
path: third_party/pkg/core/pkgs/async
bazel_worker:
path: third_party/pkg/tools/pkgs/bazel_worker
benchmark_harness:
path: third_party/pkg/tools/pkgs/benchmark_harness
boolean_selector:
path: third_party/pkg/tools/pkgs/boolean_selector
browser_launcher:
path: third_party/pkg/tools/pkgs/browser_launcher
checks:
path: third_party/pkg/test/pkgs/checks
cli_config:
path: third_party/pkg/tools/pkgs/cli_config
cli_util:
path: third_party/pkg/tools/pkgs/cli_util
clock:
path: third_party/pkg/tools/pkgs/clock
code_assets:
path: third_party/pkg/native/pkgs/code_assets
collection:
path: third_party/pkg/core/pkgs/collection
convert:
path: third_party/pkg/core/pkgs/convert
corpus:
path: third_party/pkg/ecosystem/pkgs/corpus
coverage:
path: third_party/pkg/tools/pkgs/coverage
crypto:
path: third_party/pkg/core/pkgs/crypto
csslib:
path: third_party/pkg/tools/pkgs/csslib
dart_flutter_team_lints:
path: third_party/pkg/ecosystem/pkgs/dart_flutter_team_lints
dart_style:
path: third_party/pkg/dart_style
dartdoc:
path: third_party/pkg/dartdoc
data_assets:
path: third_party/pkg/native/pkgs/data_assets
extension_discovery:
path: third_party/pkg/tools/pkgs/extension_discovery
fake_async:
path: third_party/pkg/test/pkgs/fake_async
ffi:
path: third_party/pkg/native/pkgs/ffi
file:
path: third_party/pkg/tools/pkgs/file
file_testing:
path: third_party/pkg/tools/pkgs/file_testing
fixnum:
path: third_party/pkg/core/pkgs/fixnum
glob:
path: third_party/pkg/tools/pkgs/glob
graphs:
path: third_party/pkg/tools/pkgs/graphs
hooks:
path: third_party/pkg/native/pkgs/hooks
hooks_runner:
path: third_party/pkg/native/pkgs/hooks_runner
html:
path: third_party/pkg/tools/pkgs/html
http:
path: third_party/pkg/http/pkgs/http
http2:
path: third_party/pkg/http/pkgs/http2
http_client_conformance_tests:
path: third_party/pkg/http/pkgs/http_client_conformance_tests
http_multi_server:
path: third_party/pkg/http/pkgs/http_multi_server
http_parser:
path: third_party/pkg/http/pkgs/http_parser
http_profile:
path: third_party/pkg/http/pkgs/http_profile
intl:
path: third_party/pkg/i18n/pkgs/intl
json_rpc_2:
path: third_party/pkg/tools/pkgs/json_rpc_2
leak_tracker:
path: third_party/pkg/leak_tracker/pkgs/leak_tracker
leak_tracker_testing:
path: third_party/pkg/leak_tracker/pkgs/leak_tracker_testing
lints:
path: third_party/pkg/core/pkgs/lints
logging:
path: third_party/pkg/core/pkgs/logging
markdown:
path: third_party/pkg/tools/pkgs/markdown
matcher:
path: third_party/pkg/test/pkgs/matcher
memory_usage:
path: third_party/pkg/leak_tracker/pkgs/memory_usage
mime:
path: third_party/pkg/tools/pkgs/mime
native_test_helpers:
path: third_party/pkg/native/pkgs/native_test_helpers
native_toolchain_c:
path: third_party/pkg/native/pkgs/native_toolchain_c
oauth2:
path: third_party/pkg/tools/pkgs/oauth2
os_detect:
path: third_party/pkg/core/pkgs/os_detect
package_config:
path: third_party/pkg/tools/pkgs/package_config
path:
path: third_party/pkg/core/pkgs/path
platform:
path: third_party/pkg/core/pkgs/platform
pool:
path: third_party/pkg/tools/pkgs/pool
protobuf:
path: third_party/pkg/protobuf/protobuf
process:
path: third_party/pkg/tools/pkgs/process
protobuf_benchmarks:
path: third_party/pkg/protobuf/benchmarks
protoc_plugin:
path: third_party/pkg/protobuf/protoc_plugin
pub:
path: third_party/pkg/pub
pub_formats:
path: third_party/pkg/native/pkgs/pub_formats
pub_semver:
path: third_party/pkg/tools/pkgs/pub_semver
record_use:
path: third_party/pkg/native/pkgs/record_use
regression_tests:
path: third_party/pkg/test/integration_tests/regression
shelf:
path: third_party/pkg/shelf/pkgs/shelf
shelf_packages_handler:
path: third_party/pkg/shelf/pkgs/shelf_packages_handler
shelf_proxy:
path: third_party/pkg/shelf/pkgs/shelf_proxy
shelf_static:
path: third_party/pkg/shelf/pkgs/shelf_static
shelf_test_handler:
path: third_party/pkg/shelf/pkgs/shelf_test_handler
shelf_web_socket:
path: third_party/pkg/shelf/pkgs/shelf_web_socket
source_map_stack_trace:
path: third_party/pkg/tools/pkgs/source_map_stack_trace
source_maps:
path: third_party/pkg/tools/pkgs/source_maps
source_span:
path: third_party/pkg/tools/pkgs/source_span
spawn_hybrid:
path: third_party/pkg/test/integration_tests/spawn_hybrid
sse:
path: third_party/pkg/tools/pkgs/sse
stack_trace:
path: third_party/pkg/tools/pkgs/stack_trace
stream_channel:
path: third_party/pkg/tools/pkgs/stream_channel
stream_transform:
path: third_party/pkg/tools/pkgs/stream_transform
string_scanner:
path: third_party/pkg/tools/pkgs/string_scanner
swift2objc:
path: third_party/pkg/native/pkgs/swift2objc
sync_http:
path: third_party/pkg/sync_http
tar:
path: third_party/pkg/tar
term_glyph:
path: third_party/pkg/tools/pkgs/term_glyph
test:
path: third_party/pkg/test/pkgs/test
test_api:
path: third_party/pkg/test/pkgs/test_api
test_case_selector:
path: third_party/pkg/native/pkgs/test_case_selector
test_core:
path: third_party/pkg/test/pkgs/test_core
test_descriptor:
path: third_party/pkg/test/pkgs/test_descriptor
test_process:
path: third_party/pkg/test/pkgs/test_process
test_reflective_loader:
path: third_party/pkg/tools/pkgs/test_reflective_loader
tool:
path: third_party/pkg/webdev/tool
typed_data:
path: third_party/pkg/core/pkgs/typed_data
unified_analytics:
path: third_party/pkg/tools/pkgs/unified_analytics
vector_math:
path: third_party/pkg/vector_math
wasm_tests:
path: third_party/pkg/test/integration_tests/wasm
watcher:
path: third_party/pkg/tools/pkgs/watcher
web:
path: third_party/pkg/web/web
web_socket:
path: third_party/pkg/http/pkgs/web_socket
web_socket_channel:
path: third_party/pkg/http/pkgs/web_socket_channel
webdriver:
path: third_party/pkg/webdriver
webkit_inspection_protocol:
path: third_party/pkg/webkit_inspection_protocol
yaml:
path: third_party/pkg/tools/pkgs/yaml
yaml_edit:
path: third_party/pkg/tools/pkgs/yaml_edit
io:
path: third_party/pkg/tools/pkgs/io
devtools_shared:
path: third_party/devtools/devtools_shared
# heapsnapshot has dependencies from outside the sdk, so cannot be part of
# the workspace. https://github.com/dart-lang/sdk/issues/50061
heapsnapshot:
path: runtime/tools/heapsnapshot
# observatory needs a migration to language version 3.6 before it can be
# included in the workspace. (If it is not deleted before)
observatory:
path: pkg/observatory