@microsoft/api-extractor 7.32.1 → 7.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rollup.d.ts +15 -0
- package/lib/api/Extractor.d.ts.map +1 -1
- package/lib/api/Extractor.js +6 -2
- package/lib/api/Extractor.js.map +1 -1
- package/lib/api/ExtractorConfig.d.ts +2 -0
- package/lib/api/ExtractorConfig.d.ts.map +1 -1
- package/lib/api/ExtractorConfig.js +4 -0
- package/lib/api/ExtractorConfig.js.map +1 -1
- package/lib/api/IConfigFile.d.ts +13 -0
- package/lib/api/IConfigFile.d.ts.map +1 -1
- package/lib/api/IConfigFile.js.map +1 -1
- package/lib/collector/Collector.d.ts +3 -0
- package/lib/collector/Collector.d.ts.map +1 -1
- package/lib/collector/Collector.js +1 -0
- package/lib/collector/Collector.js.map +1 -1
- package/lib/collector/MessageRouter.d.ts +2 -0
- package/lib/collector/MessageRouter.d.ts.map +1 -1
- package/lib/collector/MessageRouter.js +26 -19
- package/lib/collector/MessageRouter.js.map +1 -1
- package/lib/collector/SourceMapper.d.ts +39 -4
- package/lib/collector/SourceMapper.d.ts.map +1 -1
- package/lib/collector/SourceMapper.js +78 -71
- package/lib/collector/SourceMapper.js.map +1 -1
- package/lib/generators/ApiModelGenerator.d.ts +1 -0
- package/lib/generators/ApiModelGenerator.d.ts.map +1 -1
- package/lib/generators/ApiModelGenerator.js +68 -18
- package/lib/generators/ApiModelGenerator.js.map +1 -1
- package/lib/schemas/api-extractor-template.json +17 -1
- package/lib/schemas/api-extractor.schema.json +4 -1
- package/package.json +3 -3
|
@@ -27,6 +27,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
28
|
exports.ApiModelGenerator = void 0;
|
|
29
29
|
/* eslint-disable no-bitwise */
|
|
30
|
+
const path = __importStar(require("path"));
|
|
30
31
|
const ts = __importStar(require("typescript"));
|
|
31
32
|
const api_extractor_model_1 = require("@microsoft/api-extractor-model");
|
|
32
33
|
const ExcerptBuilder_1 = require("./ExcerptBuilder");
|
|
@@ -48,7 +49,8 @@ class ApiModelGenerator {
|
|
|
48
49
|
const apiPackage = new api_extractor_model_1.ApiPackage({
|
|
49
50
|
name: this._collector.workingPackage.name,
|
|
50
51
|
docComment: packageDocComment,
|
|
51
|
-
tsdocConfiguration: this._collector.extractorConfig.tsdocConfiguration
|
|
52
|
+
tsdocConfiguration: this._collector.extractorConfig.tsdocConfiguration,
|
|
53
|
+
projectFolderUrl: this._collector.extractorConfig.projectFolderUrl
|
|
52
54
|
});
|
|
53
55
|
this._apiModel.addMember(apiPackage);
|
|
54
56
|
const apiEntryPoint = new api_extractor_model_1.ApiEntryPoint({ name: '' });
|
|
@@ -101,6 +103,7 @@ class ApiModelGenerator {
|
|
|
101
103
|
const astModule = astNamespaceImport.astModule;
|
|
102
104
|
const { name, isExported, parentApiItem } = context;
|
|
103
105
|
const containerKey = api_extractor_model_1.ApiNamespace.getContainerKey(name);
|
|
106
|
+
const fileUrlPath = this._getFileUrlPath(astNamespaceImport.declaration);
|
|
104
107
|
let apiNamespace = parentApiItem.tryGetMemberByKey(containerKey);
|
|
105
108
|
if (apiNamespace === undefined) {
|
|
106
109
|
apiNamespace = new api_extractor_model_1.ApiNamespace({
|
|
@@ -108,7 +111,8 @@ class ApiModelGenerator {
|
|
|
108
111
|
docComment: undefined,
|
|
109
112
|
releaseTag: api_extractor_model_1.ReleaseTag.None,
|
|
110
113
|
excerptTokens: [],
|
|
111
|
-
isExported
|
|
114
|
+
isExported,
|
|
115
|
+
fileUrlPath
|
|
112
116
|
});
|
|
113
117
|
parentApiItem.addMember(apiNamespace);
|
|
114
118
|
}
|
|
@@ -209,6 +213,7 @@ class ApiModelGenerator {
|
|
|
209
213
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
210
214
|
const docComment = apiItemMetadata.tsdocComment;
|
|
211
215
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
216
|
+
const fileUrlPath = this._getFileUrlPath(callSignature);
|
|
212
217
|
apiCallSignature = new api_extractor_model_1.ApiCallSignature({
|
|
213
218
|
docComment,
|
|
214
219
|
releaseTag,
|
|
@@ -216,7 +221,8 @@ class ApiModelGenerator {
|
|
|
216
221
|
parameters,
|
|
217
222
|
overloadIndex,
|
|
218
223
|
excerptTokens,
|
|
219
|
-
returnTypeTokenRange
|
|
224
|
+
returnTypeTokenRange,
|
|
225
|
+
fileUrlPath
|
|
220
226
|
});
|
|
221
227
|
parentApiItem.addMember(apiCallSignature);
|
|
222
228
|
}
|
|
@@ -235,13 +241,15 @@ class ApiModelGenerator {
|
|
|
235
241
|
const docComment = apiItemMetadata.tsdocComment;
|
|
236
242
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
237
243
|
const isProtected = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
|
|
244
|
+
const fileUrlPath = this._getFileUrlPath(constructorDeclaration);
|
|
238
245
|
apiConstructor = new api_extractor_model_1.ApiConstructor({
|
|
239
246
|
docComment,
|
|
240
247
|
releaseTag,
|
|
241
248
|
isProtected,
|
|
242
249
|
parameters,
|
|
243
250
|
overloadIndex,
|
|
244
|
-
excerptTokens
|
|
251
|
+
excerptTokens,
|
|
252
|
+
fileUrlPath
|
|
245
253
|
});
|
|
246
254
|
parentApiItem.addMember(apiConstructor);
|
|
247
255
|
}
|
|
@@ -275,6 +283,7 @@ class ApiModelGenerator {
|
|
|
275
283
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
276
284
|
const docComment = apiItemMetadata.tsdocComment;
|
|
277
285
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
286
|
+
const fileUrlPath = this._getFileUrlPath(classDeclaration);
|
|
278
287
|
apiClass = new api_extractor_model_1.ApiClass({
|
|
279
288
|
name,
|
|
280
289
|
docComment,
|
|
@@ -283,7 +292,8 @@ class ApiModelGenerator {
|
|
|
283
292
|
typeParameters,
|
|
284
293
|
extendsTokenRange,
|
|
285
294
|
implementsTokenRanges,
|
|
286
|
-
isExported
|
|
295
|
+
isExported,
|
|
296
|
+
fileUrlPath
|
|
287
297
|
});
|
|
288
298
|
parentApiItem.addMember(apiClass);
|
|
289
299
|
}
|
|
@@ -305,6 +315,7 @@ class ApiModelGenerator {
|
|
|
305
315
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
306
316
|
const docComment = apiItemMetadata.tsdocComment;
|
|
307
317
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
318
|
+
const fileUrlPath = this._getFileUrlPath(constructSignature);
|
|
308
319
|
apiConstructSignature = new api_extractor_model_1.ApiConstructSignature({
|
|
309
320
|
docComment,
|
|
310
321
|
releaseTag,
|
|
@@ -312,7 +323,8 @@ class ApiModelGenerator {
|
|
|
312
323
|
parameters,
|
|
313
324
|
overloadIndex,
|
|
314
325
|
excerptTokens,
|
|
315
|
-
returnTypeTokenRange
|
|
326
|
+
returnTypeTokenRange,
|
|
327
|
+
fileUrlPath
|
|
316
328
|
});
|
|
317
329
|
parentApiItem.addMember(apiConstructSignature);
|
|
318
330
|
}
|
|
@@ -327,13 +339,15 @@ class ApiModelGenerator {
|
|
|
327
339
|
const docComment = apiItemMetadata.tsdocComment;
|
|
328
340
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
329
341
|
const preserveMemberOrder = this._collector.extractorConfig.enumMemberOrder === api_extractor_model_1.EnumMemberOrder.Preserve;
|
|
342
|
+
const fileUrlPath = this._getFileUrlPath(astDeclaration.declaration);
|
|
330
343
|
apiEnum = new api_extractor_model_1.ApiEnum({
|
|
331
344
|
name,
|
|
332
345
|
docComment,
|
|
333
346
|
releaseTag,
|
|
334
347
|
excerptTokens,
|
|
335
348
|
preserveMemberOrder,
|
|
336
|
-
isExported
|
|
349
|
+
isExported,
|
|
350
|
+
fileUrlPath
|
|
337
351
|
});
|
|
338
352
|
parentApiItem.addMember(apiEnum);
|
|
339
353
|
}
|
|
@@ -355,12 +369,14 @@ class ApiModelGenerator {
|
|
|
355
369
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
356
370
|
const docComment = apiItemMetadata.tsdocComment;
|
|
357
371
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
372
|
+
const fileUrlPath = this._getFileUrlPath(enumMember);
|
|
358
373
|
apiEnumMember = new api_extractor_model_1.ApiEnumMember({
|
|
359
374
|
name,
|
|
360
375
|
docComment,
|
|
361
376
|
releaseTag,
|
|
362
377
|
excerptTokens,
|
|
363
|
-
initializerTokenRange
|
|
378
|
+
initializerTokenRange,
|
|
379
|
+
fileUrlPath
|
|
364
380
|
});
|
|
365
381
|
parentApiItem.addMember(apiEnumMember);
|
|
366
382
|
}
|
|
@@ -381,6 +397,7 @@ class ApiModelGenerator {
|
|
|
381
397
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
382
398
|
const docComment = apiItemMetadata.tsdocComment;
|
|
383
399
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
400
|
+
const fileUrlPath = this._getFileUrlPath(functionDeclaration);
|
|
384
401
|
apiFunction = new api_extractor_model_1.ApiFunction({
|
|
385
402
|
name,
|
|
386
403
|
docComment,
|
|
@@ -390,7 +407,8 @@ class ApiModelGenerator {
|
|
|
390
407
|
overloadIndex,
|
|
391
408
|
excerptTokens,
|
|
392
409
|
returnTypeTokenRange,
|
|
393
|
-
isExported
|
|
410
|
+
isExported,
|
|
411
|
+
fileUrlPath
|
|
394
412
|
});
|
|
395
413
|
parentApiItem.addMember(apiFunction);
|
|
396
414
|
}
|
|
@@ -411,6 +429,7 @@ class ApiModelGenerator {
|
|
|
411
429
|
const docComment = apiItemMetadata.tsdocComment;
|
|
412
430
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
413
431
|
const isReadonly = this._isReadonly(astDeclaration);
|
|
432
|
+
const fileUrlPath = this._getFileUrlPath(indexSignature);
|
|
414
433
|
apiIndexSignature = new api_extractor_model_1.ApiIndexSignature({
|
|
415
434
|
docComment,
|
|
416
435
|
releaseTag,
|
|
@@ -418,7 +437,8 @@ class ApiModelGenerator {
|
|
|
418
437
|
overloadIndex,
|
|
419
438
|
excerptTokens,
|
|
420
439
|
returnTypeTokenRange,
|
|
421
|
-
isReadonly
|
|
440
|
+
isReadonly,
|
|
441
|
+
fileUrlPath
|
|
422
442
|
});
|
|
423
443
|
parentApiItem.addMember(apiIndexSignature);
|
|
424
444
|
}
|
|
@@ -445,6 +465,7 @@ class ApiModelGenerator {
|
|
|
445
465
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
446
466
|
const docComment = apiItemMetadata.tsdocComment;
|
|
447
467
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
468
|
+
const fileUrlPath = this._getFileUrlPath(interfaceDeclaration);
|
|
448
469
|
apiInterface = new api_extractor_model_1.ApiInterface({
|
|
449
470
|
name,
|
|
450
471
|
docComment,
|
|
@@ -452,7 +473,8 @@ class ApiModelGenerator {
|
|
|
452
473
|
excerptTokens,
|
|
453
474
|
typeParameters,
|
|
454
475
|
extendsTokenRanges,
|
|
455
|
-
isExported
|
|
476
|
+
isExported,
|
|
477
|
+
fileUrlPath
|
|
456
478
|
});
|
|
457
479
|
parentApiItem.addMember(apiInterface);
|
|
458
480
|
}
|
|
@@ -480,6 +502,7 @@ class ApiModelGenerator {
|
|
|
480
502
|
}
|
|
481
503
|
const isOptional = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
482
504
|
const isProtected = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
|
|
505
|
+
const fileUrlPath = this._getFileUrlPath(methodDeclaration);
|
|
483
506
|
apiMethod = new api_extractor_model_1.ApiMethod({
|
|
484
507
|
name,
|
|
485
508
|
docComment,
|
|
@@ -491,7 +514,8 @@ class ApiModelGenerator {
|
|
|
491
514
|
parameters,
|
|
492
515
|
overloadIndex,
|
|
493
516
|
excerptTokens,
|
|
494
|
-
returnTypeTokenRange
|
|
517
|
+
returnTypeTokenRange,
|
|
518
|
+
fileUrlPath
|
|
495
519
|
});
|
|
496
520
|
parentApiItem.addMember(apiMethod);
|
|
497
521
|
}
|
|
@@ -513,6 +537,7 @@ class ApiModelGenerator {
|
|
|
513
537
|
const docComment = apiItemMetadata.tsdocComment;
|
|
514
538
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
515
539
|
const isOptional = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
540
|
+
const fileUrlPath = this._getFileUrlPath(methodSignature);
|
|
516
541
|
apiMethodSignature = new api_extractor_model_1.ApiMethodSignature({
|
|
517
542
|
name,
|
|
518
543
|
docComment,
|
|
@@ -522,7 +547,8 @@ class ApiModelGenerator {
|
|
|
522
547
|
parameters,
|
|
523
548
|
overloadIndex,
|
|
524
549
|
excerptTokens,
|
|
525
|
-
returnTypeTokenRange
|
|
550
|
+
returnTypeTokenRange,
|
|
551
|
+
fileUrlPath
|
|
526
552
|
});
|
|
527
553
|
parentApiItem.addMember(apiMethodSignature);
|
|
528
554
|
}
|
|
@@ -536,7 +562,15 @@ class ApiModelGenerator {
|
|
|
536
562
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
537
563
|
const docComment = apiItemMetadata.tsdocComment;
|
|
538
564
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
539
|
-
|
|
565
|
+
const fileUrlPath = this._getFileUrlPath(astDeclaration.declaration);
|
|
566
|
+
apiNamespace = new api_extractor_model_1.ApiNamespace({
|
|
567
|
+
name,
|
|
568
|
+
docComment,
|
|
569
|
+
releaseTag,
|
|
570
|
+
excerptTokens,
|
|
571
|
+
isExported,
|
|
572
|
+
fileUrlPath
|
|
573
|
+
});
|
|
540
574
|
parentApiItem.addMember(apiNamespace);
|
|
541
575
|
}
|
|
542
576
|
this._processChildDeclarations(astDeclaration, Object.assign(Object.assign({}, context), { parentApiItem: apiNamespace }));
|
|
@@ -571,6 +605,7 @@ class ApiModelGenerator {
|
|
|
571
605
|
const isOptional = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
572
606
|
const isProtected = (astDeclaration.modifierFlags & ts.ModifierFlags.Protected) !== 0;
|
|
573
607
|
const isReadonly = this._isReadonly(astDeclaration);
|
|
608
|
+
const fileUrlPath = this._getFileUrlPath(declaration);
|
|
574
609
|
apiProperty = new api_extractor_model_1.ApiProperty({
|
|
575
610
|
name,
|
|
576
611
|
docComment,
|
|
@@ -581,7 +616,8 @@ class ApiModelGenerator {
|
|
|
581
616
|
isReadonly,
|
|
582
617
|
excerptTokens,
|
|
583
618
|
propertyTypeTokenRange,
|
|
584
|
-
initializerTokenRange
|
|
619
|
+
initializerTokenRange,
|
|
620
|
+
fileUrlPath
|
|
585
621
|
});
|
|
586
622
|
parentApiItem.addMember(apiProperty);
|
|
587
623
|
}
|
|
@@ -605,6 +641,7 @@ class ApiModelGenerator {
|
|
|
605
641
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
606
642
|
const isOptional = (astDeclaration.astSymbol.followedSymbol.flags & ts.SymbolFlags.Optional) !== 0;
|
|
607
643
|
const isReadonly = this._isReadonly(astDeclaration);
|
|
644
|
+
const fileUrlPath = this._getFileUrlPath(propertySignature);
|
|
608
645
|
apiPropertySignature = new api_extractor_model_1.ApiPropertySignature({
|
|
609
646
|
name,
|
|
610
647
|
docComment,
|
|
@@ -612,7 +649,8 @@ class ApiModelGenerator {
|
|
|
612
649
|
isOptional,
|
|
613
650
|
excerptTokens,
|
|
614
651
|
propertyTypeTokenRange,
|
|
615
|
-
isReadonly
|
|
652
|
+
isReadonly,
|
|
653
|
+
fileUrlPath
|
|
616
654
|
});
|
|
617
655
|
parentApiItem.addMember(apiPropertySignature);
|
|
618
656
|
}
|
|
@@ -635,6 +673,7 @@ class ApiModelGenerator {
|
|
|
635
673
|
const apiItemMetadata = this._collector.fetchApiItemMetadata(astDeclaration);
|
|
636
674
|
const docComment = apiItemMetadata.tsdocComment;
|
|
637
675
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
676
|
+
const fileUrlPath = this._getFileUrlPath(typeAliasDeclaration);
|
|
638
677
|
apiTypeAlias = new api_extractor_model_1.ApiTypeAlias({
|
|
639
678
|
name,
|
|
640
679
|
docComment,
|
|
@@ -642,7 +681,8 @@ class ApiModelGenerator {
|
|
|
642
681
|
releaseTag,
|
|
643
682
|
excerptTokens,
|
|
644
683
|
typeTokenRange,
|
|
645
|
-
isExported
|
|
684
|
+
isExported,
|
|
685
|
+
fileUrlPath
|
|
646
686
|
});
|
|
647
687
|
parentApiItem.addMember(apiTypeAlias);
|
|
648
688
|
}
|
|
@@ -666,6 +706,7 @@ class ApiModelGenerator {
|
|
|
666
706
|
const docComment = apiItemMetadata.tsdocComment;
|
|
667
707
|
const releaseTag = apiItemMetadata.effectiveReleaseTag;
|
|
668
708
|
const isReadonly = this._isReadonly(astDeclaration);
|
|
709
|
+
const fileUrlPath = this._getFileUrlPath(variableDeclaration);
|
|
669
710
|
apiVariable = new api_extractor_model_1.ApiVariable({
|
|
670
711
|
name,
|
|
671
712
|
docComment,
|
|
@@ -674,7 +715,8 @@ class ApiModelGenerator {
|
|
|
674
715
|
variableTypeTokenRange,
|
|
675
716
|
initializerTokenRange,
|
|
676
717
|
isReadonly,
|
|
677
|
-
isExported
|
|
718
|
+
isExported,
|
|
719
|
+
fileUrlPath
|
|
678
720
|
});
|
|
679
721
|
parentApiItem.addMember(apiVariable);
|
|
680
722
|
}
|
|
@@ -750,6 +792,14 @@ class ApiModelGenerator {
|
|
|
750
792
|
}
|
|
751
793
|
}
|
|
752
794
|
}
|
|
795
|
+
_getFileUrlPath(declaration) {
|
|
796
|
+
const sourceFile = declaration.getSourceFile();
|
|
797
|
+
const sourceLocation = this._collector.sourceMapper.getSourceLocation({
|
|
798
|
+
sourceFile,
|
|
799
|
+
pos: declaration.pos
|
|
800
|
+
});
|
|
801
|
+
return path.posix.relative(this._collector.extractorConfig.projectFolder, sourceLocation.sourceFilePath);
|
|
802
|
+
}
|
|
753
803
|
}
|
|
754
804
|
exports.ApiModelGenerator = ApiModelGenerator;
|
|
755
805
|
//# sourceMappingURL=ApiModelGenerator.js.map
|