import type { Platform } from '@prisma/get-platform' ; import { getNodeAPIName } from '@prisma/get-platform' ; import { ClientEngineType } from '@prisma/sdk' ; import path from 'path' ; import { map } from '../../../../../helpers/blaze/map' ; param engineType param platforms param relativeOutdir returns export function buildNFTAnnotations ( engineType , platforms , relativeOutdir ) { if ( platforms === undefined ) { return '' ; } if ( process . env . NETLIFY ) { platforms = [ 'rhel-openssl-1.0.x' ] ; } const engineAnnotations = map ( platforms , ( platform ) => { return buildNFTEngineAnnotation ( engineType , platform , relativeOutdir ) ; } ) . join ( '\n' ) ; const schemaAnnotations = buildNFTSchemaAnnotation ( engineType , relativeOutdir ) ; return `${ engineAnnotations }${ schemaAnnotations }` ; } param engineType param platform returns function getQueryEngineFilename ( engineType , platform ) { if ( engineType === ClientEngineType . Library ) { return getNodeAPIName ( platform , 'fs' ) ; } if ( engineType === ClientEngineType . Binary ) { return `query-engine-${ platform }` ; } return undefined ; } see https param fileName param relativeOutdir returns function buildNFTAnnotation ( fileName , relativeOutdir ) { return `
path.join(__dirname, '${ fileName }');
path.join(process.cwd(), './${ path . join ( relativeOutdir , fileName ) }')` ; } param engineType param platform param relativeOutdir returns function buildNFTEngineAnnotation ( engineType , platform , relativeOutdir ) { const engineFilename = getQueryEngineFilename ( engineType , platform ) ; if ( engineFilename === undefined ) return '' ; return buildNFTAnnotation ( engineFilename , relativeOutdir ) ; } param engineType param relativeOutdir returns function buildNFTSchemaAnnotation ( engineType , relativeOutdir ) { if ( engineType === ClientEngineType . DataProxy ) return '' ; return buildNFTAnnotation ( 'schema.prisma' , relativeOutdir ) ; }