From 8fcdb3841d58cc0f06f63a000e1366b2ef9c3399 Mon Sep 17 00:00:00 2001 From: thosakwe Date: Tue, 27 Dec 2016 11:55:17 -0500 Subject: [PATCH] Updated example --- .gitignore | 6 +- .../browser/static/packages/browser/dart.js | 32 + .../static/packages/browser/interop.js | 9 + .../packages/analyzer/src/summary/format.fbs | 2473 +++++++++++++++++ build/web/packages/browser/dart.js | 32 + build/web/packages/browser/interop.js | 9 + .../package_resolver/src/test_package_config | 3 + build/web/packages/test/dart.js | 69 + .../test/src/runner/browser/static/host.css | 314 +++ .../test/src/runner/browser/static/index.html | 24 + 10 files changed, 2968 insertions(+), 3 deletions(-) create mode 100644 build/lib/src/runner/browser/static/packages/browser/dart.js create mode 100644 build/lib/src/runner/browser/static/packages/browser/interop.js create mode 100644 build/web/packages/analyzer/src/summary/format.fbs create mode 100644 build/web/packages/browser/dart.js create mode 100644 build/web/packages/browser/interop.js create mode 100644 build/web/packages/package_resolver/src/test_package_config create mode 100644 build/web/packages/test/dart.js create mode 100644 build/web/packages/test/src/runner/browser/static/host.css create mode 100644 build/web/packages/test/src/runner/browser/static/index.html diff --git a/.gitignore b/.gitignore index 2aa48381..a7c95b85 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,8 @@ .packages .project .pub/ -build/ -**/packages/ +# build/ +# **/packages/ # Files created by dart2js # (Most Dart developers will use pub build to compile Dart, use/modify these @@ -26,4 +26,4 @@ doc/api/ # (Library packages only! Remove pattern if developing an application package) pubspec.lock -log.txt \ No newline at end of file +log.txt diff --git a/build/lib/src/runner/browser/static/packages/browser/dart.js b/build/lib/src/runner/browser/static/packages/browser/dart.js new file mode 100644 index 00000000..f8d686e1 --- /dev/null +++ b/build/lib/src/runner/browser/static/packages/browser/dart.js @@ -0,0 +1,32 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +(function() { +// Bootstrap support for Dart scripts on the page as this script. +if (navigator.userAgent.indexOf('(Dart)') === -1) { + // TODO: + // - Support in-browser compilation. + // - Handle inline Dart scripts. + + // Fall back to compiled JS. Run through all the scripts and + // replace them if they have a type that indicate that they source + // in Dart code (type="application/dart"). + var scripts = document.getElementsByTagName("script"); + var length = scripts.length; + for (var i = 0; i < length; ++i) { + if (scripts[i].type == "application/dart") { + // Remap foo.dart to foo.dart.js. + if (scripts[i].src && scripts[i].src != '') { + var script = document.createElement('script'); + script.src = scripts[i].src.replace(/\.dart(?=\?|$)/, '.dart.js'); + var parent = scripts[i].parentNode; + // TODO(vsm): Find a solution for issue 8455 that works with more + // than one script. + document.currentScript = script; + parent.replaceChild(script, scripts[i]); + } + } + } +} +})(); diff --git a/build/lib/src/runner/browser/static/packages/browser/interop.js b/build/lib/src/runner/browser/static/packages/browser/interop.js new file mode 100644 index 00000000..ec02e585 --- /dev/null +++ b/build/lib/src/runner/browser/static/packages/browser/interop.js @@ -0,0 +1,9 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// TODO(jmesserly): remove this script after a deprecation period. +if (typeof console == "object" && typeof console.warn == "function") { + console.warn(' + +