Skip to content

Commit

Permalink
🏗️ Prepare for web
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 committed May 22, 2024
1 parent 3700d4c commit 3d7df45
Show file tree
Hide file tree
Showing 16 changed files with 518 additions and 425 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ jobs:
cache: true
flutter-version: ${{ matrix.sdk == 'min' && '3.3.0' || '' }}
channel: ${{ matrix.sdk == 'min' && '' || matrix.channel }}
- run: dart pub get
- run: |
# Temporarily workaround with new packages.
echo -e "dependency_overrides:\n dio_web_adapter:\n path: ../plugins/web_adapter" >> example/pubspec_overrides.yaml
dart pub get
- uses: bluefireteam/melos-action@v3
with:
run-bootstrap: false
Expand Down
22 changes: 22 additions & 0 deletions plugins/web_adapter/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
MIT License

Copyright (c) 2018 Wen Du (wendux)
Copyright (c) 2022 The CFUG Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
16 changes: 16 additions & 0 deletions plugins/web_adapter/dart_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
presets:
# empty placeholders required in CI scripts
all:
default:

override_platforms:
chrome:
settings:
headless: true
firefox:
settings:
# headless argument has to be set explicitly for non-chrome browsers
arguments: --headless
executable:
# https://github.com/dart-lang/test/pull/2195
mac_os: '/Applications/Firefox.app/Contents/MacOS/firefox'
20 changes: 10 additions & 10 deletions plugins/web_adapter/lib/dio_web_adapter.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
library dio_web_adapter;

export 'src/html/adapter.dart'
if (dart.library.js_interop) 'src/js_interop/adapter.dart';
export 'src/html/compute.dart'
if (dart.library.js_interop) 'src/js_interop/compute.dart';
export 'src/html/dio_impl.dart'
if (dart.library.js_interop) 'src/js_interop/dio_impl.dart';
export 'src/html/multipart_file.dart'
if (dart.library.js_interop) 'src/js_interop/multipart_file.dart';
export 'src/html/progress_stream.dart'
if (dart.library.js_interop) 'src/js_interop/progress_stream.dart';
export 'src/html/adapter.dart';
// export 'src/js_interop/adapter.dart';
export 'src/html/compute.dart';
// export 'src/js_interop/compute.dart';
export 'src/html/dio_impl.dart';
// export 'src/js_interop/dio_impl.dart';
export 'src/html/multipart_file.dart';
// export 'src/js_interop/multipart_file.dart';
export 'src/html/progress_stream.dart';
// export 'src/js_interop/progress_stream.dart';
2 changes: 2 additions & 0 deletions plugins/web_adapter/lib/src/html/adapter.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// export '../js_interop/adapter.dart';

import 'dart:async';
import 'dart:convert';
import 'dart:html';
Expand Down
3 changes: 3 additions & 0 deletions plugins/web_adapter/lib/src/html/compute.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//
// The file is intentionally not refactored so that it is easier to keep the
// compute package up to date with Flutter's implementation.

// export '../js_interop/compute.dart';

import 'package:dio/src/compute/compute.dart' as c;

/// The dart:html implementation of [c.compute].
Expand Down
2 changes: 2 additions & 0 deletions plugins/web_adapter/lib/src/html/dio_impl.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// export '../js_interop/dio_impl.dart';

import 'package:dio/dio.dart';

import 'adapter.dart';
Expand Down
2 changes: 2 additions & 0 deletions plugins/web_adapter/lib/src/html/multipart_file.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// export '../js_interop/multipart_file.dart';

import 'package:http_parser/http_parser.dart';

final _err = UnsupportedError(
Expand Down
2 changes: 2 additions & 0 deletions plugins/web_adapter/lib/src/html/progress_stream.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// export '../js_interop/progress_stream.dart';

import 'dart:async';
import 'dart:typed_data';

Expand Down
Loading

0 comments on commit 3d7df45

Please sign in to comment.