Skip to content

Commit a90dfff

Browse files
author
Orta Therox
authored
Merge pull request #1059 from saschanaz/microsoft-merge
Allow strings in deprecated field
2 parents a5332ac + 39b8fa5 commit a90dfff

File tree

8 files changed

+48
-34
lines changed

8 files changed

+48
-34
lines changed

baselines/dom.generated.d.ts

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,8 +2230,10 @@ declare var AudioParamMap: {
22302230
new(): AudioParamMap;
22312231
};
22322232

2233-
/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed.
2234-
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. */
2233+
/**
2234+
* The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed.
2235+
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet.
2236+
*/
22352237
interface AudioProcessingEvent extends Event {
22362238
/** @deprecated */
22372239
readonly inputBuffer: AudioBuffer;
@@ -6302,7 +6304,7 @@ declare var HTMLDetailsElement: {
63026304
new(): HTMLDetailsElement;
63036305
};
63046306

6305-
/** @deprecated - this is not available in most browsers */
6307+
/** @deprecated this is not available in most browsers */
63066308
interface HTMLDialogElement extends HTMLElement {
63076309
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLDialogElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
63086310
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -6344,7 +6346,7 @@ declare var HTMLDivElement: {
63446346
new(): HTMLDivElement;
63456347
};
63466348

6347-
/** @deprecated - use Document */
6349+
/** @deprecated use Document */
63486350
interface HTMLDocument extends Document {
63496351
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: HTMLDocument, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
63506352
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -8354,7 +8356,7 @@ declare var HTMLTableColElement: {
83548356
new(): HTMLTableColElement;
83558357
};
83568358

8357-
/** @deprecated - prefer HTMLTableCellElement */
8359+
/** @deprecated prefer HTMLTableCellElement */
83588360
interface HTMLTableDataCellElement extends HTMLTableCellElement {
83598361
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTableDataCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
83608362
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -8475,7 +8477,7 @@ declare var HTMLTableElement: {
84758477
new(): HTMLTableElement;
84768478
};
84778479

8478-
/** @deprecated - prefer HTMLTableCellElement */
8480+
/** @deprecated prefer HTMLTableCellElement */
84798481
interface HTMLTableHeaderCellElement extends HTMLTableCellElement {
84808482
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTableHeaderCellElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
84818483
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -10219,8 +10221,10 @@ declare var MouseEvent: {
1021910221
new(type: string, eventInitDict?: MouseEventInit): MouseEvent;
1022010222
};
1022110223

10222-
/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes.
10223-
* @deprecated DOM4 [DOM] provides a new mechanism using a MutationObserver interface which addresses the use cases that mutation events solve, but in a more performant manner. Thus, this specification describes mutation events for reference and completeness of legacy behavior, but deprecates the use of the MutationEvent interface. */
10224+
/**
10225+
* Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes.
10226+
* @deprecated DOM4 [DOM] provides a new mechanism using a MutationObserver interface which addresses the use cases that mutation events solve, but in a more performant manner. Thus, this specification describes mutation events for reference and completeness of legacy behavior, but deprecates the use of the MutationEvent interface.
10227+
*/
1022410228
interface MutationEvent extends Event {
1022510229
readonly attrChange: number;
1022610230
readonly attrName: string;
@@ -10233,6 +10237,7 @@ interface MutationEvent extends Event {
1023310237
readonly REMOVAL: number;
1023410238
}
1023510239

10240+
/** @deprecated */
1023610241
declare var MutationEvent: {
1023710242
prototype: MutationEvent;
1023810243
new(): MutationEvent;
@@ -11121,8 +11126,10 @@ declare var PerformanceMeasure: {
1112111126
new(): PerformanceMeasure;
1112211127
};
1112311128

11124-
/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done.
11125-
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. */
11129+
/**
11130+
* The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done.
11131+
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
11132+
*/
1112611133
interface PerformanceNavigation {
1112711134
/** @deprecated */
1112811135
readonly redirectCount: number;
@@ -11237,8 +11244,10 @@ declare var PerformanceServerTiming: {
1123711244
new(): PerformanceServerTiming;
1123811245
};
1123911246

11240-
/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property.
11241-
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead. */
11247+
/**
11248+
* A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property.
11249+
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
11250+
*/
1124211251
interface PerformanceTiming {
1124311252
/** @deprecated */
1124411253
readonly connectEnd: number;
@@ -13846,8 +13855,10 @@ interface ScriptProcessorNodeEventMap {
1384613855
"audioprocess": AudioProcessingEvent;
1384713856
}
1384813857

13849-
/** Allows the generation, processing, or analyzing of audio using JavaScript.
13850-
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and was replaced by AudioWorklet (see AudioWorkletNode). */
13858+
/**
13859+
* Allows the generation, processing, or analyzing of audio using JavaScript.
13860+
* @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and was replaced by AudioWorklet (see AudioWorkletNode).
13861+
*/
1385113862
interface ScriptProcessorNode extends AudioNode {
1385213863
/** @deprecated */
1385313864
readonly bufferSize: number;

baselines/serviceworker.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2366,7 +2366,7 @@ interface OVR_multiview2 {
23662366
readonly MAX_VIEWS_OVR: GLenum;
23672367
}
23682368

2369-
/** @deprecated - this is not available in most browsers */
2369+
/** @deprecated this is not available in most browsers */
23702370
interface OffscreenCanvas extends EventTarget {
23712371
}
23722372

baselines/sharedworker.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2276,7 +2276,7 @@ interface OVR_multiview2 {
22762276
readonly MAX_VIEWS_OVR: GLenum;
22772277
}
22782278

2279-
/** @deprecated - this is not available in most browsers */
2279+
/** @deprecated this is not available in most browsers */
22802280
interface OffscreenCanvas extends EventTarget {
22812281
}
22822282

baselines/webworker.generated.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2424,7 +2424,7 @@ interface OVR_multiview2 {
24242424
readonly MAX_VIEWS_OVR: GLenum;
24252425
}
24262426

2427-
/** @deprecated - this is not available in most browsers */
2427+
/** @deprecated this is not available in most browsers */
24282428
interface OffscreenCanvas extends EventTarget {
24292429
}
24302430

inputfiles/addedTypes.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,33 +294,33 @@
294294
"name": "HTMLTableDataCellElement",
295295
"extends": "HTMLTableCellElement",
296296
"noInterfaceObject": true,
297-
"comment": "@deprecated - prefer HTMLTableCellElement",
297+
"deprecated": "prefer HTMLTableCellElement",
298298
"exposed": "Window"
299299
},
300300
"HTMLTableHeaderCellElement": {
301301
"name": "HTMLTableHeaderCellElement",
302302
"extends": "HTMLTableCellElement",
303303
"noInterfaceObject": true,
304-
"comment": "@deprecated - prefer HTMLTableCellElement",
304+
"deprecated": "prefer HTMLTableCellElement",
305305
"exposed": "Window"
306306
},
307307
"HTMLDialogElement": {
308308
"name": "HTMLDialogElement",
309309
"noInterfaceObject": true,
310-
"comment": "@deprecated - this is not available in most browsers",
310+
"deprecated": "this is not available in most browsers",
311311
"exposed": "Window"
312312
},
313313
"OffscreenCanvas": {
314314
"name": "OffscreenCanvas",
315315
"noInterfaceObject": true,
316-
"comment": "@deprecated - this is not available in most browsers",
316+
"deprecated": "this is not available in most browsers",
317317
"exposed": "Worker"
318318
},
319319
"HTMLDocument": {
320320
"name": "HTMLDocument",
321321
"extends": "Document",
322322
"noInterfaceObject": true,
323-
"comment": "@deprecated - use Document",
323+
"deprecated": "use Document",
324324
"exposed": "Window"
325325
},
326326
"HTMLMediaElement": {

src/build.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,7 @@ async function emitDom() {
159159
for (const [key, value] of Object.entries(descriptions)) {
160160
const target = idl.interfaces!.interface[key] || namespaces[key];
161161
if (target) {
162-
const comment = target.comment ?? "";
163-
const deprecated = "\n * @deprecated " + transformVerbosity(key, value);
164-
target.comment = comment + deprecated;
162+
target.deprecated = transformVerbosity(key, value);
165163
}
166164
}
167165
return idl;

src/build/emitter.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -823,28 +823,33 @@ export function emitWebIdl(
823823
}
824824

825825
function emitComments(
826-
entity: { comment?: string; deprecated?: boolean },
826+
entity: { comment?: string; deprecated?: boolean | string },
827827
print: (s: string) => void
828828
) {
829+
const deprecated =
830+
typeof entity.deprecated === "string"
831+
? `@deprecated ${entity.deprecated}`
832+
: entity.deprecated
833+
? "@deprecated"
834+
: null;
829835
if (entity.comment) {
830836
if (entity.comment.startsWith("/*")) {
831837
const split = entity.comment.split("\n");
832838

833839
// Merge in the deprecated notice, if required.
834-
if (entity.deprecated && !entity.comment.includes("@deprecated")) {
835-
split[split.length - 1] = " * @deprecated";
836-
split.push(" */");
840+
if (deprecated) {
841+
split.splice(split.length - 1, 0, ` * ${deprecated}`);
837842
}
838843

839844
split.forEach(print);
840-
} else if (entity.deprecated && !entity.comment.includes("@deprecated")) {
845+
} else if (deprecated) {
841846
// Convert into multi-line comment with deprecation notice.
842-
print(`/**\n * ${entity.comment}\n * @deprecated\n */`);
847+
print(`/**\n * ${entity.comment}\n * ${deprecated}\n */`);
843848
} else {
844849
print(`/** ${entity.comment} */`);
845850
}
846-
} else if (entity.deprecated) {
847-
print(`/** @deprecated */`);
851+
} else if (deprecated) {
852+
print(`/** ${deprecated} */`);
848853
}
849854
}
850855

src/build/types.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export interface Interface {
190190
dictionaries: Dictionary[];
191191
typedefs: TypeDef[];
192192
};
193-
deprecated?: boolean;
193+
deprecated?: boolean | string;
194194
}
195195

196196
export interface Iterator {

0 commit comments

Comments
 (0)