google/traceur-compiler — pull request #744 by guybedford (2014-02-05 10:14:54+00:00)
Title: use "transpiled module" flag over __transpiledModule export

Unfortunately it turns out the `__transpiledModule` export from https://github.com/google/traceur-compiler/pull/683 isn't sufficient.

The reason for this is that the export can only be detected after execution, while we need to have meta that can be detected at the linking stage.

For example, if an ES6 module imports an AMD module, it has to access the module from the `default` property. But if an ES6 module is transpiled into AMD, and loads that same AMD module trying to access the `default` property, this causes an error.

This fix creates the following syntax instead:

```javascript
"transpiled module";
define([], function() {
// ...
});
```

This can then be detected by a regular expression that only needs to check the first few characters of the source, something of the form `/^(\s*(\/\*.*\*\/)|(\/\/[^\n]*))*"transpiled module";/`

I've included the test for the regex as well in this PR.