forked from esnext/es6-module-transpiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-write the module transpiler with support for bindings.
This commit removes support for AMD, YUI, and globals formats. These formats can be implemented as plugins. AMD should perhaps be included in core, but we'll see.
- Loading branch information
1 parent
861880e
commit 9ae2d8c
Showing
160 changed files
with
3,504 additions
and
1,885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,2 @@ | ||
/node_modules/ | ||
tmp/ | ||
test/index.html | ||
test/.generated | ||
bin/ | ||
dist/ | ||
node_modules/ | ||
test/results |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/usr/bin/env node | ||
|
||
var Path = require('path'); | ||
var exe = Path.basename(process.argv[1]); | ||
var getopt = require('posix-getopt'); | ||
var parser = new getopt.BasicParser('h(help)v(version)', process.argv); | ||
var option; | ||
|
||
function usage(puts) { | ||
puts(exe + ' [--help] [--version] <command> [<args>]'); | ||
puts(); | ||
puts('Commands'); | ||
puts(); | ||
puts(' convert Converts modules from `import`/`export` to an ES5 equivalent.'); | ||
puts(' help Display help for a given command.'); | ||
} | ||
|
||
function makeWriteLine(stream) { | ||
return function(line) { | ||
if (!line || line[line.length - 1] !== '\n') { | ||
line = (line || '') + '\n'; | ||
} | ||
stream.write(line); | ||
}; | ||
} | ||
|
||
var puts = makeWriteLine(process.stdout); | ||
var eputs = makeWriteLine(process.stderr); | ||
|
||
while ((option = parser.getopt()) !== undefined) { | ||
if (option.error) { | ||
usage(); | ||
process.exit(1); | ||
} | ||
|
||
switch (option.option) { | ||
case 'h': | ||
usage(puts); | ||
process.exit(0); | ||
break; | ||
|
||
case 'v': | ||
puts(exe + ' v' + require(Path.join(__dirname, '../package.json')).version); | ||
process.exit(0); | ||
break; | ||
} | ||
} | ||
|
||
var args = process.argv; | ||
var offset = parser.optind(); | ||
|
||
var commandName = args[offset]; | ||
if (commandName === 'help') { | ||
commandName = args[offset + 1]; | ||
args = ['--help'].concat(args.slice(offset + 2 /* skip 'help' and command name */)); | ||
} else { | ||
args = args.slice(offset + 1); | ||
} | ||
|
||
if (typeof commandName !== 'string') { | ||
usage(puts); | ||
process.exit(1); | ||
} | ||
|
||
var command; | ||
|
||
try { | ||
command = require(Path.join('../lib/cli', commandName)); | ||
} catch (ex) { | ||
usage(eputs); | ||
process.exit(1); | ||
} | ||
|
||
try { | ||
var exitCode = command.run(args, puts, eputs); | ||
process.exit(exitCode); | ||
} catch (ex) { | ||
if (ex.constructor.name === 'AssertionError') { | ||
eputs('error: ' + exe + ' ' + commandName + ' -- ' + ex.message); | ||
process.exit(1); | ||
} else { | ||
throw ex; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.