Skip to content
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

Convert generation script to TS, and update the source webidl #383

Merged
merged 94 commits into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from 75 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
63022de
Convert input files to json
mhegazy Feb 20, 2018
317c27a
Add schema for input
mhegazy Feb 20, 2018
e80f384
Add config files
mhegazy Feb 20, 2018
b0bdc00
Convert script to TS
mhegazy Feb 20, 2018
5ffa5fe
Normalize input files
mhegazy Feb 21, 2018
751571f
Fix some conversion mistakes
mhegazy Feb 21, 2018
e7aba4c
Make some arrays maps
mhegazy Feb 21, 2018
2f0d977
Add support for loading comments
mhegazy Feb 21, 2018
0426bda
Add some types to merge
mhegazy Feb 21, 2018
63e0a7e
Move source files to a diffrent directory
mhegazy Feb 22, 2018
a82b8cb
revert changes to comments
mhegazy Feb 22, 2018
6ddee3e
normalize addedTypes.json and support overrides
mhegazy Feb 22, 2018
0c0e158
Add support for removign items
mhegazy Feb 22, 2018
c3f0346
Add support of overriding definitons
mhegazy Feb 22, 2018
8125a3e
Add .js to gitignore
mhegazy Feb 22, 2018
0131cf2
Clean up some remaining diffs
mhegazy Feb 23, 2018
294a92d
Rremove unused declarations
mhegazy Feb 23, 2018
0b9c8a3
Cleanup
mhegazy Feb 23, 2018
bdb44dd
Use new input file
mhegazy Feb 25, 2018
6e865bc
Update types
mhegazy Feb 25, 2018
2e4133b
Refactor
mhegazy Feb 25, 2018
80018bb
Add support for overrides
mhegazy Feb 26, 2018
bf4d9da
Add list of known types for workers
mhegazy Feb 26, 2018
a2a308b
Remove unused function
mhegazy Feb 26, 2018
4dca898
Better handeling for unknown types
mhegazy Feb 26, 2018
0480b7c
Remove unused comments
mhegazy Feb 26, 2018
5f10d60
make event handelers nullable
mhegazy Feb 26, 2018
a255454
Add deprecated comments
mhegazy Feb 26, 2018
1106259
Refactor
mhegazy Feb 26, 2018
e47cdf6
Remove index signature on Window
mhegazy Feb 26, 2018
b6a01cd
Remove unused files
mhegazy Feb 26, 2018
baa3af7
Move files around
mhegazy Feb 26, 2018
3cec779
Update readme
mhegazy Feb 26, 2018
5b21243
Remove function
mhegazy Feb 26, 2018
624201b
Change filtering logic
mhegazy Feb 26, 2018
b92083b
Use camel case
mhegazy Feb 26, 2018
a0af64d
Add test script
mhegazy Feb 27, 2018
cba9e48
Add some build scripts
mhegazy Feb 27, 2018
9fc1683
Accept baselines
mhegazy Feb 27, 2018
fde91ea
Add missing types
mhegazy Feb 27, 2018
196f5a3
Add missing property
mhegazy Feb 27, 2018
9791e4c
Add missing overloads
mhegazy Feb 27, 2018
a390b2e
Fix querySelector signatures
mhegazy Feb 27, 2018
bd003ed
Update XMLHttpRequest.send signature
mhegazy Feb 27, 2018
a6d64c1
Add missing typedef
mhegazy Feb 27, 2018
336ac4b
Change type for FileReader.result
mhegazy Feb 27, 2018
4644914
Hide Window.browser on the global scope
mhegazy Feb 27, 2018
fa29c34
Fix MediaList.mediaText type
mhegazy Feb 27, 2018
ac985b8
Add NodeSelector interface
mhegazy Feb 27, 2018
7c495cf
Add missing typedef
mhegazy Feb 27, 2018
c66d24e
Make indexers non-nullable
mhegazy Feb 27, 2018
1d73253
Use the right tsc in tests
mhegazy Feb 27, 2018
131d645
Port https://github.com/Microsoft/TSJS-lib-generator/pull/371
mhegazy Feb 27, 2018
c54015b
Port https://github.com/Microsoft/TSJS-lib-generator/pull/380
mhegazy Feb 27, 2018
9ddd9e5
Refactor override-type
mhegazy Feb 27, 2018
3417a19
Consolidate handeling of override-signatures
mhegazy Feb 27, 2018
5dc147a
Consolidate the use of override-signature
mhegazy Feb 28, 2018
a8d4b4b
Some cleanup
mhegazy Feb 28, 2018
3a5f64e
Make es6 iterators non-nullable just like indexers
mhegazy Feb 28, 2018
4a7505d
Remove some MS-specific types from the library
mhegazy Feb 28, 2018
743fb96
Extract helpers to a new file
mhegazy Feb 28, 2018
799d043
Move filtering to a preprocesing pass
mhegazy Feb 28, 2018
c6685ff
Update readme
mhegazy Feb 28, 2018
054bb6b
Port https://github.com/Microsoft/TSJS-lib-generator/pull/381
mhegazy Feb 28, 2018
68bac2a
Remove some more types
mhegazy Feb 28, 2018
57ba32a
Add new webidl file
mhegazy Mar 1, 2018
e72c4c1
Update travis file
mhegazy Mar 1, 2018
a856a10
some cleanup
mhegazy Mar 1, 2018
4d9e7f7
Merge remote-tracking branch 'origin/master' into convertToTS
mhegazy Mar 1, 2018
c5dfac3
update gitIgnore
mhegazy Mar 1, 2018
dbabfdb
Build before testing in npm test
mhegazy Mar 1, 2018
401ef78
Use a separate build script
mhegazy Mar 1, 2018
14bb7e2
Revert "Use a separate build script"
mhegazy Mar 1, 2018
aa02c79
Run tasks sequentially
mhegazy Mar 1, 2018
8d0ab24
Normalize line ending before comparing baselines to output
mhegazy Mar 1, 2018
98f7901
Make `DataTransferItem.webkitGetAsEntry` return `any`
mhegazy Mar 1, 2018
4990238
Add deprecated property `KeyboardEvent.char`
mhegazy Mar 1, 2018
a9a2b36
Add previouslly present typedefs for back compat
mhegazy Mar 1, 2018
4696164
Remove space after this types
mhegazy Mar 1, 2018
97eecc7
Use camelCase consistentlly
mhegazy Mar 1, 2018
959ffb1
Fix URL constructor
mhegazy Mar 1, 2018
8f529c3
Make unknown Window types in Worker environment `object` instead of `…
mhegazy Mar 1, 2018
22e1fa5
Make `EventTarget.addEventListener` second argument required
mhegazy Mar 1, 2018
12c83d5
Use `[]` instead of `Array` all the time
mhegazy Mar 2, 2018
e897757
Remove `Window.browser` property
mhegazy Mar 5, 2018
3c9471d
Rename `ClientType` to `ClientTypes` to avoid conflicts with exisitin…
mhegazy Mar 5, 2018
3e5afdb
Use cpx to copy
mhegazy Mar 5, 2018
64d4cca
Remove iife's
mhegazy Mar 5, 2018
5d59e97
Code review comments
mhegazy Mar 5, 2018
bb7a313
Refator emit function to a diffrent file
mhegazy Mar 6, 2018
967d7e4
Extract helpers outside the main function
mhegazy Mar 6, 2018
0920382
cleanup gitignore
mhegazy Mar 6, 2018
99305e7
Set private: true
mhegazy Mar 6, 2018
6d46a8b
more code review comments
mhegazy Mar 7, 2018
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
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ __pycache__/
*.odx.cs
*.xsd.cs

.paket/
.fake/
generated/
generated/

*.js
Copy link

Choose a reason for hiding this comment

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

Looks like all the js is in lib so this is redundant?

*.js.map
lib/
inputfiles/browser.webidl.json
14 changes: 9 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
language: csharp
mono:
- latest
language: node_js

script:
- ./build.sh
node_js:
- 'stable'

sudo: false

install:
- npm uninstall typescript --no-save
- npm install
34 changes: 23 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,27 @@ AppVeyor Status: [![Build status](https://ci.appveyor.com/api/projects/status/8o
Travis CI Status: [![Build Status](https://travis-ci.org/Microsoft/TSJS-lib-generator.svg?branch=master)](https://travis-ci.org/Microsoft/TSJS-lib-generator)

This tool is used to generate `dom.generated.d.ts`, `webworker.generated.d.ts` and `dom.es6.generated.d.ts` for TypeScript.
The input file is the XML spec file generated by the Microsoft Edge browser.
The input file is the JSON webidl file generated by the Microsoft Edge browser.

## Build Instructions

To build the tool, simply clone this repo, and run `build.cmd` (Windows) or `build.sh` (OS X/Unix) on the command line.
If it runs successfully, the output files will be generated under the `generated` folder.
To get things setup:

Note: for OS X and Unix users, [Mono 4.2 or higher](http://www.mono-project.com/download/) is required.
```sh
npm install
```

To generate the .d.ts files

```sh
npm run build
```

To test:

```sh
npm run test
```

## Contribution Guidelines

Expand All @@ -22,7 +35,7 @@ In order to make the tests pass, please update the baseline as well in any pull
For common changes, it is sufficient to change the json files.
There are three json files that are typically used to alter the type generation: `addedTypes.json`, `overridingTypes.json`, and `removedTypes.json`.
`comments.json` can used to add comments to the types.
Finally, `knownWorkerEnums` and `knownWorkerInterfaces` determine which types are available in a WebWorker environment.
Finally, `knownWorkerTypes.json` determine which types are available in a WebWorker environment.

The format of each file can be inferred from their existing content.

Expand Down Expand Up @@ -53,16 +66,15 @@ A "Living Standard" ([example](https://xhr.spec.whatwg.org/)) should be added he

## Code Structure

- `Build.fsx`: Runs `TS.fsx` for all targets, then does a snapshot test by comparing the `generated/` and `baseline/` contents.
- `TS.fsx`: handles the emitting of the `.d.ts` files.
- `src/index.ts`: handles the emitting of the `.d.ts` files.
- `src/test.ts`: verifies the otuput by comparing the `generated/` and `baseline/` contents.


## Input Files

- `browser.webidl.xml`: an XML spec file generated by Microsoft Edge. **Do not edit this file**.
- `browser.webidl.preprocessed.json`: a JSON file generated by Microsoft Edge. **Do not edit this file**.
- Due to the different update schedules between Edge and TypeScript, this may not be the most up-to-date version of the spec.
- `webworker.webidl.xml`: an XML spec file generated by Microsoft Edge that contains types for Web Workers. **Do not edit this file**.
- `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`.
- `addedTypes.json`: types that should exist in either browser or webworker but are missing from the Edge spec. The format of the file mimics that of `browser.webidl.preprocessed.json`.
- `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.
- `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. **Do not edit this file**.
Loading