From 6acaa08662971867af75210aec51c7dfe8a57fa1 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 10 Mar 2018 16:44:44 +0900 Subject: [PATCH 01/15] first commit --- inputfiles/idl/Web IDL.widl | 44 +++ inputfiles/idlSources.json | 6 + package-lock.json | 722 ++++++++++++++++++++++++++++++++++++ package.json | 11 +- src/fetcher.ts | 35 ++ src/idlprocess.ts | 2 + tsconfig.json | 4 +- 7 files changed, 820 insertions(+), 4 deletions(-) create mode 100644 inputfiles/idl/Web IDL.widl create mode 100644 inputfiles/idlSources.json create mode 100644 src/fetcher.ts create mode 100644 src/idlprocess.ts diff --git a/inputfiles/idl/Web IDL.widl b/inputfiles/idl/Web IDL.widl new file mode 100644 index 000000000..7c19a7a28 --- /dev/null +++ b/inputfiles/idl/Web IDL.widl @@ -0,0 +1,44 @@ +typedef (Int8Array or Int16Array or Int32Array or + Uint8Array or Uint16Array or Uint32Array or Uint8ClampedArray or + Float32Array or Float64Array or DataView) ArrayBufferView; + +typedef (ArrayBufferView or ArrayBuffer) BufferSource; +[ + Exposed=(Window,Worker), + Constructor(optional DOMString message = "", optional DOMString name = "Error") +] +interface DOMException { // but see below note about ECMAScript binding + readonly attribute DOMString name; + readonly attribute DOMString message; + readonly attribute unsigned short code; + + const unsigned short INDEX_SIZE_ERR = 1; + const unsigned short DOMSTRING_SIZE_ERR = 2; + const unsigned short HIERARCHY_REQUEST_ERR = 3; + const unsigned short WRONG_DOCUMENT_ERR = 4; + const unsigned short INVALID_CHARACTER_ERR = 5; + const unsigned short NO_DATA_ALLOWED_ERR = 6; + const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7; + const unsigned short NOT_FOUND_ERR = 8; + const unsigned short NOT_SUPPORTED_ERR = 9; + const unsigned short INUSE_ATTRIBUTE_ERR = 10; + const unsigned short INVALID_STATE_ERR = 11; + const unsigned short SYNTAX_ERR = 12; + const unsigned short INVALID_MODIFICATION_ERR = 13; + const unsigned short NAMESPACE_ERR = 14; + const unsigned short INVALID_ACCESS_ERR = 15; + const unsigned short VALIDATION_ERR = 16; + const unsigned short TYPE_MISMATCH_ERR = 17; + const unsigned short SECURITY_ERR = 18; + const unsigned short NETWORK_ERR = 19; + const unsigned short ABORT_ERR = 20; + const unsigned short URL_MISMATCH_ERR = 21; + const unsigned short QUOTA_EXCEEDED_ERR = 22; + const unsigned short TIMEOUT_ERR = 23; + const unsigned short INVALID_NODE_TYPE_ERR = 24; + const unsigned short DATA_CLONE_ERR = 25; +}; + +typedef unsigned long long DOMTimeStamp; +callback Function = any (any... arguments); +callback VoidFunction = void (); \ No newline at end of file diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json new file mode 100644 index 000000000..db6f132b9 --- /dev/null +++ b/inputfiles/idlSources.json @@ -0,0 +1,6 @@ +[ + { + "url": "https://heycam.github.io/webidl/", + "title": "Web IDL" + } +] diff --git a/package-lock.json b/package-lock.json index e443ca745..402858a94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,11 +3,68 @@ "requires": true, "lockfileVersion": 1, "dependencies": { + "@types/jsdom": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-11.0.4.tgz", + "integrity": "sha512-lthMj4kw7Fzs3LjBhQ0+1faAfDrN9GFJZO5Nf/xO7fppFfxqnnQdNR28n0xMGXsx8fTHOPliE1NTkAW1bVLpYw==", + "requires": { + "@types/node": "9.4.6", + "@types/tough-cookie": "2.3.2", + "parse5": "3.0.3" + } + }, "@types/node": { "version": "9.4.6", "resolved": "https://registry.npmjs.org/@types/node/-/node-9.4.6.tgz", "integrity": "sha512-CTUtLb6WqCCgp6P59QintjHWqzf4VL1uPA27bipLAPxFqrtK1gEYllePzTICGqQ8rYsCbpnsNypXjjDzGAAjEQ==" }, + "@types/node-fetch": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-1.6.7.tgz", + "integrity": "sha1-UhB46PDGmhWOUCIAWsqS0mIPbVc=", + "requires": { + "@types/node": "9.4.6" + } + }, + "@types/tough-cookie": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA==" + }, + "@types/webidl2": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/@types/webidl2/-/webidl2-10.2.0.tgz", + "integrity": "sha512-npmi7XRcxUjUjtXsWTOomfCaC9mttf/gL6x/tvJgxj28qZzEM5Tx2W06b5S4gLGy0XNwriKvO9rTk01ABzlE+w==" + }, + "abab": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz", + "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4=" + }, + "acorn": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.1.tgz", + "integrity": "sha512-D/KGiCpM/VOtTMDS+wfjywEth926WUrArrzYov4N4SI7t+3y8747dPpCmmAvrm/Z3ygqMHnyPxvYYO0yTdn/nQ==" + }, + "acorn-globals": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz", + "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==", + "requires": { + "acorn": "5.5.1" + } + }, + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, "anymatch": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", @@ -30,6 +87,11 @@ "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==" }, + "array-equal": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz", + "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM=" + }, "array-filter": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", @@ -50,11 +112,41 @@ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=" }, + "asn1": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" + }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=" }, + "async-limiter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz", + "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==" + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=" + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -69,11 +161,28 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "optional": true, + "requires": { + "tweetnacl": "0.14.5" + } + }, "binary-extensions": { "version": "1.11.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=" }, + "boom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/boom/-/boom-4.3.1.tgz", + "integrity": "sha1-T4owBctKfjiJ90kDD9JbluAdLjE=", + "requires": { + "hoek": "4.2.1" + } + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -93,6 +202,16 @@ "repeat-element": "1.1.2" } }, + "browser-process-hrtime": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz", + "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44=" + }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chokidar": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", @@ -109,11 +228,29 @@ "readdirp": "2.1.0" } }, + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=" + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "requires": { + "delayed-stream": "1.0.0" + } + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "content-type-parser": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/content-type-parser/-/content-type-parser-1.0.2.tgz", + "integrity": "sha512-lM4l4CnMEwOLHAHr/P6MEZwZFPJFtAAKgL6pogbXmVZggIqXhdB6RbBtPOTsw2FcXwYhehRGERJmRrjOiIB8pQ==" + }, "core-js": { "version": "2.5.3", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.3.tgz", @@ -142,11 +279,104 @@ "subarg": "1.0.0" } }, + "cryptiles": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", + "integrity": "sha1-qJ+7Ig9c4l7FboxKqKT9e1sNKf4=", + "requires": { + "boom": "5.2.0" + }, + "dependencies": { + "boom": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/boom/-/boom-5.2.0.tgz", + "integrity": "sha512-Z5BTk6ZRe4tXXQlkqftmsAUANpXmuwlsF5Oov8ThoMbQRzdGTA1ngYRW160GexgOgjsFOKJz0LYhoNi+2AMBUw==", + "requires": { + "hoek": "4.2.1" + } + } + } + }, + "cssom": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz", + "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs=" + }, + "cssstyle": { + "version": "0.2.37", + "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.2.37.tgz", + "integrity": "sha1-VBCXI0yyUTyDzu06zdwn/yeYfVQ=", + "requires": { + "cssom": "0.3.2" + } + }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "1.0.0" + } + }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=" + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "domexception": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz", + "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==", + "requires": { + "webidl-conversions": "4.0.2" + } + }, "duplexer": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz", "integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=" }, + "ecc-jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "optional": true, + "requires": { + "jsbn": "0.1.1" + } + }, + "escodegen": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.9.1.tgz", + "integrity": "sha512-6hTjO1NAWkHnDk3OqQ4YrCuwwmGHL9S3nPlzBOUG/R44rda3wLNrfvQ5fkSGjyhHFKM7ALPKcKGrwvCLe0lC7Q==", + "requires": { + "esprima": "3.1.3", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "optionator": "0.8.2", + "source-map": "0.6.1" + } + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=" + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=" + }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -163,6 +393,11 @@ "fill-range": "2.2.3" } }, + "extend": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" + }, "extglob": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", @@ -171,6 +406,26 @@ "is-extglob": "1.0.0" } }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, + "fast-deep-equal": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz", + "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ=" + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=" + }, "filename-regex": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", @@ -206,6 +461,21 @@ "for-in": "1.0.2" } }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "requires": { + "asynckit": "0.4.0", + "combined-stream": "1.0.6", + "mime-types": "2.1.18" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1000,6 +1270,14 @@ } } }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "1.0.0" + } + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -1043,6 +1321,59 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=" }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz", + "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=", + "requires": { + "ajv": "5.5.2", + "har-schema": "2.0.0" + } + }, + "hawk": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", + "integrity": "sha512-miowhl2+U7Qle4vdLqDdPt9m09K6yZhkLDTWGoUiUzrQCn+mHHSmfJgAyGaLRZbPmTqfFFjRV1QWCW0VWUJBbQ==", + "requires": { + "boom": "4.3.1", + "cryptiles": "3.1.2", + "hoek": "4.2.1", + "sntp": "2.1.0" + } + }, + "hoek": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz", + "integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA==" + }, + "html-encoding-sniffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz", + "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==", + "requires": { + "whatwg-encoding": "1.0.3" + } + }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "1.0.0", + "jsprim": "1.4.1", + "sshpk": "1.13.1" + } + }, + "iconv-lite": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", + "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==" + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1119,6 +1450,11 @@ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", @@ -1132,11 +1468,88 @@ "isarray": "1.0.0" } }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "optional": true + }, + "jsdom": { + "version": "11.6.2", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.6.2.tgz", + "integrity": "sha512-pAeZhpbSlUp5yQcS6cBQJwkbzmv4tWFaYxHbFVSxzXefqjvtRA851Z5N2P+TguVG9YeUDcgb8pdeVQRJh0XR3Q==", + "requires": { + "abab": "1.0.4", + "acorn": "5.5.1", + "acorn-globals": "4.1.0", + "array-equal": "1.0.0", + "browser-process-hrtime": "0.1.2", + "content-type-parser": "1.0.2", + "cssom": "0.3.2", + "cssstyle": "0.2.37", + "domexception": "1.0.1", + "escodegen": "1.9.1", + "html-encoding-sniffer": "1.0.2", + "left-pad": "1.2.0", + "nwmatcher": "1.4.3", + "parse5": "4.0.0", + "pn": "1.1.0", + "request": "2.83.0", + "request-promise-native": "1.0.5", + "sax": "1.2.4", + "symbol-tree": "3.2.2", + "tough-cookie": "2.3.4", + "w3c-hr-time": "1.0.1", + "webidl-conversions": "4.0.2", + "whatwg-encoding": "1.0.3", + "whatwg-url": "6.4.0", + "ws": "4.1.0", + "xml-name-validator": "3.0.0" + }, + "dependencies": { + "parse5": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz", + "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA==" + } + } + }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, + "json-schema-traverse": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", + "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" + }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + }, "jsonify": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=" }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -1145,6 +1558,30 @@ "is-buffer": "1.1.6" } }, + "left-pad": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.2.0.tgz", + "integrity": "sha1-0wpzxrggHY99jnlWupYWCHpo4O4=" + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, + "lodash": { + "version": "4.17.5", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz", + "integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw==" + }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, "micromatch": { "version": "2.3.11", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", @@ -1165,6 +1602,19 @@ "regex-cache": "0.4.4" } }, + "mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==" + }, + "mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "requires": { + "mime-db": "1.33.0" + } + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1192,6 +1642,11 @@ "integrity": "sha512-ltW65co7f3PQWBDbqVvaU1WtFJUsNW7sWWm4HINhbMQIyVyzIeyZ8toX5TC5eeooE6piZoaEh4cZkueSKG3KYw==", "optional": true }, + "node-fetch": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.1.tgz", + "integrity": "sha1-NpynC4L1DIZJYQSmx3bSdPTkotQ=" + }, "normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -1200,6 +1655,16 @@ "remove-trailing-separator": "1.1.0" } }, + "nwmatcher": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/nwmatcher/-/nwmatcher-1.4.3.tgz", + "integrity": "sha512-IKdSTiDWCarf2JTS5e9e2+5tPZGdkRJ79XjYV0pzK8Q9BpsFyBq1RGKxzs7Q8UBushGw7m6TzVKz6fcY99iSWw==" + }, + "oauth-sign": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=" + }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -1217,6 +1682,19 @@ "wrappy": "1.0.2" } }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, "parse-glob": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", @@ -1228,6 +1706,14 @@ "is-glob": "2.0.1" } }, + "parse5": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz", + "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==", + "requires": { + "@types/node": "9.4.6" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1238,6 +1724,21 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=" }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, + "pn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz", + "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA==" + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=" + }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", @@ -1248,6 +1749,16 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" + }, + "qs": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", + "integrity": "sha512-eRzhrN1WSINYCDCbrz796z37LOe3m5tmW7RQf6oBntukAG1nmovJvhnwHHRMAfeoItc1m2Hk02WER2aQ/iqs+A==" + }, "randomatic": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", @@ -1338,6 +1849,53 @@ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=" }, + "request": { + "version": "2.83.0", + "resolved": "https://registry.npmjs.org/request/-/request-2.83.0.tgz", + "integrity": "sha512-lR3gD69osqm6EYLk9wB/G1W/laGWjzH90t1vEa2xuxHD5KUrSzp9pUSfTm+YC5Nxt2T8nMPEvKlhbQayU7bgFw==", + "requires": { + "aws-sign2": "0.7.0", + "aws4": "1.6.0", + "caseless": "0.12.0", + "combined-stream": "1.0.6", + "extend": "3.0.1", + "forever-agent": "0.6.1", + "form-data": "2.3.2", + "har-validator": "5.0.3", + "hawk": "6.0.2", + "http-signature": "1.2.0", + "is-typedarray": "1.0.0", + "isstream": "0.1.2", + "json-stringify-safe": "5.0.1", + "mime-types": "2.1.18", + "oauth-sign": "0.8.2", + "performance-now": "2.1.0", + "qs": "6.5.1", + "safe-buffer": "5.1.1", + "stringstream": "0.0.5", + "tough-cookie": "2.3.4", + "tunnel-agent": "0.6.0", + "uuid": "3.2.1" + } + }, + "request-promise-core": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz", + "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=", + "requires": { + "lodash": "4.17.5" + } + }, + "request-promise-native": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz", + "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=", + "requires": { + "request-promise-core": "1.1.1", + "stealthy-require": "1.1.1", + "tough-cookie": "2.3.4" + } + }, "resolve": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", @@ -1351,6 +1909,11 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, + "sax": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" + }, "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -1367,6 +1930,40 @@ "jsonify": "0.0.0" } }, + "sntp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", + "integrity": "sha512-FL1b58BDrqS3A11lJ0zEdnJ3UOKqVxawAkF3k7F0CVN7VQ34aZrV+G8BZ1WC9ZL7NyrwsW0oviwsWDgRuVYtJg==", + "requires": { + "hoek": "4.2.1" + } + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true + }, + "sshpk": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz", + "integrity": "sha1-US322mKHFEMW3EwY/hzx2UBzm+M=", + "requires": { + "asn1": "0.2.3", + "assert-plus": "1.0.0", + "bcrypt-pbkdf": "1.0.1", + "dashdash": "1.14.1", + "ecc-jsbn": "0.1.1", + "getpass": "0.1.7", + "jsbn": "0.1.1", + "tweetnacl": "0.14.5" + } + }, + "stealthy-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz", + "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=" + }, "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", @@ -1375,6 +1972,11 @@ "safe-buffer": "5.1.1" } }, + "stringstream": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=" + }, "subarg": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", @@ -1390,6 +1992,56 @@ } } }, + "symbol-tree": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz", + "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY=" + }, + "tough-cookie": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", + "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==", + "requires": { + "punycode": "1.4.1" + } + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" + } + } + }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "5.1.1" + } + }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "optional": true + }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "requires": { + "prelude-ls": "1.1.2" + } + }, "typescript": { "version": "2.8.0-dev.20180307", "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180307.tgz", @@ -1400,10 +2052,80 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "uuid": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", + "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==" + }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "1.3.0" + } + }, + "w3c-hr-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz", + "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=", + "requires": { + "browser-process-hrtime": "0.1.2" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + }, + "webidl2": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/webidl2/-/webidl2-10.2.0.tgz", + "integrity": "sha512-qSTGkql9gLhtju/LuboiQs7o/NYa62EI+cWmhYGsJfFEZqcLXGBH3QwZ926c+JAa/5tteG2lHjG0p3HuL4B3lQ==" + }, + "whatwg-encoding": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz", + "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==", + "requires": { + "iconv-lite": "0.4.19" + } + }, + "whatwg-url": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.4.0.tgz", + "integrity": "sha512-Z0CVh/YE217Foyb488eo+iBv+r7eAQ0wSTyApi9n06jhcA3z6Nidg/EGvl0UFkg7kMdKxfBzzr+o9JF+cevgMg==", + "requires": { + "lodash.sortby": "4.7.0", + "tr46": "1.0.1", + "webidl-conversions": "4.0.2" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "ws": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz", + "integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==", + "requires": { + "async-limiter": "1.0.0", + "safe-buffer": "5.1.1" + } + }, + "xml-name-validator": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz", + "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==" } } } diff --git a/package.json b/package.json index 7578ac6d0..ff25facb4 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,21 @@ { - "name": "TSJS-lib-generator", + "name": "tsjs-lib-generator", "private": true, "scripts": { "build": "tsc --p ./tsconfig.json && node ./lib/index.js", + "fetch": "tsc --p ./tsconfig.json && node ./lib/fetcher.js", "baseline-accept": "cpx \"generated\\*\" baselines\\", "test": "tsc --p ./tsconfig.json && node ./lib/index.js && node ./lib/test.js" }, "dependencies": { + "@types/jsdom": "^11.0.4", "@types/node": "^9.4.6", + "@types/node-fetch": "^1.6.7", + "@types/webidl2": "^10.2.0", "cpx": "^1.5.0", - "typescript": "next" + "jsdom": "^11.6.2", + "node-fetch": "^2.1.1", + "typescript": "next", + "webidl2": "^10.2.0" } } diff --git a/src/fetcher.ts b/src/fetcher.ts new file mode 100644 index 000000000..c85180d77 --- /dev/null +++ b/src/fetcher.ts @@ -0,0 +1,35 @@ +import * as fs from "fs"; +import fetch from "node-fetch"; +import { JSDOM } from "jsdom"; + +fetchIDLs(); + +interface IDLSource { + url: string; + title: string; +} + +async function fetchIDLs() { + const file = fs.readFileSync(`${__dirname}/../inputfiles/idlSources.json`, { encoding: "utf-8" }); + const idlSources = JSON.parse(file) as IDLSource[]; + for (const source of idlSources) { + const idl = await fetchIDL(source); + fs.writeFileSync(`${__dirname}/../inputfiles/idl/${source.title}.widl`, idl); + } +} + +async function fetchIDL(source: IDLSource) { + const response = await fetch(source.url); + const dom = new JSDOM(await response.text()); + const elements = Array.from(dom.window.document.querySelectorAll("pre.idl:not(.extract),code.idl-code")); + if (!elements.length) { + throw new Error("Found no IDL code"); + } + const last = elements[elements.length - 1]; + if (last.previousElementSibling!.textContent!.includes("IDL Index")) { + // IDL Index includes all IDL codes + return last.textContent!.trim(); + } + + return elements.map(element => element.textContent!.trim()).join('\n\n'); +} diff --git a/src/idlprocess.ts b/src/idlprocess.ts new file mode 100644 index 000000000..81d2778d5 --- /dev/null +++ b/src/idlprocess.ts @@ -0,0 +1,2 @@ +import * as webidl2 from "webidl2"; + diff --git a/tsconfig.json b/tsconfig.json index 42ee03d79..277647c0f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "target": "es6", "module": "commonjs", - "lib": ["es2016"], + "lib": ["es2016", "dom"], "outDir": "./lib", "strict": true, "esModuleInterop": true, @@ -13,4 +13,4 @@ "include": [ "./src" ] -} \ No newline at end of file +} From 688fde7dcb16bdcbdc01dee595664323b4fb1822 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 11 Mar 2018 22:27:54 +0900 Subject: [PATCH 02/15] basic interface converter --- package-lock.json | 8 +-- src/fetcher.ts | 2 +- src/idlprocess.ts | 2 - src/index.ts | 2 +- src/widlprocess.ts | 127 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 133 insertions(+), 8 deletions(-) delete mode 100644 src/idlprocess.ts create mode 100644 src/widlprocess.ts diff --git a/package-lock.json b/package-lock.json index 402858a94..a7ba50fe2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "TSJS-lib-generator", + "name": "tsjs-lib-generator", "requires": true, "lockfileVersion": 1, "dependencies": { @@ -2043,9 +2043,9 @@ } }, "typescript": { - "version": "2.8.0-dev.20180307", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180307.tgz", - "integrity": "sha512-v8gWVik3uKhHSzx8VEKDR9t/jAEtJrxgwBde9hbt6re579n/xjB7ROUCzvcy9Le4BzxAQGmOOP7HsQG+h4Nvzg==" + "version": "2.8.0-dev.20180308", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180308.tgz", + "integrity": "sha512-UI8bxYQmgCSdS+Keh7w7KTXSbsJ56GFRHeNxhpAyhrEuP5Tf8pikoAa71UaPXZJBWnP0ZAscHlXjrPlrfwk4Jg==" }, "util-deprecate": { "version": "1.0.2", diff --git a/src/fetcher.ts b/src/fetcher.ts index c85180d77..0a2b1a86e 100644 --- a/src/fetcher.ts +++ b/src/fetcher.ts @@ -14,7 +14,7 @@ async function fetchIDLs() { const idlSources = JSON.parse(file) as IDLSource[]; for (const source of idlSources) { const idl = await fetchIDL(source); - fs.writeFileSync(`${__dirname}/../inputfiles/idl/${source.title}.widl`, idl); + fs.writeFileSync(`${__dirname}/../inputfiles/idl/${source.title}.widl`, idl + '\n'); } } diff --git a/src/idlprocess.ts b/src/idlprocess.ts deleted file mode 100644 index 81d2778d5..000000000 --- a/src/idlprocess.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as webidl2 from "webidl2"; - diff --git a/src/index.ts b/src/index.ts index 0d22a6aab..4c8cd6400 100644 --- a/src/index.ts +++ b/src/index.ts @@ -140,4 +140,4 @@ function emitDom() { } } -emitDom(); \ No newline at end of file +emitDom(); diff --git a/src/widlprocess.ts b/src/widlprocess.ts new file mode 100644 index 000000000..bebaac180 --- /dev/null +++ b/src/widlprocess.ts @@ -0,0 +1,127 @@ +import * as webidl2 from "webidl2"; +import * as Browser from "./types"; + +export function convert(text: string) { + const rootTypes = webidl2.parse(text); + const partialInterfaces: Browser.Interface[] = []; + const browser = createEmptyBrowserWebidl(); + for (const rootType of rootTypes) { + if (rootType.type === "interface") { + const converted = convertInterface(rootType); + if (rootType.partial) { + partialInterfaces.push(converted); + } + else { + browser.interfaces!.interface[rootType.name] = converted; + } + } + } + return { browser, partialInterfaces }; +} + +function getExposure(extAttrs: webidl2.ExtendedAttributes[]) { + for (const extAttr of extAttrs) { + if (extAttr.name === "Exposed") { + if (Array.isArray(extAttr.rhs.value)) { + return extAttr.rhs.value.join(' '); + } + return extAttr.rhs.value; + } + } + return "Window"; +} + +function convertInterface(i: webidl2.InterfaceType) { + const result: Browser.Interface = { + name: i.name, + extends: i.inheritance || "Object", + constants: { constant: {} }, + methods: { method: {} }, + properties: { property: {} }, + constructor: getConstructor(i.extAttrs), // TODO: implement this + exposed: getExposure(i.extAttrs) + }; + for (const member of i.members) { + if (member.type === "const") { + result.constants!.constant[member.name] = convertConstantMember(member); + } + else if (member.type === "attribute") { + result.properties!.property[member.name] = convertAttribute(member); + } + } + + return result; +} + +function getConstructor(extAttrs: webidl2.ExtendedAttributes[]): Browser.Constructor | undefined { + for (const extAttr of extAttrs) { + if (extAttr.name === "Constructor") { + return { + signature: [{ + type: "", // emitter never uses this + param: extAttr.arguments.map(convertArgument) + }] + } + } + } +} + +function convertArgument(arg: webidl2.Argument): Browser.Param { + return { + name: arg.name, + type: convertIdlType(arg.idlType), + nullable: arg.idlType.nullable ? 1 : undefined, + optional: arg.optional ? 1 : undefined, + variadic: arg.variadic ? 1 : undefined, + } +} + +function convertAttribute(attribute: webidl2.AttributeMemberType): Browser.Property { + return { + name: attribute.name, + type: convertIdlType(attribute.idlType), + "read-only": attribute.readonly ? 1 : undefined + } +} + +function convertConstantMember(constant: webidl2.ConstantMemberType): Browser.Constant { + return { + name: constant.name, + type: constant.idlType.idlType as string, + value: convertConstantValue(constant.value) + }; + + function convertConstantValue(value: webidl2.ValueDescription): string { + switch (value.type) { + case "boolean": + case "number": + return `${value.value}`; + case "null": + case "NaN": + return value.type; + case "Infinity": + return (value.negative ? '-' : '') + value.type; + default: + throw new Error("Not implemented"); + } + } +} + +function convertIdlType(i: webidl2.IDLTypeDescription): string | Browser.Typed[] { + if (typeof i.idlType === "string") { + return i.idlType; + } + throw new Error("Not implemented"); +} + +function createEmptyBrowserWebidl(): Browser.WebIdl { + return { + "callback-functions": { "callback-function": {} }, + "callback-interfaces": { interface: {} }, + dictionaries: { dictionary: {} }, + enums: { enum: {} }, + interfaces: { interface: {} }, + mixins: { mixin: {} }, + typedefs: { typedef: [] } + } +} From c3f2b17473a6c9afa86999024da65ddb406eee9e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 12 Mar 2018 10:24:59 +0900 Subject: [PATCH 03/15] convert callback functions --- inputfiles/addedTypes.json | 2 +- src/widlprocess.ts | 47 +++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index e1fcd98e1..21f6a3a13 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -3079,4 +3079,4 @@ } ] } -} \ No newline at end of file +} diff --git a/src/widlprocess.ts b/src/widlprocess.ts index bebaac180..69051c2a2 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -15,6 +15,19 @@ export function convert(text: string) { browser.interfaces!.interface[rootType.name] = converted; } } + else if (rootType.type === "interface mixin") { + browser["mixins"]!.mixin[rootType.name] = convertInterfaceMixin(rootType); + } + else if (rootType.type === "callback interface") { + browser["callback-interfaces"]!.interface[rootType.name] = convertInterface(rootType); + } + else if (rootType.type === "callback") { + browser["callback-functions"]!["callback-function"][rootType.name] + = convertCallbackFunctions(rootType); + } + else if (rootType.type === "typedef") { + browser.typedefs!.typedef.push() + } } return { browser, partialInterfaces }; } @@ -32,9 +45,23 @@ function getExposure(extAttrs: webidl2.ExtendedAttributes[]) { } function convertInterface(i: webidl2.InterfaceType) { + const result = convertInterfaceCommon(i); + if (i.inheritance) { + result.extends = i.inheritance; + } + return result; +} + +function convertInterfaceMixin(i: webidl2.InterfaceMixinType) { + const result = convertInterfaceCommon(i); + result['no-interface-object'] = 1; + return result; +} + +function convertInterfaceCommon(i: webidl2.InterfaceType | webidl2.InterfaceMixinType) { const result: Browser.Interface = { name: i.name, - extends: i.inheritance || "Object", + extends: "Object", constants: { constant: {} }, methods: { method: {} }, properties: { property: {} }, @@ -66,6 +93,17 @@ function getConstructor(extAttrs: webidl2.ExtendedAttributes[]): Browser.Constru } } +function convertCallbackFunctions(c: webidl2.CallbackType): Browser.CallbackFunction { + return { + name: c.name, + callback: 1, + signature: [{ + type: convertIdlType(c.idlType), + param: c.arguments.map(convertArgument) + }] + } +} + function convertArgument(arg: webidl2.Argument): Browser.Param { return { name: arg.name, @@ -107,6 +145,13 @@ function convertConstantMember(constant: webidl2.ConstantMemberType): Browser.Co } } +// function convertTypedef(typedef: webidl2.TypedefType): Browser.TypeDef { +// return { +// "new-type": typedef.name, +// type: +// } +// } + function convertIdlType(i: webidl2.IDLTypeDescription): string | Browser.Typed[] { if (typeof i.idlType === "string") { return i.idlType; From 761f13fca6cd1c17f60dbf7df06dc31b10261326 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 12 Mar 2018 14:39:06 +0900 Subject: [PATCH 04/15] convert typedef --- src/widlprocess.ts | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/src/widlprocess.ts b/src/widlprocess.ts index 69051c2a2..1413b5ecf 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -26,7 +26,7 @@ export function convert(text: string) { = convertCallbackFunctions(rootType); } else if (rootType.type === "typedef") { - browser.typedefs!.typedef.push() + browser.typedefs!.typedef.push(convertTypedef(rootType)); } } return { browser, partialInterfaces }; @@ -98,7 +98,7 @@ function convertCallbackFunctions(c: webidl2.CallbackType): Browser.CallbackFunc name: c.name, callback: 1, signature: [{ - type: convertIdlType(c.idlType), + ...convertIdlType(c.idlType), param: c.arguments.map(convertArgument) }] } @@ -107,7 +107,7 @@ function convertCallbackFunctions(c: webidl2.CallbackType): Browser.CallbackFunc function convertArgument(arg: webidl2.Argument): Browser.Param { return { name: arg.name, - type: convertIdlType(arg.idlType), + ...convertIdlType(arg.idlType), nullable: arg.idlType.nullable ? 1 : undefined, optional: arg.optional ? 1 : undefined, variadic: arg.variadic ? 1 : undefined, @@ -117,7 +117,7 @@ function convertArgument(arg: webidl2.Argument): Browser.Param { function convertAttribute(attribute: webidl2.AttributeMemberType): Browser.Property { return { name: attribute.name, - type: convertIdlType(attribute.idlType), + ...convertIdlType(attribute.idlType), "read-only": attribute.readonly ? 1 : undefined } } @@ -145,18 +145,34 @@ function convertConstantMember(constant: webidl2.ConstantMemberType): Browser.Co } } -// function convertTypedef(typedef: webidl2.TypedefType): Browser.TypeDef { -// return { -// "new-type": typedef.name, -// type: -// } -// } +function convertTypedef(typedef: webidl2.TypedefType): Browser.TypeDef { + return { + "new-type": typedef.name, + ...convertIdlType(typedef.idlType) + } +} -function convertIdlType(i: webidl2.IDLTypeDescription): string | Browser.Typed[] { +function convertIdlType(i: webidl2.IDLTypeDescription): Browser.Typed { if (typeof i.idlType === "string") { - return i.idlType; + return { + type: i.idlType, + nullable: i.nullable ? 1 : undefined + }; + } + if (i.generic) { + return { + type: i.generic, + subtype: convertIdlType(i.idlType as webidl2.IDLTypeDescription), + nullable: i.nullable ? 1 : undefined + }; + } + if (i.union) { + return { + type: (i.idlType as webidl2.IDLTypeDescription[]).map(convertIdlType), + nullable: i.nullable ? 1 : undefined + }; } - throw new Error("Not implemented"); + throw new Error("Unsupported IDL type structure"); } function createEmptyBrowserWebidl(): Browser.WebIdl { From e79823fef7163a5ca291103dbc4b01dbb895ddbd Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 12 Mar 2018 17:33:04 +0900 Subject: [PATCH 05/15] incomplete operation converter --- inputfiles/idl/Encoding.widl | 23 ++++++++++ inputfiles/idl/Web IDL.widl | 2 +- inputfiles/idlSources.json | 4 ++ src/index.ts | 7 +++ src/widlprocess.ts | 86 +++++++++++++++++++++++++++--------- 5 files changed, 100 insertions(+), 22 deletions(-) create mode 100644 inputfiles/idl/Encoding.widl diff --git a/inputfiles/idl/Encoding.widl b/inputfiles/idl/Encoding.widl new file mode 100644 index 000000000..bbb2aa3b6 --- /dev/null +++ b/inputfiles/idl/Encoding.widl @@ -0,0 +1,23 @@ +dictionary TextDecoderOptions { + boolean fatal = false; + boolean ignoreBOM = false; +}; + +dictionary TextDecodeOptions { + boolean stream = false; +}; + +[Constructor(optional DOMString label = "utf-8", optional TextDecoderOptions options), + Exposed=(Window,Worker)] +interface TextDecoder { + readonly attribute DOMString encoding; + readonly attribute boolean fatal; + readonly attribute boolean ignoreBOM; + USVString decode(optional BufferSource input, optional TextDecodeOptions options); +}; +[Constructor, + Exposed=(Window,Worker)] +interface TextEncoder { + readonly attribute DOMString encoding; + [NewObject] Uint8Array encode(optional USVString input = ""); +}; diff --git a/inputfiles/idl/Web IDL.widl b/inputfiles/idl/Web IDL.widl index 7c19a7a28..5ebec9017 100644 --- a/inputfiles/idl/Web IDL.widl +++ b/inputfiles/idl/Web IDL.widl @@ -41,4 +41,4 @@ interface DOMException { // but see below note about ECMAScript binding typedef unsigned long long DOMTimeStamp; callback Function = any (any... arguments); -callback VoidFunction = void (); \ No newline at end of file +callback VoidFunction = void (); diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index db6f132b9..918cd668b 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -1,4 +1,8 @@ [ + { + "url": "https://encoding.spec.whatwg.org/", + "title": "Encoding" + }, { "url": "https://heycam.github.io/webidl/", "title": "Web IDL" diff --git a/src/index.ts b/src/index.ts index 4c8cd6400..c1b1783cd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,7 @@ import * as fs from "fs"; import * as path from "path"; import { filter, merge, filterProperties } from "./helpers"; import { Flavor, emitWebIDl } from "./emitter"; +import { convert } from "./widlprocess"; function emitDomWorker(webidl: Browser.WebIdl, knownWorkerTypes: Set, tsWorkerOutput: string) { const worker = getEmptyWebIDL(); @@ -81,12 +82,18 @@ function emitDom() { const addedItems = require(path.join(inputFolder, "addedTypes.json")); const comments = require(path.join(inputFolder, "comments.json")); const removedItems = require(path.join(inputFolder, "removedTypes.json")); + const widlStandardTypes = fs.readdirSync(path.join(inputFolder, "idl")).map( + filename => fs.readFileSync(path.join(inputFolder, "idl", filename), { encoding: "utf-8" }) + ).map(convert); /// Load the input file let webidl: Browser.WebIdl = require(path.join(inputFolder, "browser.webidl.preprocessed.json")); const knownWorkerTypes = new Set(require(path.join(inputFolder, "knownWorkerTypes.json"))); + for (const w of widlStandardTypes) { + webidl = merge(webidl, w.browser); + } webidl = prune(webidl, removedItems); webidl = merge(webidl, addedItems); webidl = merge(webidl, overriddenItems); diff --git a/src/widlprocess.ts b/src/widlprocess.ts index 1413b5ecf..eea7d8ef8 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -25,6 +25,9 @@ export function convert(text: string) { browser["callback-functions"]!["callback-function"][rootType.name] = convertCallbackFunctions(rootType); } + else if (rootType.type === "dictionary") { + browser.dictionaries!.dictionary[rootType.name] = convertDictionary(rootType); + } else if (rootType.type === "typedef") { browser.typedefs!.typedef.push(convertTypedef(rootType)); } @@ -65,7 +68,7 @@ function convertInterfaceCommon(i: webidl2.InterfaceType | webidl2.InterfaceMixi constants: { constant: {} }, methods: { method: {} }, properties: { property: {} }, - constructor: getConstructor(i.extAttrs), // TODO: implement this + constructor: getConstructor(i.extAttrs, i.name), // TODO: implement this exposed: getExposure(i.extAttrs) }; for (const member of i.members) { @@ -80,17 +83,35 @@ function convertInterfaceCommon(i: webidl2.InterfaceType | webidl2.InterfaceMixi return result; } -function getConstructor(extAttrs: webidl2.ExtendedAttributes[]): Browser.Constructor | undefined { +function getConstructor(extAttrs: webidl2.ExtendedAttributes[], parent: string) { + const constructor: Browser.Constructor = { + signature: [] + }; for (const extAttr of extAttrs) { if (extAttr.name === "Constructor") { - return { - signature: [{ - type: "", // emitter never uses this - param: extAttr.arguments.map(convertArgument) - }] - } + constructor.signature.push({ + type: parent, + param: extAttr.arguments ? extAttr.arguments.map(convertArgument) : [] + }); } } + if (constructor.signature.length) { + return constructor; + } +} + +function convertOperation(operation: webidl2.OperationMemberType) { + const result: Browser.Method = { + name: operation.name!, + signature: [], + getter: operation.getter ? 1 : undefined, + static: operation.static ? 1 : undefined, + stringifier: operation.stringifier ? 1 : undefined, + } + + operation.arguments + + return result; } function convertCallbackFunctions(c: webidl2.CallbackType): Browser.CallbackFunction { @@ -128,20 +149,43 @@ function convertConstantMember(constant: webidl2.ConstantMemberType): Browser.Co type: constant.idlType.idlType as string, value: convertConstantValue(constant.value) }; +} - function convertConstantValue(value: webidl2.ValueDescription): string { - switch (value.type) { - case "boolean": - case "number": - return `${value.value}`; - case "null": - case "NaN": - return value.type; - case "Infinity": - return (value.negative ? '-' : '') + value.type; - default: - throw new Error("Not implemented"); - } +function convertConstantValue(value: webidl2.ValueDescription): string { + switch (value.type) { + case "string": + return `"${value.value}"`; + case "boolean": + case "number": + case "sequence": + return `${value.value}`; + case "null": + case "NaN": + return value.type; + case "Infinity": + return (value.negative ? '-' : '') + value.type; + default: + throw new Error("Not implemented"); + } +} + +function convertDictionary(dictionary: webidl2.DictionaryType) { + const result: Browser.Dictionary = { + name: dictionary.name, + extends: dictionary.inheritance || "Object", + members: { member: {} } + } + for (const member of dictionary.members) { + result.members.member[member.name] = convertDictionaryMember(member); + } + return result; +} + +function convertDictionaryMember(member: webidl2.DictionaryMemberType): Browser.Member { + return { + name: member.name, + default: member.default ? convertConstantValue(member.default) : undefined, + ...convertIdlType(member.idlType) } } From 2d4be97a2a387352b6287a01aa1c38c09716d997 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 12 Mar 2018 22:53:27 +0900 Subject: [PATCH 06/15] convert operations --- src/widlprocess.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/widlprocess.ts b/src/widlprocess.ts index eea7d8ef8..e934b42c5 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -78,6 +78,16 @@ function convertInterfaceCommon(i: webidl2.InterfaceType | webidl2.InterfaceMixi else if (member.type === "attribute") { result.properties!.property[member.name] = convertAttribute(member); } + else if (member.type === "operation" && member.name) { + const operation = convertOperation(member); + const { method } = result.methods; + if (method[member.name]) { + method[member.name].signature.push(...operation.signature); + } + else { + method[member.name] = operation; + } + } } return result; @@ -100,18 +110,17 @@ function getConstructor(extAttrs: webidl2.ExtendedAttributes[], parent: string) } } -function convertOperation(operation: webidl2.OperationMemberType) { - const result: Browser.Method = { +function convertOperation(operation: webidl2.OperationMemberType): Browser.Method { + return { name: operation.name!, - signature: [], + signature: [{ + ...convertIdlType(operation.idlType!), + param: operation.arguments.map(convertArgument) + }], getter: operation.getter ? 1 : undefined, static: operation.static ? 1 : undefined, stringifier: operation.stringifier ? 1 : undefined, - } - - operation.arguments - - return result; + }; } function convertCallbackFunctions(c: webidl2.CallbackType): Browser.CallbackFunction { From e3f76daf88ab36d9b866844b52b1df58e4cca3ac Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Mon, 12 Mar 2018 23:11:27 +0900 Subject: [PATCH 07/15] fix typedef filtering --- inputfiles/addedTypes.json | 4 ---- inputfiles/removedTypes.json | 6 ++++-- src/index.ts | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 21f6a3a13..ddf4c7e3c 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -3069,10 +3069,6 @@ "new-type": "payloadtype", "override-type": "number" }, - { - "new-type": "BufferSource", - "override-type": "ArrayBuffer | ArrayBufferView" - }, { "new-type": "ClientTypes", "override-type": "\"window\" | \"worker\" | \"sharedworker\" | \"all\"" diff --git a/inputfiles/removedTypes.json b/inputfiles/removedTypes.json index 68424db10..0b26c1bbe 100644 --- a/inputfiles/removedTypes.json +++ b/inputfiles/removedTypes.json @@ -55,6 +55,8 @@ } }, "typedefs": { - "typedef": [] + "typedef": [{ + "new-type": "ArrayBufferView" + }] } -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index c1b1783cd..be50f8c35 100644 --- a/src/index.ts +++ b/src/index.ts @@ -112,7 +112,7 @@ function emitDom() { if (obj.enums) result.enums!.enum = filterEnum(obj.enums.enum, template.enums && template.enums.enum); if (obj.mixins) result.mixins!.mixin = filterInterface(obj.mixins.mixin, template.mixins && template.mixins.mixin); if (obj.interfaces) result.interfaces!.interface = filterInterface(obj.interfaces.interface, template.interfaces && template.interfaces.interface); - if (obj.typedefs) result.typedefs!.typedef = obj.typedefs.typedef.filter(t => template.typedefs && template.typedefs.typedef.find(o => o["new-type"] === t["new-type"])); + if (obj.typedefs) result.typedefs!.typedef = obj.typedefs.typedef.filter(t => !(template.typedefs && template.typedefs.typedef.find(o => o["new-type"] === t["new-type"]))); return result; From ea1a6a591942113a7b7cbd64dfb120dead3855c4 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 13 Mar 2018 09:32:28 +0900 Subject: [PATCH 08/15] shallow merge --- src/helpers.ts | 25 ++++++++++++++++--------- src/index.ts | 2 +- src/widlprocess.ts | 1 - 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index f651d0489..a2dc7fa86 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -26,7 +26,7 @@ export function filterProperties(obj: Record, fn: (o: T) => boolea return result; } -export function merge(src: T, target: T): T { +export function merge(src: T, target: T, shallow?: boolean): T { if (typeof src !== "object" || typeof target !== "object") { return target; } @@ -42,7 +42,12 @@ export function merge(src: T, target: T): T { if (Array.isArray(srcProp) !== Array.isArray(targetProp)) { throw new Error("Mismatch on property: " + k + JSON.stringify(targetProp)); } - src[k] = merge(src[k], target[k]); + if (shallow && "name" in src[k] && "name" in target[k]) { + src[k] = target[k]; + } + else { + src[k] = merge(src[k], target[k], shallow); + } } } else { @@ -53,17 +58,19 @@ export function merge(src: T, target: T): T { return src; } -function mergeNamedArrays(srcProp: T[], targetProp: T[]) { +function mergeNamedArrays(srcProp: T[], targetProp: T[]) { const map: any = {}; for (const e1 of srcProp) { - if (e1.name) { - map[e1.name] = e1; + const name = e1.name || e1["new-type"]; + if (name) { + map[name] = e1; } } for (const e2 of targetProp) { - if (e2.name && map[e2.name]) { - merge(map[e2.name], e2); + const name = e2.name || e2["new-type"]; + if (name && map[name]) { + merge(map[name], e2); } else { srcProp.push(e2); @@ -116,7 +123,7 @@ export function isArray(value: any): value is ReadonlyArray<{}> { return Array.isArray ? Array.isArray(value) : value instanceof Array; } -export function flatMap(array: ReadonlyArray | undefined, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[] { +export function flatMap(array: ReadonlyArray | undefined, mapfn: (x: T, i: number) => U | ReadonlyArray | undefined): U[] { let result: U[] | undefined; if (array) { result = []; @@ -137,4 +144,4 @@ export function flatMap(array: ReadonlyArray | undefined, mapfn: (x: T, export function concat(a: T[] | undefined, b: T[] | undefined): T[] { return !a ? b || [] : a.concat(b || []); -} \ No newline at end of file +} diff --git a/src/index.ts b/src/index.ts index be50f8c35..a8cd7de25 100644 --- a/src/index.ts +++ b/src/index.ts @@ -92,7 +92,7 @@ function emitDom() { const knownWorkerTypes = new Set(require(path.join(inputFolder, "knownWorkerTypes.json"))); for (const w of widlStandardTypes) { - webidl = merge(webidl, w.browser); + webidl = merge(webidl, w.browser, true); } webidl = prune(webidl, removedItems); webidl = merge(webidl, addedItems); diff --git a/src/widlprocess.ts b/src/widlprocess.ts index e934b42c5..a5d714d4d 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -138,7 +138,6 @@ function convertArgument(arg: webidl2.Argument): Browser.Param { return { name: arg.name, ...convertIdlType(arg.idlType), - nullable: arg.idlType.nullable ? 1 : undefined, optional: arg.optional ? 1 : undefined, variadic: arg.variadic ? 1 : undefined, } From ae361a41b3cb6c13cae2b921f9002395c3b5aa43 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 13 Mar 2018 10:39:51 +0900 Subject: [PATCH 09/15] update baseline --- baselines/dom.generated.d.ts | 10 +++------- baselines/webworker.generated.d.ts | 5 ----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index bd62e605a..92f6a93ca 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -3122,7 +3122,6 @@ interface DOMException { readonly code: number; readonly message: string; readonly name: string; - toString(): string; readonly ABORT_ERR: number; readonly DATA_CLONE_ERR: number; readonly DOMSTRING_SIZE_ERR: number; @@ -3140,10 +3139,8 @@ interface DOMException { readonly NOT_SUPPORTED_ERR: number; readonly NO_DATA_ALLOWED_ERR: number; readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; readonly QUOTA_EXCEEDED_ERR: number; readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; readonly SYNTAX_ERR: number; readonly TIMEOUT_ERR: number; readonly TYPE_MISMATCH_ERR: number; @@ -3172,10 +3169,8 @@ declare var DOMException: { readonly NOT_SUPPORTED_ERR: number; readonly NO_DATA_ALLOWED_ERR: number; readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; readonly QUOTA_EXCEEDED_ERR: number; readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; readonly SYNTAX_ERR: number; readonly TIMEOUT_ERR: number; readonly TYPE_MISMATCH_ERR: number; @@ -13102,7 +13097,7 @@ interface TextDecoder { readonly encoding: string; readonly fatal: boolean; readonly ignoreBOM: boolean; - decode(input?: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer | null, options?: TextDecodeOptions): string; + decode(input?: BufferSource, options?: TextDecodeOptions): string; } declare var TextDecoder: { @@ -15928,6 +15923,8 @@ declare function addEventListener(type: K, liste declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; declare function removeEventListener(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions): void; declare function removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +type BufferSource = ArrayBufferView | ArrayBuffer; +type DOMTimeStamp = number; type ScrollBehavior = "auto" | "instant" | "smooth"; type ScrollLogicalPosition = "start" | "center" | "end" | "nearest"; type MouseWheelEvent = WheelEvent; @@ -15970,7 +15967,6 @@ type RTCTransport = RTCDtlsTransport | RTCSrtpSdesTransport; type RequestInfo = Request | string; type USVString = string; type payloadtype = number; -type BufferSource = ArrayBuffer | ArrayBufferView; type ClientTypes = "window" | "worker" | "sharedworker" | "all"; type AppendMode = "segments" | "sequence"; type AudioContextLatencyCategory = "balanced" | "interactive" | "playback"; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index abdfd73b4..0218ebecf 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -358,7 +358,6 @@ interface DOMException { readonly code: number; readonly message: string; readonly name: string; - toString(): string; readonly ABORT_ERR: number; readonly DATA_CLONE_ERR: number; readonly DOMSTRING_SIZE_ERR: number; @@ -376,10 +375,8 @@ interface DOMException { readonly NOT_SUPPORTED_ERR: number; readonly NO_DATA_ALLOWED_ERR: number; readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; readonly QUOTA_EXCEEDED_ERR: number; readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; readonly SYNTAX_ERR: number; readonly TIMEOUT_ERR: number; readonly TYPE_MISMATCH_ERR: number; @@ -408,10 +405,8 @@ declare var DOMException: { readonly NOT_SUPPORTED_ERR: number; readonly NO_DATA_ALLOWED_ERR: number; readonly NO_MODIFICATION_ALLOWED_ERR: number; - readonly PARSE_ERR: number; readonly QUOTA_EXCEEDED_ERR: number; readonly SECURITY_ERR: number; - readonly SERIALIZE_ERR: number; readonly SYNTAX_ERR: number; readonly TIMEOUT_ERR: number; readonly TYPE_MISMATCH_ERR: number; From edea22364ce7c4899908e89240b06fe5b8183913 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 Apr 2018 08:52:31 +0900 Subject: [PATCH 10/15] helpers.getEmptyWebIDL --- src/helpers.ts | 28 ++++++++++++++++++++++++++++ src/index.ts | 28 +--------------------------- src/widlprocess.ts | 15 ++------------- 3 files changed, 31 insertions(+), 40 deletions(-) diff --git a/src/helpers.ts b/src/helpers.ts index a2dc7fa86..4c1a174c6 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,3 +1,5 @@ +import * as Browser from "./types"; + export function filter(obj: any, fn: (o: any, n: string | undefined) => boolean): any { if (typeof obj === "object") { if (Array.isArray(obj)) { @@ -145,3 +147,29 @@ export function flatMap(array: ReadonlyArray | undefined, mapfn: (x: T, export function concat(a: T[] | undefined, b: T[] | undefined): T[] { return !a ? b || [] : a.concat(b || []); } + +export function getEmptyWebIDL(): Browser.WebIdl { + return { + "callback-functions": { + "callback-function": {} + }, + "callback-interfaces": { + "interface": {} + }, + "dictionaries": { + "dictionary": {} + }, + "enums": { + "enum": {} + }, + "interfaces": { + "interface": {} + }, + "mixins": { + "mixin": {} + }, + "typedefs": { + "typedef": [] + } + } +} diff --git a/src/index.ts b/src/index.ts index a8cd7de25..c94d8feee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ import * as Browser from "./types"; import * as fs from "fs"; import * as path from "path"; -import { filter, merge, filterProperties } from "./helpers"; +import { filter, merge, filterProperties, getEmptyWebIDL } from "./helpers"; import { Flavor, emitWebIDl } from "./emitter"; import { convert } from "./widlprocess"; @@ -37,32 +37,6 @@ function emitES6DomIterators(webidl: Browser.WebIdl, tsWebES6Output: string) { fs.writeFileSync(tsWebES6Output, emitWebIDl(webidl, Flavor.ES6Iterators)); } -function getEmptyWebIDL(): Browser.WebIdl { - return { - "callback-functions": { - "callback-function": {} - }, - "callback-interfaces": { - "interface": {} - }, - "dictionaries": { - "dictionary": {} - }, - "enums": { - "enum": {} - }, - "interfaces": { - "interface": {} - }, - "mixins": { - "mixin": {} - }, - "typedefs": { - "typedef": [] - } - } -} - function emitDom() { const __SOURCE_DIRECTORY__ = __dirname; const inputFolder = path.join(__SOURCE_DIRECTORY__, "../", "inputfiles"); diff --git a/src/widlprocess.ts b/src/widlprocess.ts index a5d714d4d..5a8470b66 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -1,10 +1,11 @@ import * as webidl2 from "webidl2"; import * as Browser from "./types"; +import { getEmptyWebIDL } from "./helpers"; export function convert(text: string) { const rootTypes = webidl2.parse(text); const partialInterfaces: Browser.Interface[] = []; - const browser = createEmptyBrowserWebidl(); + const browser = getEmptyWebIDL(); for (const rootType of rootTypes) { if (rootType.type === "interface") { const converted = convertInterface(rootType); @@ -226,15 +227,3 @@ function convertIdlType(i: webidl2.IDLTypeDescription): Browser.Typed { } throw new Error("Unsupported IDL type structure"); } - -function createEmptyBrowserWebidl(): Browser.WebIdl { - return { - "callback-functions": { "callback-function": {} }, - "callback-interfaces": { interface: {} }, - dictionaries: { dictionary: {} }, - enums: { enum: {} }, - interfaces: { interface: {} }, - mixins: { mixin: {} }, - typedefs: { typedef: [] } - } -} From f39257b025d8b50a941d9dbe5c2957b051c8fa45 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 Apr 2018 08:56:54 +0900 Subject: [PATCH 11/15] use require() to read json --- src/fetcher.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fetcher.ts b/src/fetcher.ts index 0a2b1a86e..608ce756a 100644 --- a/src/fetcher.ts +++ b/src/fetcher.ts @@ -1,4 +1,5 @@ import * as fs from "fs"; +import * as path from "path"; import fetch from "node-fetch"; import { JSDOM } from "jsdom"; @@ -10,11 +11,10 @@ interface IDLSource { } async function fetchIDLs() { - const file = fs.readFileSync(`${__dirname}/../inputfiles/idlSources.json`, { encoding: "utf-8" }); - const idlSources = JSON.parse(file) as IDLSource[]; + const idlSources = require("../inputfiles/idlSources.json") as IDLSource[]; for (const source of idlSources) { const idl = await fetchIDL(source); - fs.writeFileSync(`${__dirname}/../inputfiles/idl/${source.title}.widl`, idl + '\n'); + fs.writeFileSync(path.join(__dirname, `../inputfiles/idl/${source.title}.widl`), idl + '\n'); } } From 6be5890a0cd19a8274d4db338d6777e4eb75309f Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 Apr 2018 09:42:07 +0900 Subject: [PATCH 12/15] update webidl2 --- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index a7ba50fe2..962ff0660 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,9 +32,9 @@ "integrity": "sha512-vOVmaruQG5EatOU/jM6yU2uCp3Lz6mK1P5Ztu4iJjfM4SVHU9XYktPUQtKlIXuahqXHdEyUarMrBEwg5Cwu+bA==" }, "@types/webidl2": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/@types/webidl2/-/webidl2-10.2.0.tgz", - "integrity": "sha512-npmi7XRcxUjUjtXsWTOomfCaC9mttf/gL6x/tvJgxj28qZzEM5Tx2W06b5S4gLGy0XNwriKvO9rTk01ABzlE+w==" + "version": "10.2.1", + "resolved": "https://registry.npmjs.org/@types/webidl2/-/webidl2-10.2.1.tgz", + "integrity": "sha512-sMGNhws5oE4YPgw+PuSsvi5RUODXr5e4fy5UQW5CZ6oEWIJzsXFyzg9A45JYqVjq6vrdmtLTJsbOcjvOPKMsVA==" }, "abab": { "version": "1.0.4", @@ -2043,9 +2043,9 @@ } }, "typescript": { - "version": "2.8.0-dev.20180308", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.8.0-dev.20180308.tgz", - "integrity": "sha512-UI8bxYQmgCSdS+Keh7w7KTXSbsJ56GFRHeNxhpAyhrEuP5Tf8pikoAa71UaPXZJBWnP0ZAscHlXjrPlrfwk4Jg==" + "version": "2.9.0-dev.20180404", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.0-dev.20180404.tgz", + "integrity": "sha512-UdM6mevKwRvKuBeZqJVuJH7KMqcWII7hO0Wy1hoSv6XFBysKmEVaCS7nImOaz7bubLeKMXpP/dZIsHZRZWg5Dg==" }, "util-deprecate": { "version": "1.0.2", @@ -2081,9 +2081,9 @@ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" }, "webidl2": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/webidl2/-/webidl2-10.2.0.tgz", - "integrity": "sha512-qSTGkql9gLhtju/LuboiQs7o/NYa62EI+cWmhYGsJfFEZqcLXGBH3QwZ926c+JAa/5tteG2lHjG0p3HuL4B3lQ==" + "version": "10.3.1", + "resolved": "https://registry.npmjs.org/webidl2/-/webidl2-10.3.1.tgz", + "integrity": "sha512-n6y1kwIWZB8VHgPeTCzp3qVwmz/Wilbquni2t23Sin3xU8tfhjh9EUTwYNpD406EXPVG1oDzmt+12Bu02Hm1aA==" }, "whatwg-encoding": { "version": "1.0.3", diff --git a/package.json b/package.json index ff25facb4..1ed27a45a 100644 --- a/package.json +++ b/package.json @@ -11,11 +11,11 @@ "@types/jsdom": "^11.0.4", "@types/node": "^9.4.6", "@types/node-fetch": "^1.6.7", - "@types/webidl2": "^10.2.0", + "@types/webidl2": "^10.2.1", "cpx": "^1.5.0", "jsdom": "^11.6.2", "node-fetch": "^2.1.1", "typescript": "next", - "webidl2": "^10.2.0" + "webidl2": "^10.3.1" } } From 57918a3598aeb8a0bf4f67cfb6a87a7bc32685e4 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 Apr 2018 09:50:16 +0900 Subject: [PATCH 13/15] skiplibcheck so that jsdom won't fail --- src/test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test.ts b/src/test.ts index f66aba914..4ec47074c 100644 --- a/src/test.ts +++ b/src/test.ts @@ -26,7 +26,7 @@ function compareToBaselines() { function compileGeneratedFile(file: string) { try { - child_process.execSync(`node ${tscPath} --strict --lib es5 --noEmit ${path.join(outputFolder, file)}`); + child_process.execSync(`node ${tscPath} --strict --lib es5 --skipLibCheck --noEmit ${path.join(outputFolder, file)}`); } catch (e) { console.error(`Test failed: could not compile '${file}':`); console.error(e.stdout.toString()); @@ -46,4 +46,4 @@ function test() { process.exit(1); } -test(); \ No newline at end of file +test(); From c3d4f8a86741ea2f3138ee8e29ebabb0901ff7bb Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 5 Apr 2018 09:56:56 +0900 Subject: [PATCH 14/15] check for anonymous operations --- src/widlprocess.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widlprocess.ts b/src/widlprocess.ts index 5a8470b66..17bf7f09e 100644 --- a/src/widlprocess.ts +++ b/src/widlprocess.ts @@ -112,10 +112,13 @@ function getConstructor(extAttrs: webidl2.ExtendedAttributes[], parent: string) } function convertOperation(operation: webidl2.OperationMemberType): Browser.Method { + if (!operation.name || !operation.idlType) { + throw new Error("Unexpected anonymous operation"); + } return { - name: operation.name!, + name: operation.name, signature: [{ - ...convertIdlType(operation.idlType!), + ...convertIdlType(operation.idlType), param: operation.arguments.map(convertArgument) }], getter: operation.getter ? 1 : undefined, From d7f1852657371223790988047081428ae09a5a84 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 5 Apr 2018 09:38:08 -0700 Subject: [PATCH 15/15] use `--types` to avoid compiling `@types` packages when testing the generated file --- src/test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test.ts b/src/test.ts index 4ec47074c..a61b9bf95 100644 --- a/src/test.ts +++ b/src/test.ts @@ -26,7 +26,7 @@ function compareToBaselines() { function compileGeneratedFile(file: string) { try { - child_process.execSync(`node ${tscPath} --strict --lib es5 --skipLibCheck --noEmit ${path.join(outputFolder, file)}`); + child_process.execSync(`node ${tscPath} --strict --lib es5 --types --noEmit ${path.join(outputFolder, file)}`); } catch (e) { console.error(`Test failed: could not compile '${file}':`); console.error(e.stdout.toString());