1
0
mirror of https://github.com/fluencelabs/wasm-bindgen synced 2025-03-16 18:20:51 +00:00

Dropped node support in umd -> amd

This commit is contained in:
Sharad Chand 2018-04-07 13:06:36 +05:45
parent 2b9af53030
commit 0bd8713bd5
3 changed files with 74 additions and 97 deletions
crates
cli-support/src
cli/src/bin

@ -47,7 +47,7 @@ impl<'a> Context<'a> {
let contents = contents.trim(); let contents = contents.trim();
let global = if self.config.nodejs { let global = if self.config.nodejs {
format!("module.exports.{} = {};\n", name, contents) format!("module.exports.{} = {};\n", name, contents)
} else if self.config.umd { } else if self.config.amd {
format!("__exports.{} = {}\n", name, contents) format!("__exports.{} = {}\n", name, contents)
} else { } else {
if contents.starts_with("function") { if contents.starts_with("function") {
@ -66,7 +66,7 @@ impl<'a> Context<'a> {
{ {
let mut bind = |name: &str, f: &Fn(&mut Self) -> String| { let mut bind = |name: &str, f: &Fn(&mut Self) -> String| {
if !self.wasm_import_needed(name) { if !self.wasm_import_needed(name) {
return return;
} }
let contents = f(self); let contents = f(self);
let contents = contents.trim(); let contents = contents.trim();
@ -229,61 +229,39 @@ impl<'a> Context<'a> {
self.footer.push_str(&format!("wasm = require('./{}_bg');", self.footer.push_str(&format!("wasm = require('./{}_bg');",
module_name)); module_name));
format!("var wasm;") format!("var wasm;")
} else if self.config.umd { } else if self.config.amd {
format!(" format!("
if(typeof window === 'undefined' && typeof process === 'object') {{ return fetch('{module}_bg.wasm')
const fs = require('fs'); .then(response => response.arrayBuffer())
const path = require('path'); .then(buffer => WebAssembly.instantiate(buffer, __js_exports))
const wasm_path = path.join(__dirname, '{module}_bg.wasm'); .then(({{instance}}) => {{
const buffer = fs.readFileSync(wasm_path); wasm = instance.exports;
const mod = new WebAssembly.Module(buffer); return wasm;
}})
return __initialize(mod, false); .catch(error => {{
}} else {{ console.log('Error loading wasm module `{module}`:', error);
return fetch('{module}_bg.wasm') throw error;
.then(response => response.arrayBuffer()) }});
.then(bytes => WebAssembly.compile(bytes)) ", module = module_name)
.then(mod => __initialize(mod, true));
}}", module = module_name)
} else { } else {
format!("import * as wasm from './{}_bg';", module_name) format!("import * as wasm from './{}_bg';", module_name)
}; };
let js = if self.config.umd { let js = if self.config.amd {
format!(" format!("
(function (root, factory) {{ (function (root, factory) {{
if (typeof define === 'function' && define.amd) {{ if (typeof define === 'function' && define.amd) {{
define([], factory); define([], factory);
}} else if (typeof module === 'object' && module.exports) {{
module.exports = factory();
}} else {{ }} else {{
root.{module} = factory(); root.{module} = factory();
}} }}
}}(typeof self !== 'undefined' ? self : this, function() {{ }}(typeof self !== 'undefined' ? self : this, function() {{
let wasm; let wasm;
const __js_exports = {{}};
const __exports = {{}};
{globals}
__js_exports['./{module}'] = __exports;
{import_wasm} {import_wasm}
function __initialize(__mod, __load_async) {{
const __js_exports = {{}};
const __exports = {{}};
{globals}
__js_exports['./{module}'] = __exports;
if (__load_async) {{
return WebAssembly.instantiate(__mod, __js_exports)
.then(instance => {{
wasm = instance.exports;
return instance.exports;
}})
.catch(error => {{
console.log('Error loading wasm module `{module}`:', error);
throw error;
}});
}} else {{
const instance = new WebAssembly.Instance(__mod, __js_exports);
wasm = instance.exports;
return instance.exports;
}}
}}
}})) }}))
", ",
module = module_name, module = module_name,
@ -380,7 +358,7 @@ impl<'a> Context<'a> {
} }
fn _rewrite_imports(&mut self, module_name: &str) fn _rewrite_imports(&mut self, module_name: &str)
-> Vec<(String, String)> -> Vec<(String, String)>
{ {
let mut math_imports = Vec::new(); let mut math_imports = Vec::new();
let imports = self.module.sections_mut() let imports = self.module.sections_mut()
@ -398,11 +376,11 @@ impl<'a> Context<'a> {
import.module_mut().truncate(0); import.module_mut().truncate(0);
import.module_mut().push_str("./"); import.module_mut().push_str("./");
import.module_mut().push_str(module_name); import.module_mut().push_str(module_name);
continue continue;
} }
if import.module() != "env" { if import.module() != "env" {
continue continue;
} }
let renamed_import = format!("__wbindgen_{}", import.field()); let renamed_import = format!("__wbindgen_{}", import.field());
@ -477,7 +455,7 @@ impl<'a> Context<'a> {
fn expose_drop_ref(&mut self) { fn expose_drop_ref(&mut self) {
if !self.exposed_globals.insert("drop_ref") { if !self.exposed_globals.insert("drop_ref") {
return return;
} }
self.expose_global_slab(); self.expose_global_slab();
self.expose_global_slab_next(); self.expose_global_slab_next();
@ -520,7 +498,7 @@ impl<'a> Context<'a> {
fn expose_global_stack(&mut self) { fn expose_global_stack(&mut self) {
if !self.exposed_globals.insert("stack") { if !self.exposed_globals.insert("stack") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
let stack = []; let stack = [];
@ -529,14 +507,14 @@ impl<'a> Context<'a> {
fn expose_global_slab(&mut self) { fn expose_global_slab(&mut self) {
if !self.exposed_globals.insert("slab") { if !self.exposed_globals.insert("slab") {
return return;
} }
self.globals.push_str(&format!("let slab = [];")); self.globals.push_str(&format!("let slab = [];"));
} }
fn expose_global_slab_next(&mut self) { fn expose_global_slab_next(&mut self) {
if !self.exposed_globals.insert("slab_next") { if !self.exposed_globals.insert("slab_next") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
let slab_next = 0; let slab_next = 0;
@ -545,7 +523,7 @@ impl<'a> Context<'a> {
fn expose_get_object(&mut self) { fn expose_get_object(&mut self) {
if !self.exposed_globals.insert("get_object") { if !self.exposed_globals.insert("get_object") {
return return;
} }
self.expose_global_stack(); self.expose_global_stack();
self.expose_global_slab(); self.expose_global_slab();
@ -575,7 +553,7 @@ impl<'a> Context<'a> {
fn expose_check_token(&mut self) { fn expose_check_token(&mut self) {
if !self.exposed_globals.insert("check_token") { if !self.exposed_globals.insert("check_token") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
const token = Symbol('foo'); const token = Symbol('foo');
@ -588,7 +566,7 @@ impl<'a> Context<'a> {
fn expose_assert_num(&mut self) { fn expose_assert_num(&mut self) {
if !self.exposed_globals.insert("assert_num") { if !self.exposed_globals.insert("assert_num") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function _assertNum(n) {{ function _assertNum(n) {{
@ -600,7 +578,7 @@ impl<'a> Context<'a> {
fn expose_assert_bool(&mut self) { fn expose_assert_bool(&mut self) {
if !self.exposed_globals.insert("assert_bool") { if !self.exposed_globals.insert("assert_bool") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function _assertBoolean(n) {{ function _assertBoolean(n) {{
@ -612,7 +590,7 @@ impl<'a> Context<'a> {
fn expose_pass_string_to_wasm(&mut self) { fn expose_pass_string_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_string_to_wasm") { if !self.exposed_globals.insert("pass_string_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.expose_text_encoder(); self.expose_text_encoder();
@ -638,7 +616,7 @@ impl<'a> Context<'a> {
fn expose_pass_array8_to_wasm(&mut self) { fn expose_pass_array8_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_array8_to_wasm") { if !self.exposed_globals.insert("pass_array8_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.expose_uint8_memory(); self.expose_uint8_memory();
@ -653,7 +631,7 @@ impl<'a> Context<'a> {
fn expose_pass_array16_to_wasm(&mut self) { fn expose_pass_array16_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_array16_to_wasm") { if !self.exposed_globals.insert("pass_array16_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.expose_uint16_memory(); self.expose_uint16_memory();
@ -668,7 +646,7 @@ impl<'a> Context<'a> {
fn expose_pass_array32_to_wasm(&mut self) { fn expose_pass_array32_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_array32_to_wasm") { if !self.exposed_globals.insert("pass_array32_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.expose_uint32_memory(); self.expose_uint32_memory();
@ -683,7 +661,7 @@ impl<'a> Context<'a> {
fn expose_pass_array_f32_to_wasm(&mut self) { fn expose_pass_array_f32_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_array_f32_to_wasm") { if !self.exposed_globals.insert("pass_array_f32_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.globals.push_str(&format!(" self.globals.push_str(&format!("
@ -697,7 +675,7 @@ impl<'a> Context<'a> {
fn expose_pass_array_f64_to_wasm(&mut self) { fn expose_pass_array_f64_to_wasm(&mut self) {
if !self.exposed_globals.insert("pass_array_f64_to_wasm") { if !self.exposed_globals.insert("pass_array_f64_to_wasm") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_malloc"); self.required_internal_exports.insert("__wbindgen_malloc");
self.globals.push_str(&format!(" self.globals.push_str(&format!("
@ -711,7 +689,7 @@ impl<'a> Context<'a> {
fn expose_text_encoder(&mut self) { fn expose_text_encoder(&mut self) {
if !self.exposed_globals.insert("text_encoder") { if !self.exposed_globals.insert("text_encoder") {
return return;
} }
if self.config.nodejs { if self.config.nodejs {
self.globals.push_str(&format!(" self.globals.push_str(&format!("
@ -731,7 +709,7 @@ impl<'a> Context<'a> {
fn expose_text_decoder(&mut self) { fn expose_text_decoder(&mut self) {
if !self.exposed_globals.insert("text_decoder") { if !self.exposed_globals.insert("text_decoder") {
return return;
} }
if self.config.nodejs { if self.config.nodejs {
self.globals.push_str(&format!(" self.globals.push_str(&format!("
@ -751,7 +729,7 @@ impl<'a> Context<'a> {
fn expose_get_string_from_wasm(&mut self) { fn expose_get_string_from_wasm(&mut self) {
if !self.exposed_globals.insert("get_string_from_wasm") { if !self.exposed_globals.insert("get_string_from_wasm") {
return return;
} }
self.expose_text_decoder(); self.expose_text_decoder();
self.expose_uint8_memory(); self.expose_uint8_memory();
@ -764,7 +742,7 @@ impl<'a> Context<'a> {
fn expose_get_array_js_value_from_wasm(&mut self) { fn expose_get_array_js_value_from_wasm(&mut self) {
if !self.exposed_globals.insert("get_array_js_value_from_wasm") { if !self.exposed_globals.insert("get_array_js_value_from_wasm") {
return return;
} }
self.expose_get_array_u32_from_wasm(); self.expose_get_array_u32_from_wasm();
self.expose_get_object(); self.expose_get_object();
@ -784,7 +762,7 @@ impl<'a> Context<'a> {
fn expose_get_array_i8_from_wasm(&mut self) { fn expose_get_array_i8_from_wasm(&mut self) {
self.expose_uint8_memory(); self.expose_uint8_memory();
if !self.exposed_globals.insert("get_array_i8_from_wasm") { if !self.exposed_globals.insert("get_array_i8_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayI8FromWasm(ptr, len) {{ function getArrayI8FromWasm(ptr, len) {{
@ -798,7 +776,7 @@ impl<'a> Context<'a> {
fn expose_get_array_u8_from_wasm(&mut self) { fn expose_get_array_u8_from_wasm(&mut self) {
self.expose_uint8_memory(); self.expose_uint8_memory();
if !self.exposed_globals.insert("get_array_u8_from_wasm") { if !self.exposed_globals.insert("get_array_u8_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayU8FromWasm(ptr, len) {{ function getArrayU8FromWasm(ptr, len) {{
@ -812,7 +790,7 @@ impl<'a> Context<'a> {
fn expose_get_array_i16_from_wasm(&mut self) { fn expose_get_array_i16_from_wasm(&mut self) {
self.expose_uint16_memory(); self.expose_uint16_memory();
if !self.exposed_globals.insert("get_array_i16_from_wasm") { if !self.exposed_globals.insert("get_array_i16_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayI16FromWasm(ptr, len) {{ function getArrayI16FromWasm(ptr, len) {{
@ -826,7 +804,7 @@ impl<'a> Context<'a> {
fn expose_get_array_u16_from_wasm(&mut self) { fn expose_get_array_u16_from_wasm(&mut self) {
self.expose_uint16_memory(); self.expose_uint16_memory();
if !self.exposed_globals.insert("get_array_u16_from_wasm") { if !self.exposed_globals.insert("get_array_u16_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayU16FromWasm(ptr, len) {{ function getArrayU16FromWasm(ptr, len) {{
@ -840,7 +818,7 @@ impl<'a> Context<'a> {
fn expose_get_array_i32_from_wasm(&mut self) { fn expose_get_array_i32_from_wasm(&mut self) {
self.expose_uint32_memory(); self.expose_uint32_memory();
if !self.exposed_globals.insert("get_array_i32_from_wasm") { if !self.exposed_globals.insert("get_array_i32_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayI32FromWasm(ptr, len) {{ function getArrayI32FromWasm(ptr, len) {{
@ -854,7 +832,7 @@ impl<'a> Context<'a> {
fn expose_get_array_u32_from_wasm(&mut self) { fn expose_get_array_u32_from_wasm(&mut self) {
self.expose_uint32_memory(); self.expose_uint32_memory();
if !self.exposed_globals.insert("get_array_u32_from_wasm") { if !self.exposed_globals.insert("get_array_u32_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayU32FromWasm(ptr, len) {{ function getArrayU32FromWasm(ptr, len) {{
@ -867,7 +845,7 @@ impl<'a> Context<'a> {
fn expose_get_array_f32_from_wasm(&mut self) { fn expose_get_array_f32_from_wasm(&mut self) {
if !self.exposed_globals.insert("get_array_f32_from_wasm") { if !self.exposed_globals.insert("get_array_f32_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayF32FromWasm(ptr, len) {{ function getArrayF32FromWasm(ptr, len) {{
@ -880,7 +858,7 @@ impl<'a> Context<'a> {
fn expose_get_array_f64_from_wasm(&mut self) { fn expose_get_array_f64_from_wasm(&mut self) {
if !self.exposed_globals.insert("get_array_f64_from_wasm") { if !self.exposed_globals.insert("get_array_f64_from_wasm") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function getArrayF64FromWasm(ptr, len) {{ function getArrayF64FromWasm(ptr, len) {{
@ -893,7 +871,7 @@ impl<'a> Context<'a> {
fn expose_uint8_memory(&mut self) { fn expose_uint8_memory(&mut self) {
if !self.exposed_globals.insert("uint8_memory") { if !self.exposed_globals.insert("uint8_memory") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
let cachedUint8Memory = null; let cachedUint8Memory = null;
@ -908,7 +886,7 @@ impl<'a> Context<'a> {
fn expose_uint16_memory(&mut self) { fn expose_uint16_memory(&mut self) {
if !self.exposed_globals.insert("uint16_memory") { if !self.exposed_globals.insert("uint16_memory") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
let cachedUint16Memory = null; let cachedUint16Memory = null;
@ -923,7 +901,7 @@ impl<'a> Context<'a> {
fn expose_uint32_memory(&mut self) { fn expose_uint32_memory(&mut self) {
if !self.exposed_globals.insert("uint32_memory") { if !self.exposed_globals.insert("uint32_memory") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
let cachedUint32Memory = null; let cachedUint32Memory = null;
@ -938,7 +916,7 @@ impl<'a> Context<'a> {
fn expose_assert_class(&mut self) { fn expose_assert_class(&mut self) {
if !self.exposed_globals.insert("assert_class") { if !self.exposed_globals.insert("assert_class") {
return return;
} }
self.globals.push_str(&format!(" self.globals.push_str(&format!("
function _assertClass(instance, klass) {{ function _assertClass(instance, klass) {{
@ -951,7 +929,7 @@ impl<'a> Context<'a> {
fn expose_borrowed_objects(&mut self) { fn expose_borrowed_objects(&mut self) {
if !self.exposed_globals.insert("borrowed_objects") { if !self.exposed_globals.insert("borrowed_objects") {
return return;
} }
self.expose_global_stack(); self.expose_global_stack();
self.globals.push_str(&format!(" self.globals.push_str(&format!("
@ -964,7 +942,7 @@ impl<'a> Context<'a> {
fn expose_take_object(&mut self) { fn expose_take_object(&mut self) {
if !self.exposed_globals.insert("take_object") { if !self.exposed_globals.insert("take_object") {
return return;
} }
self.expose_get_object(); self.expose_get_object();
self.expose_drop_ref(); self.expose_drop_ref();
@ -979,7 +957,7 @@ impl<'a> Context<'a> {
fn expose_add_heap_object(&mut self) { fn expose_add_heap_object(&mut self) {
if !self.exposed_globals.insert("add_heap_object") { if !self.exposed_globals.insert("add_heap_object") {
return return;
} }
self.expose_global_slab(); self.expose_global_slab();
self.expose_global_slab_next(); self.expose_global_slab_next();
@ -1100,7 +1078,7 @@ impl<'a> Context<'a> {
fn expose_set_global_argument(&mut self) { fn expose_set_global_argument(&mut self) {
if !self.exposed_globals.insert("set_global_argument") { if !self.exposed_globals.insert("set_global_argument") {
return return;
} }
self.expose_uint32_memory(); self.expose_uint32_memory();
self.expose_global_argument_ptr(); self.expose_global_argument_ptr();
@ -1114,7 +1092,7 @@ impl<'a> Context<'a> {
fn expose_get_global_argument(&mut self) { fn expose_get_global_argument(&mut self) {
if !self.exposed_globals.insert("get_global_argument") { if !self.exposed_globals.insert("get_global_argument") {
return return;
} }
self.expose_uint32_memory(); self.expose_uint32_memory();
self.expose_global_argument_ptr(); self.expose_global_argument_ptr();
@ -1128,7 +1106,7 @@ impl<'a> Context<'a> {
fn expose_global_argument_ptr(&mut self) { fn expose_global_argument_ptr(&mut self) {
if !self.exposed_globals.insert("global_argument_ptr") { if !self.exposed_globals.insert("global_argument_ptr") {
return return;
} }
self.required_internal_exports.insert("__wbindgen_global_argument_ptr"); self.required_internal_exports.insert("__wbindgen_global_argument_ptr");
self.globals.push_str(" self.globals.push_str("
@ -1157,7 +1135,7 @@ impl<'a, 'b> SubContext<'a, 'b> {
pub fn generate_export(&mut self, export: &shared::Export) { pub fn generate_export(&mut self, export: &shared::Export) {
if let Some(ref class) = export.class { if let Some(ref class) = export.class {
return self.generate_export_for_class(class, export) return self.generate_export_for_class(class, export);
} }
let (js, ts) = self.generate_function("function", let (js, ts) = self.generate_function("function",
&export.function.name, &export.function.name,
@ -1237,8 +1215,7 @@ impl<'a, 'b> SubContext<'a, 'b> {
arg_conversions.push_str(&format!("\ arg_conversions.push_str(&format!("\
_assertBoolean({name}); _assertBoolean({name});
", name = name)); ", name = name));
} else { } else {}
}
pass(&format!("arg{i} ? 1 : 0", i = i)) pass(&format!("arg{i} ? 1 : 0", i = i))
} }
shared::TYPE_JS_OWNED => { shared::TYPE_JS_OWNED => {
@ -1381,9 +1358,9 @@ impl<'a, 'b> SubContext<'a, 'b> {
const ret = wasm.{}({passed}); const ret = wasm.{}({passed});
{convert_ret} {convert_ret}
", ",
f = wasm_name, f = wasm_name,
passed = passed_args, passed = passed_args,
convert_ret = convert_ret, convert_ret = convert_ret,
)); ));
} else { } else {
dst.push_str(&format!("\ dst.push_str(&format!("\
@ -1394,10 +1371,10 @@ impl<'a, 'b> SubContext<'a, 'b> {
{destructors} {destructors}
}} }}
", ",
f = wasm_name, f = wasm_name,
passed = passed_args, passed = passed_args,
destructors = destructors, destructors = destructors,
convert_ret = convert_ret, convert_ret = convert_ret,
)); ));
} }
dst.push_str("}"); dst.push_str("}");

@ -17,7 +17,7 @@ pub struct Bindgen {
path: Option<PathBuf>, path: Option<PathBuf>,
nodejs: bool, nodejs: bool,
browser: bool, browser: bool,
umd: bool, amd: bool,
debug: bool, debug: bool,
typescript: bool, typescript: bool,
} }
@ -37,7 +37,7 @@ impl Bindgen {
path: None, path: None,
nodejs: false, nodejs: false,
browser: false, browser: false,
umd: false, amd: false,
debug: false, debug: false,
typescript: false, typescript: false,
} }
@ -58,8 +58,8 @@ impl Bindgen {
self self
} }
pub fn umd(&mut self, umd: bool) -> &mut Bindgen { pub fn amd(&mut self, amd: bool) -> &mut Bindgen {
self.umd = umd; self.amd = amd;
self self
} }

@ -32,7 +32,7 @@ Options:
struct Args { struct Args {
flag_nodejs: bool, flag_nodejs: bool,
flag_browser: bool, flag_browser: bool,
flag_umd: bool, flag_amd: bool,
flag_typescript: bool, flag_typescript: bool,
flag_out_dir: Option<PathBuf>, flag_out_dir: Option<PathBuf>,
flag_debug: bool, flag_debug: bool,
@ -59,7 +59,7 @@ fn main() {
b.input_path(&input) b.input_path(&input)
.nodejs(args.flag_nodejs) .nodejs(args.flag_nodejs)
.browser(args.flag_browser) .browser(args.flag_browser)
.umd(args.flag_umd) .amd(args.flag_amd)
.debug(args.flag_debug) .debug(args.flag_debug)
.typescript(args.flag_typescript); .typescript(args.flag_typescript);