* paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
50 | return [paths.firstObject stringByAppendingString: @"/WebF"];
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/macos/libquickjs.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dagouzhi/mini-app-engines/fe9866decaf1d5b3234036025101855e739c86b2/packages/webf-0.12.0+1/macos/libquickjs.dylib
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/macos/libwebf.dylib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dagouzhi/mini-app-engines/fe9866decaf1d5b3234036025101855e739c86b2/packages/webf-0.12.0+1/macos/libwebf.dylib
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/macos/prepare.sh:
--------------------------------------------------------------------------------
1 | read_version() {
2 | VERSION_STR=$(cat webf.podspec | grep s.version | awk '{print $3}')
3 | END_POS=$(echo ${#VERSION_STR} - 2 | bc)
4 | export VERSION=${VERSION_STR:1:$END_POS}
5 | }
6 |
7 | ROOT=$(pwd)
8 |
9 | if [ -L "libwebf.dylib" ]; then
10 | rm libwebf.dylib
11 | ln -s $ROOT/../../bridge/build/macos/lib/x86_64/libwebf.dylib
12 | fi
13 |
14 | if [ -L "libquickjs.dylib" ]; then
15 | rm libquickjs.dylib
16 | ln -s $ROOT/../../bridge/build/macos/lib/x86_64/libquickjs.dylib
17 | fi
18 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/macos/webf.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint webf.podspec' to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'webf'
7 | s.version = '0.1.0'
8 | s.summary = 'A W3C standard compliant Web rendering engine based on Flutter.'
9 | s.description = <<-DESC
10 | A W3C standard compliant Web rendering engine based on Flutter..
11 | DESC
12 | s.homepage = 'https://openwebf.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'WebF' => 'dongtiangche@outlook.com' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*'
17 | s.public_header_files = 'Classes/**/*.h'
18 | s.dependency 'FlutterMacOS'
19 | s.vendored_libraries = 'libwebf.dylib', 'libquickjs.dylib'
20 | s.prepare_command = 'bash prepare.sh'
21 |
22 | s.platform = :osx, '10.11'
23 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
24 | s.swift_version = '5.0'
25 | end
26 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: webf
2 | description: A W3C standard compliant Web rendering engine based on Flutter.
3 | version: 0.12.0+1
4 | homepage: https://openwebf.com
5 |
6 | environment:
7 | sdk: ">=2.17.5 <3.0.0"
8 | flutter: ">=3.0.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 | path: ^1.8.1 # Pure dart module.
14 | meta: ^1.7.0 # Pure dart module.
15 | ffi: ^2.0.1 # Pure dart module.
16 | characters: ^1.2.0
17 | async: ^2.8.2 # Pure dart module.
18 | quiver: ^3.1.0 # Pure dart module.
19 | vector_math: ^2.1.2 # Pure dart module.
20 | connectivity_plus: ^2.3.5 # No AndroidX used.
21 | shared_preferences: ^2.0.15 # No AndroidX used.
22 |
23 | dev_dependencies:
24 | flutter_test:
25 | sdk: flutter
26 | test: ^1.20.2
27 |
28 | flutter:
29 | # This section identifies this Flutter project as a plugin project.
30 | # The 'pluginClass' and Android 'package' identifiers should not ordinarily
31 | # be modified. They are used by the tooling to maintain consistency when
32 | # adding or updating assets for this project.
33 | #
34 | # NOTE: This new plugin description format is not supported on Flutter's
35 | # stable channel as of 1.9.1. A plugin published using this format will not
36 | # work for most clients until the next major stable release.
37 | # However, it is required in order to declare macOS support.
38 | plugin:
39 | platforms:
40 | android:
41 | package: com.openwebf.webf
42 | pluginClass: WebFPlugin
43 | ios:
44 | pluginClass: WebFPlugin
45 | macos:
46 | pluginClass: WebFPlugin
47 | linux:
48 | pluginClass: WebfPlugin
49 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_301:
--------------------------------------------------------------------------------
1 | HTTP/1.1 301 Moved Permanently
2 | Content-Type: text/html
3 | Content-Length: 262
4 | Connection: keep-alive
5 | Location: https://www.taobao.com/
6 | Timing-Allow-Origin: *
7 |
8 |
9 |
10 | 301 Moved Permanently
11 |
12 | 301 Moved Permanently
13 | The requested resource has been assigned a new permanent URI.
14 |
Powered by Tengine
15 |
16 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_js_gzipped:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dagouzhi/mini-app-engines/fe9866decaf1d5b3234036025101855e739c86b2/packages/webf-0.12.0+1/test/fixtures/GET_js_gzipped
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_json_with_content_length:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Content-Type: application/json
3 | Content-Length: 72
4 |
5 | {
6 | "method": "GET",
7 | "data": {
8 | "userName": "12345"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_json_with_content_length_expires_etag_last_modified:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Connection: close
3 | Content-Type: application/json
4 | Content-Length: 72
5 | ETag: "4EE5B35FB8C5FB2CF8041FC41D3D199E"
6 | expires: Mon, 16 Aug 2221 10:17:45 GMT
7 | Last-Modified: Sun, 15 Mar 2020 11:32:20 GMT
8 |
9 | {
10 | "method": "GET",
11 | "data": {
12 | "userName": "12345"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_plain_text_with_content_length_and_last_modified:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Content-Type: text/plain
3 | Last-Modified: Sun, 15 Mar 2020 11:32:20 GMT
4 | Content-Length: 10
5 |
6 | CachedData
7 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_plain_text_with_current_time_last_modified:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Content-Type: text/plain
3 | Last-Modified: CURRENT_TIME
4 | Content-Length: 10
5 |
6 | CachedData
7 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/GET_plain_text_with_etag_and_content_length:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Content-Type: text/plain
3 | x-custom-header: hello-world
4 | eTag: "foo"
5 | Content-Length: 10
6 |
7 | CachedData
8 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/fixtures/POST_plain_text:
--------------------------------------------------------------------------------
1 | HTTP/1.1 200 OK
2 | Content-Type: text/plain
3 | Content-Length: 10
4 |
5 | helloworld
6 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/css/values.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'package:webf/css.dart';
7 | import 'package:test/test.dart';
8 |
9 | void main() {
10 | group('CSSValues', () {
11 | group('CSSFunction', () {
12 | var cases = [
13 | 'var(--x)',
14 | 'url(https://some.com/path)',
15 | 'conic-gradient(from 45deg, blue, red)',
16 | 'device-cmyk(0 81% 81% 30% / .5, rgb(178 34 34))',
17 | 'calc(var(--widthA) / 2)',
18 | 'url(https://some.com/path), url(https://some.com/path2)'
19 | '''conic-gradient(
20 | hsl(360, 100%, 50%),
21 | hsl(315, 100%, 50%),
22 | hsl(270, 100%, 50%),
23 | hsl(225, 100%, 50%),
24 | hsl(180, 100%, 50%),
25 | hsl(135, 100%, 50%),
26 | hsl(90, 100%, 50%),
27 | hsl(45, 100%, 50%),
28 | hsl(0, 100%, 50%)
29 | )''',
30 | ];
31 | cases.forEach((String input) {
32 | test('simple case #${cases.indexOf(input)}', () {
33 | expect(CSSFunction.isFunction(input), true);
34 | });
35 | });
36 |
37 | test('specified function name #0', () {
38 | var input = 'var(--x)';
39 | expect(CSSFunction.isFunction(input, functionName: 'var'), true);
40 | });
41 |
42 | test('specified function name #1', () {
43 | var input = 'var(--x)';
44 | expect(CSSFunction.isFunction(input, functionName: 'var1'), false);
45 | });
46 |
47 | test('specified function name #2', () {
48 | var input = 'var(--x)';
49 | expect(CSSFunction.isFunction(input, functionName: 'url'), false);
50 | });
51 |
52 | test('specified function name #3', () {
53 | var input = 'conic-gradient(--x)';
54 | expect(CSSFunction.isFunction(input, functionName: 'conic-gradient'), true);
55 | });
56 | });
57 | });
58 | }
59 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/foundation/convert.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'package:webf/foundation.dart';
7 | import 'package:test/test.dart';
8 |
9 | void main() {
10 | group('Convert', () {
11 | test('utf8 decode basic', () async {
12 | String spec = 'Hello World!';
13 | List rawData = spec.codeUnits;
14 | String decoded = await resolveStringFromData(rawData);
15 |
16 | expect(decoded, spec);
17 | });
18 | });
19 | }
20 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/foundation/environment.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'package:test/test.dart';
7 | import 'package:webf/foundation.dart';
8 |
9 | void main() {
10 | group('environment', () {
11 | test('getWebFTemporaryPath()', () async {
12 | String tempPath = await getWebFTemporaryPath();
13 | expect(tempPath, './temp');
14 | });
15 | });
16 | }
17 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/foundation/uri_parser.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'package:test/test.dart';
7 | import 'package:webf/foundation.dart';
8 |
9 | void main() {
10 | group('UriParser', () {
11 | var uriParser = UriParser();
12 |
13 | var resolveTests = [
14 | // base, relative, result
15 | ['https://foo.com', '//bar.org', 'https://bar.org'],
16 | ['https://foo.com', '/bar', 'https://foo.com/bar'],
17 | ['https://foo.com', 'file:///Users/bar', 'file:///Users/bar'],
18 | ['https://foo.com/?a=1', 'bar?b=2', 'https://foo.com/bar?b=2'],
19 | ['https://foo.com/?a=1', '//bar.org', 'https://bar.org'],
20 | ['assets:foo', './bar', 'assets:bar'],
21 | ['assets:foo', '/bar', 'assets:/bar'],
22 | ['assets:foo', './bar', 'assets:bar'],
23 | ['assets:foo', '../bar', 'assets:bar'],
24 | ['http://foo.com/bar', '../bar', 'http://foo.com/bar'],
25 | ['http://foo.com/bar', 'http://bar.com/', 'http://bar.com/'],
26 | ['file:///Users/foo', '/bar', 'file:///bar'],
27 | ['file:///Users/foo', 'bar', 'file:///Users/bar'],
28 | ['file:///Users/foo', '//foo.com/bar?a=1', 'file://foo.com/bar?a=1'],
29 | ];
30 |
31 | for (var spec in resolveTests) {
32 | String index = resolveTests.indexOf(spec).toString().padLeft(3, '0');
33 |
34 | test('resolve $index', () {
35 | Uri base = Uri.parse(spec[0]);
36 | Uri relative = Uri.parse(spec[1]);
37 | expect(uriParser.resolve(base, relative).toString(), spec[2]);
38 | });
39 | }
40 | });
41 | }
42 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/gesture/scroll_physics.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'dart:io' show Platform;
7 |
8 | import 'package:test/test.dart';
9 | import 'package:webf/src/gesture/scroll_physics.dart';
10 |
11 | // Only for test.
12 | class TestScrollPhysics extends ScrollPhysics {}
13 |
14 | void main() {
15 | group('ScrollPhysics', () {
16 | test('createScrollPhysics', () {
17 | ScrollPhysics scrollPhysics = ScrollPhysics.createScrollPhysics();
18 | // In test env, that should be macos env.
19 | expect(Platform.operatingSystem, 'linux');
20 | expect(scrollPhysics.runtimeType.toString(), 'ClampingScrollPhysics');
21 | });
22 |
23 | test('ScrollPhysics Factory', () {
24 | // ScrollPhysics
25 | ScrollPhysics.scrollPhysicsFactory = (ScrollPhysics? parent) {
26 | return TestScrollPhysics();
27 | };
28 |
29 | ScrollPhysics scrollPhysics = ScrollPhysics.createScrollPhysics();
30 | expect(scrollPhysics.runtimeType.toString(), 'TestScrollPhysics');
31 |
32 | ScrollPhysics.scrollPhysicsFactory = null;
33 | });
34 | });
35 | }
36 |
--------------------------------------------------------------------------------
/packages/webf-0.12.0+1/test/src/module/fetch.dart:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2019-2022 The Kraken authors. All rights reserved.
3 | * Copyright (C) 2022-present The WebF authors. All rights reserved.
4 | */
5 |
6 | import 'package:webf/module.dart';
7 | import 'package:test/test.dart';
8 |
9 | import '../../local_http_server.dart';
10 |
11 | void main() {
12 | group('fetch', () {
13 | FetchModule fetchModule = FetchModule(null);
14 | var server = LocalHttpServer.getInstance();
15 |
16 | test('Custom Headers', () async {
17 | var request =
18 | await fetchModule.getRequest(server.getUri('plain_text'), 'POST', {'foo': 'bar'}, null);
19 | expect(request.uri.path, '/plain_text');
20 | expect(request.method, 'POST');
21 | expect(request.headers.value('foo'), 'bar');
22 | await request.close();
23 | });
24 | });
25 | }
26 |
--------------------------------------------------------------------------------
/react-native.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | dependency: {
3 | platforms: {
4 | ios: {
5 | project: './ios-rn/MiniAppEngines.xcworkspace',
6 | },
7 | android: {
8 | sourceDir: './android-rn/',
9 | },
10 | },
11 | },
12 | };
13 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_module_rn/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------