(moduleAndSpecifiers)
| 183 | * @returns {SourceData} the generated source |
| 184 | */ |
| 185 | const getSourceForCommonJsExternal = (moduleAndSpecifiers) => { |
| 186 | if (!Array.isArray(moduleAndSpecifiers)) { |
| 187 | return { |
| 188 | expression: `require(${JSON.stringify(moduleAndSpecifiers)})` |
| 189 | }; |
| 190 | } |
| 191 | const moduleName = moduleAndSpecifiers[0]; |
| 192 | return { |
| 193 | expression: `require(${JSON.stringify(moduleName)})${propertyAccess( |
| 194 | moduleAndSpecifiers, |
| 195 | 1 |
| 196 | )}` |
| 197 | }; |
| 198 | }; |
| 199 | |
| 200 | /** |
| 201 | * Gets external module node commonjs init fragment. |
no test coverage detected