-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate archive script to package:web (#5456)
Also updates dependencies and completes some cleanup.
- Loading branch information
Showing
9 changed files
with
3,769 additions
and
3,056 deletions.
There are no files selected for viewing
6,532 changes: 3,605 additions & 2,927 deletions
6,532
src/assets/js/get-dart/download_archive.dart.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 16 additions & 16 deletions
32
tool/get-dart/dart_sdk_archive/lib/src/operating_system.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
import 'dart:html'; | ||
import 'package:web/web.dart'; | ||
|
||
class OperatingSystem { | ||
final class OperatingSystem { | ||
static final OperatingSystem current = | ||
[_chrome, _mac, _windows, _linux, _unix].firstWhere( | ||
(system) => system._matchesNavigator(window.navigator), | ||
orElse: () => OperatingSystem('Unknown', (n) => false), | ||
(system) => window.navigator.appVersion.contains(system._navigatorName), | ||
orElse: () => const OperatingSystem('Unknown', 'Unknown'), | ||
); | ||
|
||
final String name; | ||
final bool Function(Navigator) _matchesNavigator; | ||
final String _navigatorName; | ||
|
||
OperatingSystem(this.name, this._matchesNavigator); | ||
const OperatingSystem(this.name, this._navigatorName); | ||
|
||
bool get isLinux => this == _linux; | ||
bool get isMac => this == _mac; | ||
bool get isUnix => this == _unix; | ||
bool get isWindows => this == _windows; | ||
} | ||
|
||
final _linux = OperatingSystem( | ||
const _linux = OperatingSystem( | ||
'Linux', | ||
'Linux', | ||
(Navigator navigator) => navigator.appVersion.contains('Linux'), | ||
); | ||
|
||
final _mac = OperatingSystem( | ||
const _mac = OperatingSystem( | ||
'Mac', | ||
'Mac', | ||
(Navigator navigator) => navigator.appVersion.contains('Mac'), | ||
); | ||
|
||
final _unix = OperatingSystem( | ||
const _unix = OperatingSystem( | ||
'Unix', | ||
(Navigator navigator) => navigator.appVersion.contains('X11'), | ||
'X11', | ||
); | ||
|
||
final _windows = OperatingSystem( | ||
const _windows = OperatingSystem( | ||
'Windows', | ||
(Navigator navigator) => navigator.appVersion.contains('Win'), | ||
'Win', | ||
); | ||
|
||
final _chrome = OperatingSystem( | ||
const _chrome = OperatingSystem( | ||
'ChromeOS', | ||
(Navigator navigator) => navigator.appVersion.contains('CrOS'), | ||
'CrOS', | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.