(project: Project, p: FsProject)
| 250 | // Generate all target-* files |
| 251 | // |
| 252 | function generateTargets(project: Project, p: FsProject) { |
| 253 | /** Array of metadata about target files to be imported */ |
| 254 | const targets: Array<Target> = []; |
| 255 | // TODO does allowJs matter? |
| 256 | for (const inOut of [false, true]) { |
| 257 | for (const inSrc of [false, true]) { |
| 258 | for (const srcExt of [ |
| 259 | 'ts', |
| 260 | 'tsx', |
| 261 | 'cts', |
| 262 | 'mts', |
| 263 | 'jsx', |
| 264 | 'js', |
| 265 | 'cjs', |
| 266 | 'mjs', |
| 267 | ]) { |
| 268 | for (const targetPackageStyle of targetPackageStyles) { |
| 269 | const packageTypeModulePermutations = targetPackageStyle |
| 270 | ? [true, false] |
| 271 | : [project.typeModule]; |
| 272 | for (const packageTypeModule of packageTypeModulePermutations) { |
| 273 | const isIndexPermutations = targetPackageStyle |
| 274 | ? [false] |
| 275 | : [true, false]; |
| 276 | // TODO test main pointing to a directory containing an `index.` file? |
| 277 | for (const isIndex of isIndexPermutations) { |
| 278 | //#region SKIPPING |
| 279 | if (!inSrc && !inOut) continue; |
| 280 | |
| 281 | // Don't bother with jsx if we don't have allowJs enabled |
| 282 | // TODO Get rid of this? "Just work" in this case? |
| 283 | if (srcExt === 'jsx' && !project.allowJs) continue; |
| 284 | // Don't bother with src-only extensions when only emitting to `out` |
| 285 | if (!inSrc && ['ts', 'tsx', 'cts', 'mts', 'jsx'].includes(srcExt)) |
| 286 | continue; |
| 287 | |
| 288 | // TODO re-enable with src <-> out mapping |
| 289 | if ( |
| 290 | !inOut && |
| 291 | isOneOf(targetPackageStyle, [ |
| 292 | 'main-out-with-extension', |
| 293 | 'main-out-extensionless', |
| 294 | 'exports-out-with-extension', |
| 295 | ]) |
| 296 | ) |
| 297 | continue; |
| 298 | if ( |
| 299 | !inSrc && |
| 300 | isOneOf(targetPackageStyle, [ |
| 301 | 'main-src-with-extension', |
| 302 | 'main-src-extensionless', |
| 303 | 'exports-src-with-extension', |
| 304 | ]) |
| 305 | ) |
| 306 | continue; |
| 307 | if ( |
| 308 | isOneOf(targetPackageStyle, [ |
| 309 | 'main-out-with-extension', |
no test coverage detected
searching dependent graphs…