Skip to main content

dwi_builder 0.6.0 copy "dwi_builder: ^0.6.0" to clipboard
dwi_builder: ^0.6.0 copied to clipboard

Build-time discovery, generation and compilation of DWI worker entrypoints.

example/dwi_builder_example.dart

/// Builds a project's worker entrypoint programmatically.
///
/// Equivalent to `dart run dwi_builder build`, and to what the Flutter build
/// hook runs. Set `compile: false` to generate sources without invoking
/// `dart compile js`.
library;

import 'package:dwi_builder/dwi_builder.dart';

Future<void> main() async {
  final builder = DwiBuilder(
    const DwiBuildConfig(
      projectRoot: '.',
      compile: false,
    ),
  );

  final result = await builder.build();
  print('package: ${result.discovery.packageName}');
  print('tasks: ${result.discovery.tasks.map((task) => task.name).join(', ')}');
  print('generated worker: ${result.workerSourcePath}');
  print('generated proxies: ${result.proxiesPath}');
  print('content hash: ${result.hash}');
  print('compiled: ${result.compiled}, cache hit: ${result.cacheHit}');
  print('took ${result.duration.inMilliseconds} ms');
}
0
likes
0
points
788
downloads

Publisher

unverified uploader

Weekly Downloads

Build-time discovery, generation and compilation of DWI worker entrypoints.

Repository (GitHub)
View/report issues

Topics

#isolate #concurrency #web-worker #wasm

License

unknown (license)

Dependencies

analyzer, args, crypto, dwi_annotations, hooks, path, yaml

More

Packages that depend on dwi_builder