()
| 13 | } |
| 14 | |
| 15 | importTransforms() { |
| 16 | const shimAmd = require('./amd-shim'); |
| 17 | |
| 18 | return { |
| 19 | amd: { |
| 20 | transform: (tree, options) => { |
| 21 | let nameMapping = {}; |
| 22 | for (let relativePath in options) { |
| 23 | nameMapping[relativePath] = options[relativePath].as; |
| 24 | } |
| 25 | |
| 26 | let amdTransform = shimAmd(tree, nameMapping); |
| 27 | |
| 28 | return amdTransform; |
| 29 | }, |
| 30 | processOptions: (assetPath, entry, options) => { |
| 31 | // If the import is specified to be a different name we must break because of the broccoli rewrite behavior. |
| 32 | if (Object.keys(options).indexOf(assetPath) !== -1 && options[assetPath].as !== entry.as) { |
| 33 | throw new Error( |
| 34 | `Highlander error while importing ${assetPath}. You may not import an AMD transformed asset at different module names.` |
| 35 | ); |
| 36 | } |
| 37 | |
| 38 | options[assetPath] = { |
| 39 | as: entry.as, |
| 40 | }; |
| 41 | |
| 42 | return options; |
| 43 | }, |
| 44 | }, |
| 45 | }; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | module.exports = AmdTransformAddon; |
no outgoing calls
no test coverage detected