@@ -166,8 +166,10 @@ function getTsSourceFromJsSource(
166
166
const sourceMapPrefix = "\n//# sourceMappingURL=" ;
167
167
const indexOfSourceMapPrefix = contents . indexOf ( sourceMapPrefix ) ;
168
168
if ( indexOfSourceMapPrefix === - 1 ) {
169
- logger . error ( `The file ${ jsPath } does not contain a sourceMappingURL` ) ;
170
- return ;
169
+ logger . verbose (
170
+ `The file ${ jsPath } does not contain a sourceMappingURL`
171
+ ) ;
172
+ return jsPath ;
171
173
}
172
174
const endOfSourceMapPrefix =
173
175
indexOfSourceMapPrefix + sourceMapPrefix . length ;
@@ -253,30 +255,18 @@ export function getTsEntryPointForPackage(
253
255
) ;
254
256
if ( typedocPackageConfig ?. entryPoint ) {
255
257
packageMain = typedocPackageConfig . entryPoint ;
256
- } else if (
257
- hasOwnProperty ( packageJson , "typedocMain" ) &&
258
- typeof packageJson . typedocMain == "string"
259
- ) {
258
+ } else if ( validate ( { typedocMain : String } , packageJson ) ) {
260
259
logger . warn (
261
260
`Legacy typedoc entry point config (using "typedocMain" field) found for "${ nicePath (
262
261
packageJsonPath
263
262
) } ". Please update to use "typedoc": { "entryPoint": "..." } instead. In future upgrade, "typedocMain" field will be ignored.`
264
263
) ;
265
264
packageMain = packageJson . typedocMain ;
266
- } else if (
267
- hasOwnProperty ( packageJson , "main" ) &&
268
- typeof packageJson . main == "string"
269
- ) {
265
+ } else if ( validate ( { main : String } , packageJson ) ) {
270
266
packageMain = packageJson . main ;
271
- } else if (
272
- hasOwnProperty ( packageJson , "types" ) &&
273
- typeof packageJson . types == "string"
274
- ) {
267
+ } else if ( validate ( { types : String } , packageJson ) ) {
275
268
packageTypes = packageJson . types ;
276
- } else if (
277
- hasOwnProperty ( packageJson , "typings" ) &&
278
- typeof packageJson . typings == "string"
279
- ) {
269
+ } else if ( validate ( { typings : String } , packageJson ) ) {
280
270
packageTypes = packageJson . typings ;
281
271
}
282
272
let entryPointPath = resolve ( packageJsonPath , ".." , packageMain ) ;
@@ -287,7 +277,7 @@ export function getTsEntryPointForPackage(
287
277
try {
288
278
entryPointPath = require . resolve ( entryPointPath , { paths : [ ] } ) ;
289
279
if (
290
- / \. ( [ c m ] t s | t s x ? ) $ / . test ( entryPointPath ) &&
280
+ / \. ( [ c m ] ? t s | t s x ? ) $ / . test ( entryPointPath ) &&
291
281
existsSync ( entryPointPath )
292
282
) {
293
283
return entryPointPath ;
@@ -302,7 +292,7 @@ export function getTsEntryPointForPackage(
302
292
packageTypes ?? packageMain
303
293
) ;
304
294
if (
305
- / \. ( [ c m ] [ t j ] s | t s x ? ) $ / . test ( entryPointPath ) &&
295
+ / \. ( [ c m ] ? [ t j ] s | t s x ? ) $ / . test ( entryPointPath ) &&
306
296
existsSync ( entryPointPath )
307
297
) {
308
298
return entryPointPath ;
0 commit comments