Skip to content

Commit 18ad1ff

Browse files
committed
Format.
1 parent c58188c commit 18ad1ff

File tree

149 files changed

+7668
-7026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+7668
-7026
lines changed

dwds/debug_extension/tool/build_extension.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,38 @@ import 'package:path/path.dart' as p;
2020
const _prodFlag = 'prod';
2121

2222
void main(List<String> arguments) async {
23-
final parser = ArgParser()
24-
..addFlag(_prodFlag, negatable: true, defaultsTo: false);
23+
final parser =
24+
ArgParser()..addFlag(_prodFlag, negatable: true, defaultsTo: false);
2525
final argResults = parser.parse(arguments);
2626

27-
exitCode = await run(
28-
isProd: argResults[_prodFlag] as bool,
29-
);
27+
exitCode = await run(isProd: argResults[_prodFlag] as bool);
3028
if (exitCode != 0) {
3129
_logWarning('Run terminated unexpectedly with exit code: $exitCode');
3230
}
3331
}
3432

3533
Future<int> run({required bool isProd}) async {
36-
_logInfo(
37-
'Building extension for ${isProd ? 'prod' : 'dev'}',
38-
);
34+
_logInfo('Building extension for ${isProd ? 'prod' : 'dev'}');
3935
_logInfo('Compiling extension with dart2js to /compiled directory');
40-
final compileStep = await Process.start(
41-
'dart',
42-
['run', 'build_runner', 'build', 'web', '--output', 'build', '--release'],
43-
);
36+
final compileStep = await Process.start('dart', [
37+
'run',
38+
'build_runner',
39+
'build',
40+
'web',
41+
'--output',
42+
'build',
43+
'--release',
44+
]);
4445
final compileExitCode = await _handleProcess(compileStep);
4546
// Terminate early if compilation failed:
4647
if (compileExitCode != 0) {
4748
return compileExitCode;
4849
}
4950
_logInfo('Copying manifest.json to /compiled directory');
5051
try {
51-
File(p.join('web', 'manifest.json')).copySync(
52-
p.join('compiled', 'manifest.json'),
53-
);
52+
File(
53+
p.join('web', 'manifest.json'),
54+
).copySync(p.join('compiled', 'manifest.json'));
5455
} catch (error) {
5556
_logWarning('Copying manifest file failed: $error');
5657
// Return non-zero exit code to indicate failure:
@@ -60,10 +61,9 @@ Future<int> run({required bool isProd}) async {
6061
if (isProd) return 0;
6162
// Update manifest.json for dev:
6263
_logInfo('Updating manifest.json in /compiled directory.');
63-
final updateStep = await Process.start(
64-
'dart',
65-
[p.join('tool', 'update_dev_files.dart')],
66-
);
64+
final updateStep = await Process.start('dart', [
65+
p.join('tool', 'update_dev_files.dart'),
66+
]);
6767
final updateExitCode = await _handleProcess(updateStep);
6868
// Return exit code (0 indicates success):
6969
return updateExitCode;

dwds/debug_extension/tool/copy_builder.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ Builder copyBuilder(_) => _CopyBuilder();
1010
class _CopyBuilder extends Builder {
1111
@override
1212
Map<String, List<String>> get buildExtensions => {
13-
'web/{{}}.dart.js': ['compiled/{{}}.dart.js'],
14-
'web/static_assets/{{}}.png': ['compiled/static_assets/{{}}.png'],
15-
'web/static_assets/{{}}.html': ['compiled/static_assets/{{}}.html'],
16-
'web/static_assets/{{}}.css': ['compiled/static_assets/{{}}.css'],
17-
'web/manifest.json': ['compiled/manifest.json'],
18-
};
13+
'web/{{}}.dart.js': ['compiled/{{}}.dart.js'],
14+
'web/static_assets/{{}}.png': ['compiled/static_assets/{{}}.png'],
15+
'web/static_assets/{{}}.html': ['compiled/static_assets/{{}}.html'],
16+
'web/static_assets/{{}}.css': ['compiled/static_assets/{{}}.css'],
17+
'web/manifest.json': ['compiled/manifest.json'],
18+
};
1919

2020
@override
2121
Future<void> build(BuildStep buildStep) async {

dwds/debug_extension/tool/update_dev_files.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ void main() async {
1212
Future<void> _updateManifestJson() async {
1313
final manifestJson = File('compiled/manifest.json');
1414
final extensionKeyTxt = File('extension_key.txt');
15-
final extensionKey = await extensionKeyTxt.exists()
16-
? await extensionKeyTxt.readAsString()
17-
: null;
15+
final extensionKey =
16+
await extensionKeyTxt.exists()
17+
? await extensionKeyTxt.readAsString()
18+
: null;
1819
return _transformDevFile(manifestJson, (line) {
1920
if (_matchesKey(line: line, key: 'name')) {
2021
return [
@@ -24,11 +25,7 @@ Future<void> _updateManifestJson() async {
2425
newValue: '[DEV] Dart Debug Extension',
2526
),
2627
if (extensionKey != null)
27-
_newKeyValue(
28-
oldLine: line,
29-
newKey: 'key',
30-
newValue: extensionKey,
31-
),
28+
_newKeyValue(oldLine: line, newKey: 'key', newValue: extensionKey),
3229
];
3330
} else if (_matchesKey(line: line, key: 'default_icon')) {
3431
return [

dwds/debug_extension/web/background.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ void main() {
2323
}
2424

2525
void _registerListeners() {
26-
chrome.runtime.onMessage.addListener(
27-
allowInterop(_handleRuntimeMessages),
28-
);
26+
chrome.runtime.onMessage.addListener(allowInterop(_handleRuntimeMessages));
2927
// The only extension allowed to send messages to this extension is the
3028
// AngularDart DevTools extension. Its permission is set in the manifest.json
3129
// externally_connectable field.
@@ -34,8 +32,9 @@ void _registerListeners() {
3432
);
3533
// The only external service that sends messages to the Dart Debug Extension
3634
// is Cider.
37-
chrome.runtime.onConnectExternal
38-
.addListener(allowInterop(handleCiderConnectRequest));
35+
chrome.runtime.onConnectExternal.addListener(
36+
allowInterop(handleCiderConnectRequest),
37+
);
3938
// Update the extension icon on tab navigation:
4039
chrome.tabs.onActivated.addListener(
4140
allowInterop((ActiveInfo info) async {
@@ -50,11 +49,13 @@ void _registerListeners() {
5049
}
5150
}),
5251
);
53-
chrome.webNavigation.onCommitted
54-
.addListener(allowInterop(_detectNavigationAwayFromDartApp));
52+
chrome.webNavigation.onCommitted.addListener(
53+
allowInterop(_detectNavigationAwayFromDartApp),
54+
);
5555

56-
chrome.commands.onCommand
57-
.addListener(allowInterop(_maybeSendCopyAppIdRequest));
56+
chrome.commands.onCommand.addListener(
57+
allowInterop(_maybeSendCopyAppIdRequest),
58+
);
5859
}
5960

6061
Future<void> _handleRuntimeMessages(
@@ -214,19 +215,20 @@ bool _isInternalNavigation(NavigationInfo navigationInfo) {
214215

215216
DebugInfo _addTabInfo(DebugInfo debugInfo, {required Tab tab}) {
216217
return DebugInfo(
217-
(b) => b
218-
..appEntrypointPath = debugInfo.appEntrypointPath
219-
..appId = debugInfo.appId
220-
..appInstanceId = debugInfo.appInstanceId
221-
..appOrigin = debugInfo.appOrigin
222-
..appUrl = debugInfo.appUrl
223-
..authUrl = debugInfo.authUrl
224-
..extensionUrl = debugInfo.extensionUrl
225-
..isInternalBuild = debugInfo.isInternalBuild
226-
..isFlutterApp = debugInfo.isFlutterApp
227-
..workspaceName = debugInfo.workspaceName
228-
..tabUrl = tab.url
229-
..tabId = tab.id,
218+
(b) =>
219+
b
220+
..appEntrypointPath = debugInfo.appEntrypointPath
221+
..appId = debugInfo.appId
222+
..appInstanceId = debugInfo.appInstanceId
223+
..appOrigin = debugInfo.appOrigin
224+
..appUrl = debugInfo.appUrl
225+
..authUrl = debugInfo.authUrl
226+
..extensionUrl = debugInfo.extensionUrl
227+
..isInternalBuild = debugInfo.isInternalBuild
228+
..isFlutterApp = debugInfo.isFlutterApp
229+
..workspaceName = debugInfo.workspaceName
230+
..tabUrl = tab.url
231+
..tabId = tab.id,
230232
);
231233
}
232234

@@ -279,9 +281,7 @@ void _setDefaultIcon(int tabId) {
279281
final iconPath =
280282
isDevMode ? 'static_assets/dart_dev.png' : 'static_assets/dart_grey.png';
281283
setExtensionIcon(IconInfo(path: iconPath));
282-
setExtensionPopup(
283-
PopupDetails(popup: '', tabId: tabId),
284-
);
284+
setExtensionPopup(PopupDetails(popup: '', tabId: tabId));
285285
}
286286

287287
Future<DebugInfo?> _fetchDebugInfo(int tabId) {

dwds/debug_extension/web/chrome_api.dart

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,7 @@ class Notifications {
158158
@JS()
159159
@anonymous
160160
class OnClickedHandler {
161-
external void addListener(
162-
void Function(String) callback,
163-
);
161+
external void addListener(void Function(String) callback);
164162
}
165163

166164
@JS()
@@ -233,9 +231,7 @@ class Port {
233231
@JS()
234232
@anonymous
235233
class OnPortMessageHandler {
236-
external void addListener(
237-
void Function(dynamic, Port) callback,
238-
);
234+
external void addListener(void Function(dynamic, Port) callback);
239235
}
240236

241237
@JS()

dwds/debug_extension/web/cider_connection.dart

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ enum CiderMessageType {
4444
///
4545
/// The types must match those defined by ChromeExtensionErrorType in the
4646
/// Cider extension.
47-
enum CiderErrorType {
48-
internalError,
49-
invalidRequest,
50-
noAppId,
51-
}
47+
enum CiderErrorType { internalError, invalidRequest, noAppId }
5248

5349
const _ciderPortName = 'cider';
5450
Port? _ciderPort;
@@ -62,9 +58,7 @@ void handleCiderConnectRequest(Port port) {
6258
debugLog('Received connect request from Cider', verbose: true);
6359
_ciderPort = port;
6460

65-
port.onMessage.addListener(
66-
allowInterop(_handleMessageFromCider),
67-
);
61+
port.onMessage.addListener(allowInterop(_handleMessageFromCider));
6862

6963
sendMessageToCider(messageType: CiderMessageType.connected);
7064
}
@@ -99,10 +93,7 @@ void sendErrorMessageToCider({
9993
}
10094

10195
void _sendMessageToCider(String json) {
102-
final message = {
103-
'key': _ciderDartMessageKey,
104-
'json': json,
105-
};
96+
final message = {'key': _ciderDartMessageKey, 'json': json};
10697
_ciderPort!.postMessage(jsify(message));
10798
}
10899

@@ -177,7 +168,8 @@ Future<void> _sendInspectorUrl({String? appId}) async {
177168
if (!alreadyDebugging) {
178169
sendErrorMessageToCider(
179170
errorType: CiderErrorType.invalidRequest,
180-
errorDetails: 'Cannot send the inspector URL before '
171+
errorDetails:
172+
'Cannot send the inspector URL before '
181173
'the debugger has been attached.',
182174
);
183175
return;
@@ -195,10 +187,7 @@ Future<void> _sendInspectorUrl({String? appId}) async {
195187
}
196188
final inspectorUrl = addQueryParameters(
197189
devToolsUri,
198-
queryParameters: {
199-
'embed': 'true',
200-
'page': 'inspector',
201-
},
190+
queryParameters: {'embed': 'true', 'page': 'inspector'},
202191
);
203192
sendMessageToCider(
204193
messageType: CiderMessageType.inspectorUrlResponse,

dwds/debug_extension/web/copier.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ void main() {
1919
}
2020

2121
void _registerListeners() {
22-
chrome.runtime.onMessage.addListener(
23-
allowInterop(_handleRuntimeMessages),
24-
);
22+
chrome.runtime.onMessage.addListener(allowInterop(_handleRuntimeMessages));
2523
}
2624

2725
void _handleRuntimeMessages(
@@ -49,8 +47,8 @@ void _copyAppId(String appId) {
4947
}
5048

5149
Future<bool> _notifyCopiedSuccess(String appId) => sendRuntimeMessage(
52-
type: MessageType.appId,
53-
body: appId,
54-
sender: Script.copier,
55-
recipient: Script.background,
56-
);
50+
type: MessageType.appId,
51+
body: appId,
52+
sender: Script.copier,
53+
recipient: Script.background,
54+
);

dwds/debug_extension/web/cross_extension_communication.dart

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ void maybeForwardMessageToAngularDartDevTools({
5656
}) {
5757
if (!_eventsForAngularDartDevTools.contains(method)) return;
5858

59-
final message = method.startsWith('dwds')
60-
? _dwdsEventMessage(method: method, params: params, tabId: tabId)
61-
: _debugEventMessage(method: method, params: params, tabId: tabId);
59+
final message =
60+
method.startsWith('dwds')
61+
? _dwdsEventMessage(method: method, params: params, tabId: tabId)
62+
: _debugEventMessage(method: method, params: params, tabId: tabId);
6263

6364
_forwardMessageToAngularDartDevTools(message);
6465
}
@@ -87,9 +88,7 @@ void _respondWithChromeResult(Object? chromeResult, Function sendResponse) {
8788
if (chromeResult == null) {
8889
sendResponse(
8990
ErrorResponse()
90-
..error = JSON.stringify(
91-
chrome.runtime.lastError ?? 'Unknown error.',
92-
),
91+
..error = JSON.stringify(chrome.runtime.lastError ?? 'Unknown error.'),
9392
);
9493
} else {
9594
sendResponse(chromeResult);
@@ -126,23 +125,17 @@ ExternalExtensionMessage _debugEventMessage({
126125
required String method,
127126
required dynamic params,
128127
required int tabId,
129-
}) =>
130-
ExternalExtensionMessage(
131-
name: 'chrome.debugger.event',
132-
tabId: tabId,
133-
options: DebugEvent(method: method, params: params),
134-
);
128+
}) => ExternalExtensionMessage(
129+
name: 'chrome.debugger.event',
130+
tabId: tabId,
131+
options: DebugEvent(method: method, params: params),
132+
);
135133

136134
ExternalExtensionMessage _dwdsEventMessage({
137135
required String method,
138136
required dynamic params,
139137
required int tabId,
140-
}) =>
141-
ExternalExtensionMessage(
142-
name: method,
143-
tabId: tabId,
144-
options: params,
145-
);
138+
}) => ExternalExtensionMessage(name: method, tabId: tabId, options: params);
146139

147140
// This message is used for cross-extension communication between this extension
148141
// and the AngularDart DevTools extension.

dwds/debug_extension/web/data_serializers.g.dart

Lines changed: 17 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)