MCPcopy
hub / github.com/TypeStrong/ts-node / generateEntrypoints

Function generateEntrypoints

src/test/resolver.spec.ts:510–546  ·  view source on GitHub ↗

* Generate all entrypoint-* files

(
  project: Project,
  p: FsProject,
  targets: Target[]
)

Source from the content-addressed store, hash-verified

508 * Generate all entrypoint-* files
509 */
510function generateEntrypoints(
511 project: Project,
512 p: FsProject,
513 targets: Target[]
514) {
515 /** Array of entrypoint files to be imported during the test */
516 let entrypoints: string[] = [];
517 for (const entrypointExt of ['cjs', 'mjs'] as const) {
518 // TODO consider removing this logic; deferring to conditionals in the generateEntrypoint which emit meaningful comments
519 const withExtPermutations =
520 entrypointExt == 'mjs' &&
521 project.experimentalSpecifierResolutionNode === false
522 ? [true]
523 : [false, true];
524 for (const withExt of withExtPermutations) {
525 // Location of the entrypoint
526 for (const entrypointLocation of ['src', 'out'] as const) {
527 // Target of the entrypoint's import statements
528 for (const entrypointTargetting of ['src', 'out'] as const) {
529 // TODO re-enable when we have out <-> src mapping
530 if (entrypointLocation !== 'src') continue;
531 if (entrypointTargetting !== 'src') continue;
532
533 entrypoints.push(
534 generateEntrypoint(project, p, targets, {
535 entrypointExt,
536 withExt,
537 entrypointLocation,
538 entrypointTargetting,
539 })
540 );
541 }
542 }
543 }
544 }
545 return entrypoints;
546}
547
548function generateEntrypoint(
549 project: Project,

Callers 1

declareProjectFunction · 0.85

Calls 1

generateEntrypointFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…