diff --git a/doc/caveats.md b/doc/caveats.md index 42e5fdd925..61f469ce77 100644 --- a/doc/caveats.md +++ b/doc/caveats.md @@ -10,19 +10,19 @@ redirect_from: /caveats.html In order for certain features to work they require certain polyfills. You can satisfy **all** 6to5 feature requirements by using the included -[polyfill](polyfill.md). +[polyfill](/docs/usage/polyfill). You may alternatively selectively include what you need: | Feature | Requirements | | --------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -| Abstract References | [experimental](experimental.md), `Symbol` | +| Abstract References | [experimental](/docs/usage/experimental), `Symbol` | | Array destructuring | `Array.from` | -| Async functions, Generators | [experimental](experimental.md), [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) | -| Comprehensions | [experimental](experimental.md), `Array.from` | +| Async functions, Generators | [experimental](/docs/usage/experimental), [regenerator runtime](https://github.com/facebook/regenerator/blob/master/runtime.js) | +| Comprehensions | [experimental](/docs/usage/experimental), `Array.from` | | For Of | `Symbol`, `prototype[Symbol.iterator]` | | Modules | `Object.assign`* | -| Object spread/rest | [experimental](experimental.md), `Object.assign` | +| Object spread/rest | [experimental](/docs/usage/experimental), `Object.assign` | | Spread | `Array.from` | *Only required for exporting a non-function `default` with additional `export`s. @@ -33,7 +33,7 @@ Since 6to5 assumes that your code will be ran in an ES5 environment it uses ES5 functions. So if you're using an environment that has limited or no support for ES5 such as lower versions of IE then using the [es5-shim](https://github.com/es-shims/es5-shim) along with the -[6to5 polyfill](polyfill.md) will add support for these methods. +[6to5 polyfill](/docs/usage/polyfill) will add support for these methods. ## Internet Explorer @@ -44,40 +44,8 @@ via [\_\_proto\_\_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe this is widely supported but you may run into problems with much older browsers. **NOTE:** `__proto__` is not supported on IE <= 10 so static properties -**will not** be inherited. - -You can use the `protoToAssign` optional transformer that will transform all -`__proto__` assignments to a method that will shallowly copy it over all -properties. - -```javascript -require("6to5").transform("code", { optional: ["protoToAssign"] }); -``` - -```sh -$ 6to5 --optional protoToAssign script.js -``` - -This means that the following **will** work: - -```javascript -var foo = { a: 1 }; -var bar = { b: 2 }; -bar.__proto__ = foo; -bar.a; // 1 -bar.b; // 2 -``` - -however the following **will not**: - -```javascript -var foo = { a: 1 }; -var bar = { b: 2 }; -bar.__proto__ = foo; -bar.a; // 1 -foo.a = 2; -bar.a; // 1 - should be 2 but remember that nothing is bound and it's a straight copy -``` +**will not** be inherited. See the +[protoToAssign](/docs/usage/transformers#proto-to-assign) for a possible work around. ### Getters/setters (8 and below) diff --git a/doc/compare.md b/doc/compare.md index a04e9b9f55..bcd5d72e61 100644 --- a/doc/compare.md +++ b/doc/compare.md @@ -60,7 +60,7 @@ like other transpilers, 6to5 maps directly to the equivalent ES5. Sometimes there are little inline functions that 6to5 needs. These are placed at the top of your file much like coffee-script does. If these -bother you then you can use the [optional runtime](optional-runtime.md). +bother you then you can use the [optional runtime](/docs/usage/runtime). We promise that these inline functions will never be significant and will always be used as little as possible. diff --git a/doc/usage/options.md b/doc/usage/options.md index 398381c2a0..f6583f6945 100644 --- a/doc/usage/options.md +++ b/doc/usage/options.md @@ -23,13 +23,14 @@ $ 6to5 --name=value | `fileNameRelative` | `(filename)` | Filename relative to `sourceRoot`. | | `blacklist` | `[]` | Array of transformers to **exclude**. Run `6to5 --help` to see a full list of transformers. | | `whitelist` | `[]` | Array of transformers to **only** use. Run `6to5 --help` to see a full list of transformers. | +| `optional` | `[]` | Array of transformers to [optionally](/docs/usage/transformers#optional-transformers) use. Run `6to5 --help` to see a full list of module formatters. | | `modules` | `"common"` | Which module formatter to use. Run `6to5 --help` to see a full list of module formatters. | | `sourceMap` | `false` | If truthy, adds a `map` property to returned output. If set to `"inline"`, a comment with a sourceMappingURL directive is added to the bottom of the returned code. | | `sourceMapName` | `(filenameRelative)` | Set `file` on returned source map. | | `sourceFileName` | `(filenameRelative)` | Set `sources[0]` on returned source map. | | `sourceRoot` | `(moduleRoot)` | The root from which all sources are relative. | | `moduleRoot` | `(sourceRoot)` | Optional prefix for the AMD module formatter that will be prepend to the filename on module definitions. | -| `amdModuleIds` | `false` | If truthy, insert an explicit id for each defined AMD module. By default, AMD modules are anonymous. | +| `moduleIds` | `false` | If truthy, insert an explicit id for modules. By default, all modules are anonymous. (Not available for `common` modules) | | `runtime` | `false` | Optionally replace all 6to5 helper declarations with a referenece to this variable. If set to `true` then the default namespace is used `to5Runtime`. | | `comments` | `true` | Output comments in generated output. | | `experimental` | `false` | Enable support for experimental ES7 features. |