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

Unified Diff: lib/src/compiler/compiler.dart

Issue 2249233002: fix #626, add AMD module format and make it default (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: fix sunflower Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/compiler/compiler.dart
diff --git a/lib/src/compiler/compiler.dart b/lib/src/compiler/compiler.dart
index 77d03f06001903d13721d8df95cad6b419dd1298..c4d41690c1c4207813d69ce28badcca2bd6a9b06 100644
--- a/lib/src/compiler/compiler.dart
+++ b/lib/src/compiler/compiler.dart
@@ -143,11 +143,14 @@ class ModuleCompiler {
}
}
-enum ModuleFormat { es6, legacy, node }
+enum ModuleFormat { es6, commonjs, requirejs, legacy }
ModuleFormat parseModuleFormat(String s) => {
'es6': ModuleFormat.es6,
- 'node': ModuleFormat.node,
+ 'commonjs': ModuleFormat.commonjs,
+ 'requirejs': ModuleFormat.requirejs,
+ // Deprecated:
+ 'node': ModuleFormat.commonjs,
'legacy': ModuleFormat.legacy
}[s];
@@ -222,7 +225,7 @@ class CompilerOptions {
this.emitMetadata: false,
this.closure: false,
this.destructureNamedParams: false,
- this.moduleFormat: ModuleFormat.legacy,
+ this.moduleFormat: ModuleFormat.requirejs,
this.hoistInstanceCreation: true,
this.hoistSignatureTypes: false,
this.nameTypeTests: true,
@@ -258,15 +261,21 @@ class CompilerOptions {
'disable if using X-SourceMap header',
defaultsTo: true,
hide: true)
- ..addOption('modules',
- help: 'module pattern to emit',
- allowed: ['es6', 'legacy', 'node'],
- allowedHelp: {
- 'es6': 'es6 modules',
- 'legacy': 'a custom format used by dartdevc, similar to AMD',
- 'node': 'node.js modules (https://nodejs.org/api/modules.html)'
- },
- defaultsTo: 'legacy')
+ ..addOption('modules',
+ help: 'module pattern to emit',
+ allowed: [
+ 'es6',
+ 'commonjs',
+ 'requirejs',
+ /*deprecated*/ 'legacy',
+ /*renamed to commonjs*/ 'node'
+ ],
+ allowedHelp: {
+ 'es6': 'es6 modules',
+ 'commonjs': 'commonjs/node.js modules',
+ 'requirejs': 'requirejs/amd modules'
nweiz 2016/08/16 22:14:53 Nit: add capitalization to the help strings here.
Jennifer Messerly 2016/08/24 22:39:51 Done.
+ },
+ defaultsTo: 'requirejs')
vsm 2016/08/16 21:23:23 We should keep the default until we fix downstream
Jennifer Messerly 2016/08/16 21:29:27 it's really easy to tweak our internal build rules
Jennifer Messerly 2016/08/16 21:34:45 I just sent you a CL that pins internal build rule
Jennifer Messerly 2016/08/24 22:39:51 update: and this was landed.
..addFlag('emit-metadata',
help: 'emit metadata annotations queriable via mirrors',
defaultsTo: false)

Powered by Google App Engine
This is Rietveld 408576698