Skip to content

Create deprecatedjson from mdn web #884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ __pycache__/
generated/
lib/
inputfiles/browser.webidl.json
.vscode
.vscode/*
!.vscode/launch.template.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this does anything here 👀

package-lock.json
yarn.lock
26 changes: 26 additions & 0 deletions .vscode/launch.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"args": [
"${relativeFile}"
],
"runtimeArgs": [
"--nolazy",
"-r",
"ts-node/register"
],
"sourceMaps": true,
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"env": {
"TS_NODE_PROJECT": "${workspaceFolder}/tsconfig.json"
}
}
]
}
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ The common steps to send a pull request are:

### What are the TypeScript team's heuristics for PRs to the DOM APIs

Changes to this repo can have pretty drastic ecosystem effects, because these types are included by default in TypeScript.
Changes to this repo can have pretty drastic ecosystem effects, because these types are included by default in TypeScript.
Due to this, we tend to be quite conservative with our approach to introducing changes.
To give you a sense of whether we will accept changes, you can use these heuristics to know up-front if we'll be open to merging.
To give you a sense of whether we will accept changes, you can use these heuristics to know up-front if we'll be open to merging.

#### Fixes

Expand All @@ -71,9 +71,9 @@ To give you a sense of whether we will accept changes, you can use these heurist
> For example, adding a new spec or subsection via a new or updated IDL file

- Does the new objects or fields show up in [mdn/browser-compat-data](https://github.com/mdn/browser-compat-data)? If not, it's likely too soon.
- Is the IDL source from WHATWG?
- Is the IDL source from WHATWG?
- Are the additions available in at least two of Firefox, Safari and Chromium?
- Is the IDL source from W3C?
- Is the IDL source from W3C?
- What stage of the [W3C process](https://en.wikipedia.org/wiki/World_Wide_Web_Consortium#Specification_maturation) is the proposal for these changes: We aim for Proposed recommendation, but can accept Candidate recommendation for stable looking proposals.
- If it's at Working draft the additions available in all three of Firefox, Safari and Chromium
- Could any types added at the global scope have naming conflicts?
Expand Down Expand Up @@ -103,3 +103,4 @@ To give you a sense of whether we will accept changes, you can use these heurist
- `overridingTypes.json`: types that are defined in the spec file but has a better or more up-to-date definitions in the json files.
- `removedTypes.json`: types that are defined in the spec file but should be removed.
- `comments.json`: comment strings to be embedded in the generated .js files.
- `deprecatedMessage.json`: the reason why one type is deprecated. The reason why it is a sprecated file rather than merge in comment.json is mdn/apiDescriptions.json would also possiably be deprecated.
23 changes: 17 additions & 6 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2328,7 +2328,9 @@ declare var AudioParamMap: {
new(): AudioParamMap;
};

/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */
/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed.
* @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.
*/
interface AudioProcessingEvent extends Event {
readonly inputBuffer: AudioBuffer;
readonly outputBuffer: AudioBuffer;
Expand Down Expand Up @@ -10527,7 +10529,8 @@ declare var MouseEvent: {
new(type: string, eventInitDict?: MouseEventInit): MouseEvent;
};

/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes. */
/** Provides event properties that are specific to modifications to the Document Object Model (DOM) hierarchy and nodes.
* @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. */
interface MutationEvent extends Event {
readonly attrChange: number;
readonly attrName: string;
Expand Down Expand Up @@ -11514,7 +11517,9 @@ declare var PerformanceMeasure: {
new(): PerformanceMeasure;
};

/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done. */
/** The legacy PerformanceNavigation interface represents information about how the navigation to the current document was done.
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
*/
interface PerformanceNavigation {
readonly redirectCount: number;
readonly type: number;
Expand Down Expand Up @@ -11604,7 +11609,9 @@ declare var PerformanceResourceTiming: {
new(): PerformanceResourceTiming;
};

/** 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. */
/** 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.
* @deprecated This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.
*/
interface PerformanceTiming {
readonly connectEnd: number;
readonly connectStart: number;
Expand Down Expand Up @@ -14776,7 +14783,9 @@ interface ScriptProcessorNodeEventMap {
"audioprocess": AudioProcessingEvent;
}

/** Allows the generation, processing, or analyzing of audio using JavaScript. */
/** Allows the generation, processing, or analyzing of audio using JavaScript.
* @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).
*/
interface ScriptProcessorNode extends AudioNode {
/** @deprecated */
readonly bufferSize: number;
Expand Down Expand Up @@ -14900,7 +14909,9 @@ declare var ServiceWorkerContainer: {
new(): ServiceWorkerContainer;
};

/** This ServiceWorker API interface contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. */
/** This ServiceWorker API interface contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker.
* @deprecated In modern browsers, this interface has been deprecated. Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features.
*/
interface ServiceWorkerMessageEvent extends Event {
readonly data: any;
readonly lastEventId: string;
Expand Down
33 changes: 33 additions & 0 deletions inputfiles/deprecatedMessage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any automatic generator for this file. Is this file handcrafted?

Copy link
Contributor Author

@ShuiRuTian ShuiRuTian Oct 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it is created by a script. It is why I change the .gitignore file ---- I did add the template file, for running the script by vscode quickly.
But sandersn think this file would not update frequently and this file could be maintained manually like others. So I delete the script from the branch. You could see the previews for more info.

"MutationEvent": "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.",
"SVGAltGlyphItemElement": "This interface was removed in the SVG 2 specification.\n",
"PerformanceTiming": "This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.\n",
"MouseScrollEvent": "Do not use this interface for wheel events.Like MouseWheelEvent, this interface is non-standard and deprecated. It was used in Gecko-based browsers only. Instead use the standard WheelEvent.\n",
"SVGAltGlyphDefElement": "This interface was removed in the SVG 2 specification.\n",
"SVGExternalResourcesRequired": "This interface was removed in the SVG 2 specification.\n",
"SVGMatrix": "SVG 2 replaced the SVGMatrix interface by the more general DOMMatrix and DOMMatrixReadOnly interfaces.\n",
"RTCSessionDescriptionCallback": "Because this function type is part of the legacy WebRTC API, you should avoid using it (and the callback-based forms of createOffer() and createAnswer() that make use of it).\n",
"ServiceWorkerMessageEvent": "In modern browsers, this interface has been deprecated. Service worker messages will now use the MessageEvent interface, for consistency with other web messaging features.\n",
"SVGRenderingIntent": "This interface was removed in the SVG 2 specification.\n",
"PerformanceNavigation": "This interface is deprecated in the Navigation Timing Level 2 specification. Please use the PerformanceNavigationTiming interface instead.\n",
"AudioProcessingEvent": "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.\n",
"ScriptProcessorNode": "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).\n",
"SVGGlyphElement": "This interface was removed in the SVG 2 specification.\n",
"MouseWheelEvent": "Do not use this interface for wheel events.Like MouseScrollEvent, this interface is non-standard and deprecated. It was used in non-Gecko browsers only. Instead use the standard WheelEvent.\n",
"IDBDatabaseException": "This interface was removed from the specification and was replaced by usage of DOMException.\n",
"NameList": "Although this interface was previously implemented in Gecko, there was no way to actually create one. NameList has been removed, effective with Gecko 10.0\n",
"IDBDatabaseSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"IDBEnvironment": "The indexedDB property that was previously defined in this mixin is instead now WindowOrWorkerGlobalScope.indexedDB (that is, defined as a member of the WindowOrWorkerGlobalScope mixin).\n",
"IDBFactorySync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"IDBVersionChangeRequest": "The latest specification does not include this interface anymore as the IDBDatabase.setVersion() method has been removed. See the compatibility table for version details.The new way to do it is to use the IDBOpenDBRequest interface which has now the onblocked handler and the newly needed onupgradeneeded one.\n",
"IDBIndexSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"IDBTransactionSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"IDBEnvironmentSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"DOMLocator": "This is not implemented in Mozilla\n",
"LocalMediaStream": "This interface is no longer available in any mainstream browser. Do not use LocalMediaStream; you need to update any code that does use it as soon as possible or your content or application will stop working. See Stopping a video stream in MediaStreamTrack to learn how. All other functionality is found in MediaStream.\n",
"IDBObjectStoreSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"BlobBuilder": "The BlobBuilder interface has been deprecated in favor of the newly introduced Blob constructor.\n",
"IDBCursorSync": "The synchronous version of the IndexedDB API was originally intended for use only with Web Workers, and was eventually removed from the spec because its need was questionable. It may however be reintroduced in the future if there is enough demand from web developers.\n",
"DOMConfiguration": "This interface has never been supported in Gecko, and has been removed from the DOM specification.\n",
"FileError": "This interface is obsolete per the latest specification. Use the new DOM4 DOMError interface instead.\n"
}
7 changes: 7 additions & 0 deletions manualAnalytics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# READ ME!
All files in this folder aimes to be used by USER rather than CODE.

Users could have a quick view of some data.

mdnDeprecatedApis.ts -- all api names marked as deprecated in `https://developer.mozilla.org/en-US/docs/Web/API`
idlSourceAppearDeprecateText.ts -- check web pages in `inputfiles/idlSources.json`, to see whether there is text "deprecate" in the whole page.
60 changes: 60 additions & 0 deletions manualAnalytics/idlSourceAppearDeprecateText.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import * as fs from "fs";
import * as path from "path";
import fetch from "node-fetch";
// import { JSDOM } from "jsdom";

interface IDLSource {
url: string;
title: string;
deprecated?: boolean;
local?: boolean;
}

async function fetchIDLs() {
const idlSources = (require("../inputfiles/idlSources.json") as IDLSource[]);
await Promise.all(idlSources.map(async source => {
if (source.local) {
return;
}
await fetchIDL(source);
})).then(
() => {
fs.writeFileSync(path.join(__dirname, 'idlSourcePossiable.json'), JSON.stringify(Array.from(deprecatedSet)));
}
);
}
// ['https://www.w3.org/TR/css-color-3/', 'https://www.w3.org/TR/credential-management-1/', 'https://www.w3.org/TR/css-text-decor-3/', 'https://w3c.github.io/media-playback-quality/', 'https://www.w3.org/TR/css-text-3/', 'https://drafts.csswg.org/css-images-3/', 'https://www.w3.org/TR/secure-contexts/', 'https://www.w3.org/TR/SVG2/types.html', 'https://html.spec.whatwg.org/multipage/obsolete.html', 'https://notifications.spec.whatwg.org/', 'https://www.w3.org/TR/SVG2/text.html', 'https://fetch.spec.whatwg.org/', 'https://html.spec.whatwg.org/multipage/webappapis.html', 'https://dom.spec.whatwg.org/', 'https://drafts.fxtf.org/css-masking-1/', 'https://www.w3.org/TR/filter-effects-1/', 'https://drafts.csswg.org/cssom/', 'https://w3c.github.io/webrtc-pc/', 'https://webaudio.github.io/web-audio-api/', 'https://heycam.github.io/webidl/', 'https://www.w3.org/TR/SVG2/pservers.html', 'https://www.w3.org/TR/uievents/']

const tmpLocalFolder = path.join(__dirname, "localIdlSource");
const deprecatedSet = new Set<string>();

async function fetchIDL(source: IDLSource) {

if (!fs.existsSync(tmpLocalFolder)) {
fs.mkdirSync(tmpLocalFolder);
}

if (source.url.endsWith(".idl")) {
return;
}

const localFile = path.join(tmpLocalFolder, source.title);
let webPageContent: string;
if (fs.existsSync(localFile)) {
webPageContent = fs.readFileSync(localFile, { encoding: "utf-8" });
}
else {
const response = await fetch(source.url);
webPageContent = await response.text();
fs.writeFileSync(localFile, webPageContent);
}
if (webPageContent.toLowerCase().includes("deprecated")) {
deprecatedSet.add(source.url);
}
// const dom = JSDOM.fragment(
// ""// webPageContent
// );

}

fetchIDLs();
Loading