|
4 | 4 |
|
5 | 5 | This tool is used to generate `dom.generated.d.ts` and `webworker.generated.d.ts` for TypeScript, and `domWeb.js` and `domWindows.js` for Visual Studio JavaScript language service. The input file is the XML spec file generated by the Microsoft Edge browser.
|
6 | 6 |
|
7 |
| -## Build Instruction |
8 |
| -To build the tool, simply clone the repo, and run `build.cmd` (Windows) or `build.sh` (OS X/Unix) in command line. If it runs successfully, the output files will be generated under the `generated` folder. |
| 7 | +## Build Instructions |
9 | 8 |
|
10 |
| -Note: for OS X/ Unix users, [Mono 4.2](http://www.mono-project.com/download/alpha/) is required. |
| 9 | +To build the tool, simply clone this repo, and run `build.cmd` (Windows) or `build.sh` (OS X/Unix) on the command line. |
| 10 | +If it runs successfully, the output files will be generated under the `generated` folder. |
11 | 11 |
|
12 |
| -## Contribution Guide |
13 |
| -The `dom.generated.d.ts` and `webworker.generated.d.ts` files in the TypeScript repo are used as baselines. |
14 |
| -For each pull request, we will run the script and compare the generated files with the baseline files. |
15 |
| -In order to make the tests pass, please update the baseline as well in any pull requests. |
| 12 | +Note: for OS X and Unix users, [Mono 4.2](http://www.mono-project.com/download/alpha/) is required. |
16 | 13 |
|
17 |
| -For common changes, it is sufficient to change the json files. |
18 |
| -There are three json files that are used to alter the file generation: `addedTypes.json`, `overridingTypes.json` and `removedTypes.json`. |
19 |
| -The format of each file can be inferred from their existing content. |
| 14 | +## Contribution Guidelines |
| 15 | + |
| 16 | +The `dom.generated.d.ts` and `webworker.generated.d.ts` files in the TypeScript repo are used as baselines. |
| 17 | +For each pull request, we will run the script and compare the generated files with the baseline files. |
| 18 | +In order to make the tests pass, please update the baseline as well in any pull requests. |
| 19 | + |
| 20 | +For common changes, it is sufficient to change the json files. |
| 21 | +There are three json files that are used to alter the file generation: `addedTypes.json`, `overridingTypes.json`, and `removedTypes.json`. |
| 22 | +The format of each file can be inferred from their existing content. |
20 | 23 |
|
21 | 24 | The common steps to send a pull request are:
|
22 |
| - 0. Open or refer to an issue in the [TypeScript repo](https://github.com/Microsoft/TypeScript). |
23 |
| - 1. Add missing elements to `inputfiles/addedTypes.json`, overriding elements to `inputfiles/overridingTypes.json`, or elements to remove to `inputfiles/removedTypes.json`. |
24 |
| - 2. Run the script locally to obtain new `dom.generated.d.ts` and `webworker.generated.d.ts`. |
25 |
| - 3. Update the files in the `baselines` folder using the newly generated files. |
| 25 | + |
| 26 | +0. Open or refer to an issue in the [TypeScript repo](https://github.com/Microsoft/TypeScript). |
| 27 | +1. Add missing elements to `inputfiles/addedTypes.json`, overriding elements to `inputfiles/overridingTypes.json`, or elements to remove to `inputfiles/removedTypes.json`. |
| 28 | +2. Run the script locally to obtain new `dom.generated.d.ts` and `webworker.generated.d.ts`. |
| 29 | +3. Update the files in the `baselines` folder using the newly generated files. |
26 | 30 |
|
27 | 31 | ## Code Structure
|
28 |
| -- `Shared.fs`: handles the parsing from XML spec file, and stores the common data structures for later use; |
29 |
| -- `TS.fs`: handles the emitting of the `lib.d.ts` file; |
| 32 | + |
| 33 | +- `Shared.fs`: handles the parsing from XML spec file, and stores the common data structures for later use. |
| 34 | +- `TS.fs`: handles the emitting of the `lib.d.ts` file. |
30 | 35 | - `JS.fs`: handles the emitting of the `domWeb.js` and `domWindows.js`
|
31 | 36 |
|
32 |
| -## Input Files: |
33 |
| -- `browser.webidl.xml`: the XML spec file generated by Microsoft Edge (due to the different updating schedules between Edge and TypeScript, this may **not** be the most up-to-date version of the spec.); |
34 |
| -- `webworker.webidl.xml`: contains additional types for webworker. |
| 37 | +## Input Files |
| 38 | + |
| 39 | +- `browser.webidl.xml`: an XML spec file generated by Microsoft Edge. **Do not edit this file**. |
| 40 | + - Due to the different update schedules between Edge and TypeScript, this may not be the most up-to-date version of the spec. |
| 41 | +- `webworker.webidl.xml`: an XML spec file generated by Microsoft Edge that contains types for Web Workers. **Do not edit this file**. |
35 | 42 | - `addedTypes.json`: types that should exist in either browser or webworker but are missing from the Edge spec. The type can be `property`, `method`, `interface`, `constructor`, or `indexer`.
|
36 | 43 | - `overridingTypes.json`: types that are defined in the spec file but has a better or more up-to-date definitions in the json files.
|
37 | 44 | - `removedTypes.json`: types that are defined in the spec file but should be removed.
|
38 | 45 | - `comments.json`: comment strings to be embedded in the generated .js files
|
39 |
| -- `jsTemplate.js`: the initial templates for `domWeb.js` and `domWindows.js`, which contains the necessary helper functions; |
| 46 | +- `jsTemplate.js`: the initial templates for `domWeb.js` and `domWindows.js`, which contains the necessary helper functions. |
40 | 47 | - `sample.json`: sample json file used to tell F# json type provider that structure of the json files. The content of it is not used anywhere.
|
0 commit comments