Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v9]: Remove dart:html usage in favour of package:web #2710

Merged
merged 8 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ jobs:

- run: dart doc --dry-run

- name: Run publish validation
run: |
dart pub get --directory ../scripts/publish_validation
dart run ../scripts/publish_validation/bin/publish_validation.dart --executable ${{ inputs.sdk }}

package-analysis:
# `axel-op/dart-package-analyzer` is using `flutter pub upgrade` instead of `get`,
# which ignores pubspec.yaml `dependency_overrides`. Because of that, all `release/*` branches are failing,
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Remove `options.autoAppStart` and `setAppStartEnd` ([#2680](https://github.com/getsentry/sentry-dart/pull/2680))
- Add hint for transactions ([#2675](https://github.com/getsentry/sentry-dart/pull/2675))
- `BeforeSendTransactionCallback` now has a `Hint` parameter
- Remove `dart:html` usage in favour of `package:web` ([#2710](https://github.com/getsentry/sentry-dart/pull/2710))

### Enhancements

Expand Down
2 changes: 1 addition & 1 deletion dart/example_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
sentry:
path: ../../dart/
web: ^0.5.1
web: ^1.1.0

dev_dependencies:
build_runner: ^2.4.2
Expand Down
1 change: 0 additions & 1 deletion dart/lib/src/dart_exception_type_identifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:http/http.dart' show ClientException;

import '../sentry.dart';
import 'dart_exception_type_identifier_io.dart'
if (dart.library.html) 'dart_exception_type_identifier_web.dart'
if (dart.library.js_interop) 'dart_exception_type_identifier_web.dart';

class DartExceptionTypeIdentifier implements ExceptionTypeIdentifier {
Expand Down
1 change: 0 additions & 1 deletion dart/lib/src/environment/environment_variables.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '../platform_checker.dart';
import '_io_environment_variables.dart'
if (dart.library.html) '_web_environment_variables.dart'
if (dart.library.js_interop) '_web_environment_variables.dart' as env;

/// Reads environment variables from the system.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import '../../event_processor.dart';
import '../../sentry_options.dart';
import 'io_enricher_event_processor.dart'
if (dart.library.html) 'html_enricher_event_processor.dart'
if (dart.library.js_interop) 'web_enricher_event_processor.dart';

abstract class EnricherEventProcessor implements EventProcessor {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// We would lose compatibility with old dart versions by adding web to pubspec.
// ignore: depend_on_referenced_packages
import 'package:web/web.dart' as web show window, Window, Navigator;

import '../../../sentry.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import '../../event_processor.dart';
import '../../sentry_options.dart';
import 'io_exception_event_processor.dart'
if (dart.library.html) 'web_exception_event_processor.dart'
if (dart.library.js_interop) 'web_exception_event_processor.dart';

abstract class ExceptionEventProcessor implements EventProcessor {
Expand Down
4 changes: 1 addition & 3 deletions dart/lib/src/origin.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export 'origin_io.dart'
if (dart.library.html) 'origin_html.dart'
if (dart.library.js_interop) 'origin_web.dart';
export 'origin_io.dart' if (dart.library.js_interop) 'origin_web.dart';
5 changes: 0 additions & 5 deletions dart/lib/src/origin_html.dart

This file was deleted.

2 changes: 0 additions & 2 deletions dart/lib/src/origin_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// We would lose compatibility with old dart versions by adding web to pubspec.
// ignore: depend_on_referenced_packages
import 'package:web/web.dart';

/// request origin, used for browser stacktrace
Expand Down
53 changes: 0 additions & 53 deletions dart/lib/src/platform/_html_platform.dart

This file was deleted.

2 changes: 0 additions & 2 deletions dart/lib/src/platform/_web_platform.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// We would lose compatibility with old dart versions by adding web to pubspec.
// ignore: depend_on_referenced_packages
import 'package:web/web.dart' as web;

import 'platform.dart';
Expand Down
5 changes: 2 additions & 3 deletions dart/lib/src/platform/platform.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'dart:typed_data';

import '_io_platform.dart'
if (dart.library.html) '_html_platform.dart'
if (dart.library.js_interop) '_web_platform.dart' as platform;
import '_io_platform.dart' if (dart.library.js_interop) '_web_platform.dart'
as platform;

const Platform instance = platform.instance;

Expand Down
1 change: 0 additions & 1 deletion dart/lib/src/utils/isolate_utils.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:meta/meta.dart';

import '_io_get_isolate_name.dart'
if (dart.library.html) '_web_get_isolate_name.dart'
if (dart.library.js_interop) '_web_get_isolate_name.dart' as isolate_getter;

@internal
Expand Down
1 change: 1 addition & 0 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ dependencies:
stack_trace: ^1.10.0
uuid: '>=3.0.0 <5.0.0'
collection: ^1.16.0
web: ^1.1.0

dev_dependencies:
build_runner: ^2.3.0
Expand Down
4 changes: 1 addition & 3 deletions dart/test/event_processor/enricher/web_enricher_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
library;

import 'package:sentry/sentry.dart';
import 'package:sentry/src/event_processor/enricher/html_enricher_event_processor.dart'
if (dart.library.html) 'package:sentry/src/event_processor/enricher/html_enricher_event_processor.dart'
if (dart.library.js_interop) 'package:sentry/src/event_processor/enricher/web_enricher_event_processor.dart';
import 'package:sentry/src/event_processor/enricher/web_enricher_event_processor.dart';
import 'package:test/test.dart';

import '../../mocks.dart';
Expand Down
8 changes: 2 additions & 6 deletions file/lib/src/sentry_file_extension.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// ignore_for_file: invalid_use_of_internal_member

import 'dart:io'
if (dart.library.html) 'dart:html'
if (dart.library.js_interop) 'dart:js_interop';
import 'dart:io' if (dart.library.js_interop) 'dart:js_interop';

import 'package:meta/meta.dart';
import 'package:sentry/sentry.dart';
Expand All @@ -29,9 +27,7 @@ extension SentryFileExtension on File {
///
/// All the copy, create, delete, open, rename, read, and write operations are
/// supported.
File sentryTrace({
@internal Hub? hub,
}) {
File sentryTrace({@internal Hub? hub}) {
final _hub = hub ?? HubAdapter();

if (_hub.options.platformChecker.isWeb ||
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import '../../../sentry_flutter.dart';
import 'io_url_filter_event_processor.dart'
if (dart.library.html) 'html_url_filter_event_processor.dart'
if (dart.library.js_interop) 'web_url_filter_event_processor.dart';

abstract class UrlFilterEventProcessor implements EventProcessor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
// We would lose compatibility with old dart versions by adding web to pubspec.
// ignore: depend_on_referenced_packages
// ignore: implementation_imports
import 'package:sentry/src/utils/regex_utils.dart';
import 'package:web/web.dart' as web show window, Window;

import '../../../sentry_flutter.dart';
import 'url_filter_event_processor.dart';
// ignore: implementation_imports
import 'package:sentry/src/utils/regex_utils.dart';

// ignore_for_file: invalid_use_of_internal_member

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'noop_connectivity_provider.dart'
if (dart.library.html) 'html_connectivity_provider.dart'
if (dart.library.js_interop) 'web_connectivity_provider.dart';

abstract class ConnectivityProvider {
Expand Down
Loading
Loading