start static method

Future<DartDevcFrontendServerClient> start(
  1. String entrypoint,
  2. String outputDillPath, {
  3. String dartdevcModuleFormat = 'amd',
  4. bool debug = false,
  5. bool enableHttpUris = false,
  6. List<String> fileSystemRoots = const [],
  7. String fileSystemScheme = 'org-dartlang-root',
  8. String? frontendServerPath,
  9. String packagesJson = '.dart_tool/package_config.json',
  10. String? platformKernel,
  11. String? sdkRoot,
  12. bool verbose = false,
  13. bool printIncrementalDependencies = true,
})
override

Starts the frontend server.

Most arguments directly mirror the command line arguments for the frontend_server (see pkg/frontend_server/lib/frontend_server.dart in the sdk). Options are exposed on an as-needed basis.

The entrypoint and packagesJson may be a relative path or any uri supported by the frontend server.

The outputDillPath determines where the primary output should be, and some targets may output additional files based on that file name (by adding file extensions for instance).

When the frontendServerPath argument is provided, the frontend server will be started from the specified file. The specified file can either be a Dart source file or an AppJIT snapshot.

When the frontendServerPath argument is provided, setting debug to true permits debuggers to attach to the frontend server. When the frontendServerPath argument is omitted, setting debug to true will cause an ArgumentError to be thrown.

Implementation

static Future<DartDevcFrontendServerClient> start(
  String entrypoint,
  String outputDillPath, {
  String dartdevcModuleFormat = 'amd',
  bool debug = false,
  bool enableHttpUris = false,
  List<String> fileSystemRoots = const [], // For `fileSystemScheme` uris,
  String fileSystemScheme =
      'org-dartlang-root', // Custom scheme for virtual `fileSystemRoots`.
  String? frontendServerPath, // Defaults to the snapshot in the sdk.
  String packagesJson = '.dart_tool/package_config.json',
  String? platformKernel, // Defaults to the dartdevc platform from the sdk.
  String? sdkRoot, // Defaults to the current SDK root.
  bool verbose = false,
  bool printIncrementalDependencies = true,
}) async {
  var feServer = await FrontendServerClient.start(
    entrypoint,
    outputDillPath,
    platformKernel ?? _dartdevcPlatformKernel,
    dartdevcModuleFormat: dartdevcModuleFormat,
    debug: debug,
    enableHttpUris: enableHttpUris,
    fileSystemRoots: fileSystemRoots,
    fileSystemScheme: fileSystemScheme,
    frontendServerPath: frontendServerPath,
    packagesJson: packagesJson,
    sdkRoot: sdkRoot,
    target: 'dartdevc',
    verbose: verbose,
  );
  return DartDevcFrontendServerClient._(
      feServer, Uri.parse(entrypoint).path, dartdevcModuleFormat);
}