build_web_compilers 0.4.0+4

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 96

build_web_compilers

Web compilers for users of package:build.
Build Status Issues related to build_web_compilers Pub Package Version Latest Dartdocs Join the chat on Gitter

Installation

This package is intended to be used as a development dependency for users of package:build who want to run code in a browser. Simply add the following to your pubspec.yaml:

dev_dependencies:
  build_web_compilers:

Usage

If you are using the autogenerated build script (going through pub run build_runner <command> instead of handwriting a build.dart file), then all you need is the dev_dependency listed above.

Configuration

By default, the dartdevc compiler will be used, which is the Dart Development Compiler.

If you would like to opt into dart2js you will need to add a build.yaml file, which should look roughly like the following:

targets:
  $default:
    builders:
      build_web_compilers|entrypoint:
        # These are globs for the entrypoints you want to compile.
        generate_for:
        - test/**.browser_test.dart
        - web/**.dart
        options:
          compiler: dart2js
          # List any dart2js specific args here, or omit it.
          dart2js_args:
          - --checked

We are working on command line configuration as well, you can follow https://github.com/dart-lang/build/issues/801 for updates on that.

Manual Usage

If you are using a custom build script, you will need to add the following builder applications to what you already have, almost certainly at the end of the list (unless you need to post-process the js files).

[
    apply(
        'build_web_compilers|ddc',
        [
        (_) => new ModuleBuilder(),
        (_) => new UnlinkedSummaryBuilder(),
        (_) => new LinkedSummaryBuilder(),
        (_) => new DevCompilerBuilder()
        ],
        toAllPackages(),
        // Recommended, but not required. This makes it so only modules that are
        // imported by entrypoints get compiled.
        isOptional: true,
        hideOutput: true),
    apply('build_web_compilers|entrypoint',
        // You can also use `WebCompiler.Dart2Js`. If you don't care about
        // dartdevc at all you may also omit the previous builder application
        // entirely.
        [(_) => new WebEntrypointBuilder(WebCompiler.DartDevc)], toRoot(),
        hideOutput: true,
        // These globs should match your entrypoints only.
        defaultGenerateFor: const InputSet(
            include: const ['web/**', 'test/**.browser_test.dart'])),
]

0.4.0+4

  • Expand support for package:build_config to include version 0.3.x.

0.4.0+3

  • Expand support for package:archive to include version 2.x.x.

0.4.0+2

  • Fix a dart2 error.

0.4.0+1

  • Support package:analyzer 0.32.0.

0.4.0

  • Changed the default for enable_sync_async to true for the build_web_compilers|entrypoint builder.
  • Changed the default for ignore_cast_failures to false for the build_web_compilers|entrypoint builder.

0.3.8

  • Remove .dart sources and .js.map files from the output directory in release mode.
  • Clean up .tar.gz outputs produced by Dart2Js.
  • Don't output extra Dart2Js outputs other than deferred part files.
  • Fixed a logical error in dartdevc compiler to detect correct base url for require js.
  • Added a enable_sync_async option to the build_web_compilers|entrypoint builder, which defaults to false.

0.3.7+3

  • The dartdevc compiler now respects the <base href="/...."> tags and will set them as the base url for require js.

0.3.7+2

  • Fix sdk stack trace folding in the browser console and package:test.

0.3.7+1

  • Add missing dependency on the pool package.

0.3.7

  • Reduce memory usage by requesting (and lazily building) lower level modules first when building for an entrypoint.

0.3.6

  • Add support for compiling with dart2js by default in release mode.

0.3.5

  • Don't ignore cast failures by default. We expect most code to be clean with cast failures, and the option can be manually enabled with config.

0.3.4+2

  • Create .packages file and use the new frontend with dart2js.

0.3.4+1

  • Use --use-old-frontend with dart2js as a stopgap until we can add support for .packages files.

0.3.4

  • Added support for dart2js deferred loading.
  • Added support for bootstrapping code in web workers with dartdevc.

0.3.3

  • Added support for --dump-info and the dart2js compiler. If you pass that argument with dart2js_args the .info.json file will be copied the output.

0.3.2

  • Dart2JS now has minification (--minify) enabled by default, similar to how it worked in pub build. If you are adding custom dart2js options, make sure you still keep the --minify flag. Here is an example:
targets:
  $default:
    builders:
      build_web_compilers|entrypoint:
        generate_for:
        - web/**.dart
        options:
          compiler: dart2js
          dart2js_args:
          - --fast-startup
          - --minify
          - --trust-type-annotations
          - --trust-primitives

0.3.1

  • Cast failures will now be ignored in dartdevc by default (these were enabled in the latest sdk), and added an ignore_cast_failures option to the build_web_compilers|entrypoint builder which you can set to true to enable them.
    • At some point in the future it is expected that the default for this will flip.

0.3.0+1

  • Fixed an issue with dart2js and the --no-source-maps flag.

0.3.0

Breaking changes

  • Split ModuleBuilder, UnlinkedSummaryBuilder and LinkedSummaryBuilder into a separate build_modules package.

0.2.1+1

  • Support the latest analyzer package.

0.2.1

  • All dart files under test are now compiled by default instead of only the _browser_test.dart files (minus vm/node test bootstrap files). This means the original tests can be debugged directly (prior to package:test bootstrapping).
  • Updated to package:build version 0.12.0.

0.2.0

New Features

  • Added support for dart2js. This can be configured using the top level compiler option for the build_web_compilers|entrypoint builder. The supported options are dartdevc (the default) and dart2js. Args can be passed to dart2js using the dart2js_args option. For example:
targets:
  <my_package>:
    builders:
      build_web_compilers|entrypoint:
        options:
          compiler: dart2js
          dart2js_args:
          - --minify

Breaking Changes

  • Renamed ddc_bootstrap builder to entrypoint, the exposed class also changed from DevCompilerBootstrapBuilder to WebEntrypointBuilder.
  • Renamed jsBootstrapExtension to ddcBootstrapExtension since it is only required when using the dev compiler.

0.1.1

  • Mark ddc_bootstrap builder with build_to: cache.
  • Publish as build_web_compilers

0.1.0

  • Add builder factories.
  • Fixed temp dir cleanup bug on windows.
  • Enabled support for running tests in --precompiled mode.

0.0.1

  • Initial release with support for building analyzer summaries and DDC modules.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  build_web_compilers: "^0.4.0+4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:build_web_compilers/build_web_compilers.dart';
  
Version Uploaded Documentation Archive
0.4.0+4 Jun 8, 2018 Go to the documentation of build_web_compilers 0.4.0+4 Download build_web_compilers 0.4.0+4 archive
0.4.0+3 May 31, 2018 Go to the documentation of build_web_compilers 0.4.0+3 Download build_web_compilers 0.4.0+3 archive
0.4.0+1 May 15, 2018 Go to the documentation of build_web_compilers 0.4.0+1 Download build_web_compilers 0.4.0+1 archive
0.4.0 May 3, 2018 Go to the documentation of build_web_compilers 0.4.0 Download build_web_compilers 0.4.0 archive
0.3.8 May 2, 2018 Go to the documentation of build_web_compilers 0.3.8 Download build_web_compilers 0.3.8 archive
0.3.7+3 Apr 24, 2018 Go to the documentation of build_web_compilers 0.3.7+3 Download build_web_compilers 0.3.7+3 archive
0.3.7+2 Apr 24, 2018 Go to the documentation of build_web_compilers 0.3.7+2 Download build_web_compilers 0.3.7+2 archive
0.3.7+1 Apr 20, 2018 Go to the documentation of build_web_compilers 0.3.7+1 Download build_web_compilers 0.3.7+1 archive
0.3.7 Apr 19, 2018 Go to the documentation of build_web_compilers 0.3.7 Download build_web_compilers 0.3.7 archive
0.3.6 Apr 7, 2018 Go to the documentation of build_web_compilers 0.3.6 Download build_web_compilers 0.3.6 archive

All 22 versions...

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
91 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
96
Learn more about scoring.

Platforms

Detected platforms: Flutter, other

Primary library: package:build_web_compilers/build_web_compilers.dart with components: io, build.

Suggestions

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use build_web_compilers.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.50 <2.0.0
analyzer >=0.30.0 <0.33.0 0.32.3
archive >=1.0.13 <3.0.0 2.0.0
bazel_worker ^0.1.4 0.1.11
build ^0.12.4 0.12.7
build_config >=0.2.6 <0.4.0 0.3.1
build_modules ^0.2.2+1 0.2.3
cli_util ^0.1.2 0.1.3
crypto >=0.9.2 <3.0.0 2.0.5
glob ^1.1.0 1.1.6
js ^0.6.1 0.6.1
logging ^0.11.2 0.11.3+1
path ^1.4.2 1.6.1
pool ^1.3.0 1.3.5
pub_semver ^1.3.7 1.4.1
scratch_space ^0.0.2 0.0.3
source_maps ^0.10.4 0.10.6
source_span ^1.4.0 1.4.0
stack_trace ^1.9.2 1.9.2
Transitive dependencies
args 1.4.3
async 2.0.7
charcode 1.1.2
collection 1.14.10
convert 2.0.1
csslib 0.14.4
fixnum 0.10.7
front_end 0.1.3
graphs 0.1.2
html 0.13.3+1
json_annotation 0.2.9
kernel 0.3.3
meta 1.1.5
package_config 1.0.3
plugin 0.2.0+2
protobuf 0.9.0
pubspec_parse 0.1.2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+9
yaml 2.1.14
Dev dependencies
a
b
build_test ^0.10.0
test ^0.12.24