diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 703409e3bd..a68e5fe574 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -1,3 +1,9 @@ +## 28.0.0 + +- Support expression evaluation in Frontend Server + Build Daemon mode via `DaemonExpressionCompiler`. +- Add `WebPathTranslator` to support path translation between Frontend Server and Build Daemon. +- Replace `PackageUriMapper` with `PathResolver` strategy. + ## 27.1.3-wip - Internal test infrastructure refactoring: Move common test files to `dwds_test_common`. diff --git a/dwds/lib/asset_reader.dart b/dwds/lib/asset_reader.dart index 578849f302..d9c471903a 100644 --- a/dwds/lib/asset_reader.dart +++ b/dwds/lib/asset_reader.dart @@ -3,4 +3,9 @@ // BSD-style license that can be found in the LICENSE file. export 'src/readers/asset_reader.dart' - show AssetReader, PackageUriMapper, stripLeadingSlashes; + show + AssetReader, + BuildRunnerPathResolver, + FrontendServerPathResolver, + PathResolver, + stripLeadingSlashes; diff --git a/dwds/lib/dwds.dart b/dwds/lib/dwds.dart index 97c735fd8a..295de36207 100644 --- a/dwds/lib/dwds.dart +++ b/dwds/lib/dwds.dart @@ -18,6 +18,8 @@ export 'src/debugging/metadata/provider.dart' export 'src/events.dart' show DwdsEvent; export 'src/handlers/dev_handler.dart' show AppConnectionException; export 'src/handlers/socket_connections.dart'; +export 'src/loaders/asset_scheme.dart' + show AssetScheme, BuildRunnerAssetScheme, FrontendServerAssetScheme; export 'src/loaders/build_runner_strategy_provider.dart' show BuildRunnerDdcLibraryBundleStrategyProvider, @@ -25,6 +27,7 @@ export 'src/loaders/build_runner_strategy_provider.dart' export 'src/loaders/ddc.dart' show DdcStrategy; export 'src/loaders/frontend_server_strategy_provider.dart' show + FrontendServerBuildDaemonStrategyProvider, FrontendServerDdcLibraryBundleStrategyProvider, FrontendServerDdcStrategyProvider, FrontendServerRequireStrategyProvider; @@ -35,13 +38,21 @@ export 'src/loaders/strategy.dart' LoadStrategy, ReloadConfiguration, ReloadableLoadStrategy; -export 'src/readers/asset_reader.dart' show AssetReader, PackageUriMapper; +export 'src/readers/asset_reader.dart' + show + AssetReader, + BuildRunnerPathResolver, + FlutterPathResolver, + FrontendServerPathResolver, + PathResolver; export 'src/readers/frontend_server_asset_reader.dart' show FrontendServerAssetReader; export 'src/readers/proxy_server_asset_reader.dart' show ProxyServerAssetReader; export 'src/servers/devtools.dart'; export 'src/services/chrome/chrome_debug_exception.dart' show ChromeDebugException; +export 'src/services/daemon_expression_compiler.dart' + show DaemonExpressionCompiler; export 'src/services/expression_compiler.dart' show CompilerOptions, diff --git a/dwds/lib/src/debugging/location.dart b/dwds/lib/src/debugging/location.dart index b2c07dc547..7b450f3114 100644 --- a/dwds/lib/src/debugging/location.dart +++ b/dwds/lib/src/debugging/location.dart @@ -8,6 +8,7 @@ import 'package:dwds/src/debugging/metadata/provider.dart'; import 'package:dwds/src/debugging/modules.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:dwds/src/utilities/dart_uri.dart'; +import 'package:dwds/src/utilities/web_path_translator.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as p; import 'package:source_maps/parser.dart'; @@ -194,6 +195,8 @@ class Locations { return _sourceToLocation[serverPath] ?? {}; } + Iterable keys() => _sourceToLocation.keys; + /// Returns all [Location] data for a provided JS server path. Future> locationsForUrl(String url) async { if (url.isEmpty) return {}; @@ -345,7 +348,13 @@ class Locations { '/${stripLeadingSlashes(modulePath)}', ); - if (sourceMapContents == null) return result; + if (sourceMapContents == null) { + _logger.warning( + 'Failed to load source map for module $module at path ' + '$sourceMapPath', + ); + return result; + } final runtimeScriptId = await _modules.getRuntimeScriptIdForModule( _entrypoint, @@ -373,11 +382,9 @@ class Locations { } } for (final location in result) { + final serverPath = location.dartLocation.uri.serverPath; _sourceToLocation - .putIfAbsent( - location.dartLocation.uri.serverPath, - () => {}, - ) + .putIfAbsent(serverPath, () => {}) .add(location); } return _moduleToLocations[module] = result; @@ -395,15 +402,25 @@ class Locations { }) { final index = entry.sourceUrlId; if (index == null) return null; - // Source map URLS are relative to the script. They may have platform - // separators or they may use URL semantics. To be sure, we split and - // re-join them. - // This works on Windows because path treats both / and \ as separators. - // It will fail if the path has both separators in it. - final relativeSegments = p.split(sourceUrls[index]); - final path = p.url.normalize( - p.url.joinAll([scriptLocation, ...relativeSegments]), - ); + final sourceUrl = sourceUrls[index]; + String path; + if (Uri.tryParse(sourceUrl)?.isAbsolute == true) { + path = sourceUrl; + } else { + // TODO(markzipan): Check if platform-specific separators can be handled + // upstream in the SDK. + // Source map URLS are relative to the script. They may have platform + // separators or they may use URL semantics. To be sure, we split and + // re-join them. + // This works on Windows because path treats both / and \ as separators. + // It will fail if the path has both separators in it. + final relativeSegments = p.split(sourceUrl); + path = p.url.normalize( + p.url.joinAll([scriptLocation, ...relativeSegments]), + ); + + path = WebPathTranslator.reconstructAppScheme(path, scriptLocation); + } try { final dartUri = DartUri(path, _root); diff --git a/dwds/lib/src/debugging/metadata/provider.dart b/dwds/lib/src/debugging/metadata/provider.dart index 0f639406fd..e721351a28 100644 --- a/dwds/lib/src/debugging/metadata/provider.dart +++ b/dwds/lib/src/debugging/metadata/provider.dart @@ -1,7 +1,6 @@ // 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. - import 'dart:convert'; import 'package:async/async.dart'; @@ -13,7 +12,6 @@ import 'package:path/path.dart' as p; /// A provider of metadata in which data is collected through DDC outputs. class MetadataProvider { final AssetReader _assetReader; - final _logger = Logger('MetadataProvider'); final String entrypoint; final Set _libraries = {}; final Map _scriptToModule = {}; @@ -165,13 +163,15 @@ class MetadataProvider { /// return a map from module names to their [ModuleMetadata]. Future> _processMetadata() async { final modules = {}; - // The merged metadata resides next to the entrypoint. - // Assume that .bootstrap.js has .ddc_merged_metadata - if (entrypoint.endsWith('.bootstrap.js')) { - _logger.info('Loading debug metadata...'); + final logger = Logger('MetadataProvider'); + final assetScheme = _assetReader.assetScheme; + final bootstrapSuffix = assetScheme.bootstrapSuffix; + + if (entrypoint.endsWith(bootstrapSuffix)) { + logger.info('Loading debug metadata...'); final serverPath = entrypoint.replaceAll( - '.bootstrap.js', - '.ddc_merged_metadata', + bootstrapSuffix, + assetScheme.mergedMetadataSuffix, ); final merged = await _assetReader.metadataContents(serverPath); if (merged != null) { @@ -187,10 +187,9 @@ class MetadataProvider { ); final moduleName = metadata.name; modules[moduleName] = metadata; - _logger.fine('Loaded debug metadata for module: $moduleName'); + logger.fine('Loaded debug metadata for module: $moduleName'); } catch (e) { - _logger.warning('Failed to read metadata: $e'); - rethrow; + logger.warning('Failed to parse metadata: $e'); } } } @@ -274,18 +273,19 @@ class MetadataProvider { final moduleLibraries = {}; for (final library in metadata.libraries.values) { - if (library.importUri.startsWith('file:/')) { - throw AbsoluteImportUriException(library.importUri); + final importUri = library.importUri; + if (importUri.startsWith('file:/')) { + throw AbsoluteImportUriException(importUri); } - moduleLibraries.add(library.importUri); - _libraries.add(library.importUri); - _scripts[library.importUri] = []; + moduleLibraries.add(importUri); + _libraries.add(importUri); + _scripts[importUri] = []; - _scriptToModule[library.importUri] = moduleName; + _scriptToModule[importUri] = moduleName; for (final path in library.partUris) { // Parts in metadata are relative to the library Uri directory. - final partPath = p.url.join(p.dirname(library.importUri), path); - _scripts[library.importUri]!.add(partPath); + final partPath = p.url.join(p.url.dirname(importUri), path); + _scripts[importUri]!.add(partPath); _scriptToModule[partPath] = moduleName; } } diff --git a/dwds/lib/src/handlers/injected_client_js.dart b/dwds/lib/src/handlers/injected_client_js.dart index 7c5ef69609..93c9b319b6 100644 --- a/dwds/lib/src/handlers/injected_client_js.dart +++ b/dwds/lib/src/handlers/injected_client_js.dart @@ -2,7 +2,7 @@ // Emits the transpiled client.js directly into a statically embeddable string. // dart format off -const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.14.0-edge.49708da8bbb61fcaf57229ecfad88ee2db967f44.\n" +const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-values), the Dart to JavaScript compiler version: 3.14.0-edge.30b941a500c61ffb45fe23e49ae0576eada8d371.\n" "// The code supports the following hooks:\n" "// dartPrint(message):\n" "// if this function is defined it is called instead of the Dart [print]\n" @@ -1512,7 +1512,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " case 4:\n" " return closure.call\$4(arg1, arg2, arg3, arg4);\n" " }\n" -" throw A.wrapException(new A._Exception(\"Unsupported number of arguments for wrapped closure\"));\n" +" throw A.wrapException(A.Exception_Exception(\"Unsupported number of arguments for wrapped closure\"));\n" " },\n" " convertDartClosureToJS(closure, arity) {\n" " var \$function = closure.\$identity;\n" @@ -3830,10 +3830,15 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._TimerImpl\$(milliseconds < 0 ? 0 : milliseconds, callback);\n" " },\n" " _TimerImpl\$(milliseconds, callback) {\n" -" var t1 = new A._TimerImpl();\n" +" var t1 = new A._TimerImpl(true);\n" " t1._TimerImpl\$2(milliseconds, callback);\n" " return t1;\n" " },\n" +" _TimerImpl\$periodic(milliseconds, callback) {\n" +" var t1 = new A._TimerImpl(false);\n" +" t1._TimerImpl\$periodic\$2(milliseconds, callback);\n" +" return t1;\n" +" },\n" " _makeAsyncAwaitCompleter(\$T) {\n" " return new A._AsyncAwaitCompleter(new A._Future(\$.Zone__current, \$T._eval\$1(\"_Future<0>\")), \$T._eval\$1(\"_AsyncAwaitCompleter<0>\"));\n" " },\n" @@ -3871,20 +3876,91 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " },\n" " _wrapJsFunctionForAsync(\$function) {\n" " var \$protected = function(fn, ERROR) {\n" -" return function(errorCode, result) {\n" -" while (true) {\n" -" try {\n" -" fn(errorCode, result);\n" -" break;\n" -" } catch (error) {\n" -" result = error;\n" -" errorCode = ERROR;\n" -" }\n" +" return function(errorCode, result) {\n" +" while (true) {\n" +" try {\n" +" fn(errorCode, result);\n" +" break;\n" +" } catch (error) {\n" +" result = error;\n" +" errorCode = ERROR;\n" " }\n" -" };\n" -" }(\$function, 1),\n" -" t1 = \$.Zone__current;\n" -" return t1._registerBinaryCallbackZoned\$3\$2(t1, type\$.void_Function_int_dynamic._as(new A._wrapJsFunctionForAsync_closure(\$protected)), type\$.void, type\$.int, type\$.dynamic);\n" +" }\n" +" };\n" +" }(\$function, 1);\n" +" return \$.Zone__current.registerBinaryCallback\$3\$1(new A._wrapJsFunctionForAsync_closure(\$protected), type\$.void, type\$.int, type\$.dynamic);\n" +" },\n" +" _asyncStarHelper(object, bodyFunctionOrErrorCode, controller) {\n" +" var t1, t2, t3,\n" +" _s10_ = \"controller\";\n" +" if (bodyFunctionOrErrorCode === 0) {\n" +" t1 = controller.cancelationFuture;\n" +" if (t1 != null)\n" +" t1._completeWithValue\$1(null);\n" +" else {\n" +" t1 = controller.___AsyncStarStreamController_controller_A;\n" +" t1 === \$ && A.throwLateFieldNI(_s10_);\n" +" t1.close\$0();\n" +" }\n" +" return;\n" +" } else if (bodyFunctionOrErrorCode === 1) {\n" +" t1 = controller.cancelationFuture;\n" +" if (t1 != null) {\n" +" t2 = A.unwrapException(object);\n" +" t3 = A.getTraceFromException(object);\n" +" t1._completeErrorObject\$1(new A.AsyncError(t2, t3));\n" +" } else {\n" +" t1 = A.unwrapException(object);\n" +" t2 = A.getTraceFromException(object);\n" +" t3 = controller.___AsyncStarStreamController_controller_A;\n" +" t3 === \$ && A.throwLateFieldNI(_s10_);\n" +" t3.addError\$2(t1, t2);\n" +" controller.___AsyncStarStreamController_controller_A.close\$0();\n" +" }\n" +" return;\n" +" }\n" +" type\$.void_Function_int_dynamic._as(bodyFunctionOrErrorCode);\n" +" if (object instanceof A._IterationMarker) {\n" +" if (controller.cancelationFuture != null) {\n" +" bodyFunctionOrErrorCode.call\$2(2, null);\n" +" return;\n" +" }\n" +" t1 = object.state;\n" +" if (t1 === 0) {\n" +" t1 = object.value;\n" +" t2 = controller.___AsyncStarStreamController_controller_A;\n" +" t2 === \$ && A.throwLateFieldNI(_s10_);\n" +" t2.add\$1(0, controller.\$ti._precomputed1._as(t1));\n" +" A.scheduleMicrotask(new A._asyncStarHelper_closure(controller, bodyFunctionOrErrorCode));\n" +" return;\n" +" } else if (t1 === 1) {\n" +" t1 = controller.\$ti._eval\$1(\"Stream<1>\")._as(type\$.Stream_dynamic._as(object.value));\n" +" t2 = controller.___AsyncStarStreamController_controller_A;\n" +" t2 === \$ && A.throwLateFieldNI(_s10_);\n" +" t2.addStream\$2\$cancelOnError(t1, false).then\$1\$1(new A._asyncStarHelper_closure0(controller, bodyFunctionOrErrorCode), type\$.Null);\n" +" return;\n" +" }\n" +" }\n" +" A._awaitOnObject(object, bodyFunctionOrErrorCode);\n" +" },\n" +" _streamOfController(controller) {\n" +" var t1 = controller.___AsyncStarStreamController_controller_A;\n" +" t1 === \$ && A.throwLateFieldNI(\"controller\");\n" +" return new A._ControllerStream(t1, A._instanceType(t1)._eval\$1(\"_ControllerStream<1>\"));\n" +" },\n" +" _AsyncStarStreamController\$(body, \$T) {\n" +" var t1 = new A._AsyncStarStreamController(\$T._eval\$1(\"_AsyncStarStreamController<0>\"));\n" +" t1._AsyncStarStreamController\$1(body, \$T);\n" +" return t1;\n" +" },\n" +" _makeAsyncStarStreamController(body, \$T) {\n" +" return A._AsyncStarStreamController\$(body, \$T);\n" +" },\n" +" _IterationMarker_yieldStar(values) {\n" +" return new A._IterationMarker(values, 1);\n" +" },\n" +" _IterationMarker_yieldSingle(value) {\n" +" return new A._IterationMarker(value, 0);\n" " },\n" " AsyncError_defaultStackTrace(error) {\n" " var stackTrace;\n" @@ -3940,9 +4016,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _interceptError(error, stackTrace) {\n" " var replacement, t1, t2,\n" " zone = \$.Zone__current;\n" -" if (zone === B.Zone_jYP)\n" +" if (zone === B.C__RootZone)\n" " return null;\n" -" replacement = zone._errorCallbackZoned\$3(zone, error, stackTrace);\n" +" replacement = zone.errorCallback\$2(error, stackTrace);\n" " if (replacement == null)\n" " return null;\n" " t1 = replacement.error;\n" @@ -3953,7 +4029,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " },\n" " _interceptUserError(error, stackTrace) {\n" " var replacement;\n" -" if (\$.Zone__current !== B.Zone_jYP) {\n" +" if (\$.Zone__current !== B.C__RootZone) {\n" " replacement = A._interceptError(error, stackTrace);\n" " if (replacement != null)\n" " return replacement;\n" @@ -3979,7 +4055,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return t1;\n" " },\n" " _Future__chainCoreFuture(source, target, sync) {\n" -" var t2, t3, ignoreError, listeners, targetZone, _box_0 = {},\n" +" var t2, t3, ignoreError, listeners, _box_0 = {},\n" " t1 = _box_0.source = source;\n" " for (t2 = type\$._Future_dynamic; t3 = t1._state, (t3 & 4) !== 0; t1 = source) {\n" " source = t2._as(t1._resultOrListeners);\n" @@ -4013,8 +4089,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return;\n" " }\n" " target._state ^= 2;\n" -" targetZone = target._zone;\n" -" targetZone._scheduleMicrotaskZoned\$2(targetZone, new A._Future__chainCoreFuture_closure(_box_0, target));\n" +" target._zone.scheduleMicrotask\$1(new A._Future__chainCoreFuture_closure(_box_0, target));\n" " },\n" " _Future__propagateToListeners(source, listeners) {\n" " var t2, t3, _box_0, t4, t5, hasError, asyncError, nextListener, nextListener0, sourceResult, t6, zone, oldZone, result, current, _box_1 = {},\n" @@ -4027,8 +4102,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " if (listeners == null) {\n" " if (hasError && (t4 & 1) === 0) {\n" " asyncError = t2._as(t1._resultOrListeners);\n" -" t1 = t1._zone;\n" -" t1._handleUncaughtErrorZoned\$3(t1, asyncError.error, asyncError.stackTrace);\n" +" t1._zone.handleUncaughtError\$2(asyncError.error, asyncError.stackTrace);\n" " }\n" " return;\n" " }\n" @@ -4051,10 +4125,15 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t6 = true;\n" " if (t6) {\n" " zone = t1.result._zone;\n" -" if (hasError && t4._zone._handleUncaughtErrorFunction != zone._handleUncaughtErrorFunction) {\n" -" t2._as(sourceResult);\n" +" if (hasError) {\n" " t1 = t4._zone;\n" -" t1._handleUncaughtErrorZoned\$3(t1, sourceResult.error, sourceResult.stackTrace);\n" +" t1 = !(t1 === zone || t1.get\$errorZone() === zone.get\$errorZone());\n" +" } else\n" +" t1 = false;\n" +" if (t1) {\n" +" t1 = _box_1.source;\n" +" asyncError = t2._as(t1._resultOrListeners);\n" +" t1._zone.handleUncaughtError\$2(asyncError.error, asyncError.stackTrace);\n" " return;\n" " }\n" " oldZone = \$.Zone__current;\n" @@ -4062,7 +4141,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " \$.Zone__current = zone;\n" " else\n" " oldZone = null;\n" -" t1 = t1.state;\n" +" t1 = _box_0.listener.state;\n" " if ((t1 & 15) === 8)\n" " new A._Future__propagateToListeners_handleWhenCompleteCallback(_box_0, _box_1, hasError).call\$0();\n" " else if (t5) {\n" @@ -4113,12 +4192,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " },\n" " _registerErrorHandler(errorHandler, zone) {\n" -" var t1 = type\$.dynamic_Function_Object_StackTrace;\n" -" if (t1._is(errorHandler))\n" -" return zone._registerBinaryCallbackZoned\$3\$2(zone, t1._as(errorHandler), type\$.dynamic, type\$.Object, type\$.StackTrace);\n" -" t1 = type\$.dynamic_Function_Object;\n" -" if (t1._is(errorHandler))\n" -" return zone._registerUnaryCallbackZoned\$2\$2(zone, t1._as(errorHandler), type\$.dynamic, type\$.Object);\n" +" if (type\$.dynamic_Function_Object_StackTrace._is(errorHandler))\n" +" return zone.registerBinaryCallback\$3\$1(errorHandler, type\$.dynamic, type\$.Object, type\$.StackTrace);\n" +" if (type\$.dynamic_Function_Object._is(errorHandler))\n" +" return zone.registerUnaryCallback\$2\$1(errorHandler, type\$.dynamic, type\$.Object);\n" " throw A.wrapException(A.ArgumentError\$value(errorHandler, \"onError\", string\$.Error_));\n" " },\n" " _microtaskLoop() {\n" @@ -4175,27 +4252,32 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " },\n" " scheduleMicrotask(callback) {\n" -" var currentZone = \$.Zone__current;\n" -" if (B.Zone_jYP === currentZone) {\n" -" A._rootScheduleMicrotask(B.Zone_jYP, callback);\n" +" var t1, _null = null,\n" +" currentZone = \$.Zone__current;\n" +" if (B.C__RootZone === currentZone) {\n" +" A._rootScheduleMicrotask(_null, _null, B.C__RootZone, callback);\n" " return;\n" " }\n" -" if (currentZone._scheduleMicrotaskFunction == null && currentZone._handleUncaughtErrorFunction == null) {\n" -" A._rootScheduleMicrotask(currentZone, currentZone._registerCallbackZoned\$1\$2(currentZone, callback, type\$.void));\n" +" if (B.C__RootZone === currentZone.get\$_scheduleMicrotask().zone)\n" +" t1 = B.C__RootZone.get\$errorZone() === currentZone.get\$errorZone();\n" +" else\n" +" t1 = false;\n" +" if (t1) {\n" +" A._rootScheduleMicrotask(_null, _null, currentZone, currentZone.registerCallback\$1\$1(callback, type\$.void));\n" " return;\n" " }\n" -" currentZone._scheduleMicrotaskZoned\$2(currentZone, currentZone.bindCallbackGuarded\$1(callback));\n" +" t1 = \$.Zone__current;\n" +" t1.scheduleMicrotask\$1(t1.bindCallbackGuarded\$1(callback));\n" " },\n" " StreamIterator_StreamIterator(stream, \$T) {\n" " A.checkNotNullable(stream, \"stream\", type\$.Object);\n" " return new A._StreamIterator(\$T._eval\$1(\"_StreamIterator<0>\"));\n" " },\n" -" StreamController_StreamController(\$T) {\n" -" var _null = null;\n" -" return new A._AsyncStreamController(_null, _null, _null, _null, \$T._eval\$1(\"_AsyncStreamController<0>\"));\n" +" StreamController_StreamController(onCancel, onListen, onResume, \$T) {\n" +" return new A._AsyncStreamController(onListen, null, onResume, onCancel, \$T._eval\$1(\"_AsyncStreamController<0>\"));\n" " },\n" " _runGuarded(notificationHandler) {\n" -" var e, s, exception, t1;\n" +" var e, s, exception;\n" " if (notificationHandler == null)\n" " return;\n" " try {\n" @@ -4203,31 +4285,31 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" t1 = \$.Zone__current;\n" -" t1._handleUncaughtErrorZoned\$3(t1, A._asObject(e), type\$.StackTrace._as(s));\n" +" \$.Zone__current.handleUncaughtError\$2(e, s);\n" " }\n" " },\n" +" _AddStreamState_makeErrorHandler(controller) {\n" +" return new A._AddStreamState_makeErrorHandler_closure(controller);\n" +" },\n" " _BufferingStreamSubscription__registerDataHandler(zone, handleData, \$T) {\n" " var t1 = handleData == null ? A.async___nullDataHandler\$closure() : handleData;\n" -" return zone._registerUnaryCallbackZoned\$2\$2(zone, type\$.\$env_1_1_void._bind\$1(\$T)._eval\$1(\"1(2)\")._as(t1), type\$.void, \$T);\n" +" return zone.registerUnaryCallback\$2\$1(t1, type\$.void, \$T);\n" " },\n" " _BufferingStreamSubscription__registerErrorHandler(zone, handleError) {\n" " if (handleError == null)\n" " handleError = A.async___nullErrorHandler\$closure();\n" " if (type\$.void_Function_Object_StackTrace._is(handleError))\n" -" return zone._registerBinaryCallbackZoned\$3\$2(zone, type\$.dynamic_Function_Object_StackTrace._as(handleError), type\$.dynamic, type\$.Object, type\$.StackTrace);\n" +" return zone.registerBinaryCallback\$3\$1(handleError, type\$.dynamic, type\$.Object, type\$.StackTrace);\n" " if (type\$.void_Function_Object._is(handleError))\n" -" return zone._registerUnaryCallbackZoned\$2\$2(zone, type\$.dynamic_Function_Object._as(handleError), type\$.dynamic, type\$.Object);\n" +" return zone.registerUnaryCallback\$2\$1(handleError, type\$.dynamic, type\$.Object);\n" " throw A.wrapException(A.ArgumentError\$(string\$.handle, null));\n" " },\n" " _nullDataHandler(value) {\n" " },\n" " _nullErrorHandler(error, stackTrace) {\n" -" var t1;\n" " A._asObject(error);\n" " type\$.StackTrace._as(stackTrace);\n" -" t1 = \$.Zone__current;\n" -" t1._handleUncaughtErrorZoned\$3(t1, error, stackTrace);\n" +" \$.Zone__current.handleUncaughtError\$2(error, stackTrace);\n" " },\n" " _nullDoneHandler() {\n" " },\n" @@ -4240,35 +4322,34 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " },\n" " Timer_Timer(duration, callback) {\n" " var t1 = \$.Zone__current;\n" -" if (t1 === B.Zone_jYP)\n" -" return t1._createTimerZoned\$3(t1, duration, type\$.void_Function._as(callback));\n" -" return t1._createTimerZoned\$3(t1, duration, type\$.void_Function._as(t1.bindCallbackGuarded\$1(callback)));\n" +" if (t1 === B.C__RootZone)\n" +" return t1.createTimer\$2(duration, callback);\n" +" return t1.createTimer\$2(duration, t1.bindCallbackGuarded\$1(callback));\n" " },\n" " runZonedGuarded(body, onError, \$R) {\n" -" var error, stackTrace, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, newZone, exception, _null = null, zoneSpecification = null, zoneValues = null,\n" +" var error, stackTrace, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, exception, _null = null, zoneSpecification = null, zoneValues = null,\n" " parentZone = \$.Zone__current,\n" -" t1 = new A.runZonedGuarded_errorHandler(parentZone, onError);\n" +" errorHandler = new A.runZonedGuarded_closure(parentZone, onError);\n" " if (zoneSpecification == null)\n" -" zoneSpecification = new A.ZoneSpecification(t1, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null);\n" +" zoneSpecification = new A.ZoneSpecification(errorHandler, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null, _null);\n" " else {\n" -" t2 = zoneSpecification;\n" -" t3 = t2.run;\n" -" t4 = t2.runUnary;\n" -" t5 = t2.runBinary;\n" -" t6 = t2.registerCallback;\n" -" t7 = t2.registerUnaryCallback;\n" -" t8 = t2.registerBinaryCallback;\n" -" t9 = t2.errorCallback;\n" -" t10 = t2.scheduleMicrotask;\n" -" t11 = t2.createTimer;\n" -" t12 = t2.createPeriodicTimer;\n" -" t13 = t2.print;\n" -" t2 = t2.fork;\n" -" zoneSpecification = new A.ZoneSpecification(t1, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t2);\n" +" t1 = zoneSpecification;\n" +" t2 = t1.run;\n" +" t3 = t1.runUnary;\n" +" t4 = t1.runBinary;\n" +" t5 = t1.registerCallback;\n" +" t6 = t1.registerUnaryCallback;\n" +" t7 = t1.registerBinaryCallback;\n" +" t8 = t1.errorCallback;\n" +" t9 = t1.scheduleMicrotask;\n" +" t10 = t1.createTimer;\n" +" t11 = t1.createPeriodicTimer;\n" +" t12 = t1.print;\n" +" t1 = t1.fork;\n" +" zoneSpecification = new A.ZoneSpecification(errorHandler, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t1);\n" " }\n" " try {\n" -" newZone = parentZone._forkZoned\$3(parentZone, zoneSpecification, zoneValues);\n" -" t1 = newZone._runZoned\$1\$2(newZone, body, \$R);\n" +" t1 = parentZone.fork\$2\$specification\$zoneValues(zoneSpecification, zoneValues).run\$1\$1(body, \$R);\n" " return t1;\n" " } catch (exception) {\n" " error = A.unwrapException(exception);\n" @@ -4277,22 +4358,125 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " return _null;\n" " },\n" -" ZoneDelegate\$_() {\n" -" return new A.ZoneDelegate(B.Zone_jYP);\n" +" _rootHandleUncaughtError(\$self, \$parent, zone, error, stackTrace) {\n" +" A._rootHandleError(error, stackTrace);\n" +" },\n" +" _rootHandleError(error, stackTrace) {\n" +" A._schedulePriorityAsyncCallback(new A._rootHandleError_closure(error, stackTrace));\n" +" },\n" +" _rootRun(\$self, \$parent, zone, f, \$R) {\n" +" var old, t1;\n" +" type\$.nullable_Zone._as(\$self);\n" +" type\$.nullable_ZoneDelegate._as(\$parent);\n" +" type\$.Zone._as(zone);\n" +" \$R._eval\$1(\"0()\")._as(f);\n" +" t1 = \$.Zone__current;\n" +" if (t1 === zone)\n" +" return f.call\$0();\n" +" \$.Zone__current = zone;\n" +" old = t1;\n" +" try {\n" +" t1 = f.call\$0();\n" +" return t1;\n" +" } finally {\n" +" \$.Zone__current = old;\n" +" }\n" " },\n" -" _rootHandleUncaughtError(error, stackTrace) {\n" -" A._schedulePriorityAsyncCallback(new A._rootHandleUncaughtError_closure(error, stackTrace));\n" +" _rootRunUnary(\$self, \$parent, zone, f, arg, \$R, \$T) {\n" +" var old, t1;\n" +" type\$.nullable_Zone._as(\$self);\n" +" type\$.nullable_ZoneDelegate._as(\$parent);\n" +" type\$.Zone._as(zone);\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(f);\n" +" \$T._as(arg);\n" +" t1 = \$.Zone__current;\n" +" if (t1 === zone)\n" +" return f.call\$1(arg);\n" +" \$.Zone__current = zone;\n" +" old = t1;\n" +" try {\n" +" t1 = f.call\$1(arg);\n" +" return t1;\n" +" } finally {\n" +" \$.Zone__current = old;\n" +" }\n" " },\n" -" _rootScheduleMicrotask(zone, callback) {\n" -" if (B.Zone_jYP !== zone)\n" -" callback = zone._handleUncaughtErrorFunction != null ? zone.bindCallbackGuarded\$1(callback) : zone.bindCallback\$1\$1(callback, type\$.void);\n" -" A._scheduleAsyncCallback(callback);\n" +" _rootRunBinary(\$self, \$parent, zone, f, arg1, arg2, \$R, \$T1, \$T2) {\n" +" var old, t1;\n" +" type\$.nullable_Zone._as(\$self);\n" +" type\$.nullable_ZoneDelegate._as(\$parent);\n" +" type\$.Zone._as(zone);\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(f);\n" +" \$T1._as(arg1);\n" +" \$T2._as(arg2);\n" +" t1 = \$.Zone__current;\n" +" if (t1 === zone)\n" +" return f.call\$2(arg1, arg2);\n" +" \$.Zone__current = zone;\n" +" old = t1;\n" +" try {\n" +" t1 = f.call\$2(arg1, arg2);\n" +" return t1;\n" +" } finally {\n" +" \$.Zone__current = old;\n" +" }\n" +" },\n" +" _rootRegisterCallback(\$self, \$parent, zone, f, \$R) {\n" +" var t1 = type\$.Zone;\n" +" t1._as(\$self);\n" +" type\$.ZoneDelegate._as(\$parent);\n" +" t1._as(zone);\n" +" return \$R._eval\$1(\"0()\")._as(f);\n" +" },\n" +" _rootRegisterUnaryCallback(\$self, \$parent, zone, f, \$R, \$T) {\n" +" var t1 = type\$.Zone;\n" +" t1._as(\$self);\n" +" type\$.ZoneDelegate._as(\$parent);\n" +" t1._as(zone);\n" +" return \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(f);\n" +" },\n" +" _rootRegisterBinaryCallback(\$self, \$parent, zone, f, \$R, \$T1, \$T2) {\n" +" var t1 = type\$.Zone;\n" +" t1._as(\$self);\n" +" type\$.ZoneDelegate._as(\$parent);\n" +" t1._as(zone);\n" +" return \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(f);\n" +" },\n" +" _rootErrorCallback(\$self, \$parent, zone, error, stackTrace) {\n" +" var t1 = type\$.Zone;\n" +" t1._as(\$self);\n" +" type\$.ZoneDelegate._as(\$parent);\n" +" t1._as(zone);\n" +" A._asObject(error);\n" +" type\$.nullable_StackTrace._as(stackTrace);\n" +" return null;\n" " },\n" -" _rootFork(zone, specification, zoneValues) {\n" -" var t1 = new A.ZoneDelegate(B.Zone_jYP),\n" -" t2 = new A._ZoneHandleUncaughtError(B.Zone_jYP, specification.handleUncaughtError);\n" -" t1 = t1._zone = new A.Zone(zone, t1, zone._runFunction, zone._runUnaryFunction, zone._runBinaryFunction, zone._registerCallbackFunction, zone._registerUnaryCallbackFunction, zone._registerBinaryCallbackFunction, zone._errorCallbackFunction, zone._scheduleMicrotaskFunction, zone._createTimerFunction, zone._createPeriodicTimerFunction, zone._printFunction, zone._forkFunction, t2, zone._zoneValues);\n" -" t2.zone = t1;\n" +" _rootScheduleMicrotask(\$self, \$parent, zone, f) {\n" +" var t1, t2;\n" +" type\$.void_Function._as(f);\n" +" if (B.C__RootZone !== zone) {\n" +" t1 = B.C__RootZone.get\$errorZone();\n" +" t2 = zone.get\$errorZone();\n" +" f = t1 !== t2 ? zone.bindCallbackGuarded\$1(f) : zone.bindCallback\$1\$1(f, type\$.void);\n" +" }\n" +" A._scheduleAsyncCallback(f);\n" +" },\n" +" _rootCreateTimer(\$self, \$parent, zone, duration, callback) {\n" +" callback = zone.bindCallback\$1\$1(type\$.void_Function._as(callback), type\$.void);\n" +" return A.Timer__createTimer(duration, callback);\n" +" },\n" +" _rootCreatePeriodicTimer(\$self, \$parent, zone, duration, callback) {\n" +" var milliseconds;\n" +" callback = zone.bindUnaryCallback\$2\$1(type\$.void_Function_Timer._as(callback), type\$.void, type\$.Timer);\n" +" milliseconds = duration.get\$inMilliseconds();\n" +" return A._TimerImpl\$periodic(milliseconds.\$lt(0, 0) ? 0 : milliseconds, callback);\n" +" },\n" +" _rootPrint(\$self, \$parent, zone, line) {\n" +" A.printString(line);\n" +" },\n" +" _rootFork(\$self, \$parent, zone, specification, zoneValues) {\n" +" var t1 = new A._CustomZone(zone.get\$_run(), zone.get\$_runUnary(), zone.get\$_runBinary(), zone.get\$_registerCallback(), zone.get\$_registerUnaryCallback(), zone.get\$_registerBinaryCallback(), zone.get\$_errorCallback(), zone.get\$_scheduleMicrotask(), zone.get\$_createTimer(), zone.get\$_createPeriodicTimer(), zone.get\$_print(), zone.get\$_fork(), zone.get\$_handleUncaughtError(), zone.get\$_zoneValues(), zone);\n" +" t1._handleUncaughtError = new A._ZoneHandleUncaughtError(t1, specification.handleUncaughtError);\n" " return t1;\n" " },\n" " _AsyncRun__initializeScheduleImmediate_internalCallback: function _AsyncRun__initializeScheduleImmediate_internalCallback(t0) {\n" @@ -4309,13 +4493,22 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _AsyncRun__scheduleImmediateWithSetImmediate_internalCallback: function _AsyncRun__scheduleImmediateWithSetImmediate_internalCallback(t0) {\n" " this.callback = t0;\n" " },\n" -" _TimerImpl: function _TimerImpl() {\n" +" _TimerImpl: function _TimerImpl(t0) {\n" +" this._once = t0;\n" " this._handle = null;\n" +" this._tick = 0;\n" " },\n" " _TimerImpl_internalCallback: function _TimerImpl_internalCallback(t0, t1) {\n" " this.\$this = t0;\n" " this.callback = t1;\n" " },\n" +" _TimerImpl\$periodic_closure: function _TimerImpl\$periodic_closure(t0, t1, t2, t3) {\n" +" var _ = this;\n" +" _.\$this = t0;\n" +" _.milliseconds = t1;\n" +" _.start = t2;\n" +" _.callback = t3;\n" +" },\n" " _AsyncAwaitCompleter: function _AsyncAwaitCompleter(t0, t1) {\n" " this._future = t0;\n" " this.isSync = false;\n" @@ -4330,6 +4523,45 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _wrapJsFunctionForAsync_closure: function _wrapJsFunctionForAsync_closure(t0) {\n" " this.\$protected = t0;\n" " },\n" +" _asyncStarHelper_closure: function _asyncStarHelper_closure(t0, t1) {\n" +" this.controller = t0;\n" +" this.bodyFunction = t1;\n" +" },\n" +" _asyncStarHelper_closure0: function _asyncStarHelper_closure0(t0, t1) {\n" +" this.controller = t0;\n" +" this.bodyFunction = t1;\n" +" },\n" +" _AsyncStarStreamController: function _AsyncStarStreamController(t0) {\n" +" var _ = this;\n" +" _.___AsyncStarStreamController_controller_A = \$;\n" +" _.isSuspended = false;\n" +" _.cancelationFuture = null;\n" +" _.\$ti = t0;\n" +" },\n" +" _AsyncStarStreamController__resumeBody: function _AsyncStarStreamController__resumeBody(t0) {\n" +" this.body = t0;\n" +" },\n" +" _AsyncStarStreamController__resumeBody_closure: function _AsyncStarStreamController__resumeBody_closure(t0) {\n" +" this.body = t0;\n" +" },\n" +" _AsyncStarStreamController_closure0: function _AsyncStarStreamController_closure0(t0) {\n" +" this._resumeBody = t0;\n" +" },\n" +" _AsyncStarStreamController_closure1: function _AsyncStarStreamController_closure1(t0, t1) {\n" +" this.\$this = t0;\n" +" this._resumeBody = t1;\n" +" },\n" +" _AsyncStarStreamController_closure: function _AsyncStarStreamController_closure(t0, t1) {\n" +" this.\$this = t0;\n" +" this.body = t1;\n" +" },\n" +" _AsyncStarStreamController__closure: function _AsyncStarStreamController__closure(t0) {\n" +" this.body = t0;\n" +" },\n" +" _IterationMarker: function _IterationMarker(t0, t1) {\n" +" this.value = t0;\n" +" this.state = t1;\n" +" },\n" " AsyncError: function AsyncError(t0, t1) {\n" " this.error = t0;\n" " this.stackTrace = t1;\n" @@ -4489,6 +4721,21 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._async\$_target = t0;\n" " this.\$ti = t1;\n" " },\n" +" _AddStreamState: function _AddStreamState() {\n" +" },\n" +" _AddStreamState_makeErrorHandler_closure: function _AddStreamState_makeErrorHandler_closure(t0) {\n" +" this.controller = t0;\n" +" },\n" +" _AddStreamState_cancel_closure: function _AddStreamState_cancel_closure(t0) {\n" +" this.\$this = t0;\n" +" },\n" +" _StreamControllerAddStreamState: function _StreamControllerAddStreamState(t0, t1, t2, t3) {\n" +" var _ = this;\n" +" _._varData = t0;\n" +" _.addStreamFuture = t1;\n" +" _.addSubscription = t2;\n" +" _.\$ti = t3;\n" +" },\n" " _BufferingStreamSubscription: function _BufferingStreamSubscription() {\n" " },\n" " _BufferingStreamSubscription_asFuture_closure: function _BufferingStreamSubscription_asFuture_closure(t0, t1) {\n" @@ -4551,26 +4798,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _EmptyStream: function _EmptyStream(t0) {\n" " this.\$ti = t0;\n" " },\n" -" _MultiStream: function _MultiStream(t0, t1, t2) {\n" -" this.isBroadcast = t0;\n" -" this._onListen = t1;\n" -" this.\$ti = t2;\n" -" },\n" -" _MultiStream_listen_closure: function _MultiStream_listen_closure(t0, t1) {\n" -" this.\$this = t0;\n" -" this.controller = t1;\n" -" },\n" -" _MultiStreamController: function _MultiStreamController(t0, t1, t2, t3, t4) {\n" -" var _ = this;\n" -" _._varData = null;\n" -" _._state = 0;\n" -" _._doneFuture = null;\n" -" _.onListen = t0;\n" -" _.onPause = t1;\n" -" _.onResume = t2;\n" -" _.onCancel = t3;\n" -" _.\$ti = t4;\n" -" },\n" " _cancelAndValue_closure: function _cancelAndValue_closure(t0, t1) {\n" " this.future = t0;\n" " this.value = t1;\n" @@ -4594,51 +4821,119 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._source = t1;\n" " this.\$ti = t2;\n" " },\n" +" _ZoneRun: function _ZoneRun(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneRunUnary: function _ZoneRunUnary(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneRunBinary: function _ZoneRunBinary(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneRegisterCallback: function _ZoneRegisterCallback(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneRegisterUnaryCallback: function _ZoneRegisterUnaryCallback(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneRegisterBinaryCallback: function _ZoneRegisterBinaryCallback(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneErrorCallback: function _ZoneErrorCallback(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneScheduleMicrotask: function _ZoneScheduleMicrotask(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneCreateTimer: function _ZoneCreateTimer(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneCreatePeriodicTimer: function _ZoneCreatePeriodicTimer() {\n" +" },\n" +" _ZonePrint: function _ZonePrint(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" +" _ZoneFork: function _ZoneFork(t0, t1) {\n" +" this.zone = t0;\n" +" this.\$function = t1;\n" +" },\n" " _ZoneHandleUncaughtError: function _ZoneHandleUncaughtError(t0, t1) {\n" " this.zone = t0;\n" " this.\$function = t1;\n" " },\n" -" Zone: function Zone(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15) {\n" +" _ZoneValues: function _ZoneValues(t0, t1) {\n" +" this.zone = t0;\n" +" this.map = t1;\n" +" },\n" +" _Zone: function _Zone() {\n" +" },\n" +" _CustomZone: function _CustomZone(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14) {\n" " var _ = this;\n" -" _._parent = t0;\n" -" _._delegate = t1;\n" -" _._runFunction = t2;\n" -" _._runUnaryFunction = t3;\n" -" _._runBinaryFunction = t4;\n" -" _._registerCallbackFunction = t5;\n" -" _._registerUnaryCallbackFunction = t6;\n" -" _._registerBinaryCallbackFunction = t7;\n" -" _._errorCallbackFunction = t8;\n" -" _._scheduleMicrotaskFunction = t9;\n" -" _._createTimerFunction = t10;\n" -" _._createPeriodicTimerFunction = t11;\n" -" _._printFunction = t12;\n" -" _._forkFunction = t13;\n" -" _._handleUncaughtErrorFunction = t14;\n" -" _._zoneValues = t15;\n" -" },\n" -" Zone_bindCallback_closure: function Zone_bindCallback_closure(t0, t1, t2) {\n" +" _._run = t0;\n" +" _._runUnary = t1;\n" +" _._runBinary = t2;\n" +" _._registerCallback = t3;\n" +" _._registerUnaryCallback = t4;\n" +" _._registerBinaryCallback = t5;\n" +" _._errorCallback = t6;\n" +" _._scheduleMicrotask = t7;\n" +" _._createTimer = t8;\n" +" _._createPeriodicTimer = t9;\n" +" _._print = t10;\n" +" _._fork = t11;\n" +" _._handleUncaughtError = t12;\n" +" _._zoneValues = t13;\n" +" _._delegateCache = null;\n" +" _.parent = t14;\n" +" },\n" +" _CustomZone_bindCallback_closure: function _CustomZone_bindCallback_closure(t0, t1, t2) {\n" " this.\$this = t0;\n" " this.registered = t1;\n" " this.R = t2;\n" " },\n" -" Zone_bindCallbackGuarded_closure: function Zone_bindCallbackGuarded_closure(t0, t1) {\n" +" _CustomZone_bindCallbackGuarded_closure: function _CustomZone_bindCallbackGuarded_closure(t0, t1) {\n" " this.\$this = t0;\n" " this.registered = t1;\n" " },\n" -" Zone_bindUnaryCallbackGuarded_closure: function Zone_bindUnaryCallbackGuarded_closure(t0, t1, t2) {\n" +" _CustomZone_bindUnaryCallbackGuarded_closure: function _CustomZone_bindUnaryCallbackGuarded_closure(t0, t1, t2) {\n" " this.\$this = t0;\n" " this.registered = t1;\n" " this.T = t2;\n" " },\n" -" runZonedGuarded_errorHandler: function runZonedGuarded_errorHandler(t0, t1) {\n" +" _RootZone: function _RootZone() {\n" +" },\n" +" _RootZone_bindCallback_closure: function _RootZone_bindCallback_closure(t0, t1, t2) {\n" +" this.\$this = t0;\n" +" this.f = t1;\n" +" this.R = t2;\n" +" },\n" +" _RootZone_bindCallbackGuarded_closure: function _RootZone_bindCallbackGuarded_closure(t0, t1) {\n" +" this.\$this = t0;\n" +" this.f = t1;\n" +" },\n" +" _RootZone_bindUnaryCallbackGuarded_closure: function _RootZone_bindUnaryCallbackGuarded_closure(t0, t1, t2) {\n" +" this.\$this = t0;\n" +" this.f = t1;\n" +" this.T = t2;\n" +" },\n" +" runZonedGuarded_closure: function runZonedGuarded_closure(t0, t1) {\n" " this.parentZone = t0;\n" " this.onError = t1;\n" " },\n" -" ZoneDelegate: function ZoneDelegate(t0) {\n" -" this._zone = t0;\n" +" _ZoneDelegate: function _ZoneDelegate(t0) {\n" +" this._delegationTarget = t0;\n" " },\n" -" _rootHandleUncaughtError_closure: function _rootHandleUncaughtError_closure(t0, t1) {\n" +" _rootHandleError_closure: function _rootHandleError_closure(t0, t1) {\n" " this.error = t0;\n" " this.stackTrace = t1;\n" " },\n" @@ -4973,7 +5268,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._data = null;\n" " },\n" " _JsonMapKeyIterable: function _JsonMapKeyIterable(t0) {\n" -" this._convert\$_parent = t0;\n" +" this._parent = t0;\n" " },\n" " _Utf8Decoder__decoder_closure: function _Utf8Decoder__decoder_closure() {\n" " },\n" @@ -5296,6 +5591,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " ConcurrentModificationError\$(modifiedObject) {\n" " return new A.ConcurrentModificationError(modifiedObject);\n" " },\n" +" Exception_Exception(message) {\n" +" return new A._Exception(message);\n" +" },\n" " FormatException\$(message, source, offset) {\n" " return new A.FormatException(message, source, offset);\n" " },\n" @@ -7350,35 +7648,35 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " },\n" " BaseResponse: function BaseResponse() {\n" " },\n" -" _toClientException(e, request) {\n" -" var message;\n" -" if (type\$.JSObject._is(e) && \"AbortError\" === A._asString(e.name))\n" -" return new A.RequestAbortedException(\"Request aborted by `abortTrigger`\", request.url);\n" +" _rethrowAsClientException(e, st, request) {\n" +" var t1, message;\n" +" if (type\$.JSObject._is(e))\n" +" t1 = A._asString(e.name) === \"AbortError\";\n" +" else\n" +" t1 = false;\n" +" if (t1)\n" +" A.Error_throwWithStackTrace(new A.RequestAbortedException(\"Request aborted by `abortTrigger`\", request.url), st);\n" " if (!(e instanceof A.ClientException)) {\n" " message = J.toString\$0\$(e);\n" " if (B.JSString_methods.startsWith\$1(message, \"TypeError: \"))\n" " message = B.JSString_methods.substring\$1(message, 11);\n" " e = new A.ClientException(message, request.url);\n" " }\n" -" return e;\n" -" },\n" -" _rethrowAsClientException(e, st, request) {\n" -" A.Error_throwWithStackTrace(A._toClientException(e, request), st);\n" +" A.Error_throwWithStackTrace(e, st);\n" " },\n" -" _bodyToStream(request, response) {\n" -" return new A._MultiStream(false, new A._bodyToStream_closure(request, response), type\$._MultiStream_List_int);\n" +" _readBody(request, response) {\n" +" return A._readBody\$body(request, response);\n" " },\n" -" _readStreamBody(request, response, controller) {\n" -" return A._readStreamBody\$body(request, response, controller);\n" -" },\n" -" _readStreamBody\$body(request, response, controller) {\n" -" var \$async\$goto = 0,\n" -" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void),\n" -" \$async\$returnValue, \$async\$handler = 2, \$async\$errorStack = [], chunk, e, s, t2, t3, t4, t5, exception, t6, t7, _box_0, t1, reader, \$async\$exception;\n" -" var \$async\$_readStreamBody = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" -" if (\$async\$errorCode === 1) {\n" -" \$async\$errorStack.push(\$async\$result);\n" -" \$async\$goto = \$async\$handler;\n" +" _readBody\$body(request, response) {\n" +" var \$async\$_readBody = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" +" switch (\$async\$errorCode) {\n" +" case 2:\n" +" \$async\$next = \$async\$nextWhenCanceled;\n" +" \$async\$goto = \$async\$next.pop();\n" +" break;\n" +" case 1:\n" +" \$async\$errorStack.push(\$async\$result);\n" +" \$async\$goto = \$async\$handler;\n" " }\n" " for (;;)\n" " switch (\$async\$goto) {\n" @@ -7386,124 +7684,114 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " // Function start\n" " _box_0 = {};\n" " t1 = A._asJSObjectQ(response.body);\n" -" reader = t1 == null ? null : A._asJSObject(t1.getReader());\n" -" \$async\$goto = reader == null ? 3 : 4;\n" -" break;\n" -" case 3:\n" -" // then\n" -" \$async\$goto = 5;\n" -" return A._asyncAwait(controller.close\$0(), \$async\$_readStreamBody);\n" -" case 5:\n" -" // returning from await.\n" -" // goto return\n" -" \$async\$goto = 1;\n" -" break;\n" -" case 4:\n" -" // join\n" -" _box_0.resumeSignal = null;\n" -" _box_0.hadError = _box_0.cancelled = false;\n" -" controller.set\$onResume(new A._readStreamBody_closure(_box_0));\n" -" controller.set\$onCancel(new A._readStreamBody_closure0(_box_0, reader, request));\n" -" t1 = type\$.NativeUint8List, t2 = controller.\$ti._precomputed1, t3 = type\$.JSObject, t4 = type\$._Future_void, t5 = type\$._AsyncCompleter_void;\n" -" case 6:\n" +" bodyStreamReader = t1 == null ? null : A._asJSObject(t1.getReader());\n" +" if (bodyStreamReader == null) {\n" +" // goto return\n" +" \$async\$goto = 1;\n" +" break;\n" +" }\n" +" isDone = false;\n" +" _box_0.isError = false;\n" +" \$async\$handler = 4;\n" +" t1 = type\$.NativeUint8List, t2 = type\$.JSObject;\n" +" case 7:\n" " // for condition\n" " // trivial condition\n" -" chunk = null;\n" -" \$async\$handler = 9;\n" -" \$async\$goto = 12;\n" -" return A._asyncAwait(A.promiseToFuture(A._asJSObject(reader.read()), t3), \$async\$_readStreamBody);\n" -" case 12:\n" +" \$async\$goto = 9;\n" +" return A._asyncStarHelper(A.promiseToFuture(A._asJSObject(bodyStreamReader.read()), t2), \$async\$_readBody, \$async\$controller);\n" +" case 9:\n" " // returning from await.\n" " chunk = \$async\$result;\n" -" \$async\$handler = 2;\n" -" // goto after finally\n" -" \$async\$goto = 11;\n" +" if (A._asBool(chunk.done)) {\n" +" isDone = true;\n" +" // goto after for\n" +" \$async\$goto = 8;\n" +" break;\n" +" }\n" +" t3 = chunk.value;\n" +" t3.toString;\n" +" \$async\$goto = 10;\n" +" \$async\$nextWhenCanceled = [1, 5];\n" +" return A._asyncStarHelper(A._IterationMarker_yieldSingle(t1._as(t3)), \$async\$_readBody, \$async\$controller);\n" +" case 10:\n" +" // after yield\n" +" // goto for condition\n" +" \$async\$goto = 7;\n" " break;\n" -" case 9:\n" +" case 8:\n" +" // after for\n" +" \$async\$next.push(6);\n" +" // goto finally\n" +" \$async\$goto = 5;\n" +" break;\n" +" case 4:\n" " // catch\n" -" \$async\$handler = 8;\n" +" \$async\$handler = 3;\n" " \$async\$exception = \$async\$errorStack.pop();\n" " e = A.unwrapException(\$async\$exception);\n" -" s = A.getTraceFromException(\$async\$exception);\n" -" \$async\$goto = !_box_0.cancelled ? 13 : 14;\n" +" st = A.getTraceFromException(\$async\$exception);\n" +" _box_0.isError = true;\n" +" A._rethrowAsClientException(e, st, request);\n" +" \$async\$next.push(6);\n" +" // goto finally\n" +" \$async\$goto = 5;\n" " break;\n" -" case 13:\n" +" case 3:\n" +" // uncaught\n" +" \$async\$next = [2];\n" +" case 5:\n" +" // finally\n" +" \$async\$handler = 2;\n" +" \$async\$goto = !isDone ? 11 : 12;\n" +" break;\n" +" case 11:\n" " // then\n" -" _box_0.hadError = true;\n" -" t1 = A._toClientException(e, request);\n" -" t2 = type\$.nullable_StackTrace._as(s);\n" -" t3 = controller._state;\n" -" if (t3 >= 4)\n" -" A.throwExpression(controller._badEventState\$0());\n" -" if ((t3 & 1) !== 0) {\n" -" t3 = controller.get\$_subscription();\n" -" t3._addError\$2(t1, t2 == null ? B._StringStackTrace_OdL : t2);\n" -" }\n" -" \$async\$goto = 15;\n" -" return A._asyncAwait(controller.close\$0(), \$async\$_readStreamBody);\n" -" case 15:\n" +" \$async\$handler = 14;\n" +" \$async\$goto = 17;\n" +" return A._asyncStarHelper(A.promiseToFuture(A._asJSObject(bodyStreamReader.cancel()), type\$.nullable_Object).catchError\$2\$test(new A._readBody_closure(), new A._readBody_closure0(_box_0)), \$async\$_readBody, \$async\$controller);\n" +" case 17:\n" " // returning from await.\n" -" case 14:\n" -" // join\n" -" // goto after for\n" -" \$async\$goto = 7;\n" +" \$async\$handler = 2;\n" +" // goto after finally\n" +" \$async\$goto = 16;\n" " break;\n" +" case 14:\n" +" // catch\n" +" \$async\$handler = 13;\n" +" \$async\$exception1 = \$async\$errorStack.pop();\n" +" e0 = A.unwrapException(\$async\$exception1);\n" +" st0 = A.getTraceFromException(\$async\$exception1);\n" +" if (!_box_0.isError)\n" +" A._rethrowAsClientException(e0, st0, request);\n" " // goto after finally\n" -" \$async\$goto = 11;\n" +" \$async\$goto = 16;\n" " break;\n" -" case 8:\n" +" case 13:\n" " // uncaught\n" " // goto rethrow\n" " \$async\$goto = 2;\n" " break;\n" -" case 11:\n" -" // after finally\n" -" if (A._asBool(chunk.done)) {\n" -" controller.closeSync\$0();\n" -" // goto after for\n" -" \$async\$goto = 7;\n" -" break;\n" -" } else {\n" -" t6 = chunk.value;\n" -" t6.toString;\n" -" t6 = t2._as(t1._as(t6));\n" -" t7 = controller._state;\n" -" if (t7 >= 4)\n" -" A.throwExpression(controller._badEventState\$0());\n" -" if ((t7 & 1) !== 0)\n" -" controller.get\$_subscription()._add\$1(t6);\n" -" }\n" -" t6 = controller._state;\n" -" \$async\$goto = ((t6 & 1) !== 0 ? (controller.get\$_subscription()._state & 4) !== 0 : (t6 & 2) === 0) ? 16 : 17;\n" -" break;\n" " case 16:\n" -" // then\n" -" t6 = _box_0.resumeSignal;\n" -" \$async\$goto = 18;\n" -" return A._asyncAwait((t6 == null ? _box_0.resumeSignal = new A._AsyncCompleter(new A._Future(\$.Zone__current, t4), t5) : t6).future, \$async\$_readStreamBody);\n" -" case 18:\n" -" // returning from await.\n" -" case 17:\n" +" // after finally\n" +" case 12:\n" " // join\n" -" if ((controller._state & 1) === 0) {\n" -" // goto after for\n" -" \$async\$goto = 7;\n" -" break;\n" -" }\n" -" // goto for condition\n" -" \$async\$goto = 6;\n" +" // goto the next finally handler\n" +" \$async\$goto = \$async\$next.pop();\n" " break;\n" -" case 7:\n" -" // after for\n" +" case 6:\n" +" // after finally\n" " case 1:\n" " // return\n" -" return A._asyncReturn(\$async\$returnValue, \$async\$completer);\n" +" return A._asyncStarHelper(null, 0, \$async\$controller);\n" " case 2:\n" " // rethrow\n" -" return A._asyncRethrow(\$async\$errorStack.at(-1), \$async\$completer);\n" +" return A._asyncStarHelper(\$async\$errorStack.at(-1), 1, \$async\$controller);\n" " }\n" " });\n" -" return A._asyncStartSync(\$async\$_readStreamBody, \$async\$completer);\n" +" var \$async\$goto = 0,\n" +" \$async\$controller = A._makeAsyncStarStreamController(\$async\$_readBody, type\$.List_int),\n" +" \$async\$nextWhenCanceled, \$async\$handler = 2, \$async\$errorStack = [], \$async\$next = [], isDone, chunk, e, st, e0, st0, t2, t3, exception, _box_0, t1, bodyStreamReader, \$async\$exception, \$async\$exception1;\n" +" return A._streamOfController(\$async\$controller);\n" " },\n" " BrowserClient: function BrowserClient(t0) {\n" " this.withCredentials = false;\n" @@ -7512,17 +7800,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " BrowserClient_send_closure: function BrowserClient_send_closure(t0) {\n" " this.headers = t0;\n" " },\n" -" _bodyToStream_closure: function _bodyToStream_closure(t0, t1) {\n" -" this.request = t0;\n" -" this.response = t1;\n" -" },\n" -" _readStreamBody_closure: function _readStreamBody_closure(t0) {\n" -" this._box_0 = t0;\n" +" _readBody_closure: function _readBody_closure() {\n" " },\n" -" _readStreamBody_closure0: function _readStreamBody_closure0(t0, t1, t2) {\n" +" _readBody_closure0: function _readBody_closure0(t0) {\n" " this._box_0 = t0;\n" -" this.reader = t1;\n" -" this.request = t2;\n" " },\n" " ByteStream: function ByteStream(t0) {\n" " this._stream = t0;\n" @@ -8109,10 +8390,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _.text = t3;\n" " },\n" " SseClient\$(serverUrl, debugKey) {\n" -" var t3, t4, t5,\n" +" var t3, t4, t5, _null = null,\n" " t1 = type\$.String,\n" -" t2 = A.StreamController_StreamController(t1);\n" -" t1 = A.StreamController_StreamController(t1);\n" +" t2 = A.StreamController_StreamController(_null, _null, _null, t1);\n" +" t1 = A.StreamController_StreamController(_null, _null, _null, t1);\n" " t3 = A.Logger_Logger(\"SseClient\");\n" " t4 = \$.Zone__current;\n" " t5 = A.generateId();\n" @@ -8177,7 +8458,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " },\n" " _wrapZone(callback, \$T) {\n" " var t1 = \$.Zone__current;\n" -" if (t1 === B.Zone_jYP)\n" +" if (t1 === B.C__RootZone)\n" " return callback;\n" " return t1.bindUnaryCallbackGuarded\$1\$1(callback, \$T);\n" " },\n" @@ -8227,7 +8508,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1 = type\$.JSArray_nullable_Object._as(new t1());\n" " webSocket = A._asJSObject(new t2(t3, t1));\n" " webSocket.binaryType = \"arraybuffer\";\n" -" browserSocket = new A.BrowserWebSocket(webSocket, A.StreamController_StreamController(type\$.WebSocketEvent));\n" +" browserSocket = new A.BrowserWebSocket(webSocket, A.StreamController_StreamController(null, null, null, type\$.WebSocketEvent));\n" " t1 = new A._Future(\$.Zone__current, type\$._Future_BrowserWebSocket);\n" " webSocketConnected = new A._AsyncCompleter(t1, type\$._AsyncCompleter_BrowserWebSocket);\n" " if (A._asInt(webSocket.readyState) === 1)\n" @@ -8490,7 +8771,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " handleWebSocketHotReloadRequest\$body(\$event, manager, clientSink) {\n" " var \$async\$goto = 0,\n" " \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void),\n" -" \$async\$handler = 1, \$async\$errorStack = [], e, path, exception, requestId, \$async\$exception;\n" +" \$async\$handler = 1, \$async\$errorStack = [], e, exception, requestId, \$async\$exception;\n" " var \$async\$handleWebSocketHotReloadRequest = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" " if (\$async\$errorCode === 1) {\n" " \$async\$errorStack.push(\$async\$result);\n" @@ -8502,10 +8783,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " // Function start\n" " requestId = \$event.id;\n" " \$async\$handler = 3;\n" -" path = A._asStringQ(init.G.\$reloadedSourcesPath);\n" -" path.toString;\n" " \$async\$goto = 6;\n" -" return A._asyncAwait(manager._restarter.hotReloadStart\$1(path), \$async\$handleWebSocketHotReloadRequest);\n" +" return A._asyncAwait(manager._restarter.hotReloadStart\$1(A._asStringQ(init.G.\$reloadedSourcesPath)), \$async\$handleWebSocketHotReloadRequest);\n" " case 6:\n" " // returning from await.\n" " \$async\$goto = 7;\n" @@ -8548,7 +8827,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " handleWebSocketHotRestartRequest\$body(\$event, manager, clientSink) {\n" " var \$async\$goto = 0,\n" " \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void),\n" -" \$async\$handler = 1, \$async\$errorStack = [], runId, e, t1, t2, exception, requestId, \$async\$exception;\n" +" \$async\$handler = 1, \$async\$errorStack = [], runId, e, t1, exception, requestId, \$async\$exception;\n" " var \$async\$handleWebSocketHotRestartRequest = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" " if (\$async\$errorCode === 1) {\n" " \$async\$errorStack.push(\$async\$result);\n" @@ -8566,10 +8845,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " break;\n" " case 6:\n" " // then\n" -" t2 = A._asStringQ(t1.\$reloadedSourcesPath);\n" -" t2.toString;\n" " \$async\$goto = 9;\n" -" return A._asyncAwait(manager.hotRestartBegin\$1(t2), \$async\$handleWebSocketHotRestartRequest);\n" +" return A._asyncAwait(manager.hotRestartBegin\$1(A._asStringQ(t1.\$reloadedSourcesPath)), \$async\$handleWebSocketHotRestartRequest);\n" " case 9:\n" " // returning from await.\n" " A._asJSObject(t1.dartDevEmbedder).hotRestartEnd();\n" @@ -9687,6 +9964,12 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return result;\n" " return result + other;\n" " },\n" +" \$tdiv(receiver, other) {\n" +" if ((receiver | 0) === receiver)\n" +" if (other >= 1)\n" +" return receiver / other | 0;\n" +" return this._tdivSlow\$1(receiver, other);\n" +" },\n" " _tdivFast\$1(receiver, other) {\n" " return (receiver | 0) === receiver ? receiver / other | 0 : this._tdivSlow\$1(receiver, other);\n" " },\n" @@ -9921,30 +10204,20 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return this.__internal\$_source.cancel\$0();\n" " },\n" " onData\$1(handleData) {\n" -" var t2,\n" -" t1 = this.\$ti;\n" +" var t1 = this.\$ti;\n" " t1._eval\$1(\"~(2)?\")._as(handleData);\n" -" if (handleData == null)\n" -" t1 = null;\n" -" else {\n" -" t2 = this.__internal\$_zone;\n" -" t1 = t1._rest[1];\n" -" t1 = t2._registerUnaryCallbackZoned\$2\$2(t2, type\$.\$env_1_1_dynamic._bind\$1(t1)._eval\$1(\"1(2)\")._as(handleData), type\$.dynamic, t1);\n" -" }\n" -" this.__internal\$_handleData = t1;\n" +" this.__internal\$_handleData = handleData == null ? null : this.__internal\$_zone.registerUnaryCallback\$2\$1(handleData, type\$.dynamic, t1._rest[1]);\n" " },\n" " onError\$1(handleError) {\n" -" var t1, _this = this;\n" +" var _this = this;\n" " _this.__internal\$_source.onError\$1(handleError);\n" " if (handleError == null)\n" " _this.__internal\$_handleError = null;\n" -" else if (type\$.void_Function_Object_StackTrace._is(handleError)) {\n" -" t1 = _this.__internal\$_zone;\n" -" _this.__internal\$_handleError = t1._registerBinaryCallbackZoned\$3\$2(t1, type\$.dynamic_Function_Object_StackTrace._as(handleError), type\$.dynamic, type\$.Object, type\$.StackTrace);\n" -" } else if (type\$.void_Function_Object._is(handleError)) {\n" -" t1 = _this.__internal\$_zone;\n" -" _this.__internal\$_handleError = t1._registerUnaryCallbackZoned\$2\$2(t1, type\$.dynamic_Function_Object._as(handleError), type\$.dynamic, type\$.Object);\n" -" } else\n" +" else if (type\$.void_Function_Object_StackTrace._is(handleError))\n" +" _this.__internal\$_handleError = _this.__internal\$_zone.registerBinaryCallback\$3\$1(handleError, type\$.dynamic, type\$.Object, type\$.StackTrace);\n" +" else if (type\$.void_Function_Object._is(handleError))\n" +" _this.__internal\$_handleError = _this.__internal\$_zone.registerUnaryCallback\$2\$1(handleError, type\$.dynamic, type\$.Object);\n" +" else\n" " throw A.wrapException(A.ArgumentError\$(string\$.handle, null));\n" " },\n" " __internal\$_onData\$1(data) {\n" @@ -9961,10 +10234,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " error = A.unwrapException(exception);\n" " stack = A.getTraceFromException(exception);\n" " handleError = _this.__internal\$_handleError;\n" -" if (handleError == null) {\n" -" t1 = _this.__internal\$_zone;\n" -" t1._handleUncaughtErrorZoned\$3(t1, A._asObject(error), type\$.StackTrace._as(stack));\n" -" } else {\n" +" if (handleError == null)\n" +" _this.__internal\$_zone.handleUncaughtError\$2(error, stack);\n" +" else {\n" " t1 = type\$.Object;\n" " t2 = _this.__internal\$_zone;\n" " if (type\$.void_Function_Object_StackTrace._is(handleError))\n" @@ -10151,7 +10423,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$0() {\n" " return A.Future_Future\$value(null, type\$.void);\n" " },\n" -" \$signature: 6\n" +" \$signature: 9\n" " };\n" " A.SentinelValue.prototype = {};\n" " A.EfficientLengthIterable.prototype = {};\n" @@ -10717,6 +10989,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$2(a0, a1) {\n" " return this._genericClosure.call\$1\$2(a0, a1, this.\$ti._rest[0]);\n" " },\n" +" call\$4(a0, a1, a2, a3) {\n" +" return this._genericClosure.call\$1\$4(a0, a1, a2, a3, this.\$ti._rest[0]);\n" +" },\n" " \$signature() {\n" " return A.instantiatedGenericFunctionType(A.closureFunctionType(this._genericClosure), this.\$ti);\n" " }\n" @@ -11153,13 +11428,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$2(o, tag) {\n" " return this.getUnknownTag(o, tag);\n" " },\n" -" \$signature: 73\n" +" \$signature: 31\n" " };\n" " A.initHooks_closure1.prototype = {\n" " call\$1(tag) {\n" " return this.prototypeForTag(A._asString(tag));\n" " },\n" -" \$signature: 59\n" +" \$signature: 30\n" " };\n" " A._Record.prototype = {\n" " get\$runtimeType(_) {\n" @@ -11667,7 +11942,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1.storedCallback = null;\n" " f.call\$0();\n" " },\n" -" \$signature: 8\n" +" \$signature: 4\n" " };\n" " A._AsyncRun__initializeScheduleImmediate_closure.prototype = {\n" " call\$1(callback) {\n" @@ -11677,7 +11952,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t2 = this.span;\n" " t1.firstChild ? t1.removeChild(t2) : t1.appendChild(t2);\n" " },\n" -" \$signature: 43\n" +" \$signature: 49\n" " };\n" " A._AsyncRun__scheduleImmediateJsOverride_internalCallback.prototype = {\n" " call\$0() {\n" @@ -11698,6 +11973,12 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " else\n" " throw A.wrapException(A.UnsupportedError\$(\"`setTimeout()` not found.\"));\n" " },\n" +" _TimerImpl\$periodic\$2(milliseconds, callback) {\n" +" if (self.setTimeout != null)\n" +" this._handle = self.setInterval(A.convertDartClosureToJS(new A._TimerImpl\$periodic_closure(this, milliseconds, Date.now(), callback), 0), milliseconds);\n" +" else\n" +" throw A.wrapException(A.UnsupportedError\$(\"Periodic timer.\"));\n" +" },\n" " get\$isActive() {\n" " return this._handle != null;\n" " },\n" @@ -11706,7 +11987,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " var t1 = this._handle;\n" " if (t1 == null)\n" " return;\n" -" self.clearTimeout(t1);\n" +" if (this._once)\n" +" self.clearTimeout(t1);\n" +" else\n" +" self.clearInterval(t1);\n" " this._handle = null;\n" " } else\n" " throw A.wrapException(A.UnsupportedError\$(\"Canceling a timer.\"));\n" @@ -11715,11 +11999,29 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._TimerImpl_internalCallback.prototype = {\n" " call\$0() {\n" -" this.\$this._handle = null;\n" +" var t1 = this.\$this;\n" +" t1._handle = null;\n" +" t1._tick = 1;\n" " this.callback.call\$0();\n" " },\n" " \$signature: 0\n" " };\n" +" A._TimerImpl\$periodic_closure.prototype = {\n" +" call\$0() {\n" +" var duration, _this = this,\n" +" t1 = _this.\$this,\n" +" tick = t1._tick + 1,\n" +" t2 = _this.milliseconds;\n" +" if (t2 > 0) {\n" +" duration = Date.now() - _this.start;\n" +" if (duration > (tick + 1) * t2)\n" +" tick = B.JSInt_methods.\$tdiv(duration, t2);\n" +" }\n" +" t1._tick = tick;\n" +" _this.callback.call\$1(t1);\n" +" },\n" +" \$signature: 1\n" +" };\n" " A._AsyncAwaitCompleter.prototype = {\n" " complete\$1(value) {\n" " var t2, _this = this,\n" @@ -11750,19 +12052,104 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(result) {\n" " return this.bodyFunction.call\$2(0, result);\n" " },\n" -" \$signature: 4\n" +" \$signature: 5\n" " };\n" " A._awaitOnObject_closure0.prototype = {\n" " call\$2(error, stackTrace) {\n" " this.bodyFunction.call\$2(1, new A.ExceptionAndStackTrace(error, type\$.StackTrace._as(stackTrace)));\n" " },\n" -" \$signature: 48\n" +" \$signature: 54\n" " };\n" " A._wrapJsFunctionForAsync_closure.prototype = {\n" " call\$2(errorCode, result) {\n" " this.\$protected(A._asInt(errorCode), result);\n" " },\n" -" \$signature: 55\n" +" \$signature: 59\n" +" };\n" +" A._asyncStarHelper_closure.prototype = {\n" +" call\$0() {\n" +" var t3,\n" +" t1 = this.controller,\n" +" t2 = t1.___AsyncStarStreamController_controller_A;\n" +" t2 === \$ && A.throwLateFieldNI(\"controller\");\n" +" t3 = t2._state;\n" +" if ((t3 & 1) !== 0 ? (t2.get\$_subscription()._state & 4) !== 0 : (t3 & 2) === 0) {\n" +" t1.isSuspended = true;\n" +" return;\n" +" }\n" +" t1 = t1.cancelationFuture != null ? 2 : 0;\n" +" this.bodyFunction.call\$2(t1, null);\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._asyncStarHelper_closure0.prototype = {\n" +" call\$1(__wc0_formal) {\n" +" var errorCode = this.controller.cancelationFuture != null ? 2 : 0;\n" +" this.bodyFunction.call\$2(errorCode, null);\n" +" },\n" +" \$signature: 4\n" +" };\n" +" A._AsyncStarStreamController.prototype = {\n" +" _AsyncStarStreamController\$1(body, \$T) {\n" +" var _this = this,\n" +" t1 = new A._AsyncStarStreamController__resumeBody(body);\n" +" _this.___AsyncStarStreamController_controller_A = _this.\$ti._eval\$1(\"StreamController<1>\")._as(A.StreamController_StreamController(new A._AsyncStarStreamController_closure(_this, body), new A._AsyncStarStreamController_closure0(t1), new A._AsyncStarStreamController_closure1(_this, t1), \$T));\n" +" }\n" +" };\n" +" A._AsyncStarStreamController__resumeBody.prototype = {\n" +" call\$0() {\n" +" A.scheduleMicrotask(new A._AsyncStarStreamController__resumeBody_closure(this.body));\n" +" },\n" +" \$signature: 1\n" +" };\n" +" A._AsyncStarStreamController__resumeBody_closure.prototype = {\n" +" call\$0() {\n" +" this.body.call\$2(0, null);\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._AsyncStarStreamController_closure0.prototype = {\n" +" call\$0() {\n" +" this._resumeBody.call\$0();\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._AsyncStarStreamController_closure1.prototype = {\n" +" call\$0() {\n" +" var t1 = this.\$this;\n" +" if (t1.isSuspended) {\n" +" t1.isSuspended = false;\n" +" this._resumeBody.call\$0();\n" +" }\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._AsyncStarStreamController_closure.prototype = {\n" +" call\$0() {\n" +" var t1 = this.\$this,\n" +" t2 = t1.___AsyncStarStreamController_controller_A;\n" +" t2 === \$ && A.throwLateFieldNI(\"controller\");\n" +" if ((t2._state & 4) === 0) {\n" +" t1.cancelationFuture = new A._Future(\$.Zone__current, type\$._Future_dynamic);\n" +" if (t1.isSuspended) {\n" +" t1.isSuspended = false;\n" +" A.scheduleMicrotask(new A._AsyncStarStreamController__closure(this.body));\n" +" }\n" +" return t1.cancelationFuture;\n" +" }\n" +" },\n" +" \$signature: 60\n" +" };\n" +" A._AsyncStarStreamController__closure.prototype = {\n" +" call\$0() {\n" +" this.body.call\$2(2, null);\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._IterationMarker.prototype = {\n" +" toString\$0(_) {\n" +" return \"IterationMarker(\" + this.state + \", \" + A.S(this.value) + \")\";\n" +" }\n" " };\n" " A.AsyncError.prototype = {\n" " toString\$0(_) {\n" @@ -11848,11 +12235,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._FutureListener.prototype = {\n" " matchesErrorTest\$1(asyncError) {\n" -" var t1;\n" " if ((this.state & 15) !== 6)\n" " return true;\n" -" t1 = this.result._zone;\n" -" return t1._runUnaryZoned\$2\$3(t1, type\$.bool_Function_Object._as(this.callback), asyncError.error, type\$.bool, type\$.Object);\n" +" return this.result._zone.runUnary\$2\$2(type\$.bool_Function_Object._as(this.callback), asyncError.error, type\$.bool, type\$.Object);\n" " },\n" " handleError\$1(asyncError) {\n" " var exception, _this = this,\n" @@ -11863,9 +12248,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t3 = asyncError.error,\n" " t4 = _this.result._zone;\n" " if (type\$.dynamic_Function_Object_StackTrace._is(errorCallback))\n" -" result = t4._runBinaryZoned\$3\$4(t4, errorCallback, t3, asyncError.stackTrace, t1, t2, type\$.StackTrace);\n" +" result = t4.runBinary\$3\$3(errorCallback, t3, asyncError.stackTrace, t1, t2, type\$.StackTrace);\n" " else\n" -" result = t4._runUnaryZoned\$2\$3(t4, type\$.dynamic_Function_Object._as(errorCallback), t3, t1, t2);\n" +" result = t4.runUnary\$2\$2(type\$.dynamic_Function_Object._as(errorCallback), t3, t1, t2);\n" " try {\n" " t1 = _this.\$ti._eval\$1(\"2/\")._as(result);\n" " return t1;\n" @@ -11881,16 +12266,15 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._Future.prototype = {\n" " then\$1\$2\$onError(f, onError, \$R) {\n" -" var currentZone, t2, result,\n" +" var currentZone, result, t2,\n" " t1 = this.\$ti;\n" " t1._bind\$1(\$R)._eval\$1(\"1/(2)\")._as(f);\n" " currentZone = \$.Zone__current;\n" -" if (currentZone === B.Zone_jYP) {\n" +" if (currentZone === B.C__RootZone) {\n" " if (onError != null && !type\$.dynamic_Function_Object_StackTrace._is(onError) && !type\$.dynamic_Function_Object._is(onError))\n" " throw A.wrapException(A.ArgumentError\$value(onError, \"onError\", string\$.Error_));\n" " } else {\n" -" t2 = t1._precomputed1;\n" -" f = currentZone._registerUnaryCallbackZoned\$2\$2(currentZone, \$R._eval\$1(\"@<0/>\")._bind\$1(t2)._eval\$1(\"1(2)\")._as(f), \$R._eval\$1(\"0/\"), t2);\n" +" f = currentZone.registerUnaryCallback\$2\$1(f, \$R._eval\$1(\"0/\"), t1._precomputed1);\n" " if (onError != null)\n" " onError = A._registerErrorHandler(onError, currentZone);\n" " }\n" @@ -11910,23 +12294,32 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._addListener\$1(new A._FutureListener(result, 19, f, onError, t1._eval\$1(\"@<1>\")._bind\$1(\$E)._eval\$1(\"_FutureListener<1,2>\")));\n" " return result;\n" " },\n" -" catchError\$1(onError) {\n" -" var t1 = this.\$ti,\n" -" resultZone = \$.Zone__current,\n" -" result = new A._Future(resultZone, t1);\n" -" if (resultZone !== B.Zone_jYP)\n" -" onError = A._registerErrorHandler(onError, resultZone);\n" -" this._addListener\$1(new A._FutureListener(result, 2, null, onError, t1._eval\$1(\"_FutureListener<1,1>\")));\n" +" catchError\$2\$test(onError, test) {\n" +" var t1, t2, result;\n" +" type\$.nullable_bool_Function_Object._as(test);\n" +" t1 = this.\$ti;\n" +" t2 = \$.Zone__current;\n" +" result = new A._Future(t2, t1);\n" +" if (t2 !== B.C__RootZone) {\n" +" onError = A._registerErrorHandler(onError, t2);\n" +" if (test != null)\n" +" test = t2.registerUnaryCallback\$2\$1(test, type\$.bool, type\$.Object);\n" +" }\n" +" t2 = test == null ? 2 : 6;\n" +" this._addListener\$1(new A._FutureListener(result, t2, test, onError, t1._eval\$1(\"_FutureListener<1,1>\")));\n" " return result;\n" " },\n" +" catchError\$1(onError) {\n" +" return this.catchError\$2\$test(onError, null);\n" +" },\n" " whenComplete\$1(action) {\n" -" var t1, resultZone, result;\n" +" var t1, t2, result;\n" " type\$.dynamic_Function._as(action);\n" " t1 = this.\$ti;\n" -" resultZone = \$.Zone__current;\n" -" result = new A._Future(resultZone, t1);\n" -" if (resultZone !== B.Zone_jYP)\n" -" action = resultZone._registerCallbackZoned\$1\$2(resultZone, action, type\$.dynamic);\n" +" t2 = \$.Zone__current;\n" +" result = new A._Future(t2, t1);\n" +" if (t2 !== B.C__RootZone)\n" +" action = t2.registerCallback\$1\$1(action, type\$.dynamic);\n" " this._addListener\$1(new A._FutureListener(result, 8, action, null, t1._eval\$1(\"_FutureListener<1,1>\")));\n" " return result;\n" " },\n" @@ -11953,8 +12346,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " _this._cloneResult\$1(source);\n" " }\n" -" t1 = _this._zone;\n" -" t1._scheduleMicrotaskZoned\$2(t1, new A._Future__addListener_closure(_this, listener));\n" +" _this._zone.scheduleMicrotask\$1(new A._Future__addListener_closure(_this, listener));\n" " }\n" " },\n" " _prependListeners\$1(listeners) {\n" @@ -11982,8 +12374,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _this._cloneResult\$1(source);\n" " }\n" " _box_0.listeners = _this._reverseListeners\$1(listeners);\n" -" t1 = _this._zone;\n" -" t1._scheduleMicrotaskZoned\$2(t1, new A._Future__prependListeners_closure(_box_0, _this));\n" +" _this._zone.scheduleMicrotask\$1(new A._Future__prependListeners_closure(_box_0, _this));\n" " }\n" " },\n" " _removeListeners\$0() {\n" @@ -12022,8 +12413,14 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " A._Future__propagateToListeners(_this, listeners);\n" " },\n" " _completeWithResultOf\$1(source) {\n" -" var listeners, _this = this;\n" -" if ((source._state & 16) !== 0 && _this._zone._handleUncaughtErrorFunction != source._zone._handleUncaughtErrorFunction)\n" +" var t1, t2, listeners, _this = this;\n" +" if ((source._state & 16) !== 0) {\n" +" t1 = _this._zone;\n" +" t2 = source._zone;\n" +" t1 = !(t1 === t2 || t1.get\$errorZone() === t2.get\$errorZone());\n" +" } else\n" +" t1 = false;\n" +" if (t1)\n" " return;\n" " listeners = _this._removeListeners\$0();\n" " _this._cloneResult\$1(source);\n" @@ -12049,21 +12446,18 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._asyncCompleteWithValue\$1(value);\n" " },\n" " _asyncCompleteWithValue\$1(value) {\n" -" var t1, _this = this;\n" +" var _this = this;\n" " _this.\$ti._precomputed1._as(value);\n" " _this._state ^= 2;\n" -" t1 = _this._zone;\n" -" t1._scheduleMicrotaskZoned\$2(t1, new A._Future__asyncCompleteWithValue_closure(_this, value));\n" +" _this._zone.scheduleMicrotask\$1(new A._Future__asyncCompleteWithValue_closure(_this, value));\n" " },\n" " _chainFuture\$1(value) {\n" " A._Future__chainCoreFuture(this.\$ti._eval\$1(\"Future<1>\")._as(value), this, false);\n" " return;\n" " },\n" " _asyncCompleteErrorObject\$1(error) {\n" -" var t1;\n" " this._state ^= 2;\n" -" t1 = this._zone;\n" -" t1._scheduleMicrotaskZoned\$2(t1, new A._Future__asyncCompleteErrorObject_closure(this, error));\n" +" this._zone.scheduleMicrotask\$1(new A._Future__asyncCompleteErrorObject_closure(this, error));\n" " },\n" " timeout\$2\$onTimeout(timeLimit, onTimeout) {\n" " var t3, _future, _this = this, t1 = {},\n" @@ -12077,7 +12471,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t3 = \$.Zone__current;\n" " _future = new A._Future(t3, t2);\n" " t1.timer = null;\n" -" t1.timer = A.Timer_Timer(timeLimit, new A._Future_timeout_closure(_this, _future, t3, t3._registerCallbackZoned\$1\$2(t3, t2._eval\$1(\"1/()\")._as(onTimeout), t2._eval\$1(\"1/\"))));\n" +" t1.timer = A.Timer_Timer(timeLimit, new A._Future_timeout_closure(_this, _future, t3, t3.registerCallback\$1\$1(onTimeout, t2._eval\$1(\"1/\"))));\n" " _this.then\$1\$2\$onError(new A._Future_timeout_closure0(t1, _this, _future), new A._Future_timeout_closure1(t1, _future), type\$.Null);\n" " return _future;\n" " },\n" @@ -12115,11 +12509,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._Future__propagateToListeners_handleWhenCompleteCallback.prototype = {\n" " call\$0() {\n" -" var e, s, t1, t2, exception, t3, originalSource, joinedResult, _this = this, completeResult = null;\n" +" var e, s, t1, exception, t2, t3, originalSource, joinedResult, _this = this, completeResult = null;\n" " try {\n" " t1 = _this._box_0.listener;\n" -" t2 = t1.result._zone;\n" -" completeResult = t2._runZoned\$1\$2(t2, type\$.dynamic_Function._as(t1.callback), type\$.dynamic);\n" +" completeResult = t1.result._zone.run\$1\$1(type\$.dynamic_Function._as(t1.callback), type\$.dynamic);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" @@ -12161,7 +12554,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(__wc0_formal) {\n" " this.joinedResult._completeWithResultOf\$1(this.originalSource);\n" " },\n" -" \$signature: 8\n" +" \$signature: 4\n" " };\n" " A._Future__propagateToListeners_handleWhenCompleteCallback_closure0.prototype = {\n" " call\$2(e, s) {\n" @@ -12173,15 +12566,14 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._Future__propagateToListeners_handleValueCallback.prototype = {\n" " call\$0() {\n" -" var e, s, t1, t2, t3, t4, t5, t6, exception;\n" +" var e, s, t1, t2, t3, t4, t5, exception;\n" " try {\n" " t1 = this._box_0;\n" " t2 = t1.listener;\n" " t3 = t2.\$ti;\n" " t4 = t3._precomputed1;\n" " t5 = t4._as(this.sourceResult);\n" -" t6 = t2.result._zone;\n" -" t1.listenerValueOrError = t6._runUnaryZoned\$2\$3(t6, t3._eval\$1(\"2/(1)\")._as(t2.callback), t5, t3._eval\$1(\"2/\"), t4);\n" +" t1.listenerValueOrError = t2.result._zone.runUnary\$2\$2(t3._eval\$1(\"2/(1)\")._as(t2.callback), t5, t3._eval\$1(\"2/\"), t4);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" @@ -12230,11 +12622,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._Future_timeout_closure.prototype = {\n" " call\$0() {\n" -" var e, s, t1, t2, exception, _this = this;\n" +" var e, s, exception, t1, t2, _this = this;\n" " try {\n" -" t1 = _this.zone;\n" -" t2 = _this.\$this.\$ti;\n" -" _this._future._complete\$1(t1._runZoned\$1\$2(t1, t2._eval\$1(\"1/()\")._as(_this.onTimeoutHandler), t2._eval\$1(\"1/\")));\n" +" _this._future._complete\$1(_this.zone.run\$1\$1(_this.onTimeoutHandler, _this.\$this.\$ti._eval\$1(\"1/\")));\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" @@ -12343,10 +12733,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " if ((_this._state & 8) === 0)\n" " return A._instanceType(_this)._eval\$1(\"_PendingEvents<1>?\")._as(_this._varData);\n" " t1 = A._instanceType(_this);\n" -" return t1._eval\$1(\"_PendingEvents<1>?\")._as(t1._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData).get\$_varData());\n" +" return t1._eval\$1(\"_PendingEvents<1>?\")._as(t1._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData)._varData);\n" " },\n" " _ensurePendingEvents\$0() {\n" -" var events, t1, _this = this;\n" +" var events, t1, state, _this = this;\n" " if ((_this._state & 8) === 0) {\n" " events = _this._varData;\n" " if (events == null)\n" @@ -12354,13 +12744,16 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._instanceType(_this)._eval\$1(\"_PendingEvents<1>\")._as(events);\n" " }\n" " t1 = A._instanceType(_this);\n" -" events = t1._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData).get\$_varData();\n" +" state = t1._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData);\n" +" events = state._varData;\n" +" if (events == null)\n" +" events = state._varData = new A._PendingEvents(t1._eval\$1(\"_PendingEvents<1>\"));\n" " return t1._eval\$1(\"_PendingEvents<1>\")._as(events);\n" " },\n" " get\$_subscription() {\n" " var varData = this._varData;\n" " if ((this._state & 8) !== 0)\n" -" varData = type\$._StreamControllerAddStreamState_nullable_Object._as(varData).get\$_varData();\n" +" varData = type\$._StreamControllerAddStreamState_nullable_Object._as(varData)._varData;\n" " return A._instanceType(this)._eval\$1(\"_ControllerSubscription<1>\")._as(varData);\n" " },\n" " _badEventState\$0() {\n" @@ -12368,6 +12761,31 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return new A.StateError(\"Cannot add event after closing\");\n" " return new A.StateError(\"Cannot add event while adding a stream\");\n" " },\n" +" addStream\$2\$cancelOnError(source, cancelOnError) {\n" +" var t2, t3, t4, t5, t6, _this = this,\n" +" t1 = A._instanceType(_this);\n" +" t1._eval\$1(\"Stream<1>\")._as(source);\n" +" t2 = _this._state;\n" +" if (t2 >= 4)\n" +" throw A.wrapException(_this._badEventState\$0());\n" +" if ((t2 & 2) !== 0) {\n" +" t1 = new A._Future(\$.Zone__current, type\$._Future_dynamic);\n" +" t1._asyncComplete\$1(null);\n" +" return t1;\n" +" }\n" +" t2 = _this._varData;\n" +" t3 = cancelOnError === true;\n" +" t4 = new A._Future(\$.Zone__current, type\$._Future_dynamic);\n" +" t5 = t1._eval\$1(\"~(1)\")._as(_this.get\$_add());\n" +" t6 = t3 ? A._AddStreamState_makeErrorHandler(_this) : _this.get\$_addError();\n" +" t6 = source.listen\$4\$cancelOnError\$onDone\$onError(t5, t3, _this.get\$_close(), t6);\n" +" t3 = _this._state;\n" +" if ((t3 & 1) !== 0 ? (_this.get\$_subscription()._state & 4) !== 0 : (t3 & 2) === 0)\n" +" t6.pause\$0();\n" +" _this._varData = new A._StreamControllerAddStreamState(t2, t4, t6, t1._eval\$1(\"_StreamControllerAddStreamState<1>\"));\n" +" _this._state |= 8;\n" +" return t4;\n" +" },\n" " _ensureDoneFuture\$0() {\n" " var t1 = this._doneFuture;\n" " if (t1 == null)\n" @@ -12381,6 +12799,16 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " throw A.wrapException(_this._badEventState\$0());\n" " _this._add\$1(value);\n" " },\n" +" addError\$2(error, stackTrace) {\n" +" var _0_0;\n" +" if (this._state >= 4)\n" +" throw A.wrapException(this._badEventState\$0());\n" +" _0_0 = A._interceptUserError(error, stackTrace);\n" +" this._addError\$2(_0_0.error, _0_0.stackTrace);\n" +" },\n" +" addError\$1(error) {\n" +" return this.addError\$2(error, null);\n" +" },\n" " close\$0() {\n" " var _this = this,\n" " t1 = _this._state;\n" @@ -12408,6 +12836,23 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " else if ((t2 & 3) === 0)\n" " _this._ensurePendingEvents\$0().add\$1(0, new A._DelayedData(value, t1._eval\$1(\"_DelayedData<1>\")));\n" " },\n" +" _addError\$2(error, stackTrace) {\n" +" var t1;\n" +" A._asObject(error);\n" +" type\$.StackTrace._as(stackTrace);\n" +" t1 = this._state;\n" +" if ((t1 & 1) !== 0)\n" +" this._sendError\$2(error, stackTrace);\n" +" else if ((t1 & 3) === 0)\n" +" this._ensurePendingEvents\$0().add\$1(0, new A._DelayedError(error, stackTrace));\n" +" },\n" +" _close\$0() {\n" +" var _this = this,\n" +" addState = A._instanceType(_this)._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData);\n" +" _this._varData = addState._varData;\n" +" _this._state &= 4294967287;\n" +" addState.addStreamFuture._asyncComplete\$1(null);\n" +" },\n" " _subscribe\$4(onData, onError, onDone, cancelOnError) {\n" " var t2, t3, t4, t5, t6, t7, subscription, pendingEvents, addState, _this = this,\n" " t1 = A._instanceType(_this);\n" @@ -12421,12 +12866,12 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t5 = A._BufferingStreamSubscription__registerDataHandler(t2, onData, t1._precomputed1);\n" " t6 = A._BufferingStreamSubscription__registerErrorHandler(t2, onError);\n" " t7 = onDone == null ? A.async___nullDoneHandler\$closure() : onDone;\n" -" subscription = new A._ControllerSubscription(_this, t5, t6, t2._registerCallbackZoned\$1\$2(t2, type\$.void_Function._as(t7), type\$.void), t2, t3 | t4, t1._eval\$1(\"_ControllerSubscription<1>\"));\n" +" subscription = new A._ControllerSubscription(_this, t5, t6, t2.registerCallback\$1\$1(t7, type\$.void), t2, t3 | t4, t1._eval\$1(\"_ControllerSubscription<1>\"));\n" " pendingEvents = _this.get\$_pendingEvents();\n" " if (((_this._state |= 1) & 8) !== 0) {\n" " addState = t1._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(_this._varData);\n" -" addState.set\$_varData(subscription);\n" -" addState.resume\$0();\n" +" addState._varData = subscription;\n" +" addState.addSubscription.resume\$0();\n" " } else\n" " _this._varData = subscription;\n" " subscription._setPendingEvents\$1(pendingEvents);\n" @@ -12470,12 +12915,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " set\$onListen(onListen) {\n" " this.onListen = type\$.nullable_void_Function._as(onListen);\n" " },\n" -" set\$onResume(onResume) {\n" -" this.onResume = type\$.nullable_void_Function._as(onResume);\n" -" },\n" -" set\$onCancel(onCancel) {\n" -" this.onCancel = type\$.nullable_void_Function._as(onCancel);\n" -" },\n" " \$isStreamSink: 1,\n" " \$isStreamController: 1,\n" " \$is_StreamControllerLifecycle: 1,\n" @@ -12498,7 +12937,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._AsyncStreamControllerDispatch.prototype = {\n" " _sendData\$1(data) {\n" -" var t1 = A._instanceType(this);\n" +" var t1 = this.\$ti;\n" " t1._precomputed1._as(data);\n" " this.get\$_subscription()._addPending\$1(new A._DelayedData(data, t1._eval\$1(\"_DelayedData<1>\")));\n" " },\n" @@ -12531,7 +12970,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t2 = A._instanceType(t1);\n" " t2._eval\$1(\"StreamSubscription<1>\")._as(this);\n" " if ((t1._state & 8) !== 0)\n" -" t2._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(t1._varData).pause\$0();\n" +" t2._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(t1._varData).addSubscription.pause\$0();\n" " A._runGuarded(t1.onPause);\n" " },\n" " _onResume\$0() {\n" @@ -12539,11 +12978,32 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t2 = A._instanceType(t1);\n" " t2._eval\$1(\"StreamSubscription<1>\")._as(this);\n" " if ((t1._state & 8) !== 0)\n" -" t2._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(t1._varData).resume\$0();\n" +" t2._eval\$1(\"_StreamControllerAddStreamState<1>\")._as(t1._varData).addSubscription.resume\$0();\n" " A._runGuarded(t1.onResume);\n" " }\n" " };\n" " A._StreamSinkWrapper.prototype = {\$isStreamSink: 1};\n" +" A._AddStreamState.prototype = {\n" +" cancel\$0() {\n" +" var cancel = this.addSubscription.cancel\$0();\n" +" return cancel.whenComplete\$1(new A._AddStreamState_cancel_closure(this));\n" +" }\n" +" };\n" +" A._AddStreamState_makeErrorHandler_closure.prototype = {\n" +" call\$2(e, s) {\n" +" var t1 = this.controller;\n" +" t1._addError\$2(A._asObject(e), type\$.StackTrace._as(s));\n" +" t1._close\$0();\n" +" },\n" +" \$signature: 3\n" +" };\n" +" A._AddStreamState_cancel_closure.prototype = {\n" +" call\$0() {\n" +" this.\$this.addStreamFuture._asyncComplete\$1(null);\n" +" },\n" +" \$signature: 1\n" +" };\n" +" A._StreamControllerAddStreamState.prototype = {};\n" " A._BufferingStreamSubscription.prototype = {\n" " _setPendingEvents\$1(pendingEvents) {\n" " var _this = this;\n" @@ -12997,7 +13457,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1 = new A._DoneStreamSubscription(t2, t1._eval\$1(\"_DoneStreamSubscription<1>\"));\n" " A.scheduleMicrotask(t1.get\$_onMicrotask());\n" " if (onDone != null)\n" -" t1._onDone = t2._registerCallbackZoned\$1\$2(t2, type\$.void_Function._as(onDone), type\$.void);\n" +" t1._onDone = t2.registerCallback\$1\$1(onDone, type\$.void);\n" " return t1;\n" " },\n" " listen\$3\$onDone\$onError(onData, onDone, onError) {\n" @@ -13007,44 +13467,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return this.listen\$4\$cancelOnError\$onDone\$onError(onData, cancelOnError, onDone, null);\n" " }\n" " };\n" -" A._MultiStream.prototype = {\n" -" listen\$4\$cancelOnError\$onDone\$onError(onData, cancelOnError, onDone, onError) {\n" -" var controller, _null = null,\n" -" t1 = this.\$ti;\n" -" t1._eval\$1(\"~(1)?\")._as(onData);\n" -" type\$.nullable_void_Function._as(onDone);\n" -" controller = new A._MultiStreamController(_null, _null, _null, _null, t1._eval\$1(\"_MultiStreamController<1>\"));\n" -" controller.set\$onListen(new A._MultiStream_listen_closure(this, controller));\n" -" return controller._subscribe\$4(onData, onError, onDone, cancelOnError === true);\n" -" },\n" -" listen\$3\$onDone\$onError(onData, onDone, onError) {\n" -" return this.listen\$4\$cancelOnError\$onDone\$onError(onData, null, onDone, onError);\n" -" },\n" -" listen\$3\$cancelOnError\$onDone(onData, cancelOnError, onDone) {\n" -" return this.listen\$4\$cancelOnError\$onDone\$onError(onData, cancelOnError, onDone, null);\n" -" }\n" -" };\n" -" A._MultiStream_listen_closure.prototype = {\n" -" call\$0() {\n" -" this.\$this._onListen.call\$1(this.controller);\n" -" },\n" -" \$signature: 0\n" -" };\n" -" A._MultiStreamController.prototype = {\n" -" closeSync\$0() {\n" -" var _this = this,\n" -" t1 = _this._state;\n" -" if ((t1 & 4) !== 0)\n" -" return;\n" -" if (t1 >= 4)\n" -" throw A.wrapException(_this._badEventState\$0());\n" -" t1 |= 4;\n" -" _this._state = t1;\n" -" if ((t1 & 1) !== 0)\n" -" _this.get\$_subscription()._close\$0();\n" -" },\n" -" \$isMultiStreamController: 1\n" -" };\n" " A._cancelAndValue_closure.prototype = {\n" " call\$0() {\n" " return this.future._complete\$1(this.value);\n" @@ -13063,7 +13485,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t5 = A._BufferingStreamSubscription__registerDataHandler(t2, onData, t1._rest[1]);\n" " t6 = A._BufferingStreamSubscription__registerErrorHandler(t2, onError);\n" " t7 = onDone == null ? A.async___nullDoneHandler\$closure() : onDone;\n" -" t1 = new A._ForwardingStreamSubscription(this, t5, t6, t2._registerCallbackZoned\$1\$2(t2, type\$.void_Function._as(t7), type\$.void), t2, t3 | t4, t1._eval\$1(\"_ForwardingStreamSubscription<1,2>\"));\n" +" t1 = new A._ForwardingStreamSubscription(this, t5, t6, t2.registerCallback\$1\$1(t7, type\$.void), t2, t3 | t4, t1._eval\$1(\"_ForwardingStreamSubscription<1,2>\"));\n" " t1._subscription = this._source.listen\$3\$onDone\$onError(t1.get\$_handleData(), t1.get\$_handleDone(), t1.get\$_handleError());\n" " return t1;\n" " },\n" @@ -13145,270 +13567,453 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " sink._add\$1(outputEvent);\n" " }\n" " };\n" -" A._ZoneHandleUncaughtError.prototype = {};\n" -" A.Zone.prototype = {\n" -" run\$1\$1(action, \$R) {\n" -" return this._runZoned\$1\$2(this, \$R._eval\$1(\"0()\")._as(action), \$R);\n" -" },\n" -" runGuarded\$1(action) {\n" -" var e, s, t1, exception, _this = this;\n" -" type\$.void_Function._as(action);\n" +" A._ZoneRun.prototype = {};\n" +" A._ZoneRunUnary.prototype = {};\n" +" A._ZoneRunBinary.prototype = {};\n" +" A._ZoneRegisterCallback.prototype = {};\n" +" A._ZoneRegisterUnaryCallback.prototype = {};\n" +" A._ZoneRegisterBinaryCallback.prototype = {};\n" +" A._ZoneErrorCallback.prototype = {};\n" +" A._ZoneScheduleMicrotask.prototype = {};\n" +" A._ZoneCreateTimer.prototype = {};\n" +" A._ZoneCreatePeriodicTimer.prototype = {};\n" +" A._ZonePrint.prototype = {};\n" +" A._ZoneFork.prototype = {};\n" +" A._ZoneHandleUncaughtError.prototype = {\n" +" function\$5(arg0, arg1, arg2, arg3, arg4) {\n" +" return this.\$function.call\$5(arg0, arg1, arg2, arg3, arg4);\n" +" }\n" +" };\n" +" A._ZoneValues.prototype = {};\n" +" A._Zone.prototype = {\n" +" _processUncaughtError\$3(zone, error, stackTrace) {\n" +" var implementation, implZone, parentZone, currentZone, e, s, t1, exception;\n" +" type\$.StackTrace._as(stackTrace);\n" +" implementation = this.get\$_handleUncaughtError();\n" +" implZone = implementation.zone;\n" +" if (implZone === B.C__RootZone) {\n" +" A._rootHandleError(error, stackTrace);\n" +" return;\n" +" }\n" +" t1 = implZone.get\$parent();\n" +" t1.toString;\n" +" parentZone = t1;\n" +" currentZone = \$.Zone__current;\n" " try {\n" -" t1 = _this._runZoned\$1\$2(_this, action, type\$.void);\n" -" return t1;\n" +" \$.Zone__current = parentZone;\n" +" implementation.function\$5(implZone, implZone.get\$_parentDelegate(), zone, error, stackTrace);\n" +" \$.Zone__current = currentZone;\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" _this._handleUncaughtErrorZoned\$3(_this, e, s);\n" +" \$.Zone__current = currentZone;\n" +" t1 = error === e ? stackTrace : s;\n" +" parentZone._processUncaughtError\$3(implZone, e, t1);\n" " }\n" " },\n" -" runUnaryGuarded\$1\$2(action, argument, \$T) {\n" -" var e, s, t1, exception, _this = this;\n" -" \$T._eval\$1(\"~(0)\")._as(action);\n" -" \$T._as(argument);\n" +" \$isZone: 1\n" +" };\n" +" A._CustomZone.prototype = {\n" +" get\$_delegate() {\n" +" var t1 = this._delegateCache;\n" +" return t1 == null ? this._delegateCache = new A._ZoneDelegate(this) : t1;\n" +" },\n" +" get\$_parentDelegate() {\n" +" return this.parent.get\$_delegate();\n" +" },\n" +" get\$errorZone() {\n" +" return this._handleUncaughtError.zone;\n" +" },\n" +" runGuarded\$1(f) {\n" +" var e, s, exception;\n" +" type\$.void_Function._as(f);\n" " try {\n" -" t1 = _this._runUnaryZoned\$2\$3(_this, action, argument, type\$.void, \$T);\n" -" return t1;\n" +" this.run\$1\$1(f, type\$.void);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" _this._handleUncaughtErrorZoned\$3(_this, e, s);\n" +" this._processUncaughtError\$3(this, A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" " },\n" -" runBinaryGuarded\$2\$3(action, argument1, argument2, \$T1, \$T2) {\n" -" var e, s, t1, exception, _this = this;\n" -" \$T1._eval\$1(\"@<0>\")._bind\$1(\$T2)._eval\$1(\"~(1,2)\")._as(action);\n" -" \$T1._as(argument1);\n" -" \$T2._as(argument2);\n" +" runUnaryGuarded\$1\$2(f, arg, \$T) {\n" +" var e, s, exception;\n" +" \$T._eval\$1(\"~(0)\")._as(f);\n" +" \$T._as(arg);\n" " try {\n" -" t1 = _this._runBinaryZoned\$3\$4(_this, action, argument1, argument2, type\$.void, \$T1, \$T2);\n" -" return t1;\n" +" this.runUnary\$2\$2(f, arg, type\$.void, \$T);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" _this._handleUncaughtErrorZoned\$3(_this, e, s);\n" +" this._processUncaughtError\$3(this, A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" " },\n" -" bindCallback\$1\$1(callback, \$R) {\n" -" return new A.Zone_bindCallback_closure(this, this._registerCallbackZoned\$1\$2(this, \$R._eval\$1(\"0()\")._as(callback), \$R), \$R);\n" +" runBinaryGuarded\$2\$3(f, arg1, arg2, \$T1, \$T2) {\n" +" var e, s, exception;\n" +" \$T1._eval\$1(\"@<0>\")._bind\$1(\$T2)._eval\$1(\"~(1,2)\")._as(f);\n" +" \$T1._as(arg1);\n" +" \$T2._as(arg2);\n" +" try {\n" +" this.runBinary\$3\$3(f, arg1, arg2, type\$.void, \$T1, \$T2);\n" +" } catch (exception) {\n" +" e = A.unwrapException(exception);\n" +" s = A.getTraceFromException(exception);\n" +" this._processUncaughtError\$3(this, A._asObject(e), type\$.StackTrace._as(s));\n" +" }\n" +" },\n" +" bindCallback\$1\$1(f, \$R) {\n" +" return new A._CustomZone_bindCallback_closure(this, this.registerCallback\$1\$1(\$R._eval\$1(\"0()\")._as(f), \$R), \$R);\n" +" },\n" +" bindCallbackGuarded\$1(f) {\n" +" return new A._CustomZone_bindCallbackGuarded_closure(this, this.registerCallback\$1\$1(type\$.void_Function._as(f), type\$.void));\n" +" },\n" +" bindUnaryCallbackGuarded\$1\$1(f, \$T) {\n" +" return new A._CustomZone_bindUnaryCallbackGuarded_closure(this, this.registerUnaryCallback\$2\$1(\$T._eval\$1(\"~(0)\")._as(f), type\$.void, \$T), \$T);\n" +" },\n" +" handleUncaughtError\$2(error, stackTrace) {\n" +" this._processUncaughtError\$3(this, error, type\$.StackTrace._as(stackTrace));\n" +" },\n" +" fork\$2\$specification\$zoneValues(specification, zoneValues) {\n" +" var implementation = this._fork,\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$5(zone, zone.get\$_parentDelegate(), this, specification, zoneValues);\n" +" },\n" +" run\$1\$1(f, \$R) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"0()\")._as(f);\n" +" implementation = this._run;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$1\$4(zone, zone.get\$_parentDelegate(), this, f, \$R);\n" +" },\n" +" runUnary\$2\$2(f, arg, \$R, \$T) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(f);\n" +" \$T._as(arg);\n" +" implementation = this._runUnary;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$2\$5(zone, zone.get\$_parentDelegate(), this, f, arg, \$R, \$T);\n" +" },\n" +" runBinary\$3\$3(f, arg1, arg2, \$R, \$T1, \$T2) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(f);\n" +" \$T1._as(arg1);\n" +" \$T2._as(arg2);\n" +" implementation = this._runBinary;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$3\$6(zone, zone.get\$_parentDelegate(), this, f, arg1, arg2, \$R, \$T1, \$T2);\n" +" },\n" +" registerCallback\$1\$1(callback, \$R) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"0()\")._as(callback);\n" +" implementation = this._registerCallback;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$1\$4(zone, zone.get\$_parentDelegate(), this, callback, \$R);\n" +" },\n" +" registerUnaryCallback\$2\$1(callback, \$R, \$T) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(callback);\n" +" implementation = this._registerUnaryCallback;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$2\$4(zone, zone.get\$_parentDelegate(), this, callback, \$R, \$T);\n" +" },\n" +" registerBinaryCallback\$3\$1(callback, \$R, \$T1, \$T2) {\n" +" var implementation, zone;\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(callback);\n" +" implementation = this._registerBinaryCallback;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$3\$4(zone, zone.get\$_parentDelegate(), this, callback, \$R, \$T1, \$T2);\n" +" },\n" +" errorCallback\$2(error, stackTrace) {\n" +" var implementation = this._errorCallback,\n" +" zone = implementation.zone;\n" +" if (zone === B.C__RootZone)\n" +" return null;\n" +" return implementation.\$function.call\$5(zone, zone.get\$_parentDelegate(), this, error, stackTrace);\n" +" },\n" +" scheduleMicrotask\$1(f) {\n" +" var implementation, zone;\n" +" type\$.void_Function._as(f);\n" +" implementation = this._scheduleMicrotask;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$4(zone, zone.get\$_parentDelegate(), this, f);\n" +" },\n" +" createTimer\$2(duration, f) {\n" +" var implementation, zone;\n" +" type\$.void_Function._as(f);\n" +" implementation = this._createTimer;\n" +" zone = implementation.zone;\n" +" return implementation.\$function.call\$5(zone, zone.get\$_parentDelegate(), this, duration, f);\n" +" },\n" +" get\$_run() {\n" +" return this._run;\n" +" },\n" +" get\$_runUnary() {\n" +" return this._runUnary;\n" +" },\n" +" get\$_runBinary() {\n" +" return this._runBinary;\n" +" },\n" +" get\$_registerCallback() {\n" +" return this._registerCallback;\n" +" },\n" +" get\$_registerUnaryCallback() {\n" +" return this._registerUnaryCallback;\n" +" },\n" +" get\$_registerBinaryCallback() {\n" +" return this._registerBinaryCallback;\n" +" },\n" +" get\$_errorCallback() {\n" +" return this._errorCallback;\n" +" },\n" +" get\$_scheduleMicrotask() {\n" +" return this._scheduleMicrotask;\n" +" },\n" +" get\$_createTimer() {\n" +" return this._createTimer;\n" +" },\n" +" get\$_createPeriodicTimer() {\n" +" return this._createPeriodicTimer;\n" +" },\n" +" get\$_print() {\n" +" return this._print;\n" +" },\n" +" get\$_fork() {\n" +" return this._fork;\n" +" },\n" +" get\$_handleUncaughtError() {\n" +" return this._handleUncaughtError;\n" +" },\n" +" get\$_zoneValues() {\n" +" return this._zoneValues;\n" +" },\n" +" get\$parent() {\n" +" return this.parent;\n" +" }\n" +" };\n" +" A._CustomZone_bindCallback_closure.prototype = {\n" +" call\$0() {\n" +" return this.\$this.run\$1\$1(this.registered, this.R);\n" +" },\n" +" \$signature() {\n" +" return this.R._eval\$1(\"0()\");\n" +" }\n" +" };\n" +" A._CustomZone_bindCallbackGuarded_closure.prototype = {\n" +" call\$0() {\n" +" return this.\$this.runGuarded\$1(this.registered);\n" +" },\n" +" \$signature: 0\n" +" };\n" +" A._CustomZone_bindUnaryCallbackGuarded_closure.prototype = {\n" +" call\$1(arg) {\n" +" var t1 = this.T;\n" +" return this.\$this.runUnaryGuarded\$1\$2(this.registered, t1._as(arg), t1);\n" +" },\n" +" \$signature() {\n" +" return this.T._eval\$1(\"~(0)\");\n" +" }\n" +" };\n" +" A._RootZone.prototype = {\n" +" get\$_run() {\n" +" return B._ZoneRun__RootZone__rootRun;\n" +" },\n" +" get\$_runUnary() {\n" +" return B._ZoneRunUnary__RootZone__rootRunUnary;\n" +" },\n" +" get\$_runBinary() {\n" +" return B._ZoneRunBinary__RootZone__rootRunBinary;\n" +" },\n" +" get\$_registerCallback() {\n" +" return B._ZoneRegisterCallback__RootZone__rootRegisterCallback;\n" " },\n" -" bindCallbackGuarded\$1(callback) {\n" -" return new A.Zone_bindCallbackGuarded_closure(this, this._registerCallbackZoned\$1\$2(this, type\$.void_Function._as(callback), type\$.void));\n" +" get\$_registerUnaryCallback() {\n" +" return B._ZoneRegisterUnaryCallback_a9v;\n" " },\n" -" bindUnaryCallbackGuarded\$1\$1(callback, \$T) {\n" -" return new A.Zone_bindUnaryCallbackGuarded_closure(this, this._registerUnaryCallbackZoned\$2\$2(this, \$T._eval\$1(\"~(0)\")._as(callback), type\$.void, \$T), \$T);\n" +" get\$_registerBinaryCallback() {\n" +" return B._ZoneRegisterBinaryCallback_sk0;\n" +" },\n" +" get\$_errorCallback() {\n" +" return B._ZoneErrorCallback__RootZone__rootErrorCallback;\n" +" },\n" +" get\$_scheduleMicrotask() {\n" +" return B._ZoneScheduleMicrotask__RootZone__rootScheduleMicrotask;\n" +" },\n" +" get\$_createTimer() {\n" +" return B._ZoneCreateTimer__RootZone__rootCreateTimer;\n" +" },\n" +" get\$_createPeriodicTimer() {\n" +" return B.C__ZoneCreatePeriodicTimer;\n" +" },\n" +" get\$_print() {\n" +" return B._ZonePrint__RootZone__rootPrint;\n" +" },\n" +" get\$_fork() {\n" +" return B._ZoneFork__RootZone__rootFork;\n" +" },\n" +" get\$_handleUncaughtError() {\n" +" return B._ZoneHandleUncaughtError_wQ6;\n" +" },\n" +" get\$_zoneValues() {\n" +" return B._ZoneValues__RootZone_Map_empty;\n" +" },\n" +" get\$parent() {\n" +" return null;\n" +" },\n" +" get\$_delegate() {\n" +" var t1 = \$._RootZone__rootDelegate;\n" +" return t1 == null ? \$._RootZone__rootDelegate = new A._ZoneDelegate(this) : t1;\n" " },\n" " get\$_parentDelegate() {\n" -" var t1 = this._parent;\n" -" t1 = t1 == null ? null : t1._delegate;\n" -" return t1 == null ? \$.\$get\$_rootDelegate() : t1;\n" +" var t1 = \$._RootZone__rootDelegate;\n" +" return t1 == null ? \$._RootZone__rootDelegate = new A._ZoneDelegate(this) : t1;\n" " },\n" -" _handleUncaughtErrorZoned\$3(zone, error, stackTrace) {\n" -" var implementation, implZone, parentZone, currentZone, e, s, t1, exception;\n" -" type\$.StackTrace._as(stackTrace);\n" -" implementation = this._handleUncaughtErrorFunction;\n" -" if (implementation == null) {\n" -" A._rootHandleUncaughtError(error, stackTrace);\n" -" return;\n" -" }\n" -" implZone = implementation.zone;\n" -" t1 = implZone._parent;\n" -" t1.toString;\n" -" parentZone = t1;\n" -" currentZone = \$.Zone__current;\n" +" get\$errorZone() {\n" +" return this;\n" +" },\n" +" runGuarded\$1(f) {\n" +" var e, s, exception;\n" +" type\$.void_Function._as(f);\n" " try {\n" -" \$.Zone__current = parentZone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" implementation.\$function.call\$5(implZone, t1, zone, error, stackTrace);\n" -" \$.Zone__current = currentZone;\n" +" if (B.C__RootZone === \$.Zone__current) {\n" +" f.call\$0();\n" +" return;\n" +" }\n" +" A._rootRun(null, null, this, f, type\$.void);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" \$.Zone__current = currentZone;\n" -" t1 = error === e ? stackTrace : s;\n" -" parentZone._handleUncaughtErrorZoned\$3(implZone, e, t1);\n" +" A._rootHandleError(A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" " },\n" -" _forkZoned\$3(zone, specification, zoneValues) {\n" -" var implZone, t1,\n" -" implementation = this._forkFunction;\n" -" if (implementation == null)\n" -" return A._rootFork(zone, specification, zoneValues);\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$5(implZone, t1, zone, specification, zoneValues);\n" -" },\n" -" _runZoned\$1\$2(zone, callback, \$R) {\n" -" var oldZone, implementation, t1, implZone;\n" -" \$R._eval\$1(\"0()\")._as(callback);\n" -" implementation = this._runFunction;\n" -" if (implementation == null) {\n" -" t1 = \$.Zone__current;\n" -" if (t1 === zone)\n" -" return callback.call\$0();\n" -" oldZone = t1;\n" -" \$.Zone__current = zone;\n" -" try {\n" -" t1 = callback.call\$0();\n" -" return t1;\n" -" } finally {\n" -" \$.Zone__current = oldZone;\n" +" runUnaryGuarded\$1\$2(f, arg, \$T) {\n" +" var e, s, exception;\n" +" \$T._eval\$1(\"~(0)\")._as(f);\n" +" \$T._as(arg);\n" +" try {\n" +" if (B.C__RootZone === \$.Zone__current) {\n" +" f.call\$1(arg);\n" +" return;\n" " }\n" +" A._rootRunUnary(null, null, this, f, arg, type\$.void, \$T);\n" +" } catch (exception) {\n" +" e = A.unwrapException(exception);\n" +" s = A.getTraceFromException(exception);\n" +" A._rootHandleError(A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$1\$4(implZone, t1, zone, callback, \$R);\n" " },\n" -" _runUnaryZoned\$2\$3(zone, callback, argument, \$R, \$T) {\n" -" var oldZone, implementation, t1, implZone;\n" -" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(callback);\n" -" \$T._as(argument);\n" -" implementation = this._runUnaryFunction;\n" -" if (implementation == null) {\n" -" t1 = \$.Zone__current;\n" -" if (t1 === zone)\n" -" return callback.call\$1(argument);\n" -" oldZone = t1;\n" -" \$.Zone__current = zone;\n" -" try {\n" -" t1 = callback.call\$1(argument);\n" -" return t1;\n" -" } finally {\n" -" \$.Zone__current = oldZone;\n" +" runBinaryGuarded\$2\$3(f, arg1, arg2, \$T1, \$T2) {\n" +" var e, s, exception;\n" +" \$T1._eval\$1(\"@<0>\")._bind\$1(\$T2)._eval\$1(\"~(1,2)\")._as(f);\n" +" \$T1._as(arg1);\n" +" \$T2._as(arg2);\n" +" try {\n" +" if (B.C__RootZone === \$.Zone__current) {\n" +" f.call\$2(arg1, arg2);\n" +" return;\n" " }\n" +" A._rootRunBinary(null, null, this, f, arg1, arg2, type\$.void, \$T1, \$T2);\n" +" } catch (exception) {\n" +" e = A.unwrapException(exception);\n" +" s = A.getTraceFromException(exception);\n" +" A._rootHandleError(A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$2\$5(implZone, t1, zone, callback, argument, \$R, \$T);\n" " },\n" -" _runBinaryZoned\$3\$4(zone, callback, argument1, argument2, \$R, \$T1, \$T2) {\n" -" var oldZone, implementation, t1, implZone;\n" -" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(callback);\n" -" \$T1._as(argument1);\n" -" \$T2._as(argument2);\n" -" implementation = this._runBinaryFunction;\n" -" if (implementation == null) {\n" -" t1 = \$.Zone__current;\n" -" if (t1 === zone)\n" -" return callback.call\$2(argument1, argument2);\n" -" oldZone = t1;\n" -" \$.Zone__current = zone;\n" -" try {\n" -" t1 = callback.call\$2(argument1, argument2);\n" -" return t1;\n" -" } finally {\n" -" \$.Zone__current = oldZone;\n" -" }\n" -" }\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$3\$6(implZone, t1, zone, callback, argument1, argument2, \$R, \$T1, \$T2);\n" +" bindCallback\$1\$1(f, \$R) {\n" +" return new A._RootZone_bindCallback_closure(this, \$R._eval\$1(\"0()\")._as(f), \$R);\n" " },\n" -" _registerCallbackZoned\$1\$2(zone, callback, \$R) {\n" -" var implementation, implZone, t1;\n" -" \$R._eval\$1(\"0()\")._as(callback);\n" -" implementation = this._registerCallbackFunction;\n" -" if (implementation == null)\n" -" return callback;\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$1\$4(implZone, t1, zone, callback, \$R);\n" +" bindCallbackGuarded\$1(f) {\n" +" return new A._RootZone_bindCallbackGuarded_closure(this, type\$.void_Function._as(f));\n" " },\n" -" _registerUnaryCallbackZoned\$2\$2(zone, callback, \$R, \$T) {\n" -" var implementation, implZone, t1;\n" -" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(callback);\n" -" implementation = this._registerUnaryCallbackFunction;\n" -" if (implementation == null)\n" -" return callback;\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$2\$4(implZone, t1, zone, callback, \$R, \$T);\n" +" bindUnaryCallbackGuarded\$1\$1(f, \$T) {\n" +" return new A._RootZone_bindUnaryCallbackGuarded_closure(this, \$T._eval\$1(\"~(0)\")._as(f), \$T);\n" " },\n" -" _registerBinaryCallbackZoned\$3\$2(zone, callback, \$R, \$T1, \$T2) {\n" -" var implementation, implZone, t1;\n" -" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(callback);\n" -" implementation = this._registerBinaryCallbackFunction;\n" -" if (implementation == null)\n" -" return callback;\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$3\$4(implZone, t1, zone, callback, \$R, \$T1, \$T2);\n" +" handleUncaughtError\$2(error, stackTrace) {\n" +" A._rootHandleError(error, type\$.StackTrace._as(stackTrace));\n" " },\n" -" _errorCallbackZoned\$3(zone, error, stackTrace) {\n" -" var implZone, t1,\n" -" implementation = this._errorCallbackFunction;\n" -" if (implementation == null)\n" -" return null;\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$5(implZone, t1, zone, error, stackTrace);\n" +" fork\$2\$specification\$zoneValues(specification, zoneValues) {\n" +" return A._rootFork(null, null, this, specification, zoneValues);\n" " },\n" -" _scheduleMicrotaskZoned\$2(zone, callback) {\n" -" var implementation, implZone, t1;\n" -" type\$.void_Function._as(callback);\n" -" implementation = this._scheduleMicrotaskFunction;\n" -" if (implementation == null) {\n" -" A._rootScheduleMicrotask(zone, callback);\n" -" return;\n" -" }\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" implementation.\$function.call\$4(implZone, t1, zone, callback);\n" +" run\$1\$1(f, \$R) {\n" +" \$R._eval\$1(\"0()\")._as(f);\n" +" if (\$.Zone__current === B.C__RootZone)\n" +" return f.call\$0();\n" +" return A._rootRun(null, null, this, f, \$R);\n" " },\n" -" _createTimerZoned\$3(zone, duration, callback) {\n" -" var implementation, implZone, t1;\n" -" type\$.void_Function._as(callback);\n" -" implementation = this._createTimerFunction;\n" -" if (implementation == null)\n" -" return A.Timer__createTimer(duration, B.Zone_jYP !== zone ? zone.bindCallback\$1\$1(callback, type\$.void) : callback);\n" -" implZone = implementation.zone;\n" -" t1 = implZone.get\$_parentDelegate();\n" -" return implementation.\$function.call\$5(implZone, t1, zone, duration, callback);\n" +" runUnary\$2\$2(f, arg, \$R, \$T) {\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(f);\n" +" \$T._as(arg);\n" +" if (\$.Zone__current === B.C__RootZone)\n" +" return f.call\$1(arg);\n" +" return A._rootRunUnary(null, null, this, f, arg, \$R, \$T);\n" +" },\n" +" runBinary\$3\$3(f, arg1, arg2, \$R, \$T1, \$T2) {\n" +" \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(f);\n" +" \$T1._as(arg1);\n" +" \$T2._as(arg2);\n" +" if (\$.Zone__current === B.C__RootZone)\n" +" return f.call\$2(arg1, arg2);\n" +" return A._rootRunBinary(null, null, this, f, arg1, arg2, \$R, \$T1, \$T2);\n" +" },\n" +" registerCallback\$1\$1(f, \$R) {\n" +" return \$R._eval\$1(\"0()\")._as(f);\n" +" },\n" +" registerUnaryCallback\$2\$1(f, \$R, \$T) {\n" +" return \$R._eval\$1(\"@<0>\")._bind\$1(\$T)._eval\$1(\"1(2)\")._as(f);\n" +" },\n" +" registerBinaryCallback\$3\$1(f, \$R, \$T1, \$T2) {\n" +" return \$R._eval\$1(\"@<0>\")._bind\$1(\$T1)._bind\$1(\$T2)._eval\$1(\"1(2,3)\")._as(f);\n" +" },\n" +" errorCallback\$2(error, stackTrace) {\n" +" return null;\n" +" },\n" +" scheduleMicrotask\$1(f) {\n" +" A._rootScheduleMicrotask(null, null, this, type\$.void_Function._as(f));\n" +" },\n" +" createTimer\$2(duration, f) {\n" +" return A.Timer__createTimer(duration, type\$.void_Function._as(f));\n" " }\n" " };\n" -" A.Zone_bindCallback_closure.prototype = {\n" +" A._RootZone_bindCallback_closure.prototype = {\n" " call\$0() {\n" -" var t1 = this.\$this;\n" -" return t1._runZoned\$1\$2(t1, this.registered, this.R);\n" +" return this.\$this.run\$1\$1(this.f, this.R);\n" " },\n" " \$signature() {\n" " return this.R._eval\$1(\"0()\");\n" " }\n" " };\n" -" A.Zone_bindCallbackGuarded_closure.prototype = {\n" +" A._RootZone_bindCallbackGuarded_closure.prototype = {\n" " call\$0() {\n" -" return this.\$this.runGuarded\$1(this.registered);\n" +" return this.\$this.runGuarded\$1(this.f);\n" " },\n" " \$signature: 0\n" " };\n" -" A.Zone_bindUnaryCallbackGuarded_closure.prototype = {\n" -" call\$1(argument) {\n" +" A._RootZone_bindUnaryCallbackGuarded_closure.prototype = {\n" +" call\$1(arg) {\n" " var t1 = this.T;\n" -" return this.\$this.runUnaryGuarded\$1\$2(this.registered, t1._as(argument), t1);\n" +" return this.\$this.runUnaryGuarded\$1\$2(this.f, t1._as(arg), t1);\n" " },\n" " \$signature() {\n" " return this.T._eval\$1(\"~(0)\");\n" " }\n" " };\n" -" A.runZonedGuarded_errorHandler.prototype = {\n" +" A.runZonedGuarded_closure.prototype = {\n" " call\$5(\$self, \$parent, zone, error, stackTrace) {\n" -" var e, s, t1, exception, t2;\n" +" var e, s, exception, t1;\n" " try {\n" -" t1 = this.parentZone;\n" -" t1._runBinaryZoned\$3\$4(t1, type\$.void_Function_Object_StackTrace._as(this.onError), error, stackTrace, type\$.void, type\$.Object, type\$.StackTrace);\n" +" this.parentZone.runBinary\$3\$3(this.onError, error, stackTrace, type\$.void, type\$.Object, type\$.StackTrace);\n" " } catch (exception) {\n" " e = A.unwrapException(exception);\n" " s = A.getTraceFromException(exception);\n" -" t1 = e === error ? stackTrace : s;\n" -" t2 = A._asObject(e);\n" -" type\$.StackTrace._as(t1);\n" -" \$parent._zone._handleUncaughtErrorZoned\$3(zone, t2, t1);\n" +" t1 = \$parent._delegationTarget;\n" +" if (e === error)\n" +" t1._processUncaughtError\$3(zone, error, stackTrace);\n" +" else\n" +" t1._processUncaughtError\$3(zone, A._asObject(e), type\$.StackTrace._as(s));\n" " }\n" " },\n" -" \$signature: 32\n" +" \$signature: 42\n" " };\n" -" A.ZoneDelegate.prototype = {};\n" -" A._rootHandleUncaughtError_closure.prototype = {\n" +" A._ZoneDelegate.prototype = {\$isZoneDelegate: 1};\n" +" A._rootHandleError_closure.prototype = {\n" " call\$0() {\n" " A.Error_throwWithStackTrace(this.error, this.stackTrace);\n" " },\n" @@ -13679,7 +14284,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(v) {\n" " return this.K._is(v);\n" " },\n" -" \$signature: 41\n" +" \$signature: 44\n" " };\n" " A._HashSet.prototype = {\n" " get\$iterator(_) {\n" @@ -13902,6 +14507,21 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " take\$1(receiver, count) {\n" " return A.SubListIterable\$(receiver, 0, A.checkNotNullable(count, \"count\", type\$.int), A.instanceType(receiver)._eval\$1(\"ListBase.E\"));\n" " },\n" +" toList\$1\$growable(receiver, growable) {\n" +" var t1, first, result, i, _this = this;\n" +" if (_this.get\$isEmpty(receiver)) {\n" +" t1 = J.JSArray_JSArray\$growable(0, A.instanceType(receiver)._eval\$1(\"ListBase.E\"));\n" +" return t1;\n" +" }\n" +" first = _this.\$index(receiver, 0);\n" +" result = A.List_List\$filled(_this.get\$length(receiver), first, true, A.instanceType(receiver)._eval\$1(\"ListBase.E\"));\n" +" for (i = 1; i < _this.get\$length(receiver); ++i)\n" +" B.JSArray_methods.\$indexSet(result, i, _this.\$index(receiver, i));\n" +" return result;\n" +" },\n" +" toList\$0(receiver) {\n" +" return this.toList\$1\$growable(receiver, true);\n" +" },\n" " add\$1(receiver, element) {\n" " var t1;\n" " A.instanceType(receiver)._eval\$1(\"ListBase.E\")._as(element);\n" @@ -14524,6 +15144,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " containsKey\$1(key) {\n" " if (this._processed == null)\n" " return this._data.containsKey\$1(key);\n" +" if (typeof key != \"string\")\n" +" return false;\n" " return Object.prototype.hasOwnProperty.call(this._original, key);\n" " },\n" " forEach\$1(_, f) {\n" @@ -14577,10 +15199,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " };\n" " A._JsonMapKeyIterable.prototype = {\n" " get\$length(_) {\n" -" return this._convert\$_parent.get\$length(0);\n" +" return this._parent.get\$length(0);\n" " },\n" " elementAt\$1(_, index) {\n" -" var t1 = this._convert\$_parent;\n" +" var t1 = this._parent;\n" " if (t1._processed == null)\n" " t1 = t1.get\$keys().elementAt\$1(0, index);\n" " else {\n" @@ -14592,7 +15214,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return t1;\n" " },\n" " get\$iterator(_) {\n" -" var t1 = this._convert\$_parent;\n" +" var t1 = this._parent;\n" " if (t1._processed == null) {\n" " t1 = t1.get\$keys();\n" " t1 = t1.get\$iterator(t1);\n" @@ -14603,7 +15225,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return t1;\n" " },\n" " contains\$1(_, key) {\n" -" return this._convert\$_parent.containsKey\$1(key);\n" +" return this._parent.containsKey\$1(key);\n" " }\n" " };\n" " A._Utf8Decoder__decoder_closure.prototype = {\n" @@ -15811,7 +16433,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$2(msg, position) {\n" " throw A.wrapException(A.FormatException\$(\"Illegal IPv6 address, \" + msg, this.host, position));\n" " },\n" -" \$signature: 53\n" +" \$signature: 56\n" " };\n" " A._Uri.prototype = {\n" " get\$_text() {\n" @@ -16111,7 +16733,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(s) {\n" " return A._Uri__uriEncode(64, A._asString(s), B.C_Utf8Codec, false);\n" " },\n" -" \$signature: 9\n" +" \$signature: 10\n" " };\n" " A.UriData.prototype = {\n" " get\$uri() {\n" @@ -16451,7 +17073,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1.call(t1, value);\n" " return value;\n" " },\n" -" \$signature: 10\n" +" \$signature: 11\n" " };\n" " A.FutureOfJSAnyToJSPromise_get_toJS__closure0.prototype = {\n" " call\$2(error, stackTrace) {\n" @@ -16469,7 +17091,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1.call(t1, wrapper);\n" " return wrapper;\n" " },\n" -" \$signature: 61\n" +" \$signature: 68\n" " };\n" " A.FutureOfVoidToJSPromise_get_toJS_closure.prototype = {\n" " call\$2(resolve, reject) {\n" @@ -16483,7 +17105,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " var t1 = this.resolve;\n" " return t1.call(t1);\n" " },\n" -" \$signature: 67\n" +" \$signature: 74\n" " };\n" " A.FutureOfVoidToJSPromise_get_toJS__closure0.prototype = {\n" " call\$2(error, stackTrace) {\n" @@ -16526,13 +17148,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " } else\n" " return o;\n" " },\n" -" \$signature: 10\n" +" \$signature: 11\n" " };\n" " A.promiseToFuture_closure.prototype = {\n" " call\$1(r) {\n" " return this.completer.complete\$1(this.T._eval\$1(\"0/?\")._as(r));\n" " },\n" -" \$signature: 4\n" +" \$signature: 5\n" " };\n" " A.promiseToFuture_closure0.prototype = {\n" " call\$1(e) {\n" @@ -16540,7 +17162,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return this.completer.completeError\$1(new A.NullRejectionException(e === undefined));\n" " return this.completer.completeError\$1(e);\n" " },\n" -" \$signature: 4\n" +" \$signature: 5\n" " };\n" " A.dartify_convert.prototype = {\n" " call\$1(o) {\n" @@ -16592,7 +17214,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " return o;\n" " },\n" -" \$signature: 10\n" +" \$signature: 11\n" " };\n" " A._JSRandom.prototype = {\n" " nextInt\$1(max) {\n" @@ -17008,13 +17630,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(e) {\n" " return type\$.BuildStatus._as(e)._name === this.json;\n" " },\n" -" \$signature: 29\n" +" \$signature: 75\n" " };\n" " A.BuildStatus_BuildStatus\$fromJson_closure0.prototype = {\n" " call\$0() {\n" " throw A.wrapException(A.ArgumentError\$(\"Unknown BuildStatus: \" + this.json, null));\n" " },\n" -" \$signature: 74\n" +" \$signature: 89\n" " };\n" " A.BuildResult.prototype = {\n" " toJson\$0() {\n" @@ -17090,7 +17712,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(e) {\n" " return type\$.DebugEvent._as(e).toJson\$0();\n" " },\n" -" \$signature: 75\n" +" \$signature: 90\n" " };\n" " A.DebugInfo.prototype = {\n" " toJson\$0() {\n" @@ -17503,14 +18125,14 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(o) {\n" " return J.toString\$0\$(o);\n" " },\n" -" \$signature: 30\n" +" \$signature: 29\n" " };\n" " A.PersistentWebSocket.prototype = {\n" " get\$_incomingStreamController() {\n" " var result, _this = this,\n" " value = _this.__PersistentWebSocket__incomingStreamController_FI;\n" " if (value === \$) {\n" -" result = A.StreamController_StreamController(type\$.dynamic);\n" +" result = A.StreamController_StreamController(null, null, null, type\$.dynamic);\n" " result.set\$onListen(_this.get\$_listenWithRetry());\n" " _this.__PersistentWebSocket__incomingStreamController_FI !== \$ && A.throwLateFieldADI(\"_incomingStreamController\");\n" " _this.__PersistentWebSocket__incomingStreamController_FI = result;\n" @@ -17680,9 +18302,9 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(socket) {\n" " var _this = this;\n" " type\$.WebSocket._as(socket);\n" -" return new A.PersistentWebSocket(_this.logger, _this.debugName, _this.maxRetryAttempts, new A._AsyncCompleter(new A._Future(\$.Zone__current, type\$._Future_void), type\$._AsyncCompleter_void), _this.uri, _this.onReconnect, socket, A.StreamController_StreamController(type\$.dynamic));\n" +" return new A.PersistentWebSocket(_this.logger, _this.debugName, _this.maxRetryAttempts, new A._AsyncCompleter(new A._Future(\$.Zone__current, type\$._Future_void), type\$._AsyncCompleter_void), _this.uri, _this.onReconnect, socket, A.StreamController_StreamController(null, null, null, type\$.dynamic));\n" " },\n" -" \$signature: 31\n" +" \$signature: 32\n" " };\n" " A.PersistentWebSocket__listenWithRetry_attemptRetry.prototype = {\n" " call\$1(message) {\n" @@ -17776,7 +18398,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " });\n" " return A._asyncStartSync(\$async\$call\$1, \$async\$completer);\n" " },\n" -" \$signature: 33\n" +" \$signature: 34\n" " };\n" " A._PersistentWebSocket_Object_StreamChannelMixin.prototype = {};\n" " A.safeUnawaited_closure.prototype = {\n" @@ -17785,7 +18407,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " type\$.StackTrace._as(stackTrace);\n" " return \$.\$get\$_logger().log\$4(B.Level_WARNING_900, \"Error in unawaited Future:\", error, stackTrace);\n" " },\n" -" \$signature: 7\n" +" \$signature: 6\n" " };\n" " A.Uuid.prototype = {\n" " v4\$0() {\n" @@ -17854,13 +18476,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$2(key1, key2) {\n" " return A._asString(key1).toLowerCase() === A._asString(key2).toLowerCase();\n" " },\n" -" \$signature: 34\n" +" \$signature: 35\n" " };\n" " A.BaseRequest_closure0.prototype = {\n" " call\$1(key) {\n" " return B.JSString_methods.get\$hashCode(A._asString(key).toLowerCase());\n" " },\n" -" \$signature: 35\n" +" \$signature: 36\n" " };\n" " A.BaseResponse.prototype = {\n" " BaseResponse\$7\$contentLength\$headers\$isRedirect\$persistentConnection\$reasonPhrase\$request(statusCode, contentLength, headers, isRedirect, persistentConnection, reasonPhrase, request) {\n" @@ -17955,7 +18577,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }(A._callDartFunctionFast3, t2);\n" " result[\$.\$get\$DART_CLOSURE_DART_JSINTEROP_PROPERTY_NAME()] = t2;\n" " t1.forEach(result);\n" -" t1 = A._bodyToStream(request, response);\n" +" t1 = A._readBody(request, response);\n" " t2 = A._asInt(response.status);\n" " t4 = headers;\n" " t5 = contentLength0;\n" @@ -18014,77 +18636,20 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$2(value, header) {\n" " return this.call\$3(value, header, null);\n" " },\n" -" \$signature: 36\n" -" };\n" -" A._bodyToStream_closure.prototype = {\n" -" call\$1(listener) {\n" -" return A._readStreamBody(this.request, this.response, type\$.MultiStreamController_List_int._as(listener));\n" -" },\n" " \$signature: 37\n" " };\n" -" A._readStreamBody_closure.prototype = {\n" -" call\$0() {\n" -" var t1 = this._box_0,\n" -" _0_0 = t1.resumeSignal;\n" -" if (_0_0 != null) {\n" -" t1.resumeSignal = null;\n" -" _0_0.complete\$0();\n" -" }\n" +" A._readBody_closure.prototype = {\n" +" call\$1(_) {\n" +" return null;\n" " },\n" -" \$signature: 0\n" +" \$signature: 4\n" " };\n" -" A._readStreamBody_closure0.prototype = {\n" -" call\$0() {\n" -" var \$async\$goto = 0,\n" -" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void),\n" -" \$async\$handler = 1, \$async\$errorStack = [], \$async\$self = this, e, s, exception, \$async\$exception;\n" -" var \$async\$call\$0 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" -" if (\$async\$errorCode === 1) {\n" -" \$async\$errorStack.push(\$async\$result);\n" -" \$async\$goto = \$async\$handler;\n" -" }\n" -" for (;;)\n" -" switch (\$async\$goto) {\n" -" case 0:\n" -" // Function start\n" -" \$async\$handler = 3;\n" -" \$async\$self._box_0.cancelled = true;\n" -" \$async\$goto = 6;\n" -" return A._asyncAwait(A.promiseToFuture(A._asJSObject(\$async\$self.reader.cancel()), type\$.nullable_Object), \$async\$call\$0);\n" -" case 6:\n" -" // returning from await.\n" -" \$async\$handler = 1;\n" -" // goto after finally\n" -" \$async\$goto = 5;\n" -" break;\n" -" case 3:\n" -" // catch\n" -" \$async\$handler = 2;\n" -" \$async\$exception = \$async\$errorStack.pop();\n" -" e = A.unwrapException(\$async\$exception);\n" -" s = A.getTraceFromException(\$async\$exception);\n" -" if (!\$async\$self._box_0.hadError)\n" -" A._rethrowAsClientException(e, s, \$async\$self.request);\n" -" // goto after finally\n" -" \$async\$goto = 5;\n" -" break;\n" -" case 2:\n" -" // uncaught\n" -" // goto rethrow\n" -" \$async\$goto = 1;\n" -" break;\n" -" case 5:\n" -" // after finally\n" -" // implicit return\n" -" return A._asyncReturn(null, \$async\$completer);\n" -" case 1:\n" -" // rethrow\n" -" return A._asyncRethrow(\$async\$errorStack.at(-1), \$async\$completer);\n" -" }\n" -" });\n" -" return A._asyncStartSync(\$async\$call\$0, \$async\$completer);\n" +" A._readBody_closure0.prototype = {\n" +" call\$1(_) {\n" +" A._asObject(_);\n" +" return this._box_0.isError;\n" " },\n" -" \$signature: 6\n" +" \$signature: 38\n" " };\n" " A.ByteStream.prototype = {\n" " toBytes\$0() {\n" @@ -18099,7 +18664,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(bytes) {\n" " return this.completer.complete\$1(new Uint8Array(A._ensureNativeList(type\$.List_int._as(bytes))));\n" " },\n" -" \$signature: 38\n" +" \$signature: 39\n" " };\n" " A.ClientException.prototype = {\n" " toString\$0(_) {\n" @@ -18187,7 +18752,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " scanner.expectDone\$0();\n" " return A.MediaType\$(t4, t5, parameters);\n" " },\n" -" \$signature: 39\n" +" \$signature: 40\n" " };\n" " A.MediaType_toString_closure.prototype = {\n" " call\$2(attribute, value) {\n" @@ -18206,7 +18771,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " } else\n" " t1._contents = t3 + value;\n" " },\n" -" \$signature: 40\n" +" \$signature: 41\n" " };\n" " A.MediaType_toString__closure.prototype = {\n" " call\$1(match) {\n" @@ -18309,7 +18874,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " \$parent._children.\$indexSet(0, thisName, t1);\n" " return t1;\n" " },\n" -" \$signature: 42\n" +" \$signature: 43\n" " };\n" " A.Context.prototype = {\n" " absolute\$15(part1, part2, part3, part4, part5, part6, part7, part8, part9, part10, part11, part12, part13, part14, part15) {\n" @@ -18556,7 +19121,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " A._asStringQ(arg);\n" " return arg == null ? \"null\" : '\"' + arg + '\"';\n" " },\n" -" \$signature: 44\n" +" \$signature: 45\n" " };\n" " A.InternalStyle.prototype = {\n" " getRoot\$1(path) {\n" @@ -19010,7 +19575,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " var t1 = this.\$this;\n" " t1._onReleaseCompleters.removeFirst\$0().complete\$1(new A.PoolResource(t1));\n" " },\n" -" \$signature: 45\n" +" \$signature: 46\n" " };\n" " A.Pool__runOnRelease_closure0.prototype = {\n" " call\$2(error, stackTrace) {\n" @@ -19028,27 +19593,23 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " get\$lines() {\n" " return this._lineStarts.length;\n" " },\n" -" SourceFile\$_fromList\$2\$url(decodedChars, url) {\n" -" var t1, t2, t3, t4, t5, t6, i, c, j, t7;\n" -" for (t1 = this._decodedChars, t2 = t1.length, t3 = decodedChars.__internal\$_string, t4 = t3.length, t5 = t1.\$flags | 0, t6 = this._lineStarts, i = 0; i < t2; ++i) {\n" -" if (!(i < t4))\n" -" return A.ioore(t3, i);\n" -" c = t3.charCodeAt(i);\n" -" t5 & 2 && A.throwUnsupportedOperation(t1);\n" -" t1[i] = c;\n" +" SourceFile\$decoded\$2\$url(decodedChars, url) {\n" +" var t1, t2, t3, i, c, j, t4;\n" +" for (t1 = this._decodedChars, t2 = t1.length, t3 = this._lineStarts, i = 0; i < t2; ++i) {\n" +" c = t1[i];\n" " if (c === 13) {\n" " j = i + 1;\n" -" if (j < t4) {\n" -" if (!(j < t4))\n" -" return A.ioore(t3, j);\n" -" t7 = t3.charCodeAt(j) !== 10;\n" +" if (j < t2) {\n" +" if (!(j < t2))\n" +" return A.ioore(t1, j);\n" +" t4 = t1[j] !== 10;\n" " } else\n" -" t7 = true;\n" -" if (t7)\n" +" t4 = true;\n" +" if (t4)\n" " c = 10;\n" " }\n" " if (c === 10)\n" -" B.JSArray_methods.add\$1(t6, i + 1);\n" +" B.JSArray_methods.add\$1(t3, i + 1);\n" " }\n" " },\n" " getLine\$1(offset) {\n" @@ -19454,7 +20015,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$0() {\n" " return this.color;\n" " },\n" -" \$signature: 46\n" +" \$signature: 47\n" " };\n" " A.Highlighter\$__closure.prototype = {\n" " call\$1(line) {\n" @@ -19462,7 +20023,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t2 = A._arrayInstanceType(t1);\n" " return new A.WhereIterable(t1, t2._eval\$1(\"bool(1)\")._as(new A.Highlighter\$___closure()), t2._eval\$1(\"WhereIterable<1>\")).get\$length(0);\n" " },\n" -" \$signature: 47\n" +" \$signature: 48\n" " };\n" " A.Highlighter\$___closure.prototype = {\n" " call\$1(highlight) {\n" @@ -19475,21 +20036,21 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(line) {\n" " return type\$._Line._as(line).url;\n" " },\n" -" \$signature: 49\n" +" \$signature: 50\n" " };\n" " A.Highlighter__collateLines_closure.prototype = {\n" " call\$1(highlight) {\n" " var t1 = type\$._Highlight._as(highlight).span.get\$sourceUrl();\n" " return t1 == null ? new A.Object() : t1;\n" " },\n" -" \$signature: 50\n" +" \$signature: 51\n" " };\n" " A.Highlighter__collateLines_closure0.prototype = {\n" " call\$2(highlight1, highlight2) {\n" " var t1 = type\$._Highlight;\n" " return t1._as(highlight1).span.compareTo\$1(0, t1._as(highlight2).span);\n" " },\n" -" \$signature: 51\n" +" \$signature: 52\n" " };\n" " A.Highlighter__collateLines_closure1.prototype = {\n" " call\$1(entry) {\n" @@ -19532,7 +20093,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " return lines;\n" " },\n" -" \$signature: 78\n" +" \$signature: 53\n" " };\n" " A.Highlighter__collateLines__closure.prototype = {\n" " call\$1(highlight) {\n" @@ -19699,7 +20260,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }\n" " return A._Highlight__normalizeEndOfLine(A._Highlight__normalizeTrailingNewline(A._Highlight__normalizeNewlines(newSpan)));\n" " },\n" -" \$signature: 54\n" +" \$signature: 55\n" " };\n" " A._Line.prototype = {\n" " toString\$0(_) {\n" @@ -19912,18 +20473,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _this._outgoingController.close\$0();\n" " },\n" " _closeWithError\$1(error) {\n" -" var _0_0, error0, stackTrace, t2,\n" -" t1 = this._incomingController;\n" -" if (t1._state >= 4)\n" -" A.throwExpression(t1._badEventState\$0());\n" -" _0_0 = A._interceptUserError(error, null);\n" -" error0 = _0_0.error;\n" -" stackTrace = _0_0.stackTrace;\n" -" t2 = t1._state;\n" -" if ((t2 & 1) !== 0)\n" -" t1._sendError\$2(error0, stackTrace);\n" -" else if ((t2 & 3) === 0)\n" -" t1._ensurePendingEvents\$0().add\$1(0, new A._DelayedError(error0, stackTrace));\n" +" var t1;\n" +" this._incomingController.addError\$1(error);\n" " this.close\$0();\n" " t1 = this._onConnected;\n" " if ((t1.future._state & 30) === 0)\n" @@ -20077,7 +20628,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " });\n" " return A._asyncStartSync(\$async\$call\$0, \$async\$completer);\n" " },\n" -" \$signature: 57\n" +" \$signature: 58\n" " };\n" " A.StreamChannelMixin.prototype = {};\n" " A.StringScannerException.prototype = {\n" @@ -20124,7 +20675,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this._fail\$1(\"no more input\");\n" " },\n" " error\$3\$length\$position(message, \$length, position) {\n" -" var t2, t3, end, sourceFile, end0,\n" +" var t2, t3, t4, t5, sourceFile, end,\n" " t1 = this.string;\n" " if (position < 0)\n" " A.throwExpression(A.RangeError\$(\"position must be greater than or equal to 0.\"));\n" @@ -20134,16 +20685,17 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " if (t2)\n" " A.throwExpression(A.RangeError\$(\"position plus length must not go beyond the end of the string.\"));\n" " t2 = this.sourceUrl;\n" -" t3 = A._setArrayType([0], type\$.JSArray_int);\n" -" end = t1.length;\n" -" sourceFile = new A.SourceFile(t2, t3, new Uint32Array(end));\n" -" sourceFile.SourceFile\$_fromList\$2\$url(new A.CodeUnits(t1), t2);\n" -" end0 = position + \$length;\n" -" if (end0 > end)\n" -" A.throwExpression(A.RangeError\$(\"End \" + end0 + string\$.x20must_ + sourceFile.get\$length(0) + \".\"));\n" +" t3 = new A.CodeUnits(t1);\n" +" t4 = A._setArrayType([0], type\$.JSArray_int);\n" +" t5 = new Uint32Array(A._ensureNativeList(t3.toList\$0(t3)));\n" +" sourceFile = new A.SourceFile(t2, t4, t5);\n" +" sourceFile.SourceFile\$decoded\$2\$url(t3, t2);\n" +" end = position + \$length;\n" +" if (end > t5.length)\n" +" A.throwExpression(A.RangeError\$(\"End \" + end + string\$.x20must_ + sourceFile.get\$length(0) + \".\"));\n" " else if (position < 0)\n" " A.throwExpression(A.RangeError\$(\"Start may not be negative, was \" + position + \".\"));\n" -" throw A.wrapException(new A.StringScannerException(t1, message, new A._FileSpan(sourceFile, position, end0)));\n" +" throw A.wrapException(new A.StringScannerException(t1, message, new A._FileSpan(sourceFile, position, end)));\n" " },\n" " _fail\$1(\$name) {\n" " this.error\$3\$length\$position(\"expected \" + \$name + \".\", 0, this._string_scanner\$_position);\n" @@ -20449,8 +21001,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t1.\$dartReadyToRunMain = A._functionToJS0(new A.main__closure4(_box_0));\n" " t2 = \$.Zone__current;\n" " t3 = Math.max(100, 1);\n" -" t4 = A.StreamController_StreamController(type\$.DebugEvent);\n" -" t5 = A.StreamController_StreamController(type\$.List_DebugEvent);\n" +" t4 = A.StreamController_StreamController(null, null, null, type\$.DebugEvent);\n" +" t5 = A.StreamController_StreamController(null, null, null, type\$.List_DebugEvent);\n" " debugEventController = new A.BatchedStreamController(t3, 1000, t4, t5, new A._AsyncCompleter(new A._Future(t2, type\$._Future_bool), type\$._AsyncCompleter_bool), type\$.BatchedStreamController_DebugEvent);\n" " t2 = A.List_List\$filled(A.QueueList__computeInitialCapacity(null), null, false, type\$.nullable_Result_DebugEvent);\n" " t3 = A.ListQueue\$(type\$._EventRequest_dynamic);\n" @@ -20472,29 +21024,25 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " });\n" " return A._asyncStartSync(\$async\$call\$0, \$async\$completer);\n" " },\n" -" \$signature: 6\n" +" \$signature: 9\n" " };\n" " A.main__closure.prototype = {\n" " call\$0() {\n" -" var path = A._asStringQ(init.G.\$reloadedSourcesPath);\n" -" path.toString;\n" -" return A.FutureOfJSAnyToJSPromise_get_toJS(this.manager._restarter.hotReloadStart\$1(path), type\$.JSArray_nullable_Object);\n" +" return A.FutureOfJSAnyToJSPromise_get_toJS(this.manager._restarter.hotReloadStart\$1(A._asStringQ(init.G.\$reloadedSourcesPath)), type\$.JSArray_nullable_Object);\n" " },\n" -" \$signature: 5\n" +" \$signature: 7\n" " };\n" " A.main__closure0.prototype = {\n" " call\$0() {\n" " return A.FutureOfVoidToJSPromise_get_toJS(this.manager.hotReloadEnd\$0());\n" " },\n" -" \$signature: 5\n" +" \$signature: 7\n" " };\n" " A.main__closure1.prototype = {\n" " call\$0() {\n" -" var path = A._asStringQ(init.G.\$reloadedSourcesPath);\n" -" path.toString;\n" -" return A.FutureOfJSAnyToJSPromise_get_toJS(this.manager.hotRestartBegin\$1(path), type\$.JSArray_nullable_Object);\n" +" return A.FutureOfJSAnyToJSPromise_get_toJS(this.manager.hotRestartBegin\$1(A._asStringQ(init.G.\$reloadedSourcesPath)), type\$.JSArray_nullable_Object);\n" " },\n" -" \$signature: 5\n" +" \$signature: 7\n" " };\n" " A.main__closure2.prototype = {\n" " call\$2(runId, pauseIsolatesOnStart) {\n" @@ -20514,7 +21062,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(runId) {\n" " return this.call\$2(runId, null);\n" " },\n" -" \$signature: 60\n" +" \$signature: 92\n" " };\n" " A.main__closure3.prototype = {\n" " call\$1(runId) {\n" @@ -20544,7 +21092,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " if (A._asBool(init.G.\$dartEmitDebugEvents))\n" " A._trySendEvent(this.client.get\$sink(), B.C_JsonCodec.encode\$2\$toEncodable(A._setArrayType([\"BatchedDebugEvents\", new A.BatchedDebugEvents(events).toJson\$0()], type\$.JSArray_Object), null), type\$.dynamic);\n" " },\n" -" \$signature: 62\n" +" \$signature: 63\n" " };\n" " A.main__closure6.prototype = {\n" " call\$2(kind, eventData) {\n" @@ -20556,7 +21104,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " A._trySendEvent(new A._StreamSinkWrapper(t1, A._instanceType(t1)._eval\$1(\"_StreamSinkWrapper<1>\")), new A.DebugEvent(kind, eventData, Date.now()), type\$.DebugEvent);\n" " }\n" " },\n" -" \$signature: 63\n" +" \$signature: 64\n" " };\n" " A.main__closure7.prototype = {\n" " call\$1(eventData) {\n" @@ -20588,7 +21136,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " \$call\$body\$main__closure(serialized) {\n" " var \$async\$goto = 0,\n" " \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void),\n" -" \$async\$self = this, t1, t2, t3, path, \$alert, \$event;\n" +" \$async\$self = this, t1, t2, \$alert, \$event;\n" " var \$async\$call\$1 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" " if (\$async\$errorCode === 1)\n" " return A._asyncRethrow(\$async\$result, \$async\$completer);\n" @@ -20621,10 +21169,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " break;\n" " case 11:\n" " // then\n" -" t3 = A._asStringQ(t1.\$reloadedSourcesPath);\n" -" t3.toString;\n" " \$async\$goto = 14;\n" -" return A._asyncAwait(t2.hotRestartBegin\$1(t3), \$async\$call\$1);\n" +" return A._asyncAwait(t2.hotRestartBegin\$1(A._asStringQ(t1.\$reloadedSourcesPath)), \$async\$call\$1);\n" " case 14:\n" " // returning from await.\n" " type\$.TwoPhaseRestarter._as(t2._restarter);\n" @@ -20650,10 +21196,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " case 16:\n" " // then\n" " t2 = \$async\$self.manager;\n" -" path = A._asStringQ(t1.\$reloadedSourcesPath);\n" -" path.toString;\n" " \$async\$goto = 18;\n" -" return A._asyncAwait(t2._restarter.hotReloadStart\$1(path), \$async\$call\$1);\n" +" return A._asyncAwait(t2._restarter.hotReloadStart\$1(A._asStringQ(t1.\$reloadedSourcesPath)), \$async\$call\$1);\n" " case 18:\n" " // returning from await.\n" " \$async\$goto = 19;\n" @@ -20772,7 +21316,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " A.main__closure10.prototype = {\n" " call\$1(error) {\n" " },\n" -" \$signature: 8\n" +" \$signature: 4\n" " };\n" " A.main__closure11.prototype = {\n" " call\$1(e) {\n" @@ -20791,25 +21335,25 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " type\$.StackTrace._as(stackTrace);\n" " A.print(\"Unhandled error detected in the injected client.js script.\\n\\nYou can disable this script in webdev by passing --no-injected-client if it\\nis preventing your app from loading, but note that this will also prevent\\nall debugging and hot reload/restart functionality from working.\\n\\nThe original error is below, please file an issue at\\nhttps://github.com/dart-lang/webdev/issues/new and attach this output:\\n\\n\" + A.S(error) + \"\\n\" + stackTrace.toString\$0(0) + \"\\n\");\n" " },\n" -" \$signature: 7\n" +" \$signature: 6\n" " };\n" " A._handleAuthRequest_closure.prototype = {\n" " call\$1(isAuthenticated) {\n" " return A._dispatchEvent(\"dart-auth-response\", \"\" + A._asBool(isAuthenticated));\n" " },\n" -" \$signature: 64\n" +" \$signature: 65\n" " };\n" " A._sendHotReloadResponse_closure.prototype = {\n" " call\$3(id, success, errorMessage) {\n" " return new A.HotReloadResponse(id, success, errorMessage);\n" " },\n" -" \$signature: 65\n" +" \$signature: 66\n" " };\n" " A._sendHotRestartResponse_closure.prototype = {\n" " call\$3(id, success, errorMessage) {\n" " return new A.HotRestartResponse(id, success, errorMessage);\n" " },\n" -" \$signature: 66\n" +" \$signature: 67\n" " };\n" " A.DdcLibraryBundleRestarter.prototype = {\n" " _runMainWhenReady\$2(readyToRunMain, runMain) {\n" @@ -20928,6 +21472,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._asyncAwait(A._Debugger_maybeInvokeFlutterDisassemble(A._asJSObject(A._asJSObject(t1.dartDevEmbedder).debugger)), \$async\$hotRestartBegin\$1);\n" " case 3:\n" " // returning from await.\n" +" reloadedSourcesPath.toString;\n" " t2 = type\$.JSArray_nullable_Object;\n" " \$async\$temp1 = t2;\n" " \$async\$temp2 = A;\n" @@ -20954,7 +21499,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " hotReloadStart\$1(reloadedSourcesPath) {\n" " var \$async\$goto = 0,\n" " \$async\$completer = A._makeAsyncAwaitCompleter(type\$.JSArray_nullable_Object),\n" -" \$async\$returnValue, \$async\$self = this, t3, t4, t5, t6, srcModuleLibraryCast, src, libraries, t7, t8, t9, t1, t2, filesToLoad, librariesToReload, srcModuleLibraries;\n" +" \$async\$returnValue, \$async\$self = this, srcModuleLibraries, t3, t4, t5, t6, srcModuleLibraryCast, src, libraries, t7, t8, t9, result, t1, t2, filesToLoad, librariesToReload;\n" " var \$async\$hotReloadStart\$1 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" " if (\$async\$errorCode === 1)\n" " return A._asyncRethrow(\$async\$result, \$async\$completer);\n" @@ -20966,6 +21511,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " t2 = type\$.JSArray_nullable_Object;\n" " filesToLoad = t2._as(new t1.Array());\n" " librariesToReload = t2._as(new t1.Array());\n" +" reloadedSourcesPath.toString;\n" " \$async\$goto = 3;\n" " return A._asyncAwait(\$async\$self._getSrcModuleLibraries\$1(reloadedSourcesPath), \$async\$hotReloadStart\$1);\n" " case 3:\n" @@ -20988,6 +21534,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._asyncAwait(A.promiseToFuture(A._asJSObject(A._asJSObject(t1.dartDevEmbedder).hotReload(filesToLoad, librariesToReload)), type\$.nullable_Object), \$async\$hotReloadStart\$1);\n" " case 4:\n" " // returning from await.\n" +" result = \$async\$result;\n" +" A._asJSObject(A._asJSObject(A._asJSObject(t1.dartDevEmbedder).debugger).invokeExtension(\"ext.dwds.sendEvent\", '{\"type\": \"hotReloadResult\", \"result\": \"' + A.S(result) + '\"}'));\n" +" if (result != null && typeof result === \"boolean\" && !A._asBool(result))\n" +" throw A.wrapException(A.Exception_Exception(\"Hot reload rejected by DDC\"));\n" " \$async\$returnValue = t2._as(A.jsify(srcModuleLibraries));\n" " // goto return\n" " \$async\$goto = 1;\n" @@ -21154,10 +21704,45 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._asyncStartSync(\$async\$restart\$3\$readyToRunMain\$reloadedSourcesPath\$runId, \$async\$completer);\n" " },\n" " hotReloadEnd\$0() {\n" -" return A.throwExpression(A.UnimplementedError\$(string\$.Hot_reD));\n" +" var \$async\$goto = 0,\n" +" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void);\n" +" var \$async\$hotReloadEnd\$0 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" +" if (\$async\$errorCode === 1)\n" +" return A._asyncRethrow(\$async\$result, \$async\$completer);\n" +" for (;;)\n" +" switch (\$async\$goto) {\n" +" case 0:\n" +" // Function start\n" +" // implicit return\n" +" return A._asyncReturn(null, \$async\$completer);\n" +" }\n" +" });\n" +" return A._asyncStartSync(\$async\$hotReloadEnd\$0, \$async\$completer);\n" " },\n" " hotReloadStart\$1(reloadedSourcesPath) {\n" -" return A.throwExpression(A.UnimplementedError\$(string\$.Hot_reD));\n" +" var \$async\$goto = 0,\n" +" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.JSArray_nullable_Object),\n" +" \$async\$returnValue;\n" +" var \$async\$hotReloadStart\$1 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" +" if (\$async\$errorCode === 1)\n" +" return A._asyncRethrow(\$async\$result, \$async\$completer);\n" +" for (;;)\n" +" switch (\$async\$goto) {\n" +" case 0:\n" +" // Function start\n" +" if (reloadedSourcesPath == null || reloadedSourcesPath.length === 0) {\n" +" \$async\$returnValue = type\$.JSArray_nullable_Object._as(new init.G.Array());\n" +" // goto return\n" +" \$async\$goto = 1;\n" +" break;\n" +" }\n" +" throw A.wrapException(A.UnimplementedError\$(\"Hot reload is not supported for the DDC module format.\"));\n" +" case 1:\n" +" // return\n" +" return A._asyncReturn(\$async\$returnValue, \$async\$completer);\n" +" }\n" +" });\n" +" return A._asyncStartSync(\$async\$hotReloadStart\$1, \$async\$completer);\n" " },\n" " \$isRestarter: 1\n" " };\n" @@ -21176,7 +21761,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " this.sub.cancel\$0();\n" " return value;\n" " },\n" -" \$signature: 68\n" +" \$signature: 69\n" " };\n" " A.ReloadingManager.prototype = {\n" " hotRestart\$3\$readyToRunMain\$reloadedSourcesPath\$runId(readyToRunMain, reloadedSourcesPath, runId) {\n" @@ -21410,10 +21995,45 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return A._asyncStartSync(\$async\$restart\$3\$readyToRunMain\$reloadedSourcesPath\$runId, \$async\$completer);\n" " },\n" " hotReloadEnd\$0() {\n" -" return A.throwExpression(A.UnimplementedError\$(string\$.Hot_reA));\n" +" var \$async\$goto = 0,\n" +" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.void);\n" +" var \$async\$hotReloadEnd\$0 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" +" if (\$async\$errorCode === 1)\n" +" return A._asyncRethrow(\$async\$result, \$async\$completer);\n" +" for (;;)\n" +" switch (\$async\$goto) {\n" +" case 0:\n" +" // Function start\n" +" // implicit return\n" +" return A._asyncReturn(null, \$async\$completer);\n" +" }\n" +" });\n" +" return A._asyncStartSync(\$async\$hotReloadEnd\$0, \$async\$completer);\n" " },\n" " hotReloadStart\$1(reloadedSourcesPath) {\n" -" return A.throwExpression(A.UnimplementedError\$(string\$.Hot_reA));\n" +" var \$async\$goto = 0,\n" +" \$async\$completer = A._makeAsyncAwaitCompleter(type\$.JSArray_nullable_Object),\n" +" \$async\$returnValue;\n" +" var \$async\$hotReloadStart\$1 = A._wrapJsFunctionForAsync(function(\$async\$errorCode, \$async\$result) {\n" +" if (\$async\$errorCode === 1)\n" +" return A._asyncRethrow(\$async\$result, \$async\$completer);\n" +" for (;;)\n" +" switch (\$async\$goto) {\n" +" case 0:\n" +" // Function start\n" +" if (reloadedSourcesPath == null || reloadedSourcesPath.length === 0) {\n" +" \$async\$returnValue = type\$.JSArray_nullable_Object._as(new init.G.Array());\n" +" // goto return\n" +" \$async\$goto = 1;\n" +" break;\n" +" }\n" +" throw A.wrapException(A.UnimplementedError\$(\"Hot reload is not supported for the AMD module format.\"));\n" +" case 1:\n" +" // return\n" +" return A._asyncReturn(\$async\$returnValue, \$async\$completer);\n" +" }\n" +" });\n" +" return A._asyncStartSync(\$async\$hotReloadStart\$1, \$async\$completer);\n" " },\n" " _require_restarter\$_runMainWhenReady\$1(readyToRunMain) {\n" " var \$async\$goto = 0,\n" @@ -21707,7 +22327,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " call\$1(e) {\n" " this.completer.completeError\$2(new A.HotReloadFailedException(A._asString(type\$.JavaScriptObject._as(e).message)), this.stackTrace);\n" " },\n" -" \$signature: 71\n" +" \$signature: 72\n" " };\n" " A._createScript_closure.prototype = {\n" " call\$0() {\n" @@ -21716,13 +22336,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " return new A._createScript__closure();\n" " return new A._createScript__closure0(nonce);\n" " },\n" -" \$signature: 72\n" +" \$signature: 73\n" " };\n" " A._createScript__closure.prototype = {\n" " call\$0() {\n" " return A._asJSObject(A._asJSObject(init.G.document).createElement(\"script\"));\n" " },\n" -" \$signature: 5\n" +" \$signature: 7\n" " };\n" " A._createScript__closure0.prototype = {\n" " call\$0() {\n" @@ -21730,7 +22350,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " scriptElement.setAttribute(\"nonce\", this.nonce);\n" " return scriptElement;\n" " },\n" -" \$signature: 5\n" +" \$signature: 7\n" " };\n" " A.runMain_closure.prototype = {\n" " call\$0() {\n" @@ -21769,23 +22389,52 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _instance_1_u = hunkHelpers._instance_1u,\n" " _static_1 = hunkHelpers._static_1,\n" " _static_0 = hunkHelpers._static_0,\n" +" _static = hunkHelpers.installStaticTearOff,\n" " _instance = hunkHelpers.installInstanceTearOff,\n" " _instance_2_u = hunkHelpers._instance_2u,\n" " _instance_0_u = hunkHelpers._instance_0u,\n" -" _instance_1_i = hunkHelpers._instance_1i,\n" -" _static = hunkHelpers.installStaticTearOff;\n" +" _instance_1_i = hunkHelpers._instance_1i;\n" " _static_2(J, \"_interceptors_JSArray__compareAny\$closure\", \"JSArray__compareAny\", 27);\n" -" _instance_1_u(A.CastStreamSubscription.prototype, \"get\$__internal\$_onData\", \"__internal\$_onData\$1\", 11);\n" +" _instance_1_u(A.CastStreamSubscription.prototype, \"get\$__internal\$_onData\", \"__internal\$_onData\$1\", 8);\n" " _static_1(A, \"async__AsyncRun__scheduleImmediateJsOverride\$closure\", \"_AsyncRun__scheduleImmediateJsOverride\", 14);\n" " _static_1(A, \"async__AsyncRun__scheduleImmediateWithSetImmediate\$closure\", \"_AsyncRun__scheduleImmediateWithSetImmediate\", 14);\n" " _static_1(A, \"async__AsyncRun__scheduleImmediateWithTimer\$closure\", \"_AsyncRun__scheduleImmediateWithTimer\", 14);\n" " _static_0(A, \"async___startMicrotaskLoop\$closure\", \"_startMicrotaskLoop\", 0);\n" -" _static_1(A, \"async___nullDataHandler\$closure\", \"_nullDataHandler\", 4);\n" -" _static_2(A, \"async___nullErrorHandler\$closure\", \"_nullErrorHandler\", 7);\n" +" _static_1(A, \"async___nullDataHandler\$closure\", \"_nullDataHandler\", 5);\n" +" _static_2(A, \"async___nullErrorHandler\$closure\", \"_nullErrorHandler\", 6);\n" " _static_0(A, \"async___nullDoneHandler\$closure\", \"_nullDoneHandler\", 0);\n" -" _instance(A._Completer.prototype, \"get\$completeError\", 0, 1, null, [\"call\$2\", \"call\$1\"], [\"completeError\$2\", \"completeError\$1\"], 58, 0, 0);\n" -" _instance_2_u(A._Future.prototype, \"get\$_completeError\", \"_completeError\$2\", 7);\n" +" _static(A, \"async___rootHandleUncaughtError\$closure\", 5, null, [\"call\$5\"], [\"_rootHandleUncaughtError\"], 76, 0);\n" +" _static(A, \"async___rootRun\$closure\", 4, null, [\"call\$1\$4\", \"call\$4\"], [\"_rootRun\", function(\$self, \$parent, zone, f) {\n" +" return A._rootRun(\$self, \$parent, zone, f, type\$.dynamic);\n" +" }], 77, 0);\n" +" _static(A, \"async___rootRunUnary\$closure\", 5, null, [\"call\$2\$5\", \"call\$5\"], [\"_rootRunUnary\", function(\$self, \$parent, zone, f, arg) {\n" +" var t1 = type\$.dynamic;\n" +" return A._rootRunUnary(\$self, \$parent, zone, f, arg, t1, t1);\n" +" }], 78, 0);\n" +" _static(A, \"async___rootRunBinary\$closure\", 6, null, [\"call\$3\$6\"], [\"_rootRunBinary\"], 79, 0);\n" +" _static(A, \"async___rootRegisterCallback\$closure\", 4, null, [\"call\$1\$4\", \"call\$4\"], [\"_rootRegisterCallback\", function(\$self, \$parent, zone, f) {\n" +" return A._rootRegisterCallback(\$self, \$parent, zone, f, type\$.dynamic);\n" +" }], 80, 0);\n" +" _static(A, \"async___rootRegisterUnaryCallback\$closure\", 4, null, [\"call\$2\$4\", \"call\$4\"], [\"_rootRegisterUnaryCallback\", function(\$self, \$parent, zone, f) {\n" +" var t1 = type\$.dynamic;\n" +" return A._rootRegisterUnaryCallback(\$self, \$parent, zone, f, t1, t1);\n" +" }], 81, 0);\n" +" _static(A, \"async___rootRegisterBinaryCallback\$closure\", 4, null, [\"call\$3\$4\", \"call\$4\"], [\"_rootRegisterBinaryCallback\", function(\$self, \$parent, zone, f) {\n" +" var t1 = type\$.dynamic;\n" +" return A._rootRegisterBinaryCallback(\$self, \$parent, zone, f, t1, t1, t1);\n" +" }], 82, 0);\n" +" _static(A, \"async___rootErrorCallback\$closure\", 5, null, [\"call\$5\"], [\"_rootErrorCallback\"], 83, 0);\n" +" _static(A, \"async___rootScheduleMicrotask\$closure\", 4, null, [\"call\$4\"], [\"_rootScheduleMicrotask\"], 84, 0);\n" +" _static(A, \"async___rootCreateTimer\$closure\", 5, null, [\"call\$5\"], [\"_rootCreateTimer\"], 85, 0);\n" +" _static(A, \"async___rootCreatePeriodicTimer\$closure\", 5, null, [\"call\$5\"], [\"_rootCreatePeriodicTimer\"], 86, 0);\n" +" _static(A, \"async___rootPrint\$closure\", 4, null, [\"call\$4\"], [\"_rootPrint\"], 87, 0);\n" +" _static(A, \"async___rootFork\$closure\", 5, null, [\"call\$5\"], [\"_rootFork\"], 88, 0);\n" +" _instance(A._Completer.prototype, \"get\$completeError\", 0, 1, null, [\"call\$2\", \"call\$1\"], [\"completeError\$2\", \"completeError\$1\"], 62, 0, 0);\n" +" _instance_2_u(A._Future.prototype, \"get\$_completeError\", \"_completeError\$2\", 6);\n" " var _;\n" +" _instance_1_u(_ = A._StreamController.prototype, \"get\$_add\", \"_add\$1\", 8);\n" +" _instance_2_u(_, \"get\$_addError\", \"_addError\$2\", 6);\n" +" _instance_0_u(_, \"get\$_close\", \"_close\$0\", 0);\n" " _instance_0_u(_ = A._ControllerSubscription.prototype, \"get\$_onPause\", \"_onPause\$0\", 0);\n" " _instance_0_u(_, \"get\$_onResume\", \"_onResume\$0\", 0);\n" " _instance_0_u(_ = A._BufferingStreamSubscription.prototype, \"get\$_onPause\", \"_onPause\$0\", 0);\n" @@ -21793,59 +22442,59 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _instance_0_u(A._DoneStreamSubscription.prototype, \"get\$_onMicrotask\", \"_onMicrotask\$0\", 0);\n" " _instance_0_u(_ = A._ForwardingStreamSubscription.prototype, \"get\$_onPause\", \"_onPause\$0\", 0);\n" " _instance_0_u(_, \"get\$_onResume\", \"_onResume\$0\", 0);\n" -" _instance_1_u(_, \"get\$_handleData\", \"_handleData\$1\", 11);\n" -" _instance_2_u(_, \"get\$_handleError\", \"_handleError\$2\", 76);\n" +" _instance_1_u(_, \"get\$_handleData\", \"_handleData\$1\", 8);\n" +" _instance_2_u(_, \"get\$_handleError\", \"_handleError\$2\", 33);\n" " _instance_0_u(_, \"get\$_handleDone\", \"_handleDone\$0\", 0);\n" " _static_2(A, \"collection___defaultEquals\$closure\", \"_defaultEquals0\", 28);\n" " _static_1(A, \"collection___defaultHashCode\$closure\", \"_defaultHashCode\", 15);\n" " _static_2(A, \"collection_ListBase__compareAny\$closure\", \"ListBase__compareAny\", 27);\n" " _static_1(A, \"convert___defaultToEncodable\$closure\", \"_defaultToEncodable\", 16);\n" -" _instance_1_i(_ = A._ByteCallbackSink.prototype, \"get\$add\", \"add\$1\", 11);\n" +" _instance_1_i(_ = A._ByteCallbackSink.prototype, \"get\$add\", \"add\$1\", 8);\n" " _instance_0_u(_, \"get\$close\", \"close\$0\", 0);\n" " _static_1(A, \"core__identityHashCode\$closure\", \"identityHashCode\", 15);\n" " _static_2(A, \"core__identical\$closure\", \"identical\", 28);\n" -" _static_1(A, \"core_Uri_decodeComponent\$closure\", \"Uri_decodeComponent\", 9);\n" +" _static_1(A, \"core_Uri_decodeComponent\$closure\", \"Uri_decodeComponent\", 10);\n" " _static(A, \"math__max\$closure\", 2, null, [\"call\$1\$2\", \"call\$2\"], [\"max\", function(a, b) {\n" " return A.max(a, b, type\$.num);\n" -" }], 77, 0);\n" -" _instance_1_u(_ = A.PersistentWebSocket.prototype, \"get\$_writeToWebSocket\", \"_writeToWebSocket\$1\", 4);\n" -" _instance_0_u(_, \"get\$_listenWithRetry\", \"_listenWithRetry\$0\", 6);\n" -" _static_1(A, \"case_insensitive_map_CaseInsensitiveMap__canonicalizer\$closure\", \"CaseInsensitiveMap__canonicalizer\", 9);\n" +" }], 91, 0);\n" +" _instance_1_u(_ = A.PersistentWebSocket.prototype, \"get\$_writeToWebSocket\", \"_writeToWebSocket\$1\", 5);\n" +" _instance_0_u(_, \"get\$_listenWithRetry\", \"_listenWithRetry\$0\", 9);\n" +" _static_1(A, \"case_insensitive_map_CaseInsensitiveMap__canonicalizer\$closure\", \"CaseInsensitiveMap__canonicalizer\", 10);\n" " _instance_1_u(_ = A.SseClient.prototype, \"get\$_onIncomingControlMessage\", \"_onIncomingControlMessage\$1\", 2);\n" " _instance_1_u(_, \"get\$_onIncomingMessage\", \"_onIncomingMessage\$1\", 2);\n" " _instance_0_u(_, \"get\$_onOutgoingDone\", \"_onOutgoingDone\$0\", 0);\n" -" _instance_1_u(_, \"get\$_onOutgoingMessage\", \"_onOutgoingMessage\$1\", 56);\n" -" _static_1(A, \"client__initializeConnection\$closure\", \"initializeConnection\", 52);\n" +" _instance_1_u(_, \"get\$_onOutgoingMessage\", \"_onOutgoingMessage\$1\", 57);\n" +" _static_1(A, \"client__initializeConnection\$closure\", \"initializeConnection\", 61);\n" " _static_1(A, \"client___handleAuthRequest\$closure\", \"_handleAuthRequest\", 2);\n" " _instance_0_u(A.ReloadingManager.prototype, \"get\$hotRestartEnd\", \"hotRestartEnd\$0\", 0);\n" -" _instance_1_u(_ = A.RequireRestarter.prototype, \"get\$_moduleParents\", \"_moduleParents\$1\", 69);\n" -" _instance_2_u(_, \"get\$_moduleTopologicalCompare\", \"_moduleTopologicalCompare\$2\", 70);\n" +" _instance_1_u(_ = A.RequireRestarter.prototype, \"get\$_moduleParents\", \"_moduleParents\$1\", 70);\n" +" _instance_2_u(_, \"get\$_moduleTopologicalCompare\", \"_moduleTopologicalCompare\$2\", 71);\n" " })();\n" " (function inheritance() {\n" " var _mixin = hunkHelpers.mixin,\n" " _inherit = hunkHelpers.inherit,\n" " _inheritMany = hunkHelpers.inheritMany;\n" " _inherit(A.Object, null);\n" -" _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, A.SafeToStringHook, J.ArrayIterator, A.Stream, A.CastStreamSubscription, A.Iterable, A.CastIterator, A.Closure, A.MapBase, A.Error, A.ListBase, A.SentinelValue, A.ListIterator, A.MappedIterator, A.WhereIterator, A.ExpandIterator, A.TakeIterator, A.SkipIterator, A.EmptyIterator, A.WhereTypeIterator, A.FixedLengthListMixin, A.UnmodifiableListMixin, A._Record, A.ConstantMap, A._KeysOrValuesOrElementsIterator, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A.LinkedHashMapValueIterator, A.LinkedHashMapEntryIterator, A.JSSyntaxRegExp, A._MatchImplementation, A._AllMatchesIterator, A.StringMatch, A._StringAllMatchesIterator, A._Cell, A._UnmodifiableNativeByteBufferView, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A.AsyncError, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A._StreamController, A._AsyncStreamControllerDispatch, A._BufferingStreamSubscription, A._StreamSinkWrapper, A._DelayedEvent, A._DelayedDone, A._PendingEvents, A._DoneStreamSubscription, A._StreamIterator, A._ZoneHandleUncaughtError, A.Zone, A.ZoneDelegate, A.ZoneSpecification, A._HashMapKeyIterator, A.SetBase, A._HashSetIterator, A._UnmodifiableMapMixin, A.MapView, A._ListQueueIterator, A._SplayTreeNode, A._SplayTree, A._SplayTreeIterator, A.Codec, A.Converter, A.ByteConversionSink, A._JsonStringifier, A._Utf8Encoder, A._Utf8Decoder, A.DateTime, A.Duration, A._Enum, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.MapEntry, A.Null, A._StringStackTrace, A.StringBuffer, A._Uri, A.UriData, A._SimpleUri, A.NullRejectionException, A._JSRandom, A._JSSecureRandom, A.AsyncMemoizer, A.ErrorResult, A.ValueResult, A.StreamQueue, A._NextRequest, A._HasNextRequest, A.CanonicalizedMap, A._QueueList_Object_ListMixin, A.BuildResult, A.ConnectRequest, A.DebugEvent, A.BatchedDebugEvents, A.DebugInfo, A.DevToolsRequest, A.DevToolsResponse, A.ErrorResponse, A.HotReloadRequest, A.HotReloadResponse, A.HotRestartRequest, A.HotRestartResponse, A.PingRequest, A.RegisterEvent, A.RunRequest, A.ServiceExtensionRequest, A.ServiceExtensionResponse, A.BatchedStreamController, A.SocketClient, A._PersistentWebSocket_Object_StreamChannelMixin, A.Uuid, A._StackState, A.ClientException, A.BaseClient, A.BaseRequest, A.BaseResponse, A.MediaType, A.Level, A.LogRecord, A.Logger, A.Context, A.Style, A.ParsedPath, A.PathException, A.Pool, A.PoolResource, A.SourceFile, A.SourceLocationMixin, A.SourceSpanMixin, A.Highlighter, A._Highlight, A._Line, A.SourceLocation, A.SourceSpanException, A.StreamChannelMixin, A.StringScanner, A.EventStreamProvider, A._EventStreamSubscription, A.BrowserWebSocket, A.WebSocketEvent, A.WebSocketException, A.DdcLibraryBundleRestarter, A.DdcRestarter, A.ReloadingManager, A.HotReloadFailedException, A.RequireRestarter]);\n" +" _inheritMany(A.Object, [A.JS_CONST, J.Interceptor, A.SafeToStringHook, J.ArrayIterator, A.Stream, A.CastStreamSubscription, A.Iterable, A.CastIterator, A.Closure, A.MapBase, A.Error, A.ListBase, A.SentinelValue, A.ListIterator, A.MappedIterator, A.WhereIterator, A.ExpandIterator, A.TakeIterator, A.SkipIterator, A.EmptyIterator, A.WhereTypeIterator, A.FixedLengthListMixin, A.UnmodifiableListMixin, A._Record, A.ConstantMap, A._KeysOrValuesOrElementsIterator, A.TypeErrorDecoder, A.NullThrownFromJavaScriptException, A.ExceptionAndStackTrace, A._StackTrace, A.LinkedHashMapCell, A.LinkedHashMapKeyIterator, A.LinkedHashMapValueIterator, A.LinkedHashMapEntryIterator, A.JSSyntaxRegExp, A._MatchImplementation, A._AllMatchesIterator, A.StringMatch, A._StringAllMatchesIterator, A._Cell, A._UnmodifiableNativeByteBufferView, A.Rti, A._FunctionParameters, A._Type, A._TimerImpl, A._AsyncAwaitCompleter, A._AsyncStarStreamController, A._IterationMarker, A.AsyncError, A._Completer, A._FutureListener, A._Future, A._AsyncCallbackEntry, A._StreamController, A._AsyncStreamControllerDispatch, A._BufferingStreamSubscription, A._StreamSinkWrapper, A._AddStreamState, A._DelayedEvent, A._DelayedDone, A._PendingEvents, A._DoneStreamSubscription, A._StreamIterator, A._ZoneRun, A._ZoneRunUnary, A._ZoneRunBinary, A._ZoneRegisterCallback, A._ZoneRegisterUnaryCallback, A._ZoneRegisterBinaryCallback, A._ZoneErrorCallback, A._ZoneScheduleMicrotask, A._ZoneCreateTimer, A._ZoneCreatePeriodicTimer, A._ZonePrint, A._ZoneFork, A._ZoneHandleUncaughtError, A._ZoneValues, A._Zone, A._ZoneDelegate, A.ZoneSpecification, A._HashMapKeyIterator, A.SetBase, A._HashSetIterator, A._UnmodifiableMapMixin, A.MapView, A._ListQueueIterator, A._SplayTreeNode, A._SplayTree, A._SplayTreeIterator, A.Codec, A.Converter, A.ByteConversionSink, A._JsonStringifier, A._Utf8Encoder, A._Utf8Decoder, A.DateTime, A.Duration, A._Enum, A.OutOfMemoryError, A.StackOverflowError, A._Exception, A.FormatException, A.MapEntry, A.Null, A._StringStackTrace, A.StringBuffer, A._Uri, A.UriData, A._SimpleUri, A.NullRejectionException, A._JSRandom, A._JSSecureRandom, A.AsyncMemoizer, A.ErrorResult, A.ValueResult, A.StreamQueue, A._NextRequest, A._HasNextRequest, A.CanonicalizedMap, A._QueueList_Object_ListMixin, A.BuildResult, A.ConnectRequest, A.DebugEvent, A.BatchedDebugEvents, A.DebugInfo, A.DevToolsRequest, A.DevToolsResponse, A.ErrorResponse, A.HotReloadRequest, A.HotReloadResponse, A.HotRestartRequest, A.HotRestartResponse, A.PingRequest, A.RegisterEvent, A.RunRequest, A.ServiceExtensionRequest, A.ServiceExtensionResponse, A.BatchedStreamController, A.SocketClient, A._PersistentWebSocket_Object_StreamChannelMixin, A.Uuid, A._StackState, A.ClientException, A.BaseClient, A.BaseRequest, A.BaseResponse, A.MediaType, A.Level, A.LogRecord, A.Logger, A.Context, A.Style, A.ParsedPath, A.PathException, A.Pool, A.PoolResource, A.SourceFile, A.SourceLocationMixin, A.SourceSpanMixin, A.Highlighter, A._Highlight, A._Line, A.SourceLocation, A.SourceSpanException, A.StreamChannelMixin, A.StringScanner, A.EventStreamProvider, A._EventStreamSubscription, A.BrowserWebSocket, A.WebSocketEvent, A.WebSocketException, A.DdcLibraryBundleRestarter, A.DdcRestarter, A.ReloadingManager, A.HotReloadFailedException, A.RequireRestarter]);\n" " _inheritMany(J.Interceptor, [J.JSBool, J.JSNull, J.JavaScriptObject, J.JavaScriptBigInt, J.JavaScriptSymbol, J.JSNumber, J.JSString]);\n" " _inheritMany(J.JavaScriptObject, [J.LegacyJavaScriptObject, J.JSArray, A.NativeByteBuffer, A.NativeTypedData]);\n" " _inheritMany(J.LegacyJavaScriptObject, [J.PlainJavaScriptObject, J.UnknownJavaScriptObject, J.JavaScriptFunction]);\n" " _inherit(J.JSArraySafeToStringHook, A.SafeToStringHook);\n" " _inherit(J.JSUnmodifiableArray, J.JSArray);\n" " _inheritMany(J.JSNumber, [J.JSInt, J.JSNumNotInt]);\n" -" _inheritMany(A.Stream, [A.CastStream, A.StreamView, A._StreamImpl, A._EmptyStream, A._MultiStream, A._ForwardingStream, A._EventStream]);\n" +" _inheritMany(A.Stream, [A.CastStream, A.StreamView, A._StreamImpl, A._EmptyStream, A._ForwardingStream, A._EventStream]);\n" " _inheritMany(A.Iterable, [A._CastIterableBase, A.EfficientLengthIterable, A.MappedIterable, A.WhereIterable, A.ExpandIterable, A.TakeIterable, A.SkipIterable, A.WhereTypeIterable, A._KeysOrValues, A._AllMatchesIterable, A._StringAllMatchesIterable]);\n" " _inheritMany(A._CastIterableBase, [A.CastIterable, A.__CastListBase__CastIterableBase_ListMixin]);\n" " _inherit(A._EfficientLengthCastIterable, A.CastIterable);\n" " _inherit(A._CastListBase, A.__CastListBase__CastIterableBase_ListMixin);\n" -" _inheritMany(A.Closure, [A.Closure2Args, A.Closure0Args, A.Instantiation, A.TearOffClosure, A.initHooks_closure, A.initHooks_closure1, A._AsyncRun__initializeScheduleImmediate_internalCallback, A._AsyncRun__initializeScheduleImmediate_closure, A._awaitOnObject_closure, A._Future__propagateToListeners_handleWhenCompleteCallback_closure, A._Future_timeout_closure0, A.Stream_length_closure, A.Stream_first_closure0, A.Zone_bindUnaryCallbackGuarded_closure, A.runZonedGuarded_errorHandler, A._LinkedCustomHashMap_closure, A._Uri__makePath_closure, A.FutureOfJSAnyToJSPromise_get_toJS__closure, A.FutureOfVoidToJSPromise_get_toJS__closure, A.jsify__convert, A.promiseToFuture_closure, A.promiseToFuture_closure0, A.dartify_convert, A.StreamQueue__ensureListening_closure, A.CanonicalizedMap_keys_closure, A.BuildStatus_BuildStatus\$fromJson_closure, A.BatchedDebugEvents_toJson_closure, A.WebSocketClient_stream_closure, A.PersistentWebSocket_connect_closure, A.PersistentWebSocket__listenWithRetry_attemptRetry, A.PersistentWebSocket__listenWithRetry_closure, A.BaseRequest_closure0, A.BrowserClient_send_closure, A._bodyToStream_closure, A.ByteStream_toBytes_closure, A.MediaType_toString__closure, A.expectQuotedString_closure, A.Context_joinAll_closure, A.Context_split_closure, A._validateArgList_closure, A.Pool__runOnRelease_closure, A.Highlighter\$__closure, A.Highlighter\$___closure, A.Highlighter\$__closure0, A.Highlighter__collateLines_closure, A.Highlighter__collateLines_closure1, A.Highlighter__collateLines__closure, A.Highlighter_highlight_closure, A.SseClient_closure0, A.SseClient_closure1, A._EventStreamSubscription_closure, A._EventStreamSubscription_onData_closure, A.BrowserWebSocket_connect_closure, A.BrowserWebSocket_connect_closure0, A.BrowserWebSocket_connect_closure1, A.BrowserWebSocket_connect_closure2, A.main__closure2, A.main__closure3, A.main__closure5, A.main__closure7, A.main__closure9, A.main__closure10, A.main__closure11, A._handleAuthRequest_closure, A._sendHotReloadResponse_closure, A._sendHotRestartResponse_closure, A.DdcLibraryBundleRestarter_restart_closure, A.DdcLibraryBundleRestarter_hotReloadStart_closure, A.DdcRestarter_restart_closure0, A.DdcRestarter_restart_closure, A.RequireRestarter__reloadModule_closure0, A.JSArrayExtension_toDartIterable_closure]);\n" -" _inheritMany(A.Closure2Args, [A._CastListBase_sort_closure, A.CastMap_forEach_closure, A.initHooks_closure0, A._awaitOnObject_closure0, A._wrapJsFunctionForAsync_closure, A._Future__propagateToListeners_handleWhenCompleteCallback_closure0, A._Future_timeout_closure1, A._BufferingStreamSubscription_asFuture_closure0, A.MapBase_mapToString_closure, A._JsonStringifier_writeMap_closure, A.Uri_parseIPv6Address_error, A.FutureOfJSAnyToJSPromise_get_toJS_closure, A.FutureOfJSAnyToJSPromise_get_toJS__closure0, A.FutureOfVoidToJSPromise_get_toJS_closure, A.FutureOfVoidToJSPromise_get_toJS__closure0, A.StreamQueue__ensureListening_closure1, A.CanonicalizedMap_addAll_closure, A.CanonicalizedMap_forEach_closure, A.safeUnawaited_closure, A.BaseRequest_closure, A.MediaType_toString_closure, A.Pool__runOnRelease_closure0, A.Highlighter__collateLines_closure0, A.main__closure6, A.main_closure0]);\n" +" _inheritMany(A.Closure, [A.Closure2Args, A.Closure0Args, A.Instantiation, A.TearOffClosure, A.initHooks_closure, A.initHooks_closure1, A._AsyncRun__initializeScheduleImmediate_internalCallback, A._AsyncRun__initializeScheduleImmediate_closure, A._awaitOnObject_closure, A._asyncStarHelper_closure0, A._Future__propagateToListeners_handleWhenCompleteCallback_closure, A._Future_timeout_closure0, A.Stream_length_closure, A.Stream_first_closure0, A._CustomZone_bindUnaryCallbackGuarded_closure, A._RootZone_bindUnaryCallbackGuarded_closure, A.runZonedGuarded_closure, A._LinkedCustomHashMap_closure, A._Uri__makePath_closure, A.FutureOfJSAnyToJSPromise_get_toJS__closure, A.FutureOfVoidToJSPromise_get_toJS__closure, A.jsify__convert, A.promiseToFuture_closure, A.promiseToFuture_closure0, A.dartify_convert, A.StreamQueue__ensureListening_closure, A.CanonicalizedMap_keys_closure, A.BuildStatus_BuildStatus\$fromJson_closure, A.BatchedDebugEvents_toJson_closure, A.WebSocketClient_stream_closure, A.PersistentWebSocket_connect_closure, A.PersistentWebSocket__listenWithRetry_attemptRetry, A.PersistentWebSocket__listenWithRetry_closure, A.BaseRequest_closure0, A.BrowserClient_send_closure, A._readBody_closure, A._readBody_closure0, A.ByteStream_toBytes_closure, A.MediaType_toString__closure, A.expectQuotedString_closure, A.Context_joinAll_closure, A.Context_split_closure, A._validateArgList_closure, A.Pool__runOnRelease_closure, A.Highlighter\$__closure, A.Highlighter\$___closure, A.Highlighter\$__closure0, A.Highlighter__collateLines_closure, A.Highlighter__collateLines_closure1, A.Highlighter__collateLines__closure, A.Highlighter_highlight_closure, A.SseClient_closure0, A.SseClient_closure1, A._EventStreamSubscription_closure, A._EventStreamSubscription_onData_closure, A.BrowserWebSocket_connect_closure, A.BrowserWebSocket_connect_closure0, A.BrowserWebSocket_connect_closure1, A.BrowserWebSocket_connect_closure2, A.main__closure2, A.main__closure3, A.main__closure5, A.main__closure7, A.main__closure9, A.main__closure10, A.main__closure11, A._handleAuthRequest_closure, A._sendHotReloadResponse_closure, A._sendHotRestartResponse_closure, A.DdcLibraryBundleRestarter_restart_closure, A.DdcLibraryBundleRestarter_hotReloadStart_closure, A.DdcRestarter_restart_closure0, A.DdcRestarter_restart_closure, A.RequireRestarter__reloadModule_closure0, A.JSArrayExtension_toDartIterable_closure]);\n" +" _inheritMany(A.Closure2Args, [A._CastListBase_sort_closure, A.CastMap_forEach_closure, A.initHooks_closure0, A._awaitOnObject_closure0, A._wrapJsFunctionForAsync_closure, A._Future__propagateToListeners_handleWhenCompleteCallback_closure0, A._Future_timeout_closure1, A._AddStreamState_makeErrorHandler_closure, A._BufferingStreamSubscription_asFuture_closure0, A.MapBase_mapToString_closure, A._JsonStringifier_writeMap_closure, A.Uri_parseIPv6Address_error, A.FutureOfJSAnyToJSPromise_get_toJS_closure, A.FutureOfJSAnyToJSPromise_get_toJS__closure0, A.FutureOfVoidToJSPromise_get_toJS_closure, A.FutureOfVoidToJSPromise_get_toJS__closure0, A.StreamQueue__ensureListening_closure1, A.CanonicalizedMap_addAll_closure, A.CanonicalizedMap_forEach_closure, A.safeUnawaited_closure, A.BaseRequest_closure, A.MediaType_toString_closure, A.Pool__runOnRelease_closure0, A.Highlighter__collateLines_closure0, A.main__closure6, A.main_closure0]);\n" " _inherit(A.CastList, A._CastListBase);\n" " _inheritMany(A.MapBase, [A.CastMap, A.JsLinkedHashMap, A._HashMap, A._JsonMap]);\n" " _inheritMany(A.Error, [A.LateError, A.TypeError, A.JsNoSuchMethodError, A.UnknownJsTypeError, A.RuntimeError, A._Error, A.JsonUnsupportedObjectError, A.AssertionError, A.ArgumentError, A.UnsupportedError, A.UnimplementedError, A.StateError, A.ConcurrentModificationError]);\n" " _inherit(A.UnmodifiableListBase, A.ListBase);\n" " _inherit(A.CodeUnits, A.UnmodifiableListBase);\n" -" _inheritMany(A.Closure0Args, [A.nullFuture_closure, A._AsyncRun__scheduleImmediateJsOverride_internalCallback, A._AsyncRun__scheduleImmediateWithSetImmediate_internalCallback, A._TimerImpl_internalCallback, A.Future_Future\$microtask_closure, A.Future_Future\$delayed_closure, A._Future__addListener_closure, A._Future__prependListeners_closure, A._Future__chainCoreFuture_closure, A._Future__asyncCompleteWithValue_closure, A._Future__asyncCompleteErrorObject_closure, A._Future__propagateToListeners_handleWhenCompleteCallback, A._Future__propagateToListeners_handleValueCallback, A._Future__propagateToListeners_handleError, A._Future_timeout_closure, A.Stream_length_closure0, A.Stream_first_closure, A._StreamController__subscribe_closure, A._StreamController__recordCancel_complete, A._BufferingStreamSubscription_asFuture_closure, A._BufferingStreamSubscription_asFuture__closure, A._BufferingStreamSubscription__sendError_sendError, A._BufferingStreamSubscription__sendDone_sendDone, A._PendingEvents_schedule_closure, A._MultiStream_listen_closure, A._cancelAndValue_closure, A.Zone_bindCallback_closure, A.Zone_bindCallbackGuarded_closure, A._rootHandleUncaughtError_closure, A._Utf8Decoder__decoder_closure, A._Utf8Decoder__decoderNonfatal_closure, A.StreamQueue__ensureListening_closure0, A.BuildStatus_BuildStatus\$fromJson_closure0, A.BatchedStreamController__hasEventOrTimeOut_closure, A.BatchedStreamController__hasEventDuring_closure, A._readStreamBody_closure, A._readStreamBody_closure0, A.MediaType_MediaType\$parse_closure, A.Logger_Logger_closure, A.Highlighter_closure, A.Highlighter__writeFileStart_closure, A.Highlighter__writeMultilineHighlights_closure, A.Highlighter__writeMultilineHighlights_closure0, A.Highlighter__writeMultilineHighlights_closure1, A.Highlighter__writeMultilineHighlights_closure2, A.Highlighter__writeMultilineHighlights__closure, A.Highlighter__writeMultilineHighlights__closure0, A.Highlighter__writeHighlightedText_closure, A.Highlighter__writeIndicator_closure, A.Highlighter__writeIndicator_closure0, A.Highlighter__writeIndicator_closure1, A.Highlighter__writeSidebar_closure, A._Highlight_closure, A.SseClient_closure, A.SseClient__closure, A.SseClient__onOutgoingMessage_closure, A.main_closure, A.main__closure, A.main__closure0, A.main__closure1, A.main__closure4, A.main__closure8, A.DdcLibraryBundleRestarter__getSrcModuleLibraries_closure, A.RequireRestarter__reload_closure, A.RequireRestarter__reloadModule_closure, A._createScript_closure, A._createScript__closure, A._createScript__closure0, A.runMain_closure]);\n" +" _inheritMany(A.Closure0Args, [A.nullFuture_closure, A._AsyncRun__scheduleImmediateJsOverride_internalCallback, A._AsyncRun__scheduleImmediateWithSetImmediate_internalCallback, A._TimerImpl_internalCallback, A._TimerImpl\$periodic_closure, A._asyncStarHelper_closure, A._AsyncStarStreamController__resumeBody, A._AsyncStarStreamController__resumeBody_closure, A._AsyncStarStreamController_closure0, A._AsyncStarStreamController_closure1, A._AsyncStarStreamController_closure, A._AsyncStarStreamController__closure, A.Future_Future\$microtask_closure, A.Future_Future\$delayed_closure, A._Future__addListener_closure, A._Future__prependListeners_closure, A._Future__chainCoreFuture_closure, A._Future__asyncCompleteWithValue_closure, A._Future__asyncCompleteErrorObject_closure, A._Future__propagateToListeners_handleWhenCompleteCallback, A._Future__propagateToListeners_handleValueCallback, A._Future__propagateToListeners_handleError, A._Future_timeout_closure, A.Stream_length_closure0, A.Stream_first_closure, A._StreamController__subscribe_closure, A._StreamController__recordCancel_complete, A._AddStreamState_cancel_closure, A._BufferingStreamSubscription_asFuture_closure, A._BufferingStreamSubscription_asFuture__closure, A._BufferingStreamSubscription__sendError_sendError, A._BufferingStreamSubscription__sendDone_sendDone, A._PendingEvents_schedule_closure, A._cancelAndValue_closure, A._CustomZone_bindCallback_closure, A._CustomZone_bindCallbackGuarded_closure, A._RootZone_bindCallback_closure, A._RootZone_bindCallbackGuarded_closure, A._rootHandleError_closure, A._Utf8Decoder__decoder_closure, A._Utf8Decoder__decoderNonfatal_closure, A.StreamQueue__ensureListening_closure0, A.BuildStatus_BuildStatus\$fromJson_closure0, A.BatchedStreamController__hasEventOrTimeOut_closure, A.BatchedStreamController__hasEventDuring_closure, A.MediaType_MediaType\$parse_closure, A.Logger_Logger_closure, A.Highlighter_closure, A.Highlighter__writeFileStart_closure, A.Highlighter__writeMultilineHighlights_closure, A.Highlighter__writeMultilineHighlights_closure0, A.Highlighter__writeMultilineHighlights_closure1, A.Highlighter__writeMultilineHighlights_closure2, A.Highlighter__writeMultilineHighlights__closure, A.Highlighter__writeMultilineHighlights__closure0, A.Highlighter__writeHighlightedText_closure, A.Highlighter__writeIndicator_closure, A.Highlighter__writeIndicator_closure0, A.Highlighter__writeIndicator_closure1, A.Highlighter__writeSidebar_closure, A._Highlight_closure, A.SseClient_closure, A.SseClient__closure, A.SseClient__onOutgoingMessage_closure, A.main_closure, A.main__closure, A.main__closure0, A.main__closure1, A.main__closure4, A.main__closure8, A.DdcLibraryBundleRestarter__getSrcModuleLibraries_closure, A.RequireRestarter__reload_closure, A.RequireRestarter__reloadModule_closure, A._createScript_closure, A._createScript__closure, A._createScript__closure0, A.runMain_closure]);\n" " _inheritMany(A.EfficientLengthIterable, [A.ListIterable, A.EmptyIterable, A.LinkedHashMapKeysIterable, A.LinkedHashMapValuesIterable, A.LinkedHashMapEntriesIterable, A._HashMapKeyIterable]);\n" " _inheritMany(A.ListIterable, [A.SubListIterable, A.MappedListIterable, A.ReversedListIterable, A.ListQueue, A._JsonMapKeyIterable]);\n" " _inherit(A.EfficientLengthMappedIterable, A.MappedIterable);\n" @@ -21872,9 +22521,10 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _inherit(A._AsyncStreamController, A._StreamController);\n" " _inherit(A._ControllerStream, A._StreamImpl);\n" " _inheritMany(A._BufferingStreamSubscription, [A._ControllerSubscription, A._ForwardingStreamSubscription]);\n" +" _inherit(A._StreamControllerAddStreamState, A._AddStreamState);\n" " _inheritMany(A._DelayedEvent, [A._DelayedData, A._DelayedError]);\n" -" _inherit(A._MultiStreamController, A._AsyncStreamController);\n" " _inherit(A._MapStream, A._ForwardingStream);\n" +" _inheritMany(A._Zone, [A._CustomZone, A._RootZone]);\n" " _inherit(A._IdentityHashMap, A._HashMap);\n" " _inherit(A._SetBase, A.SetBase);\n" " _inherit(A._HashSet, A._SetBase);\n" @@ -21935,7 +22585,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " typeUniverse: {eC: new Map(), tR: {}, eT: {}, tPV: {}, sEA: []},\n" " mangledGlobalNames: {int: \"int\", double: \"double\", num: \"num\", String: \"String\", bool: \"bool\", Null: \"Null\", List: \"List\", Object: \"Object\", Map: \"Map\", JSObject: \"JSObject\"},\n" " mangledNames: {},\n" -" types: [\"~()\", \"Null()\", \"~(JSObject)\", \"Null(Object,StackTrace)\", \"~(@)\", \"JSObject()\", \"Future<~>()\", \"~(Object,StackTrace)\", \"Null(@)\", \"String(String)\", \"Object?(Object?)\", \"~(Object?)\", \"bool(_Highlight)\", \"Null(JSObject)\", \"~(~())\", \"int(Object?)\", \"@(@)\", \"~(Object?,Object?)\", \"@()\", \"Null(JavaScriptFunction,JavaScriptFunction)\", \"bool()\", \"Future<~>(String)\", \"String(Match)\", \"bool(String)\", \"int()\", \"Null(String)\", \"Null(JavaScriptFunction)\", \"int(@,@)\", \"bool(Object?,Object?)\", \"bool(BuildStatus)\", \"String(@)\", \"PersistentWebSocket(WebSocket)\", \"~(Zone,ZoneDelegate,Zone,Object,StackTrace)\", \"Future<~>(WebSocketEvent)\", \"bool(String,String)\", \"int(String)\", \"Null(String,String[Object?])\", \"~(MultiStreamController>)\", \"~(List)\", \"MediaType()\", \"~(String,String)\", \"bool(Object?)\", \"Logger()\", \"Null(~())\", \"String(String?)\", \"Null(~)\", \"String?()\", \"int(_Line)\", \"Null(@,StackTrace)\", \"Object(_Line)\", \"Object(_Highlight)\", \"int(_Highlight,_Highlight)\", \"~(StreamSink<@>)\", \"0&(String,int?)\", \"SourceSpanWithContext()\", \"~(int,@)\", \"~(String?)\", \"Future()\", \"~(Object[StackTrace?])\", \"@(String)\", \"JSObject(String[bool?])\", \"JSObject(Object,StackTrace)\", \"~(List)\", \"Null(String,String)\", \"~(bool)\", \"HotReloadResponse(String,bool,String?)\", \"HotRestartResponse(String,bool,String?)\", \"Object?(~)\", \"bool(bool)\", \"List(String)\", \"int(String,String)\", \"Null(JavaScriptObject)\", \"JSObject()()\", \"@(@,String)\", \"0&()\", \"Map(DebugEvent)\", \"~(@,StackTrace)\", \"0^(0^,0^)\", \"List<_Line>(MapEntry>)\"],\n" +" types: [\"~()\", \"Null()\", \"~(JSObject)\", \"Null(Object,StackTrace)\", \"Null(@)\", \"~(@)\", \"~(Object,StackTrace)\", \"JSObject()\", \"~(Object?)\", \"Future<~>()\", \"String(String)\", \"Object?(Object?)\", \"bool(_Highlight)\", \"Null(JSObject)\", \"~(~())\", \"int(Object?)\", \"@(@)\", \"~(Object?,Object?)\", \"@()\", \"Null(JavaScriptFunction,JavaScriptFunction)\", \"bool()\", \"Future<~>(String)\", \"String(Match)\", \"bool(String)\", \"int()\", \"Null(String)\", \"Null(JavaScriptFunction)\", \"int(@,@)\", \"bool(Object?,Object?)\", \"String(@)\", \"@(String)\", \"@(@,String)\", \"PersistentWebSocket(WebSocket)\", \"~(@,StackTrace)\", \"Future<~>(WebSocketEvent)\", \"bool(String,String)\", \"int(String)\", \"Null(String,String[Object?])\", \"bool(Object)\", \"~(List)\", \"MediaType()\", \"~(String,String)\", \"~(Zone,ZoneDelegate,Zone,Object,StackTrace)\", \"Logger()\", \"bool(Object?)\", \"String(String?)\", \"Null(~)\", \"String?()\", \"int(_Line)\", \"Null(~())\", \"Object(_Line)\", \"Object(_Highlight)\", \"int(_Highlight,_Highlight)\", \"List<_Line>(MapEntry>)\", \"Null(@,StackTrace)\", \"SourceSpanWithContext()\", \"0&(String,int?)\", \"~(String?)\", \"Future()\", \"~(int,@)\", \"_Future<@>?()\", \"~(StreamSink<@>)\", \"~(Object[StackTrace?])\", \"~(List)\", \"Null(String,String)\", \"~(bool)\", \"HotReloadResponse(String,bool,String?)\", \"HotRestartResponse(String,bool,String?)\", \"JSObject(Object,StackTrace)\", \"bool(bool)\", \"List(String)\", \"int(String,String)\", \"Null(JavaScriptObject)\", \"JSObject()()\", \"Object?(~)\", \"bool(BuildStatus)\", \"~(Zone?,ZoneDelegate?,Zone,Object,StackTrace)\", \"0^(Zone?,ZoneDelegate?,Zone,0^())\", \"0^(Zone?,ZoneDelegate?,Zone,0^(1^),1^)\", \"0^(Zone?,ZoneDelegate?,Zone,0^(1^,2^),1^,2^)\", \"0^()(Zone,ZoneDelegate,Zone,0^())\", \"0^(1^)(Zone,ZoneDelegate,Zone,0^(1^))\", \"0^(1^,2^)(Zone,ZoneDelegate,Zone,0^(1^,2^))\", \"AsyncError?(Zone,ZoneDelegate,Zone,Object,StackTrace?)\", \"~(Zone?,ZoneDelegate?,Zone,~())\", \"Timer(Zone,ZoneDelegate,Zone,Duration,~())\", \"Timer(Zone,ZoneDelegate,Zone,Duration,~(Timer))\", \"~(Zone,ZoneDelegate,Zone,String)\", \"Zone(Zone?,ZoneDelegate?,Zone,ZoneSpecification?,Map?)\", \"0&()\", \"Map(DebugEvent)\", \"0^(0^,0^)\", \"JSObject(String[bool?])\"],\n" " interceptorsByTag: null,\n" " leafTags: null,\n" " arrayRti: Symbol(\"\$ti\"),\n" @@ -21943,7 +22593,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " \"2;\": (t1, t2) => o => o instanceof A._Record_2 && t1._is(o._0) && t2._is(o._1)\n" " }\n" " };\n" -" A._Universe_addRules(init.typeUniverse, JSON.parse('{\"JavaScriptFunction\":\"LegacyJavaScriptObject\",\"PlainJavaScriptObject\":\"LegacyJavaScriptObject\",\"UnknownJavaScriptObject\":\"LegacyJavaScriptObject\",\"NativeSharedArrayBuffer\":\"NativeByteBuffer\",\"JavaScriptObject\":{\"JSObject\":[]},\"JSArray\":{\"List\":[\"1\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"1\"],\"JSObject\":[],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"JSBool\":{\"bool\":[],\"TrustedGetRuntimeType\":[]},\"JSNull\":{\"Null\":[],\"TrustedGetRuntimeType\":[]},\"LegacyJavaScriptObject\":{\"JavaScriptObject\":[],\"JSObject\":[]},\"JSArraySafeToStringHook\":{\"SafeToStringHook\":[]},\"JSUnmodifiableArray\":{\"JSArray\":[\"1\"],\"List\":[\"1\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"1\"],\"JSObject\":[],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"ArrayIterator\":{\"Iterator\":[\"1\"]},\"JSNumber\":{\"double\":[],\"num\":[],\"Comparable\":[\"num\"]},\"JSInt\":{\"double\":[],\"int\":[],\"num\":[],\"Comparable\":[\"num\"],\"TrustedGetRuntimeType\":[]},\"JSNumNotInt\":{\"double\":[],\"num\":[],\"Comparable\":[\"num\"],\"TrustedGetRuntimeType\":[]},\"JSString\":{\"String\":[],\"Comparable\":[\"String\"],\"Pattern\":[],\"TrustedGetRuntimeType\":[]},\"CastStream\":{\"Stream\":[\"2\"],\"Stream.T\":\"2\"},\"CastStreamSubscription\":{\"StreamSubscription\":[\"2\"]},\"_CastIterableBase\":{\"Iterable\":[\"2\"]},\"CastIterator\":{\"Iterator\":[\"2\"]},\"CastIterable\":{\"_CastIterableBase\":[\"1\",\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"_EfficientLengthCastIterable\":{\"CastIterable\":[\"1\",\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"_CastListBase\":{\"ListBase\":[\"2\"],\"List\":[\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"]},\"CastList\":{\"_CastListBase\":[\"1\",\"2\"],\"ListBase\":[\"2\"],\"List\":[\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListBase.E\":\"2\",\"Iterable.E\":\"2\"},\"CastMap\":{\"MapBase\":[\"3\",\"4\"],\"Map\":[\"3\",\"4\"],\"MapBase.K\":\"3\",\"MapBase.V\":\"4\"},\"LateError\":{\"Error\":[]},\"CodeUnits\":{\"ListBase\":[\"int\"],\"UnmodifiableListMixin\":[\"int\"],\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"UnmodifiableListMixin.E\":\"int\"},\"EfficientLengthIterable\":{\"Iterable\":[\"1\"]},\"ListIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"SubListIterable\":{\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"ListIterator\":{\"Iterator\":[\"1\"]},\"MappedIterable\":{\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"EfficientLengthMappedIterable\":{\"MappedIterable\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"MappedIterator\":{\"Iterator\":[\"2\"]},\"MappedListIterable\":{\"ListIterable\":[\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListIterable.E\":\"2\",\"Iterable.E\":\"2\"},\"WhereIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"WhereIterator\":{\"Iterator\":[\"1\"]},\"ExpandIterable\":{\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"ExpandIterator\":{\"Iterator\":[\"2\"]},\"TakeIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EfficientLengthTakeIterable\":{\"TakeIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"TakeIterator\":{\"Iterator\":[\"1\"]},\"SkipIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EfficientLengthSkipIterable\":{\"SkipIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"SkipIterator\":{\"Iterator\":[\"1\"]},\"EmptyIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EmptyIterator\":{\"Iterator\":[\"1\"]},\"WhereTypeIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"WhereTypeIterator\":{\"Iterator\":[\"1\"]},\"UnmodifiableListBase\":{\"ListBase\":[\"1\"],\"UnmodifiableListMixin\":[\"1\"],\"List\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"ReversedListIterable\":{\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"_Record_2\":{\"_Record2\":[],\"_Record\":[]},\"ConstantMap\":{\"Map\":[\"1\",\"2\"]},\"ConstantStringMap\":{\"ConstantMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"]},\"_KeysOrValues\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_KeysOrValuesOrElementsIterator\":{\"Iterator\":[\"1\"]},\"Instantiation\":{\"Closure\":[],\"Function\":[]},\"Instantiation1\":{\"Closure\":[],\"Function\":[]},\"NullError\":{\"TypeError\":[],\"Error\":[]},\"JsNoSuchMethodError\":{\"Error\":[]},\"UnknownJsTypeError\":{\"Error\":[]},\"NullThrownFromJavaScriptException\":{\"Exception\":[]},\"_StackTrace\":{\"StackTrace\":[]},\"Closure\":{\"Function\":[]},\"Closure0Args\":{\"Closure\":[],\"Function\":[]},\"Closure2Args\":{\"Closure\":[],\"Function\":[]},\"TearOffClosure\":{\"Closure\":[],\"Function\":[]},\"StaticClosure\":{\"Closure\":[],\"Function\":[]},\"BoundClosure\":{\"Closure\":[],\"Function\":[]},\"RuntimeError\":{\"Error\":[]},\"JsLinkedHashMap\":{\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"LinkedHashMapKeysIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"LinkedHashMapKeyIterator\":{\"Iterator\":[\"1\"]},\"LinkedHashMapValuesIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"LinkedHashMapValueIterator\":{\"Iterator\":[\"1\"]},\"LinkedHashMapEntriesIterable\":{\"EfficientLengthIterable\":[\"MapEntry<1,2>\"],\"Iterable\":[\"MapEntry<1,2>\"],\"Iterable.E\":\"MapEntry<1,2>\"},\"LinkedHashMapEntryIterator\":{\"Iterator\":[\"MapEntry<1,2>\"]},\"JsIdentityLinkedHashMap\":{\"JsLinkedHashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_Record2\":{\"_Record\":[]},\"JSSyntaxRegExp\":{\"RegExp\":[],\"Pattern\":[]},\"_MatchImplementation\":{\"RegExpMatch\":[],\"Match\":[]},\"_AllMatchesIterable\":{\"Iterable\":[\"RegExpMatch\"],\"Iterable.E\":\"RegExpMatch\"},\"_AllMatchesIterator\":{\"Iterator\":[\"RegExpMatch\"]},\"StringMatch\":{\"Match\":[]},\"_StringAllMatchesIterable\":{\"Iterable\":[\"Match\"],\"Iterable.E\":\"Match\"},\"_StringAllMatchesIterator\":{\"Iterator\":[\"Match\"]},\"NativeByteBuffer\":{\"JavaScriptObject\":[],\"JSObject\":[],\"ByteBuffer\":[],\"TrustedGetRuntimeType\":[]},\"NativeArrayBuffer\":{\"NativeByteBuffer\":[],\"JavaScriptObject\":[],\"JSObject\":[],\"ByteBuffer\":[],\"TrustedGetRuntimeType\":[]},\"NativeTypedData\":{\"JavaScriptObject\":[],\"JSObject\":[]},\"_UnmodifiableNativeByteBufferView\":{\"ByteBuffer\":[]},\"NativeByteData\":{\"JavaScriptObject\":[],\"ByteData\":[],\"JSObject\":[],\"TrustedGetRuntimeType\":[]},\"NativeTypedArray\":{\"JavaScriptIndexingBehavior\":[\"1\"],\"JavaScriptObject\":[],\"JSObject\":[]},\"NativeTypedArrayOfDouble\":{\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"]},\"NativeTypedArrayOfInt\":{\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"]},\"NativeFloat32List\":{\"Float32List\":[],\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"double\",\"Iterable.E\":\"double\",\"FixedLengthListMixin.E\":\"double\"},\"NativeFloat64List\":{\"Float64List\":[],\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"double\",\"Iterable.E\":\"double\",\"FixedLengthListMixin.E\":\"double\"},\"NativeInt16List\":{\"NativeTypedArrayOfInt\":[],\"Int16List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeInt32List\":{\"NativeTypedArrayOfInt\":[],\"Int32List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeInt8List\":{\"NativeTypedArrayOfInt\":[],\"Int8List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint16List\":{\"NativeTypedArrayOfInt\":[],\"Uint16List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint32List\":{\"NativeTypedArrayOfInt\":[],\"Uint32List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint8ClampedList\":{\"NativeTypedArrayOfInt\":[],\"Uint8ClampedList\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint8List\":{\"NativeTypedArrayOfInt\":[],\"Uint8List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"_Error\":{\"Error\":[]},\"_TypeError\":{\"TypeError\":[],\"Error\":[]},\"AsyncError\":{\"Error\":[]},\"MultiStreamController\":{\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"]},\"_TimerImpl\":{\"Timer\":[]},\"_AsyncAwaitCompleter\":{\"Completer\":[\"1\"]},\"_Completer\":{\"Completer\":[\"1\"]},\"_AsyncCompleter\":{\"_Completer\":[\"1\"],\"Completer\":[\"1\"]},\"_SyncCompleter\":{\"_Completer\":[\"1\"],\"Completer\":[\"1\"]},\"_Future\":{\"Future\":[\"1\"]},\"StreamView\":{\"Stream\":[\"1\"]},\"_StreamController\":{\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"],\"_StreamControllerLifecycle\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"]},\"_AsyncStreamController\":{\"_AsyncStreamControllerDispatch\":[\"1\"],\"_StreamController\":[\"1\"],\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"],\"_StreamControllerLifecycle\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"]},\"_ControllerStream\":{\"_StreamImpl\":[\"1\"],\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_ControllerSubscription\":{\"_BufferingStreamSubscription\":[\"1\"],\"StreamSubscription\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"],\"_BufferingStreamSubscription.T\":\"1\"},\"_StreamSinkWrapper\":{\"StreamSink\":[\"1\"]},\"_BufferingStreamSubscription\":{\"StreamSubscription\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"],\"_BufferingStreamSubscription.T\":\"1\"},\"_StreamImpl\":{\"Stream\":[\"1\"]},\"_DelayedData\":{\"_DelayedEvent\":[\"1\"]},\"_DelayedError\":{\"_DelayedEvent\":[\"@\"]},\"_DelayedDone\":{\"_DelayedEvent\":[\"@\"]},\"_DoneStreamSubscription\":{\"StreamSubscription\":[\"1\"]},\"_EmptyStream\":{\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_MultiStream\":{\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_MultiStreamController\":{\"_AsyncStreamController\":[\"1\"],\"_AsyncStreamControllerDispatch\":[\"1\"],\"_StreamController\":[\"1\"],\"MultiStreamController\":[\"1\"],\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"],\"_StreamControllerLifecycle\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"]},\"_ForwardingStream\":{\"Stream\":[\"2\"]},\"_ForwardingStreamSubscription\":{\"_BufferingStreamSubscription\":[\"2\"],\"StreamSubscription\":[\"2\"],\"_EventSink\":[\"2\"],\"_EventDispatch\":[\"2\"],\"_BufferingStreamSubscription.T\":\"2\"},\"_MapStream\":{\"_ForwardingStream\":[\"1\",\"2\"],\"Stream\":[\"2\"],\"Stream.T\":\"2\"},\"_SplayTreeSetNode\":{\"_SplayTreeNode\":[\"1\",\"_SplayTreeSetNode<1>\"],\"_SplayTreeNode.K\":\"1\",\"_SplayTreeNode.1\":\"_SplayTreeSetNode<1>\"},\"_HashMap\":{\"MapBase\":[\"1\",\"2\"],\"HashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_IdentityHashMap\":{\"_HashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"HashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_HashMapKeyIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_HashMapKeyIterator\":{\"Iterator\":[\"1\"]},\"_LinkedCustomHashMap\":{\"JsLinkedHashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_HashSet\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_HashSetIterator\":{\"Iterator\":[\"1\"]},\"ListBase\":{\"List\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"MapBase\":{\"Map\":[\"1\",\"2\"]},\"MapView\":{\"Map\":[\"1\",\"2\"]},\"UnmodifiableMapView\":{\"_UnmodifiableMapView_MapView__UnmodifiableMapMixin\":[\"1\",\"2\"],\"MapView\":[\"1\",\"2\"],\"_UnmodifiableMapMixin\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"]},\"ListQueue\":{\"Queue\":[\"1\"],\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"_ListQueueIterator\":{\"Iterator\":[\"1\"]},\"SetBase\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"_SetBase\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"_SplayTreeIterator\":{\"Iterator\":[\"3\"]},\"_SplayTreeKeyIterator\":{\"_SplayTreeIterator\":[\"1\",\"2\",\"1\"],\"Iterator\":[\"1\"],\"_SplayTreeIterator.K\":\"1\",\"_SplayTreeIterator.T\":\"1\",\"_SplayTreeIterator.1\":\"2\"},\"SplayTreeSet\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"_SplayTree\":[\"1\",\"_SplayTreeSetNode<1>\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\",\"_SplayTree.1\":\"_SplayTreeSetNode<1>\",\"_SplayTree.K\":\"1\"},\"Encoding\":{\"Codec\":[\"String\",\"List\"]},\"_JsonMap\":{\"MapBase\":[\"String\",\"@\"],\"Map\":[\"String\",\"@\"],\"MapBase.K\":\"String\",\"MapBase.V\":\"@\"},\"_JsonMapKeyIterable\":{\"ListIterable\":[\"String\"],\"EfficientLengthIterable\":[\"String\"],\"Iterable\":[\"String\"],\"ListIterable.E\":\"String\",\"Iterable.E\":\"String\"},\"AsciiCodec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"_UnicodeSubsetEncoder\":{\"Converter\":[\"String\",\"List\"]},\"AsciiEncoder\":{\"Converter\":[\"String\",\"List\"]},\"_UnicodeSubsetDecoder\":{\"Converter\":[\"List\",\"String\"]},\"AsciiDecoder\":{\"Converter\":[\"List\",\"String\"]},\"Base64Codec\":{\"Codec\":[\"List\",\"String\"]},\"Base64Encoder\":{\"Converter\":[\"List\",\"String\"]},\"JsonUnsupportedObjectError\":{\"Error\":[]},\"JsonCyclicError\":{\"Error\":[]},\"JsonCodec\":{\"Codec\":[\"Object?\",\"String\"]},\"JsonEncoder\":{\"Converter\":[\"Object?\",\"String\"]},\"JsonDecoder\":{\"Converter\":[\"String\",\"Object?\"]},\"Latin1Codec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"Latin1Encoder\":{\"Converter\":[\"String\",\"List\"]},\"Latin1Decoder\":{\"Converter\":[\"List\",\"String\"]},\"Utf8Codec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"Utf8Encoder\":{\"Converter\":[\"String\",\"List\"]},\"Utf8Decoder\":{\"Converter\":[\"List\",\"String\"]},\"DateTime\":{\"Comparable\":[\"DateTime\"]},\"double\":{\"num\":[],\"Comparable\":[\"num\"]},\"Duration\":{\"Comparable\":[\"Duration\"]},\"int\":{\"num\":[],\"Comparable\":[\"num\"]},\"List\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"num\":{\"Comparable\":[\"num\"]},\"RegExpMatch\":{\"Match\":[]},\"String\":{\"Comparable\":[\"String\"],\"Pattern\":[]},\"AssertionError\":{\"Error\":[]},\"TypeError\":{\"Error\":[]},\"ArgumentError\":{\"Error\":[]},\"RangeError\":{\"Error\":[]},\"IndexError\":{\"Error\":[]},\"UnsupportedError\":{\"Error\":[]},\"UnimplementedError\":{\"Error\":[]},\"StateError\":{\"Error\":[]},\"ConcurrentModificationError\":{\"Error\":[]},\"OutOfMemoryError\":{\"Error\":[]},\"StackOverflowError\":{\"Error\":[]},\"_Exception\":{\"Exception\":[]},\"FormatException\":{\"Exception\":[]},\"_StringStackTrace\":{\"StackTrace\":[]},\"StringBuffer\":{\"StringSink\":[]},\"_Uri\":{\"Uri\":[]},\"_SimpleUri\":{\"Uri\":[]},\"_DataUri\":{\"Uri\":[]},\"NullRejectionException\":{\"Exception\":[]},\"ErrorResult\":{\"Result\":[\"0&\"]},\"ValueResult\":{\"Result\":[\"1\"]},\"_NextRequest\":{\"_EventRequest\":[\"1\"]},\"_HasNextRequest\":{\"_EventRequest\":[\"1\"]},\"CanonicalizedMap\":{\"Map\":[\"2\",\"3\"]},\"QueueList\":{\"ListBase\":[\"1\"],\"List\":[\"1\"],\"Queue\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListBase.E\":\"1\",\"QueueList.E\":\"1\",\"Iterable.E\":\"1\"},\"_CastQueueList\":{\"QueueList\":[\"2\"],\"ListBase\":[\"2\"],\"List\":[\"2\"],\"Queue\":[\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListBase.E\":\"2\",\"QueueList.E\":\"2\",\"Iterable.E\":\"2\"},\"PersistentWebSocket\":{\"StreamChannelMixin\":[\"@\"]},\"SseSocketClient\":{\"SocketClient\":[]},\"WebSocketClient\":{\"SocketClient\":[]},\"RequestAbortedException\":{\"Exception\":[]},\"ByteStream\":{\"StreamView\":[\"List\"],\"Stream\":[\"List\"],\"Stream.T\":\"List\",\"StreamView.T\":\"List\"},\"ClientException\":{\"Exception\":[]},\"Request\":{\"BaseRequest\":[]},\"StreamedResponseV2\":{\"StreamedResponse\":[]},\"CaseInsensitiveMap\":{\"CanonicalizedMap\":[\"String\",\"String\",\"1\"],\"Map\":[\"String\",\"1\"],\"CanonicalizedMap.K\":\"String\",\"CanonicalizedMap.V\":\"1\",\"CanonicalizedMap.C\":\"String\"},\"Level\":{\"Comparable\":[\"Level\"]},\"PathException\":{\"Exception\":[]},\"PosixStyle\":{\"InternalStyle\":[]},\"UrlStyle\":{\"InternalStyle\":[]},\"WindowsStyle\":{\"InternalStyle\":[]},\"FileLocation\":{\"SourceLocation\":[],\"Comparable\":[\"SourceLocation\"]},\"_FileSpan\":{\"SourceSpanWithContext\":[],\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceLocation\":{\"Comparable\":[\"SourceLocation\"]},\"SourceLocationMixin\":{\"SourceLocation\":[],\"Comparable\":[\"SourceLocation\"]},\"SourceSpan\":{\"Comparable\":[\"SourceSpan\"]},\"SourceSpanBase\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceSpanException\":{\"Exception\":[]},\"SourceSpanFormatException\":{\"FormatException\":[],\"Exception\":[]},\"SourceSpanMixin\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceSpanWithContext\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SseClient\":{\"StreamChannelMixin\":[\"String?\"]},\"StringScannerException\":{\"FormatException\":[],\"Exception\":[]},\"_EventStream\":{\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_EventStreamSubscription\":{\"StreamSubscription\":[\"1\"]},\"BrowserWebSocket\":{\"WebSocket\":[]},\"TextDataReceived\":{\"WebSocketEvent\":[]},\"BinaryDataReceived\":{\"WebSocketEvent\":[]},\"CloseReceived\":{\"WebSocketEvent\":[]},\"WebSocketException\":{\"Exception\":[]},\"WebSocketConnectionClosed\":{\"Exception\":[]},\"DdcLibraryBundleRestarter\":{\"TwoPhaseRestarter\":[],\"Restarter\":[]},\"DdcRestarter\":{\"Restarter\":[]},\"RequireRestarter\":{\"Restarter\":[]},\"HotReloadFailedException\":{\"Exception\":[]},\"Int8List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint8List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint8ClampedList\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Int16List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint16List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Int32List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint32List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Float32List\":{\"List\":[\"double\"],\"EfficientLengthIterable\":[\"double\"],\"Iterable\":[\"double\"]},\"Float64List\":{\"List\":[\"double\"],\"EfficientLengthIterable\":[\"double\"],\"Iterable\":[\"double\"]}}'));\n" +" A._Universe_addRules(init.typeUniverse, JSON.parse('{\"JavaScriptFunction\":\"LegacyJavaScriptObject\",\"PlainJavaScriptObject\":\"LegacyJavaScriptObject\",\"UnknownJavaScriptObject\":\"LegacyJavaScriptObject\",\"NativeSharedArrayBuffer\":\"NativeByteBuffer\",\"JavaScriptObject\":{\"JSObject\":[]},\"JSArray\":{\"List\":[\"1\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"1\"],\"JSObject\":[],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"JSBool\":{\"bool\":[],\"TrustedGetRuntimeType\":[]},\"JSNull\":{\"Null\":[],\"TrustedGetRuntimeType\":[]},\"LegacyJavaScriptObject\":{\"JavaScriptObject\":[],\"JSObject\":[]},\"JSArraySafeToStringHook\":{\"SafeToStringHook\":[]},\"JSUnmodifiableArray\":{\"JSArray\":[\"1\"],\"List\":[\"1\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"1\"],\"JSObject\":[],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"ArrayIterator\":{\"Iterator\":[\"1\"]},\"JSNumber\":{\"double\":[],\"num\":[],\"Comparable\":[\"num\"]},\"JSInt\":{\"double\":[],\"int\":[],\"num\":[],\"Comparable\":[\"num\"],\"TrustedGetRuntimeType\":[]},\"JSNumNotInt\":{\"double\":[],\"num\":[],\"Comparable\":[\"num\"],\"TrustedGetRuntimeType\":[]},\"JSString\":{\"String\":[],\"Comparable\":[\"String\"],\"Pattern\":[],\"TrustedGetRuntimeType\":[]},\"CastStream\":{\"Stream\":[\"2\"],\"Stream.T\":\"2\"},\"CastStreamSubscription\":{\"StreamSubscription\":[\"2\"]},\"_CastIterableBase\":{\"Iterable\":[\"2\"]},\"CastIterator\":{\"Iterator\":[\"2\"]},\"CastIterable\":{\"_CastIterableBase\":[\"1\",\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"_EfficientLengthCastIterable\":{\"CastIterable\":[\"1\",\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"_CastListBase\":{\"ListBase\":[\"2\"],\"List\":[\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"]},\"CastList\":{\"_CastListBase\":[\"1\",\"2\"],\"ListBase\":[\"2\"],\"List\":[\"2\"],\"_CastIterableBase\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListBase.E\":\"2\",\"Iterable.E\":\"2\"},\"CastMap\":{\"MapBase\":[\"3\",\"4\"],\"Map\":[\"3\",\"4\"],\"MapBase.K\":\"3\",\"MapBase.V\":\"4\"},\"LateError\":{\"Error\":[]},\"CodeUnits\":{\"ListBase\":[\"int\"],\"UnmodifiableListMixin\":[\"int\"],\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"UnmodifiableListMixin.E\":\"int\"},\"EfficientLengthIterable\":{\"Iterable\":[\"1\"]},\"ListIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"SubListIterable\":{\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"ListIterator\":{\"Iterator\":[\"1\"]},\"MappedIterable\":{\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"EfficientLengthMappedIterable\":{\"MappedIterable\":[\"1\",\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"MappedIterator\":{\"Iterator\":[\"2\"]},\"MappedListIterable\":{\"ListIterable\":[\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListIterable.E\":\"2\",\"Iterable.E\":\"2\"},\"WhereIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"WhereIterator\":{\"Iterator\":[\"1\"]},\"ExpandIterable\":{\"Iterable\":[\"2\"],\"Iterable.E\":\"2\"},\"ExpandIterator\":{\"Iterator\":[\"2\"]},\"TakeIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EfficientLengthTakeIterable\":{\"TakeIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"TakeIterator\":{\"Iterator\":[\"1\"]},\"SkipIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EfficientLengthSkipIterable\":{\"SkipIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"SkipIterator\":{\"Iterator\":[\"1\"]},\"EmptyIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"EmptyIterator\":{\"Iterator\":[\"1\"]},\"WhereTypeIterable\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"WhereTypeIterator\":{\"Iterator\":[\"1\"]},\"UnmodifiableListBase\":{\"ListBase\":[\"1\"],\"UnmodifiableListMixin\":[\"1\"],\"List\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"ReversedListIterable\":{\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"_Record_2\":{\"_Record2\":[],\"_Record\":[]},\"ConstantMap\":{\"Map\":[\"1\",\"2\"]},\"ConstantStringMap\":{\"ConstantMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"]},\"_KeysOrValues\":{\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_KeysOrValuesOrElementsIterator\":{\"Iterator\":[\"1\"]},\"Instantiation\":{\"Closure\":[],\"Function\":[]},\"Instantiation1\":{\"Closure\":[],\"Function\":[]},\"NullError\":{\"TypeError\":[],\"Error\":[]},\"JsNoSuchMethodError\":{\"Error\":[]},\"UnknownJsTypeError\":{\"Error\":[]},\"NullThrownFromJavaScriptException\":{\"Exception\":[]},\"_StackTrace\":{\"StackTrace\":[]},\"Closure\":{\"Function\":[]},\"Closure0Args\":{\"Closure\":[],\"Function\":[]},\"Closure2Args\":{\"Closure\":[],\"Function\":[]},\"TearOffClosure\":{\"Closure\":[],\"Function\":[]},\"StaticClosure\":{\"Closure\":[],\"Function\":[]},\"BoundClosure\":{\"Closure\":[],\"Function\":[]},\"RuntimeError\":{\"Error\":[]},\"JsLinkedHashMap\":{\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"LinkedHashMapKeysIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"LinkedHashMapKeyIterator\":{\"Iterator\":[\"1\"]},\"LinkedHashMapValuesIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"LinkedHashMapValueIterator\":{\"Iterator\":[\"1\"]},\"LinkedHashMapEntriesIterable\":{\"EfficientLengthIterable\":[\"MapEntry<1,2>\"],\"Iterable\":[\"MapEntry<1,2>\"],\"Iterable.E\":\"MapEntry<1,2>\"},\"LinkedHashMapEntryIterator\":{\"Iterator\":[\"MapEntry<1,2>\"]},\"JsIdentityLinkedHashMap\":{\"JsLinkedHashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_Record2\":{\"_Record\":[]},\"JSSyntaxRegExp\":{\"RegExp\":[],\"Pattern\":[]},\"_MatchImplementation\":{\"RegExpMatch\":[],\"Match\":[]},\"_AllMatchesIterable\":{\"Iterable\":[\"RegExpMatch\"],\"Iterable.E\":\"RegExpMatch\"},\"_AllMatchesIterator\":{\"Iterator\":[\"RegExpMatch\"]},\"StringMatch\":{\"Match\":[]},\"_StringAllMatchesIterable\":{\"Iterable\":[\"Match\"],\"Iterable.E\":\"Match\"},\"_StringAllMatchesIterator\":{\"Iterator\":[\"Match\"]},\"NativeByteBuffer\":{\"JavaScriptObject\":[],\"JSObject\":[],\"ByteBuffer\":[],\"TrustedGetRuntimeType\":[]},\"NativeArrayBuffer\":{\"NativeByteBuffer\":[],\"JavaScriptObject\":[],\"JSObject\":[],\"ByteBuffer\":[],\"TrustedGetRuntimeType\":[]},\"NativeTypedData\":{\"JavaScriptObject\":[],\"JSObject\":[]},\"_UnmodifiableNativeByteBufferView\":{\"ByteBuffer\":[]},\"NativeByteData\":{\"JavaScriptObject\":[],\"ByteData\":[],\"JSObject\":[],\"TrustedGetRuntimeType\":[]},\"NativeTypedArray\":{\"JavaScriptIndexingBehavior\":[\"1\"],\"JavaScriptObject\":[],\"JSObject\":[]},\"NativeTypedArrayOfDouble\":{\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"]},\"NativeTypedArrayOfInt\":{\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"]},\"NativeFloat32List\":{\"Float32List\":[],\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"double\",\"Iterable.E\":\"double\",\"FixedLengthListMixin.E\":\"double\"},\"NativeFloat64List\":{\"Float64List\":[],\"ListBase\":[\"double\"],\"NativeTypedArray\":[\"double\"],\"List\":[\"double\"],\"JavaScriptIndexingBehavior\":[\"double\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"double\"],\"JSObject\":[],\"Iterable\":[\"double\"],\"FixedLengthListMixin\":[\"double\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"double\",\"Iterable.E\":\"double\",\"FixedLengthListMixin.E\":\"double\"},\"NativeInt16List\":{\"NativeTypedArrayOfInt\":[],\"Int16List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeInt32List\":{\"NativeTypedArrayOfInt\":[],\"Int32List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeInt8List\":{\"NativeTypedArrayOfInt\":[],\"Int8List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint16List\":{\"NativeTypedArrayOfInt\":[],\"Uint16List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint32List\":{\"NativeTypedArrayOfInt\":[],\"Uint32List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint8ClampedList\":{\"NativeTypedArrayOfInt\":[],\"Uint8ClampedList\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"NativeUint8List\":{\"NativeTypedArrayOfInt\":[],\"Uint8List\":[],\"ListBase\":[\"int\"],\"NativeTypedArray\":[\"int\"],\"List\":[\"int\"],\"JavaScriptIndexingBehavior\":[\"int\"],\"JavaScriptObject\":[],\"EfficientLengthIterable\":[\"int\"],\"JSObject\":[],\"Iterable\":[\"int\"],\"FixedLengthListMixin\":[\"int\"],\"TrustedGetRuntimeType\":[],\"ListBase.E\":\"int\",\"Iterable.E\":\"int\",\"FixedLengthListMixin.E\":\"int\"},\"_Error\":{\"Error\":[]},\"_TypeError\":{\"TypeError\":[],\"Error\":[]},\"AsyncError\":{\"Error\":[]},\"_Future\":{\"Future\":[\"1\"]},\"_TimerImpl\":{\"Timer\":[]},\"_AsyncAwaitCompleter\":{\"Completer\":[\"1\"]},\"_Completer\":{\"Completer\":[\"1\"]},\"_AsyncCompleter\":{\"_Completer\":[\"1\"],\"Completer\":[\"1\"]},\"_SyncCompleter\":{\"_Completer\":[\"1\"],\"Completer\":[\"1\"]},\"StreamView\":{\"Stream\":[\"1\"]},\"_StreamController\":{\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"],\"_StreamControllerLifecycle\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"]},\"_AsyncStreamController\":{\"_AsyncStreamControllerDispatch\":[\"1\"],\"_StreamController\":[\"1\"],\"StreamController\":[\"1\"],\"StreamSink\":[\"1\"],\"_StreamControllerLifecycle\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"]},\"_ControllerStream\":{\"_StreamImpl\":[\"1\"],\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_ControllerSubscription\":{\"_BufferingStreamSubscription\":[\"1\"],\"StreamSubscription\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"],\"_BufferingStreamSubscription.T\":\"1\"},\"_StreamSinkWrapper\":{\"StreamSink\":[\"1\"]},\"_StreamControllerAddStreamState\":{\"_AddStreamState\":[\"1\"]},\"_BufferingStreamSubscription\":{\"StreamSubscription\":[\"1\"],\"_EventSink\":[\"1\"],\"_EventDispatch\":[\"1\"],\"_BufferingStreamSubscription.T\":\"1\"},\"_StreamImpl\":{\"Stream\":[\"1\"]},\"_DelayedData\":{\"_DelayedEvent\":[\"1\"]},\"_DelayedError\":{\"_DelayedEvent\":[\"@\"]},\"_DelayedDone\":{\"_DelayedEvent\":[\"@\"]},\"_DoneStreamSubscription\":{\"StreamSubscription\":[\"1\"]},\"_EmptyStream\":{\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_ForwardingStream\":{\"Stream\":[\"2\"]},\"_ForwardingStreamSubscription\":{\"_BufferingStreamSubscription\":[\"2\"],\"StreamSubscription\":[\"2\"],\"_EventSink\":[\"2\"],\"_EventDispatch\":[\"2\"],\"_BufferingStreamSubscription.T\":\"2\"},\"_MapStream\":{\"_ForwardingStream\":[\"1\",\"2\"],\"Stream\":[\"2\"],\"Stream.T\":\"2\"},\"_Zone\":{\"Zone\":[]},\"_CustomZone\":{\"_Zone\":[],\"Zone\":[]},\"_RootZone\":{\"_Zone\":[],\"Zone\":[]},\"_ZoneDelegate\":{\"ZoneDelegate\":[]},\"_SplayTreeSetNode\":{\"_SplayTreeNode\":[\"1\",\"_SplayTreeSetNode<1>\"],\"_SplayTreeNode.K\":\"1\",\"_SplayTreeNode.1\":\"_SplayTreeSetNode<1>\"},\"_HashMap\":{\"MapBase\":[\"1\",\"2\"],\"HashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_IdentityHashMap\":{\"_HashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"HashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_HashMapKeyIterable\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_HashMapKeyIterator\":{\"Iterator\":[\"1\"]},\"_LinkedCustomHashMap\":{\"JsLinkedHashMap\":[\"1\",\"2\"],\"MapBase\":[\"1\",\"2\"],\"LinkedHashMap\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"],\"MapBase.K\":\"1\",\"MapBase.V\":\"2\"},\"_HashSet\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\"},\"_HashSetIterator\":{\"Iterator\":[\"1\"]},\"ListBase\":{\"List\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"MapBase\":{\"Map\":[\"1\",\"2\"]},\"MapView\":{\"Map\":[\"1\",\"2\"]},\"UnmodifiableMapView\":{\"_UnmodifiableMapView_MapView__UnmodifiableMapMixin\":[\"1\",\"2\"],\"MapView\":[\"1\",\"2\"],\"_UnmodifiableMapMixin\":[\"1\",\"2\"],\"Map\":[\"1\",\"2\"]},\"ListQueue\":{\"Queue\":[\"1\"],\"ListIterable\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListIterable.E\":\"1\",\"Iterable.E\":\"1\"},\"_ListQueueIterator\":{\"Iterator\":[\"1\"]},\"SetBase\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"_SetBase\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"_SplayTreeIterator\":{\"Iterator\":[\"3\"]},\"_SplayTreeKeyIterator\":{\"_SplayTreeIterator\":[\"1\",\"2\",\"1\"],\"Iterator\":[\"1\"],\"_SplayTreeIterator.K\":\"1\",\"_SplayTreeIterator.T\":\"1\",\"_SplayTreeIterator.1\":\"2\"},\"SplayTreeSet\":{\"SetBase\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"_SplayTree\":[\"1\",\"_SplayTreeSetNode<1>\"],\"Iterable\":[\"1\"],\"Iterable.E\":\"1\",\"_SplayTree.1\":\"_SplayTreeSetNode<1>\",\"_SplayTree.K\":\"1\"},\"Encoding\":{\"Codec\":[\"String\",\"List\"]},\"_JsonMap\":{\"MapBase\":[\"String\",\"@\"],\"Map\":[\"String\",\"@\"],\"MapBase.K\":\"String\",\"MapBase.V\":\"@\"},\"_JsonMapKeyIterable\":{\"ListIterable\":[\"String\"],\"EfficientLengthIterable\":[\"String\"],\"Iterable\":[\"String\"],\"ListIterable.E\":\"String\",\"Iterable.E\":\"String\"},\"AsciiCodec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"_UnicodeSubsetEncoder\":{\"Converter\":[\"String\",\"List\"]},\"AsciiEncoder\":{\"Converter\":[\"String\",\"List\"]},\"_UnicodeSubsetDecoder\":{\"Converter\":[\"List\",\"String\"]},\"AsciiDecoder\":{\"Converter\":[\"List\",\"String\"]},\"Base64Codec\":{\"Codec\":[\"List\",\"String\"]},\"Base64Encoder\":{\"Converter\":[\"List\",\"String\"]},\"JsonUnsupportedObjectError\":{\"Error\":[]},\"JsonCyclicError\":{\"Error\":[]},\"JsonCodec\":{\"Codec\":[\"Object?\",\"String\"]},\"JsonEncoder\":{\"Converter\":[\"Object?\",\"String\"]},\"JsonDecoder\":{\"Converter\":[\"String\",\"Object?\"]},\"Latin1Codec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"Latin1Encoder\":{\"Converter\":[\"String\",\"List\"]},\"Latin1Decoder\":{\"Converter\":[\"List\",\"String\"]},\"Utf8Codec\":{\"Encoding\":[],\"Codec\":[\"String\",\"List\"]},\"Utf8Encoder\":{\"Converter\":[\"String\",\"List\"]},\"Utf8Decoder\":{\"Converter\":[\"List\",\"String\"]},\"DateTime\":{\"Comparable\":[\"DateTime\"]},\"double\":{\"num\":[],\"Comparable\":[\"num\"]},\"Duration\":{\"Comparable\":[\"Duration\"]},\"int\":{\"num\":[],\"Comparable\":[\"num\"]},\"List\":{\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"]},\"num\":{\"Comparable\":[\"num\"]},\"RegExpMatch\":{\"Match\":[]},\"String\":{\"Comparable\":[\"String\"],\"Pattern\":[]},\"AssertionError\":{\"Error\":[]},\"TypeError\":{\"Error\":[]},\"ArgumentError\":{\"Error\":[]},\"RangeError\":{\"Error\":[]},\"IndexError\":{\"Error\":[]},\"UnsupportedError\":{\"Error\":[]},\"UnimplementedError\":{\"Error\":[]},\"StateError\":{\"Error\":[]},\"ConcurrentModificationError\":{\"Error\":[]},\"OutOfMemoryError\":{\"Error\":[]},\"StackOverflowError\":{\"Error\":[]},\"_Exception\":{\"Exception\":[]},\"FormatException\":{\"Exception\":[]},\"_StringStackTrace\":{\"StackTrace\":[]},\"StringBuffer\":{\"StringSink\":[]},\"_Uri\":{\"Uri\":[]},\"_SimpleUri\":{\"Uri\":[]},\"_DataUri\":{\"Uri\":[]},\"NullRejectionException\":{\"Exception\":[]},\"ErrorResult\":{\"Result\":[\"0&\"]},\"ValueResult\":{\"Result\":[\"1\"]},\"_NextRequest\":{\"_EventRequest\":[\"1\"]},\"_HasNextRequest\":{\"_EventRequest\":[\"1\"]},\"CanonicalizedMap\":{\"Map\":[\"2\",\"3\"]},\"QueueList\":{\"ListBase\":[\"1\"],\"List\":[\"1\"],\"Queue\":[\"1\"],\"EfficientLengthIterable\":[\"1\"],\"Iterable\":[\"1\"],\"ListBase.E\":\"1\",\"QueueList.E\":\"1\",\"Iterable.E\":\"1\"},\"_CastQueueList\":{\"QueueList\":[\"2\"],\"ListBase\":[\"2\"],\"List\":[\"2\"],\"Queue\":[\"2\"],\"EfficientLengthIterable\":[\"2\"],\"Iterable\":[\"2\"],\"ListBase.E\":\"2\",\"QueueList.E\":\"2\",\"Iterable.E\":\"2\"},\"PersistentWebSocket\":{\"StreamChannelMixin\":[\"@\"]},\"SseSocketClient\":{\"SocketClient\":[]},\"WebSocketClient\":{\"SocketClient\":[]},\"RequestAbortedException\":{\"Exception\":[]},\"ByteStream\":{\"StreamView\":[\"List\"],\"Stream\":[\"List\"],\"Stream.T\":\"List\",\"StreamView.T\":\"List\"},\"ClientException\":{\"Exception\":[]},\"Request\":{\"BaseRequest\":[]},\"StreamedResponseV2\":{\"StreamedResponse\":[]},\"CaseInsensitiveMap\":{\"CanonicalizedMap\":[\"String\",\"String\",\"1\"],\"Map\":[\"String\",\"1\"],\"CanonicalizedMap.K\":\"String\",\"CanonicalizedMap.V\":\"1\",\"CanonicalizedMap.C\":\"String\"},\"Level\":{\"Comparable\":[\"Level\"]},\"PathException\":{\"Exception\":[]},\"PosixStyle\":{\"InternalStyle\":[]},\"UrlStyle\":{\"InternalStyle\":[]},\"WindowsStyle\":{\"InternalStyle\":[]},\"FileLocation\":{\"SourceLocation\":[],\"Comparable\":[\"SourceLocation\"]},\"_FileSpan\":{\"SourceSpanWithContext\":[],\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceLocation\":{\"Comparable\":[\"SourceLocation\"]},\"SourceLocationMixin\":{\"SourceLocation\":[],\"Comparable\":[\"SourceLocation\"]},\"SourceSpan\":{\"Comparable\":[\"SourceSpan\"]},\"SourceSpanBase\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceSpanException\":{\"Exception\":[]},\"SourceSpanFormatException\":{\"FormatException\":[],\"Exception\":[]},\"SourceSpanMixin\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SourceSpanWithContext\":{\"SourceSpan\":[],\"Comparable\":[\"SourceSpan\"]},\"SseClient\":{\"StreamChannelMixin\":[\"String?\"]},\"StringScannerException\":{\"FormatException\":[],\"Exception\":[]},\"_EventStream\":{\"Stream\":[\"1\"],\"Stream.T\":\"1\"},\"_EventStreamSubscription\":{\"StreamSubscription\":[\"1\"]},\"BrowserWebSocket\":{\"WebSocket\":[]},\"TextDataReceived\":{\"WebSocketEvent\":[]},\"BinaryDataReceived\":{\"WebSocketEvent\":[]},\"CloseReceived\":{\"WebSocketEvent\":[]},\"WebSocketException\":{\"Exception\":[]},\"WebSocketConnectionClosed\":{\"Exception\":[]},\"DdcLibraryBundleRestarter\":{\"TwoPhaseRestarter\":[],\"Restarter\":[]},\"DdcRestarter\":{\"Restarter\":[]},\"RequireRestarter\":{\"Restarter\":[]},\"HotReloadFailedException\":{\"Exception\":[]},\"Int8List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint8List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint8ClampedList\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Int16List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint16List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Int32List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Uint32List\":{\"List\":[\"int\"],\"EfficientLengthIterable\":[\"int\"],\"Iterable\":[\"int\"]},\"Float32List\":{\"List\":[\"double\"],\"EfficientLengthIterable\":[\"double\"],\"Iterable\":[\"double\"]},\"Float64List\":{\"List\":[\"double\"],\"EfficientLengthIterable\":[\"double\"],\"Iterable\":[\"double\"]}}'));\n" " A._Universe_addErasedTypes(init.typeUniverse, JSON.parse('{\"UnmodifiableListBase\":1,\"__CastListBase__CastIterableBase_ListMixin\":2,\"NativeTypedArray\":1,\"_DelayedEvent\":1,\"_SetBase\":1,\"_SplayTreeSet__SplayTree_Iterable\":1,\"_SplayTreeSet__SplayTree_Iterable_SetMixin\":1,\"_QueueList_Object_ListMixin\":1,\"StreamChannelMixin\":1}'));\n" " var string\$ = {\n" " x00_____: \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\u03f6\\x00\\u0404\\u03f4 \\u03f4\\u03f6\\u01f6\\u01f6\\u03f6\\u03fc\\u01f4\\u03ff\\u03ff\\u0584\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u05d4\\u01f4\\x00\\u01f4\\x00\\u0504\\u05c4\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u0400\\x00\\u0400\\u0200\\u03f7\\u0200\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u03ff\\u0200\\u0200\\u0200\\u03f7\\x00\",\n" @@ -21954,16 +22604,12 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " Cannotn: \"Cannot extract a non-Windows file path from a file URI with an authority\",\n" " Dart_e: \"Dart exception thrown from converted Future. Use the properties 'error' to fetch the boxed error and 'stack' to recover the stack trace.\",\n" " Error_: \"Error handler must accept one Object or one Object and a StackTrace as arguments, and return a value of the returned future's type\",\n" -" Hot_reA: \"Hot reload is not supported for the AMD module format.\",\n" -" Hot_reD: \"Hot reload is not supported for the DDC module format.\",\n" " handle: \"handleError callback must take either an Object (the error), or both an Object (the error) and a StackTrace.\",\n" " max_mu: \"max must be in range 0 < max \\u2264 2^32, was \"\n" " };\n" " var type\$ = (function rtii() {\n" " var findType = A.findType;\n" " return {\n" -" \$env_1_1_dynamic: findType(\"@<@>\"),\n" -" \$env_1_1_void: findType(\"@<~>\"),\n" " AsyncError: findType(\"AsyncError\"),\n" " BatchedStreamController_DebugEvent: findType(\"BatchedStreamController\"),\n" " BrowserWebSocket: findType(\"BrowserWebSocket\"),\n" @@ -22021,7 +22667,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " Map_dynamic_dynamic: findType(\"Map<@,@>\"),\n" " MappedListIterable_String_dynamic: findType(\"MappedListIterable\"),\n" " MediaType: findType(\"MediaType\"),\n" -" MultiStreamController_List_int: findType(\"MultiStreamController>\"),\n" " NativeArrayBuffer: findType(\"NativeArrayBuffer\"),\n" " NativeTypedArrayOfInt: findType(\"NativeTypedArrayOfInt\"),\n" " NativeUint8List: findType(\"NativeUint8List\"),\n" @@ -22043,9 +22688,11 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " SplayTreeSet_String: findType(\"SplayTreeSet\"),\n" " StackTrace: findType(\"StackTrace\"),\n" " StreamQueue_DebugEvent: findType(\"StreamQueue\"),\n" +" Stream_dynamic: findType(\"Stream<@>\"),\n" " StreamedResponse: findType(\"StreamedResponse\"),\n" " String: findType(\"String\"),\n" " String_Function_Match: findType(\"String(Match)\"),\n" +" Timer: findType(\"Timer\"),\n" " TrustedGetRuntimeType: findType(\"TrustedGetRuntimeType\"),\n" " TwoPhaseRestarter: findType(\"TwoPhaseRestarter\"),\n" " TypeError: findType(\"TypeError\"),\n" @@ -22059,6 +22706,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " WebSocket: findType(\"WebSocket\"),\n" " WebSocketEvent: findType(\"WebSocketEvent\"),\n" " WhereTypeIterable_String: findType(\"WhereTypeIterable\"),\n" +" Zone: findType(\"Zone\"),\n" +" ZoneDelegate: findType(\"ZoneDelegate\"),\n" " _AsyncCompleter_BrowserWebSocket: findType(\"_AsyncCompleter\"),\n" " _AsyncCompleter_PoolResource: findType(\"_AsyncCompleter\"),\n" " _AsyncCompleter_String: findType(\"_AsyncCompleter\"),\n" @@ -22080,7 +22729,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " _Highlight: findType(\"_Highlight\"),\n" " _IdentityHashMap_of_nullable_Object_and_nullable_Object: findType(\"_IdentityHashMap\"),\n" " _Line: findType(\"_Line\"),\n" -" _MultiStream_List_int: findType(\"_MultiStream>\"),\n" " _StreamControllerAddStreamState_nullable_Object: findType(\"_StreamControllerAddStreamState\"),\n" " _SyncCompleter_PoolResource: findType(\"_SyncCompleter\"),\n" " bool: findType(\"bool\"),\n" @@ -22104,10 +22752,13 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " nullable_StackTrace: findType(\"StackTrace?\"),\n" " nullable_String: findType(\"String?\"),\n" " nullable_String_Function_Match: findType(\"String(Match)?\"),\n" +" nullable_Zone: findType(\"Zone?\"),\n" +" nullable_ZoneDelegate: findType(\"ZoneDelegate?\"),\n" " nullable__DelayedEvent_dynamic: findType(\"_DelayedEvent<@>?\"),\n" " nullable__FutureListener_dynamic_dynamic: findType(\"_FutureListener<@,@>?\"),\n" " nullable__Highlight: findType(\"_Highlight?\"),\n" " nullable_bool: findType(\"bool?\"),\n" +" nullable_bool_Function_Object: findType(\"bool(Object)?\"),\n" " nullable_double: findType(\"double?\"),\n" " nullable_int: findType(\"int?\"),\n" " nullable_num: findType(\"num?\"),\n" @@ -22120,6 +22771,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " void_Function_Object: findType(\"~(Object)\"),\n" " void_Function_Object_StackTrace: findType(\"~(Object,StackTrace)\"),\n" " void_Function_String_dynamic: findType(\"~(String,@)\"),\n" +" void_Function_Timer: findType(\"~(Timer)\"),\n" " void_Function_int_dynamic: findType(\"~(int,@)\")\n" " };\n" " })();\n" @@ -22279,6 +22931,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " B.C_Uuid = new A.Uuid();\n" " B.C__DelayedDone = new A._DelayedDone();\n" " B.C__JSRandom = new A._JSRandom();\n" +" B.C__RootZone = new A._RootZone();\n" +" B.C__ZoneCreatePeriodicTimer = new A._ZoneCreatePeriodicTimer();\n" " B.Duration_0 = new A.Duration(0);\n" " B.Duration_5000000 = new A.Duration(5000000);\n" " B.JsonDecoder_null = new A.JsonDecoder(null);\n" @@ -22314,8 +22968,21 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " B.Type_Uint8ClampedList_04U = A.typeLiteral(\"Uint8ClampedList\");\n" " B.Type_Uint8List_8Eb = A.typeLiteral(\"Uint8List\");\n" " B.Utf8Decoder_false = new A.Utf8Decoder(false);\n" -" B.Zone_jYP = new A.Zone(null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);\n" " B._StringStackTrace_OdL = new A._StringStackTrace(\"\");\n" +" B._ZoneCreateTimer__RootZone__rootCreateTimer = new A._ZoneCreateTimer(B.C__RootZone, A.async___rootCreateTimer\$closure());\n" +" B._ZoneErrorCallback__RootZone__rootErrorCallback = new A._ZoneErrorCallback(B.C__RootZone, A.async___rootErrorCallback\$closure());\n" +" B._ZoneFork__RootZone__rootFork = new A._ZoneFork(B.C__RootZone, A.async___rootFork\$closure());\n" +" B._ZoneHandleUncaughtError_wQ6 = new A._ZoneHandleUncaughtError(B.C__RootZone, A.async___rootHandleUncaughtError\$closure());\n" +" B._ZonePrint__RootZone__rootPrint = new A._ZonePrint(B.C__RootZone, A.async___rootPrint\$closure());\n" +" B._ZoneRegisterBinaryCallback_sk0 = new A._ZoneRegisterBinaryCallback(B.C__RootZone, A.async___rootRegisterBinaryCallback\$closure());\n" +" B._ZoneRegisterCallback__RootZone__rootRegisterCallback = new A._ZoneRegisterCallback(B.C__RootZone, A.async___rootRegisterCallback\$closure());\n" +" B._ZoneRegisterUnaryCallback_a9v = new A._ZoneRegisterUnaryCallback(B.C__RootZone, A.async___rootRegisterUnaryCallback\$closure());\n" +" B._ZoneRunBinary__RootZone__rootRunBinary = new A._ZoneRunBinary(B.C__RootZone, A.async___rootRunBinary\$closure());\n" +" B._ZoneRunUnary__RootZone__rootRunUnary = new A._ZoneRunUnary(B.C__RootZone, A.async___rootRunUnary\$closure());\n" +" B._ZoneRun__RootZone__rootRun = new A._ZoneRun(B.C__RootZone, A.async___rootRun\$closure());\n" +" B._ZoneScheduleMicrotask__RootZone__rootScheduleMicrotask = new A._ZoneScheduleMicrotask(B.C__RootZone, A.async___rootScheduleMicrotask\$closure());\n" +" B.Map_empty1 = new A.ConstantStringMap(B.Object_empty, [], A.findType(\"ConstantStringMap\"));\n" +" B._ZoneValues__RootZone_Map_empty = new A._ZoneValues(B.C__RootZone, B.Map_empty1);\n" " })();\n" " (function staticFields() {\n" " \$._JS_INTEROP_INTERCEPTOR_TAG = null;\n" @@ -22335,7 +23002,8 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " \$._lastCallback = null;\n" " \$._lastPriorityCallback = null;\n" " \$._isInCallbackLoop = false;\n" -" \$.Zone__current = B.Zone_jYP;\n" +" \$.Zone__current = B.C__RootZone;\n" +" \$._RootZone__rootDelegate = null;\n" " \$.Uri__cachedBaseString = \"\";\n" " \$.Uri__cachedBaseUri = null;\n" " \$.LogRecord__nextNumber = 0;\n" @@ -22348,7 +23016,7 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " var _lazyFinal = hunkHelpers.lazyFinal;\n" " _lazyFinal(\$, \"DART_CLOSURE_PROPERTY_NAME\", \"\$get\$DART_CLOSURE_PROPERTY_NAME\", () => A.getIsolateAffinityTag(\"_\$dart_dartClosure\"));\n" " _lazyFinal(\$, \"DART_CLOSURE_DART_JSINTEROP_PROPERTY_NAME\", \"\$get\$DART_CLOSURE_DART_JSINTEROP_PROPERTY_NAME\", () => A.getIsolateAffinityTag(\"_\$dart_dartClosure_dartJSInterop\"));\n" -" _lazyFinal(\$, \"nullFuture\", \"\$get\$nullFuture\", () => B.Zone_jYP.run\$1\$1(new A.nullFuture_closure(), type\$.Future_void));\n" +" _lazyFinal(\$, \"nullFuture\", \"\$get\$nullFuture\", () => B.C__RootZone.run\$1\$1(new A.nullFuture_closure(), type\$.Future_void));\n" " _lazyFinal(\$, \"_safeToStringHooks\", \"\$get\$_safeToStringHooks\", () => A._setArrayType([new J.JSArraySafeToStringHook()], A.findType(\"JSArray\")));\n" " _lazyFinal(\$, \"TypeErrorDecoder_noSuchMethodPattern\", \"\$get\$TypeErrorDecoder_noSuchMethodPattern\", () => A.TypeErrorDecoder_extractPattern(A.TypeErrorDecoder_provokeCallErrorOn({\n" " toString: function() {\n" @@ -22396,7 +23064,6 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " }()));\n" " _lazyFinal(\$, \"_AsyncRun__scheduleImmediateClosure\", \"\$get\$_AsyncRun__scheduleImmediateClosure\", () => A._AsyncRun__initializeScheduleImmediate());\n" " _lazyFinal(\$, \"Future__nullFuture\", \"\$get\$Future__nullFuture\", () => \$.\$get\$nullFuture());\n" -" _lazyFinal(\$, \"_rootDelegate\", \"\$get\$_rootDelegate\", () => A.ZoneDelegate\$_());\n" " _lazyFinal(\$, \"_Utf8Decoder__reusableBuffer\", \"\$get\$_Utf8Decoder__reusableBuffer\", () => A.NativeUint8List_NativeUint8List(4096));\n" " _lazyFinal(\$, \"_Utf8Decoder__decoder\", \"\$get\$_Utf8Decoder__decoder\", () => new A._Utf8Decoder__decoder_closure().call\$0());\n" " _lazyFinal(\$, \"_Utf8Decoder__decoderNonfatal\", \"\$get\$_Utf8Decoder__decoderNonfatal\", () => new A._Utf8Decoder__decoderNonfatal_closure().call\$0());\n" @@ -22486,8 +23153,11 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " Function.prototype.call\$0 = function() {\n" " return this();\n" " };\n" -" Function.prototype.call\$1\$4 = function(a, b, c, d) {\n" -" return this(a, b, c, d);\n" +" Function.prototype.call\$1\$1 = function(a) {\n" +" return this(a);\n" +" };\n" +" Function.prototype.call\$3\$3 = function(a, b, c) {\n" +" return this(a, b, c);\n" " };\n" " Function.prototype.call\$5 = function(a, b, c, d, e) {\n" " return this(a, b, c, d, e);\n" @@ -22495,23 +23165,38 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value " Function.prototype.call\$3 = function(a, b, c) {\n" " return this(a, b, c);\n" " };\n" +" Function.prototype.call\$3\$6 = function(a, b, c, d, e, f) {\n" +" return this(a, b, c, d, e, f);\n" +" };\n" +" Function.prototype.call\$1\$4 = function(a, b, c, d) {\n" +" return this(a, b, c, d);\n" +" };\n" +" Function.prototype.call\$2\$1 = function(a) {\n" +" return this(a);\n" +" };\n" " Function.prototype.call\$4 = function(a, b, c, d) {\n" " return this(a, b, c, d);\n" " };\n" -" Function.prototype.call\$3\$6 = function(a, b, c, d, e, f) {\n" -" return this(a, b, c, d, e, f);\n" +" Function.prototype.call\$3\$1 = function(a) {\n" +" return this(a);\n" " };\n" " Function.prototype.call\$3\$4 = function(a, b, c, d) {\n" " return this(a, b, c, d);\n" " };\n" +" Function.prototype.call\$2\$4 = function(a, b, c, d) {\n" +" return this(a, b, c, d);\n" +" };\n" +" Function.prototype.call\$2\$2 = function(a, b) {\n" +" return this(a, b);\n" +" };\n" " Function.prototype.call\$2\$5 = function(a, b, c, d, e) {\n" " return this(a, b, c, d, e);\n" " };\n" -" Function.prototype.call\$2\$4 = function(a, b, c, d) {\n" -" return this(a, b, c, d);\n" +" Function.prototype.call\$2\$3 = function(a, b, c) {\n" +" return this(a, b, c);\n" " };\n" -" Function.prototype.call\$1\$1 = function(a) {\n" -" return this(a);\n" +" Function.prototype.call\$1\$2 = function(a, b) {\n" +" return this(a, b);\n" " };\n" " Function.prototype.call\$2\$0 = function() {\n" " return this();\n" @@ -22552,4 +23237,4 @@ const injectedClientJs = "// Generated by dart2js (, csp, intern-composite-value "})();\n" ""; -const clientDartHash = 'eb87fbfbfd5a1d956d883131177756f74503b621509846fb09367d3ab94173eb'; +const clientDartHash = '6c9aa3e56aa014bb92865822a76b4cfbb757957f40e8112884d684f4e86c82ea'; diff --git a/dwds/lib/src/loaders/asset_scheme.dart b/dwds/lib/src/loaders/asset_scheme.dart new file mode 100644 index 0000000000..1442b74acb --- /dev/null +++ b/dwds/lib/src/loaders/asset_scheme.dart @@ -0,0 +1,86 @@ +// Copyright (c) 2026, 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. + +/// Encapsulates asset file naming conventions and schemes. +abstract class AssetScheme { + /// File extension for JS files. + /// (e.g., '.ddc.js' or '.dart.lib.js'). + String get jsSuffix; + + /// File extension for sourcemaps. + /// (e.g., '.ddc.js.map' or '.dart.lib.js.map'). + String get sourceMapSuffix; + + /// File extension for module names. + /// (e.g., '.ddc' or '.dart.lib'). + String get descriptorSuffix; + + /// File extension for full dill files. + /// (e.g., '.ddc.full.dill' or '.dart.lib.full.dill'). + String get fullDillSuffix; + + /// File extension for summary dill files. + /// (e.g., '.ddc.dill' or '.dart.lib.dill'). + String get summaryDillSuffix; + + /// File extension for bootstrap files. + /// (e.g., '.bootstrap.js' or '.dart.bootstrap.js'). + String get bootstrapSuffix; + + /// File extension for merged metadata. + /// (e.g., '.ddc_merged_metadata'). + String get mergedMetadataSuffix; +} + +/// Asset scheme for package:build assets. +final class BuildRunnerAssetScheme implements AssetScheme { + const BuildRunnerAssetScheme(); + + @override + String get jsSuffix => '.ddc.js'; + + @override + String get sourceMapSuffix => '.ddc.js.map'; + + @override + String get descriptorSuffix => '.ddc'; + + @override + String get fullDillSuffix => '.ddc.full.dill'; + + @override + String get summaryDillSuffix => '.ddc.dill'; + + @override + String get bootstrapSuffix => '.bootstrap.js'; + + @override + String get mergedMetadataSuffix => '.ddc_merged_metadata'; +} + +/// Asset scheme for Frontend Server assets. +final class FrontendServerAssetScheme implements AssetScheme { + const FrontendServerAssetScheme(); + + @override + String get jsSuffix => '.dart.lib.js'; + + @override + String get sourceMapSuffix => '.dart.lib.js.map'; + + @override + String get descriptorSuffix => '.dart.lib'; + + @override + String get fullDillSuffix => '.dart.lib.full.dill'; + + @override + String get summaryDillSuffix => '.dart.lib.dill'; + + @override + String get bootstrapSuffix => '.bootstrap.js'; + + @override + String get mergedMetadataSuffix => '.ddc_merged_metadata'; +} diff --git a/dwds/lib/src/loaders/build_runner_strategy_provider.dart b/dwds/lib/src/loaders/build_runner_strategy_provider.dart index ba776bda97..8706aa8414 100644 --- a/dwds/lib/src/loaders/build_runner_strategy_provider.dart +++ b/dwds/lib/src/loaders/build_runner_strategy_provider.dart @@ -5,6 +5,7 @@ import 'dart:convert'; import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/ddc_library_bundle.dart'; import 'package:dwds/src/loaders/require.dart'; import 'package:dwds/src/loaders/strategy.dart'; @@ -38,6 +39,7 @@ class BuildRunnerRequireStrategyProvider with BuildRunnerStrategyProviderMixin { _moduleInfoForProvider, _assetReader, _buildSettings, + const BuildRunnerAssetScheme(), packageConfigPath: _packageConfigPath, ); @@ -79,6 +81,7 @@ class BuildRunnerDdcLibraryBundleStrategyProvider _assetReader, _buildSettings, (path) => null, // g3RelativePath + const BuildRunnerAssetScheme(), packageConfigPath: _packageConfigPath, injectScriptLoad: injectScriptLoad, reloadedSourcesUri: _reloadedSourcesUri, @@ -203,15 +206,9 @@ mixin BuildRunnerStrategyProviderMixin { } String? _serverPathForAppUri(String appUrl) { - final appUri = Uri.parse(appUrl); - if (appUri.isScheme('org-dartlang-app')) { - // We skip the root from which we are serving. - return appUri.pathSegments.skip(1).join('/'); - } - if (appUri.isScheme('package')) { - return '/packages/${appUri.path}'; - } - return null; + return BuildRunnerPathResolver( + useDebuggerModuleNames: _buildSettings.useDebuggerModuleNames, + ).appUriToServerPath(appUrl); } Future> _moduleInfoForProvider( diff --git a/dwds/lib/src/loaders/ddc.dart b/dwds/lib/src/loaders/ddc.dart index a1b18f6fd4..6fddc0dd32 100644 --- a/dwds/lib/src/loaders/ddc.dart +++ b/dwds/lib/src/loaders/ddc.dart @@ -6,6 +6,7 @@ import 'dart:convert'; import 'package:dwds/src/debugging/dart_runtime_debugger.dart'; import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:dwds/src/services/expression_compiler.dart'; @@ -145,7 +146,8 @@ class DdcStrategy extends LoadStrategy { this._moduleInfoForProvider, AssetReader assetReader, this._buildSettings, - this._g3RelativePath, { + this._g3RelativePath, + this.assetScheme, { super.packageConfigPath, }) : super(assetReader); @@ -162,6 +164,9 @@ class DdcStrategy extends LoadStrategy { @override String get moduleFormat => 'ddc'; + @override + final AssetScheme assetScheme; + @override String get loadLibrariesModule => 'ddc_module_loader.ddk.js'; diff --git a/dwds/lib/src/loaders/ddc_library_bundle.dart b/dwds/lib/src/loaders/ddc_library_bundle.dart index 2404fb9567..7f2bb61a11 100644 --- a/dwds/lib/src/loaders/ddc_library_bundle.dart +++ b/dwds/lib/src/loaders/ddc_library_bundle.dart @@ -6,6 +6,7 @@ import 'dart:convert'; import 'package:dwds/src/debugging/dart_runtime_debugger.dart'; import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/ddc.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/asset_reader.dart'; @@ -124,7 +125,8 @@ class DdcLibraryBundleStrategy extends LoadStrategy this._moduleInfoForProvider, AssetReader assetReader, this._buildSettings, - this._g3RelativePath, { + this._g3RelativePath, + this.assetScheme, { super.packageConfigPath, this.reloadedSourcesUri, this.injectScriptLoad = true, @@ -146,6 +148,9 @@ class DdcLibraryBundleStrategy extends LoadStrategy @override String get moduleFormat => 'ddc'; + @override + final AssetScheme assetScheme; + @override String get loadLibrariesModule => 'ddc_module_loader.ddk.js'; diff --git a/dwds/lib/src/loaders/frontend_server_strategy_provider.dart b/dwds/lib/src/loaders/frontend_server_strategy_provider.dart index 3e68b6eaff..477dfde221 100644 --- a/dwds/lib/src/loaders/frontend_server_strategy_provider.dart +++ b/dwds/lib/src/loaders/frontend_server_strategy_provider.dart @@ -3,31 +3,36 @@ // found in the LICENSE file. import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/ddc.dart'; import 'package:dwds/src/loaders/ddc_library_bundle.dart'; import 'package:dwds/src/loaders/require.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:dwds/src/services/expression_compiler.dart'; +import 'package:dwds/src/utilities/web_path_translator.dart'; import 'package:path/path.dart' as p; abstract class FrontendServerStrategyProvider { final ReloadConfiguration _configuration; final AssetReader _assetReader; - final PackageUriMapper _packageUriMapper; + final PathResolver _pathResolver; final Future> Function() _digestsProvider; final String _basePath; final BuildSettings _buildSettings; final String? _packageConfigPath; + AssetScheme get assetScheme; + FrontendServerStrategyProvider( this._configuration, this._assetReader, - this._packageUriMapper, + PathResolver? pathResolver, this._digestsProvider, this._buildSettings, { this._packageConfigPath, - }) : _basePath = _assetReader.basePath; + }) : _basePath = _assetReader.basePath, + _pathResolver = pathResolver ?? FrontendServerPathResolver(); T get strategy; @@ -73,17 +78,11 @@ abstract class FrontendServerStrategyProvider { _addBasePath((await metadataProvider.moduleToSourceMap)[module] ?? ''); String? _serverPathForAppUri(String appUrl) { - final appUri = Uri.parse(appUrl); - if (appUri.isScheme('org-dartlang-app')) { - return _addBasePath(appUri.path); - } - if (appUri.isScheme('package')) { - final resolved = _packageUriMapper.packageUriToServerPath(appUri); - if (resolved != null) { - return resolved; - } - } - return null; + final translated = _pathResolver.appUriToServerPath( + appUrl, + useDebuggerModuleNames: _buildSettings.useDebuggerModuleNames, + ); + return translated != null ? _addBasePath(translated) : null; } Future> _moduleInfoForProvider( @@ -119,39 +118,51 @@ class FrontendServerDdcStrategyProvider _assetReader, _buildSettings, (String _) => null, + assetScheme, packageConfigPath: _packageConfigPath, ); FrontendServerDdcStrategyProvider( super._configuration, super._assetReader, - super._packageUriMapper, + super._pathResolver, super._digestsProvider, super._buildSettings, { super.packageConfigPath, }); + @override + AssetScheme get assetScheme => const FrontendServerAssetScheme(); + @override DdcStrategy get strategy => _ddcStrategy; } -/// Provides a [DdcLibraryBundleStrategy] suitable for use with the Frontend -/// Server. -// ignore: prefer-correct-type-name +/// Provides a [DdcLibraryBundleStrategy] for the Frontend Server-only +/// configuration. class FrontendServerDdcLibraryBundleStrategyProvider extends FrontendServerStrategyProvider { late final DdcLibraryBundleStrategy _libraryBundleStrategy; FrontendServerDdcLibraryBundleStrategyProvider( - super._configuration, - super._assetReader, - super._packageUriMapper, - super._digestsProvider, - super._buildSettings, { + ReloadConfiguration configuration, + AssetReader assetReader, + PathResolver? pathResolver, + Future> Function() digestsProvider, + BuildSettings buildSettings, { super.packageConfigPath, Uri? reloadedSourcesUri, bool injectScriptLoad = true, - }) { + }) : super( + configuration, + assetReader, + pathResolver ?? + (buildSettings.isFlutterApp + ? FlutterPathResolver() + : FrontendServerPathResolver()), + digestsProvider, + buildSettings, + ) { _libraryBundleStrategy = DdcLibraryBundleStrategy( _configuration, _moduleProvider, @@ -164,16 +175,177 @@ class FrontendServerDdcLibraryBundleStrategyProvider _assetReader, _buildSettings, (String _) => null, + assetScheme, packageConfigPath: _packageConfigPath, reloadedSourcesUri: reloadedSourcesUri, injectScriptLoad: injectScriptLoad, ); } + @override + AssetScheme get assetScheme => const FrontendServerAssetScheme(); + @override DdcLibraryBundleStrategy get strategy => _libraryBundleStrategy; } +/// Provides a [DdcLibraryBundleStrategy] for the Frontend Server + Build +/// Daemon configuration, which supports hot reload. +class FrontendServerBuildDaemonStrategyProvider + extends FrontendServerStrategyProvider { + late final DdcLibraryBundleStrategy _libraryBundleStrategy; + + FrontendServerBuildDaemonStrategyProvider( + ReloadConfiguration configuration, + AssetReader assetReader, + PathResolver? pathResolver, + Future> Function() digestsProvider, + BuildSettings buildSettings, { + super.packageConfigPath, + Uri? reloadedSourcesUri, + bool injectScriptLoad = true, + }) : super( + configuration, + assetReader, + pathResolver ?? BuildRunnerPathResolver(), + digestsProvider, + buildSettings, + ) { + _libraryBundleStrategy = DdcLibraryBundleStrategy( + _configuration, + _moduleProvider, + (_) => _digestsProvider(), + _moduleForServerPath, + _serverPathForModule, + _sourceMapPathForModule, + _serverPathForAppUri, + _moduleInfoForProvider, + _assetReader, + _buildSettings, + (String _) => null, + assetScheme, + packageConfigPath: _packageConfigPath, + reloadedSourcesUri: reloadedSourcesUri, + injectScriptLoad: injectScriptLoad, + ); + } + + @override + AssetScheme get assetScheme => const BuildRunnerAssetScheme(); + + @override + DdcLibraryBundleStrategy get strategy => _libraryBundleStrategy; + + /// Strips the top-level web/entrypoint directory from a path. + /// + /// For example: + /// - `web/main.dart` -> `main.dart` + /// - `example/append_body/main.dart` -> `append_body/main.dart` + /// - `packages/path/path.dart` -> `packages/path/path.dart` (unchanged) + String _stripPrefix(String path) { + path = path.replaceAll('\\', '/'); + if (path.startsWith('packages')) return path; + final parts = path.split('/'); + + final appUri = _buildSettings.appEntrypoint; + final validPrefixes = [ + if (appUri != null && appUri.pathSegments.isNotEmpty) + appUri.pathSegments.first, + ...WebPathTranslator.defaultWebDirs, + ]; + + if (parts.length > 1 && validPrefixes.contains(parts[0])) { + return parts.skip(1).join('/'); + } + return path; + } + + /// Looks up the DDC module name for a served source file path while remapping + /// browser-requested DDC paths (containing '.ddc') to Frontend Server-served + /// paths (containing '.dart.lib'). + /// + /// Requested paths can originate from different contexts at runtime, so we + /// perform several runtime lookups: + /// 1) Frontend Server uses '.dart.lib.js' and is referenced by expression + /// evaluation requests, metadata files, stack traces, and sourcemaps. + /// 2) Build daemon serves with '.ddc.js' and is referenced by Chrome file + /// requests and Chrome DevTools protocol script URLs. + @override + Future _moduleForServerPath( + MetadataProvider metadataProvider, + String serverPath, + ) async { + // Try looking up with the build runner path. + var module = await super._moduleForServerPath(metadataProvider, serverPath); + if (module != null) return module; + final remappedPath = WebPathTranslator.translateBuildRunnerToFesPath( + serverPath, + ); + module = await super._moduleForServerPath(metadataProvider, remappedPath); + if (module != null) return module; + + // Look up root modules with directory prefixes (e.g. 'web/' or 'example/'). + // Package dependencies ('packages/') are matched above. + final modulePathToModule = await metadataProvider.modulePathToModule; + final appUri = _buildSettings.appEntrypoint; + final validPrefixes = [ + if (appUri != null && appUri.pathSegments.isNotEmpty) + appUri.pathSegments.first, + ...WebPathTranslator.defaultWebDirs, + ]; + for (final prefix in validPrefixes) { + final match = + modulePathToModule['$prefix/$remappedPath'] ?? + modulePathToModule['$prefix/$serverPath']; + if (match != null) return match; + } + return null; + } + + @override + Future _serverPathForModule( + MetadataProvider metadataProvider, + String module, + ) async { + final path = await super._serverPathForModule(metadataProvider, module); + final stripped = _stripPrefix(path); + return WebPathTranslator.translateFesToBuildRunnerPath(stripped); + } + + @override + Future _sourceMapPathForModule( + MetadataProvider metadataProvider, + String module, + ) async { + final path = await super._sourceMapPathForModule(metadataProvider, module); + final stripped = _stripPrefix(path); + return WebPathTranslator.translateFesToBuildRunnerPath(stripped); + } + + @override + String? _serverPathForAppUri(String appUrl) => + _pathResolver.appUriToServerPath( + appUrl, + useDebuggerModuleNames: _buildSettings.useDebuggerModuleNames, + ); + + @override + Future> _moduleInfoForProvider( + MetadataProvider metadataProvider, + ) async { + final moduleInfo = await super._moduleInfoForProvider(metadataProvider); + return moduleInfo.map((module, info) { + return MapEntry( + module, + ModuleInfo( + WebPathTranslator.translateFesToBuildRunnerPath(info.fullDillPath), + WebPathTranslator.translateFesToBuildRunnerPath(info.summaryPath), + ), + ); + }); + } +} + /// Provides a [RequireStrategy] suitable for use with Frontend Server. class FrontendServerRequireStrategyProvider extends FrontendServerStrategyProvider { @@ -188,17 +360,30 @@ class FrontendServerRequireStrategyProvider _moduleInfoForProvider, _assetReader, _buildSettings, + assetScheme, packageConfigPath: _packageConfigPath, ); FrontendServerRequireStrategyProvider( - super._configuration, - super._assetReader, - super._packageUriMapper, - super._digestsProvider, - super._buildSettings, { + ReloadConfiguration configuration, + AssetReader assetReader, + PathResolver? pathResolver, + Future> Function() digestsProvider, + BuildSettings buildSettings, { super.packageConfigPath, - }); + }) : super( + configuration, + assetReader, + pathResolver ?? + (buildSettings.isFlutterApp + ? FlutterPathResolver() + : FrontendServerPathResolver()), + digestsProvider, + buildSettings, + ); + + @override + AssetScheme get assetScheme => const FrontendServerAssetScheme(); @override RequireStrategy get strategy => _requireStrategy; diff --git a/dwds/lib/src/loaders/require.dart b/dwds/lib/src/loaders/require.dart index 535c39d66e..9ce760bcbf 100644 --- a/dwds/lib/src/loaders/require.dart +++ b/dwds/lib/src/loaders/require.dart @@ -6,6 +6,7 @@ import 'dart:convert'; import 'package:dwds/src/debugging/dart_runtime_debugger.dart'; import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:dwds/src/services/expression_compiler.dart'; @@ -138,7 +139,8 @@ class RequireStrategy extends LoadStrategy { this._serverPathForAppUri, this._moduleInfoForProvider, AssetReader assetReader, - this._buildSettings, { + this._buildSettings, + this.assetScheme, { super.packageConfigPath, }) : super(assetReader); @@ -162,6 +164,9 @@ class RequireStrategy extends LoadStrategy { @override String get moduleFormat => 'amd'; + @override + final AssetScheme assetScheme; + @override String get loadLibrariesModule => 'require.js'; diff --git a/dwds/lib/src/loaders/strategy.dart b/dwds/lib/src/loaders/strategy.dart index c4ccaa6aa9..60084990f5 100644 --- a/dwds/lib/src/loaders/strategy.dart +++ b/dwds/lib/src/loaders/strategy.dart @@ -7,6 +7,7 @@ import 'dart:typed_data'; import 'package:dwds/src/debugging/dart_runtime_debugger.dart'; import 'package:dwds/src/debugging/metadata/provider.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:dwds/src/services/expression_compiler.dart'; import 'package:dwds/src/utilities/dart_uri.dart'; @@ -47,8 +48,11 @@ abstract class LoadStrategy { final String? _packageConfigPath; final _providers = {}; - LoadStrategy(this._assetReader, {String? packageConfigPath}) - : _packageConfigPath = packageConfigPath ?? _findPackageConfigFilePath(); + LoadStrategy( + this._assetReader, { + String? packageConfigPath, + // ignore: prefer_initializing_formals + }) : _packageConfigPath = packageConfigPath ?? _findPackageConfigFilePath(); /// The ID for this strategy. /// @@ -66,6 +70,9 @@ abstract class LoadStrategy { /// Used for preventing stepping into the library loading code. String get loadLibrariesModule; + /// Asset scheme, which determines file extensions for this strategy. + AssetScheme get assetScheme; + /// Returns a snippet of JS code that can be used to load a JS module. /// /// The snippet should be a reference to a function that takes a single @@ -191,11 +198,12 @@ abstract class LoadStrategy { /// Returns the [MetadataProvider] for the application located at the provided /// [entrypoint]. MetadataProvider metadataProviderFor(String entrypoint) { - if (_providers.containsKey(entrypoint)) { - return _providers[entrypoint]!; - } else { - throw StateError('No metadata provider for $entrypoint'); - } + final provider = _providers[entrypoint]; + if (provider != null) return provider; + throw StateError( + 'No metadata provider for $entrypoint. ' + 'Available providers: ${_providers.keys.toList()}', + ); } /// Creates and returns a [MetadataProvider] with the given [entrypoint] and @@ -217,7 +225,7 @@ abstract class LoadStrategy { String entrypoint, Map reloadedModulesToLibraries, ) { - final provider = _providers[entrypoint]!; + final provider = metadataProviderFor(entrypoint); return provider.reinitializeAfterHotReload(reloadedModulesToLibraries); } } @@ -235,11 +243,13 @@ class BuildSettings { final bool canaryFeatures; final bool isFlutterApp; final List experiments; + final bool useDebuggerModuleNames; const BuildSettings({ this.appEntrypoint, this.canaryFeatures = false, this.isFlutterApp = true, this.experiments = const [], + this.useDebuggerModuleNames = true, }); } diff --git a/dwds/lib/src/readers/asset_reader.dart b/dwds/lib/src/readers/asset_reader.dart index 5bec51e490..b44c5f8995 100644 --- a/dwds/lib/src/readers/asset_reader.dart +++ b/dwds/lib/src/readers/asset_reader.dart @@ -2,10 +2,14 @@ // 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:collection/collection.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; +import 'package:dwds/src/utilities/shared.dart'; +import 'package:dwds/src/utilities/web_path_translator.dart'; import 'package:file/file.dart'; import 'package:logging/logging.dart'; import 'package:package_config/package_config.dart'; +import 'package:path/path.dart' as p; +export 'package:dwds/src/utilities/shared.dart' show stripLeadingSlashes; /// A reader for Dart sources and related source maps. abstract class AssetReader { @@ -21,14 +25,17 @@ abstract class AssetReader { /// ``` String get basePath; - /// Returns the contents for a source map at the provided server path, or - /// null if the resource does not exist. - Future sourceMapContents(String serverPath); + /// The asset scheme used by this reader. + AssetScheme get assetScheme; /// Returns the contents for a dart source at the provided server path, or /// null if the resource does not exist. Future dartSourceContents(String serverPath); + /// Returns the contents for a source map at the provided server path, or + /// null if the resource does not exist. + Future sourceMapContents(String serverPath); + /// Returns the contents for the merged metadata output at the provided path, /// or null if the resource does not exist. Future metadataContents(String serverPath); @@ -37,12 +44,56 @@ abstract class AssetReader { Future close(); } -class PackageUriMapper { - final _logger = Logger('PackageUriMapper'); - final PackageConfig packageConfig; +abstract class PathResolver { + final Logger _logger; + final PackageConfig? packageConfig; final bool useDebuggerModuleNames; + final String? packageRoot; + + PathResolver({ + this.packageConfig, + this.useDebuggerModuleNames = false, + this.packageRoot, + required String loggerName, + }) : _logger = Logger(loggerName); - static Future create( + /// Computes the server path for a given application URL. + /// + /// Returns `null` if [appUrl] is not supported by the resolver. + String? appUriToServerPath(String appUrl, {bool? useDebuggerModuleNames}); + + /// Computes the application URI (e.g., package: URI) for a given server path. + /// + /// Returns `null` if the path cannot be translated to a validapp URI. + String? serverPathToAppUri(String serverPath); + + /// Computes the resolved file URI for a given server path. + /// + /// Returns `null` if a URI cannot be resolved. + Uri? serverPathToResolvedUri(String serverPath) { + serverPath = stripLeadingSlashes(serverPath).replaceAll('\\', '/'); + final segments = serverPath.split('/'); + if (segments.first == 'packages') { + final config = packageConfig; + if (config == null) { + _logger.severe('Cannot resolve packages without packageConfig'); + return null; + } + final packagePath = serverPathToAppUri(serverPath); + if (packagePath == null) return null; + return config.resolve(Uri.parse(packagePath)); + } else if (packageRoot != null) { + return Uri.file(p.join(packageRoot!, serverPath)); + } + _logger.severe( + 'Cannot resolve path without packages/ prefix or packageRoot: $serverPath', + ); + return null; + } +} + +final class FrontendServerPathResolver extends PathResolver { + static Future create( FileSystem fileSystem, Uri packageConfigFile, { bool useDebuggerModuleNames = false, @@ -50,76 +101,176 @@ class PackageUriMapper { final packageConfig = await loadPackageConfig( fileSystem.file(packageConfigFile), ); - return PackageUriMapper( - packageConfig, + return FrontendServerPathResolver( + packageConfig: packageConfig, useDebuggerModuleNames: useDebuggerModuleNames, ); } - PackageUriMapper(this.packageConfig, {this.useDebuggerModuleNames = false}); + FrontendServerPathResolver({ + super.packageConfig, + super.useDebuggerModuleNames = false, + super.packageRoot, + }) : super(loggerName: 'FrontendServerPathResolver'); - /// Compute server path for package uri. - /// - /// Note: needs to match `urlForComponentUri` in javascript_bundle.dart - /// in SDK code. - String? packageUriToServerPath(Uri packageUri) { - final defaultServerPath = '/packages/${packageUri.path}'; - if (packageUri.isScheme('package')) { - if (!useDebuggerModuleNames) { - return defaultServerPath; + @override + String? appUriToServerPath(String appUrl, {bool? useDebuggerModuleNames}) { + final useDebugger = useDebuggerModuleNames ?? this.useDebuggerModuleNames; + final appUri = Uri.parse(appUrl); + // Note: must match `urlForComponentUri` in javascript_bundle.dart in SDK. + if (appUri.isScheme('package')) { + // package:foo/bar.dart -> packages/foo/lib/bar.dart (useDebugger) + // package:foo/bar.dart -> packages/foo/bar.dart (!useDebugger) + final pathSegments = appUri.pathSegments; + if (pathSegments.isEmpty) { + throw FormatException('Invalid package URI with empty path: $appUrl'); } - final resolvedUri = packageConfig.resolve(packageUri); - if (resolvedUri == null) { - _logger.severe('Cannot resolve package uri $packageUri'); - return defaultServerPath; - } - final package = packageConfig.packageOf(resolvedUri); - if (package == null) { - _logger.severe('Cannot find package for package uri $packageUri'); - return defaultServerPath; + final buildRunnerPath = 'packages/${appUri.path}'; + final path = useDebugger + ? WebPathTranslator.addLibSegment(buildRunnerPath) + : buildRunnerPath; + return path; + } + if (appUri.isScheme('org-dartlang-app')) { + // org-dartlang-app:///web/main.dart -> web/main.dart + // org-dartlang-app:///packages/foo/bar.dart -> packages/foo/lib/bar.dart (useDebugger) + // org-dartlang-app:///packages/foo/lib/bar.dart -> packages/foo/bar.dart (!useDebugger) + final segments = appUri.pathSegments; + if (segments.isEmpty) { + throw FormatException('Invalid org-dartlang-app URI: $appUrl'); } - final root = package.root; - final relativeUrl = resolvedUri.toString().replaceFirst('$root', ''); - final relativeRoot = _getRelativeRoot(root); - final ret = relativeRoot == null - ? 'packages/$relativeUrl' - : 'packages/$relativeRoot/$relativeUrl'; - return ret; + final path = useDebugger + ? WebPathTranslator.addLibSegment(appUri.path.substring(1)) + : WebPathTranslator.removeLibSegment(appUri.path.substring(1)); + return path; } - _logger.severe('Expected package uri, but found $packageUri'); return null; } - /// Compute resolved file uri for a server path. - Uri? serverPathToResolvedUri(String serverPath) { - serverPath = stripLeadingSlashes(serverPath); - final segments = serverPath.split('/'); - if (segments.first == 'packages') { - if (!useDebuggerModuleNames) { - return packageConfig.resolve( - Uri(scheme: 'package', pathSegments: segments.skip(1)), - ); + @override + String? serverPathToAppUri(String serverPath) { + // packages/foo/lib/bar.dart -> package:foo/bar.dart + // packages/foo/bar.dart -> package:foo/bar.dart + // web/main.dart -> web/main.dart + serverPath = stripLeadingSlashes(serverPath).replaceAll('\\', '/'); + if (!serverPath.startsWith('packages/')) return serverPath; + return WebPathTranslator.packagePathToPackageUri(serverPath); + } +} + +final class BuildRunnerPathResolver extends PathResolver { + static Future create( + FileSystem fileSystem, + Uri packageConfigFile, { + bool useDebuggerModuleNames = false, + }) async { + final packageConfig = await loadPackageConfig( + fileSystem.file(packageConfigFile), + ); + return BuildRunnerPathResolver( + packageConfig: packageConfig, + useDebuggerModuleNames: useDebuggerModuleNames, + ); + } + + BuildRunnerPathResolver({ + super.packageConfig, + super.useDebuggerModuleNames = false, + super.packageRoot, + }) : super(loggerName: 'BuildRunnerPathResolver'); + + @override + String? appUriToServerPath(String appUrl, {bool? useDebuggerModuleNames}) { + final useDebugger = useDebuggerModuleNames ?? this.useDebuggerModuleNames; + final appUri = Uri.parse(appUrl); + // Note: must match `urlForComponentUri` in javascript_bundle.dart in SDK. + if (appUri.isScheme('package')) { + // package:foo/bar.dart -> packages/foo/bar.dart (useDebugger) + // package:foo/bar.dart -> /packages/foo/bar.dart (!useDebugger) + final pathSegments = appUri.pathSegments; + if (pathSegments.isEmpty) { + throw FormatException('Invalid package URI with empty path: $appUrl'); + } + final path = 'packages/${appUri.path}'; + if (!useDebugger && path.startsWith('packages/')) { + return '/$path'; + } + return path; + } + + if (appUri.isScheme('org-dartlang-app')) { + // org-dartlang-app:///web/main.dart -> main.dart + // org-dartlang-app:///packages/foo/bar.dart -> packages/foo/bar.dart + final segments = appUri.pathSegments; + if (segments.isEmpty) { + throw FormatException('Invalid org-dartlang-app URI: $appUrl'); } - final relativeRoot = segments.skip(1).first; - final relativeUrl = segments.skip(2).join('/'); - final package = packageConfig.packages.firstWhere( - (Package p) => _getRelativeRoot(p.root) == relativeRoot, - ); - final resolvedUri = package.root.resolve(relativeUrl); - - return resolvedUri; + final first = segments.first; + if (first == 'packages') { + if (segments.length < 3) { + throw FormatException('Invalid package path in app URI: $appUrl'); + } + return segments.join('/'); + } + return segments.skip(1).join('/'); } - _logger.severe('Expected "packages/" path, but found $serverPath'); + return null; } -} -String stripLeadingSlashes(String path) { - while (path.startsWith('/') || path.startsWith('\\')) { - path = path.substring(1); + @override + String? serverPathToAppUri(String serverPath) { + // packages/foo/bar.dart -> package:foo/bar.dart + // web/main.dart -> web/main.dart + serverPath = stripLeadingSlashes(serverPath).replaceAll('\\', '/'); + if (!serverPath.startsWith('packages/')) return serverPath; + return serverPath.replaceFirst('packages/', 'package:'); } - return path; } -String? _getRelativeRoot(Uri root) => - root.pathSegments.lastWhereOrNull((segment) => segment.isNotEmpty); +final class FlutterPathResolver extends PathResolver { + FlutterPathResolver({ + super.packageConfig, + super.useDebuggerModuleNames = false, + super.packageRoot, + }) : super(loggerName: 'FlutterPathResolver'); + + @override + String? appUriToServerPath(String appUrl, {bool? useDebuggerModuleNames}) { + final useDebugger = useDebuggerModuleNames ?? this.useDebuggerModuleNames; + final isFlutterPackage = appUrl.startsWith('package:'); + + if (isFlutterPackage) { + // package:foo/bar.dart -> packages/foo/bar.dart + final appUri = Uri.parse(appUrl); + final pathSegments = appUri.pathSegments; + if (pathSegments.isEmpty) { + throw FormatException('Invalid package URI with empty path: $appUrl'); + } + final path = 'packages/${appUri.path}'; + return path; + } else { + final appUri = Uri.parse(appUrl); + if (appUri.isScheme('org-dartlang-app')) { + // org-dartlang-app:///web/main.dart -> web/main.dart + // org-dartlang-app:///packages/foo/bar.dart -> packages/foo/lib/bar.dart (useDebugger) + // org-dartlang-app:///packages/foo/lib/bar.dart -> packages/foo/bar.dart (!useDebugger) + final path = useDebugger + ? WebPathTranslator.addLibSegment(appUri.path.substring(1)) + : WebPathTranslator.removeLibSegment(appUri.path.substring(1)); + return path; + } + } + return null; + } + + @override + String? serverPathToAppUri(String serverPath) { + // packages/foo/lib/bar.dart -> package:foo/bar.dart + // packages/foo/bar.dart -> package:foo/bar.dart + // web/main.dart -> web/main.dart + serverPath = stripLeadingSlashes(serverPath).replaceAll('\\', '/'); + if (!serverPath.startsWith('packages/')) return serverPath; + return WebPathTranslator.packagePathToPackageUri(serverPath); + } +} diff --git a/dwds/lib/src/readers/frontend_server_asset_reader.dart b/dwds/lib/src/readers/frontend_server_asset_reader.dart index a87b459f3f..6dc36c3a10 100644 --- a/dwds/lib/src/readers/frontend_server_asset_reader.dart +++ b/dwds/lib/src/readers/frontend_server_asset_reader.dart @@ -5,6 +5,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:logging/logging.dart'; import 'package:package_config/package_config.dart'; @@ -21,6 +22,8 @@ class FrontendServerAssetReader implements AssetReader { final String _packageRoot; final Future _packageConfig; final String _basePath; + final AssetScheme _assetScheme; + final PathResolver _pathResolver; /// Map of Dart module server path to source map contents. final _mapContents = {}; @@ -42,8 +45,12 @@ class FrontendServerAssetReader implements AssetReader { required String outputPath, required String packageRoot, String? basePath, + AssetScheme? assetScheme, + PathResolver? pathResolver, }) : _packageRoot = packageRoot, _basePath = basePath ?? '', + _assetScheme = assetScheme ?? const FrontendServerAssetScheme(), + _pathResolver = pathResolver ?? FrontendServerPathResolver(), _mapOriginal = File('$outputPath.map'), _mapIncremental = File('$outputPath.incremental.map'), _jsonOriginal = File('$outputPath.json'), @@ -58,21 +65,25 @@ class FrontendServerAssetReader implements AssetReader { String get basePath => _basePath; @override - Future dartSourceContents(String serverPath) async { - if (serverPath.endsWith('.dart')) { - final packageConfig = await _packageConfig; + AssetScheme get assetScheme => _assetScheme; - Uri? fileUri; - if (serverPath.startsWith('packages/')) { - final packagePath = serverPath.replaceFirst('packages/', 'package:'); + @override + Future dartSourceContents(String serverPath) async { + serverPath = serverPath.replaceAll('\\', '/'); + final packageConfig = await _packageConfig; + var strippedPath = _stripBasePath(serverPath); + Uri? fileUri; + if (strippedPath.startsWith('packages/')) { + final packagePath = _pathResolver.serverPathToAppUri(strippedPath); + if (packagePath != null) { fileUri = packageConfig.resolve(Uri.parse(packagePath)); - } else { - fileUri = p.toUri(p.join(_packageRoot, serverPath)); - } - if (fileUri != null) { - final source = File(fileUri.toFilePath()); - if (source.existsSync()) return source.readAsString(); } + } else { + fileUri = p.toUri(p.join(_packageRoot, strippedPath)); + } + if (fileUri != null) { + final source = File(fileUri.toFilePath()); + if (source.existsSync()) return source.readAsString(); } _logger.severe('Cannot find source contents for $serverPath'); return null; @@ -80,13 +91,13 @@ class FrontendServerAssetReader implements AssetReader { @override Future sourceMapContents(String serverPath) async { - if (serverPath.endsWith('lib.js.map')) { - if (!serverPath.startsWith('/')) serverPath = '/$serverPath'; - // Strip the .map, sources are looked up by their js path. - serverPath = p.withoutExtension(serverPath); - if (_mapContents.containsKey(serverPath)) { - return _mapContents[serverPath]; - } + serverPath = serverPath.replaceAll('\\', '/'); + var strippedPath = _stripBasePath(serverPath); + if (!strippedPath.startsWith('/')) strippedPath = '/$strippedPath'; + // Strip the .map, sources are looked up by their js path. + strippedPath = p.withoutExtension(strippedPath); + if (_mapContents.containsKey(strippedPath)) { + return _mapContents[strippedPath]; } _logger.severe('Cannot find source map contents for $serverPath'); return null; @@ -128,6 +139,22 @@ class FrontendServerAssetReader implements AssetReader { throw UnimplementedError(); } + /// Strips the [_basePath] prefix from the [serverPath]. + /// + /// Example (if [_basePath] is 'foo/bar'): + /// - 'foo/bar/packages/path/src/utils.dart' -> 'packages/path/src/utils.dart' + String _stripBasePath(String serverPath) { + var strippedPath = stripLeadingSlashes(serverPath); + final strippedBasePath = stripLeadingSlashes(_basePath); + if (strippedBasePath.isNotEmpty && + strippedPath.startsWith(strippedBasePath)) { + strippedPath = stripLeadingSlashes( + strippedPath.substring(strippedBasePath.length), + ); + } + return strippedPath; + } + @override Future close() async {} } diff --git a/dwds/lib/src/readers/proxy_server_asset_reader.dart b/dwds/lib/src/readers/proxy_server_asset_reader.dart index 4225ba9bd9..285a239a83 100644 --- a/dwds/lib/src/readers/proxy_server_asset_reader.dart +++ b/dwds/lib/src/readers/proxy_server_asset_reader.dart @@ -5,6 +5,7 @@ import 'dart:convert'; import 'dart:io'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/readers/asset_reader.dart'; import 'package:http/http.dart' as http; import 'package:http/io_client.dart'; @@ -18,14 +19,16 @@ class ProxyServerAssetReader implements AssetReader { final Handler _handler; final http.Client? _client; + final AssetScheme _assetScheme; - ProxyServerAssetReader._(this._handler, this._client); + ProxyServerAssetReader._(this._handler, this._client, this._assetScheme); factory ProxyServerAssetReader( int assetServerPort, { String root = '', String host = 'localhost', bool isHttps = false, + AssetScheme? assetScheme, }) { final scheme = isHttps ? 'https://' : 'http://'; final inner = HttpClient() @@ -38,34 +41,35 @@ class ProxyServerAssetReader implements AssetReader { var url = '$scheme$host:$assetServerPort/'; if (root.isNotEmpty) url += '$root/'; final handler = proxyHandler(url, client: client); - return ProxyServerAssetReader._(handler, client); + return ProxyServerAssetReader._( + handler, + client, + assetScheme ?? const BuildRunnerAssetScheme(), + ); } - ProxyServerAssetReader.fromHandler(this._handler) : _client = null; + ProxyServerAssetReader.fromHandler(this._handler, {AssetScheme? assetScheme}) + : _client = null, + _assetScheme = assetScheme ?? const BuildRunnerAssetScheme(); @override String get basePath => ''; @override - Future dartSourceContents(String serverPath) => - _readResource(serverPath); + AssetScheme get assetScheme => _assetScheme; - @override - Future sourceMapContents(String serverPath) => - _readResource(serverPath); - - Future _readResource(String path) async { + Future _readResource(String serverPath) async { // Handlers expect a fully formed HTML URI. The actual hostname and port // does not matter. final request = Request( 'GET', - Uri.parse('http://foo:0000/$path'), + Uri.parse('http://foo:0000/$serverPath'), ).change(headers: {'requested-by': 'DWDS'}); final response = await _handler(request); if (response.statusCode != HttpStatus.ok) { _logger.warning(''' - Failed to load asset at path: $path. + Failed to load asset at path: $serverPath. Status code: ${response.statusCode} @@ -78,6 +82,14 @@ class ProxyServerAssetReader implements AssetReader { } } + @override + Future dartSourceContents(String serverPath) => + _readResource(serverPath); + + @override + Future sourceMapContents(String serverPath) => + _readResource(serverPath); + @override Future metadataContents(String serverPath) => _readResource(serverPath); diff --git a/dwds/lib/src/services/chrome/chrome_proxy_service.dart b/dwds/lib/src/services/chrome/chrome_proxy_service.dart index 1add07eece..49c0fc951e 100644 --- a/dwds/lib/src/services/chrome/chrome_proxy_service.dart +++ b/dwds/lib/src/services/chrome/chrome_proxy_service.dart @@ -415,7 +415,7 @@ final class ChromeProxyService extends ProxyService { }) { return wrapInErrorHandlerAsync( 'addBreakpoint', - () => _addBreakpoint(isolateId, scriptId, line), + () => _addBreakpoint(isolateId, scriptId, line, column: column), ); } diff --git a/dwds/lib/src/services/daemon_expression_compiler.dart b/dwds/lib/src/services/daemon_expression_compiler.dart new file mode 100644 index 0000000000..c69db4e27d --- /dev/null +++ b/dwds/lib/src/services/daemon_expression_compiler.dart @@ -0,0 +1,73 @@ +// Copyright (c) 2026, 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:async'; +import 'dart:convert'; + +import 'package:dwds/src/services/expression_compiler.dart'; + +/// An expression compiler that forwards expression compilation requests to the +/// build daemon. +/// +/// We assume the build daemon already has a Frontend Server intialized. +final class DaemonExpressionCompiler implements ExpressionCompiler { + final Future> Function(Map request) + _sendRequest; + + DaemonExpressionCompiler(this._sendRequest); + + @override + Future compileExpressionToJs( + String isolateId, + String libraryUri, + String scriptUri, + int line, + int column, + Map jsModules, + Map jsFrameValues, + String moduleName, + String expression, + ) async { + final requestJson = { + 'instruction': 'COMPILE_EXPRESSION_JS', + 'isolateId': isolateId, + 'libraryUri': libraryUri, + 'scriptUri': scriptUri, + 'line': line, + 'column': column, + 'jsModules': jsModules, + 'jsFrameValues': jsFrameValues, + 'moduleName': moduleName, + 'expression': expression, + }; + final responseJson = await _sendRequest(requestJson); + final expressionDataString = responseJson['expressionData'] as String?; + final errorMessage = responseJson['errorMessage'] as String?; + final errorCount = responseJson['errorCount'] as int? ?? 0; + + final isError = errorCount > 0 || expressionDataString == null; + + String result; + if (isError) { + result = errorMessage ?? 'Unknown compilation error'; + } else { + final bytes = base64.decode(expressionDataString); + result = utf8.decode(bytes); + } + + return ExpressionCompilationResult(result, isError); + } + + /// Not needed by [DaemonExpressionCompiler] since we assume that a shared + /// Frontend Server instance is already initialized. + @override + Future initialize(CompilerOptions options) async {} + + /// Not needed by [DaemonExpressionCompiler] since reloads are handled by + /// `reloaded_sources.json`, which are generated from build daemon's build + /// outputs. + @override + Future updateDependencies(Map modules) async => + true; +} diff --git a/dwds/lib/src/utilities/dart_uri.dart b/dwds/lib/src/utilities/dart_uri.dart index 3c0b6f9484..0f0fc3755f 100644 --- a/dwds/lib/src/utilities/dart_uri.dart +++ b/dwds/lib/src/utilities/dart_uri.dart @@ -3,6 +3,8 @@ // BSD-style license that can be found in the LICENSE file. import 'package:dwds/src/config/tool_configuration.dart'; +import 'package:dwds/src/utilities/shared.dart'; +import 'package:dwds/src/utilities/web_path_translator.dart'; import 'package:logging/logging.dart'; import 'package:package_config/package_config.dart'; import 'package:path/path.dart' as p; @@ -19,8 +21,8 @@ class DartUri { /// - package:packageName/pathUnderLib/file.dart /// - org-dartlang-app:///prefix/path/file.dart, where prefix is ignored. /// e.g. org-dartlang-app:example/hello_world/main.dart, - /// - /packages/packageName/foo.dart, the web server form of a package URI, - /// e.g. /packages/path/src/utils.dart + /// - /packages/packageName/foo.dart, the web server package path of a + /// package URI, e.g. /packages/path/src/utils.dart /// - /path/foo.dart or path/foo.dart, e.g. /hello_world/web/main.dart, where /// path is a web server path and so relative to the directory being /// served, not to the package. @@ -29,7 +31,11 @@ class DartUri { factory DartUri(String uri, [String? root]) { // TODO(annagrin): Support creating DartUris from `dart:` uris. // Issue: https://github.com/dart-lang/webdev/issues/1584 - if (uri.startsWith('org-dartlang-app:') || uri.startsWith('google3:')) { + if (uri.startsWith('org-dartlang-app:')) { + return DartUri._fromDartLangUri(uri, root: root); + } + if (uri.startsWith('google3:')) { + // TODO(markzipan): Determine if google3 needs [root] to be passed. return DartUri._fromDartLangUri(uri); } if (uri.startsWith('package:')) { @@ -42,20 +48,19 @@ class DartUri { return DartUri._fromRelativePath(uri, root: root); } if (uri.startsWith('/')) { - return DartUri._fromRelativePath(uri); + return DartUri._fromRelativePath(uri, root: root); } if (uri.startsWith('http:') || uri.startsWith('https:')) { - return DartUri(Uri.parse(uri).path); + return DartUri(Uri.parse(uri).path, root); } - - throw FormatException('Unsupported URI form: $uri'); + return DartUri._fromRelativePath(uri, root: root); } @override String toString() => 'DartUri: $serverPath'; - /// Construct from a package: URI - factory DartUri._fromDartLangUri(String uri) { + /// Construct from an app URI + factory DartUri._fromDartLangUri(String uri, {String? root}) { var serverPath = globalToolConfiguration.loadStrategy.serverPathForAppUri( uri, ); @@ -63,7 +68,7 @@ class DartUri { _logger.severe('Cannot find server path for $uri'); serverPath = uri; } - return DartUri._(serverPath); + return DartUri._fromRelativePath(serverPath, root: root); } /// Construct from a package: URI @@ -87,14 +92,90 @@ class DartUri { } /// Construct from a path, relative to the directory being served. + /// + /// [root] is the directory the app is served from (such as 'web') and is used + /// to translate served URI paths to their on-disk paths. factory DartUri._fromRelativePath(String uri, {String? root}) { - uri = uri[0] == '.' ? uri.substring(1) : uri; - uri = uri[0] == '/' ? uri.substring(1) : uri; + uri = _normalizeUri(uri); + // Strip the root from [uri]. + final basePath = _stripRoot(uri, root); + // Normalize package paths. + final normalizedPath = _normalizePackagePath(basePath); + // Re-attach root if needed. + final finalPath = _ensureRoot(normalizedPath, root); + return DartUri._(finalPath); + } + + /// Normalizes [uri] by converting backslashes and stripping leading + /// dots/slashes. + /// + /// Examples: + /// - `web\main.dart` -> `web/main.dart` + /// - `./web/main.dart` -> `web/main.dart` + /// - `/web/main.dart` -> `web/main.dart` + static String _normalizeUri(String uri) { + uri = uri.replaceAll('\\', '/'); + if (uri.startsWith('.')) uri = uri.substring(1); + if (uri.startsWith('/')) uri = uri.substring(1); + return uri; + } + + /// Strips the [root] prefix from the URI if it is present. + /// + /// Examples: + /// - `web/packages/foo.dart` (root: `web`) -> `packages/foo.dart` + /// - `packages/foo.dart` (root: `web`) -> `packages/foo.dart` + /// - `web/packages/foo.dart` (root: `/web`) -> `packages/foo.dart` + static String _stripRoot(String uri, String? root) { + if (root == null || root.isEmpty) return uri; + final cleanRoot = _getCleanRootPrefix(root); + if (cleanRoot.isEmpty) return uri; + return uri.startsWith(cleanRoot) ? uri.substring(cleanRoot.length) : uri; + } - if (root != null) { - return DartUri._fromRelativePath(p.url.join(root, uri)); + /// Ensures the URI starts with [root] if provided. + /// + /// Examples: + /// - `packages/foo.dart` (root: `web`) -> `web/packages/foo.dart` + /// - `web/packages/foo.dart` (root: `web`) -> `web/packages/foo.dart` + /// - `packages/foo.dart` (root: `/web`) -> `/web/packages/foo.dart` + static String _ensureRoot(String uri, String? root) { + if (root == null || root.isEmpty) return uri; + final cleanRoot = _getCleanRootPrefix(root); + if (cleanRoot.isEmpty || !uri.startsWith(cleanRoot)) { + return p.url.join(root, uri); } - return DartUri._(uri); + return uri; + } + + /// Cleans up and formats [root]. + /// + /// Examples: + /// - `web` -> `web/` + /// - `/web` -> `web/` + /// - `web/` -> `web/` + /// - `/` -> `` + static String _getCleanRootPrefix(String root) { + final cleanRoot = stripLeadingSlashes(root.replaceAll('\\', '/')); + if (cleanRoot.isEmpty) return ''; + return cleanRoot.endsWith('/') ? cleanRoot : '$cleanRoot/'; + } + + /// Normalizes package paths, considering project names and 'lib' segments. + /// + /// Examples: + /// - `lib/main.dart` -> `packages/my_app/main.dart` + /// - `packages/foo/bar.dart` -> `packages/foo/lib/bar.dart` (FrontendServer) + /// - `packages/foo/lib/bar.dart` -> `packages/foo/bar.dart` (BuildRunner) + static String _normalizePackagePath(String uri) { + uri = WebPathTranslator.translateLibPathToPackagePath( + uri, + globalToolConfiguration.appMetadata.workspaceName, + ); + return WebPathTranslator.canonicalizePackagePath( + uri, + globalToolConfiguration.loadStrategy, + ); } /// The canonical web server path part of the URI. diff --git a/dwds/lib/src/utilities/shared.dart b/dwds/lib/src/utilities/shared.dart index ba866644c8..206bd0098d 100644 --- a/dwds/lib/src/utilities/shared.dart +++ b/dwds/lib/src/utilities/shared.dart @@ -45,3 +45,10 @@ Future wrapInErrorHandlerAsync( ); }, test: (e) => e is! RPCError && e is! SentinelException); } + +String stripLeadingSlashes(String path) { + while (path.startsWith('/') || path.startsWith('\\')) { + path = path.substring(1); + } + return path; +} diff --git a/dwds/lib/src/utilities/web_path_translator.dart b/dwds/lib/src/utilities/web_path_translator.dart new file mode 100644 index 0000000000..fb1840b522 --- /dev/null +++ b/dwds/lib/src/utilities/web_path_translator.dart @@ -0,0 +1,194 @@ +// Copyright (c) 2026, 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:dwds/src/loaders/asset_scheme.dart'; +import 'package:dwds/src/loaders/strategy.dart'; + +/// Translates paths across DDC, Frontend Server, DWDS, and package:build. +class WebPathTranslator { + static const _fesScheme = FrontendServerAssetScheme(); + static const _buildRunnerScheme = BuildRunnerAssetScheme(); + + static String _modifyLibSegment(String serverPath, {required bool add}) { + serverPath = serverPath.replaceAll('\\', '/'); + if (!serverPath.startsWith('packages/')) return serverPath; + final segments = serverPath.split('/'); + if (segments.length > 2) { + final isLib = segments[2] == 'lib'; + if (add && !isLib) { + return 'packages/${segments[1]}/lib/${segments.skip(2).join('/')}'; + } + if (!add && isLib) { + return 'packages/${segments[1]}/${segments.skip(3).join('/')}'; + } + } + return serverPath; + } + + /// Adds 'lib' to a package path. + /// + /// Example: `packages/foo/bar.dart` -> `packages/foo/lib/bar.dart` + static String addLibSegment(String serverPath) => + _modifyLibSegment(serverPath, add: true); + + /// Removes 'lib' from a package path. + /// + /// Example: `packages/foo/lib/bar.dart` -> `packages/foo/bar.dart` + static String removeLibSegment(String serverPath) => + _modifyLibSegment(serverPath, add: false); + + /// Translates a 'lib/' path to a package path. + /// + /// DDC generates source maps with relative paths from the generated output. + /// Files in the root package can resolve to 'lib/' references, so we prepend + /// `packages/[rootPackageName]/` to resolve them to a package path. Example: + /// `lib/foo.dart` -> `packages/root_package/foo.dart` + static String translateLibPathToPackagePath( + String uri, + String? rootPackageName, + ) { + if (uri.startsWith('lib/')) { + if (rootPackageName == null || rootPackageName.isEmpty) { + throw StateError( + 'Cannot translate lib/ path without a root package name. URI: $uri', + ); + } + return 'packages/$rootPackageName/${uri.substring('lib/'.length)}'; + } + return uri; + } + + /// Converts a `packages/` server path to a `package:` URI string. + /// + /// Examples: + /// `packages/foo/lib/bar.dart` -> `package:foo/bar.dart` + /// `packages/foo/bar.dart` -> `package:foo/bar.dart` + static String? packagePathToPackageUri(String path) { + if (!path.startsWith('packages/')) return null; + final pathWithoutLib = removeLibSegment(path); + return 'package:${pathWithoutLib.substring('packages/'.length)}'; + } + + /// Canonicalizes a `packages/` server path using the provided [LoadStrategy]. + /// + /// Converts `packages/foo/lib/bar.dart` or `packages/foo/bar.dart` to the + /// load strategy's canonical server path. Otherwise returns [path]. + static String canonicalizePackagePath( + String path, + LoadStrategy loadStrategy, + ) { + if (!path.startsWith('packages/')) return path; + final packageUri = packagePathToPackageUri(path); + if (packageUri != null) { + final canonicalPath = loadStrategy.serverPathForAppUri(packageUri); + if (canonicalPath != null) { + var result = canonicalPath; + while (result.startsWith('/')) { + result = result.substring(1); + } + return result; + } + } + return path; + } + + /// Translates package paths between layouts based on asset schemes. + /// + /// For example, from [FrontendServerAssetScheme] to [BuildRunnerAssetScheme]: + /// `packages/foo/lib/bar.dart` -> `packages/foo/bar.dart` + /// From [BuildRunnerAssetScheme] to [FrontendServerAssetScheme]: + /// `packages/foo/bar.dart` -> `packages/foo/lib/bar.dart` + static String translatePackagePath( + String path, { + required AssetScheme from, + required AssetScheme to, + }) { + if (from is FrontendServerAssetScheme && to is BuildRunnerAssetScheme) { + return removeLibSegment(path); + } + if (from is BuildRunnerAssetScheme && to is FrontendServerAssetScheme) { + return addLibSegment(path); + } + return path; + } + + /// Maps module extensions between layouts based on asset schemes. + /// + /// For example, from [FrontendServerAssetScheme] to [BuildRunnerAssetScheme]: + /// `main.dart.lib` -> `main.ddc` + /// `main.dart.lib.js` -> `main.ddc.js` + static String translateModuleExtension( + String path, { + required AssetScheme from, + required AssetScheme to, + }) { + if (from.descriptorSuffix == to.descriptorSuffix) return path; + return path.replaceAll(from.descriptorSuffix, to.descriptorSuffix); + } + + /// Maps a Frontend Server suffix ('.dart.lib') to a package:build ('.ddc') + /// suffix. + static String translateFesToBuildRunnerPath(String path) { + final withoutLib = translatePackagePath( + path, + from: _fesScheme, + to: _buildRunnerScheme, + ); + return translateModuleExtension( + withoutLib, + from: _fesScheme, + to: _buildRunnerScheme, + ); + } + + /// Maps a package:build (build_runner) path to a Frontend Server path. + /// + /// Adds 'lib/' to package paths and replaces Build Runner suffixes with + /// Frontend Server suffixes (e.g. '.ddc' -> '.dart.lib'). + static String translateBuildRunnerToFesPath(String path) { + final withLib = translatePackagePath( + path, + from: _buildRunnerScheme, + to: _fesScheme, + ); + return translateModuleExtension( + withLib, + from: _buildRunnerScheme, + to: _fesScheme, + ); + } + + static const defaultWebDirs = ['web', 'test', 'example', 'benchmark']; + + /// Reconstructs the `org-dartlang-app:///` scheme for paths. + /// + /// This is required for relative sourcemaps emitted by the Frontend Server, + /// which lack a scheme (such as `/web/main.dart`). + static String reconstructAppScheme(String path, String scriptLocation) { + if (path.startsWith('org-dartlang-app:')) return path; + final normalizedPath = path.startsWith('/') ? path : '/$path'; + final isWebDir = defaultWebDirs.any( + (dir) => normalizedPath.startsWith('/$dir/'), + ); + if (isWebDir) { + // Example: + // scriptLocation: `/` + // path: `/web/main.dart` + // after: `org-dartlang-app:///web/main.dart` + return 'org-dartlang-app://$normalizedPath'; + } + if (scriptLocation.startsWith('/packages/') && + !normalizedPath.startsWith('/packages/')) { + // Example: + // scriptLocation: `/packages/my_package/subdir/main.ddc.js` + // path: `/lib/src/library.dart` + // after: `org-dartlang-app:///packages/my_package/src/library.dart` + final packageDir = scriptLocation.split('/').take(3).join('/'); + final relativePath = normalizedPath.startsWith('/lib/') + ? normalizedPath.substring('/lib/'.length) + : normalizedPath.substring(1); + return 'org-dartlang-app://$packageDir/$relativePath'; + } + return path; + } +} diff --git a/dwds/lib/src/version.dart b/dwds/lib/src/version.dart index e5c03848be..d3dcccae6c 100644 --- a/dwds/lib/src/version.dart +++ b/dwds/lib/src/version.dart @@ -1,2 +1,2 @@ // Generated code. Do not modify. -const packageVersion = '27.1.3-wip'; +const packageVersion = '28.0.0'; diff --git a/dwds/pubspec.yaml b/dwds/pubspec.yaml index 9089b186e5..c2bde53d57 100644 --- a/dwds/pubspec.yaml +++ b/dwds/pubspec.yaml @@ -1,6 +1,6 @@ name: dwds # Every time this changes you need to run `dart run tool/build.dart`. -version: 27.1.3-wip +version: 28.0.0 description: >- A service that proxies between the Chrome debug protocol and the Dart VM diff --git a/dwds/test/frontend_server_common/CHANGELOG-legacy.md b/dwds/test/frontend_server_common/CHANGELOG-legacy.md deleted file mode 100644 index b05b83a9f3..0000000000 --- a/dwds/test/frontend_server_common/CHANGELOG-legacy.md +++ /dev/null @@ -1,26 +0,0 @@ -## 0.2.3-wip - -- Update Dart SDK constraint to `^3.10.0`. -- Add bootstrapping code for DDC library bundle format. -- Added scriptUri to compileExpression*Request -- Adding `createReloadedSourceEntry` for sharing reloaded_sources.json entry logic. - -## 0.2.2 - -- Start the frontend server from the AOT snapshot shipped in the Dart SDK. - -## 0.2.1 - -- Doe not pass `-debugger-module-names` flag to the frontend server. - -## 0.2.0 - -- Migrate to null safety - -## 0.1.1 - -- Remove dead code - -## 0.1.0 - -- Initial version diff --git a/dwds/test/frontend_server_common/README.md b/dwds/test/frontend_server_common/README.md deleted file mode 100644 index 61862a5af1..0000000000 --- a/dwds/test/frontend_server_common/README.md +++ /dev/null @@ -1,14 +0,0 @@ -Dart Web Developer Service - -__*Note: Under heavy development.*__ - -This code is an edited copy of flutter code used for setting up frontend server -and components that are needed to communicate to Chrome and dwds: - -- frontend server client -- web runner -- dev fs -- asset server - -This eventually will transform into common code that both flutter and dwds use -for better integration. diff --git a/dwds/test/frontend_server_common/asset_server.dart b/dwds/test/frontend_server_common/asset_server.dart deleted file mode 100644 index ef39ff0b35..0000000000 --- a/dwds/test/frontend_server_common/asset_server.dart +++ /dev/null @@ -1,363 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Note: this is a copy from flutter tools, updated to work with dwds tests - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; -import 'dart:typed_data'; - -import 'package:dwds/asset_reader.dart'; -import 'package:dwds/config.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; -import 'package:file/file.dart'; -import 'package:logging/logging.dart'; -import 'package:mime/mime.dart' as mime; -import 'package:shelf/shelf.dart' as shelf; - -class TestAssetServer implements AssetReader { - late final String _basePath; - final String index; - - final _logger = Logger('TestAssetServer'); - - // Fallback to "application/octet-stream" on null which - // makes no claims as to the structure of the data. - static const String _defaultMimeType = 'application/octet-stream'; - final Uri _projectDirectory; - final FileSystem _fileSystem; - final HttpServer _httpServer; - final Map _files = {}; - final Map _sourceMaps = {}; - final Map _metadata = {}; - late String _mergedMetadata; - final PackageUriMapper _packageUriMapper; - final InternetAddress internetAddress; - final TestSdkLayout _sdkLayout; - - TestAssetServer( - this.index, - this._httpServer, - this._packageUriMapper, - this.internetAddress, - this._projectDirectory, - this._fileSystem, - this._sdkLayout, - ) { - _basePath = _parseBasePathFromIndexHtml(index); - } - - @override - String get basePath => _basePath; - - bool hasFile(String path) => _files.containsKey(path); - Uint8List getFile(String path) => _files[path]!; - - bool hasSourceMap(String path) => _sourceMaps.containsKey(path); - Uint8List getSourceMap(String path) => _sourceMaps[path]!; - - bool hasMetadata(String path) => _metadata.containsKey(path); - Uint8List getMetadata(String path) => _metadata[path]!; - - /// Start the web asset server on a [hostname] and [port]. - /// - /// Unhandled exceptions will throw a exception with the error and stack - /// trace. - static Future start( - String sdkDirectory, - Uri projectDirectory, - FileSystem fileSystem, - String index, - String hostname, - int port, - UrlEncoder? urlTunneler, - PackageUriMapper packageUriMapper, - ) async { - final address = (await InternetAddress.lookup(hostname)).first; - final httpServer = await HttpServer.bind(address, port); - final sdkLayout = TestSdkLayout.createDefault(sdkDirectory); - final server = TestAssetServer( - index, - httpServer, - packageUriMapper, - address, - projectDirectory, - fileSystem, - sdkLayout, - ); - return server; - } - - // handle requests for JavaScript source, dart sources maps, or asset files. - Future handleRequest(shelf.Request request) async { - if (request.method != 'GET') { - // Assets are served via GET only. - return shelf.Response.notFound(''); - } - final requestPath = _stripBasePath(request.url.path, basePath); - if (requestPath == null) { - return shelf.Response.notFound(''); - } - - final headers = {}; - - if (request.url.path.endsWith('.html')) { - final indexFile = _fileSystem.file(_projectDirectory.resolve(index)); - if (indexFile.existsSync()) { - headers[HttpHeaders.contentTypeHeader] = 'text/html'; - headers[HttpHeaders.contentLengthHeader] = indexFile - .lengthSync() - .toString(); - return shelf.Response.ok(indexFile.openRead(), headers: headers); - } - return shelf.Response.notFound(''); - } - - // If this is a JavaScript file, it must be in the in-memory cache. - // Attempt to look up the file by URI. - if (hasFile(requestPath)) { - final List bytes = getFile(requestPath); - headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); - headers[HttpHeaders.contentTypeHeader] = 'application/javascript'; - return shelf.Response.ok(bytes, headers: headers); - } - // If this is a sourcemap file, then it might be in the in-memory cache. - // Attempt to lookup the file by URI. - if (hasSourceMap(requestPath)) { - final List bytes = getSourceMap(requestPath); - headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); - headers[HttpHeaders.contentTypeHeader] = 'application/json'; - return shelf.Response.ok(bytes, headers: headers); - } - // If this is a metadata file, then it might be in the in-memory cache. - // Attempt to lookup the file by URI. - if (hasMetadata(requestPath)) { - final List bytes = getMetadata(requestPath); - headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); - headers[HttpHeaders.contentTypeHeader] = 'application/json'; - return shelf.Response.ok(bytes, headers: headers); - } - - final file = _resolveDartFile(requestPath); - if (!file.existsSync()) { - return shelf.Response.notFound(''); - } - - final length = file.lengthSync(); - // Attempt to determine the file's mime type. if this is not provided some - // browsers will refuse to render images/show video et cetera. If the tool - // cannot determine a mime type, fall back to application/octet-stream. - String? mimeType; - if (length >= 12) { - mimeType = mime.lookupMimeType( - file.path, - headerBytes: await file.openRead(0, 12).first, - ); - } - mimeType ??= _defaultMimeType; - headers[HttpHeaders.contentLengthHeader] = length.toString(); - headers[HttpHeaders.contentTypeHeader] = mimeType; - return shelf.Response.ok(file.openRead(), headers: headers); - } - - /// Tear down the http server running. - @override - Future close() { - return _httpServer.close(); - } - - /// Write a single file into the in-memory cache. - void writeFile(String filePath, String contents) { - _files[filePath] = Uint8List.fromList(utf8.encode(contents)); - } - - /// Update the in-memory asset server with the provided source and manifest - /// files. - /// - /// Returns a list of updated modules. - List write( - File codeFile, - File manifestFile, - File sourcemapFile, - File metadataFile, - ) { - final modules = []; - final codeBytes = codeFile.readAsBytesSync(); - final sourcemapBytes = sourcemapFile.readAsBytesSync(); - final metadataBytes = metadataFile.readAsBytesSync(); - final manifest = _castStringKeyedMap( - json.decode(manifestFile.readAsStringSync()), - ); - for (final filePath in manifest.keys) { - final offsets = _castStringKeyedMap(manifest[filePath]); - final codeOffsets = (offsets['code'] as List).cast(); - final sourcemapOffsets = (offsets['sourcemap'] as List) - .cast(); - final metadataOffsets = (offsets['metadata'] as List) - .cast(); - if (codeOffsets.length != 2 || - sourcemapOffsets.length != 2 || - metadataOffsets.length != 2) { - _logger.severe('Invalid manifest byte offsets: $offsets'); - continue; - } - - final codeStart = codeOffsets[0]; - final codeEnd = codeOffsets[1]; - if (codeStart < 0 || codeEnd > codeBytes.lengthInBytes) { - _logger.severe('Invalid byte index: [$codeStart, $codeEnd]'); - continue; - } - final byteView = Uint8List.view( - codeBytes.buffer, - codeStart, - codeEnd - codeStart, - ); - - final fileName = filePath.startsWith('/') - ? filePath.substring(1) - : filePath; - _files[fileName] = byteView; - - final sourcemapStart = sourcemapOffsets[0]; - final sourcemapEnd = sourcemapOffsets[1]; - if (sourcemapStart < 0 || sourcemapEnd > sourcemapBytes.lengthInBytes) { - _logger.severe('Invalid byte index: [$sourcemapStart, $sourcemapEnd]'); - continue; - } - final sourcemapView = Uint8List.view( - sourcemapBytes.buffer, - sourcemapStart, - sourcemapEnd - sourcemapStart, - ); - _sourceMaps['$fileName.map'] = sourcemapView; - - final metadataStart = metadataOffsets[0]; - final metadataEnd = metadataOffsets[1]; - if (metadataStart < 0 || metadataEnd > metadataBytes.lengthInBytes) { - _logger.severe('Invalid byte index: [$metadataStart, $metadataEnd]'); - continue; - } - final metadataView = Uint8List.view( - metadataBytes.buffer, - metadataStart, - metadataEnd - metadataStart, - ); - _metadata['$fileName.metadata'] = metadataView; - - modules.add(fileName); - } - - _mergedMetadata = _metadata.values - .map((Uint8List encoded) => utf8.decode(encoded)) - .join('\n'); - - return modules; - } - - // Attempt to resolve `path` to a dart file. - File _resolveDartFile(String path) { - // If this is a dart file, it must be on the local file system and is - // likely coming from a source map request. The tool doesn't currently - // consider the case of Dart files as assets. - final dartFile = _fileSystem.file(_projectDirectory.resolve(path)); - if (dartFile.existsSync()) { - return dartFile; - } - - final segments = path.split('/'); - - // The file might have been a package file which is signaled by a - // `/packages//` request. - if (segments.first == 'packages') { - var resolved = _packageUriMapper.serverPathToResolvedUri(path); - if (resolved != null) { - resolved = _projectDirectory.resolveUri(resolved); - } - final packageFile = _fileSystem.file(resolved); - if (packageFile.existsSync()) { - return packageFile; - } - _logger.severe('Package file not found: $path ($packageFile)'); - } - - // Otherwise it must be a Dart SDK source. - final dartSdkParent = _fileSystem.directory(_sdkLayout.sdkDirectory).parent; - final dartSdkFile = _fileSystem.file( - _fileSystem.path.joinAll([dartSdkParent.path, ...segments]), - ); - return dartSdkFile; - } - - @override - Future dartSourceContents(String serverPath) async { - final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - final result = _resolveDartFile(stripped); - if (result.existsSync()) { - return result.readAsString(); - } - } - _logger.severe('Source not found: $serverPath'); - return null; - } - - @override - Future sourceMapContents(String serverPath) async { - final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - if (hasSourceMap(stripped)) { - return utf8.decode(getSourceMap(stripped)); - } - } - _logger.severe('Source map not found: $serverPath'); - return null; - } - - @override - Future metadataContents(String serverPath) async { - final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - if (stripped.endsWith('.ddc_merged_metadata')) { - return _mergedMetadata; - } - if (hasMetadata(stripped)) { - return utf8.decode(getMetadata(stripped)); - } - } - _logger.severe('Metadata not found: $serverPath'); - return null; - } - - String _parseBasePathFromIndexHtml(String index) { - final file = _fileSystem.file(_projectDirectory.resolve(index)); - if (!file.existsSync()) { - throw StateError('Index file $index is not found'); - } - final contents = file.readAsStringSync(); - final matches = RegExp(r'').allMatches(contents); - if (matches.isEmpty) return ''; - return matches.first.group(1) ?? ''; - } - - String? _stripBasePath(String path, String basePath) { - path = stripLeadingSlashes(path); - if (path.startsWith(basePath)) { - path = path.substring(basePath.length); - } else { - // The given path isn't under base path, return null to indicate that. - _logger.severe('Path is not under $basePath: $path'); - return null; - } - return stripLeadingSlashes(path); - } -} - -/// Given a data structure which is a Map of String to dynamic values, return -/// the same structure (`Map`) with the correct runtime types. -Map _castStringKeyedMap(dynamic untyped) { - final map = untyped as Map; - return map.cast(); -} diff --git a/dwds/test/frontend_server_common/bootstrap.dart b/dwds/test/frontend_server_common/bootstrap.dart deleted file mode 100644 index 8efe76ec57..0000000000 --- a/dwds/test/frontend_server_common/bootstrap.dart +++ /dev/null @@ -1,573 +0,0 @@ -// Copyright 2020 The Dart Authors. 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:io' show Platform; - -// Note: this is a copy from flutter tools, updated to work with dwds tests - -/// JavaScript snippet to determine the base URL of the current path. -const String _baseUrlScript = ''' -var baseUrl = (function () { - // Attempt to detect --precompiled mode for tests, and set the base url - // appropriately, otherwise set it to '/'. - var pathParts = location.pathname.split("/"); - if (pathParts[0] == "") { - pathParts.shift(); - } - if (pathParts.length > 1 && pathParts[1] == "test") { - return "/" + pathParts.slice(0, 2).join("/") + "/"; - } - // Attempt to detect base url using html tag - // base href should start and end with "/" - if (typeof document !== 'undefined') { - var el = document.getElementsByTagName('base'); - if (el && el[0] && el[0].getAttribute("href") && el[0].getAttribute - ("href").startsWith("/") && el[0].getAttribute("href").endsWith("/")){ - return el[0].getAttribute("href"); - } - } - // return default value - return "/"; -}()); -var _trimmedBaseUrl = baseUrl.endsWith('/') ? baseUrl.substring(0, baseUrl.length - 1) : baseUrl; -var _currentDirectory = window.location.origin + _trimmedBaseUrl; -'''; - -/// Used to load prerequisite scripts such as ddc_module_loader.js -const String _simpleLoaderScript = r''' -window.$dartCreateScript = (function() { - // Find the nonce value. (Note, this is only computed once.) - var scripts = Array.from(document.getElementsByTagName("script")); - var nonce; - scripts.some( - script => (nonce = script.nonce || script.getAttribute("nonce"))); - // If present, return a closure that automatically appends the nonce. - if (nonce) { - return function() { - var script = document.createElement("script"); - script.nonce = nonce; - return script; - }; - } else { - return function() { - return document.createElement("script"); - }; - } -})(); - -// Loads a module [relativeUrl] relative to [root]. -// -// If not specified, [root] defaults to the directory serving the main app. -var forceLoadModule = function (relativeUrl, root) { - var actualRoot = root ?? _currentDirectory; - var trimmedRoot = actualRoot.endsWith('/') ? actualRoot.substring(0, actualRoot.length - 1) : actualRoot; - return new Promise(function(resolve, reject) { - var script = self.$dartCreateScript(); - let policy = { - createScriptURL: function(src) {return src;} - }; - if (self.trustedTypes && self.trustedTypes.createPolicy) { - policy = self.trustedTypes.createPolicy('dartDdcModuleUrl', policy); - } - script.onload = resolve; - script.onerror = reject; - script.src = policy.createScriptURL(trimmedRoot + "/" + relativeUrl); - document.head.appendChild(script); - }); -}; -'''; - -/// The JavaScript bootstrap script to support in-browser hot restart. -/// -/// The [requireUrl] loads our cached RequireJS script file. The [mapperUrl] -/// loads the special Dart stack trace mapper. The [entrypoint] is the -/// actual main.dart file. -/// -/// This file is served when the browser requests "main.dart.js" in debug mode, -/// and is responsible for bootstrapping the RequireJS modules and attaching -/// the hot reload hooks. -String generateBootstrapScript({ - required String requireUrl, - required String mapperUrl, - required String entrypoint, -}) { - return ''' -"use strict"; - -// Attach source mapping. -var mapperEl = document.createElement("script"); -mapperEl.defer = true; -mapperEl.async = false; -mapperEl.src = "$mapperUrl"; -document.head.appendChild(mapperEl); - -// Attach require JS. -var requireEl = document.createElement("script"); -requireEl.defer = true; -requireEl.async = false; -requireEl.src = "$requireUrl"; -// This attribute tells require JS what to load as main (defined below). -requireEl.setAttribute("data-main", "main_module.bootstrap"); -document.head.appendChild(requireEl); -'''; -} - -/// Generate a synthetic main module which captures the application's main -/// method. -/// -/// RE: Object.keys usage in app.main: -/// This attaches the main entrypoint and hot reload functionality to the -/// window. The app module will have a single property which contains the -/// actual application code. The property name is based off of the entrypoint -/// that is generated, for example the file `foo/bar/baz.dart` will generate a -/// property named approximately `foo__bar__baz`. Rather than attempt to guess, -/// we assume the first property of this object is the module. -String generateMainModule({required String entrypoint}) { - return '''/* ENTRYPOINT_EXTENTION_MARKER */ - -// Create the main module loaded below. -define("main_module.bootstrap", ["$entrypoint", "dart_sdk"], function(app, dart_sdk) { - dart_sdk._isolate_helper.startRootIsolate(() => {}, []); - dart_sdk._debugger.registerDevtoolsFormatter(); - let voidToNull = () => (voidToNull = dart_sdk.dart.constFn(dart_sdk.dart.fnType(dart_sdk.core.Null, [dart_sdk.dart.void])))(); - - // See the generateMainModule doc comment. - var child = {}; - child.main = app[Object.keys(app)[0]].main; - - /* MAIN_EXTENSION_MARKER */ - child.main(); -}); -'''; -} - -String generateDDCBootstrapScript({ - required String ddcModuleLoaderUrl, - required String mapperUrl, - required String entrypoint, - required String bootstrapUrl, -}) { - return ''' -$_baseUrlScript -$_simpleLoaderScript - -(function() { - let appName = "$entrypoint"; - - // A uuid that identifies a subapp. - let uuid = "00000000-0000-0000-0000-000000000000"; - - window.postMessage( - {type: "DDC_STATE_CHANGE", state: "initial_load", targetUuid: uuid}, "*"); - - // Load pre-requisite DDC scripts. We intentionally use invalid names to avoid namespace clashes. - let prerequisiteScripts = [ - { - "src": "$ddcModuleLoaderUrl", - "id": "dart_library \x00" - }, - { - "src": "$mapperUrl", - "id": "dart_stack_trace_mapper \x00" - } - ]; - - // Load ddc_module_loader.js to access DDC's module loader API. - let prerequisiteLoads = []; - for (let i = 0; i < prerequisiteScripts.length; i++) { - prerequisiteLoads.push(forceLoadModule(prerequisiteScripts[i].src)); - } - Promise.all(prerequisiteLoads).then((_) => afterPrerequisiteLogic()); - - // Save the current script so we can access it in a closure. - var _currentScript = document.currentScript; - - var afterPrerequisiteLogic = function() { - window.\$dartLoader.rootDirectories.push(_currentDirectory); - let scripts = [ - { - "src": "dart_sdk.js", - "id": "dart_sdk" - }, - { - "src": "$bootstrapUrl", - "id": "data-main" - } - ]; - let loadConfig = new window.\$dartLoader.LoadConfiguration(); - loadConfig.root = _currentDirectory; - loadConfig.bootstrapScript = scripts[scripts.length - 1]; - - if (window.\$dartJITModules) { - loadConfig.loadScriptFn = function(loader) { - // Loads just the entrypoint module and required SDK modules. - let moduleSet = new Set(); - // This cache is populated by ddc_module_loader.js - let libraryCache = JSON.parse(window.localStorage.getItem(`dartLibraryCache:\${appName}`)); - if (libraryCache) { - // TODO(b/165021238) - when should this be invalidated? - moduleSet = new Set(libraryCache["modules"]) - } - loader.addScriptsToQueue(scripts, function(script) { - // Preemptively load the ddc module loader and previously executed modules. - return moduleSet.size == 0 - || script.id.includes("dart_library") - // We preemptively load the stack_trace_mapper module so that we can - // translate JS errors to Dart. - || script.id.includes("stack_trace_mapper") - || moduleSet.has(script.id); - }); - loader.loadEnqueuedModules(); - } - loadConfig.ddcEventForLoadStart = /* LOAD_ENTRYPOINT_MODULES_START */ 4; - loadConfig.ddcEventForLoadedOk = /* LOAD_ENTRYPOINT_MODULES_END_OK */ 5; - loadConfig.ddcEventForLoadedError = /* LOAD_ENTRYPOINT_MODULES_END_ERROR */ 6; - } else { - loadConfig.loadScriptFn = function(loader) { - loader.addScriptsToQueue(scripts, null); - loader.loadEnqueuedModules(); - } - loadConfig.ddcEventForLoadStart = /* LOAD_ALL_MODULES_START */ 1; - loadConfig.ddcEventForLoadedOk = /* LOAD_ALL_MODULES_END_OK */ 2; - loadConfig.ddcEventForLoadedError = /* LOAD_ALL_MODULES_END_ERROR */ 3; - } - - let loader = new window.\$dartLoader.DDCLoader(loadConfig); - - // Record prerequisite scripts' fully resolved URLs. - prerequisiteScripts.forEach(script => loader.registerScript(script)); - - // Note: these variables should only be used in non-multi-app scenarios since - // they can be arbitrarily overridden based on multi-app load order. - window.\$dartLoader.loadConfig = loadConfig; - window.\$dartLoader.loader = loader; - loader.nextAttempt(); - - let currentUri = _currentScript.src; - let fetchEtagsUri; - if (currentUri.indexOf("?") == -1) { - fetchEtagsUri = currentUri + "?fetch-etags=true"; - } else { - fetchEtagsUri = currentUri + "&fetch-etags=true"; - } - - if (!window.\$dartAppNameToMetadata) { - window.\$dartAppNameToMetadata = new Map(); - } - window.\$dartAppNameToMetadata.set(appName, { - currentDirectory: _currentDirectory, - currentUri: currentUri, - fetchEtagsUri: fetchEtagsUri, - }); - - if (!window.\$dartReloadModifiedModules) { - window.\$dartReloadModifiedModules = (function(appName, callback) { - function cb() { - window.postMessage( - { - type: "DDC_STATE_CHANGE", - state: "restart_end", - targetUuid: uuid, - }, - "*"); - callback(); - } - window.postMessage( - { - type: "DDC_STATE_CHANGE", - state: "restart_begin", - targetUuid: uuid, - }, - "*"); - var xhttp = new XMLHttpRequest(); - xhttp.withCredentials = true; - xhttp.onreadystatechange = function() { - // https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/readyState - if (this.readyState == 4 && this.status == 200 || this.status == 304) { - var scripts = JSON.parse(this.responseText); - var numToLoad = 0; - var numLoaded = 0; - for (var i = 0; i < scripts.length; i++) { - var script = scripts[i]; - if (script.id == null) continue; - var src = - window.\$dartAppNameToMetadata.get(appName).currentDirectory + - script.src.toString(); - var oldSrc = window.\$dartLoader.moduleIdToUrl.get(script.id); - // Only compare the search parameters which contain the cache - // busting portion of the uri. The path might be different if the - // script is loaded from a different application on the page. - if (new URL(oldSrc).search == new URL(src).search) continue; - - // We might actually load from a different uri, delete the old one - // just to be sure. - window.\$dartLoader.urlToModuleId.delete(oldSrc); - - window.\$dartLoader.moduleIdToUrl.set(script.id, src); - window.\$dartLoader.urlToModuleId.set(src, script.id); - - if (window.\$dartJITModules) { - // Simply invalidate the import and the corresponding module will - // be lazily loaded. - dart_library.invalidateImport(script.id); - continue; - } else { - numToLoad++; - } - - var el = document.getElementById(script.id); - if (el) el.remove(); - el = window.\$dartCreateScript(); - el.src = policy.createScriptURL(src); - el.async = false; - el.defer = true; - el.id = script.id; - el.onload = function() { - numLoaded++; - if (numToLoad == numLoaded) cb(); - }; - document.head.appendChild(el); - } - // Call `cb` right away if we found no updated scripts. - if (numToLoad == 0) cb(); - } - }; - xhttp.open("GET", - window.\$dartAppNameToMetadata.get(appName).fetchEtagsUri, true); - let sdk = dart_library.import("dart_sdk", appName); - let developer = sdk.developer; - if (developer._extensions.containsKey("ext.flutter.disassemble")) { - developer.invokeExtension("ext.flutter.disassemble", "{}").then(() => { - // TODO(b/204210914): we should really be clearing all statics for all - // apps, but for now we just do it for flutter apps which we recognize - // based on this extension. - sdk.dart.hotRestart(); - xhttp.send(); - }); - } else { - xhttp.send(); - } - }); - } - } -})(); -'''; -} - -String generateDDCMainModule({ - required String entrypoint, - String? exportedMain, -}) { - final exportedMainName = exportedMain ?? entrypoint.split('.')[0]; - return '''/* ENTRYPOINT_EXTENTION_MARKER */ - -(function() { - let appName = "$entrypoint"; - - // A uuid that identifies a subapp. - let uuid = "00000000-0000-0000-0000-000000000000"; - - let dart_sdk = dart_library.import('dart_sdk', appName); - - dart_sdk._debugger.registerDevtoolsFormatter(); - dart_sdk._isolate_helper.startRootIsolate(() => {}, []); - - let child = {}; - child.main = function() { - dart_library.start(appName, uuid, "$entrypoint", "$exportedMainName"); - } - - /* MAIN_EXTENSION_MARKER */ - child.main(); -})(); -'''; -} - -String generateDDCLibraryBundleBootstrapScript({ - required String ddcModuleLoaderUrl, - required String mapperUrl, - required String entrypoint, - required String bootstrapUrl, -}) { - return ''' -$_baseUrlScript -$_simpleLoaderScript - -(function() { - let appName = "org-dartlang-app:/$entrypoint"; - - // Load pre-requisite DDC scripts. We intentionally use invalid names to avoid - // namespace clashes. - let prerequisiteScripts = [ - { - "src": "$ddcModuleLoaderUrl", - "id": "ddc_module_loader \x00" - }, - { - "src": "$mapperUrl", - "id": "dart_stack_trace_mapper \x00" - } - ]; - - // Load ddc_module_loader.js to access DDC's module loader API. - let prerequisiteLoads = []; - for (let i = 0; i < prerequisiteScripts.length; i++) { - prerequisiteLoads.push(forceLoadModule(prerequisiteScripts[i].src)); - } - Promise.all(prerequisiteLoads).then((_) => afterPrerequisiteLogic()); - - // Save the current script so we can access it in a closure. - var _currentScript = document.currentScript; - - // Create a policy if needed to load the files during a hot restart. - let policy = { - createScriptURL: function(src) {return src;} - }; - if (self.trustedTypes && self.trustedTypes.createPolicy) { - policy = self.trustedTypes.createPolicy('dartDdcModuleUrl', policy); - } - - var afterPrerequisiteLogic = function() { - window.\$dartLoader.rootDirectories.push(_currentDirectory); - let scripts = [ - { - "src": "dart_sdk.js", - "id": "dart_sdk" - }, - { - "src": "$bootstrapUrl", - "id": "data-main" - } - ]; - - let loadConfig = new window.\$dartLoader.LoadConfiguration(); - loadConfig.root = _currentDirectory; - - // TODO(srujzs): Verify this is sufficient for Windows. - loadConfig.isWindows = ${Platform.isWindows}; - loadConfig.bootstrapScript = scripts[scripts.length - 1]; - - loadConfig.loadScriptFn = function(loader) { - loader.addScriptsToQueue(scripts, null); - loader.loadEnqueuedModules(); - } - loadConfig.ddcEventForLoadStart = /* LOAD_ALL_MODULES_START */ 1; - loadConfig.ddcEventForLoadedOk = /* LOAD_ALL_MODULES_END_OK */ 2; - loadConfig.ddcEventForLoadedError = /* LOAD_ALL_MODULES_END_ERROR */ 3; - - let loader = new window.\$dartLoader.DDCLoader(loadConfig); - - // Record prerequisite scripts' fully resolved URLs. - prerequisiteScripts.forEach(script => loader.registerScript(script)); - - // Note: these variables should only be used in non-multi-app scenarios - // since they can be arbitrarily overridden based on multi-app load order. - window.\$dartLoader.loadConfig = loadConfig; - window.\$dartLoader.loader = loader; - - // Begin loading libraries - loader.nextAttempt(); - - // Set up stack trace mapper. - if (window.\$dartStackTraceUtility && - !window.\$dartStackTraceUtility.ready) { - window.\$dartStackTraceUtility.ready = true; - window.\$dartStackTraceUtility.setSourceMapProvider(function(url) { - var baseUrl = window.location.protocol + '//' + window.location.host; - url = url.replace(baseUrl + '/', ''); - if (url == 'dart_sdk.js') { - return dartDevEmbedder.debugger.getSourceMap('dart_sdk'); - } - url = url.replace(".lib.js", "").replace(".ddc.js", ""); - return dartDevEmbedder.debugger.getSourceMap(url); - }); - } - - if (!window.\$dartReloadModifiedModules) { - window.\$dartReloadModifiedModules = (function(filesToReload, appName) { - return new Promise(function(resolve) { - function callback() { - resolve(filesToReload); - } - let numToLoad = 0; - let numLoaded = 0; - for (let i = 0; i < filesToReload.length; i++) { - const file = filesToReload[i]; - const module = file.module; - if (module == null) continue; - const src = file.src; - const oldSrc = window.\$dartLoader.moduleIdToUrl.get(module); - - // We might actually load from a different uri, delete the old one - // just to be sure. - window.\$dartLoader.urlToModuleId.delete(oldSrc); - - window.\$dartLoader.moduleIdToUrl.set(module, src); - window.\$dartLoader.urlToModuleId.set(src, module); - - numToLoad++; - - let el = document.getElementById(module); - if (el) el.remove(); - el = window.\$dartCreateScript(); - el.src = policy.createScriptURL(src); - el.async = false; - el.defer = true; - el.id = module; - el.onload = function() { - numLoaded++; - if (numToLoad == numLoaded) callback(); - }; - document.head.appendChild(el); - } - // Call `callback` right away if we found no updated scripts. - if (numToLoad == 0) callback(); - }); - }); - } - }; -})(); -'''; -} - -const String _onLoadEndCallback = r'$onLoadEndCallback'; - -String generateDDCLibraryBundleMainModule({ - required String entrypoint, - required String onLoadEndBootstrap, -}) { - // The typo below in "EXTENTION" is load-bearing, package:build depends on it. - return ''' -/* ENTRYPOINT_EXTENTION_MARKER */ - -(function() { - let appName = "org-dartlang-app:///$entrypoint"; - - dartDevEmbedder.debugger.registerDevtoolsFormatter(); - - // Set up a final script that lets us know when all scripts have been loaded. - // Only then can we call the main method. - let onLoadEndSrc = '$onLoadEndBootstrap'; - window.\$dartLoader.loadConfig.bootstrapScript = { - src: onLoadEndSrc, - id: onLoadEndSrc, - }; - window.\$dartLoader.loadConfig.tryLoadBootstrapScript = true; - // Should be called by $onLoadEndBootstrap once all the scripts have been - // loaded. - window.$_onLoadEndCallback = function() { - let child = {}; - child.main = function() { - dartDevEmbedder.runMain(appName, {}); - } - /* MAIN_EXTENSION_MARKER */ - child.main(); - } -})(); -'''; -} - -String generateDDCLibraryBundleOnLoadEndBootstrap() { - return '''window.$_onLoadEndCallback();'''; -} diff --git a/dwds/test/frontend_server_common/devfs.dart b/dwds/test/frontend_server_common/devfs.dart deleted file mode 100644 index 1f7c018145..0000000000 --- a/dwds/test/frontend_server_common/devfs.dart +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Note: this is a copy from flutter tools, updated to work with dwds tests - -import 'dart:convert'; -import 'dart:io'; - -import 'package:dwds/asset_reader.dart'; -import 'package:dwds/config.dart'; -import 'package:dwds/expression_compiler.dart'; -// ignore: implementation_imports -import 'package:dwds/src/debugging/metadata/module_metadata.dart'; -import 'package:dwds/utilities.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; -import 'package:file/file.dart'; -import 'package:path/path.dart' as p; - -import 'asset_server.dart'; -import 'bootstrap.dart'; -import 'frontend_server_client.dart'; - -class WebDevFS { - WebDevFS({ - required this.fileSystem, - required this.hostname, - required this.port, - required this.projectDirectory, - required this.packageUriMapper, - required this.index, - this.urlTunneler, - required this.sdkLayout, - required this.compilerOptions, - }); - - final FileSystem fileSystem; - late final TestAssetServer assetServer; - final String hostname; - final int port; - final Uri projectDirectory; - final PackageUriMapper packageUriMapper; - final String index; - final UrlEncoder? urlTunneler; - List sources = []; - DateTime? lastCompiled; - - final TestSdkLayout sdkLayout; - final CompilerOptions compilerOptions; - - Future create() async { - assetServer = await TestAssetServer.start( - sdkLayout.sdkDirectory, - projectDirectory, - fileSystem, - index, - hostname, - port, - urlTunneler, - packageUriMapper, - ); - return Uri.parse('http://$hostname:$port'); - } - - Future dispose() { - return assetServer.close(); - } - - Future update({ - required Uri mainUri, - required String dillOutputPath, - required ResidentCompiler generator, - required List invalidatedFiles, - required bool initialCompile, - required bool fullRestart, - // The uri of the `HttpServer` that handles file requests. - // TODO(srujzs): This should be the same as the uri of the AssetServer to - // align with Flutter tools, but currently is not. Delete when that's fixed. - required Uri? fileServerUri, - }) async { - final mainPath = mainUri.toFilePath(); - final outputDirectory = fileSystem.directory( - fileSystem.file(projectDirectory.resolve(mainPath)).parent.path, - ); - final entryPoint = mainUri.toString(); - - var prefix = ''; - // If base path is not overwritten, use main's subdirectory - // to store all files, so the paths match the requests. - if (assetServer.basePath.isEmpty) { - final directory = p.dirname(entryPoint); - prefix = '$directory/'; - } - - if (initialCompile) { - final ddcModuleLoader = '${prefix}ddc_module_loader.js'; - final require = '${prefix}require.js'; - final stackMapper = '${prefix}stack_trace_mapper.js'; - final main = '${prefix}main.dart.js'; - final bootstrap = '${prefix}main_module.bootstrap.js'; - - assetServer.writeFile( - entryPoint, - fileSystem.file(projectDirectory.resolve(mainPath)).readAsStringSync(), - ); - assetServer.writeFile(stackMapper, stackTraceMapper.readAsStringSync()); - - switch (ddcModuleFormat) { - case ModuleFormat.amd: - assetServer.writeFile(require, requireJS.readAsStringSync()); - assetServer.writeFile( - main, - generateBootstrapScript( - requireUrl: 'require.js', - mapperUrl: 'stack_trace_mapper.js', - entrypoint: entryPoint, - ), - ); - assetServer.writeFile( - bootstrap, - generateMainModule(entrypoint: entryPoint), - ); - break; - case ModuleFormat.ddc: - assetServer.writeFile( - ddcModuleLoader, - ddcModuleLoaderJS.readAsStringSync(), - ); - String bootstrapper; - String mainModule; - if (compilerOptions.canaryFeatures) { - bootstrapper = generateDDCLibraryBundleBootstrapScript( - ddcModuleLoaderUrl: ddcModuleLoader, - mapperUrl: stackMapper, - entrypoint: entryPoint, - bootstrapUrl: bootstrap, - ); - const onLoadEndBootstrap = 'on_load_end_bootstrap.js'; - assetServer.writeFile( - onLoadEndBootstrap, - generateDDCLibraryBundleOnLoadEndBootstrap(), - ); - mainModule = generateDDCLibraryBundleMainModule( - entrypoint: entryPoint, - onLoadEndBootstrap: onLoadEndBootstrap, - ); - } else { - bootstrapper = generateDDCBootstrapScript( - ddcModuleLoaderUrl: ddcModuleLoader, - mapperUrl: stackMapper, - entrypoint: entryPoint, - bootstrapUrl: bootstrap, - ); - - // DDC uses a simple heuristic to determine exported identifier - // names. The module name (entrypoint name here) has its extension - // removed, and special path elements like '/', '\', and '..' are - // replaced with - // '__'. - final exportedMainName = pathToJSIdentifier( - entryPoint.split('.')[0], - ); - mainModule = generateDDCMainModule( - entrypoint: entryPoint, - exportedMain: exportedMainName, - ); - } - assetServer.writeFile(main, bootstrapper); - assetServer.writeFile(bootstrap, mainModule); - break; - default: - throw Exception('Unsupported DDC module format $ddcModuleFormat.'); - } - - assetServer.writeFile('main_module.digests', '{}'); - // Write an empty array of scripts to reload to handle the case where - // a test triggers a hot restart before any other action. - assetServer.writeFile('reloaded_sources.json', '[]'); - - final sdk = dartSdk; - final sdkSourceMap = dartSdkSourcemap; - assetServer.writeFile('dart_sdk.js', sdk.readAsStringSync()); - assetServer.writeFile('dart_sdk.js.map', sdkSourceMap.readAsStringSync()); - generator.reset(); - } - - final compilerOutput = await generator.recompile( - Uri.parse('org-dartlang-app:///$mainUri'), - invalidatedFiles, - outputPath: p.join(dillOutputPath, 'app.dill'), - packageConfig: packageUriMapper.packageConfig, - recompileRestart: fullRestart, - ); - if (compilerOutput == null || compilerOutput.errorCount > 0) { - return UpdateFSReport(success: false); - } - sources = compilerOutput.sources; - lastCompiled = DateTime.now(); - - File codeFile; - File manifestFile; - File sourcemapFile; - File metadataFile; - List modules; - try { - codeFile = outputDirectory.childFile( - '${compilerOutput.outputFilename}.sources', - ); - manifestFile = outputDirectory.childFile( - '${compilerOutput.outputFilename}.json', - ); - sourcemapFile = outputDirectory.childFile( - '${compilerOutput.outputFilename}.map', - ); - metadataFile = outputDirectory.childFile( - '${compilerOutput.outputFilename}.metadata', - ); - modules = assetServer.write( - codeFile, - manifestFile, - sourcemapFile, - metadataFile, - ); - } on FileSystemException catch (err) { - throw Exception('Failed to load recompiled sources:\n$err'); - } - if (ddcModuleFormat == ModuleFormat.ddc && - compilerOptions.canaryFeatures && - !initialCompile) { - writeReloadedSources(modules, fileServerUri!); - } - return UpdateFSReport( - success: true, - syncedBytes: codeFile.lengthSync(), - invalidatedSourcesCount: invalidatedFiles.length, - )..invalidatedModules = modules; - } - - static const String reloadedSourcesFileName = 'reloaded_sources.json'; - - /// Given a list of [modules] that need to be reloaded during a hot restart or - /// hot reload, writes a file that contains a list of objects each with three - /// fields: - /// - /// `src`: A string that corresponds to the file path containing a DDC library - /// bundle. - /// `module`: The name of the library bundle in `src`. - /// `libraries`: An array of strings containing the libraries that were - /// compiled in `src`. - /// - /// For example: - /// ```json - /// [ - /// { - /// "src": "/", - /// "module": "", - /// "libraries": ["", ""], - /// }, - /// ] - /// ``` - /// - /// The path of the output file should stay consistent across the lifetime of - /// the app. - void writeReloadedSources(List modules, Uri fileServerUri) { - final moduleToLibrary = >[]; - for (final module in modules) { - final metadata = ModuleMetadata.fromJson( - json.decode( - utf8.decode(assetServer.getMetadata('$module.metadata').toList()), - ) as Map, - ); - final libraries = metadata.libraries.keys.toList(); - moduleToLibrary.add( - createReloadedSourceEntry( - src: '$fileServerUri/$module', - module: metadata.name, - libraries: libraries, - ), - ); - } - assetServer.writeFile( - reloadedSourcesFileName, - json.encode(moduleToLibrary), - ); - } - - static Map createReloadedSourceEntry({ - required String src, - required String module, - required List libraries, - }) => {'src': src, 'module': module, 'libraries': libraries}; - - File get ddcModuleLoaderJS => - fileSystem.file(sdkLayout.ddcModuleLoaderJsPath); - File get requireJS => fileSystem.file(sdkLayout.requireJsPath); - File get dartSdk => fileSystem.file(switch (ddcModuleFormat) { - ModuleFormat.amd => sdkLayout.amdJsPath, - ModuleFormat.ddc => sdkLayout.ddcJsPath, - _ => throw Exception('Unsupported DDC module format $ddcModuleFormat.'), - }); - File get dartSdkSourcemap => fileSystem.file(switch (ddcModuleFormat) { - ModuleFormat.amd => sdkLayout.amdJsMapPath, - ModuleFormat.ddc => sdkLayout.ddcJsMapPath, - _ => throw Exception('Unsupported DDC module format $ddcModuleFormat.'), - }); - File get stackTraceMapper => fileSystem.file(sdkLayout.stackTraceMapperPath); - ModuleFormat get ddcModuleFormat => compilerOptions.moduleFormat; -} - -class UpdateFSReport { - final bool _success; - final int _invalidatedSourcesCount; - final int _syncedBytes; - - UpdateFSReport({ - this._success = false, - this._invalidatedSourcesCount = 0, - this._syncedBytes = 0, - }); - - bool get success => _success; - int get invalidatedSourcesCount => _invalidatedSourcesCount; - int get syncedBytes => _syncedBytes; - - /// JavaScript modules produced by the incremental compiler in `dartdevc` - /// mode. - /// - /// Only used for JavaScript compilation. - List? invalidatedModules; -} - -/// The result of an invalidation check from [ProjectFileInvalidator]. -class InvalidationResult { - const InvalidationResult({this.uris}); - - final List? uris; -} - -/// The [ProjectFileInvalidator] track the dependencies for a running -/// application to determine when they are dirty. -class ProjectFileInvalidator { - ProjectFileInvalidator({required this._fileSystem}); - - final FileSystem _fileSystem; - - static const String _pubCachePathLinuxAndMac = '.pub-cache'; - static const String _pubCachePathWindows = 'Pub/Cache'; - - Future findInvalidated({ - required DateTime? lastCompiled, - required List urisToMonitor, - required String packagesPath, - }) async { - if (lastCompiled == null) { - // Initial load. - assert(urisToMonitor.isEmpty); - return const InvalidationResult(uris: []); - } - - final urisToScan = [ - // Don't watch pub cache directories to speed things up a little. - for (final Uri uri in urisToMonitor) - if (_isNotInPubCache(uri)) uri, - ]; - final invalidatedFiles = []; - for (final uri in urisToScan) { - // Calling fs.statSync() is more performant than fs.file().statSync(), - // but uri.toFilePath() does not work with MultiRootFileSystem. - final updatedAt = uri.hasScheme && uri.scheme != 'file' - ? _fileSystem.file(uri).statSync().modified - : _fileSystem - .statSync(uri.toFilePath(windows: Platform.isWindows)) - .modified; - if (updatedAt.isAfter(lastCompiled)) { - invalidatedFiles.add(uri); - } - } - // We need to check the .dart_tool/package_config.json file too since it is - // not used in compilation. - final packageFile = _fileSystem.file(packagesPath); - final packageUri = packageFile.uri; - final updatedAt = packageFile.statSync().modified; - if (updatedAt.isAfter(lastCompiled)) { - invalidatedFiles.add(packageUri); - } - - return InvalidationResult(uris: invalidatedFiles); - } - - bool _isNotInPubCache(Uri uri) { - return !(Platform.isWindows && uri.path.contains(_pubCachePathWindows)) && - !uri.path.contains(_pubCachePathLinuxAndMac); - } -} diff --git a/dwds/test/frontend_server_common/frontend_server_client.dart b/dwds/test/frontend_server_common/frontend_server_client.dart deleted file mode 100644 index b2b13c605f..0000000000 --- a/dwds/test/frontend_server_common/frontend_server_client.dart +++ /dev/null @@ -1,728 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Note: this is a copy from flutter tools, updated to work with dwds tests - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:dwds/expression_compiler.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; -import 'package:logging/logging.dart'; -import 'package:package_config/package_config.dart'; - -import 'utilities.dart'; -import 'uuid.dart'; - -Logger _logger = Logger('FrontendServerClient'); -Logger _serverLogger = Logger('FrontendServer'); - -void defaultConsumer(String message, {StackTrace? stackTrace}) => - stackTrace == null - ? _serverLogger.info(message) - : _serverLogger.severe(message, null, stackTrace); - -typedef CompilerMessageConsumer = void Function( - String message, { - StackTrace stackTrace, -}); - -class CompilerOutput { - const CompilerOutput(this.outputFilename, this.errorCount, this.sources); - - final String outputFilename; - final int errorCount; - final List sources; -} - -enum StdoutState { collectDiagnostic, collectDependencies } - -/// Handles stdin/stdout communication with the frontend server. -class StdoutHandler { - StdoutHandler({required this.consumer}) { - reset(); - } - - final CompilerMessageConsumer consumer; - late Completer compilerOutput; - - final List _sources = []; - - bool _compilerMessageReceived = false; - String? _boundaryKey; - StdoutState _state = StdoutState.collectDiagnostic; - late bool _suppressCompilerMessages; - late bool _expectSources; - bool _badState = false; - - void handler(String message) { - if (message.startsWith('Observatory listening')) { - stderr.writeln(message); - return; - } - if (message.startsWith('Observatory server failed')) { - throw Exception(message); - } - if (_badState) { - return; - } - final kResultPrefix = 'result '; - if (_boundaryKey == null && message.startsWith(kResultPrefix)) { - _boundaryKey = message.substring(kResultPrefix.length); - return; - } - // Invalid state, see commented issue below for more information. - // NB: both the completeError and _badState flags are required to avoid - // filling the console with exceptions. - if (_boundaryKey == null) { - // Throwing a synchronous exception via throwToolExit will fail to cancel - // the stream. Instead use completeError so that the error is returned - // from the awaited future that the compiler consumers are expecting. - compilerOutput.completeError( - 'Frontend server tests encountered an internal problem. ' - 'This can be caused by printing to stdout into the stream that is ' - 'used for communication between frontend server (in sdk) or ' - 'frontend server client (in dwds tests).' - '\n\n' - 'Additional debugging information:\n' - ' StdoutState: $_state\n' - ' compilerMessageReceived: $_compilerMessageReceived\n' - ' message: $message\n' - ' _expectSources: $_expectSources\n' - ' sources: $_sources\n', - ); - // There are several event turns before the tool actually exits from a - // tool exception. Normally, the stream should be cancelled to prevent - // more events from entering the bad state, but because the error - // is coming from handler itself, there is no clean way to pipe this - // through. Instead, we set a flag to prevent more messages from - // registering. - _badState = true; - return; - } - final boundaryKey = _boundaryKey!; - if (message.startsWith(boundaryKey)) { - if (_expectSources) { - if (_state == StdoutState.collectDiagnostic) { - _state = StdoutState.collectDependencies; - return; - } - } - if (message.length <= boundaryKey.length) { - compilerOutput.complete(null); - return; - } - final spaceDelimiter = message.lastIndexOf(' '); - compilerOutput.complete( - CompilerOutput( - message.substring(boundaryKey.length + 1, spaceDelimiter), - int.parse(message.substring(spaceDelimiter + 1).trim()), - _sources, - ), - ); - return; - } - if (_state == StdoutState.collectDiagnostic) { - if (!_suppressCompilerMessages) { - if (_compilerMessageReceived == false) { - consumer('\nCompiler message:'); - _compilerMessageReceived = true; - } - consumer(message); - } - } else { - assert(_state == StdoutState.collectDependencies); - switch (message[0]) { - case '+': - _sources.add(Uri.parse(message.substring(1))); - break; - case '-': - _sources.remove(Uri.parse(message.substring(1))); - break; - default: - _logger.warning('Unexpected prefix for $message uri - ignoring'); - } - } - } - - // This is needed to get ready to process next compilation result output, - // with its own boundary key and new completer. - void reset({ - bool suppressCompilerMessages = false, - bool expectSources = true, - }) { - _boundaryKey = null; - _compilerMessageReceived = false; - compilerOutput = Completer(); - _suppressCompilerMessages = suppressCompilerMessages; - _expectSources = expectSources; - _state = StdoutState.collectDiagnostic; - } -} - -/// Class that allows to serialize compilation requests to the compiler. -abstract class _CompilationRequest { - _CompilationRequest(this.completer); - - Completer completer; - - Future _run(ResidentCompiler compiler); - - Future run(ResidentCompiler compiler) async { - completer.complete(await _run(compiler)); - } -} - -class _RecompileRequest extends _CompilationRequest { - _RecompileRequest( - super.completer, - this.mainUri, - this.invalidatedFiles, - this.outputPath, - this.packageConfig, { - required this.recompileRestart, - }); - - Uri mainUri; - List invalidatedFiles; - String outputPath; - PackageConfig packageConfig; - bool recompileRestart; - - @override - Future _run(ResidentCompiler compiler) async => - compiler._recompile(this); -} - -class _CompileExpressionRequest extends _CompilationRequest { - _CompileExpressionRequest( - super.completer, - this.expression, - this.definitions, - this.typeDefinitions, - this.libraryUri, - this.scriptUri, - this.klass, - this.isStatic, - ); - - String expression; - List definitions; - List typeDefinitions; - String? libraryUri; - String? scriptUri; - String? klass; - bool? isStatic; - - @override - Future _run(ResidentCompiler compiler) async => - compiler._compileExpression(this); -} - -class _CompileExpressionToJsRequest extends _CompilationRequest { - _CompileExpressionToJsRequest( - super.completer, - this.libraryUri, - this.scriptUri, - this.line, - this.column, - this.jsModules, - this.jsFrameValues, - this.moduleName, - this.expression, - ); - - String libraryUri; - String scriptUri; - int line; - int column; - Map jsModules; - Map jsFrameValues; - String moduleName; - String expression; - - @override - Future _run(ResidentCompiler compiler) async => - compiler._compileExpressionToJs(this); -} - -class _RejectRequest extends _CompilationRequest { - _RejectRequest(super.completer); - - @override - Future _run(ResidentCompiler compiler) async => - compiler._reject(); -} - -/// Wrapper around incremental frontend server compiler, that communicates with -/// server via stdin/stdout. -/// -/// The wrapper is intended to stay resident in memory as user changes, reloads, -/// restarts the Flutter app. -class ResidentCompiler { - ResidentCompiler( - this.sdkRoot, { - required this.projectDirectory, - required this.packageConfigFile, - required this.useDebuggerModuleNames, - required this.fileSystemRoots, - required this.fileSystemScheme, - required this.platformDill, - required this.compilerOptions, - required this.sdkLayout, - this.verbose = false, - CompilerMessageConsumer compilerMessageConsumer = defaultConsumer, - }) : _stdoutHandler = StdoutHandler(consumer: compilerMessageConsumer); - - final Uri projectDirectory; - final Uri packageConfigFile; - final bool useDebuggerModuleNames; - final List fileSystemRoots; - final String fileSystemScheme; - final String platformDill; - final TestSdkLayout sdkLayout; - final CompilerOptions compilerOptions; - final bool verbose; - - /// The path to the root of the Dart SDK used to compile. - final String sdkRoot; - - Process? _server; - final StdoutHandler _stdoutHandler; - bool _compileRequestNeedsConfirmation = false; - - final StreamController<_CompilationRequest> _controller = - StreamController<_CompilationRequest>(); - - /// If invoked for the first time, it compiles Dart script identified by - /// [mainUri], [invalidatedFiles] list is ignored. - /// On successive runs [invalidatedFiles] indicates which files need to be - /// recompiled. If [mainUri] is null, previously used [mainUri] entry - /// point that is used for recompilation. - /// Binary file name is returned if compilation was successful, otherwise - /// null is returned. - /// If [recompileRestart] is true, uses the `recompile-restart` instruction - /// instead of `recompile`. - Future recompile( - Uri mainUri, - List invalidatedFiles, { - required String outputPath, - required PackageConfig packageConfig, - required bool recompileRestart, - }) async { - if (!_controller.hasListener) { - _controller.stream.listen(_handleCompilationRequest); - } - - final completer = Completer(); - _controller.add( - _RecompileRequest( - completer, - mainUri, - invalidatedFiles, - outputPath, - packageConfig, - recompileRestart: recompileRestart, - ), - ); - return completer.future; - } - - Future _recompile(_RecompileRequest request) async { - _stdoutHandler.reset(); - - final mainUri = - request.packageConfig.toPackageUri(request.mainUri)?.toString() ?? - _toMultiRootPath(request.mainUri, fileSystemScheme, fileSystemRoots); - - _compileRequestNeedsConfirmation = true; - - if (_server == null) { - return _compile(mainUri, request.outputPath); - } - final server = _server!; - - final inputKey = generateV4UUID(); - final instruction = request.recompileRestart - ? 'recompile-restart' - : 'recompile'; - server.stdin.writeln('$instruction $mainUri $inputKey'); - _logger.info('<- $instruction $mainUri $inputKey'); - for (final fileUri in request.invalidatedFiles) { - String message; - if (fileUri.scheme == 'package') { - message = fileUri.toString(); - } else { - message = - request.packageConfig.toPackageUri(fileUri)?.toString() ?? - _toMultiRootPath(fileUri, fileSystemScheme, fileSystemRoots); - } - server.stdin.writeln(message); - _logger.info(message); - } - server.stdin.writeln(inputKey); - _logger.info('<- $inputKey'); - - return _stdoutHandler.compilerOutput.future; - } - - final List<_CompilationRequest> _compilationQueue = <_CompilationRequest>[]; - - Future _handleCompilationRequest(_CompilationRequest request) async { - final isEmpty = _compilationQueue.isEmpty; - _compilationQueue.add(request); - // Only trigger processing if queue was empty - i.e. no other requests - // are currently being processed. This effectively enforces "one - // compilation request at a time". - if (isEmpty) { - while (_compilationQueue.isNotEmpty) { - final request = _compilationQueue.first; - await request.run(this); - _compilationQueue.removeAt(0); - } - } - } - - Future _compile( - String scriptUri, - String outputFilePath, - ) async { - final frontendServer = sdkLayout.frontendServerSnapshotPath; - final args = [ - frontendServer, - '--sdk-root', - sdkRoot, - '--incremental', - '--target=dartdevc', - '-Ddart.developer.causal_async_stacks=true', - '--output-dill', - outputFilePath, - ...['--packages', '$packageConfigFile'], - for (final root in fileSystemRoots) ...[ - '--filesystem-root', - '$root', - ], - ...['--filesystem-scheme', fileSystemScheme], - ...['--platform', platformDill], - if (useDebuggerModuleNames) '--debugger-module-names', - '--experimental-emit-debug-metadata', - for (final experiment in compilerOptions.experiments) - '--enable-experiment=$experiment', - if (compilerOptions.canaryFeatures) '--dartdevc-canary', - if (verbose) '--verbose', - if (compilerOptions.moduleFormat == ModuleFormat.ddc) - '--dartdevc-module-format=ddc', - ]; - _logger.info(args.join(' ')); - final workingDirectory = projectDirectory.toFilePath(); - _server = await Process.start( - sdkLayout.dartAotRuntimePath, - args, - workingDirectory: workingDirectory, - ); - - final server = _server!; - server.stdout - .transform(utf8.decoder) - .transform(const LineSplitter()) - .listen( - _stdoutHandler.handler, - onDone: () { - // when outputFilename future is not completed, but stdout is closed - // process has died unexpectedly. - if (!_stdoutHandler.compilerOutput.isCompleted) { - _stdoutHandler.compilerOutput.complete(null); - throw Exception('the Dart compiler exited unexpectedly.'); - } - }, - ); - - server.stderr - .transform(utf8.decoder) - .transform(const LineSplitter()) - .listen(_logger.info); - - unawaited( - server.exitCode.then((int code) { - if (code != 0) { - throw Exception('the Dart compiler exited unexpectedly.'); - } - }), - ); - - server.stdin.writeln('compile $scriptUri'); - _logger.info('<- compile $scriptUri'); - - return _stdoutHandler.compilerOutput.future; - } - - /// Compile dart expression to kernel. - Future compileExpression( - String expression, - List definitions, - List typeDefinitions, - String libraryUri, - String scriptUri, - String klass, - bool isStatic, - ) { - if (!_controller.hasListener) { - _controller.stream.listen(_handleCompilationRequest); - } - - final completer = Completer(); - _controller.add( - _CompileExpressionRequest( - completer, - expression, - definitions, - typeDefinitions, - libraryUri, - scriptUri, - klass, - isStatic, - ), - ); - return completer.future; - } - - Future _compileExpression( - _CompileExpressionRequest request, - ) async { - _stdoutHandler.reset(suppressCompilerMessages: true, expectSources: false); - - // 'compile-expression' should be invoked after compiler has been started, - // program was compiled. - if (_server == null) { - return null; - } - final server = _server!; - - final inputKey = generateV4UUID(); - server.stdin.writeln('compile-expression $inputKey'); - server.stdin.writeln(request.expression); - request.definitions.forEach(server.stdin.writeln); - server.stdin.writeln(inputKey); - request.typeDefinitions.forEach(server.stdin.writeln); - server.stdin.writeln(inputKey); - server.stdin.writeln(request.libraryUri ?? ''); - server.stdin.writeln(request.klass ?? ''); - server.stdin.writeln(request.isStatic ?? false); - - return _stdoutHandler.compilerOutput.future; - } - - /// Compiles dart expression to JavaScript. - Future compileExpressionToJs( - String libraryUri, - String scriptUri, - int line, - int column, - Map jsModules, - Map jsFrameValues, - String moduleName, - String expression, - ) { - if (!_controller.hasListener) { - _controller.stream.listen(_handleCompilationRequest); - } - - final completer = Completer(); - _controller.add( - _CompileExpressionToJsRequest( - completer, - libraryUri, - scriptUri, - line, - column, - jsModules, - jsFrameValues, - moduleName, - expression, - ), - ); - return completer.future; - } - - Future _compileExpressionToJs( - _CompileExpressionToJsRequest request, - ) async { - _stdoutHandler.reset( - suppressCompilerMessages: !verbose, - expectSources: false, - ); - - // Compiling an expression should happen after the compiler has been - // started and the program was compiled. - if (_server == null) { - return null; - } - final server = _server!; - - server.stdin.writeln('JSON_INPUT'); - server.stdin.writeln( - json.encode({ - 'type': 'COMPILE_EXPRESSION_JS', - 'data': { - 'expression': request.expression, - 'libraryUri': request.libraryUri, - 'scriptUri': request.scriptUri, - 'line': request.line, - 'column': request.column, - 'jsModules': request.jsModules, - 'jsFrameValues': request.jsFrameValues, - 'moduleName': request.moduleName, - }, - }), - ); - - return _stdoutHandler.compilerOutput.future; - } - - /// Should be invoked when results of compilation are accepted by the client. - /// - /// Either [accept] or [reject] should be called after every [recompile] call. - void accept() { - if (_compileRequestNeedsConfirmation) { - _server!.stdin.writeln('accept'); - _logger.info('<- accept'); - } - _compileRequestNeedsConfirmation = false; - } - - /// Should be invoked when results of compilation are rejected by the client. - /// - /// Either [accept] or [reject] should be called after every [recompile] call. - Future reject() { - if (!_controller.hasListener) { - _controller.stream.listen(_handleCompilationRequest); - } - - final completer = Completer(); - _controller.add(_RejectRequest(completer)); - return completer.future; - } - - Future _reject() { - if (!_compileRequestNeedsConfirmation) { - return Future.value(null); - } - _stdoutHandler.reset(expectSources: false); - _server!.stdin.writeln('reject'); - _logger.info('<- reject'); - _compileRequestNeedsConfirmation = false; - return _stdoutHandler.compilerOutput.future; - } - - /// Should be invoked when frontend server compiler should forget what was - /// accepted previously so that next call to [recompile] produces complete - /// kernel file. - void reset() { - // TODO(annagrin): make sure this works when we support hot restart in - // tests using frontend server - for example, throw an error if the - // server is not available. - _server?.stdin.writeln('reset'); - _logger.info('<- reset'); - } - - Future quit() async { - _server?.stdin.writeln('quit'); - _logger.info('<- quit'); - - if (_server == null) { - return 0; - } - return _server!.exitCode; - } - - /// stop the service normally - Future shutdown() async { - // Server was never successfully created. - if (_server == null) { - return 0; - } - return quit(); - } - - /// kill the service - Future kill() async { - if (_server == null) { - return 0; - } - - final server = _server!; - _logger.info('killing pid ${server.pid}'); - server.kill(); - return server.exitCode; - } -} - -class TestExpressionCompiler implements ExpressionCompiler { - final ResidentCompiler _generator; - TestExpressionCompiler(this._generator); - - @override - Future compileExpressionToJs( - String isolateId, - String libraryUri, - String scriptUri, - int line, - int column, - Map jsModules, - Map jsFrameValues, - String moduleName, - String expression, - ) async { - final compilerOutput = await _generator.compileExpressionToJs( - libraryUri, - scriptUri, - line, - column, - jsModules, - jsFrameValues, - moduleName, - expression, - ); - - if (compilerOutput != null) { - final content = utf8.decode( - localFileSystem.file(compilerOutput.outputFilename).readAsBytesSync(), - ); - return ExpressionCompilationResult( - content, - compilerOutput.errorCount > 0, - ); - } - - throw Exception('Failed to compile $expression'); - } - - @override - Future updateDependencies(Map modules) async => - true; - - @override - Future initialize(CompilerOptions options) async {} -} - -/// Convert a file URI into a multi-root scheme URI if provided, otherwise -/// return unmodified. -String _toMultiRootPath( - Uri fileUri, - String? scheme, - List fileSystemRoots, -) { - if (scheme == null || fileSystemRoots.isEmpty || fileUri.scheme != 'file') { - return fileUri.toString(); - } - final filePath = fileUri.toFilePath(windows: Platform.isWindows); - for (final fileSystemRoot in fileSystemRoots) { - final rootPath = fileSystemRoot.toFilePath(windows: Platform.isWindows); - if (filePath.startsWith(rootPath)) { - return '$scheme:///${filePath.substring(rootPath.length)}'; - } - } - return fileUri.toString(); -} diff --git a/dwds/test/frontend_server_common/resident_runner.dart b/dwds/test/frontend_server_common/resident_runner.dart deleted file mode 100644 index 905d7c61db..0000000000 --- a/dwds/test/frontend_server_common/resident_runner.dart +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2020 The Dart Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Note: this is a copy from flutter tools, updated to work with dwds tests, -// and some functionality removed (does not support hot reload yet) - -import 'dart:async'; - -import 'package:dwds/asset_reader.dart'; -import 'package:dwds/config.dart'; -import 'package:dwds/expression_compiler.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; -import 'package:file/file.dart'; -import 'package:logging/logging.dart'; - -import 'devfs.dart'; -import 'frontend_server_client.dart'; - -class ResidentWebRunner { - final _logger = Logger('ResidentWebRunner'); - - ResidentWebRunner({ - required this.mainUri, - required this.urlTunneler, - required this.projectDirectory, - required this.packageConfigFile, - required this.packageUriMapper, - required this.fileSystemRoots, - required this.fileSystemScheme, - required this.outputPath, - required this.compilerOptions, - required this.sdkLayout, - bool verbose = false, - }) { - final platformDillUri = Uri.file(sdkLayout.summaryPath); - - generator = ResidentCompiler( - sdkLayout.sdkDirectory, - projectDirectory: projectDirectory, - packageConfigFile: packageConfigFile, - useDebuggerModuleNames: packageUriMapper.useDebuggerModuleNames, - platformDill: '$platformDillUri', - fileSystemRoots: fileSystemRoots, - fileSystemScheme: fileSystemScheme, - compilerOptions: compilerOptions, - sdkLayout: sdkLayout, - verbose: verbose, - ); - expressionCompiler = TestExpressionCompiler(generator); - } - - final UrlEncoder? urlTunneler; - final Uri mainUri; - final Uri projectDirectory; - final Uri packageConfigFile; - final PackageUriMapper packageUriMapper; - final String outputPath; - final List fileSystemRoots; - final String fileSystemScheme; - final CompilerOptions compilerOptions; - final TestSdkLayout sdkLayout; - - late ResidentCompiler generator; - late ExpressionCompiler expressionCompiler; - ProjectFileInvalidator? _projectFileInvalidator; - WebDevFS? devFS; - Uri? uri; - - Future run( - FileSystem fileSystem, { - String? hostname, - required int port, - required String index, - }) async { - _projectFileInvalidator ??= ProjectFileInvalidator(fileSystem: fileSystem); - devFS ??= WebDevFS( - fileSystem: fileSystem, - hostname: hostname ?? 'localhost', - port: port, - projectDirectory: projectDirectory, - packageUriMapper: packageUriMapper, - index: index, - urlTunneler: urlTunneler, - sdkLayout: sdkLayout, - compilerOptions: compilerOptions, - ); - uri ??= await devFS!.create(); - - final report = await _updateDevFS( - initialCompile: true, - fullRestart: false, - fileServerUri: null, - ); - if (!report.success) { - _logger.severe('Failed to compile application.'); - return 1; - } - - generator.accept(); - return 0; - } - - Future rerun({ - required bool fullRestart, - // The uri of the `HttpServer` that handles file requests. - // TODO(srujzs): This should be the same as the uri of the AssetServer to - // align with Flutter tools, but currently is not. Delete when that's fixed. - required Uri fileServerUri, - }) async { - final report = await _updateDevFS( - initialCompile: false, - fullRestart: fullRestart, - fileServerUri: fileServerUri, - ); - if (!report.success) { - _logger.severe('Failed to compile application.'); - return 1; - } - - generator.accept(); - return 0; - } - - Future _updateDevFS({ - required bool initialCompile, - required bool fullRestart, - // The uri of the `TestServer` that handles file requests. - // TODO(srujzs): This should be the same as the uri of the AssetServer to - // align with Flutter tools, but currently is not. Delete when that's fixed. - required Uri? fileServerUri, - }) async { - final invalidationResult = await _projectFileInvalidator!.findInvalidated( - lastCompiled: devFS!.lastCompiled, - urisToMonitor: devFS!.sources, - packagesPath: packageConfigFile.toFilePath(), - ); - final report = await devFS!.update( - mainUri: mainUri, - dillOutputPath: outputPath, - generator: generator, - invalidatedFiles: invalidationResult.uris!, - initialCompile: initialCompile, - fullRestart: fullRestart, - fileServerUri: fileServerUri, - ); - return report; - } - - Future stop() async { - await generator.shutdown(); - await devFS!.dispose(); - } -} diff --git a/dwds/test/frontend_server_common/utilities.dart b/dwds/test/frontend_server_common/utilities.dart deleted file mode 100644 index eddc3b40ac..0000000000 --- a/dwds/test/frontend_server_common/utilities.dart +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) 2019, 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:file/file.dart' as fs; -import 'package:file/local.dart'; - -const fs.FileSystem localFileSystem = LocalFileSystem(); diff --git a/dwds/test/frontend_server_common/uuid.dart b/dwds/test/frontend_server_common/uuid.dart deleted file mode 100644 index b375a98a1b..0000000000 --- a/dwds/test/frontend_server_common/uuid.dart +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2024, 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:math' show Random; - -/// A UUID generator. -/// -/// The generated values are 128 bit numbers encoded in a specific string -/// format. -/// -/// Generate a version 4 (random) uuid. This is a uuid scheme that only uses -/// random numbers as the source of the generated uuid. -String generateV4UUID() { - final special = 8 + _random.nextInt(4); - - return '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}-' - '${_bitsDigits(16, 4)}-' - '4${_bitsDigits(12, 3)}-' - '${_printDigits(special, 1)}${_bitsDigits(12, 3)}-' - '${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}${_bitsDigits(16, 4)}'; -} - -final Random _random = Random(); - -String _bitsDigits(int bitCount, int digitCount) => - _printDigits(_generateBits(bitCount), digitCount); - -int _generateBits(int bitCount) => _random.nextInt(1 << bitCount); - -String _printDigits(int value, int count) => - value.toRadixString(16).padLeft(count, '0'); diff --git a/dwds/test/integration/fixtures/frontend_server_context.dart b/dwds/test/integration/fixtures/frontend_server_context.dart index e125d95ed9..e6f7b7a05f 100644 --- a/dwds/test/integration/fixtures/frontend_server_context.dart +++ b/dwds/test/integration/fixtures/frontend_server_context.dart @@ -13,15 +13,14 @@ import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/utilities/server.dart'; import 'package:dwds_test_common/fixtures/context.dart'; import 'package:dwds_test_common/fixtures/utilities.dart'; +import 'package:dwds_test_common/frontend_server_common/asset_server.dart'; +import 'package:dwds_test_common/frontend_server_common/resident_runner.dart'; import 'package:dwds_test_common/utilities.dart'; import 'package:file/local.dart'; import 'package:logging/logging.dart' as logging; import 'package:path/path.dart' as p; import 'package:shelf/shelf.dart'; -import '../../frontend_server_common/asset_server.dart'; -import '../../frontend_server_common/resident_runner.dart'; - class FrontendServerTestContext extends TestContext { ResidentWebRunner? _webRunner; TestAssetServer? _assetReader; @@ -75,6 +74,7 @@ class FrontendServerTestContext extends TestContext { canaryFeatures: testSettings.canaryFeatures, isFlutterApp: testSettings.isFlutterApp, experiments: testSettings.experiments, + useDebuggerModuleNames: testSettings.useDebuggerModuleNames, ); final filePathToServe = webCompatiblePath([ @@ -88,7 +88,7 @@ class FrontendServerTestContext extends TestContext { p.join(project.webAssetsPath, project.dartEntryFileName), ); frontendServerFileSystem = const LocalFileSystem(); - final packageUriMapper = await PackageUriMapper.create( + final packageUriMapper = await FrontendServerPathResolver.create( frontendServerFileSystem, project.packageConfigFile, useDebuggerModuleNames: testSettings.useDebuggerModuleNames, @@ -130,33 +130,36 @@ class FrontendServerTestContext extends TestContext { _assetReader = webRunner.devFS!.assetServer; - _loadStrategy = switch (testSettings.moduleFormat) { - ModuleFormat.amd => FrontendServerRequireStrategyProvider( + _loadStrategy = switch (( + testSettings.moduleFormat, + buildSettings.canaryFeatures, + )) { + (ModuleFormat.amd, _) => FrontendServerRequireStrategyProvider( + testSettings.reloadConfiguration, + _assetReader!, + packageUriMapper, + () async => {}, + buildSettings, + ).strategy, + (ModuleFormat.ddc, true) => + FrontendServerDdcLibraryBundleStrategyProvider( + testSettings.reloadConfiguration, + _assetReader!, + packageUriMapper, + () async => {}, + buildSettings, + reloadedSourcesUri: reloadedSourcesUri, + ).strategy, + (ModuleFormat.ddc, false) => FrontendServerDdcStrategyProvider( testSettings.reloadConfiguration, - assetReader, + _assetReader!, packageUriMapper, () async => {}, buildSettings, ).strategy, - ModuleFormat.ddc => - buildSettings.canaryFeatures - ? FrontendServerDdcLibraryBundleStrategyProvider( - testSettings.reloadConfiguration, - assetReader, - packageUriMapper, - () async => {}, - buildSettings, - reloadedSourcesUri: reloadedSourcesUri, - ).strategy - : FrontendServerDdcStrategyProvider( - testSettings.reloadConfiguration, - assetReader, - packageUriMapper, - () async => {}, - buildSettings, - ).strategy, _ => throw Exception( - 'Unsupported DDC module format ${testSettings.moduleFormat.name}.', + 'Unsupported DDC module format ' + '${testSettings.moduleFormat.name}.', ), }; } diff --git a/dwds/test/integration/package_uri_mapper_test.dart b/dwds/test/integration/package_uri_mapper_test.dart index c27ef513ee..f362797497 100644 --- a/dwds/test/integration/package_uri_mapper_test.dart +++ b/dwds/test/integration/package_uri_mapper_test.dart @@ -33,7 +33,7 @@ void main() { final resolvedPath = '${project.packageDirectory}/lib/test_library.dart'; - late final PackageUriMapper packageUriMapper; + late final BuildRunnerPathResolver pathResolver; setUpAll(() async { await project.setUp(); // Note: Run `dart pub upgrade` before the test cases to fix @@ -51,7 +51,7 @@ void main() { ), ); - packageUriMapper = await PackageUriMapper.create( + pathResolver = await BuildRunnerPathResolver.create( fileSystem, packageConfigFile, useDebuggerModuleNames: useDebuggerModuleNames, @@ -61,12 +61,15 @@ void main() { tearDownAll(project.tearDown); test('Can convert package urls to server paths', () { - expect(packageUriMapper.packageUriToServerPath(packageUri), serverPath); + expect( + pathResolver.appUriToServerPath(packageUri.toString()), + serverPath, + ); }); test('Can convert server paths to file paths', () { expect( - packageUriMapper.serverPathToResolvedUri(serverPath), + pathResolver.serverPathToResolvedUri(serverPath), isA() .having((uri) => uri.scheme, 'scheme', 'file') .having((uri) => uri.path, 'path', endsWith(resolvedPath)), diff --git a/dwds/web/client.dart b/dwds/web/client.dart index 89a91b8409..ee2cfb48bf 100644 --- a/dwds/web/client.dart +++ b/dwds/web/client.dart @@ -201,7 +201,7 @@ Future? main() { } else if (reloadConfiguration == 'ReloadConfiguration.hotRestart') { if (dartModuleStrategy == 'ddc-library-bundle') { - await manager.hotRestartBegin(hotRestartReloadedSourcesPath!); + await manager.hotRestartBegin(hotRestartReloadedSourcesPath); manager.hotRestartEnd(); } else { await manager.hotRestart( @@ -535,7 +535,7 @@ Future handleWebSocketHotRestartRequest( try { final runId = const Uuid().v4(); if (manager.supportsTwoPhaseHotRestart) { - await manager.hotRestartBegin(hotRestartReloadedSourcesPath!); + await manager.hotRestartBegin(hotRestartReloadedSourcesPath); manager.hotRestartEnd(); } else { // TODO(nshahan): Remove after migrating to hotRestartBegin/hotRestartEnd. @@ -626,14 +626,7 @@ external String? get _reloadedSourcesPath; String? get hotRestartReloadedSourcesPath => _reloadedSourcesPath; -String get hotReloadReloadedSourcesPath { - final path = _reloadedSourcesPath; - assert( - path != null, - "Expected 'reloadedSourcesPath' to not be null in a hot reload.", - ); - return path!; -} +String? get hotReloadReloadedSourcesPath => _reloadedSourcesPath; /// Debugger-initiated hot restart. // TODO(nshahan): Remove after migrating to hotRestartBegin/hotRestartEnd. diff --git a/dwds/web/reloader/ddc_library_bundle_restarter.dart b/dwds/web/reloader/ddc_library_bundle_restarter.dart index 630890bb0c..d63a6b6f10 100644 --- a/dwds/web/reloader/ddc_library_bundle_restarter.dart +++ b/dwds/web/reloader/ddc_library_bundle_restarter.dart @@ -133,10 +133,14 @@ class DdcLibraryBundleRestarter implements Restarter, TwoPhaseRestarter { } @override - Future> hotRestartBegin(String reloadedSourcesPath) async { + Future> hotRestartBegin(String? reloadedSourcesPath) async { + assert( + reloadedSourcesPath != null, + "Expected 'reloadedSourcesPath' to not be null in a hot restart.", + ); await _dartDevEmbedder.debugger.maybeInvokeFlutterDisassemble(); final srcModuleLibraries = await _getSrcModuleLibraries( - reloadedSourcesPath, + reloadedSourcesPath!, ); final jsFilesToRequest = srcModuleLibraries.jsify() as JSArray; final requestedJsFiles = await _dartDevEmbedder @@ -149,11 +153,15 @@ class DdcLibraryBundleRestarter implements Restarter, TwoPhaseRestarter { void hotRestartEnd() => _dartDevEmbedder.hotRestartEnd(); @override - Future> hotReloadStart(String reloadedSourcesPath) async { + Future> hotReloadStart(String? reloadedSourcesPath) async { + assert( + reloadedSourcesPath != null, + "Expected 'reloadedSourcesPath' to not be null in a hot reload.", + ); final filesToLoad = JSArray(); final librariesToReload = JSArray(); final srcModuleLibraries = await _getSrcModuleLibraries( - reloadedSourcesPath, + reloadedSourcesPath!, ); for (final srcModuleLibrary in srcModuleLibraries) { final srcModuleLibraryCast = srcModuleLibrary.cast(); @@ -169,7 +177,18 @@ class DdcLibraryBundleRestarter implements Restarter, TwoPhaseRestarter { (JSFunction hotReloadEndCallback) { _capturedHotReloadEndCallback = hotReloadEndCallback; }.toJS; - await _dartDevEmbedder.hotReload(filesToLoad, librariesToReload).toDart; + final result = await _dartDevEmbedder + .hotReload(filesToLoad, librariesToReload) + .toDart; + _dartDevEmbedder.debugger.invokeExtension( + 'ext.dwds.sendEvent', + '{"type": "hotReloadResult", "result": "$result"}', + ); + if (result != null && + result.typeofEquals('boolean') && + !(result as JSBoolean).toDart) { + throw Exception('Hot reload rejected by DDC'); + } return srcModuleLibraries.jsify() as JSArray; } diff --git a/dwds/web/reloader/ddc_restarter.dart b/dwds/web/reloader/ddc_restarter.dart index 696f4e4f81..d10d0e2f65 100644 --- a/dwds/web/reloader/ddc_restarter.dart +++ b/dwds/web/reloader/ddc_restarter.dart @@ -59,13 +59,17 @@ class DdcRestarter implements Restarter { } @override - Future hotReloadEnd() => throw UnimplementedError( - 'Hot reload is not supported for the DDC module format.', - ); + Future hotReloadEnd() async { + // No-op for DDC. + } @override - Future> hotReloadStart(String reloadedSourcesPath) => - throw UnimplementedError( - 'Hot reload is not supported for the DDC module format.', - ); + Future> hotReloadStart(String? reloadedSourcesPath) async { + if (reloadedSourcesPath == null || reloadedSourcesPath.isEmpty) { + return JSArray(); + } + throw UnimplementedError( + 'Hot reload is not supported for the DDC module format.', + ); + } } diff --git a/dwds/web/reloader/manager.dart b/dwds/web/reloader/manager.dart index f1f7ac1544..eb123d5e14 100644 --- a/dwds/web/reloader/manager.dart +++ b/dwds/web/reloader/manager.dart @@ -66,7 +66,7 @@ class ReloadingManager { bool get supportsTwoPhaseHotRestart => _restarter is TwoPhaseRestarter; - Future> hotRestartBegin(String reloadedSourcesPath) async { + Future> hotRestartBegin(String? reloadedSourcesPath) async { final requestedSources = await (_restarter as TwoPhaseRestarter) .hotRestartBegin(reloadedSourcesPath); // Notify package:dwds that the isolate is exiting and a new isolate will @@ -107,7 +107,7 @@ class ReloadingManager { /// `module`: The name of the library bundle in `src`. /// `libraries`: An array of strings containing the libraries that were /// compiled in `src`. - Future> hotReloadStart(String reloadedSourcesPath) => + Future> hotReloadStart(String? reloadedSourcesPath) => _restarter.hotReloadStart(reloadedSourcesPath); /// Does a hard reload of the application. diff --git a/dwds/web/reloader/require_restarter.dart b/dwds/web/reloader/require_restarter.dart index 61ba853035..af01bd2372 100644 --- a/dwds/web/reloader/require_restarter.dart +++ b/dwds/web/reloader/require_restarter.dart @@ -170,15 +170,19 @@ class RequireRestarter implements Restarter { } @override - Future hotReloadEnd() => throw UnimplementedError( - 'Hot reload is not supported for the AMD module format.', - ); + Future hotReloadEnd() async { + // No-op for AMD. + } @override - Future> hotReloadStart(String reloadedSourcesPath) => - throw UnimplementedError( - 'Hot reload is not supported for the AMD module format.', - ); + Future> hotReloadStart(String? reloadedSourcesPath) async { + if (reloadedSourcesPath == null || reloadedSourcesPath.isEmpty) { + return JSArray(); + } + throw UnimplementedError( + 'Hot reload is not supported for the AMD module format.', + ); + } Future _runMainWhenReady(Future? readyToRunMain) async { if (readyToRunMain != null) { diff --git a/dwds/web/reloader/restarter.dart b/dwds/web/reloader/restarter.dart index 1810cca2db..0b0460b3ff 100644 --- a/dwds/web/reloader/restarter.dart +++ b/dwds/web/reloader/restarter.dart @@ -17,7 +17,7 @@ abstract class TwoPhaseRestarter implements Restarter { /// /// Passes the [reloadedSourcesPath] through to the `DartDevEmbedder` and /// bubbles up the returned array of scripts that were actually requested. - Future> hotRestartBegin(String reloadedSourcesPath); + Future> hotRestartBegin(String? reloadedSourcesPath); /// Finishes the hot restart operation that must have been previously started /// by [hotRestartBegin]. @@ -83,5 +83,5 @@ abstract class Restarter { /// `module`: The name of the library bundle in `src`. /// `libraries`: An array of strings containing the libraries that were /// compiled in `src`. - Future> hotReloadStart(String reloadedSourcesPath); + Future> hotReloadStart(String? reloadedSourcesPath); } diff --git a/dwds_test_common/lib/fixtures/context.dart b/dwds_test_common/lib/fixtures/context.dart index f2671b1c0c..15b5f0dfbe 100644 --- a/dwds_test_common/lib/fixtures/context.dart +++ b/dwds_test_common/lib/fixtures/context.dart @@ -20,6 +20,7 @@ import 'package:dwds/src/utilities/dart_uri.dart'; import 'package:dwds/src/utilities/server.dart'; import 'package:http/http.dart'; import 'package:http/io_client.dart'; +import 'package:http/retry.dart'; import 'package:logging/logging.dart' as logging; import 'package:path/path.dart' as p; import 'package:shelf/shelf.dart' as shelf; @@ -80,6 +81,8 @@ abstract class TestContext { Process get chromeDriver => _chromeDriver!; Process? _chromeDriver; + Process? fesProcess; + bool lastBuildFailed = false; WebkitDebugger get webkitDebugger => _webkitDebugger!; late WebkitDebugger? _webkitDebugger; @@ -162,11 +165,17 @@ abstract class TestContext { configureLogWriter(); - _client = IOClient( - HttpClient() - ..maxConnectionsPerHost = 200 - ..idleTimeout = const Duration(seconds: 30) - ..connectionTimeout = const Duration(seconds: 30), + _client = RetryClient( + IOClient( + HttpClient() + ..maxConnectionsPerHost = 200 + ..idleTimeout = const Duration(seconds: 30) + ..connectionTimeout = const Duration(seconds: 30), + ), + whenError: (error, stackTrace) { + _logger.warning('Retrying request due to network error: $error'); + return true; + }, ); final systemTempDir = Directory.systemTemp; @@ -448,7 +457,7 @@ abstract class TestContext { if (Platform.isWindows) { await Future.delayed(const Duration(seconds: 1)); } - _reloadedSources.clear(); + reloadedSources.clear(); for (var (:file, :originalString, :newString) in edits) { if (file == project.dartEntryFileName) { file = project.dartEntryFilePath; @@ -509,7 +518,7 @@ abstract class TestContext { ); } - _reloadedSources.add({ + reloadedSources.add({ 'src': '/$srcPath.ddc.js', 'module': moduleName, 'libraries': [libUri], @@ -520,7 +529,7 @@ abstract class TestContext { /// /// Used by the DDC Library Bundle module system to record changed files for /// hot restart/reload. - final _reloadedSources = >[]; + final reloadedSources = >[]; void addLibraryFile({required String libFileName, required String contents}) { final file = File(project.dartLibFilePath(libFileName)); @@ -536,7 +545,7 @@ abstract class TestContext { return (request) { final path = request.url.path; if (path.endsWith(reloadedSourcesFileName)) { - return shelf.Response.ok(jsonEncode(_reloadedSources)); + return shelf.Response.ok(jsonEncode(reloadedSources)); } return proxy(request); }; @@ -549,6 +558,7 @@ abstract class TestContext { Future waitForSuccessfulBuild({ Duration? timeout, bool propagateToBrowser = false, + bool allowFailure = false, }) => throw UnsupportedError( 'waitForSuccessfulBuild is only supported in Build Daemon mode', ); @@ -691,8 +701,51 @@ String _resolveChromeDriverExecutable() => _resolveExecutable( fallbackName: _chromeDriverName, ); -String _resolveChromeExecutable() => _resolveExecutable( - environmentKeys: const ['CHROME_EXECUTABLE', 'CHROME_PATH'], - sdkRelativePath: 'third_party/browsers/chrome/chrome/$_chromeExecutableName', - fallbackName: _chromeExecutableName, -); +String _resolveChromeExecutable() { + for (final env in const ['CHROME_EXECUTABLE', 'CHROME_PATH']) { + if (Platform.environment.containsKey(env)) { + return Platform.environment[env]!; + } + } + final sdkPath = _sdkRoot + .resolve('third_party/browsers/chrome/chrome/$_chromeExecutableName') + .toFilePath(); + if (File(sdkPath).existsSync()) { + return sdkPath; + } + if (Platform.isWindows) { + final defaultWindowsPaths = [ + if (Platform.environment.containsKey('PROGRAMFILES')) + p.join( + Platform.environment['PROGRAMFILES']!, + r'Google\Chrome\Application\chrome.exe', + ), + if (Platform.environment.containsKey('PROGRAMFILES(X86)')) + p.join( + Platform.environment['PROGRAMFILES(X86)']!, + r'Google\Chrome\Application\chrome.exe', + ), + if (Platform.environment.containsKey('LOCALAPPDATA')) + p.join( + Platform.environment['LOCALAPPDATA']!, + r'Google\Chrome\Application\chrome.exe', + ), + r'C:\Program Files\Google\Chrome\Application\chrome.exe', + r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe', + ]; + for (final path in defaultWindowsPaths) { + if (File(path).existsSync()) { + return path; + } + } + return 'chrome.exe'; + } + if (Platform.isMacOS) { + const defaultMacPath = + '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; + if (File(defaultMacPath).existsSync()) { + return defaultMacPath; + } + } + return _chromeExecutableName; +} diff --git a/dwds_test_common/lib/fixtures/fakes.dart b/dwds_test_common/lib/fixtures/fakes.dart index 0b90d0e163..6757b54096 100644 --- a/dwds_test_common/lib/fixtures/fakes.dart +++ b/dwds_test_common/lib/fixtures/fakes.dart @@ -15,6 +15,7 @@ import 'package:dwds/src/debugging/modules.dart'; import 'package:dwds/src/debugging/remote_debugger.dart'; import 'package:dwds/src/debugging/webkit_debugger.dart'; import 'package:dwds/src/handlers/socket_connections.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:dwds/src/loaders/require.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/services/expression_compiler.dart'; @@ -217,6 +218,7 @@ class FakeWebkitDebugger implements WebkitDebugger { (MetadataProvider _) async => {}, FakeAssetReader(), buildSettings, + const BuildRunnerAssetScheme(), ), ), ); @@ -355,6 +357,9 @@ class FakeStrategy extends LoadStrategy { appEntrypoint: Uri.parse('package:myapp/main.dart'), ); + @override + AssetScheme get assetScheme => const BuildRunnerAssetScheme(); + @override Future bootstrapFor(String entrypoint) async => 'dummy_bootstrap'; @@ -424,26 +429,36 @@ class FakeStrategy extends LoadStrategy { class FakeAssetReader implements AssetReader { String? metadata; - final String? _dartSource; - final String? _sourceMap; - FakeAssetReader({this.metadata, this._dartSource, this._sourceMap}); + final String? dartSource; + final String? sourceMap; + final AssetScheme _assetScheme; + + FakeAssetReader({ + this.metadata, + this.dartSource, + this.sourceMap, + AssetScheme? assetScheme, + }) : _assetScheme = assetScheme ?? const FrontendServerAssetScheme(); @override String get basePath => ''; @override - Future dartSourceContents(String serverPath) { - return _throwUnimplementedOrReturnContents(_dartSource); + AssetScheme get assetScheme => _assetScheme; + + @override + Future dartSourceContents(String serverPath) async { + return _throwUnimplementedOrReturnContents(dartSource); } @override - Future metadataContents(String serverPath) { - return _throwUnimplementedOrReturnContents(metadata); + Future sourceMapContents(String serverPath) async { + return _throwUnimplementedOrReturnContents(sourceMap); } @override - Future sourceMapContents(String serverPath) { - return _throwUnimplementedOrReturnContents(_sourceMap); + Future metadataContents(String serverPath) async { + return _throwUnimplementedOrReturnContents(metadata); } @override diff --git a/dwds_test_common/lib/fixtures/utilities.dart b/dwds_test_common/lib/fixtures/utilities.dart index d36d901aee..c1e3a26a74 100644 --- a/dwds_test_common/lib/fixtures/utilities.dart +++ b/dwds_test_common/lib/fixtures/utilities.dart @@ -261,6 +261,7 @@ class TestBuildSettings extends BuildSettings { super.canaryFeatures, super.isFlutterApp, super.experiments, + super.useDebuggerModuleNames, }); const TestBuildSettings.dart({Uri? appEntrypoint}) @@ -274,11 +275,14 @@ class TestBuildSettings extends BuildSettings { bool? canaryFeatures, bool? isFlutterApp, List? experiments, + bool? useDebuggerModuleNames, }) => TestBuildSettings( appEntrypoint: appEntrypoint ?? this.appEntrypoint, canaryFeatures: canaryFeatures ?? this.canaryFeatures, isFlutterApp: isFlutterApp ?? this.isFlutterApp, experiments: experiments ?? this.experiments, + useDebuggerModuleNames: + useDebuggerModuleNames ?? this.useDebuggerModuleNames, ); } diff --git a/dwds_test_common/lib/frontend_server_common/asset_server.dart b/dwds_test_common/lib/frontend_server_common/asset_server.dart index ef39ff0b35..35e045d7ed 100644 --- a/dwds_test_common/lib/frontend_server_common/asset_server.dart +++ b/dwds_test_common/lib/frontend_server_common/asset_server.dart @@ -11,12 +11,14 @@ import 'dart:typed_data'; import 'package:dwds/asset_reader.dart'; import 'package:dwds/config.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; +import 'package:dwds/src/loaders/asset_scheme.dart'; import 'package:file/file.dart'; import 'package:logging/logging.dart'; import 'package:mime/mime.dart' as mime; import 'package:shelf/shelf.dart' as shelf; +import '../test_sdk_layout.dart'; + class TestAssetServer implements AssetReader { late final String _basePath; final String index; @@ -33,9 +35,10 @@ class TestAssetServer implements AssetReader { final Map _sourceMaps = {}; final Map _metadata = {}; late String _mergedMetadata; - final PackageUriMapper _packageUriMapper; + final PathResolver _packageUriMapper; final InternetAddress internetAddress; final TestSdkLayout _sdkLayout; + final AssetScheme _assetScheme; TestAssetServer( this.index, @@ -44,14 +47,18 @@ class TestAssetServer implements AssetReader { this.internetAddress, this._projectDirectory, this._fileSystem, - this._sdkLayout, - ) { + this._sdkLayout, { + AssetScheme? assetScheme, + }) : _assetScheme = assetScheme ?? const FrontendServerAssetScheme() { _basePath = _parseBasePathFromIndexHtml(index); } @override String get basePath => _basePath; + @override + AssetScheme get assetScheme => _assetScheme; + bool hasFile(String path) => _files.containsKey(path); Uint8List getFile(String path) => _files[path]!; @@ -73,7 +80,7 @@ class TestAssetServer implements AssetReader { String hostname, int port, UrlEncoder? urlTunneler, - PackageUriMapper packageUriMapper, + PathResolver packageUriMapper, ) async { final address = (await InternetAddress.lookup(hostname)).first; final httpServer = await HttpServer.bind(address, port); @@ -103,6 +110,22 @@ class TestAssetServer implements AssetReader { final headers = {}; + var lookupPath = requestPath; + // Frontend Server tests may cache files under their 'lib/' path instead + // of their fully qualified served path. + // E.g., "packages/foo/bar.dart" and "lib/bar.dart". + if (lookupPath.startsWith('packages/')) { + final parts = lookupPath.split('/'); + if (parts.length > 2) { + final candidate = 'lib/${parts.sublist(2).join('/')}'; + if (_files.containsKey(candidate) || + _sourceMaps.containsKey('$candidate.map') || + _metadata.containsKey('$candidate.metadata')) { + lookupPath = candidate; + } + } + } + if (request.url.path.endsWith('.html')) { final indexFile = _fileSystem.file(_projectDirectory.resolve(index)); if (indexFile.existsSync()) { @@ -117,24 +140,24 @@ class TestAssetServer implements AssetReader { // If this is a JavaScript file, it must be in the in-memory cache. // Attempt to look up the file by URI. - if (hasFile(requestPath)) { - final List bytes = getFile(requestPath); + if (hasFile(lookupPath)) { + final List bytes = getFile(lookupPath); headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); headers[HttpHeaders.contentTypeHeader] = 'application/javascript'; return shelf.Response.ok(bytes, headers: headers); } // If this is a sourcemap file, then it might be in the in-memory cache. // Attempt to lookup the file by URI. - if (hasSourceMap(requestPath)) { - final List bytes = getSourceMap(requestPath); + if (hasSourceMap(lookupPath)) { + final List bytes = getSourceMap(lookupPath); headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); headers[HttpHeaders.contentTypeHeader] = 'application/json'; return shelf.Response.ok(bytes, headers: headers); } // If this is a metadata file, then it might be in the in-memory cache. // Attempt to lookup the file by URI. - if (hasMetadata(requestPath)) { - final List bytes = getMetadata(requestPath); + if (hasMetadata(lookupPath)) { + final List bytes = getMetadata(lookupPath); headers[HttpHeaders.contentLengthHeader] = bytes.length.toString(); headers[HttpHeaders.contentTypeHeader] = 'application/json'; return shelf.Response.ok(bytes, headers: headers); @@ -173,6 +196,11 @@ class TestAssetServer implements AssetReader { _files[filePath] = Uint8List.fromList(utf8.encode(contents)); } + /// Delete a single file from the in-memory cache. + void deleteFile(String filePath) { + _files.remove(filePath); + } + /// Update the in-memory asset server with the provided source and manifest /// files. /// @@ -259,6 +287,20 @@ class TestAssetServer implements AssetReader { // Attempt to resolve `path` to a dart file. File _resolveDartFile(String path) { + // Expression evaluation and debugger requests may reference sources + // using `package:` URIs. Resolve them to files using the packageConfig. + if (path.startsWith('package:')) { + final serverPath = _packageUriMapper.appUriToServerPath(path); + if (serverPath != null) { + final resolved = _packageUriMapper.serverPathToResolvedUri(serverPath); + if (resolved != null) { + final packageFile = _fileSystem.file(resolved); + if (packageFile.existsSync()) { + return packageFile; + } + } + } + } // If this is a dart file, it must be on the local file system and is // likely coming from a source map request. The tool doesn't currently // consider the case of Dart files as assets. @@ -294,11 +336,10 @@ class TestAssetServer implements AssetReader { @override Future dartSourceContents(String serverPath) async { final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - final result = _resolveDartFile(stripped); - if (result.existsSync()) { - return result.readAsString(); - } + if (stripped == null) return null; + final result = _resolveDartFile(stripped); + if (result.existsSync()) { + return result.readAsString(); } _logger.severe('Source not found: $serverPath'); return null; @@ -307,10 +348,9 @@ class TestAssetServer implements AssetReader { @override Future sourceMapContents(String serverPath) async { final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - if (hasSourceMap(stripped)) { - return utf8.decode(getSourceMap(stripped)); - } + if (stripped == null) return null; + if (hasSourceMap(stripped)) { + return utf8.decode(getSourceMap(stripped)); } _logger.severe('Source map not found: $serverPath'); return null; @@ -319,15 +359,13 @@ class TestAssetServer implements AssetReader { @override Future metadataContents(String serverPath) async { final stripped = _stripBasePath(serverPath, basePath); - if (stripped != null) { - if (stripped.endsWith('.ddc_merged_metadata')) { - return _mergedMetadata; - } - if (hasMetadata(stripped)) { - return utf8.decode(getMetadata(stripped)); - } + if (stripped == null) return null; + if (stripped.endsWith('.ddc_merged_metadata')) { + return _mergedMetadata; + } + if (hasMetadata(stripped)) { + return utf8.decode(getMetadata(stripped)); } - _logger.severe('Metadata not found: $serverPath'); return null; } @@ -344,6 +382,9 @@ class TestAssetServer implements AssetReader { String? _stripBasePath(String path, String basePath) { path = stripLeadingSlashes(path); + // Requests starting with 'packages/' are top-level and served relative + // to the root directory, so they don't contain the app's base path. + if (path.startsWith('packages/')) return path; if (path.startsWith(basePath)) { path = path.substring(basePath.length); } else { diff --git a/dwds_test_common/lib/frontend_server_common/devfs.dart b/dwds_test_common/lib/frontend_server_common/devfs.dart index a7800f38a1..a9991f4736 100644 --- a/dwds_test_common/lib/frontend_server_common/devfs.dart +++ b/dwds_test_common/lib/frontend_server_common/devfs.dart @@ -10,13 +10,12 @@ import 'dart:io'; import 'package:dwds/asset_reader.dart'; import 'package:dwds/config.dart'; import 'package:dwds/expression_compiler.dart'; -// ignore: implementation_imports import 'package:dwds/src/debugging/metadata/module_metadata.dart'; import 'package:dwds/utilities.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; import 'package:file/file.dart'; import 'package:path/path.dart' as p; +import '../test_sdk_layout.dart'; import 'asset_server.dart'; import 'bootstrap.dart'; import 'frontend_server_client.dart'; @@ -39,7 +38,7 @@ class WebDevFS { final String hostname; final int port; final Uri projectDirectory; - final PackageUriMapper packageUriMapper; + final PathResolver packageUriMapper; final String index; final UrlEncoder? urlTunneler; List sources = []; @@ -188,10 +187,11 @@ class WebDevFS { Uri.parse('org-dartlang-app:///$mainUri'), invalidatedFiles, outputPath: p.join(dillOutputPath, 'app.dill'), - packageConfig: packageUriMapper.packageConfig, + packageConfig: packageUriMapper.packageConfig!, recompileRestart: fullRestart, ); if (compilerOutput == null || compilerOutput.errorCount > 0) { + assetServer.deleteFile('reloaded_sources.json'); return UpdateFSReport(success: false); } sources = compilerOutput.sources; diff --git a/dwds_test_common/lib/frontend_server_common/frontend_server_client.dart b/dwds_test_common/lib/frontend_server_common/frontend_server_client.dart index 9c3ee5d2c1..ccfce39b3a 100644 --- a/dwds_test_common/lib/frontend_server_common/frontend_server_client.dart +++ b/dwds_test_common/lib/frontend_server_common/frontend_server_client.dart @@ -9,10 +9,10 @@ import 'dart:convert'; import 'dart:io'; import 'package:dwds/expression_compiler.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; import 'package:logging/logging.dart'; import 'package:package_config/package_config.dart'; +import '../test_sdk_layout.dart'; import 'utilities.dart'; import 'uuid.dart'; @@ -411,7 +411,9 @@ class ResidentCompiler { if (compilerOptions.canaryFeatures) '--dartdevc-canary', if (verbose) '--verbose', if (compilerOptions.moduleFormat == ModuleFormat.ddc) - '--dartdevc-module-format=ddc', + '--dartdevc-module-format=ddc' + else if (compilerOptions.moduleFormat == ModuleFormat.amd) + '--dartdevc-module-format=amd', ]; _logger.info(args.join(' ')); final workingDirectory = projectDirectory.toFilePath(); @@ -444,8 +446,12 @@ class ResidentCompiler { unawaited( server.exitCode.then((int code) { - if (code != 0) { - throw Exception('the Dart compiler exited unexpectedly.'); + // Ignore exit codes that signal expected process termination: + // -9 (SIGKILL), -15 (SIGTERM), and 255 (process killed). + if (code != 0 && code != -9 && code != -15 && code != 255) { + throw Exception( + 'the Dart compiler exited unexpectedly with exit code: $code.', + ); } }), ); diff --git a/dwds_test_common/lib/frontend_server_common/resident_runner.dart b/dwds_test_common/lib/frontend_server_common/resident_runner.dart index 905d7c61db..fda6cc1cac 100644 --- a/dwds_test_common/lib/frontend_server_common/resident_runner.dart +++ b/dwds_test_common/lib/frontend_server_common/resident_runner.dart @@ -10,10 +10,10 @@ import 'dart:async'; import 'package:dwds/asset_reader.dart'; import 'package:dwds/config.dart'; import 'package:dwds/expression_compiler.dart'; -import 'package:dwds_test_common/test_sdk_layout.dart'; import 'package:file/file.dart'; import 'package:logging/logging.dart'; +import '../test_sdk_layout.dart'; import 'devfs.dart'; import 'frontend_server_client.dart'; @@ -54,7 +54,7 @@ class ResidentWebRunner { final Uri mainUri; final Uri projectDirectory; final Uri packageConfigFile; - final PackageUriMapper packageUriMapper; + final PathResolver packageUriMapper; final String outputPath; final List fileSystemRoots; final String fileSystemScheme; diff --git a/dwds_test_common/lib/integration/dart_uri_file_uri.dart b/dwds_test_common/lib/integration/dart_uri_file_uri.dart index 9d9fa57cbf..dd00b126d8 100644 --- a/dwds_test_common/lib/integration/dart_uri_file_uri.dart +++ b/dwds_test_common/lib/integration/dart_uri_file_uri.dart @@ -32,7 +32,9 @@ void testAll({ setUpAll(() async { await context.setUp( - testSettings: const TestSettings( + testSettings: TestSettings( + canaryFeatures: provider.canaryFeatures, + moduleFormat: provider.ddcModuleFormat, useDebuggerModuleNames: useDebuggerModuleNames, ), ); diff --git a/dwds_test_common/lib/integration/dart_uri_file_uri_debugger_module_names.dart b/dwds_test_common/lib/integration/dart_uri_file_uri_debugger_module_names.dart index 9e1c30d0a6..ec9b3264d6 100644 --- a/dwds_test_common/lib/integration/dart_uri_file_uri_debugger_module_names.dart +++ b/dwds_test_common/lib/integration/dart_uri_file_uri_debugger_module_names.dart @@ -32,7 +32,9 @@ void testAll({ setUpAll(() async { await context.setUp( - testSettings: const TestSettings( + testSettings: TestSettings( + canaryFeatures: provider.canaryFeatures, + moduleFormat: provider.ddcModuleFormat, useDebuggerModuleNames: useDebuggerModuleNames, ), ); diff --git a/dwds_test_common/lib/integration/hot_reload.dart b/dwds_test_common/lib/integration/hot_reload.dart index bcb8c17d69..f25b860186 100644 --- a/dwds_test_common/lib/integration/hot_reload.dart +++ b/dwds_test_common/lib/integration/hot_reload.dart @@ -14,6 +14,7 @@ import 'package:vm_service/vm_service.dart'; const originalString = 'Hello World!'; const newString = 'Bonjour le monde!'; +const anotherString = 'Hola Mundo!'; void runTests({ required TestSdkConfigurationProvider provider, @@ -70,6 +71,7 @@ void runTests({ await context.setUp( testSettings: TestSettings( enableExpressionEvaluation: true, + verboseCompiler: true, moduleFormat: provider.ddcModuleFormat, canaryFeatures: provider.canaryFeatures, ), @@ -87,10 +89,21 @@ void runTests({ await makeEditAndRecompile(); final vm = await client.getVM(); final isolate = await client.getIsolate(vm.isolates!.first.id!); - final report = await fakeClient.reloadSources(isolate.id!); + var report = await fakeClient.reloadSources(isolate.id!); expect(report.success, true); - await callEvaluateAndWaitForLog(newString); + await context.makeEdits([ + ( + file: 'library1.dart', + originalString: newString, + newString: anotherString, + ), + ]); + await recompile(); + report = await fakeClient.reloadSources(isolate.id!); + expect(report.success, true); + + await callEvaluateAndWaitForLog(anotherString); }); test('can hot reload with no changes, hot reload with changes, and ' @@ -120,5 +133,44 @@ void runTests({ await callEvaluateAndWaitForLog(newString); }); + + test('can reject hot reload and recover with hot restart', () async { + final client = context.debugConnection.vmService; + + await context.makeEdits([ + ( + file: 'library1.dart', + originalString: "String get reloadValue => '$originalString';", + newString: + ''' +String get reloadValue => '$newString'; +class Bar {} +class Baz {} +class Foo extends Bar {} +''', + ), + ]); + await recompile(); + final vm = await client.getVM(); + final isolate = await client.getIsolate(vm.isolates!.first.id!); + var report = await fakeClient.reloadSources(isolate.id!); + expect(report.success, true); + + // Make an illegal edit. + await context.makeEdits([ + ( + file: 'library1.dart', + originalString: 'class Foo extends Bar', + newString: 'class Foo extends Bar', + ), + ]); + await context.recompile(fullRestart: false); + report = await fakeClient.reloadSources(isolate.id!); + expect(report.success, false); + + // Successfully recover with hot restart. + await context.recompile(fullRestart: true); + await callEvaluateAndWaitForLog(newString); + }); }, timeout: const Timeout.factor(2)); } diff --git a/dwds_test_common/lib/integration/hot_restart.dart b/dwds_test_common/lib/integration/hot_restart.dart index 80beb7ef3f..96597cfaf3 100644 --- a/dwds_test_common/lib/integration/hot_restart.dart +++ b/dwds_test_common/lib/integration/hot_restart.dart @@ -33,14 +33,13 @@ void runTests({ tearDownAll(provider.dispose); Future recompile({bool hasEdits = false}) async { - if (context.usesFrontendServer) { - await context.recompile(fullRestart: true); - } else { - assert(context.usesBuildDaemon); + if (context.usesBuildDaemon) { if (hasEdits) { // Only gets a new build if there were edits. await context.waitForSuccessfulBuild(); } + } else if (context.usesFrontendServer) { + await context.recompile(fullRestart: true); } } diff --git a/dwds_test_common/lib/integration/hot_restart_breakpoints.dart b/dwds_test_common/lib/integration/hot_restart_breakpoints.dart index 096bb53a9d..b03ab5f910 100644 --- a/dwds_test_common/lib/integration/hot_restart_breakpoints.dart +++ b/dwds_test_common/lib/integration/hot_restart_breakpoints.dart @@ -402,7 +402,7 @@ void runTests({ expect(consoleLogs.contains(newGenLog), false); await resumeAndWaitForLog(newGenLog); }); - }); + }, timeout: const Timeout.factor(4)); } TypeMatcher _hasKind(String kind) => diff --git a/dwds_test_common/lib/integration/hot_restart_correctness.dart b/dwds_test_common/lib/integration/hot_restart_correctness.dart index 889f427c13..902cc44639 100644 --- a/dwds_test_common/lib/integration/hot_restart_correctness.dart +++ b/dwds_test_common/lib/integration/hot_restart_correctness.dart @@ -44,15 +44,13 @@ void runTests({ newString: newString, ), ]); - if (context.usesFrontendServer) { - await context.recompile(fullRestart: true); - } else { - assert(context.usesBuildDaemon); + if (context.usesBuildDaemon) { await context.waitForSuccessfulBuild(propagateToBrowser: true); + } else if (context.usesFrontendServer) { + await context.recompile(fullRestart: true); } } - // Wait for `expectedString` to be printed to the console. Future waitForLog(String expectedString) async { final completer = Completer(); final subscription = context.webkitDebugger.onConsoleAPICalled.listen((e) { diff --git a/dwds_test_common/lib/integration/readers/proxy_server_asset_reader.dart b/dwds_test_common/lib/integration/readers/proxy_server_asset_reader.dart index ed844ba471..fc4085534c 100644 --- a/dwds_test_common/lib/integration/readers/proxy_server_asset_reader.dart +++ b/dwds_test_common/lib/integration/readers/proxy_server_asset_reader.dart @@ -44,14 +44,14 @@ void testAll({ }); test('can read source maps', () async { - final result = await assetReader.dartSourceContents( + final result = await assetReader.sourceMapContents( 'hello_world/main.ddc.js.map', ); expect(result, isNotNull); }); test('returns null if the source map path does not exist', () async { - final result = await assetReader.dartSourceContents( + final result = await assetReader.sourceMapContents( 'hello_world/foo.ddc.js.map', ); expect(result, isNull); diff --git a/dwds_test_common/lib/integration/sdk_configuration.dart b/dwds_test_common/lib/integration/sdk_configuration.dart index d9cc69bb0b..5d30e29ae2 100644 --- a/dwds_test_common/lib/integration/sdk_configuration.dart +++ b/dwds_test_common/lib/integration/sdk_configuration.dart @@ -5,11 +5,12 @@ import 'dart:io'; import 'package:dwds/src/utilities/sdk_configuration.dart'; -import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:file/memory.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; +import '../test_sdk_configuration.dart'; + var _throwsDoesNotExistException = throwsA( isA().having( (e) => '$e', diff --git a/dwds_test_common/lib/sdk_asset_generator.dart b/dwds_test_common/lib/sdk_asset_generator.dart index ea1f06ed01..ec3b4f273d 100644 --- a/dwds_test_common/lib/sdk_asset_generator.dart +++ b/dwds_test_common/lib/sdk_asset_generator.dart @@ -6,6 +6,7 @@ import 'package:file/file.dart'; import 'package:file/local.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as p; + import 'test_sdk_layout.dart'; /// Generates sdk.js, sdk.map, files. diff --git a/test_uri.dart b/test_uri.dart deleted file mode 100644 index 985727269f..0000000000 --- a/test_uri.dart +++ /dev/null @@ -1,10 +0,0 @@ -import 'dart:io'; - -void main() { - final uri = Uri.parse('file:///Users/markzipan/Projects/webdev/dwds_test_common/lib/fixtures/context.dart'); - print('Base: $uri'); - print('..: ${uri.resolve('..')}'); - print('../..: ${uri.resolve('../..')}'); - print('../../../: ${uri.resolve('../../../')}'); - print('../../../..: ${uri.resolve('../../../../')}'); -} diff --git a/webdev/CHANGELOG.md b/webdev/CHANGELOG.md index 792eb60b33..6a0e549c19 100644 --- a/webdev/CHANGELOG.md +++ b/webdev/CHANGELOG.md @@ -2,6 +2,10 @@ - Internal test infrastructure refactoring: Move common test files to `dwds_test_common`. +## 4.0.2 + +- **Internal**: Resolve Chrome test flakes. + ## 4.0.1 - Catch and report version skew errors when incompatible versions of `build_daemon` are used. diff --git a/webdev/lib/src/serve/webdev_server.dart b/webdev/lib/src/serve/webdev_server.dart index 309a4adcdd..10e8cf6f2f 100644 --- a/webdev/lib/src/serve/webdev_server.dart +++ b/webdev/lib/src/serve/webdev_server.dart @@ -234,7 +234,7 @@ class WebDevServer { final LoadStrategy loadStrategy; if (options.configuration.webHotReload) { final frontendServerFileSystem = LocalFileSystem(); - final packageUriMapper = await PackageUriMapper.create( + final packageUriMapper = await BuildRunnerPathResolver.create( frontendServerFileSystem, findPackageConfigUri()!, useDebuggerModuleNames: false, diff --git a/webdev/pubspec.yaml b/webdev/pubspec.yaml index b05db3f050..390aca6293 100644 --- a/webdev/pubspec.yaml +++ b/webdev/pubspec.yaml @@ -57,3 +57,5 @@ executables: webdev: dependency_overrides: + dwds: + path: ../dwds diff --git a/webdev/test/asset_handler_ddc_library_bundle_test.dart b/webdev/test/asset_handler_ddc_library_bundle_test.dart index aaa97ad92a..367d8ce9f6 100644 --- a/webdev/test/asset_handler_ddc_library_bundle_test.dart +++ b/webdev/test/asset_handler_ddc_library_bundle_test.dart @@ -9,6 +9,7 @@ import 'package:dwds/expression_compiler.dart'; import 'package:dwds_test_common/integration/asset_handler.dart'; import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:test/test.dart'; + import 'helpers/context.dart'; void main() { diff --git a/webdev/test/daemon/utils.dart b/webdev/test/daemon/utils.dart index b760eabc44..6909191bb8 100644 --- a/webdev/test/daemon/utils.dart +++ b/webdev/test/daemon/utils.dart @@ -19,18 +19,26 @@ Future exitWebdev(TestProcess webdev) async { } Future waitForAppId(TestProcess webdev) async { - var appId = ''; + final stdoutLines = []; while (await webdev.stdout.hasNext) { var line = await webdev.stdout.next; + stdoutLines.add(line); if (line.startsWith('[{"event":"app.started"')) { line = line.substring(1, line.length - 1); final message = json.decode(line) as Map; - appId = message['params']['appId'] as String; - break; + final appId = message['params']['appId'] as String; + if (appId.isNotEmpty) return appId; } } - assert(appId.isNotEmpty); - return appId; + final stderrLines = []; + while (await webdev.stderr.hasNext) { + stderrLines.add(await webdev.stderr.next); + } + throw StateError( + 'Failed to receive "app.started" event before process stdout closed.\n' + 'Captured stdout:\n${stdoutLines.join('\n')}\n' + 'Captured stderr:\n${stderrLines.join('\n')}', + ); } String? getDebugServiceUri(String line) { diff --git a/webdev/test/dds_port_amd_test.dart b/webdev/test/dds_port_amd_test.dart index 7d3b381f14..7fe4ce6425 100644 --- a/webdev/test/dds_port_amd_test.dart +++ b/webdev/test/dds_port_amd_test.dart @@ -9,6 +9,7 @@ library; import 'package:dwds_test_common/integration/dds_port.dart'; import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:test/test.dart'; + import 'helpers/context.dart'; void main() { diff --git a/webdev/test/dds_port_ddc_library_bundle_test.dart b/webdev/test/dds_port_ddc_library_bundle_test.dart index 77a8e025d5..77f0e9883c 100644 --- a/webdev/test/dds_port_ddc_library_bundle_test.dart +++ b/webdev/test/dds_port_ddc_library_bundle_test.dart @@ -10,6 +10,7 @@ import 'package:dwds/expression_compiler.dart'; import 'package:dwds_test_common/integration/dds_port.dart'; import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:test/test.dart'; + import 'helpers/context.dart'; void main() { diff --git a/webdev/test/helpers/context.dart b/webdev/test/helpers/context.dart index a80bab76c5..f064c2b720 100644 --- a/webdev/test/helpers/context.dart +++ b/webdev/test/helpers/context.dart @@ -1,7 +1,10 @@ // Copyright (c) 2024, 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:async'; +import 'dart:convert'; import 'dart:io'; +import 'dart:typed_data'; import 'package:build_daemon/client.dart'; import 'package:build_daemon/constants.dart'; @@ -15,12 +18,18 @@ import 'package:dwds/src/loaders/build_runner_strategy_provider.dart'; import 'package:dwds/src/loaders/frontend_server_strategy_provider.dart'; import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/proxy_server_asset_reader.dart'; +import 'package:dwds/src/services/daemon_expression_compiler.dart'; import 'package:dwds/src/services/expression_compiler_service.dart'; +import 'package:dwds/src/utilities/web_path_translator.dart'; import 'package:dwds_test_common/fixtures/context.dart'; import 'package:dwds_test_common/fixtures/utilities.dart'; +import 'package:dwds_test_common/frontend_server_common/devfs.dart'; +import 'package:dwds_test_common/utilities.dart'; import 'package:file/local.dart'; import 'package:http/http.dart'; import 'package:logging/logging.dart' as logging; +import 'package:path/path.dart' as p; +import 'package:shelf/shelf.dart' as shelf; import 'package:shelf/shelf.dart'; import 'package:shelf_proxy/shelf_proxy.dart'; @@ -35,9 +44,97 @@ Handler createBuildRunnerProxyHandler({ ); } -class BuildDaemonTestContext extends TestContext { - final _logger = logging.Logger('BuildDaemonTestContext'); +mixin BuildDaemonContextMixin on TestContext { + BuildDaemonClient get daemonClient; + + @override + Future waitForSuccessfulBuild({ + Duration? timeout, + bool propagateToBrowser = false, + bool allowFailure = false, + }) async { + final buildStartCompleter = Completer(); + final buildSuccessCompleter = Completer(); + final subscription = daemonClient.buildResults.listen((results) { + final isStartedEvent = results.results.any( + (r) => r.status == daemon.BuildStatus.started, + ); + final isSucceededEvent = results.results.any( + (r) => r.status == daemon.BuildStatus.succeeded, + ); + final isFailedEvent = results.results.any( + (r) => r.status == daemon.BuildStatus.failed, + ); + + if (isStartedEvent) { + if (!buildStartCompleter.isCompleted) buildStartCompleter.complete(); + } + if (isFailedEvent) { + if (!buildSuccessCompleter.isCompleted) { + final failedResult = results.results.firstWhere( + (r) => r.status == daemon.BuildStatus.failed, + ); + final daemonError = + failedResult.error ?? 'Unknown daemon compilation error'; + if (allowFailure) { + buildSuccessCompleter.complete(); + } else { + buildSuccessCompleter.completeError( + StateError('Build daemon build failed.\nError: $daemonError'), + ); + } + } + } + if (buildStartCompleter.isCompleted && isSucceededEvent) { + if (!buildSuccessCompleter.isCompleted) { + buildSuccessCompleter.complete(); + } + } + }); + + var isWaitingForSuccess = false; + try { + var timedOutWaitingForStart = false; + await buildStartCompleter.future.timeout( + const Duration(seconds: 5), + onTimeout: () { + timedOutWaitingForStart = true; + }, + ); + + if (timedOutWaitingForStart) { + return; + } + + isWaitingForSuccess = true; + await buildSuccessCompleter.future.timeout( + timeout ?? const Duration(seconds: 60), + ); + } catch (e) { + if (e is TimeoutException) { + // Return if an edit did not trigger a rebuild/recompile. + if (!isWaitingForSuccess) { + return; + } + // If the build started but never finished, the test has likely hung. + rethrow; + } + rethrow; + } finally { + await subscription.cancel(); + } + if (propagateToBrowser) { + final delay = Platform.isWindows + ? const Duration(seconds: 5) + : const Duration(seconds: 2); + await Future.delayed(delay); + } + } +} + +class BuildDaemonTestContext extends TestContext with BuildDaemonContextMixin { + final _logger = logging.Logger('BuildDaemonTestContext'); BuildDaemonTestContext(super.project, super.sdkConfigurationProvider) : super.protected(); @@ -47,6 +144,7 @@ class BuildDaemonTestContext extends TestContext { late Stream _buildResults; ExpressionCompiler? _expressionCompiler; + @override late BuildDaemonClient daemonClient; ExpressionCompilerService? ddcService; @@ -84,6 +182,7 @@ class BuildDaemonTestContext extends TestContext { canaryFeatures: testSettings.canaryFeatures, isFlutterApp: testSettings.isFlutterApp, experiments: testSettings.experiments, + useDebuggerModuleNames: testSettings.useDebuggerModuleNames, ); final options = [ @@ -110,6 +209,7 @@ class BuildDaemonTestContext extends TestContext { 'build_web_compilers|entrypoint_marker=ddc-library-bundle=true', ], '--verbose', + '--build-filter=${project.directoryToServe}/**', ]; daemonClient = await connectClient( sdkLayout.dartPath, @@ -127,22 +227,29 @@ class BuildDaemonTestContext extends TestContext { }, ); daemonClient.registerBuildTarget( - DefaultBuildTarget((b) => b..target = project.directoryToServe), + DefaultBuildTarget( + (b) => b + ..target = project.webAssetsPath + ..reportChangedAssets = true, + ), ); daemonClient.startBuild(); await waitForSuccessfulBuild(); final assetServerPort = daemonPort(project.absolutePackageDirectory); - _assetHandler = createBuildRunnerProxyHandler( - directoryToServe: project.directoryToServe, - client: client, - assetServerPort: assetServerPort, - ); - if (testSettings.moduleFormat == ModuleFormat.ddc && - buildSettings.canaryFeatures) { - _assetHandler = handleReloadedSources(_assetHandler); - } + _assetHandler = switch (( + testSettings.moduleFormat, + buildSettings.canaryFeatures, + )) { + (ModuleFormat.ddc, true) => + _createBuildRunnerDdcLibraryBundleAssetHandler(this, assetServerPort), + _ => createBuildRunnerProxyHandler( + directoryToServe: project.directoryToServe, + client: client, + assetServerPort: assetServerPort, + ), + }; _assetReader = ProxyServerAssetReader( assetServerPort, root: project.directoryToServe, @@ -156,6 +263,8 @@ class BuildDaemonTestContext extends TestContext { sdkConfigurationProvider: sdkConfigurationProvider, ); _expressionCompiler = ddcService; + } else { + _expressionCompiler = null; } _loadStrategy = switch (( @@ -181,7 +290,7 @@ class BuildDaemonTestContext extends TestContext { _buildResults = daemonClient.buildResults.map((results) { final result = results.results.firstWhere( - (result) => result.target == project.directoryToServe, + (result) => result.target == project.webAssetsPath, ); switch (result.status) { case daemon.BuildStatus.started: @@ -198,11 +307,16 @@ class BuildDaemonTestContext extends TestContext { @override Future modeTearDown() async { await ddcService?.stop(); - await daemonClient.close(); + ddcService = null; + _expressionCompiler = null; + try { + await daemonClient.close(); + } catch (_) {} } } -class BuildDaemonAndFrontendServerTestContext extends TestContext { +class BuildDaemonAndFrontendServerTestContext extends TestContext + with BuildDaemonContextMixin { final _logger = logging.Logger('BuildDaemonAndFrontendServerTestContext'); BuildDaemonAndFrontendServerTestContext( @@ -216,6 +330,7 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { late Stream _buildResults; ExpressionCompiler? _expressionCompiler; + @override late BuildDaemonClient daemonClient; ExpressionCompilerService? ddcService; late LocalFileSystem frontendServerFileSystem; @@ -238,6 +353,37 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { @override bool get usesDdcModulesOnly => true; + /// Forwards expression compilation requests to the persistent Frontend Server + /// process via socket. + Future> _compileExpressionWithDaemon( + Map request, + ) async { + final file = _fesManagerConfigFile(this); + if (!await file.exists()) { + throw StateError('FES port not found in ${file.path}'); + } + + final content = await file.readAsString(); + final json = jsonDecode(content) as Map; + final port = json['port'] as int?; + if (port == null) { + throw StateError('FES port not found in ${file.path}'); + } + + final socket = await Socket.connect(InternetAddress.loopbackIPv4, port); + try { + socket.writeln(jsonEncode(request)); + final responseStr = await socket + .cast>() + .transform(utf8.decoder) + .transform(const LineSplitter()) + .first; + return jsonDecode(responseStr) as Map; + } finally { + await socket.close(); + } + } + @override String get appUrlPath => project.filePathToServe; @@ -254,6 +400,7 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { canaryFeatures: testSettings.canaryFeatures, isFlutterApp: testSettings.isFlutterApp, experiments: testSettings.experiments, + useDebuggerModuleNames: testSettings.useDebuggerModuleNames, ); final options = [ @@ -281,55 +428,204 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { '--define', 'build_web_compilers|ddc_modules=web-hot-reload=true', '--verbose', + '--build-filter=${project.directoryToServe}/**', ]; - daemonClient = await connectClient( - sdkLayout.dartPath, - project.absolutePackageDirectory, - options, - (log) { - final record = log.toLogRecord(); - final name = record.loggerName == '' ? '' : '${record.loggerName}: '; - _logger.log( - record.level, - '$name${record.message}', - record.error, - record.stackTrace, + + if (testSettings.enableExpressionEvaluation) { + _logger.info('Starting Frontend Server Manager'); + final sdkDir = p.dirname(p.dirname(sdkLayout.dartPath)); + final testScratchSpaceDir = Directory( + p.join( + project.absolutePackageDirectory, + '.dart_tool', + 'test_scratch_space', + ), + ); + if (testScratchSpaceDir.existsSync()) { + testScratchSpaceDir.deleteSync(recursive: true); + } + testScratchSpaceDir.createSync(recursive: true); + + final sourcePackagesFile = File( + p.join( + project.absolutePackageDirectory, + '.dart_tool', + 'package_config.json', + ), + ); + final packagesFile = File( + p.join(testScratchSpaceDir.path, '.dart_tool', 'package_config.json'), + ); + packagesFile.parent.createSync(recursive: true); + + final originalJson = + jsonDecode(sourcePackagesFile.readAsStringSync()) + as Map; + final packagesList = originalJson['packages'] as List; + for (final package in packagesList) { + final packageMap = package as Map; + var rootUri = Uri.parse(packageMap['rootUri'] as String); + if (!rootUri.isAbsolute) { + rootUri = sourcePackagesFile.parent.uri.resolveUri(rootUri); + } + packageMap['rootUri'] = rootUri.toString(); + } + packagesFile.writeAsStringSync(jsonEncode(originalJson)); + + options.addAll([ + '--define', + 'build_web_compilers|ddc=scratch-space-dir=' + '${testScratchSpaceDir.path}', + ]); + final fesSnapshot = p.join( + project.absolutePackageDirectory, + '.dart_tool', + 'fes_manager.snapshot', + ); + + final buildWebCompilers = + packagesList.firstWhere( + (pkg) => (pkg as Map)['name'] == 'build_web_compilers', + orElse: () => null, + ) + as Map?; + String fesManagerPath; + if (buildWebCompilers != null) { + final pkgRootUri = Uri.parse(buildWebCompilers['rootUri'] as String); + fesManagerPath = p.join( + pkgRootUri.toFilePath(), + 'bin', + 'fes_manager.dart', ); - }, - ); + } else { + final localBuildRepoDir = p.join(p.dirname(projectRootDir), 'build'); + fesManagerPath = p.join( + localBuildRepoDir, + 'builder_pkgs', + 'build_web_compilers', + 'bin', + 'fes_manager.dart', + ); + } + final compileResult = await Process.run(sdkLayout.dartPath, [ + 'compile', + 'kernel', + '--packages=${sourcePackagesFile.path}', + '-o', + fesSnapshot, + fesManagerPath, + ]); + if (compileResult.exitCode != 0) { + _logger.severe( + 'Failed to compile Frontend Server Manager:\n' + 'Exit code: ${compileResult.exitCode}\n' + 'Stdout: ${compileResult.stdout}\n' + 'Stderr: ${compileResult.stderr}', + ); + } + + final args = [ + fesSnapshot, + sdkDir, + p.toUri(testScratchSpaceDir.path).toString(), + p.toUri(packagesFile.path).toString(), + ]; + fesProcess = await Process.start( + sdkLayout.dartPath, + args, + workingDirectory: project.absolutePackageDirectory, + ); + + fesProcess!.stdout + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.info('FES Manager STDOUT: $line'); + }); + fesProcess!.stderr + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.warning('FES Manager STDERR: $line'); + }); + + final configFile = _fesManagerConfigFile(this); + while (!await configFile.exists()) { + await Future.delayed(const Duration(milliseconds: 100)); + } + } + + try { + daemonClient = await connectClient( + sdkLayout.dartPath, + project.absolutePackageDirectory, + options, + (log) { + final record = log.toLogRecord(); + _logger.log( + record.level, + record.message, + record.error, + record.stackTrace, + ); + }, + ); + } catch (e) { + final daemonLogFile = File( + p.join( + project.absolutePackageDirectory, + '.dart_tool', + 'build', + 'daemon', + 'log', + ), + ); + if (daemonLogFile.existsSync()) { + _logger.warning( + 'Daemon startup log content:\n' + '${daemonLogFile.readAsStringSync()}', + ); + } else { + _logger.warning( + 'Daemon startup log file does not exist at: ' + '${daemonLogFile.path}', + ); + } + rethrow; + } daemonClient.registerBuildTarget( - DefaultBuildTarget((b) => b..target = project.directoryToServe), + DefaultBuildTarget( + (b) => b + ..target = project.webAssetsPath + ..outputLocation = OutputLocation( + (o) => o + ..output = outputDir.path + ..useSymlinks = false + ..hoist = true, + ).toBuilder() + ..reportChangedAssets = true, + ), ); + final buildFuture = waitForSuccessfulBuild(); daemonClient.startBuild(); - await waitForSuccessfulBuild(); - + await buildFuture; final assetServerPort = daemonPort(project.absolutePackageDirectory); - _assetHandler = createBuildRunnerProxyHandler( - directoryToServe: project.directoryToServe, - client: client, - assetServerPort: assetServerPort, - ); - if (testSettings.moduleFormat == ModuleFormat.ddc && - buildSettings.canaryFeatures) { - _assetHandler = handleReloadedSources(_assetHandler); - } - _assetReader = ProxyServerAssetReader( + + _assetHandler = _createBuildRunnerDdcLibraryBundleAssetHandler( + this, assetServerPort, - root: project.directoryToServe, ); + _assetReader = ProxyServerAssetReader.fromHandler(_assetHandler); + if (testSettings.enableExpressionEvaluation) { - ddcService = ExpressionCompilerService( - 'localhost', - port, - verbose: testSettings.verboseCompiler, - sdkConfigurationProvider: sdkConfigurationProvider, + _expressionCompiler = DaemonExpressionCompiler( + _compileExpressionWithDaemon, ); - _expressionCompiler = ddcService; } frontendServerFileSystem = const LocalFileSystem(); - final packageUriMapper = await PackageUriMapper.create( + final packageUriMapper = await BuildRunnerPathResolver.create( frontendServerFileSystem, project.packageConfigFile, useDebuggerModuleNames: testSettings.useDebuggerModuleNames, @@ -337,9 +633,10 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { _loadStrategy = switch (( testSettings.moduleFormat, buildSettings.canaryFeatures, + testSettings.enableExpressionEvaluation, )) { - (ModuleFormat.ddc, true) => - FrontendServerDdcLibraryBundleStrategyProvider( + (ModuleFormat.ddc, true, true) => + FrontendServerBuildDaemonStrategyProvider( testSettings.reloadConfiguration, _assetReader, packageUriMapper, @@ -348,34 +645,305 @@ class BuildDaemonAndFrontendServerTestContext extends TestContext { injectScriptLoad: false, reloadedSourcesUri: reloadedSourcesUri, ).strategy, + (ModuleFormat.ddc, true, false) => + BuildRunnerDdcLibraryBundleStrategyProvider( + testSettings.reloadConfiguration, + _assetReader, + buildSettings, + reloadedSourcesUri: reloadedSourcesUri, + ).strategy, _ => throw Exception( 'Unsupported DDC module format when compiling with Frontend ' 'Server + build_runner ${testSettings.moduleFormat.name}.', ), }; - _buildResults = const Stream.empty(); + // Map build results. + _buildResults = testSettings.enableExpressionEvaluation + ? const Stream.empty() + : daemonClient.buildResults.map((results) { + final result = results.results.firstWhere( + (result) => result.target == project.webAssetsPath, + ); + switch (result.status) { + case daemon.BuildStatus.started: + return dwds.BuildResult(status: dwds.BuildStatus.started); + case daemon.BuildStatus.failed: + return dwds.BuildResult(status: dwds.BuildStatus.failed); + case daemon.BuildStatus.succeeded: + return dwds.BuildResult(status: dwds.BuildStatus.succeeded); + } + throw StateError('Unexpected Daemon build result: $result'); + }); } @override Future modeTearDown() async { await ddcService?.stop(); - await daemonClient.close(); + try { + await daemonClient.close(); + } catch (_) {} } } +File _fesManagerConfigFile(TestContext context) => File( + p.join( + context.project.absolutePackageDirectory, + '.dart_tool', + 'build', + 'fes_manager_config', + ), +); + +Handler _createBuildRunnerDdcLibraryBundleAssetHandler( + TestContext context, + int assetServerPort, +) { + final rootProxy = proxyHandler( + 'http://localhost:$assetServerPort/', + client: context.client, + ); + final entrypointProxy = proxyHandler( + 'http://localhost:$assetServerPort/${context.project.directoryToServe}/', + client: context.client, + ); + + return (request) async { + final path = request.url.path; + var newPath = path; + + // Translate FES paths to package:build paths. + newPath = WebPathTranslator.translateFesToBuildRunnerPath(newPath); + var requestToProxy = request; + if (newPath != path) { + requestToProxy = shelf.Request( + request.method, + request.requestedUri.replace(path: newPath), + headers: request.headers, + body: request.read(), + context: request.context, + ); + } + + // Serve reloaded_sources.json. + if (newPath.endsWith(WebDevFS.reloadedSourcesFileName)) { + if (context.lastBuildFailed) { + return shelf.Response.internalServerError( + body: 'Last build failed, no reloaded sources.', + ); + } + return shelf.Response.ok(jsonEncode(context.reloadedSources)); + } + + // Resolve compiled files (.js, .js.map, .metadata, .dill, .full.dill) + // from either the test scratch space or the build cache. + final isDill = newPath.endsWith('.dill') || newPath.endsWith('.full.dill'); + final isMetadata = newPath.endsWith('.metadata'); + final isPackage = newPath.startsWith('packages/'); + final isJsOrMap = newPath.endsWith('.js') || newPath.endsWith('.js.map'); + + if (isDill || isMetadata || (isPackage && isJsOrMap)) { + String relativePath; + if (isPackage) { + final parts = newPath.split('/'); + relativePath = parts.length > 2 ? parts.sublist(2).join('/') : newPath; + } else { + final prefix = '${context.project.directoryToServe}/'; + relativePath = newPath.startsWith(prefix) + ? newPath.substring(prefix.length) + : newPath; + } + + final subDir = isPackage ? 'lib' : context.project.directoryToServe; + + final scratchFile = File( + p.join( + context.project.absolutePackageDirectory, + '.dart_tool', + 'build', + 'test_scratch_space', + subDir, + relativePath, + ), + ); + + final generatedFile = File( + p.join( + context.project.absolutePackageDirectory, + '.dart_tool', + 'build', + 'generated', + context.project.packageName, + subDir, + relativePath, + ), + ); + + Uint8List? fileBytes; + if (scratchFile.existsSync()) { + fileBytes = scratchFile.readAsBytesSync(); + } else if (generatedFile.existsSync()) { + fileBytes = generatedFile.readAsBytesSync(); + } + + if (fileBytes != null) { + final String mimeType; + if (newPath.endsWith('.js')) { + mimeType = 'application/javascript'; + } else if (newPath.endsWith('.json') || + newPath.endsWith('.map') || + newPath.endsWith('.metadata')) { + mimeType = 'application/json'; + } else { + mimeType = 'application/octet-stream'; + } + + return shelf.Response.ok( + fileBytes, + headers: { + HttpHeaders.contentTypeHeader: mimeType, + HttpHeaders.contentLengthHeader: fileBytes.length.toString(), + }, + ); + } + } + + // Serve the DDC merged metadata. Merging is done by the FES manager. + if (newPath.endsWith('.ddc_merged_metadata')) { + String? mergedContent; + final configFile = _fesManagerConfigFile(context); + if (await configFile.exists()) { + try { + final configJson = jsonDecode(await configFile.readAsString()) as Map; + final port = configJson['port'] as int?; + if (port != null) { + final socket = await Socket.connect( + InternetAddress.loopbackIPv4, + port, + ); + try { + socket.writeln(jsonEncode({'instruction': 'MERGE_ALL_METADATA'})); + final responseStr = await socket + .cast>() + .transform(utf8.decoder) + .transform(const LineSplitter()) + .first; + final response = jsonDecode(responseStr) as Map; + mergedContent = response['content'] as String?; + } finally { + await socket.close(); + } + } + } catch (_) { + // Ignore socket or parsing errors, letting the request fail + // gracefully or fall through. + } + } + + if (mergedContent != null) { + final bytes = Uint8List.fromList(utf8.encode(mergedContent)); + return shelf.Response.ok( + bytes, + headers: { + HttpHeaders.contentTypeHeader: 'application/json', + HttpHeaders.contentLengthHeader: bytes.length.toString(), + }, + ); + } + } + + // Swap between [rootProxy] and [entrypointProxy] to handle path serving + // differences for entrypoints vs library files. + // + // Use [rootProxy] for paths that already include the directory to serve + // (e.g., 'web/main.dart', 'packages/...', 'example/...'). + // + // Use [entrypointProxy] for files requested at the root (e.g. 'main.dart' + // or 'index.html'), These implicitly prepend [directoryToServe]. + final prefix = '${context.project.directoryToServe}/'; + var requestToProxyFinal = requestToProxy; + if (newPath.startsWith(prefix)) { + requestToProxyFinal = requestToProxy.change( + path: context.project.directoryToServe, + ); + } + + final response = + await (newPath.startsWith(prefix) || + newPath.startsWith('packages/') || + newPath.startsWith('example/') + ? rootProxy(requestToProxyFinal) + : entrypointProxy(requestToProxyFinal)); + return response; + }; +} + /// Connects to the `build_runner` daemon. Future connectClient( String dartPath, String workingDirectory, List options, void Function(ServerLog) logHandler, -) => BuildDaemonClient.connect(workingDirectory, [ - dartPath, - 'run', - 'build_runner', - 'daemon', - ...options, -], logHandler: logHandler); +) async { + final process = await Process.start(dartPath, [ + 'run', + 'build_runner', + 'daemon', + ...options, + ], workingDirectory: workingDirectory); + + final stdoutBuffer = []; + final stderrBuffer = []; + final daemonStartup = Completer(); + + process.stdout.transform(utf8.decoder).transform(const LineSplitter()).listen( + (line) { + stdoutBuffer.add(line); + if (line == readyToConnectLog || + line == versionSkew || + line == optionsSkew) { + if (!daemonStartup.isCompleted) { + daemonStartup.complete(line); + } + } + }, + ); + + process.stderr + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen(stderrBuffer.add); + + final result = await Future.any([ + daemonStartup.future, + Future.delayed( + const Duration(seconds: 45), + () => 'Timed out waiting for daemon to start up.', + ), + ]); + + if (result == readyToConnectLog) { + return BuildDaemonClient.connectUnchecked( + workingDirectory, + logHandler: logHandler, + ); + } + + process.kill(); + final exitCode = await process.exitCode.timeout( + const Duration(seconds: 5), + onTimeout: () => -1, + ); + + final details = [ + 'Command: $dartPath run build_runner daemon ${options.join(' ')}', + 'Working Directory: $workingDirectory', + 'Exit Code: $exitCode', + if (stdoutBuffer.isNotEmpty) 'Stdout:\n${stdoutBuffer.join('\n')}', + if (stderrBuffer.isNotEmpty) 'Stderr:\n${stderrBuffer.join('\n')}', + ].join('\n'); + + throw StateError('Failed to start build daemon (result: $result).\n$details'); +} /// Returns the port of the daemon asset server. int daemonPort(String workingDirectory) { diff --git a/webdev/test/proxy_server_asset_reader_amd_test.dart b/webdev/test/proxy_server_asset_reader_amd_test.dart index 5005fdf085..88b2339b4a 100644 --- a/webdev/test/proxy_server_asset_reader_amd_test.dart +++ b/webdev/test/proxy_server_asset_reader_amd_test.dart @@ -9,6 +9,7 @@ import 'package:dwds/expression_compiler.dart'; import 'package:dwds_test_common/integration/readers/proxy_server_asset_reader.dart'; import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:test/test.dart'; + import 'helpers/context.dart'; void main() { diff --git a/webdev/test/proxy_server_asset_reader_ddc_library_bundle_test.dart b/webdev/test/proxy_server_asset_reader_ddc_library_bundle_test.dart index 43d7b398dc..5791aee05c 100644 --- a/webdev/test/proxy_server_asset_reader_ddc_library_bundle_test.dart +++ b/webdev/test/proxy_server_asset_reader_ddc_library_bundle_test.dart @@ -9,6 +9,7 @@ import 'package:dwds/expression_compiler.dart'; import 'package:dwds_test_common/integration/readers/proxy_server_asset_reader.dart'; import 'package:dwds_test_common/test_sdk_configuration.dart'; import 'package:test/test.dart'; + import 'helpers/context.dart'; void main() {