Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(403)

Side by Side Diff: lib/src/options.dart

Issue 1633003002: Add --modules=node support (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged master Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/compiler.dart ('k') | test/browser/runtime_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Set of flags and options passed to the compiler 5 /// Set of flags and options passed to the compiler
6 library dev_compiler.src.options; 6 library dev_compiler.src.options;
7 7
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:args/args.dart'; 10 import 'package:args/args.dart';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 {this.useMockSdk: false, 51 {this.useMockSdk: false,
52 this.dartSdkPath, 52 this.dartSdkPath,
53 this.useMultiPackage: false, 53 this.useMultiPackage: false,
54 this.customUrlMappings: const {}, 54 this.customUrlMappings: const {},
55 this.packageRoot: 'packages/', 55 this.packageRoot: 'packages/',
56 this.packagePaths: const <String>[], 56 this.packagePaths: const <String>[],
57 this.resources: const <String>[], 57 this.resources: const <String>[],
58 this.useImplicitHtml: false}); 58 this.useImplicitHtml: false});
59 } 59 }
60 60
61 enum ModuleFormat { es6, legacy } 61 enum ModuleFormat { es6, legacy, node }
62 ModuleFormat parseModuleFormat(String s) => parseEnum(s, ModuleFormat.values); 62 ModuleFormat parseModuleFormat(String s) => parseEnum(s, ModuleFormat.values);
63 63
64 // TODO(jmesserly): refactor all codegen options here. 64 // TODO(jmesserly): refactor all codegen options here.
65 class CodegenOptions { 65 class CodegenOptions {
66 /// Whether to emit the source map files. 66 /// Whether to emit the source map files.
67 final bool emitSourceMaps; 67 final bool emitSourceMaps;
68 68
69 /// Whether to force compilation of code with static errors. 69 /// Whether to force compilation of code with static errors.
70 final bool forceCompile; 70 final bool forceCompile;
71 71
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ..addOption('runtime-dir', 308 ..addOption('runtime-dir',
309 help: 'Where to find dev_compiler\'s runtime files', defaultsTo: null) 309 help: 'Where to find dev_compiler\'s runtime files', defaultsTo: null)
310 ..addFlag('arrow-fn-bind-this', 310 ..addFlag('arrow-fn-bind-this',
311 help: 'Work around `this` binding in => functions') 311 help: 'Work around `this` binding in => functions')
312 ..addOption('modules', 312 ..addOption('modules',
313 help: 'Which module pattern to emit', 313 help: 'Which module pattern to emit',
314 allowed: ModuleFormat.values.map(getEnumName).toList(), 314 allowed: ModuleFormat.values.map(getEnumName).toList(),
315 allowedHelp: { 315 allowedHelp: {
316 getEnumName(ModuleFormat.es6): 'es6 modules', 316 getEnumName(ModuleFormat.es6): 'es6 modules',
317 getEnumName(ModuleFormat.legacy): 317 getEnumName(ModuleFormat.legacy):
318 'a custom format used by dartdevc, similar to AMD' 318 'a custom format used by dartdevc, similar to AMD',
319 getEnumName(ModuleFormat.node):
320 'node.js modules (https://nodejs.org/api/modules.html)'
319 }, 321 },
320 defaultsTo: getEnumName(ModuleFormat.legacy)) 322 defaultsTo: getEnumName(ModuleFormat.legacy))
321 323
322 // general options 324 // general options
323 ..addFlag('help', abbr: 'h', help: 'Display this message') 325 ..addFlag('help', abbr: 'h', help: 'Display this message')
324 ..addFlag('version', 326 ..addFlag('version',
325 negatable: false, help: 'Display the Dev Compiler verion') 327 negatable: false, help: 'Display the Dev Compiler verion')
326 ..addFlag('server', help: 'Run as a development server.', defaultsTo: false) 328 ..addFlag('server', help: 'Run as a development server.', defaultsTo: false)
327 ..addFlag('hashing', 329 ..addFlag('hashing',
328 help: 'Enable hash-based file caching.', defaultsTo: null) 330 help: 'Enable hash-based file caching.', defaultsTo: null)
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 // The pub-cache directory is two levels up, but we verify that the layout 411 // The pub-cache directory is two levels up, but we verify that the layout
410 // looks correct. 412 // looks correct.
411 if (path.basename(dir) != 'dev_compiler') return null; 413 if (path.basename(dir) != 'dev_compiler') return null;
412 dir = path.dirname(dir); 414 dir = path.dirname(dir);
413 if (path.basename(dir) != 'global_packages') return null; 415 if (path.basename(dir) != 'global_packages') return null;
414 dir = path.dirname(dir); 416 dir = path.dirname(dir);
415 return path.join(dir, cacheDir, 'lib', 'runtime'); 417 return path.join(dir, cacheDir, 'lib', 'runtime');
416 } 418 }
417 return null; 419 return null;
418 } 420 }
OLDNEW
« no previous file with comments | « lib/src/compiler.dart ('k') | test/browser/runtime_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698